From 49a998b6d9a85bd31fb08ea5021a288fc273d409 Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 10 Feb 2017 07:39:03 -0800 Subject: [PATCH] Path fixes. --- e107_core/shortcodes/batch/admin_shortcodes.php | 7 ++++++- e107_handlers/e107_class.php | 14 ++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index bd2609110..dfd18f5eb 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -667,10 +667,13 @@ class admin_shortcodes } unset($tmp); + + $curScript = basename($_SERVER['SCRIPT_FILENAME']); + // Obsolete ob_start(); //Show upper_right menu if the function exists - $tmp = explode('.',e_PAGE); + $tmp = explode('.',$curScript); $adminmenu_parms = ""; $adminmenu_func = $tmp[0].'_adminmenu'; @@ -687,6 +690,8 @@ class admin_shortcodes } } $plugindir = (str_replace('/','',str_replace('..', '', e_PLUGIN)).'/'); + + // FIXME @TODO $plugPath is using the URL to detect the path. It should use $_SERVER['SCRIPT_FILENAME'] $plugpath = e_PLUGIN.str_replace(basename(e_SELF),'',str_replace('/'.$plugindir,'','/'.strstr(e_SELF,$plugindir))).'admin_menu.php'; if(file_exists($plugpath)) diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index efd8d149a..cd4f87a32 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -4146,7 +4146,7 @@ class e107 $tmp2 = explode('?', e_REQUEST_URI); define('e_REQUEST_HTTP', array_shift($tmp2)); // SELF URL without the QUERY string and leading domain part - if(!deftrue('e_SINGLE_ENTRY')) + if(!deftrue('e_SINGLE_ENTRY') && !deftrue('e_SELF_OVERRIDE') ) { $page = substr(strrchr($_SERVER['PHP_SELF'], '/'), 1); @@ -4162,6 +4162,11 @@ class e107 else { define('e_SELF', e_REQUEST_SELF); + + if(deftrue('e_SELF_OVERRIDE')) // see multisite plugin. + { + define('e_PAGE', basename($_SERVER['SCRIPT_FILENAME'])); + } } @@ -4173,14 +4178,15 @@ class e107 $inAdminDir = FALSE; $isPluginDir = strpos($_self,'/'.$PLUGINS_DIRECTORY) !== FALSE; // True if we're in a plugin $e107Path = str_replace($this->base_path, '', $_self); // Knock off the initial bits + $curPage = basename($_SERVER['SCRIPT_FILENAME']); if ( (!$isPluginDir && strpos($e107Path, $ADMIN_DIRECTORY) === 0 ) // Core admin directory - || ($isPluginDir && (strpos(e_PAGE,'_admin.php') !== false || strpos(e_PAGE,'admin_') === 0 || strpos($e107Path, 'admin/') !== FALSE)) // Plugin admin file or directory + || ($isPluginDir && (strpos($curPage,'_admin.php') !== false || strpos($curPage,'admin_') === 0 || strpos($e107Path, 'admin/') !== FALSE)) // Plugin admin file or directory || (vartrue($eplug_admin) || deftrue('ADMIN_AREA')) // Admin forced || (preg_match('/^\/(.*?)\/user(settings\.php|\/edit)(\?|\/)(\d+)$/i', $_SERVER['REQUEST_URI']) && ADMIN) - || ($isPluginDir && e_PAGE === 'prefs.php') //BC Fix for old plugins - || ($isPluginDir && e_PAGE === 'config.php') // BC Fix for old plugins + || ($isPluginDir && $curPage === 'prefs.php') //BC Fix for old plugins + || ($isPluginDir && $curPage === 'config.php') // BC Fix for old plugins ) { $inAdminDir = TRUE;