[svn r21621] FS#2867 - The FCKEditor, the simple file manager: There is a function GetRootPath() for returning the system document root path. In some configurations it might fail. For reducing such a probability, at the first attempt, this function will try to return the desired result using known configuration data from the Dokeos system.

skala
Ivan Tcholakov 16 years ago
parent 7da83ec27a
commit ac289a0232
  1. 11
      main/inc/lib/fckeditor/editor/filemanager/connectors/php/io.php

@ -186,6 +186,15 @@ function CreateServerFolder( $folderPath, $lastFolder = null )
function GetRootPath()
{
// First, let the system Dokeos tries to determine the system document root path.
if (preg_match('@'.api_get_path(REL_PATH).'$@', api_get_path(SYS_PATH))) // Sanity check.
{
return str_replace('/', DIRECTORY_SEPARATOR, preg_replace('@'.api_get_path(REL_PATH).'$@', '', api_get_path(SYS_PATH)));
}
// Next, the original algorithm will try alone to determine the system document root path.
if (!isset($_SERVER)) {
global $_SERVER;
}
@ -203,7 +212,7 @@ function GetRootPath()
// This can check only that this script isn't run from a virtual dir
// But it avoids the problems that arise if it isn't checked
if ( $position === false || $position <> strlen( $sRealPath ) - strlen( $sSelfPath ) )
SendError( 1, 'Sorry, the physical root path of the file repository can not be resolved (the function GetRootPath() failed).' ) ;
SendError( 1, 'Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/php/config.php".' ) ;
return substr( $sRealPath, 0, $position ) ;
}

Loading…
Cancel
Save