1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-29 04:55:02 +03:00

fix проблемы с web- и server- путями

This commit is contained in:
Alexey Kachayev 2009-12-13 21:49:05 +00:00
parent b87b45ec59
commit 07e37311ea

View file

@ -212,12 +212,17 @@ class LsImage extends Module {
* @return string
*/
public function GetServerPath($sPath) {
$sPath=str_replace(Config::Get('path.root.web'), Config::Get('path.root.server'), $sPath);
/**
* Отделяем ?-суфикс в Web адресах
* Определяем, принадлежит ли этот адрес основному домену
*/
list($sPath,)=explode('?',$sPath,2);
return $sPath;
if(parse_url($sPath,PHP_URL_HOST)!=parse_url(Config::Get('path.root.web'),PHP_URL_HOST)) {
return $sPath;
}
/**
* Выделяем адрес пути
*/
$sPath = parse_url($sPath,PHP_URL_PATH);
return rtrim(Config::Get('path.root.server'),'/').'/'.ltrim($sPath,'/');
}
/**
* Возвращает серверный адрес по переданному web-адресу
@ -226,7 +231,7 @@ class LsImage extends Module {
* @return string
*/
public function GetWebPath($sPath) {
return str_replace(rtrim(Config::Get('path.root.server'),'/'), rtrim(Config::Get('path.root.web'),'/'), $sPath);
return str_replace(realpath(Config::Get('path.root.server')), Config::Get('path.root.web'), realpath($sPath));
}
/**
* Получает директорию для данного пользователя