index.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. define("FANWE_REQUIRE",true);
  3. require_once '../system/mapi_init.php';
  4. fanwe_require(APP_ROOT_PATH.'mapi/lib/redis/BaseRedisService.php');
  5. require APP_ROOT_PATH.'system/template/template.php';
  6. $tmpl = new AppTemplate;
  7. $GLOBALS['tmpl']->cache_dir = APP_ROOT_PATH . 'public/runtime/app_index/tpl_caches';
  8. $GLOBALS['tmpl']->compile_dir = APP_ROOT_PATH . 'public/runtime/app_index/tpl_compiled';
  9. $GLOBALS['tmpl']->template_dir = APP_ROOT_PATH . 'app_index/theme/view';
  10. $GLOBALS['tmpl']->assign("TMPL_REAL",APP_ROOT_PATH."app_index/theme/view");
  11. $tmpl_path = get_domain().APP_ROOT."/theme";
  12. $GLOBALS['tmpl']->assign("TMPL",$tmpl_path);
  13. $jstmpl_path = get_domain().PAP_ROOT."/app_index/";
  14. $GLOBALS['tmpl']->assign("JSTMPL",$jstmpl_path);
  15. fanwe_require(APP_ROOT_PATH.'app_index/lib/core/common.php');
  16. fanwe_require(APP_ROOT_PATH.'mapi/lib/core/common.php');
  17. filter_injection($_REQUEST);
  18. $_REQUEST['ctl'] = filter_ma_request($_REQUEST['ctl']);
  19. $_REQUEST['act'] = filter_ma_request($_REQUEST['act']);
  20. $search = array("../","\n","\r","\t","\r\n","'","<",">","\"","%","\\",".","/");
  21. $itype = str_replace($search,"",$_REQUEST['itype']);
  22. $class = strtolower(strim($_REQUEST['ctl']))?strtolower(strim($_REQUEST['ctl'])):"index";
  23. $class_name = $class;
  24. $lib = $itype?$itype:'app_index';
  25. if($lib=='lib'){
  26. fanwe_require(APP_ROOT_PATH."mapi/lib/base.action.php");
  27. @fanwe_require(APP_ROOT_PATH."mapi/lib/".$class.".action.php");
  28. $class=$class.'Module';
  29. }else{
  30. fanwe_require(APP_ROOT_PATH."mapi/lib/base.action.php");
  31. fanwe_require(APP_ROOT_PATH."mapi/".$lib."/base.action.php");
  32. fanwe_require(APP_ROOT_PATH."mapi/".$lib."/".$class.".action.php");
  33. $class=$class.'CModule';
  34. }
  35. $act = strtolower(strim($_REQUEST['act']))?strtolower(strim($_REQUEST['act'])):"index";
  36. $GLOBALS['tmpl']->assign("ctl",$class_name);
  37. $GLOBALS['tmpl']->assign("act",$act);
  38. if(class_exists($class)){
  39. $obj = new $class;
  40. if(method_exists($obj, $act)){
  41. $obj->$act();
  42. }
  43. else{
  44. $error["errcode "] = 10006;
  45. $error["errmsg "] = "接口方法不存在";
  46. ajax_return($error);
  47. }
  48. }
  49. else{
  50. $error["errcode "] = 10005;
  51. $error["errmsg "] = "接口不存在";
  52. ajax_return($error);
  53. }
  54. ?>