1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-25 00:41:52 +02:00

Notice removal and forum upgrade fixes. Re-wrote e107_update-page routine. Check for update is now performed inside [plugin]_setup.php

This commit is contained in:
Cameron
2012-12-08 00:36:34 -08:00
parent f97af6e6b6
commit 159fb63bfb
15 changed files with 450 additions and 121 deletions

View File

@@ -713,6 +713,11 @@ if (!function_exists('checkvalidtheme'))
if (ADMIN && strpos(e_SELF, $ADMIN_DIRECTORY) === false)
{
echo '<script>alert("'.$tp->toJS(CORE_LAN1).'")</script>';
$tm = e107::getSingleton('themeHandler');
$tm->setTheme($e107tmp_theme);
// $config = e107::getConfig();
// $config->set('sitetheme','core');
}
}
$themes_dir = $e107->getFolder('themes');

View File

@@ -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)

View File

@@ -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 .= "</tr>\n";
}
elseif(class_exists($func.'_setup')) // plugin_setup.php
if(class_exists($func.'_setup')) // plugin_setup.php
{
$text .= "<tr><td>{$rmks}</td>";
@@ -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 .= "<tr>
<td>".$val['@attributes']['name']."</td>
<td>".$frm->admin_button('update['.$path.']', LAN_UPDATE, 'warning')."</td>
</tr>";
}
return $text;
}
function core()
{
$frm = e107::getForm();
$text = "";
foreach($this->core as $func => $rmks)
{
if(function_exists("update_".$func))
{
$text .= "<tr><td>{$rmks}</td>";
if(call_user_func("update_".$func))
{
$text .= "<td>".LAN_UPDATE_3."</td>";
}
else
{
$this->updates ++;
$text .= "<td>".$frm->admin_button('update_core['.$func.']', LAN_UPDATE, 'warning', '', "id=e-{$func}")."</td>";
}
$text .= "</tr>\n";
}
}
return $text;
}
function renderForm()
{
$ns = e107::getRender();
$mes = e107::getMessage();
$caption = LAN_UPDATE;
$text = "
<form method='post' action='".e_SELF."'>
<fieldset id='core-e107-update'>
<legend>{$caption}</legend>
<table class='table adminlist'>
<colgroup>
<col style='width: 60%' />
<col style='width: 40%' />
</colgroup>
<thead>
<tr>
<th>".LAN_UPDATE_55."</th>
<th class='last'>".LAN_UPDATE_2."</th>
</tr>
</thead>
<tbody>
";
$text .= $this->core();
$text .= $this->plugins();
$text .= "
</tbody>
</table>
</fieldset>
</form>
";
$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");
?>

View File

@@ -172,7 +172,7 @@ if (varset($e107_popup) != 1)
}
else
{
echo($rinfo ? "\n<div class='e-footer-info'>{$rinfo}</div>\n" : "");
echo($rinfo ? "\n<div class='e-footer-info center' style='margin-top:10px'>{$rinfo}</div>\n" : "");
}
} // End of regular-page footer (the above NOT done for popups)

View File

