From c8ade39d1205b7d6eef84e90864900eaa1460573 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 7 May 2016 15:33:09 -0700 Subject: [PATCH] Legacy plugin admin theme fix. --- e107_handlers/e107_class.php | 2 + e107_handlers/plugin_class.php | 2 + e107_plugins/_blank/_blank_setup.php | 128 ++++++++++++++------------- 3 files changed, 70 insertions(+), 62 deletions(-) diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index 2e6ea2763..c5b93dade 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -3831,6 +3831,8 @@ class e107 || ($isPluginDir && (strpos(e_PAGE,'_admin.php') !== false || strpos(e_PAGE,'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 ) { $inAdminDir = TRUE; diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php index e2b764176..a4ae32611 100644 --- a/e107_handlers/plugin_class.php +++ b/e107_handlers/plugin_class.php @@ -3171,6 +3171,8 @@ class e107plugin { $tp = e107::getParser(); + $PLUGINS_FOLDER = '{e_PLUGIN}'; // Could be used in plugin.php file. + $eplug_conffile = null; $eplug_table_names = null; $eplug_prefs = null; diff --git a/e107_plugins/_blank/_blank_setup.php b/e107_plugins/_blank/_blank_setup.php index 0e78d37e7..d435b0a7e 100644 --- a/e107_plugins/_blank/_blank_setup.php +++ b/e107_plugins/_blank/_blank_setup.php @@ -10,75 +10,79 @@ ** */ -class _blank_setup + +if(!class_exists("_blank_setup")) { - - function install_pre($var) + class _blank_setup { - // print_a($var); - // echo "custom install 'pre' function

"; - } - /** - * For inserting default database content during install after table has been created by the blank_sql.php file. - */ - function install_post($var) - { - $sql = e107::getDb(); - $mes = e107::getMessage(); - - $e107_blank = array( - 'blank_id' =>'1', - 'blank_icon' =>'{e_PLUGIN}_blank/images/blank_32.png', - 'blank_type' =>'type_1', - 'blank_name' =>'My Name', - 'blank_folder' =>'Folder Value', - 'blank_version' =>'1', - 'blank_author' =>'bill', - 'blank_authorURL' =>'http://e107.org', - 'blank_date' =>'1352871240', - 'blank_compatibility' =>'2', - 'blank_url' =>'http://e107.org' - ); - - if($sql->insert('blank',$e107_blank)) + function install_pre($var) { - $mes->add("Custom - Install Message.", E_MESSAGE_SUCCESS); + // print_a($var); + // echo "custom install 'pre' function

"; } - else + + /** + * For inserting default database content during install after table has been created by the blank_sql.php file. + */ + function install_post($var) { - $mes->add("Custom - Failed to add default table data.", E_MESSAGE_ERROR); + $sql = e107::getDb(); + $mes = e107::getMessage(); + + $e107_blank = array( + 'blank_id' =>'1', + 'blank_icon' =>'{e_PLUGIN}_blank/images/blank_32.png', + 'blank_type' =>'type_1', + 'blank_name' =>'My Name', + 'blank_folder' =>'Folder Value', + 'blank_version' =>'1', + 'blank_author' =>'bill', + 'blank_authorURL' =>'http://e107.org', + 'blank_date' =>'1352871240', + 'blank_compatibility' =>'2', + 'blank_url' =>'http://e107.org' + ); + + if($sql->insert('blank',$e107_blank)) + { + $mes->add("Custom - Install Message.", E_MESSAGE_SUCCESS); + } + else + { + $mes->add("Custom - Failed to add default table data.", E_MESSAGE_ERROR); + } + + } + + function uninstall_options() + { + + $listoptions = array(0=>'option 1',1=>'option 2'); + + $options = array(); + $options['mypref'] = array( + 'label' => 'Custom Uninstall Label', + 'preview' => 'Preview Area', + 'helpText' => 'Custom Help Text', + 'itemList' => $listoptions, + 'itemDefault' => 1 + ); + + return $options; + } + + + function uninstall_post($var) + { + // print_a($var); + } + + function upgrade_post($var) + { + // $sql = e107::getDb(); } } - - function uninstall_options() - { - - $listoptions = array(0=>'option 1',1=>'option 2'); - - $options = array(); - $options['mypref'] = array( - 'label' => 'Custom Uninstall Label', - 'preview' => 'Preview Area', - 'helpText' => 'Custom Help Text', - 'itemList' => $listoptions, - 'itemDefault' => 1 - ); - - return $options; - } - - function uninstall_post($var) - { - // print_a($var); - } - - function upgrade_post($var) - { - // $sql = e107::getDb(); - } - -} -?> \ No newline at end of file +} \ No newline at end of file