* code for task #2464.
This commit is contained in:
@@ -137,14 +137,6 @@ class control
|
||||
*/
|
||||
private $output;
|
||||
|
||||
/**
|
||||
* The directory seperator.
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $pathFix;
|
||||
|
||||
/**
|
||||
* The prefix of view file for mobile or PC.
|
||||
*
|
||||
@@ -171,7 +163,6 @@ class control
|
||||
$this->config = $config;
|
||||
$this->lang = $lang;
|
||||
$this->dbh = $dbh;
|
||||
$this->pathFix = $this->app->getPathFix();
|
||||
$this->viewType = $this->app->getViewType();
|
||||
|
||||
/* Load the model file auto. */
|
||||
@@ -295,7 +286,7 @@ class control
|
||||
if(isset($this->config->viewPrefix[$this->viewType])) $viewType = 'html';
|
||||
|
||||
/* The main view file, extension view file and hook file. */
|
||||
$mainViewFile = $modulePath . 'view' . $this->pathFix . $this->viewPrefix . $methodName . '.' . $viewType . '.php';
|
||||
$mainViewFile = $modulePath . 'view' . DS . $this->viewPrefix . $methodName . '.' . $viewType . '.php';
|
||||
$extViewFile = $viewExtPath . $this->viewPrefix . $methodName . ".{$viewType}.php";
|
||||
$extHookFiles = glob($viewExtPath . $this->viewPrefix . $methodName . ".*.{$viewType}.hook.php");
|
||||
|
||||
@@ -337,12 +328,12 @@ class control
|
||||
$moduleName = strtolower(trim($moduleName));
|
||||
$methodName = strtolower(trim($methodName));
|
||||
$modulePath = $this->app->getModulePath($moduleName);
|
||||
$cssMethodExt = $this->app->getModuleExtPath($moduleName, 'css') . $methodName . $this->pathFix;
|
||||
$cssCommonExt = $this->app->getModuleExtPath($moduleName, 'css') . 'common' . $this->pathFix;
|
||||
$cssMethodExt = $this->app->getModuleExtPath($moduleName, 'css') . $methodName . DS;
|
||||
$cssCommonExt = $this->app->getModuleExtPath($moduleName, 'css') . 'common' . DS;
|
||||
|
||||
$css = '';
|
||||
$mainCssFile = $modulePath . 'css' . $this->pathFix . $this->viewPrefix . 'common.css';
|
||||
$methodCssFile = $modulePath . 'css' . $this->pathFix . $this->viewPrefix . $methodName . '.css';
|
||||
$mainCssFile = $modulePath . 'css' . DS . $this->viewPrefix . 'common.css';
|
||||
$methodCssFile = $modulePath . 'css' . DS . $this->viewPrefix . $methodName . '.css';
|
||||
if(file_exists($mainCssFile)) $css .= file_get_contents($mainCssFile);
|
||||
if(is_file($methodCssFile)) $css .= file_get_contents($methodCssFile);
|
||||
|
||||
@@ -379,12 +370,12 @@ class control
|
||||
$moduleName = strtolower(trim($moduleName));
|
||||
$methodName = strtolower(trim($methodName));
|
||||
$modulePath = $this->app->getModulePath($moduleName);
|
||||
$jsMethodExt = $this->app->getModuleExtPath($moduleName, 'js') . $methodName . $this->pathFix;
|
||||
$jsCommonExt = $this->app->getModuleExtPath($moduleName, 'js') . 'common' . $this->pathFix;
|
||||
$jsMethodExt = $this->app->getModuleExtPath($moduleName, 'js') . $methodName . DS;
|
||||
$jsCommonExt = $this->app->getModuleExtPath($moduleName, 'js') . 'common' . DS;
|
||||
|
||||
$js = '';
|
||||
$mainJsFile = $modulePath . 'js' . $this->pathFix . $this->viewPrefix . 'common.js';
|
||||
$methodJsFile = $modulePath . 'js' . $this->pathFix . $this->viewPrefix . $methodName . '.js';
|
||||
$mainJsFile = $modulePath . 'js' . DS . $this->viewPrefix . 'common.js';
|
||||
$methodJsFile = $modulePath . 'js' . DS . $this->viewPrefix . $methodName . '.js';
|
||||
if(file_exists($mainJsFile)) $js .= file_get_contents($mainJsFile);
|
||||
if(is_file($methodJsFile)) $js .= file_get_contents($methodJsFile);
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ class helper
|
||||
|
||||
/* Else, judge whether needed update or not .*/
|
||||
$needUpdate = false;
|
||||
$mergedModelFile = $app->getTmpRoot() . 'model' . $app->getPathFix() . $moduleName . '.php';
|
||||
$mergedModelFile = $app->getTmpRoot() . 'model' . DS . $moduleName . '.php';
|
||||
$lastTime = file_exists($mergedModelFile) ? filemtime($mergedModelFile) : 0;
|
||||
|
||||
while(!$needUpdate)
|
||||
@@ -237,7 +237,7 @@ class helper
|
||||
$modelLines = join("\n", $modelLines);
|
||||
}
|
||||
|
||||
$tmpMergedModelFile = $app->getTmpRoot() . 'model' . $app->getPathFix() . 'tmp.' . $moduleName . '.php';
|
||||
$tmpMergedModelFile = $app->getTmpRoot() . 'model' . DS . 'tmp.' . $moduleName . '.php';
|
||||
if(!@file_put_contents($tmpMergedModelFile, $modelLines))
|
||||
{
|
||||
die("ERROR: $tmpMergedModelFile not writable, please make sure the " . dirname($tmpMergedModelFile) . ' directory exists and writable');
|
||||
|
||||
+17
-36
@@ -17,14 +17,6 @@
|
||||
*/
|
||||
class router
|
||||
{
|
||||
/**
|
||||
* The directory seperator.
|
||||
*
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
private $pathFix;
|
||||
|
||||
/**
|
||||
* The base path of the ZenTaoPMS framework.
|
||||
*
|
||||
@@ -345,7 +337,7 @@ class router
|
||||
*/
|
||||
protected function setPathFix()
|
||||
{
|
||||
$this->pathFix = DIRECTORY_SEPARATOR;
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -356,7 +348,7 @@ class router
|
||||
*/
|
||||
protected function setBasePath()
|
||||
{
|
||||
$this->basePath = realpath(dirname(dirname(__FILE__))) . $this->pathFix;
|
||||
$this->basePath = realpath(dirname(dirname(__FILE__))) . DS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -367,7 +359,7 @@ class router
|
||||
*/
|
||||
protected function setFrameRoot()
|
||||
{
|
||||
$this->frameRoot = $this->basePath . 'framework' . $this->pathFix;
|
||||
$this->frameRoot = $this->basePath . 'framework' . DS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -378,7 +370,7 @@ class router
|
||||
*/
|
||||
protected function setCoreLibRoot()
|
||||
{
|
||||
$this->coreLibRoot = $this->basePath . 'lib' . $this->pathFix;
|
||||
$this->coreLibRoot = $this->basePath . 'lib' . DS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -393,11 +385,11 @@ class router
|
||||
{
|
||||
if(empty($appRoot))
|
||||
{
|
||||
$this->appRoot = $this->basePath . 'app' . $this->pathFix . $appName . $this->pathFix;
|
||||
$this->appRoot = $this->basePath . 'app' . DS . $appName . DS;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->appRoot = realpath($appRoot) . $this->pathFix;
|
||||
$this->appRoot = realpath($appRoot) . DS;
|
||||
}
|
||||
if(!is_dir($this->appRoot)) $this->triggerError("The app you call not found in {$this->appRoot}", __FILE__, __LINE__, $exit = true);
|
||||
}
|
||||
@@ -410,7 +402,7 @@ class router
|
||||
*/
|
||||
protected function setTmpRoot()
|
||||
{
|
||||
$this->tmpRoot = $this->appRoot . 'tmp' . $this->pathFix;
|
||||
$this->tmpRoot = $this->appRoot . 'tmp' . DS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -421,7 +413,7 @@ class router
|
||||
*/
|
||||
protected function setCacheRoot()
|
||||
{
|
||||
$this->cacheRoot = $this->tmpRoot . 'cache' . $this->pathFix;
|
||||
$this->cacheRoot = $this->tmpRoot . 'cache' . DS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -432,7 +424,7 @@ class router
|
||||
*/
|
||||
protected function setLogRoot()
|
||||
{
|
||||
$this->logRoot = $this->tmpRoot . 'log' . $this->pathFix;
|
||||
$this->logRoot = $this->tmpRoot . 'log' . DS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -443,7 +435,7 @@ class router
|
||||
*/
|
||||
protected function setConfigRoot()
|
||||
{
|
||||
$this->configRoot = $this->appRoot . 'config' . $this->pathFix;
|
||||
$this->configRoot = $this->appRoot . 'config' . DS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -454,7 +446,7 @@ class router
|
||||
*/
|
||||
protected function setModuleRoot()
|
||||
{
|
||||
$this->moduleRoot = $this->appRoot . 'module' . $this->pathFix;
|
||||
$this->moduleRoot = $this->appRoot . 'module' . DS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -465,7 +457,7 @@ class router
|
||||
*/
|
||||
protected function setThemeRoot()
|
||||
{
|
||||
$this->themeRoot = $this->appRoot . 'www' . $this->pathFix . 'theme' . $this->pathFix;
|
||||
$this->themeRoot = $this->appRoot . 'www' . DS . 'theme' . DS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -565,17 +557,6 @@ class router
|
||||
if(isset($this->config->timezone)) date_default_timezone_set($this->config->timezone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the $pathFix var
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getPathFix()
|
||||
{
|
||||
return $this->pathFix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the $basePath var
|
||||
*
|
||||
@@ -995,7 +976,7 @@ class router
|
||||
*/
|
||||
public function setControlFile($exitIfNone = true)
|
||||
{
|
||||
$this->controlFile = $this->moduleRoot . $this->moduleName . $this->pathFix . 'control.php';
|
||||
$this->controlFile = $this->moduleRoot . $this->moduleName . DS . 'control.php';
|
||||
if(!is_file($this->controlFile))
|
||||
{
|
||||
$this->triggerError("the control file $this->controlFile not found.", __FILE__, __LINE__, $exitIfNone);
|
||||
@@ -1026,7 +1007,7 @@ class router
|
||||
public function getModulePath($moduleName = '')
|
||||
{
|
||||
if($moduleName == '') $moduleName = $this->moduleName;
|
||||
return $this->getModuleRoot() . strtolower(trim($moduleName)) . $this->pathFix;
|
||||
return $this->getModuleRoot() . strtolower(trim($moduleName)) . DS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1039,7 +1020,7 @@ class router
|
||||
*/
|
||||
public function getModuleExtPath($moduleName, $ext)
|
||||
{
|
||||
return $this->getModuleRoot() . strtolower(trim($moduleName)) . $this->pathFix . 'ext' . $this->pathFix . $ext . $this->pathFix;
|
||||
return $this->getModuleRoot() . strtolower(trim($moduleName)) . DS . 'ext' . DS . $ext . DS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1351,7 +1332,7 @@ class router
|
||||
|
||||
/* Search in $coreLibRoot. */
|
||||
$classFile = $this->coreLibRoot . $className;
|
||||
if(is_dir($classFile)) $classFile .= $this->pathFix . $className;
|
||||
if(is_dir($classFile)) $classFile .= DS . $className;
|
||||
$classFile .= '.class.php';
|
||||
if(!helper::import($classFile)) $this->triggerError("class file $classFile not found", __FILE__, __LINE__, $exit = true);
|
||||
|
||||
@@ -1476,7 +1457,7 @@ class router
|
||||
public function loadLang($moduleName)
|
||||
{
|
||||
$modulePath = $this->getModulePath($moduleName);
|
||||
$mainLangFile = $modulePath . 'lang' . $this->pathFix . $this->clientLang . '.php';
|
||||
$mainLangFile = $modulePath . 'lang' . DS . $this->clientLang . '.php';
|
||||
$extLangPath = $this->getModuleExtPath($moduleName, 'lang');
|
||||
$extLangFiles = helper::ls($extLangPath . $this->clientLang, '.php');
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class bugfreeConvertModel extends convertModel
|
||||
*/
|
||||
public function setPath()
|
||||
{
|
||||
$this->filePath = realpath($this->post->installPath) . $this->app->getPathFix() . 'BugFile' . $this->app->getPathFix();
|
||||
$this->filePath = realpath($this->post->installPath) . DS . 'BugFile' . DS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -58,7 +58,7 @@ class redmineConvertModel extends convertModel
|
||||
*/
|
||||
public function setPath()
|
||||
{
|
||||
$this->filePath = realpath($this->post->installPath) . $this->app->getPathFix() . 'files' . $this->app->getPathFix();
|
||||
$this->filePath = realpath($this->post->installPath) . DS . 'files' . DS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -127,7 +127,7 @@ class devModel extends model
|
||||
*/
|
||||
public function getAPIs($module)
|
||||
{
|
||||
$fileName = $this->app->getModuleRoot() . $module . $this->app->getPathFix() . 'control.php';
|
||||
$fileName = $this->app->getModuleRoot() . $module . DS . 'control.php';
|
||||
if($module != 'common' and $module != 'dev')
|
||||
{
|
||||
include $fileName;
|
||||
|
||||
+32
-34
@@ -11,8 +11,6 @@
|
||||
*/
|
||||
class editorModel extends model
|
||||
{
|
||||
private $pathFix = DIRECTORY_SEPARATOR;
|
||||
|
||||
/**
|
||||
* Get all modules
|
||||
*
|
||||
@@ -48,7 +46,7 @@ class editorModel extends model
|
||||
foreach($moduleFiles as $moduleFile)
|
||||
{
|
||||
if($moduleFile == '.' or $moduleFile == '..' or $moduleFile == '.svn') continue;
|
||||
$moduleFullFile = $moduleFullDir . $this->pathFix . $moduleFile;
|
||||
$moduleFullFile = $moduleFullDir . DS . $moduleFile;
|
||||
if($moduleFile == 'control.php' or $moduleFile == 'model.php')
|
||||
{
|
||||
$allModules[$moduleFullDir][$moduleFullFile] = $this->analysis($moduleFullFile);
|
||||
@@ -60,7 +58,7 @@ class editorModel extends model
|
||||
elseif(is_dir($moduleFullFile))
|
||||
{
|
||||
$ext = ($moduleFile == 'js' or $moduleFile == 'css') ? $moduleFile : 'php';
|
||||
$extFiles = glob($moduleFullFile . $this->pathFix . "*.$ext");
|
||||
$extFiles = glob($moduleFullFile . DS . "*.$ext");
|
||||
if(!empty($extFiles))
|
||||
{
|
||||
foreach($extFiles as $fileName) $allModules[$moduleFullDir][$moduleFullFile][$fileName] = basename($fileName);
|
||||
@@ -89,7 +87,7 @@ class editorModel extends model
|
||||
foreach($extensionDirs as $extensionDir)
|
||||
{
|
||||
if($extensionDir == '.' or $extensionDir == '..' or $extensionDir == '.svn') continue;
|
||||
$extensionFullDir = $extPath . $this->pathFix . $extensionDir;
|
||||
$extensionFullDir = $extPath . DS . $extensionDir;
|
||||
if(is_dir($extensionFullDir))
|
||||
{
|
||||
$extensionList[$extensionFullDir] = array();
|
||||
@@ -104,7 +102,7 @@ class editorModel extends model
|
||||
foreach($extensionFiles as $extensionFile)
|
||||
{
|
||||
if($extensionFile == '.' or $extensionFile == '..' or $extensionFile == '.svn') continue;
|
||||
$extensionFullFile = $extensionFullDir . $this->pathFix . $extensionFile;
|
||||
$extensionFullFile = $extensionFullDir . DS . $extensionFile;
|
||||
$extensionList[$extensionFullDir][$extensionFullFile] = $extensionFile;
|
||||
}
|
||||
}
|
||||
@@ -129,7 +127,7 @@ class editorModel extends model
|
||||
if(!$isExtension) $moduleFiles = $moduleFiles[$filePath];
|
||||
foreach($this->config->editor->$sort as $sort)
|
||||
{
|
||||
$sortKey = empty($sort) ? $filePath : $filePath . $this->pathFix . $sort;
|
||||
$sortKey = empty($sort) ? $filePath : $filePath . DS . $sort;
|
||||
if(array_key_exists($sortKey, $moduleFiles)) $sortModules[$sortKey] = $moduleFiles[$sortKey];
|
||||
}
|
||||
return $sortModules;
|
||||
@@ -149,7 +147,7 @@ class editorModel extends model
|
||||
foreach($langDirs as $langDir)
|
||||
{
|
||||
if($langDir == '.' or $langDir == '..' or $langDir == '.svn') continue;
|
||||
$langFullDir = $extensionFullDir . $this->pathFix . $langDir;
|
||||
$langFullDir = $extensionFullDir . DS . $langDir;
|
||||
$fileList[$langFullDir] = array();
|
||||
if(is_dir($langFullDir))
|
||||
{
|
||||
@@ -157,7 +155,7 @@ class editorModel extends model
|
||||
foreach($langFiles as $langFile)
|
||||
{
|
||||
if($langFile == '.' or $langFile == '..' or $langFile == '.svn') continue;
|
||||
$langFullFile = $langFullDir . $this->pathFix . $langFile;
|
||||
$langFullFile = $langFullDir . DS . $langFile;
|
||||
$fileList[$langFullDir][$langFullFile] = $langFile;
|
||||
}
|
||||
}
|
||||
@@ -175,8 +173,8 @@ class editorModel extends model
|
||||
public function analysis($fileName)
|
||||
{
|
||||
$classMethod = array();
|
||||
$class = strstr($fileName, $this->pathFix . 'module' . $this->pathFix);
|
||||
$class = substr($class, 0, strpos($class, $this->pathFix, 9));
|
||||
$class = strstr($fileName, DS . 'module' . DS);
|
||||
$class = substr($class, 0, strpos($class, DS, 9));
|
||||
$class = basename($class);
|
||||
if(strpos($fileName, 'model.php') !== false) $class .= 'Model';
|
||||
if(!class_exists($class)) include $fileName;
|
||||
@@ -186,7 +184,7 @@ class editorModel extends model
|
||||
$methodName = $method->name;
|
||||
if($method->getFileName() != $fileName) continue;
|
||||
if($methodName == '__construct') continue;
|
||||
$classMethod[$fileName . $this->pathFix . $methodName] = $methodName;
|
||||
$classMethod[$fileName . DS . $methodName] = $methodName;
|
||||
}
|
||||
return $classMethod;
|
||||
}
|
||||
@@ -206,7 +204,7 @@ class editorModel extends model
|
||||
{
|
||||
$module = basename(dirname(key($files)));
|
||||
|
||||
$langFile = dirname(key($files)) . $this->pathFix . 'lang' . $this->pathFix . $this->cookie->lang. '.php';
|
||||
$langFile = dirname(key($files)) . DS . 'lang' . DS . $this->cookie->lang. '.php';
|
||||
if(file_exists($langFile))
|
||||
{
|
||||
if(!isset($lang)) $lang = new stdclass();
|
||||
@@ -268,7 +266,7 @@ class editorModel extends model
|
||||
{
|
||||
$file = "<span title='$fileName'>$fileName</span>";
|
||||
}
|
||||
if(strpos($filePath, $this->pathFix . 'ext' . $this->pathFix) !== false)
|
||||
if(strpos($filePath, DS . 'ext' . DS) !== false)
|
||||
{
|
||||
switch($fileName)
|
||||
{
|
||||
@@ -305,7 +303,7 @@ class editorModel extends model
|
||||
{
|
||||
$tree = '';
|
||||
$file = "<span title='$file'>$file</span>";
|
||||
if(strpos($filePath, $this->pathFix . 'ext' . $this->pathFix) !== false)
|
||||
if(strpos($filePath, DS . 'ext' . DS) !== false)
|
||||
{
|
||||
$tree .= "$file " . html::a($this->getExtendLink($filePath, "edit"), $this->lang->edit, 'editWin');
|
||||
$tree .= html::a(inlink('delete', 'path=' . helper::safe64Encode($filePath)), $this->lang->delete, 'hiddenwin') . "\n";
|
||||
@@ -370,7 +368,7 @@ class editorModel extends model
|
||||
$fileContent = $this->post->fileContent;
|
||||
if(get_magic_quotes_gpc()) $fileContent = stripslashes($fileContent);
|
||||
$dirPath = dirname($filePath);
|
||||
$extFilePath = substr($filePath, 0, strpos($filePath, $this->pathFix . 'ext' . $this->pathFix) + 4);
|
||||
$extFilePath = substr($filePath, 0, strpos($filePath, DS . 'ext' . DS) + 4);
|
||||
if(!is_dir($dirPath) and is_writable($extFilePath)) mkdir($dirPath, 0777, true);
|
||||
if(is_writable($dirPath))
|
||||
{
|
||||
@@ -453,8 +451,8 @@ EOD;
|
||||
*/
|
||||
public function newControl($filePath)
|
||||
{
|
||||
$className = strstr($filePath, $this->pathFix . 'module' . $this->pathFix);
|
||||
$className = substr($className, 0, strpos($className, $this->pathFix, 9));
|
||||
$className = strstr($filePath, DS . 'module' . DS);
|
||||
$className = substr($className, 0, strpos($className, DS, 9));
|
||||
$className = basename($className);
|
||||
$methodName = basename($filePath, '.php');
|
||||
return $fileContent = <<<EOD
|
||||
@@ -534,37 +532,37 @@ EOD;
|
||||
public function getSavePath($filePath, $action)
|
||||
{
|
||||
$fileName = empty($_POST['fileName']) ? '' : trim($this->post->fileName);
|
||||
$moduleName = strstr($filePath, $this->pathFix . 'module' . $this->pathFix);
|
||||
$moduleName = substr($moduleName, 0, strpos($moduleName, $this->pathFix, 9));
|
||||
$moduleName = strstr($filePath, DS . 'module' . DS);
|
||||
$moduleName = substr($moduleName, 0, strpos($moduleName, DS, 9));
|
||||
$moduleName = basename($moduleName);
|
||||
$extPath = $this->app->getModuleRoot() . $moduleName . $this->pathFix . 'ext' . $this->pathFix;
|
||||
$extPath = $this->app->getModuleRoot() . $moduleName . DS . 'ext' . DS;
|
||||
switch($action)
|
||||
{
|
||||
case 'extendModel':
|
||||
$fileName = empty($fileName) ? strtolower(basename($filePath)) . '.php' : $fileName;
|
||||
return $extPath . 'model' . $this->pathFix . $fileName;
|
||||
return $extPath . 'model' . DS . $fileName;
|
||||
case 'extendControl':
|
||||
$fileName = strtolower(basename($filePath)) . '.php';
|
||||
return $extPath . 'control' . $this->pathFix . $fileName;
|
||||
return $extPath . 'control' . DS . $fileName;
|
||||
case 'override':
|
||||
$fileName = basename($filePath);
|
||||
return $extPath . 'view' . $this->pathFix . $fileName;
|
||||
return $extPath . 'view' . DS . $fileName;
|
||||
case 'extendOther':
|
||||
$editName = basename($filePath);
|
||||
$fileName = empty($fileName) ? $editName: $fileName;
|
||||
if($editName == 'config.php') return $extPath . 'config' .$this->pathFix . $fileName;
|
||||
elseif(strpos($editName, '.php') !== false) return $extPath . 'lang' . $this->pathFix . str_replace('.php', '', $editName) . $this->pathFix . $fileName;
|
||||
else return $extPath . substr($editName, strrpos($editName, '.') + 1) . $this->pathFix . substr($editName, 0, strrpos($editName, '.')) . $this->pathFix . $fileName;
|
||||
if($editName == 'config.php') return $extPath . 'config' .DS . $fileName;
|
||||
elseif(strpos($editName, '.php') !== false) return $extPath . 'lang' . DS . str_replace('.php', '', $editName) . DS . $fileName;
|
||||
else return $extPath . substr($editName, strrpos($editName, '.') + 1) . DS . substr($editName, 0, strrpos($editName, '.')) . DS . $fileName;
|
||||
default:
|
||||
if(empty($fileName)) die(js::error($this->lang->editor->emptyFileName));
|
||||
$action = strtolower(str_replace('new', '', $action));
|
||||
if($action == 'hook') return $extPath . 'view' . $this->pathFix . $fileName;
|
||||
elseif($action == 'method') return $extPath . basename($filePath, '.php') . $this->pathFix . $fileName;
|
||||
elseif($action == 'extend') return $filePath . $this->pathFix . $fileName;
|
||||
elseif($action == 'config') return $extPath . 'config' . $this->pathFix . $fileName;
|
||||
elseif($action == 'js') return $extPath . 'js' . $this->pathFix . substr($fileName, 0, strrpos($fileName, '.')) . $this->pathFix . $fileName;
|
||||
elseif($action == 'css') return $extPath . 'css' . $this->pathFix . substr($fileName, 0, strrpos($fileName, '.')) . $this->pathFix . $fileName;
|
||||
else return $extPath . 'lang' . $this->pathFix . str_replace('_', '-', $action) . $this->pathFix . $fileName;
|
||||
if($action == 'hook') return $extPath . 'view' . DS . $fileName;
|
||||
elseif($action == 'method') return $extPath . basename($filePath, '.php') . DS . $fileName;
|
||||
elseif($action == 'extend') return $filePath . DS . $fileName;
|
||||
elseif($action == 'config') return $extPath . 'config' . DS . $fileName;
|
||||
elseif($action == 'js') return $extPath . 'js' . DS . substr($fileName, 0, strrpos($fileName, '.')) . DS . $fileName;
|
||||
elseif($action == 'css') return $extPath . 'css' . DS . substr($fileName, 0, strrpos($fileName, '.')) . DS . $fileName;
|
||||
else return $extPath . 'lang' . DS . str_replace('_', '-', $action) . DS . $fileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ class installModel extends model
|
||||
*/
|
||||
public function getDataRoot()
|
||||
{
|
||||
$result['path'] = $this->app->getAppRoot() . 'www' . $this->app->getPathFix() . 'data';
|
||||
$result['path'] = $this->app->getAppRoot() . 'www' . DS . 'data';
|
||||
$result['exists'] = is_dir($result['path']);
|
||||
$result['writable']= is_writable($result['path']);
|
||||
return $result;
|
||||
@@ -173,7 +173,7 @@ class installModel extends model
|
||||
*/
|
||||
public function checkDataRoot()
|
||||
{
|
||||
$dataRoot = $this->app->getAppRoot() . 'www' . $this->app->getPathFix() . 'data';
|
||||
$dataRoot = $this->app->getAppRoot() . 'www' . DS . 'data';
|
||||
return $result = (is_dir($dataRoot) and is_writable($dataRoot)) ? 'ok' : 'fail';
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ class installModel extends model
|
||||
*/
|
||||
public function createTable($version)
|
||||
{
|
||||
$dbFile = $this->app->getAppRoot() . 'db' . $this->app->getPathFix() . 'zentao.sql';
|
||||
$dbFile = $this->app->getAppRoot() . 'db' . DS . 'zentao.sql';
|
||||
$tables = explode(';', file_get_contents($dbFile));
|
||||
foreach($tables as $table)
|
||||
{
|
||||
@@ -425,7 +425,7 @@ class installModel extends model
|
||||
*/
|
||||
public function importDemoData()
|
||||
{
|
||||
$demoDataFile = $this->app->getAppRoot() . 'db' . $this->app->getPathFix() . 'demo.sql';
|
||||
$demoDataFile = $this->app->getAppRoot() . 'db' . DS . 'demo.sql';
|
||||
$insertTables = explode(";\n", file_get_contents($demoDataFile));
|
||||
foreach($insertTables as $table)
|
||||
{
|
||||
|
||||
@@ -638,7 +638,7 @@ class upgradeModel extends model
|
||||
*/
|
||||
public function getUpgradeFile($version)
|
||||
{
|
||||
return $this->app->getAppRoot() . 'db' . $this->app->getPathFix() . 'update' . $version . '.sql';
|
||||
return $this->app->getAppRoot() . 'db' . DS . 'update' . $version . '.sql';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user