From edfdfdd1cbf6d597551d4128e7e11d6d92bcdf95 Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 6 Aug 2007 18:58:55 +0000 Subject: fixed #685 --- 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 ++++---- 5 files changed, 33 insertions(+), 33 deletions(-) (limited to 'framework/Web') 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