2018-06-05, 21:36:50
(2016-08-03, 04:04:03)orrollo Wrote: also, was fixed the code. changed SPEValidator.php:
Code:public static function findImagePath($url){
global $GSADMIN;
$dataDirPart = str_replace(GSROOTPATH, '', GSDATAPATH); // "data/"
$pluginsDirPart = str_replace(GSROOTPATH, '', GSPLUGINPATH); // "plugins/"
$pluginsDirPart = str_replace(GSROOTPATH, '', GSPLUGINPATH); // "plugins/"
$port = ($p = $_SERVER['SERVER_PORT'])!='80' && $p !='443' ? ':'.$p : '';
$host = $_SERVER['SERVER_NAME'] . $port;
$pathParts = pathinfo($_SERVER['PHP_SELF']);
if ($pathParts['filename'] == 'changedata') //while saving page or while validating by ajax
$subDir = substr($pathParts['dirname'], 0, strrpos($pathParts['dirname'], $GSADMIN)); //find page subdir
else
$subDir = substr($pathParts['dirname'], 0, strpos($pathParts['dirname'], $pluginsDirPart.'SpecialPagesExtras')); //find page subdir
$siteHost = http_protocol()."://". $host;
//delete site host and subdir and data from image url
if ( substr($url, 0, strlen($siteHost.$subDir.$dataDirPart) ) == $siteHost.$subDir.$dataDirPart) {
$path = substr($url, strlen($siteHost.$subDir.$dataDirPart));
}
else if (substr($url, 0, strlen($subDir.$dataDirPart) ) == $subDir.$dataDirPart){ //if its root relative (ex. /data/uploads/image.jpg)
$path = substr($url, strlen($subDir.$dataDirPart));
}
else{ //wrong path, not full and root relative
return false;
}
$file = basename($path);
$subDir = tsl(dirname($path));
return array('dir' => $subDir, 'filename' => $file, 'full' => GSDATAPATH.$path);
}
orrollo, this fixed the problem - thank you for that solution. :-)