From 619b40b2e370b74eab93fae8b40ea94ae2dedd1d Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 3 Apr 2015 18:42:27 -0700 Subject: [PATCH] Improved e_CURRENT_PLUGIN detection when using SEF-URLs and other minor path fixes. --- e107_admin/boot.php | 2 +- .../shortcodes/batch/admin_shortcodes.php | 2 +- e107_handlers/application.php | 1 + e107_handlers/core_functions.php | 2 +- e107_handlers/form_handler.php | 11 +++- e107_themes/bootstrap/admin_template.php | 2 +- index.php | 59 ++++++++++--------- 7 files changed, 44 insertions(+), 35 deletions(-) diff --git a/e107_admin/boot.php b/e107_admin/boot.php index 248bb7d0d..3f542c901 100644 --- a/e107_admin/boot.php +++ b/e107_admin/boot.php @@ -37,7 +37,7 @@ e107::coreLan('footer', true); foreach ($_plugins as $_p) { - if(in_array($_p, $_globalLans) && e_CURRENT_PLUGIN != $_p) // filter out those with globals unless we are in a plugin folder. + if(in_array($_p, $_globalLans) && defset('e_CURRENT_PLUGIN') != $_p) // filter out those with globals unless we are in a plugin folder. { continue; } diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index a058b9620..6d86efc8b 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -188,7 +188,7 @@ class admin_shortcodes $e_icon_array = e107::getNav()->getIconArray(); - if (e_CURRENT_PLUGIN) + if (deftrue('e_CURRENT_PLUGIN')) { $eplug_icon = ''; $eplug_folder = e_CURRENT_PLUGIN.'/'; diff --git a/e107_handlers/application.php b/e107_handlers/application.php index 59646b85f..934873cb1 100644 --- a/e107_handlers/application.php +++ b/e107_handlers/application.php @@ -386,6 +386,7 @@ class eDispatcher { case 'plugin': //if($custom) $custom = 'url/'.$custom; + define('e_CURRENT_PLUGIN', $module); // TODO Move to a better location. return $sc ? '{e_PLUGIN}'.$module.'url/'.$custom.'url.php' : e_PLUGIN.$module.'url/'.$custom.'url.php'; break; diff --git a/e107_handlers/core_functions.php b/e107_handlers/core_functions.php index 25805bac6..3ce0f2b8b 100644 --- a/e107_handlers/core_functions.php +++ b/e107_handlers/core_functions.php @@ -325,7 +325,7 @@ if (!function_exists('r_emote')) { $key = str_replace("!", ".", $key); // Usually '.' was replaced by '!' when saving $key = preg_replace("#_(\w{3})$#", ".\\1", $key); // '_' followed by exactly 3 chars is file extension - $key = e_IMAGE."emotes/" . $pref['emotepack'] . "/" .$key; // Add in the file path + $key = e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/" .$key; // Add in the file path $value2 = substr($value, 0, strpos($value, " ")); $value = ($value2 ? $value2 : $value); diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 488656dff..92ffae92c 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -3440,8 +3440,15 @@ class e_form $value = e107::unserialize($value); // (saved as array, return it as an array) } - $value = call_user_func_array(array($this, $method), array($value, 'read', $parms)); - + + if(method_exists($this,$method)) + { + $value = call_user_func_array(array($this, $method), array($value, 'read', $parms)); + } + else + { + return "Missing: ".$method."()"; + } // print_a($attributes); // Inline Editing. if(!vartrue($attributes['noedit']) && vartrue($parms['editable'])) // avoid bad markup, better solution coming up diff --git a/e107_themes/bootstrap/admin_template.php b/e107_themes/bootstrap/admin_template.php index f060bbb6d..d4dfbf197 100644 --- a/e107_themes/bootstrap/admin_template.php +++ b/e107_themes/bootstrap/admin_template.php @@ -209,7 +209,7 @@ $ADMIN_HEADER .= '
{ADMIN_LATEST=infopanel} {ADMIN_STATUS=infopanel} - + {ADMIN_MSG=request} {ADMIN_PLUGINS} diff --git a/index.php b/index.php index abba3689a..f9220f72c 100644 --- a/index.php +++ b/index.php @@ -12,35 +12,35 @@ * $Id$ */ -/*! \mainpage e107 Content Management System (CMS) - v2 - * -* \section intro_sec What is e107? -* -* e107 is a free (open-source) content management system which allows you to easily manage and publish your content online. Developers can save time in building websites and powerful online applications. Users can avoid programming completely! Blogs, Websites, Intranets - e107 does it all. -* -* \section requirements_sec Requirements -* -* - PHP v5.3 or higher -* - MySQL 4.x or higher -* -* \section install_sec Installation -* -* - Point your browser to the http://localhost/YOUR FOLDER/install.php (depending on your webserver setup) -* - Follow the installation wizard -* -* \section reporting_bugs_sec Reporting Bugs -* -* Be sure you are using the most recent version prior to reporting an issue. You may report any bugs or feature requests on GitHub (https://github.com/e107inc/e107/issues) -* -* \section pull_requests_sec Pull-Requests -* -* - Please submit 1 pull-request for each Github #issue you may work on. -* - Make sure that only the lines you have changed actually show up in a file-comparison (diff) ie. some text-editors alter every line so this should be avoided. -* -* \section license_sec License -* -* e107 is released under the terms and conditions of the GNU General Public License (http://www.gnu.org/licenses/gpl.txt) -* +/*! \mainpage e107 Content Management System (CMS) - v2 + * +* \section intro_sec What is e107? +* +* e107 is a free (open-source) content management system which allows you to easily manage and publish your content online. Developers can save time in building websites and powerful online applications. Users can avoid programming completely! Blogs, Websites, Intranets - e107 does it all. +* +* \section requirements_sec Requirements +* +* - PHP v5.3 or higher +* - MySQL 4.x or higher +* +* \section install_sec Installation +* +* - Point your browser to the http://localhost/YOUR FOLDER/install.php (depending on your webserver setup) +* - Follow the installation wizard +* +* \section reporting_bugs_sec Reporting Bugs +* +* Be sure you are using the most recent version prior to reporting an issue. You may report any bugs or feature requests on GitHub (https://github.com/e107inc/e107/issues) +* +* \section pull_requests_sec Pull-Requests +* +* - Please submit 1 pull-request for each Github #issue you may work on. +* - Make sure that only the lines you have changed actually show up in a file-comparison (diff) ie. some text-editors alter every line so this should be avoided. +* +* \section license_sec License +* +* e107 is released under the terms and conditions of the GNU General Public License (http://www.gnu.org/licenses/gpl.txt) +* */ // BOOTSTRAP START @@ -124,6 +124,7 @@ if(file_exists($file)) { + define('e_CURRENT_PLUGIN', $plug); include_once($file); exit; }