#126 symbolic links cause filebrowser problems

Version 2.x
closed-fixed
Editor (144)
5
2005-10-07
2005-06-17
No

I have my FCKeditor running in a folder that contains a
symbolic link in it's path. In
./editor/filemanager/browser/default/connectors/php/io.php
the function GetRootPath() uses the PHP function
realpath() to get the path of the current script - this
conflicts with the use of $_SERVER['PHP_SELF'] which
does not resolve symbolic links.

From the PHP docs:
realpath() expands all symbolic links and resolves
references to '/./', '/../' and extra '/' characters in
the input path and return the canonicalized absolute
pathname. The resulting path will have no symbolic
link, '/./' or '/../' components.

As a result the fix I found was to replace the
following line:

$sRealPath = realpath( './' ) ;

with

$sRealPath = dirname($_SERVER['SCRIPT_FILENAME']);

And everything is working sweet once again!

Discussion

  • Nobody/Anonymous

    Logged In: NO

    wow!

     
  • Frederico Caldeira Knabben

    • assigned_to: nobody --> fredck
    • status: open --> open-fixed
     
  • Frederico Caldeira Knabben

    Logged In: YES
    user_id=572424

    This patch has been included in the last version.

     
  • Frederico Caldeira Knabben

    • status: open-fixed --> closed-fixed
     
  • Nobody/Anonymous

    Logged In: NO

    I am calling the class in this way:
    $oFCKeditor = new FCKeditor('user[extra][freespace]') ;
    $oFCKeditor->BasePath =
    '/'.$_cfg['folder_components'].'FCKeditor/';
    $oFCKeditor->Value =
    $user['extra']['freespace'] ;

    $server_path = $module['folder'].$bib_login->username;
    $server_path =
    '/'.$_cfg['folder_site'].$_cfg['folder_module'].$module['code'].'/'.$bib_login->username;
    // if(!file_exists($server_path)){
    // mkdir($server_path);
    // }
    $oFCKeditor->Width = '100%' ;
    $oFCKeditor->Height = '500' ;
    $oFCKeditor->Config['LinkBrowserURL'] =
    $oFCKeditor->BasePath .
    "/editor/filemanager/browser/default/browser.html?Connector=connectors/php/connector.php&ServerPath=".$server_path;

    $oFCKeditor->Config['ImageBrowserURL'] =
    $oFCKeditor->BasePath .
    "/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/php/connector.php&ServerPath=".$server_path;

    $oFCKeditor->Config['FlashBrowserURL'] =
    $oFCKeditor->BasePath .
    "/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/php/connector.php&ServerPath=".$server_path;

    $oFCKeditor->Config['MediaBrowserURL'] =
    $oFCKeditor->BasePath .
    "/editor/filemanager/browser/default/browser.html?Type=Media&Connector=connectors/php/connector.php&ServerPath=".$server_path;

    $oFCKeditor->Create() ;

    and if I don't change this lines in the code:
    function GetRootPath()
    {
    // $sRealPath = realpath( './' ) ;

    // $sSelfPath = $_SERVER['PHP_SELF'] ;
    // $sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath,
    '/' ) ) ;
    // return substr( $sRealPath, 0, strlen( $sRealPath ) -
    strlen( $sSelfPath ) ) ;
    return $_SERVER['DOCUMENT_ROOT'];
    }

    I am not able to upload files

    Fabrizio Parrella

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks