Bug fixed, base url

This commit is contained in:
dignajar 2015-12-08 21:56:31 -03:00
parent 9123603d41
commit 7dba06e473
2 changed files with 18 additions and 6 deletions

View File

@ -34,8 +34,9 @@ define('PATH_ABSTRACT', PATH_KERNEL.'abstract'.DS);
define('DOMAIN', $_SERVER['HTTP_HOST']);
// HTML PATHs
$base = empty( $_SERVER['SCRIPT_NAME'] ) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
$base = dirname($base);
//$base = empty( $_SERVER['SCRIPT_NAME'] ) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
//$base = dirname($base);
$base = empty($_SERVER['REQUEST_URI']) ? dirname($_SERVER['SCRIPT_NAME']) : dirname($_SERVER['REQUEST_URI']);
if($base!=DS) {
$base = $base.'/';

View File

@ -153,12 +153,23 @@ $Url = new Url();
$Parsedown = new ParsedownExtra();
$Security = new Security();
// HTML PATHs
// HTML PATHS
// The user can define the base URL.
// Left empty if you want to Bludit try to detect the base URL.
$base = '';
if( !empty($_SERVER['DOCUMENT_ROOT']) && !empty($_SERVER['SCRIPT_NAME']) && empty($base) ) {
$base = str_replace($_SERVER['DOCUMENT_ROOT'], '', $_SERVER['SCRIPT_NAME']);
$base = dirname($base);
}
elseif( empty($base) ) {
$base = empty( $_SERVER['SCRIPT_NAME'] ) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
$base = dirname($base);
}
if($base!=DS) {
$base = $base.'/';
$base = trim($base, '/');
$base = '/'.$base.'/';
}
else {
// Workaround for Windows Web Servers