diff --git a/class2.php b/class2.php index 70db38e2f..be952626e 100644 --- a/class2.php +++ b/class2.php @@ -713,6 +713,11 @@ if (!function_exists('checkvalidtheme')) if (ADMIN && strpos(e_SELF, $ADMIN_DIRECTORY) === false) { echo ''; + $tm = e107::getSingleton('themeHandler'); + $tm->setTheme($e107tmp_theme); + // $config = e107::getConfig(); + // $config->set('sitetheme','core'); + } } $themes_dir = $e107->getFolder('themes'); diff --git a/e107_admin/admin.php b/e107_admin/admin.php index a56fbd67a..c03824e44 100644 --- a/e107_admin/admin.php +++ b/e107_admin/admin.php @@ -165,10 +165,7 @@ if (e_QUERY == 'purge' && getperms('0')) */ $td = 1; -if(!defined("ADLINK_COLS")) -{ - define("ADLINK_COLS",5); -} + // DEPRECATED function render_links($link, $title, $description, $perms, $icon = FALSE, $mode = FALSE) diff --git a/e107_admin/e107_update.php b/e107_admin/e107_update.php index 9bc0dcb8d..f1d8af4ae 100644 --- a/e107_admin/e107_update.php +++ b/e107_admin/e107_update.php @@ -16,20 +16,19 @@ */ require_once ("../class2.php"); -include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE); +// include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE); $e_sub_cat = 'database'; require_once ("auth.php"); require_once ("update_routines.php"); -$mes = e107::getMessage(); -$frm = e107::getForm(); -// FIX ME - Should be a class so it can be called any where. +// -// Carry out core updates +// Carry out CORE updates +/* function run_updates($dbupdate) { global $mes; @@ -77,6 +76,9 @@ function run_updates_plugin($func,$check=TRUE) // New for {plugin}_setup.php } } + + + function show_updates($dbupdate, $what) { global $frm; @@ -122,7 +124,8 @@ function show_updates($dbupdate, $what) } $text .= "\n"; } - elseif(class_exists($func.'_setup')) // plugin_setup.php + + if(class_exists($func.'_setup')) // plugin_setup.php { $text .= "{$rmks}"; @@ -151,6 +154,192 @@ function show_updates($dbupdate, $what) echo $text; return $updates; // Number of updates to do } +*/ + + +// New in v2.x ------------------------------------------------ + +class e107Update +{ + var $core = array(); + var $updates = 0; + + + function __construct($core=null) + { + $mes = e107::getMessage(); + + $this->core = $core; + + if(varset($_POST['update_core']) && is_array($_POST['update_core'])) + { + $message = $this->updateCore(); + } + + if(varset($_POST['update']) && is_array($_POST['update'])) // Do plugin updates + { + $func = key($_POST['update']); + $this->updatePlugin($func); + } + + if(vartrue($message)) + { + $mes->addSuccess($message); + } + + $this->renderForm(); + } + + + + + function updateCore() + { + $mes = e107::getMessage(); + + foreach($this->core as $func => $rmks) + { + if(function_exists('update_'.$func)) // Legacy Method. + { + $installed = call_user_func("update_".$func); + //?! (LAN_UPDATE == $_POST[$func]) + if(varsettrue($_POST['update_core'][$func]) && !$installed) + { + if(function_exists("update_".$func)) + { + $message = LAN_UPDATE_7." {$rmks}"; + $error = call_user_func("update_".$func, "do"); + + if($error != '') + { + $mes->add($message, E_MESSAGE_ERROR); + $mes->add($error, E_MESSAGE_ERROR); + } + else + { + $mes->add($message, E_MESSAGE_SUCCESS); + } + } + } + } + + } + + } + + + + function updatePlugin($path) + { + e107::getPlugin()->install_plugin_xml($path, 'upgrade'); + } + + + + function plugins() + { + if(!$list = e107::getPlugin()->updateRequired()) + { + return; + } + + $frm = e107::getForm(); + + $text = ""; + foreach($list as $path=>$val) + { + $text .= " + ".$val['@attributes']['name']." + ".$frm->admin_button('update['.$path.']', LAN_UPDATE, 'warning')." + "; + } + + return $text; + } + + + + + function core() + { + $frm = e107::getForm(); + + $text = ""; + + foreach($this->core as $func => $rmks) + { + if(function_exists("update_".$func)) + { + $text .= "{$rmks}"; + + if(call_user_func("update_".$func)) + { + $text .= "".LAN_UPDATE_3.""; + } + else + { + $this->updates ++; + $text .= "".$frm->admin_button('update_core['.$func.']', LAN_UPDATE, 'warning', '', "id=e-{$func}").""; + } + $text .= "\n"; + } + } + + return $text; + } + + + + function renderForm() + { + $ns = e107::getRender(); + $mes = e107::getMessage(); + + $caption = LAN_UPDATE; + $text = " +
+
+ {$caption} + + + + + + + + + + + + + "; + + $text .= $this->core(); + $text .= $this->plugins(); + + $text .= " + +
".LAN_UPDATE_55."".LAN_UPDATE_2."
+
+
+ "; + + + $ns->tablerender("Updates",$mes->render() . $text); + + } + + +} + +new e107Update($dbupdate); + + +require_once ("footer.php"); + + + +/* if(varset($_POST['update_core']) && is_array($_POST['update_core'])) { @@ -181,6 +370,10 @@ if($total_updates == 0) { // No updates needed - clear the cache to be sure $e107cache->set_sys("nq_admin_updatecheck", time().', 1, '.$e107info['e107_version'], TRUE); } + * + * + */ + + -require_once ("footer.php"); ?> \ No newline at end of file diff --git a/e107_admin/footer.php b/e107_admin/footer.php index 74c26ced1..fc08bf8e8 100644 --- a/e107_admin/footer.php +++ b/e107_admin/footer.php @@ -172,7 +172,7 @@ if (varset($e107_popup) != 1) } else { - echo($rinfo ? "\n\n" : ""); + echo($rinfo ? "\n\n" : ""); } } // End of regular-page footer (the above NOT done for popups) diff --git a/e107_admin/includes/infopanel.php b/e107_admin/includes/infopanel.php index 594f8361a..495f5dadb 100644 --- a/e107_admin/includes/infopanel.php +++ b/e107_admin/includes/infopanel.php @@ -21,6 +21,8 @@ if (!defined('e107_INIT')) class adminstyle_infopanel { + private $iconlist = array(); + function __construct() { e107::js('core','tweet/jquery.tweet.js'); @@ -64,6 +66,13 @@ EOF; save_prefs(); } + + + $array_functions_assoc = e107::getNav()->adminLinks('assoc'); + + $this->iconlist = array_merge($array_functions_assoc, e107::getNav()->pluginLinks(E_16_PLUGMANAGER, "array")); + + } @@ -145,9 +154,7 @@ EOF; } - $array_functions_assoc = e107::getNav()->adminLinks('assoc'); - $iconlist = array_merge($array_functions_assoc, e107::getNav()->pluginLinks(E_16_PLUGMANAGER, "array")); // "
"; @@ -161,7 +168,7 @@ EOF;
"; - foreach ($iconlist as $key=>$val) + foreach ($this->iconlist as $key=>$val) { if (!vartrue($user_pref['core-infopanel-mye107']) || in_array($key, $user_pref['core-infopanel-mye107'])) { @@ -231,7 +238,7 @@ EOF; Username IP Page - Agent + Agent "; @@ -248,7 +255,7 @@ EOF; ".$this->renderOnlineName($val['online_user_id'])." ".e107::getIPHandler()->ipDecode($val['user_ip'])." ".basename($val['user_location'])." - ".$this->browserIcon($val)." + ".$this->browserIcon($val)." "; } @@ -386,9 +393,9 @@ EOF; $text2 = "
"; - $text2 .= $ns->tablerender("Personalize Icons",render_infopanel_icons(),'personalize',true); + $text2 .= $ns->tablerender("Personalize Icons", $this->render_infopanel_icons(),'personalize',true); $text2 .= "
 
"; - $text2 .= $ns->tablerender("Personalize Menus",render_infopanel_menu_options(),'personalize',true); + $text2 .= $ns->tablerender("Personalize Menus", $this->render_infopanel_menu_options(),'personalize',true); // $text2 .= render_infopanel_icons(); //$text2 .= "
 
"; // $text2 .= "

Menus

"; @@ -408,21 +415,24 @@ EOF; function render_infopanel_icons() { - $frm = e107::getSingleton('e_form'); - global $iconlist,$pluglist, $user_pref; + + $frm = e107::getForm(); + global $user_pref; $text = ""; - foreach ($iconlist as $key=>$icon) + foreach ($this->iconlist as $key=>$icon) { if (getperms($icon['perms'])) { $checked = (varset($user_pref['core-infopanel-mye107']) && in_array($key, $user_pref['core-infopanel-mye107'])) ? true : false; $text .= "
".$icon['icon'].' '.$frm->checkbox_label($icon['title'], 'e-mye107[]', $key, $checked)."
"; + } } + if (is_array($pluglist)) { foreach ($pluglist as $key=>$icon) diff --git a/e107_admin/plugin.php b/e107_admin/plugin.php index df919e308..ec8a2084e 100644 --- a/e107_admin/plugin.php +++ b/e107_admin/plugin.php @@ -663,15 +663,13 @@ class pluginManager{ function pluginUpgrade() { - $pref = e107::getPref(); - $admin_log = e107::getAdminLog(); - $plugin = e107::getPlugin(); + $pref = e107::getPref(); + $admin_log = e107::getAdminLog(); + $plugin = e107::getPlugin(); - $sql = e107::getDb(); - - $emessage = eMessage::getInstance(); - - $plug = $plugin->getinfo($this->id); + $sql = e107::getDb(); + $emessage = eMessage::getInstance(); + $plug = $plugin->getinfo($this->id); $_path = e_PLUGIN.$plug['plugin_path'].'/'; if(file_exists($_path.'plugin.xml')) diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php index e414caf16..8881ecbd9 100644 --- a/e107_admin/update_routines.php +++ b/e107_admin/update_routines.php @@ -86,6 +86,7 @@ if ($dont_check_update === TRUE) if (!$dont_check_update) { + /* if ($sql->db_Select('plugin', 'plugin_id, plugin_version, plugin_path', 'plugin_installflag=1')) { while ($row = $sql->db_Fetch()) @@ -97,13 +98,18 @@ if (!$dont_check_update) } } } - - + */ + + $dbupdateplugs = e107::getConfig('core')->get('plug_installed'); + // Read in each update file - this will add an entry to the $dbupdatep array if a potential update exists foreach ($dbupdateplugs as $path => $ver) { - $fname = e_PLUGIN.$path.'/'.$path.'_update_check.php'; - if (is_readable($fname)) include_once($fname); + if(!is_file(e_PLUGIN.$path."/plugin.xml")) + { + $fname = e_PLUGIN.$path.'/'.$path.'_update_check.php'; // DEPRECATED - left for BC only. + if (is_readable($fname)) include_once($fname); + } $fname = e_PLUGIN.$path.'/'.$path.'_setup.php'; if (is_readable($fname)) @@ -120,7 +126,7 @@ if (!$dont_check_update) $dbupdate['test_code'] = 'Test update routine'; } $dbupdate['core_prefs'] = LAN_UPDATE_13; // Prefs check - $dbupdate['706_to_800'] = LAN_UPDATE_8.' 1.x '.LAN_UPDATE_9.' 2.0'; + $dbupdate['706_to_800'] = LAN_UPDATE_8.' 1.x '.LAN_UPDATE_9.' 2.0 (Must be run first)'; // $dbupdate['70x_to_706'] = LAN_UPDATE_8.' .70x '.LAN_UPDATE_9.' .706'; } // End if (!$dont_check_update) @@ -133,31 +139,32 @@ if (!$dont_check_update) function update_check() { - + $ns = e107::getRender(); + $e107cache = e107::getCache(); + $sql = e107::getDb(); + $mes = e107::getMessage(); - global $ns, $dont_check_update, $e107info; - + global $dont_check_update, $e107info; + global $dbupdate, $dbupdatep, $e107cache; $update_needed = FALSE; if ($dont_check_update === FALSE) { - global $dbupdate, $dbupdatep, $e107cache; - - // See which core functions need update - foreach($dbupdate as $func => $rmks) + + foreach($dbupdate as $func => $rmks) // See which core functions need update { if (function_exists('update_'.$func)) { if (!call_user_func('update_'.$func, FALSE)) { $update_needed = TRUE; - continue; + break; } } } - // Now check plugins + // Now check plugins - XXX DEPRECATED foreach($dbupdatep as $func => $rmks) { if (function_exists('update_'.$func)) @@ -165,12 +172,19 @@ function update_check() if (!call_user_func('update_'.$func, FALSE)) { $update_needed = TRUE; - continue; + break; } } } + + // New in v2.x + if(e107::getPlugin()->updateRequired('boolean')) + { + $update_needed = TRUE; + } + - $e107cache->set_sys('nq_admin_updatecheck', time().','.($update_needed ? '2,' : '1,').$e107info['e107_version'], TRUE); + // $e107cache->set_sys('nq_admin_updatecheck', time().','.($update_needed ? '2,' : '1,').$e107info['e107_version'], TRUE); } else { @@ -179,32 +193,31 @@ function update_check() if ($update_needed === TRUE) { - require_once (e_HANDLER.'form_handler.php'); - $frm = new e_form(); + $frm = e107::getForm(); + $txt = "
".ADLAN_120." - ".$frm->admin_button('e107_system_update', LAN_UPDATE, 'update')." + ".$frm->admin_button('e107_system_update', LAN_UPDATE, 'other')."
"; - - require_once (e_HANDLER.'message_handler.php'); - $emessage = &eMessage::getInstance(); - $emessage->add($txt); + + $mes->addInfo($txt); } } - -require_once(e_HANDLER.'e_upgrade_class.php'); +//XXX to be reworked eventually - for checking remote 'new versions' of plugins and installed theme. +// require_once(e_HANDLER.'e_upgrade_class.php'); // $upg = new e_upgrade; - //TODO Enable this before release!! + // $upg->checkSiteTheme(); // $upg->checkAllPlugins(); + //-------------------------------------------- // Check current prefs against latest list //-------------------------------------------- @@ -267,7 +280,7 @@ if (defined('TEST_UPDATE')) //-------------------------------------------- function update_706_to_800($type='') { - global $ns, $pref, $e107info; + global $pref, $e107info; global $sysprefs, $eArrayStorage; //$mes = new messageLog; // Combined logging and message displaying handler @@ -276,15 +289,15 @@ function update_706_to_800($type='') $sql = e107::getDb(); $sql2 = e107::getDb('sql2'); $tp = e107::getParser(); + $ns = e107::getRender(); - e107::getCache()->clearAll('db'); // List of unwanted $pref values which can go $obs_prefs = array('frontpage_type','rss_feeds', 'log_lvcount', 'zone', 'upload_allowedfiletype', 'real', 'forum_user_customtitle', 'utf-compatmode','frontpage_method','standards_mode','image_owner','im_quality', 'signup_option_timezone', 'modules', 'plug_sc', 'plug_bb', 'plug_status', 'plug_latest', 'subnews_hide_news', 'upload_storagetype' -); + ); // List of DB tables not required (includes a few from 0.6xx) $obs_tables = array('flood', 'headlines', 'stat_info', 'stat_counter', 'stat_last', 'session', 'preset', 'tinymce'); diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index a94fa3b61..c88a0f4cf 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -930,15 +930,16 @@ class admin_shortcodes $banned = $sql -> db_Count('user', '(*)', 'WHERE user_ban=1'); $comments = $sql -> db_Count('comments'); - - $unver = ($unverified ? " ".ADLAN_111."" : ADLAN_111); - + $unver = ($unverified ? " ".ADLAN_111.": {$unverified}" : ADLAN_111); + $lban = ($banned) ? "".ADLAN_112. ": ".$banned."" : ADLAN_112.":"; + $lcomment = ($comments) ? "".ADLAN_114.": ".$comments."" : ADLAN_114; + $text = "
-
".E_16_USER." ".ADLAN_110.": ".$members."
-
".E_16_USER." {$unver}: ".$unverified."
-
".E_16_BANLIST." ".ADLAN_112.": ".$banned."
-
".E_16_COMMENT." ".ADLAN_114.": ".$comments."
\n\n"; +
". E_16_USER." ".ADLAN_110.": ".$members."
+
".E_16_USER." {$unver}
+
".E_16_BANLIST." ".$lban."
+
".E_16_COMMENT." ".$lcomment."
\n\n"; if(vartrue($pref['e_status_list'])) { diff --git a/e107_handlers/e_upgrade_class.php b/e107_handlers/e_upgrade_class.php index 8cde4f8bc..7bc3f8712 100644 --- a/e107_handlers/e_upgrade_class.php +++ b/e107_handlers/e_upgrade_class.php @@ -28,6 +28,10 @@ For plugins, use db_Select("plugin", "plugin_id", "plugin_path = '".(string) $path."' LIMIT 1")) + { + $row = $sql->db_Fetch(MYSQL_ASSOC); + return intval($row['plugin_id']); + } + + return false; + } + + /** + * Checks all installed plugins and returns an array of those needing an update. + * @param string $mode 'boolean' for a quick true/false or null for full array returned. + * @return mixed + */ + function updateRequired($mode=null) + { + $xml = e107::getXml(); + $mes = e107::getMessage(); + $needed = array(); + $plugVersions = e107::getConfig('core')->get('plug_installed'); + + foreach($plugVersions as $path=>$version) + { + $fullPath = e_PLUGIN.$path."/plugin.xml"; + if(is_file(e_PLUGIN.$path."/plugin.xml")) + { + $data = $xml->loadXMLfile($fullPath, true); + $curVal = floatval($version); + $fileVal = floatval($data['@attributes']['version']); + + if($ret = $this->execute_function($path, 'upgrade', 'required')) // Check {plugin}_setup.php and run a 'required' method, if true, then update is required. + { + if($mode == 'boolean') + { + $mes->addDebug("Plugin Update(s) Required"); + return TRUE; + } + $needed[$path] = $data; + } + + if($curVal < $fileVal) + { + + if($mode == 'boolean') + { + $mes->addDebug("Plugin Update(s) Required"); + return TRUE; + } + + $mes->addDebug("Plugin: {$path} requires an update."); + $needed[$path] = $data; + } + } + + } + + return count($needed) ? $needed : FALSE; + } /** * Check for new plugins, create entry in plugin table and remove deleted plugins */ function update_plugins_table() { - + $sql = e107::getDb(); $sql2 = e107::getDb('sql2'); $tp = e107::getParser(); $fl = e107::getFile(); + $mes = e107::getMessage(); + $mes->addDebug("Updating plugins Table"); - global $mySQLprefix, $menu_pref, $pref; + global $mySQLprefix, $menu_pref; + $pref = e107::getPref(); + $sp = FALSE; @@ -1143,7 +1215,7 @@ class e107plugin /** * Install routine for XML file - * @param object $id (the number of the plugin in the DB) + * @param object $id (the number of the plugin in the DB) or the path to the plugin folder. eg. 'forum' * @param object $function install|upgrade|uninstall|refresh (adds things that are missing, but doesn't change any existing settings) * @param object $options [optional] an array of possible options - ATM used only for uninstall: * 'delete_userclasses' - to delete userclasses created @@ -1154,9 +1226,13 @@ class e107plugin * @return TBD */ function install_plugin_xml($id, $function = '', $options = FALSE) - { - global $pref; - + { + if(!is_numeric($id)) + { + $id = $this->getId($id); // use path instead. + } + + $pref = e107::getPref(); $sql = e107::getDb(); $mes = e107::getMessage(); @@ -1197,6 +1273,8 @@ class e107plugin $error[] = EPL_ADLAN_76; $canContinue = FALSE; } + + if (varset($plug_vars['languageFiles'])) { @@ -1215,15 +1293,15 @@ class e107plugin } // All the dependencies are OK - can start the install now - + if ($canContinue) // Run custom {plugin}_setup install/upgrade etc. for INSERT, ALTER etc. etc. etc. { - $ret = $this->execute_function($path, $function, 'pre'); + $ret = $this->execute_function($plug['plugin_path'], $function, 'pre'); if (!is_bool($ret)) $txt .= $ret; } - + // Handle tables if ($canContinue && count($sql_list)) // TODO - move to it's own function. XmlTables(). { @@ -1280,6 +1358,7 @@ class e107plugin } } + if (varset($plug_vars['adminLinks'])) { $this->XmlAdminLinks($function, $plug_vars['adminLinks']); @@ -1373,7 +1452,7 @@ class e107plugin // Run custom {plugin}_setup install/upgrade etc. for INSERT, ALTER etc. etc. etc. // Call any custom post functions defined in _setup.php or the deprecated section - if (!$this->execute_function($path, $function, 'post')) + if (!$this->execute_function($plug['plugin_path'], $function, 'post')) { if ($function == 'install') { @@ -1885,54 +1964,62 @@ class e107plugin * @param object $when pre|post * @return boolean FALSE */ - function execute_function($path = '', $what = '', $when = '') + function execute_function($path = null, $what = '', $when = '') { $mes = eMessage::getInstance(); - $class_name = $this->plugFolder."_setup"; + + if($path == null) + { + $path = $this->plugFolder; + } + + $class_name = $path."_setup"; // was using $this->pluginFolder; $method_name = $what."_".$when; - - if (varset($this->plug_vars['@attributes']['setupFile'])) - { - $setup_file = e_PLUGIN.$this->plugFolder.'/'.$this->plug_vars['@attributes']['setupFile']; - } - else - { - $setup_file = e_PLUGIN.$this->plugFolder.'/'.$this->plugFolder.'_setup.php'; - } + + + // {PLUGIN}_setup.php should ALWAYS be the name. + // if (varset($this->plug_vars['@attributes']['setupFile'])) + // { + // $setup_file = e_PLUGIN.$this->plugFolder.'/'.$this->plug_vars['@attributes']['setupFile']; + // } + // else + // { + $setup_file = e_PLUGIN.$path.'/'.$path.'_setup.php'; + // } if (is_readable($setup_file)) { - $mes->add("Found setup file ".$setup_file." ", E_MESSAGE_DEBUG); + $mes->add("Found setup file ".$path."_setup.php ", E_MESSAGE_DEBUG); include_once($setup_file); + if (class_exists($class_name)) { $obj = new $class_name; $obj->version_from = $this; + if (method_exists($obj, $method_name)) { - $mes->add("Executing setup function ".$method_name."()", E_MESSAGE_DEBUG); + $mes->add("Executing setup function ".$class_name." :: ".$method_name."()", E_MESSAGE_DEBUG); return call_user_func(array($obj, $method_name), $this); } else { - $mes->add("Setup function ".$method_name."() NOT found.", E_MESSAGE_DEBUG); + $mes->add("Setup function ".$class_name." :: ".$method_name."() NOT found.", E_MESSAGE_DEBUG); return FALSE; } } else { - $mes->add("Setup function ".$method_name."() NOT found.", E_MESSAGE_DEBUG); + $mes->add("Setup Class ".$class_name." NOT found.", E_MESSAGE_DEBUG); return FALSE; } } else { - $mes->add("Optional Setup File NOT Found ".$setup_file." ", E_MESSAGE_DEBUG); + $mes->add("Optional Setup File NOT Found ".$path."_setup.php ", E_MESSAGE_DEBUG); } - $mes->add("Setup function ".$method_name."() NOT found.", E_MESSAGE_DEBUG); - return FALSE; // IMPORTANT. } diff --git a/e107_plugins/forum/forum_setup.php b/e107_plugins/forum/forum_setup.php index 2d47f53a0..e3cc75af7 100644 --- a/e107_plugins/forum/forum_setup.php +++ b/e107_plugins/forum/forum_setup.php @@ -42,17 +42,30 @@ class forum_setup $mes->add("Setting all user_forums to 0.", E_MESSAGE_SUCCESS); }*/ } + + /* + * Call During Upgrade Check. May be used to check for existance of tables etc and if not found return TRUE to call for an upgrade. + * + */ + function upgrade_required() + { + return false; // true to trigger an upgrade alert, and false to not. + } + function upgrade_pre($var) { //Redirect upgrade to customized upgrade routine - header('Location: '.e_PLUGIN.'forum/forum_update.php'); - exit; + + // e107::getRedirect()->redirect(e_PLUGIN.'forum/forum_update.php'); + + //header('Location: '.e_PLUGIN.'forum/forum_update.php'); } + // After Automatic Upgrade Routine has completed.. run this. ;-) function upgrade_post($var) - { - $sql = e107::getDb(); + { $mes = e107::getMessage(); + $mes->addSuccess("Migration is required. Please click 'Continue'.
Continue"); } } diff --git a/e107_plugins/forum/forum_update.php b/e107_plugins/forum/forum_update.php index 33a9ba26c..5386428d3 100644 --- a/e107_plugins/forum/forum_update.php +++ b/e107_plugins/forum/forum_update.php @@ -13,23 +13,16 @@ * */ -if(defined('e_PAGE') && e_PAGE == 'e107_update.php') -{ - echo " - - "; - exit; -} -$eplug_admin = true; +define('e_ADMIN_AREA',true); require_once('../../class2.php'); + if (!getperms('P')) { header('location:'.e_BASE.'index.php'); exit; } + error_reporting(E_ALL); require_once(e_PLUGIN.'forum/forum_class.php'); require_once(e_ADMIN.'auth.php'); @@ -40,10 +33,13 @@ $f = new forumUpgrade; $e107 = e107::getInstance(); $upgradeNeeded = $f->checkUpdateNeeded(); +$upgradeNeeded = true; if(!$upgradeNeeded) { - $text = "The forum is already at the most recent version, no upgrade is required"; - $ns->tablerender('Forum Upgrade', $text); + $mes = e107::getMessage(); + + $mes->addInfo("The forum is already at the most recent version, no upgrade is required"); + $ns->tablerender('Forum Upgrade', $mes->render()); require(e_ADMIN.'footer.php'); exit; } @@ -138,7 +134,7 @@ function step2() require_once(e_HANDLER.'db_table_admin_class.php'); $db = new db_table_admin; - $tabList = array('forum' => 'forum_new', 'forum_thread' => '', 'forum_post' => '', 'forum_track' => ''); + $tabList = array('forum' => 'forum_new'); // , 'forum_thread' => '', 'forum_post' => '', 'forum_track' => '' $ret = ''; $failed = false; $text = ''; @@ -146,11 +142,11 @@ function step2() { $text .= 'Creating table '.($rename ? $rename : $name).' -> '; $result = $db->createTable(e_PLUGIN.'forum/forum_sql.php', $name, true, $rename); - if($result) + if($result === true) { $text .= 'Success
'; } - else + elseif($result !== true) { $text .= 'Failed
'; $failed = true; @@ -168,13 +164,16 @@ function step2() $text .= "

- +
"; } $e107->ns->tablerender('Step 2: Forum table creation', $text); } + +// DEPRECATED - Done automatically via plugin-class. +/* function step3() { $e107 = e107::getInstance(); @@ -233,7 +232,7 @@ function step3() $e107->ns->tablerender($stepCaption, $text); } - +*/ function step4() { global $pref; @@ -364,7 +363,7 @@ function step5() { $text = " This step will copy all of your forum configuration from the `forum` table into the `forum_new` table.

- Once the information is successfully copied, the existing 0.7 forum table will be renamed `forum_old` and the newly created `forum_new` table will be renamed `forum`.
+ Once the information is successfully copied, the existing 1.0 forum table will be renamed `forum_old` and the newly created `forum_new` table will be renamed `forum`.


@@ -684,6 +683,8 @@ function step10() $e107 = e107::getInstance(); global $f; $stepCaption = 'Step 10: Migrate forum attachments'; + + //FIXME - Files should be moved to e107_media/files/forum/ if(!isset($_POST['migrate_attachments'])) { $text = " @@ -1439,8 +1440,15 @@ function forum_update_adminmenu() { $var[$i]['text'] = "{$var[$i]['text']}"; } + + if(isset($_POST['nextStep'])) + { + $tmp = array_keys($_POST['nextStep']); + $action = $tmp[0]; + + } - show_admin_menu('Forum Upgrade', $currentStep, $var); + show_admin_menu('Forum Upgrade', $action, $var); } ?> \ No newline at end of file diff --git a/e107_plugins/forum/plugin.xml b/e107_plugins/forum/plugin.xml index c2c4e4fde..14cf4c9ec 100755 --- a/e107_plugins/forum/plugin.xml +++ b/e107_plugins/forum/plugin.xml @@ -1,7 +1,7 @@ - + - This plugin is a fully featured Forum system + This plugin is a fully featured Forum system content Configure Forum diff --git a/e107_themes/bootstrap/admin_style.css b/e107_themes/bootstrap/admin_style.css index 184f4d12f..4131a583f 100644 --- a/e107_themes/bootstrap/admin_style.css +++ b/e107_themes/bootstrap/admin_style.css @@ -230,7 +230,7 @@ i.s-message-debug { background-position: -1480px 0; width: 32px; height: 32px; .s-message-body { padding-left: 42px; } .s-message-item {} - +.e-footer-info { text-align: center } /* ************* Backwards Compatibility CSS *****************/ diff --git a/e107_themes/bootstrap/admin_template.php b/e107_themes/bootstrap/admin_template.php index e012caa12..8b8915045 100644 --- a/e107_themes/bootstrap/admin_template.php +++ b/e107_themes/bootstrap/admin_template.php @@ -17,7 +17,7 @@ if (!defined('e107_INIT')) { exit(); } -define("ADLINK_COLS",5); + // include_lan(e_THEME."_blank/languages/".e_LANGUAGE.".php");