diff --git a/module/editor/model.php b/module/editor/model.php
index d907876ba2..da1effae7b 100644
--- a/module/editor/model.php
+++ b/module/editor/model.php
@@ -11,6 +11,8 @@
*/
class editorModel extends model
{
+ private $pathFix = DIRECTORY_SEPARATOR;
+
/**
* Get all modules
*
@@ -46,7 +48,7 @@ class editorModel extends model
foreach($moduleFiles as $moduleFile)
{
if($moduleFile == '.' or $moduleFile == '..' or $moduleFile == '.svn') continue;
- $moduleFullFile = $moduleFullDir . '/' . $moduleFile;
+ $moduleFullFile = $moduleFullDir . $this->pathFix . $moduleFile;
if($moduleFile == 'control.php' or $moduleFile == 'model.php')
{
$allModules[$moduleFullDir][$moduleFullFile] = $this->analysis($moduleFullFile);
@@ -58,7 +60,7 @@ class editorModel extends model
elseif(is_dir($moduleFullFile))
{
$ext = ($moduleFile == 'js' or $moduleFile == 'css') ? $moduleFile : 'php';
- foreach(glob($moduleFullFile . '/' . "*.$ext") as $fileName) $allModules[$moduleFullDir][$moduleFullFile][$fileName] = basename($fileName);
+ foreach(glob($moduleFullFile . $this->pathFix . "*.$ext") as $fileName) $allModules[$moduleFullDir][$moduleFullFile][$fileName] = basename($fileName);
}
else
{
@@ -83,7 +85,7 @@ class editorModel extends model
foreach($extensionDirs as $extensionDir)
{
if($extensionDir == '.' or $extensionDir == '..' or $extensionDir == '.svn') continue;
- $extensionFullDir = $extPath . '/' . $extensionDir;
+ $extensionFullDir = $extPath . $this->pathFix . $extensionDir;
if(is_dir($extensionFullDir))
{
$extensionList[$extensionFullDir] = array();
@@ -98,7 +100,7 @@ class editorModel extends model
foreach($extensionFiles as $extensionFile)
{
if($extensionFile == '.' or $extensionFile == '..' or $extensionFile == '.svn') continue;
- $extensionFullFile = $extensionFullDir . '/' . $extensionFile;
+ $extensionFullFile = $extensionFullDir . $this->pathFix . $extensionFile;
$extensionList[$extensionFullDir][$extensionFullFile] = $extensionFile;
}
}
@@ -123,7 +125,7 @@ class editorModel extends model
if(!$isExtension) $moduleFiles = $moduleFiles[$filePath];
foreach($this->config->editor->$sort as $sort)
{
- $sortKey = empty($sort) ? $filePath : $filePath . '/' . $sort;
+ $sortKey = empty($sort) ? $filePath : $filePath . $this->pathFix . $sort;
if(array_key_exists($sortKey, $moduleFiles)) $sortModules[$sortKey] = $moduleFiles[$sortKey];
}
return $sortModules;
@@ -143,7 +145,7 @@ class editorModel extends model
foreach($langDirs as $langDir)
{
if($langDir == '.' or $langDir == '..' or $langDir == '.svn') continue;
- $langFullDir = $extensionFullDir . '/' . $langDir;
+ $langFullDir = $extensionFullDir . $this->pathFix . $langDir;
$fileList[$langFullDir] = array();
if(is_dir($langFullDir))
{
@@ -151,7 +153,7 @@ class editorModel extends model
foreach($langFiles as $langFile)
{
if($langFile == '.' or $langFile == '..' or $langFile == '.svn') continue;
- $langFullFile = $langFullDir . '/' . $langFile;
+ $langFullFile = $langFullDir . $this->pathFix . $langFile;
$fileList[$langFullDir][$langFullFile] = $langFile;
}
}
@@ -169,8 +171,8 @@ class editorModel extends model
public function analysis($fileName)
{
$classMethod = array();
- $class = strstr($fileName, '/module/');
- $class = substr($class, 0, strpos($class, '/', 9));
+ $class = strstr($fileName, $this->pathFix . 'module' . $this->pathFix);
+ $class = substr($class, 0, strpos($class, $this->pathFix, 9));
$class = basename($class);
if(strpos($fileName, 'model.php') !== false) $class .= 'Model';
if(!class_exists($class)) include $fileName;
@@ -180,7 +182,7 @@ class editorModel extends model
$methodName = $method->name;
if($method->getFileName() != $fileName) continue;
if($methodName == '__construct') continue;
- $classMethod[$fileName . '/' . $methodName] = $methodName;
+ $classMethod[$fileName . $this->pathFix . $methodName] = $methodName;
}
return $classMethod;
}
@@ -198,7 +200,7 @@ class editorModel extends model
$tree = $isRoot ? "
\n" : "\n";
if($isRoot)
{
- $langFile = dirname(key($files)) . '/lang/' . $this->cookie->lang. '.php';
+ $langFile = dirname(key($files)) . $this->pathFix . 'lang' . $this->pathFix . $this->cookie->lang. '.php';
if(file_exists($langFile)) include_once $langFile;
$module = basename(dirname(key($files)));
if(isset($lang->$module))
@@ -255,7 +257,7 @@ class editorModel extends model
{
$file = "$fileName";
}
- if(strpos($filePath, '/ext/') !== false)
+ if(strpos($filePath, $this->pathFix . 'ext' . $this->pathFix) !== false)
{
switch($fileName)
{
@@ -297,7 +299,7 @@ class editorModel extends model
}
elseif(isset($this->lang->editor->translate[$file]))
{
- if(strpos($filePath, '/ext/') !== false and $file == 'config.php')
+ if(strpos($filePath, $this->pathFix . 'ext' . $this->pathFix) !== false and $file == 'config.php')
{
$file = "$file";
}
@@ -310,7 +312,7 @@ class editorModel extends model
{
$file = "$file";
}
- if(strpos($filePath, '/ext/') !== false)
+ if(strpos($filePath, $this->pathFix . 'ext' . $this->pathFix) !== 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";
@@ -359,7 +361,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, '/ext/') + 4);
+ $extFilePath = substr($filePath, 0, strpos($filePath, $this->pathFix . 'ext' . $this->pathFix) + 4);
if(!is_dir($dirPath) and is_writable($extFilePath)) mkdir($dirPath, 0777, true);
if(is_writable($dirPath))
{
@@ -442,8 +444,8 @@ EOD;
*/
public function newControl($filePath)
{
- $className = strstr($filePath, '/module/');
- $className = substr($className, 0, strpos($className, '/', 9));
+ $className = strstr($filePath, $this->pathFix . 'module' . $this->pathFix);
+ $className = substr($className, 0, strpos($className, $this->pathFix, 9));
$className = basename($className);
$methodName = basename($filePath, '.php');
return $fileContent = <<post->fileName);
- $moduleName = strstr($filePath, '/module/');
- $moduleName = substr($moduleName, 0, strpos($moduleName, '/', 9));
+ $moduleName = strstr($filePath, $this->pathFix . 'module' . $this->pathFix);
+ $moduleName = substr($moduleName, 0, strpos($moduleName, $this->pathFix, 9));
$moduleName = basename($moduleName);
- $extPath = $this->app->getModuleRoot() . $moduleName . '/ext/';
+ $extPath = $this->app->getModuleRoot() . $moduleName . $this->pathFix . 'ext' . $this->pathFix;
switch($action)
{
case 'extendModel':
$fileName = empty($fileName) ? strtolower(basename($filePath)) . '.php' : $fileName;
- return $extPath . 'model/' . $fileName;
+ return $extPath . 'model' . $this->pathFix . $fileName;
case 'extendControl':
$fileName = strtolower(basename($filePath)) . '.php';
- return $extPath . 'control/' . $fileName;
+ return $extPath . 'control' . $this->pathFix . $fileName;
case 'override':
$fileName = basename($filePath);
- return $extPath . 'view/' . $fileName;
+ return $extPath . 'view' . $this->pathFix . $fileName;
case 'extendOther':
$editName = basename($filePath);
$fileName = empty($fileName) ? $editName: $fileName;
- if($editName == 'config.php') return $extPath . 'config/' . $fileName;
- elseif(strpos($editName, '.php') !== false) return $extPath . 'lang/' . str_replace('.php', '', $editName) . '/' . $fileName;
- else return $extPath . substr($editName, strrpos($editName, '.') + 1) . '/' . substr($editName, 0, strrpos($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;
default:
if(empty($fileName)) die(js::error($this->lang->editor->emptyFileName));
$action = strtolower(str_replace('new', '', $action));
- if($action == 'hook') return $extPath . 'view/' . $fileName;
- elseif($action == 'method') return $extPath . basename($filePath, '.php') . '/' . $fileName;
- elseif($action == 'extend') return $filePath . '/' . $fileName;
- elseif($action == 'config') return $extPath . 'config/' . $fileName;
- elseif($action == 'js') return $extPath . 'js/' . substr($fileName, 0, strrpos($fileName, '.')) . '/' . $fileName;
- elseif($action == 'css') return $extPath . 'css/' . substr($fileName, 0, strrpos($fileName, '.')) . '/' . $fileName;
- else return $extPath . 'lang/' . str_replace('_', '-', $action) . '/' . $fileName;
+ 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;
}
}
}