Having problems with image paths. Will work it out eventually (I hope).
Made a new fresh install, needed to upload the dutch language file for FCKEditor to /manager/media/fckeditor/editor/lang, after that all worked like expected.
Without the language file FCKEditro wouldn’t show up
// automatically assign base_path, base_url, and site_url if($base_path==""||$base_url=="") { $a = explode("manager",str_replace("\\","/",dirname($_SERVER["PHP_SELF"]))); if(count($a)>1) array_pop($a); $url = implode("manager",$a); reset($a); $a = explode("manager",dirname(__FILE__)); if(count($a)>1) array_pop($a); $pth = implode("manager",$a); unset($a); $base_url = $url.(substr($url,-1)!="/"? "/":""); $base_path = $pth.(substr($pth,-1)!="/"? "/":""); $site_url = (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on')? "http://" : "https://" ; $site_url .= $_SERVER['HTTP_HOST']; $site_url .= ($_SERVER['SERVER_PORT']==80 || isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS'])=='on')? "":":".$_SERVER['SERVER_PORT']; $site_url .= $base_url; }
/*------------------------------------------------------------------------------*/ /* The physical path to the document root, Set manually if not using apache */ /*------------------------------------------------------------------------------*/ $fckphp_config['basedir']=substr($base_path, 0, strlen($base_path)-1); //$fckphp_config['basedir'] = $_SERVER['DOCUMENT_ROOT'] ; /*==============================================================================*/ /*------------------------------------------------------------------------------*/ /* Prefix added to image path before sending back to editor */ /*------------------------------------------------------------------------------*/ //$fckphp_config['urlprefix']=$fckphp_config['prot'].$_SERVER['SERVER_NAME']; $fckphp_config['urlprefix']= substr($site_url, 0, strlen($site_url)-1); /*==============================================================================*/ /*------------------------------------------------------------------------------*/ /* Path to user files relative to the document root (no trailing slash) */ /*------------------------------------------------------------------------------*/ $fckphp_config['UserFilesPath'] = "/assets" ; /*==============================================================================*/
http://localhost/bmp/manager/media/fckeditor/editor/file/assets/images/logo.gif
$site_url = "http://localhost/bmp/";
FCKConfig.ToolbarSets["Default"] = [ ['PasteWord','PasteText','Cut','Copy','Paste','Bold','Italic','Underline','Link','Unlink','Image','Rule','Source'], ['FontFormat','FontName','FontSize','TextColor','BGColor'] ];
I really don’t know what the problem is. include.inc.php:// automatically assign base_path, base_url, and site_url if($base_path==""||$base_url=="") { $a = explode("manager",str_replace("\\","/",dirname($_SERVER["PHP_SELF"]))); if(count($a)>1) array_pop($a); $url = implode("manager",$a); reset($a); $a = explode("manager",dirname(__FILE__)); if(count($a)>1) array_pop($a); $pth = implode("manager",$a); unset($a); $base_url = $url.(substr($url,-1)!="/"? "/":""); $base_path = $pth.(substr($pth,-1)!="/"? "/":""); $site_url = (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on')? "http://" : "https://" ; $site_url .= $_SERVER['HTTP_HOST']; $site_url .= ($_SERVER['SERVER_PORT']==80 || isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS'])=='on')? "":":".$_SERVER['SERVER_PORT']; $site_url .= $base_url; }
and fck’s php/config.php/*------------------------------------------------------------------------------*/ /* The physical path to the document root, Set manually if not using apache */ /*------------------------------------------------------------------------------*/ $fckphp_config['basedir']=substr($base_path, 0, strlen($base_path)-1); //$fckphp_config['basedir'] = $_SERVER['DOCUMENT_ROOT'] ; /*==============================================================================*/ /*------------------------------------------------------------------------------*/ /* Prefix added to image path before sending back to editor */ /*------------------------------------------------------------------------------*/ //$fckphp_config['urlprefix']=$fckphp_config['prot'].$_SERVER['SERVER_NAME']; $fckphp_config['urlprefix']= substr($site_url, 0, strlen($site_url)-1); /*==============================================================================*/ /*------------------------------------------------------------------------------*/ /* Path to user files relative to the document root (no trailing slash) */ /*------------------------------------------------------------------------------*/ $fckphp_config['UserFilesPath'] = "/assets" ; /*==============================================================================*/
So I see what’s being done. But... with this setup, I get this path for images:
http://localhost/bmp/manager/media/fckeditor/editor/file/assets/images/logo.gif
I manually updated the config.inc.php file from the install/instprocessor.php file in 1.0pre2.1. Is there a newer version?
I’m looking at a couple of other ways of dealing with setting these three items up. One is to only run the script at install and write the result to the file; since moving the site requires manual intervention in the database configuration I don’t see a big deal with having to change the base paths/urls as well. There could be an autodetection script available that would be run if there were database errors indicating the config.inc.php file was no longer applicable, sort of like the one that shows the need of running the installation script. ("It appears that your database configuration has changed. Please update your site configuration"; then have a form to update the config.inc.php data. Would also need to check that config.inc.php is writable.)
Besides, I’m not overly fond of the idea of that code having to be run every page impression! It should be set up on installation and that’s it.
// automatically assign base_path and base_url if($base_path==""||$base_url=="") { $a = explode("/manager",str_replace("\\\\","/",dirname($_SERVER["PHP_SELF"]))); if(count($a)>1) array_pop($a); $url = implode("manager",$a); reset($a); $a = explode("manager",dirname(__FILE__)); if(count($a)>1) array_pop($a); $pth = implode("manager",$a); unset($a); $base_url = $url.(substr($url,-1)!="/"? "/":""); $base_path = $pth.(substr($pth,-1)!="/" && substr($pth,-1)!="\\\\"? "/":""); $site_url = (!isset($_SERVER[\'HTTPS\']) || strtolower($_SERVER[\'HTTPS\']) != \'on\')? "http://" : "https://" ; $site_url .= $_SERVER[\'HTTP_HOST\']; $site_url .= ($_SERVER[\'SERVER_PORT\']==80 || isset($_SERVER[\'HTTPS\']) || strtolower($_SERVER[\'HTTPS\'])==\'on\')? "":":".$_SERVER[\'SERVER_PORT\']; $site_url .= $base_url; }';
&& substr($pth,-1)!="\\\\"