From edfdfdd1cbf6d597551d4128e7e11d6d92bcdf95 Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 6 Aug 2007 18:58:55 +0000 Subject: fixed #685 --- .../Configuration/TSqlMapXmlConfiguration.php | 2 +- framework/Exceptions/TErrorHandler.php | 2 +- framework/I18N/TGlobalization.php | 4 +-- framework/PradoBase.php | 2 +- framework/TApplication.php | 2 +- framework/TApplicationComponent.php | 2 +- framework/Util/TLogRouter.php | 4 +-- framework/Web/Services/TPageService.php | 14 +++++----- framework/Web/TAssetManager.php | 32 +++++++++++----------- framework/Web/UI/TClientScriptManager.php | 8 +++--- framework/Web/UI/TTemplateManager.php | 4 +-- framework/Web/UI/TThemeManager.php | 8 +++--- 12 files changed, 42 insertions(+), 42 deletions(-) (limited to 'framework') diff --git a/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php b/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php index b950a194..74ae2a90 100644 --- a/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php +++ b/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php @@ -72,7 +72,7 @@ abstract class TSqlMapXmlConfigBuilder protected function getAbsoluteFilePath($basefile,$resource) { $basedir = dirname($basefile); - $file = realpath($basedir.'/'.$resource); + $file = realpath($basedir.DIRECTORY_SEPARATOR.$resource); if(!is_string($file) || !is_file($file)) $file = realpath($resource); if(is_string($file) && is_file($file)) diff --git a/framework/Exceptions/TErrorHandler.php b/framework/Exceptions/TErrorHandler.php index 8af52ad3..2d245a2f 100644 --- a/framework/Exceptions/TErrorHandler.php +++ b/framework/Exceptions/TErrorHandler.php @@ -278,7 +278,7 @@ class TErrorHandler extends TModule */ protected function getErrorTemplate($statusCode,$exception) { - $base=$this->getErrorTemplatePath().'/'.self::ERROR_FILE_NAME; + $base=$this->getErrorTemplatePath().DIRECTORY_SEPARATOR.self::ERROR_FILE_NAME; $lang=Prado::getPreferredLanguage(); if(is_file("$base$statusCode-$lang.html")) $errorFile="$base$statusCode-$lang.html"; diff --git a/framework/I18N/TGlobalization.php b/framework/I18N/TGlobalization.php index c2a4f5ed..471869c7 100644 --- a/framework/I18N/TGlobalization.php +++ b/framework/I18N/TGlobalization.php @@ -256,10 +256,10 @@ class TGlobalization extends TModule $variants = $this->getCultureVariants($culture); $path = pathinfo($file); foreach($variants as $variant) - $files[] = $path['dirname'].'/'.$variant.'/'.$path['basename']; + $files[] = $path['dirname'].DIRECTORY_SEPARATOR.$variant.DIRECTORY_SEPARATOR.$path['basename']; $filename = substr($path['basename'],0,strrpos($path['basename'],'.')); foreach($variants as $variant) - $files[] = $path['dirname'].'/'.$filename.'.'.$variant.'.'.$path['extension']; + $files[] = $path['dirname'].DIRECTORY_SEPARATOR.$filename.'.'.$variant.'.'.$path['extension']; $files[] = $file; return $files; } diff --git a/framework/PradoBase.php b/framework/PradoBase.php index f2632f9b..2823c1d1 100644 --- a/framework/PradoBase.php +++ b/framework/PradoBase.php @@ -321,7 +321,7 @@ class PradoBase $segs=explode('.',$namespace); $alias=array_shift($segs); if(($file=array_pop($segs))!==null && ($root=self::getPathOfAlias($alias))!==null) - return rtrim($root.'/'.implode('/',$segs),'/').(($file==='*')?'':'/'.$file.$ext); + return rtrim($root.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR ,$segs),'/\\').(($file==='*')?'':DIRECTORY_SEPARATOR.$file.$ext); else return null; } diff --git a/framework/TApplication.php b/framework/TApplication.php index 4454d763..5ae86a39 100644 --- a/framework/TApplication.php +++ b/framework/TApplication.php @@ -1226,7 +1226,7 @@ class TApplicationConfiguration extends TComponent if(preg_match('/^\\/|.:\\/|.:\\\\/',$path)) // if absolute path $p=realpath($path); else - $p=realpath($configPath.'/'.$path); + $p=realpath($configPath.DIRECTORY_SEPARATOR.$path); if($p===false || !is_dir($p)) throw new TConfigurationException('appconfig_aliaspath_invalid',$id,$path); if(isset($this->_aliases[$id])) diff --git a/framework/TApplicationComponent.php b/framework/TApplicationComponent.php index f5d532d2..9ca4ff36 100644 --- a/framework/TApplicationComponent.php +++ b/framework/TApplicationComponent.php @@ -101,7 +101,7 @@ class TApplicationComponent extends TComponent if($className===null) $className=get_class($this); $class=new ReflectionClass($className); - $fullPath=dirname($class->getFileName()).'/'.$assetPath; + $fullPath=dirname($class->getFileName()).DIRECTORY_SEPARATOR.$assetPath; return $this->publishFilePath($fullPath); } diff --git a/framework/Util/TLogRouter.php b/framework/Util/TLogRouter.php index da2b06f6..ffbeb175 100644 --- a/framework/Util/TLogRouter.php +++ b/framework/Util/TLogRouter.php @@ -418,7 +418,7 @@ class TFileLogRoute extends TLogRoute */ protected function processLogs($logs) { - $logFile=$this->getLogPath().'/'.$this->getLogFile(); + $logFile=$this->getLogPath().DIRECTORY_SEPARATOR.$this->getLogFile(); if(@filesize($logFile)>$this->_maxFileSize*1024) $this->rotateFiles(); foreach($logs as $log) @@ -430,7 +430,7 @@ class TFileLogRoute extends TLogRoute */ protected function rotateFiles() { - $file=$this->getLogPath().'/'.$this->getLogFile(); + $file=$this->getLogPath().DIRECTORY_SEPARATOR.$this->getLogFile(); for($i=$this->_maxLogFiles;$i>0;--$i) { $rotateFile=$file.'.'.$i; diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php index ab672558..ab8d3651 100644 --- a/framework/Web/Services/TPageService.php +++ b/framework/Web/Services/TPageService.php @@ -249,9 +249,9 @@ class TPageService extends TService $configPath=$this->getBasePath(); foreach($paths as $path) { - $configFile=$configPath.'/'.self::CONFIG_FILE; + $configFile=$configPath.DIRECTORY_SEPARATOR.self::CONFIG_FILE; $currentTimestamp[$configFile]=@filemtime($configFile); - $configPath.='/'.$path; + $configPath.=DIRECTORY_SEPARATOR.$path; } $appConfigFile=$application->getConfigurationFile(); $currentTimestamp[0]=$appConfigFile===null?0:@filemtime($appConfigFile); @@ -367,7 +367,7 @@ class TPageService extends TService { if($this->_basePath===null) { - $basePath=$this->getApplication()->getBasePath().'/'.self::DEFAULT_BASEPATH; + $basePath=$this->getApplication()->getBasePath().DIRECTORY_SEPARATOR.self::DEFAULT_BASEPATH; if(($this->_basePath=realpath($basePath))===false || !is_dir($this->_basePath)) throw new TConfigurationException('pageservice_basepath_invalid',$basePath); } @@ -427,7 +427,7 @@ class TPageService extends TService */ protected function createPage($pagePath) { - $path=$this->getBasePath().DIRECTORY_SEPARATOR.strtr($pagePath,'.','/'); + $path=$this->getBasePath().DIRECTORY_SEPARATOR.strtr($pagePath,'.',DIRECTORY_SEPARATOR); $hasTemplateFile=is_file($path.self::PAGE_FILE_EXT); $hasClassFile=is_file($path.Prado::CLASS_FILE_EXT); @@ -568,10 +568,10 @@ class TPageConfiguration extends TComponent $path=$basePath; foreach($paths as $p) { - $this->loadFromFile($path.'/'.TPageService::CONFIG_FILE,null); - $path.='/'.$p; + $this->loadFromFile($path.DIRECTORY_SEPARATOR.TPageService::CONFIG_FILE,null); + $path.=DIRECTORY_SEPARATOR.$p; } - $this->loadFromFile($path.'/'.TPageService::CONFIG_FILE,$page); + $this->loadFromFile($path.DIRECTORY_SEPARATOR.TPageService::CONFIG_FILE,$page); $this->_rules=new TAuthorizationRuleCollection($this->_rules); } diff --git a/framework/Web/TAssetManager.php b/framework/Web/TAssetManager.php index 3b535efe..6111fe38 100644 --- a/framework/Web/TAssetManager.php +++ b/framework/Web/TAssetManager.php @@ -82,7 +82,7 @@ class TAssetManager extends TModule { $application=$this->getApplication(); if($this->_basePath===null) - $this->_basePath=dirname($application->getRequest()->getApplicationFilePath()).'/'.self::DEFAULT_BASEPATH; + $this->_basePath=dirname($application->getRequest()->getApplicationFilePath()).DIRECTORY_SEPARATOR.self::DEFAULT_BASEPATH; if(!is_writable($this->_basePath) || !is_dir($this->_basePath)) throw new TConfigurationException('assetmanager_basepath_invalid',$this->_basePath); if($this->_baseUrl===null) @@ -161,18 +161,18 @@ class TAssetManager extends TModule { $dir=$this->hash(dirname($fullpath)); $fileName=basename($fullpath); - $dst=$this->_basePath.'/'.$dir; - if(!is_file($dst.'/'.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) + $dst=$this->_basePath.DIRECTORY_SEPARATOR.$dir; + if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) $this->copyFile($fullpath,$dst); return $this->_published[$path]=$this->_baseUrl.'/'.$dir.'/'.$fileName; } else { $dir=$this->hash($fullpath); - if(!is_dir($this->_basePath.'/'.$dir) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) + if(!is_dir($this->_basePath.DIRECTORY_SEPARATOR.$dir) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) { Prado::trace("Publishing directory $fullpath",'System.Web.UI.TAssetManager'); - $this->copyDirectory($fullpath,$this->_basePath.'/'.$dir); + $this->copyDirectory($fullpath,$this->_basePath.DIRECTORY_SEPARATOR.$dir); } return $this->_published[$path]=$this->_baseUrl.'/'.$dir; } @@ -189,9 +189,9 @@ class TAssetManager extends TModule { $path=realpath($path); if(is_file($path)) - return $this->_basePath.'/'.$this->hash(dirname($path)).'/'.basename($path); + return $this->_basePath.DIRECTORY_SEPARATOR.$this->hash(dirname($path)).DIRECTORY_SEPARATOR.basename($path); else - return $this->_basePath.'/'.$this->hash($path); + return $this->_basePath.DIRECTORY_SEPARATOR.$this->hash($path); } /** @@ -235,7 +235,7 @@ class TAssetManager extends TModule @mkdir($dst); @chmod($dst, PRADO_CHMOD); } - $dstFile=$dst.'/'.basename($src); + $dstFile=$dst.DIRECTORY_SEPARATOR.basename($src); if(@filemtime($dstFile)<@filemtime($src)) { Prado::trace("Publishing file $src to $dstFile",'System.Web.TAssetManager'); @@ -264,13 +264,13 @@ class TAssetManager extends TModule { if($file==='.' || $file==='..' || $file==='.svn') continue; - else if(is_file($src.'/'.$file)) + else if(is_file($src.DIRECTORY_SEPARATOR.$file)) { - if(@filemtime($dst.'/'.$file)<@filemtime($src.'/'.$file)) - @copy($src.'/'.$file,$dst.'/'.$file); + if(@filemtime($dst.DIRECTORY_SEPARATOR.$file)<@filemtime($src.DIRECTORY_SEPARATOR.$file)) + @copy($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file); } else - $this->copyDirectory($src.'/'.$file,$dst.'/'.$file); + $this->copyDirectory($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file); } closedir($folder); } else { @@ -290,7 +290,7 @@ class TAssetManager extends TModule * @return string URL path to the directory where the tar file was extracted. */ public function publishTarFile($tarfile, $md5sum, $checkTimestamp=false) - { + { if(isset($this->_published[$md5sum])) return $this->_published[$md5sum]; else if(($fullpath=realpath($md5sum))===false || !is_file($fullpath)) @@ -299,10 +299,10 @@ class TAssetManager extends TModule { $dir=$this->hash(dirname($fullpath)); $fileName=basename($fullpath); - $dst=$this->_basePath.'/'.$dir; - if(!is_file($dst.'/'.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) + $dst=$this->_basePath.DIRECTORY_SEPARATOR.$dir; + if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) { - if(@filemtime($dst.'/'.$fileName)<@filemtime($fullpath)) + if(@filemtime($dst.DIRECTORY_SEPARATOR.$fileName)<@filemtime($fullpath)) { $this->copyFile($fullpath,$dst); $this->deployTarFile($tarfile,$dst); diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php index cd8826dc..e28f108f 100644 --- a/framework/Web/UI/TClientScriptManager.php +++ b/framework/Web/UI/TClientScriptManager.php @@ -117,7 +117,7 @@ class TClientScriptManager extends TApplicationComponent { if(is_null(self::$_pradoScripts)) { - $packageFile = Prado::getFrameworkPath().'/'.self::SCRIPT_PATH.'/packages.php'; + $packageFile = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH.'/packages.php'; list($packages,$deps)= include($packageFile); self::$_pradoScripts = $deps; } @@ -134,7 +134,7 @@ class TClientScriptManager extends TApplicationComponent */ public function getPradoScriptAssetUrl() { - $base = Prado::getFrameworkPath().'/'.self::SCRIPT_PATH; + $base = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH; $assets = Prado::getApplication()->getAssetManager(); return $assets->getPublishedUrl($base); } @@ -148,7 +148,7 @@ class TClientScriptManager extends TApplicationComponent $files=array_keys($this->_registeredPradoScripts); if(count($files) > 0) { - $base = Prado::getFrameworkPath().'/'.self::SCRIPT_PATH; + $base = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH; $url = $this->registerJavascriptPackages($base, $files); $writer->write(TJavaScript::renderScriptFile($url)); } @@ -168,7 +168,7 @@ class TClientScriptManager extends TApplicationComponent { list($path,$url) = $this->getPackagePathUrl($base); $scriptLoaderPath = $path.'/'.basename(self::SCRIPT_LOADER); - $scriptLoaderSrc = Prado::getFrameworkPath().'/'.self::SCRIPT_LOADER; + $scriptLoaderSrc = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_LOADER; if(!is_file($scriptLoaderPath)) copy($scriptLoaderSrc, $scriptLoaderPath); $url .= '/'.basename(self::SCRIPT_LOADER).'?js='.implode(',', $packages); diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index 6fe56f4d..34d66b47 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -485,7 +485,7 @@ class TTemplate extends TApplicationComponent implements ITemplate break; case self::CONFIG_ASSET: // asset URL $setter='set'.$name; - $url=$this->publishFilePath($this->_contextPath.'/'.$value[1]); + $url=$this->publishFilePath($this->_contextPath.DIRECTORY_SEPARATOR.$value[1]); $component->$setter($url); break; case self::CONFIG_PARAMETER: // application parameter @@ -533,7 +533,7 @@ class TTemplate extends TApplicationComponent implements ITemplate $component->setSubProperty($name,$value[1]); break; case self::CONFIG_ASSET: // asset URL - $url=$this->publishFilePath($this->_contextPath.'/'.$value[1]); + $url=$this->publishFilePath($this->_contextPath.DIRECTORY_SEPARATOR.$value[1]); $component->setSubProperty($name,$url); break; case self::CONFIG_PARAMETER: // application parameter diff --git a/framework/Web/UI/TThemeManager.php b/framework/Web/UI/TThemeManager.php index a7651a3e..16021029 100644 --- a/framework/Web/UI/TThemeManager.php +++ b/framework/Web/UI/TThemeManager.php @@ -78,7 +78,7 @@ class TThemeManager extends TModule */ public function getTheme($name) { - $themePath=$this->getBasePath().'/'.$name; + $themePath=$this->getBasePath().DIRECTORY_SEPARATOR.$name; $themeUrl=rtrim($this->getBaseUrl(),'/').'/'.$name; return new TTheme($themePath,$themeUrl); @@ -94,7 +94,7 @@ class TThemeManager extends TModule $folder=@opendir($basePath); while($file=@readdir($folder)) { - if($file!=='.' && $file!=='..' && $file!=='.svn' && is_dir($basePath.'/'.$file)) + if($file!=='.' && $file!=='..' && $file!=='.svn' && is_dir($basePath.DIRECTORY_SEPARATOR.$file)) $themes[]=$file; } closedir($folder); @@ -109,7 +109,7 @@ class TThemeManager extends TModule { if($this->_basePath===null) { - $this->_basePath=dirname($this->getRequest()->getApplicationFilePath()).'/'.self::DEFAULT_BASEPATH; + $this->_basePath=dirname($this->getRequest()->getApplicationFilePath()).DIRECTORY_SEPARATOR.self::DEFAULT_BASEPATH; if(($basePath=realpath($this->_basePath))===false || !is_dir($basePath)) throw new TConfigurationException('thememanager_basepath_invalid2',$this->_basePath); $this->_basePath=$basePath; @@ -253,7 +253,7 @@ class TTheme extends TApplicationComponent implements ITheme $this->_cssFiles[]=$themeUrl.'/'.$file; else if(basename($file,'.js')!==$file) $this->_jsFiles[]=$themeUrl.'/'.$file; - else if(basename($file,self::SKIN_FILE_EXT)!==$file && filemtime($themePath.'/'.$file)>$timestamp) + else if(basename($file,self::SKIN_FILE_EXT)!==$file && filemtime($themePath.DIRECTORY_SEPARATOR.$file)>$timestamp) { $cacheValid=false; break; -- cgit v1.2.3