diff --git a/framework/control.class.php b/framework/control.class.php index 48ed03ffbe..e896847264 100755 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -217,7 +217,7 @@ class control $modelFile = helper::setModelFile($moduleName); /* If no model file, try load config. */ - if(!file_exists($modelFile)) + if(!helper::import($modelFile)) { $this->app->loadConfig($moduleName, false); $this->app->loadLang($moduleName); @@ -225,7 +225,6 @@ class control return false; } - helper::import($modelFile); $modelClass = class_exists('ext' . $moduleName. 'model') ? 'ext' . $moduleName . 'model' : $moduleName . 'model'; if(!class_exists($modelClass)) $this->app->error(" The model $modelClass not found", __FILE__, __LINE__, $exit = true); @@ -274,7 +273,7 @@ class control $extHookFiles = helper::ls($viewExtPath, '.hook.php'); $viewFile = file_exists($extViewFile) ? $extViewFile : $mainViewFile; - if(!file_exists($viewFile)) $this->app->error("the view file $viewFile not found", __FILE__, __LINE__, $exit = true); + if(!is_file($viewFile)) $this->app->error("the view file $viewFile not found", __FILE__, __LINE__, $exit = true); if(!empty($extHookFiles)) return array('viewFile' => $viewFile, 'hookFiles' => $extHookFiles); return $viewFile; } @@ -316,7 +315,7 @@ class control $mainCssFile = $modulePath . 'css' . $this->pathFix . 'common.css'; $methodCssFile = $modulePath . 'css' . $this->pathFix . $methodName . '.css'; if(file_exists($mainCssFile)) $css .= file_get_contents($mainCssFile); - if(file_exists($methodCssFile)) $css .= file_get_contents($methodCssFile); + if(is_file($methodCssFile)) $css .= file_get_contents($methodCssFile); return $css; } @@ -338,7 +337,7 @@ class control $mainJsFile = $modulePath . 'js' . $this->pathFix . 'common.js'; $methodJsFile = $modulePath . 'js' . $this->pathFix . $methodName . '.js'; if(file_exists($mainJsFile)) $js .= file_get_contents($mainJsFile); - if(file_exists($methodJsFile)) $js .= file_get_contents($methodJsFile); + if(is_file($methodJsFile)) $js .= file_get_contents($methodJsFile); return $js; } @@ -477,7 +476,7 @@ class control $file2Included = file_exists($actionExtFile) ? $actionExtFile : $moduleControlFile; /* Load the control file. */ - if(!file_exists($file2Included)) $this->app->error("The control file $file2Included not found", __FILE__, __LINE__, $exit = true); + if(!is_file($file2Included)) $this->app->error("The control file $file2Included not found", __FILE__, __LINE__, $exit = true); $currentPWD = getcwd(); chdir(dirname($file2Included)); if($moduleName != $this->moduleName) helper::import($file2Included); diff --git a/framework/helper.class.php b/framework/helper.class.php index dee92b80b4..1153e5baf1 100644 --- a/framework/helper.class.php +++ b/framework/helper.class.php @@ -118,7 +118,7 @@ class helper */ static public function import($file) { - if(!file_exists($file)) return false; + if(!is_file($file)) return false; static $includedFiles = array(); if(!isset($includedFiles[$file])) { @@ -126,7 +126,7 @@ class helper $includedFiles[$file] = true; return true; } - return false; + return true; } /** @@ -337,7 +337,6 @@ class helper if(!file_exists($issueFile) or !is_readable($issueFile)) return false; return stripos(file_get_contents($issueFile), 'centos') !== false; } - } /** diff --git a/framework/model.class.php b/framework/model.class.php index 4fec21499d..e816fe9130 100755 --- a/framework/model.class.php +++ b/framework/model.class.php @@ -175,9 +175,8 @@ class model { if(empty($moduleName)) return false; $modelFile = helper::setModelFile($moduleName); - if(!file_exists($modelFile)) return false; - helper::import($modelFile); + if(!helper::import($modelFile)) return false; $modelClass = class_exists('ext' . $moduleName. 'model') ? 'ext' . $moduleName . 'model' : $moduleName . 'model'; if(!class_exists($modelClass)) $this->app->error(" The model $modelClass not found", __FILE__, __LINE__, $exit = true); diff --git a/framework/router.class.php b/framework/router.class.php index 6dcef42bbe..14cd6ac89b 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -960,7 +960,7 @@ class router public function setControlFile($exitIfNone = true) { $this->controlFile = $this->moduleRoot . $this->moduleName . $this->pathFix . 'control.php'; - if(!file_exists($this->controlFile)) + if(!is_file($this->controlFile)) { $this->error("the control file $this->controlFile not found.", __FILE__, __LINE__, $exitIfNone); return false; @@ -1324,13 +1324,13 @@ class router if(is_dir($classFile)) $classFile .= $this->pathFix . $className; $classFile .= '.class.php'; - if(!file_exists($classFile)) + if(!is_file($classFile)) { /* Search in $coreLibRoot. */ $classFile = $this->coreLibRoot . $className; if(is_dir($classFile)) $classFile .= $this->pathFix . $className; $classFile .= '.class.php'; - if(!file_exists($classFile)) $this->error("class file $classFile not found", __FILE__, __LINE__, $exit = true); + if(!is_file($classFile)) $this->error("class file $classFile not found", __FILE__, __LINE__, $exit = true); } helper::import($classFile); @@ -1364,7 +1364,7 @@ class router { $mainConfigFile = $this->configRoot . 'config.php'; $myConfig = $this->configRoot . 'my.php'; - if(file_exists($myConfig)) $extConfigFiles[] = $myConfig; + if(is_file($myConfig)) $extConfigFiles[] = $myConfig; } else { @@ -1374,7 +1374,7 @@ class router } /* Set the files to include. */ - if(!file_exists($mainConfigFile)) + if(!is_file($mainConfigFile)) { if($exitIfNone) self::error("config file $mainConfigFile not found", __FILE__, __LINE__, true); if(empty($extConfigFiles)) return false; // and no extension file, exit. @@ -1434,7 +1434,7 @@ class router $extLangFiles = helper::ls($extLangPath . $this->clientLang, '.php'); /* Set the files to includ. */ - if(!file_exists($mainLangFile)) + if(!is_file($mainLangFile)) { if(empty($extLangFiles)) return false; // also no extension file. $langFiles = $extLangFiles;