From 8f3df543230cd4403368b39b9bbe5726d11a0284 Mon Sep 17 00:00:00 2001 From: chengkun <chengkun@ishangstudy.com> Date: Mon, 26 May 2025 10:57:49 +0800 Subject: [PATCH] 提交 --- app/include/init.php | 124 ++++++++++++++++++++--------------------- 1 files changed, 60 insertions(+), 64 deletions(-) diff --git a/app/include/init.php b/app/include/init.php index 481df80..93f144a 100644 --- a/app/include/init.php +++ b/app/include/init.php @@ -1,32 +1,28 @@ <?php - - - /** * 伪静态操作start */ +//urlRewrite(); + if (isset($_GET['yunurl']) && $_GET['yunurl']) { - - $var = @explode('-', str_replace('/', '-', $_GET['yunurl'])); - + $var = @explode('-', str_replace('/', '-', $_GET['yunurl'])); foreach ($var as $p) { - - $param = @explode('_', $p); - $_GET[$param[0]] = $param[1]; + $param = @explode('_', $p); + $_GET[$param[0]] = $param[1]; } unset($_GET['yunurl']); } -if ($_GET['ivk_sa']){ +if ($_GET['ivk_sa']) { unset($_GET['ivk_sa']); } if (isset($_GET['c']) && $_GET['c'] && !preg_match('/^[a-zA-Z0-9_]+$/', $_GET['c'])) { - $_GET['c'] = 'index'; + $_GET['c'] = 'index'; } if (isset($_GET['a']) && $_GET['a'] && !preg_match('/^[a-zA-Z0-9_]+$/', $_GET['a'])) { - $_GET['a'] = 'index'; + $_GET['a'] = 'index'; } @@ -35,10 +31,10 @@ */ global $ModuleName, $DirName; -$Loaction = wapJump($config); +$Loaction = wapJump($config); if (!empty($Loaction)) { - + header('Location: ' . $Loaction); exit; } @@ -46,30 +42,30 @@ /** * 页面缓存开启 */ -include(PLUS_PATH.'cache.config.php'); // 缓存配置文件 +include(PLUS_PATH . 'cache.config.php'); // 缓存配置文件 if ($config['webcache'] == '1') { - + if (isMobileUser()) { // wap端缓存 - + if ($_GET['c'] != 'resume' && $_GET['a'] != 'show') { if ($cache_config['sy_' . $_GET['c'] . '_cache'] == '1') { - + include_once(LIB_PATH . 'web.cache.php'); - $cache = new Phpyun_Cache('./cache', DATA_PATH, $config['webcachetime']); + $cache = new Phpyun_Cache('./cache', DATA_PATH, $config['webcachetime']); $cache->read_cache(); } } } else { // PC端缓存 - + if ($ModuleName != 'resume' && $_GET['c'] != 'show') { - + if ($ModuleName != 'wap' && $_GET['c'] != 'resume' && $_GET['a'] != 'show') { - + if ($cache_config['sy_' . $ModuleName . '_cache'] == '1' && $_GET['c'] != 'clickhits') { - + include_once(LIB_PATH . 'web.cache.php'); - $cache = new Phpyun_Cache('./cache', DATA_PATH, $config['webcachetime']); + $cache = new Phpyun_Cache('./cache', DATA_PATH, $config['webcachetime']); $cache->read_cache(); } } @@ -78,12 +74,12 @@ } // 参数$_GET['c']为控制器名称 -$ControllerName = isset($_GET['c']) ? $_GET['c'] : ''; +$ControllerName = isset($_GET['c']) ? $_GET['c'] : ''; // 默认情况下,调用控制器index.class.php if ($ControllerName == '') $ControllerName = 'index'; // 参数$_GET['a']为执行的操作函数名称 -$ActionName = isset($_GET['a']) ? $_GET['a'] : ''; +$ActionName = isset($_GET['a']) ? $_GET['a'] : ''; // 默认情况下,调用操作函数index_action if ($ActionName == '') $ActionName = 'index'; @@ -91,84 +87,84 @@ // 开启二级目录访问的情况下不允许通过$_GET['m']访问该模块 // 未在后台做配置的模块,默认可以访问 -if (isset($config['sy_'.$ModuleName.'_web']) && $config['sy_'.$ModuleName.'_web'] == 2) { +if (isset($config['sy_' . $ModuleName . '_web']) && $config['sy_' . $ModuleName . '_web'] == 2) { //echo '此模块未开启!';die; - header('Location: '.Url("error")); + header('Location: ' . Url("error")); exit; } // wap站的模块需要单独处理 if ($ModuleName == 'wap') { - if (isset($config['sy_'.$ControllerName.'_web']) && $config['sy_'.$ControllerName.'_web'] == 2) { - header('Location: '.Url("error")); + if (isset($config['sy_' . $ControllerName . '_web']) && $config['sy_' . $ControllerName . '_web'] == 2) { + header('Location: ' . Url("error")); exit; } } // 未在后台做配置的模块,默认使用入口文件中指定的模块 // 当前模块的控制器目录 -$ControllerPath = APP_PATH.'app/controller/'.$ModuleName.'/'; -require(APP_PATH.'app/public/common.php'); +$ControllerPath = APP_PATH . 'app/controller/' . $ModuleName . '/'; +require(APP_PATH . 'app/public/common.php'); //引用当前模块的控制器公共文件,当此模块不需要公共函数时,可不写公共控制器 //相应的各控制应当直接继承common类 if (in_array(strtolower($ModuleName), array('siteadmin', 'wapadmin'))) { - - include(PLUS_PATH."/admindir.php"); + + include(PLUS_PATH . "/admindir.php"); if ($admindir) { - - require(APP_PATH.$admindir.'/adminCommon.class.php'); + + require(APP_PATH . $admindir . '/adminCommon.class.php'); } else { - - require(APP_PATH.'admin/adminCommon.class.php'); + + require(APP_PATH . 'admin/adminCommon.class.php'); } } -if (file_exists($ControllerPath.$ModuleName.'.controller.php')) { - require($ControllerPath.$ModuleName.'.controller.php'); +if (file_exists($ControllerPath . $ModuleName . '.controller.php')) { + require($ControllerPath . $ModuleName . '.controller.php'); } // 判断$_GET['c']指向的控制器是否存在,如不存在,则引用index.class.php -if (file_exists($ControllerPath.$ControllerName.'.class.php')) { - - require($ControllerPath.$ControllerName.'.class.php'); +if (file_exists($ControllerPath . $ControllerName . '.class.php')) { + + require($ControllerPath . $ControllerName . '.class.php'); } else { - + // $_GET['c']指向的控制器不存在,则引用index.class.php // 调用$_GET['c']指向的操作函数,即将$_GET['c']作为$_GET['a']来调用 - $ActionName = $ControllerName; - $ControllerName = 'index'; - if (!file_exists($ControllerPath.$ControllerName.'.class.php')) { - + $ActionName = $ControllerName; + $ControllerName = 'index'; + if (!file_exists($ControllerPath . $ControllerName . '.class.php')) { + //echo '此模块不存在!';die; - header('Location: '.Url("error")); + header('Location: ' . Url("error")); exit; } else { - - require($ControllerPath.'index.class.php'); + + require($ControllerPath . 'index.class.php'); } } if ($ModuleName == 'siteadmin') { - - $model = 'admin'; + + $model = 'admin'; } elseif ($ModuleName == 'wap') { - - $model = 'wap'; + + $model = 'wap'; } elseif ($ModuleName == 'wapadmin') { - - $model = 'wapadmin'; + + $model = 'wapadmin'; } else { - - $model = 'index'; + + $model = 'index'; } //控制器名称 -$conclass = $ControllerName.'_controller'; +$conclass = $ControllerName . '_controller'; //执行的操作函数名称 -$actfunc = $ActionName.'_action'; +$actfunc = $ActionName . '_action'; -$views = new $conclass($phpyun, $db, $db_config['def'], $model, $ModuleName); -$views->m = $ModuleName; +$views = new $conclass($phpyun, $db, $db_config['def'], $model, $ModuleName); +$views->m = $ModuleName; if (!method_exists($views, $actfunc)) { $views->DoException(); } @@ -176,7 +172,7 @@ $views->$actfunc(); if (isset($cache)) { - + $cache->CacheCreate(); } -- Gitblit v1.9.0