// ensure image path is below WCF_DIR/images/
if ($this->imagePath) {
- $relativePath = FileUtil::unifyDirSeperator(FileUtil::getRelativePath(WCF_DIR.'images/', WCF_DIR.$this->imagePath));
+ $relativePath = FileUtil::unifyDirSeparator(FileUtil::getRelativePath(WCF_DIR.'images/', WCF_DIR.$this->imagePath));
if (strpos($relativePath, '../') !== false) {
throw new UserInputException('imagePath', 'notValid');
}
break;
}
- $this->readCacheFiles('language', FileUtil::unifyDirSeperator(WCF_DIR.'language'));
- $this->readCacheFiles('template', FileUtil::unifyDirSeperator(WCF_DIR.'templates/compiled'), new Regex('\.meta\.php$'));
- $this->readCacheFiles('template', FileUtil::unifyDirSeperator(WCF_DIR.'acp/templates/compiled'), new Regex('\.meta\.php$'));
- $this->readCacheFiles('style', FileUtil::unifyDirSeperator(WCF_DIR.'style'), null, 'css');
- $this->readCacheFiles('style', FileUtil::unifyDirSeperator(WCF_DIR.'acp/style'), new Regex('WCFSetup.css$'), 'css');
+ $this->readCacheFiles('language', FileUtil::unifyDirSeparator(WCF_DIR.'language'));
+ $this->readCacheFiles('template', FileUtil::unifyDirSeparator(WCF_DIR.'templates/compiled'), new Regex('\.meta\.php$'));
+ $this->readCacheFiles('template', FileUtil::unifyDirSeparator(WCF_DIR.'acp/templates/compiled'), new Regex('\.meta\.php$'));
+ $this->readCacheFiles('style', FileUtil::unifyDirSeparator(WCF_DIR.'style'), null, 'css');
+ $this->readCacheFiles('style', FileUtil::unifyDirSeparator(WCF_DIR.'acp/style'), new Regex('WCFSetup.css$'), 'css');
}
/**
$packageTar = new TarWriter($packageTarName, true);
// append style tar
- $styleTarName = FileUtil::unifyDirSeperator($styleTarName);
+ $styleTarName = FileUtil::unifyDirSeparator($styleTarName);
$packageTar->add($styleTarName, '', FileUtil::addTrailingSlash(dirname($styleTarName)));
// create package.xml
*/
protected static function getWCFDir() {
if (isset($_REQUEST['wcfDir']) && $_REQUEST['wcfDir'] != '') {
- self::$wcfDir = FileUtil::addTrailingSlash(FileUtil::unifyDirSeperator($_REQUEST['wcfDir']));
+ self::$wcfDir = FileUtil::addTrailingSlash(FileUtil::unifyDirSeparator($_REQUEST['wcfDir']));
if (@file_exists(self::$wcfDir)) {
define('RELATIVE_WCF_DIR', FileUtil::getRelativePath(INSTALL_SCRIPT_DIR, self::$wcfDir));
}
$wcfDir = self::$wcfDir;
}
else {
- $wcfDir = FileUtil::unifyDirSeperator(INSTALL_SCRIPT_DIR).'wcf/';
+ $wcfDir = FileUtil::unifyDirSeparator(INSTALL_SCRIPT_DIR).'wcf/';
}
$invalidDirectory = false;
if (!empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != 80) $domainName .= ':' . $_SERVER['SERVER_PORT'];
// script url
$installScriptUrl = '';
- if (!empty($_SERVER['REQUEST_URI'])) $installScriptUrl = FileUtil::removeLeadingSlash(FileUtil::removeTrailingSlash(FileUtil::unifyDirSeperator(dirname($_SERVER['REQUEST_URI']))));
+ if (!empty($_SERVER['REQUEST_URI'])) $installScriptUrl = FileUtil::removeLeadingSlash(FileUtil::removeTrailingSlash(FileUtil::unifyDirSeparator(dirname($_SERVER['REQUEST_URI']))));
WCF::getTPL()->assign(array(
'nextStep' => 'unzipFiles',
'wcfDir' => $wcfDir,
'domainName' => $domainName,
'installScriptUrl' => $installScriptUrl,
- 'installScriptDir' => FileUtil::unifyDirSeperator(INSTALL_SCRIPT_DIR)
+ 'installScriptDir' => FileUtil::unifyDirSeparator(INSTALL_SCRIPT_DIR)
));
WCF::getTPL()->display('stepSearchWcfDir');
$this->getInstalledFiles(FileUtil::addTrailingSlash($file));
}
else {
- self::$installedFiles[] = FileUtil::unifyDirSeperator($file);
+ self::$installedFiles[] = FileUtil::unifyDirSeparator($file);
}
}
}
* @param string $pattern
*/
protected function removeFiles($pattern) {
- $directory = FileUtil::unifyDirSeperator(WCF_DIR.'cache/');
+ $directory = FileUtil::unifyDirSeparator(WCF_DIR.'cache/');
$pattern = str_replace('*', '.*', str_replace('.', '\.', $pattern));
$this->getDirectoryUtil()->executeCallback(new Callback(function ($filename) {
public function addString($filename, $string) {
if (empty($filename)) return false;
- $filename = FileUtil::unifyDirSeperator($filename);
+ $filename = FileUtil::unifyDirSeparator($filename);
if (!$this->writeHeaderBlock($filename, strlen($string), TIME_NOW, 33279)) {
return false;
$result = true;
- // unify dir seperator
- $addDir = FileUtil::unifyDirSeperator($addDir);
- $removeDir = FileUtil::unifyDirSeperator($removeDir);
+ // unify dir separator
+ $addDir = FileUtil::unifyDirSeparator($addDir);
+ $removeDir = FileUtil::unifyDirSeparator($removeDir);
foreach ($files as $filename) {
if (!$result) {
* @return boolean result
*/
protected function addFile($filename, $addDir, $removeDir) {
- $filename = FileUtil::unifyDirSeperator($filename);
+ $filename = FileUtil::unifyDirSeparator($filename);
$storedFilename = $filename;
if (!empty($removeDir)) $storedFilename = StringUtil::replaceIgnoreCase($removeDir, '', $filename);
if (!empty($addDir)) $storedFilename = $addDir . $storedFilename;
$packageDir->setName('packageDir');
$packageDir->setLabel(WCF::getLanguage()->get('wcf.acp.package.packageDir.input'));
- $defaultPath = FileUtil::addTrailingSlash(FileUtil::unifyDirSeperator(StringUtil::substring(WCF_DIR, 0, -4)));
+ $defaultPath = FileUtil::addTrailingSlash(FileUtil::unifyDirSeparator(StringUtil::substring(WCF_DIR, 0, -4)));
$packageDir->setValue($defaultPath);
$container->appendChild($packageDir);
else {
$document = PackageInstallationFormManager::getForm($this->queue, 'packageDir');
$document->handleRequest();
- $packageDir = FileUtil::addTrailingSlash(FileUtil::unifyDirSeperator($document->getValue('packageDir')));
+ $packageDir = FileUtil::addTrailingSlash(FileUtil::unifyDirSeparator($document->getValue('packageDir')));
if ($packageDir !== null) {
// validate package dir
$wcfDomainPath = $row['domainPath'];
}
- $documentRoot = str_replace($wcfDomainPath, '', FileUtil::unifyDirSeperator(WCF_DIR));
+ $documentRoot = str_replace($wcfDomainPath, '', FileUtil::unifyDirSeparator(WCF_DIR));
$domainPath = str_replace($documentRoot, '', $packageDir);
// update application path
* @return wcf\util\DirectoryUtil
*/
public static function getInstance($tmpDirectory, $recursive = true) {
- $directory = realpath(FileUtil::unifyDirSeperator($tmpDirectory));
+ $directory = realpath(FileUtil::unifyDirSeparator($tmpDirectory));
// realpath returns false if the directory does not exist
if ($directory === false) {
throw new SystemException("Unknown directory '".$tmpDirectory."'");
// ignore . and ..
if ($it->isDot()) continue;
- $this->files[FileUtil::unifyDirSeperator($filename)] = FileUtil::unifyDirSeperator($filename);
+ $this->files[FileUtil::unifyDirSeparator($filename)] = FileUtil::unifyDirSeparator($filename);
}
}
else {
// ignore . and ..
if ($this->obj->isDot()) continue;
- $this->files[FileUtil::unifyDirSeperator($obj->getFilename())] = FileUtil::unifyDirSeperator($obj->getFilename());
+ $this->files[FileUtil::unifyDirSeparator($obj->getFilename())] = FileUtil::unifyDirSeparator($obj->getFilename());
}
}
// ignore . and ..
if ($it->isDot()) continue;
- $this->fileObjects[FileUtil::unifyDirSeperator($filename)] = $obj;
+ $this->fileObjects[FileUtil::unifyDirSeparator($filename)] = $obj;
}
}
else {
// ignore . and ..
if ($this->obj->isDot()) continue;
- $this->fileObjects[FileUtil::unifyDirSeperator($obj->getFilename())] = $obj;
+ $this->fileObjects[FileUtil::unifyDirSeparator($obj->getFilename())] = $obj;
}
}
*/
public static function getRelativePath($currentDir, $targetDir) {
// remove trailing slashes
- $currentDir = self::removeTrailingSlash(self::unifyDirSeperator($currentDir));
- $targetDir = self::removeTrailingSlash(self::unifyDirSeperator($targetDir));
+ $currentDir = self::removeTrailingSlash(self::unifyDirSeparator($currentDir));
+ $targetDir = self::removeTrailingSlash(self::unifyDirSeparator($targetDir));
if ($currentDir == $targetDir) {
return './';
}
/**
- * Unifies windows and unix directory seperators.
+ * Unifies windows and unix directory separators.
*
* @param string $path
* @return string
*/
- public static function unifyDirSeperator($path) {
+ public static function unifyDirSeparator($path) {
$path = str_replace('\\\\', '/', $path);
$path = str_replace('\\', '/', $path);
return $path;
* @return string path
*/
public static function getRealPath($path) {
- $path = self::unifyDirSeperator($path);
+ $path = self::unifyDirSeparator($path);
$result = array();
$pathA = explode('/', $path);
$REQUEST_URI = StringUtil::convertEncoding('ISO-8859-1', 'UTF-8', $REQUEST_URI);
}
- return StringUtil::substring(FileUtil::unifyDirSeperator($REQUEST_URI), 0, 255);
+ return StringUtil::substring(FileUtil::unifyDirSeparator($REQUEST_URI), 0, 255);
}
private function __construct() { }