@@ -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"));
// "<form method='post' action='".e_SELF."?".e_QUERY."'>";
@@ -161,7 +168,7 @@ EOF;
<div class='left' style='padding:32px'>";
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;
<th>Username</th>
<th>IP</th>
<th>Page</th>
<th>Agent</th>
<th class='center'>Agent</th>
</tr>
</thead>
<tbody>";
@@ -248,7 +255,7 @@ EOF;
<td>".$this->renderOnlineName($val['online_user_id'])."</td>
<td>".e107::getIPHandler()->ipDecode($val['user_ip'])."</td>
<td><a class='e-tip' href='".$val['user_location']."' title='".$val['user_location']."'>".basename($val['user_location'])."</a></td>
<td><a class='e-tip' href='#' title='".$val['user_agent']."'>".$this->browserIcon($val)."</a></td>
<td class='center'><a class='e-tip' href='#' title='".$val['user_agent']."'>".$this->browserIcon($val)."</a></td>
</tr>
";
}
@@ -386,9 +393,9 @@ EOF;
$text2 = "<div id='customize_icons' class='forumheader3' style='border:0px;margin:0px'>
<form method='post' id='e-modal-form' action='".e_SELF."'>";
$text2 .= $ns->tablerender("Personalize Icons",render_infopanel_icons(),'personalize',true);
$text2 .= $ns->tablerender("Personalize Icons", $this->render_infopanel_icons(),'personalize',true);
$text2 .= "<div class='clear'>&nbsp;</div>";
$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 .= "<div class='clear'>&nbsp;</div>";
// $text2 .= "<h3>Menus</h3>";
@@ -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 .= "<div class='left f-left list field-spacer' style='display:block;height:24px;width:200px;'>
".$icon['icon'].' '.$frm->checkbox_label($icon['title'], 'e-mye107[]', $key, $checked)."</div>";
}
}
if (is_array($pluglist))
{
foreach ($pluglist as $key=>$icon)

View File

@@ -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'))

View File

@@ -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 = "
<form method='post' action='".e_ADMIN_ABS."e107_update.php'>
<div>
".ADLAN_120."
".$frm->admin_button('e107_system_update', LAN_UPDATE, 'update')."
".$frm->admin_button('e107_system_update', LAN_UPDATE, 'other')."
</div>
</form>
";
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');

View File

@@ -930,15 +930,16 @@ class admin_shortcodes
$banned = $sql -> db_Count('user', '(*)', 'WHERE user_ban=1');
$comments = $sql -> db_Count('comments');
$unver = ($unverified ? " <a href='".e_ADMIN."users.php?searchquery=&amp;filter_options=user_ban__2&amp;filter=unverified'>".ADLAN_111."</a>" : ADLAN_111);
$unver = ($unverified ? " <a href='".e_ADMIN."users.php?searchquery=&amp;filter_options=user_ban__2&amp;filter=unverified'> ".ADLAN_111.": {$unverified}</a>" : ADLAN_111);
$lban = ($banned) ? "<a href='".e_ADMIN_ABS."users.php??searchquery=&filter_options=user_ban__1&filter=banned'>".ADLAN_112. ": ".$banned."</a>" : ADLAN_112.":";
$lcomment = ($comments) ? "<a href='".e_ADMIN_ABS."comment.php'>".ADLAN_114.": ".$comments."</a>" : ADLAN_114;
$text = "
<div class='left'>
<div style='padding-bottom: 2px;'>".E_16_USER." ".ADLAN_110.": <a href='".e_ADMIN_ABS."users.php?filter=0'>".$members."</a></div>
<div style='padding-bottom: 2px;'>".E_16_USER." {$unver}: <a href='".e_ADMIN_ABS."users.php?filter=unverified'>".$unverified."</a></div>
<div style='padding-bottom: 2px;'>".E_16_BANLIST." ".ADLAN_112.": <a href='".e_ADMIN_ABS."users.php?filter=banned'>".$banned."</a></div>
<div style='padding-bottom: 2px;'>".E_16_COMMENT." ".ADLAN_114.": <a href='".e_ADMIN_ABS."comment.php'>".$comments."</a></div>\n\n";
<div style='padding-bottom: 2px;'>". E_16_USER." <a href='".e_ADMIN_ABS."users.php?filter=0'>".ADLAN_110.": ".$members."</a></div>
<div style='padding-bottom: 2px;'>".E_16_USER." {$unver}</div>
<div style='padding-bottom: 2px;'>".E_16_BANLIST." ".$lban."</div>
<div style='padding-bottom: 2px;'>".E_16_COMMENT." ".$lcomment."</div>\n\n";
if(vartrue($pref['e_status_list']))
{

View File

@@ -28,6 +28,10 @@ For plugins, use <plugin name='.... etc
*/
// XXX TODO FIXME REQUIRES Overhaul for use with the e107.org 'shop' only.
class e_upgrade
{
protected $_options = array();

View File

@@ -138,19 +138,91 @@ class e107plugin
}
return false;
}
/**
* Returns an array containing details of all plugins in the plugin table - should normally use e107plugin::update_plugins_table() first to
* make sure the table is up to date. (Primarily called from plugin manager to get lists of installed and uninstalled plugins.
* @return array plugin details
*/
function getId($path)
{
$sql = e107::getDb();
if ($sql->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: <strong>{$path}</strong> 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 <plugin>_setup.php or the deprecated <management> 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 <b>".$setup_file."</b> ", E_MESSAGE_DEBUG);
$mes->add("Found setup file <b>".$path."_setup.php</b> ", 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 <b>".$method_name."()</b>", E_MESSAGE_DEBUG);
$mes->add("Executing setup function <b>".$class_name." :: ".$method_name."()</b>", E_MESSAGE_DEBUG);
return call_user_func(array($obj, $method_name), $this);
}
else
{
$mes->add("Setup function <b>".$method_name."()</b> 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 <b>".$method_name."()</b> 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 <b>".$setup_file."</b> ", E_MESSAGE_DEBUG);
$mes->add("Optional Setup File NOT Found ".$path."_setup.php ", E_MESSAGE_DEBUG);
}
$mes->add("Setup function <b>".$method_name."()</b> NOT found.", E_MESSAGE_DEBUG);
return FALSE; // IMPORTANT.
}

View File

@@ -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'.<br /><a class='btn btn-primary' href='".e_PLUGIN."forum/forum_update.php'>Continue</a>");
}
}

View File

@@ -13,23 +13,16 @@
*
*/
if(defined('e_PAGE') && e_PAGE == 'e107_update.php')
{
echo "
<script type='text/javascript'>
window.location='".e_PLUGIN."forum/forum_update.php'
</script>
";
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 <br />';
}
else
elseif($result !== true)
{
$text .= 'Failed <br />';
$failed = true;
@@ -168,13 +164,16 @@ function step2()
$text .= "
<br /><br />
<form method='post'>
<input class='button' type='submit' name='nextStep[3]' value='Proceed to step 3' />
<input class='button' type='submit' name='nextStep[4]' value='Proceed to step 3' />
</form>
";
}
$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.<br /><br />
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`.<br />
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`.<br />
<br /><br />
<form method='post'>
<input class='button' type='submit' name='move_forum_data' value='Proceed with forum data move' />
@@ -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'] = "<span style='color:green;'>{$var[$i]['text']}</span>";
}
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);
}
?>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<e107Plugin name="Forum" version="2.0" date="2012-08-01" compatibility="2.0" installRequired="true">
<e107Plugin name="Forum" lan="" version="2.0" date="2012-08-01" compatibility="2.0" installRequired="true">
<author name="e107 Inc." url="http://e107.org" />
<description>This plugin is a fully featured Forum system</description>
<description lan="">This plugin is a fully featured Forum system</description>
<category>content</category>
<adminLinks>
<link url='forum_admin.php' description='Configure Forum' icon='images/forums_32.png' iconSmall='images/forums_16.png' primary='true' >Configure Forum</link>

View File

@@ -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 *****************/

View File

@@ -17,7 +17,7 @@
if (!defined('e107_INIT')) { exit(); }
define("ADLINK_COLS",5);
// include_lan(e_THEME."_blank/languages/".e_LANGUAGE.".php");