index.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. define("FANWE_REQUIRE",true);
  3. if(isset($_REQUEST['cstype']) && $_REQUEST['cstype']==1){
  4. require_once '../system/wap_init.php';
  5. }else{
  6. require_once '../system/mapi_init.php';
  7. }
  8. fanwe_require(APP_ROOT_PATH.'mapi/lib/redis/BaseRedisService.php');
  9. require APP_ROOT_PATH.'system/template/template.php';
  10. $tmpl = new AppTemplate;
  11. $GLOBALS['tmpl']->cache_dir = APP_ROOT_PATH . 'public/runtime/wap/tpl_caches';
  12. $GLOBALS['tmpl']->compile_dir = APP_ROOT_PATH . 'public/runtime/wap/tpl_compiled';
  13. $GLOBALS['tmpl']->template_dir = APP_ROOT_PATH . 'wap/theme/default';
  14. $GLOBALS['tmpl']->assign("TMPL_REAL",APP_ROOT_PATH."wap/theme/default");
  15. $tmpl_path = get_domain().APP_ROOT."/wap/theme/";
  16. $GLOBALS['tmpl']->assign("TMPL",$tmpl_path."default");
  17. $jstmpl_path = get_domain().PAP_ROOT."/wap/";
  18. $GLOBALS['tmpl']->assign("JSTMPL",$jstmpl_path);
  19. // $mapi = get_domain()."/mapi/";
  20. // $GLOBALS['tmpl']->assign("mapi",$mapi);
  21. // $TMPL = get_domain()."/wap/";
  22. // $GLOBALS['tmpl']->assign("TMPL",$TMPL);
  23. fanwe_require(APP_ROOT_PATH.'wap/lib/core/common.php');
  24. fanwe_require(APP_ROOT_PATH.'mapi/lib/core/common.php');
  25. filter_injection($_REQUEST);
  26. //会员自动登录及输出
  27. $cookie_uid = es_cookie::get("user_id")?es_cookie::get("user_id"):'';
  28. $cookie_upwd = es_cookie::get("user_pwd")?es_cookie::get("user_pwd"):'';
  29. if($cookie_uid!=''&&$cookie_upwd!=''&&!es_session::get("user_info"))
  30. {
  31. fanwe_require(APP_ROOT_PATH."system/libs/user.php");
  32. auto_do_login_user($cookie_uid,$cookie_upwd);
  33. }
  34. //用户信息
  35. global $user_info;
  36. $user_info = es_session::get('user_info');
  37. if (!$user_info && isset($_REQUEST['cstype'])){
  38. $cstype = $_REQUEST['cstype'];
  39. if (intval($cstype) > 0 ){
  40. $sql = "select * from ".DB_PREFIX."user where id=".intval($cstype);
  41. }else{
  42. $sql = "select * from ".DB_PREFIX."user where id=100324";
  43. }
  44. // es_session::set("user_info",$user_info);
  45. $user_info = $GLOBALS['db']->getRow($sql);
  46. //print_r($user_info);
  47. }else{
  48. //print_r($user_info);
  49. }
  50. $cstype = $_REQUEST['cstype'];
  51. if(!$user_info&&$cstype !=''){
  52. if (intval($cstype) > 0){
  53. $user_info = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."user where id=".intval($cstype));
  54. }else{
  55. $user_info = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."user where id=290");
  56. }
  57. // es_session::set("user_info",$user_info);
  58. }
  59. $_REQUEST['ctl'] = filter_ma_request($_REQUEST['ctl']);
  60. $_REQUEST['act'] = filter_ma_request($_REQUEST['act']);
  61. $class = strtolower(strim($_REQUEST['ctl']))?strtolower(strim($_REQUEST['ctl'])):"index";
  62. $class_name = $class;
  63. $act = strtolower(strim($_REQUEST['act']))?strtolower(strim($_REQUEST['act'])):"index";
  64. fanwe_require(APP_ROOT_PATH."mapi/lib/base.action.php");
  65. fanwe_require(APP_ROOT_PATH."mapi/lib/".$class.".action.php");
  66. $class=$class.'Module';
  67. if(class_exists($class)){
  68. $obj = new $class;
  69. if(method_exists($obj, $act)){
  70. $obj->$act();
  71. }
  72. else{
  73. $error["errcode "] = 10006;
  74. $error["errmsg "] = "接口方法不存在";
  75. ajax_return($error);
  76. }
  77. }
  78. else{
  79. $error["errcode "] = 10005;
  80. $error["errmsg "] = "接口不存在";
  81. ajax_return($error);
  82. }
  83. ?>