1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

e107 update administration ready;

overall message handler usage added;
This commit is contained in:
secretr
2008-12-30 15:56:12 +00:00
parent f678f6608f
commit c87325cc67
11 changed files with 320 additions and 238 deletions

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/admin.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/admin.php,v $
| $Revision: 1.8 $ | $Revision: 1.9 $
| $Date: 2008-12-29 16:11:02 $ | $Date: 2008-12-30 15:56:12 $
| $Author: secretr $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -22,18 +22,22 @@ require_once('auth.php');
require_once(e_HANDLER.'admin_handler.php'); require_once(e_HANDLER.'admin_handler.php');
require_once(e_HANDLER.'upload_handler.php'); require_once(e_HANDLER.'upload_handler.php');
require_once (e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
if (!isset($pref['adminstyle'])) $pref['adminstyle'] = 'classis'; // Shouldn't be needed - but just in case if (!isset($pref['adminstyle'])) $pref['adminstyle'] = 'classis'; // Shouldn't be needed - but just in case
// --- check for htmlarea. // --- check for htmlarea.
if (is_dir(e_ADMIN.'htmlarea') || is_dir(e_HANDLER.'htmlarea')) if (is_dir(e_ADMIN.'htmlarea') || is_dir(e_HANDLER.'htmlarea'))
{ {
$text = ADLAN_ERR_2."<br /><br /> /*$text = ADLAN_ERR_2."<br /><br />
<div style='text-align:center'>".$HANDLERS_DIRECTORY."htmlarea/<br />".$ADMIN_DIRECTORY."htmlarea/</div>"; <div style='text-align:center'>".$HANDLERS_DIRECTORY."htmlarea/<br />".$ADMIN_DIRECTORY."htmlarea/</div>";
$ns -> tablerender(ADLAN_ERR_1, $text); $ns -> tablerender(ADLAN_ERR_1, $text);*/
$emessage->add($HANDLERS_DIRECTORY."htmlarea/<br />".$ADMIN_DIRECTORY."htmlarea/", E_MESSAGE_WARNING);
} }
/* Not used in 0.8 /* Not used in 0.8
// check for old modules. // check for old modules.
if(getperms('0') && isset($pref['modules']) && $pref['modules'] && $sql->db_Field("plugin",5) == "plugin_addons") if(getperms('0') && isset($pref['modules']) && $pref['modules'] && $sql->db_Field("plugin",5) == "plugin_addons")
{ {
@@ -67,33 +71,35 @@ if(getperms('0') && isset($pref['modules']) && $pref['modules'] && $sql->db_Fiel
$allowed_types = get_filetypes(); // Get allowed types according to filetypes.xml or filetypes.php $allowed_types = get_filetypes(); // Get allowed types according to filetypes.xml or filetypes.php
if (count($allowed_types) == 0) if (count($allowed_types) == 0)
{ {
echo "Setting default filetypes<br />";
$allowed_types = array('zip' => 1, 'gz' => 1, 'jpg' => 1, 'png' => 1, 'gif' => 1); $allowed_types = array('zip' => 1, 'gz' => 1, 'jpg' => 1, 'png' => 1, 'gif' => 1);
$emessage->add("Setting default filetypes: ".implode(', ',array_keys($allowed_types)), E_MESSAGE_INFO);
} }
//echo "Allowed filetypes = ".implode(', ',array_keys($allowed_types)).'<br />'; //echo "Allowed filetypes = ".implode(', ',array_keys($allowed_types)).'<br />';
// avatar check. // avatar check.
$public = array(e_FILE.'public', e_FILE.'public/avatars'); $public = array(e_FILE.'public', e_FILE.'public/avatars');
foreach ($public as $dir) foreach ($public as $dir)
{ {
if (is_dir($dir)) if (is_dir($dir))
{ {
if ($dh = opendir($dir)) if ($dh = opendir($dir))
{ {
while (($file = readdir($dh)) !== false) while (($file = readdir($dh)) !== false)
{ {
if (is_dir($dir."/".$file) == FALSE && $file != '.' && $file != '..' && $file != '/' && $file != 'CVS' && $file != 'avatars' && $file != 'Thumbs.db' && $file !=".htaccess" && $file !="php.ini") if (is_dir($dir."/".$file) == FALSE && $file != '.' && $file != '..' && $file != '/' && $file != 'CVS' && $file != 'avatars' && $file != 'Thumbs.db' && $file !=".htaccess" && $file !="php.ini")
{ {
$fext = substr(strrchr($file, "."), 1); $fext = substr(strrchr($file, "."), 1);
if (!array_key_exists(strtolower($fext),$allowed_types) ) if (!array_key_exists(strtolower($fext),$allowed_types) )
{ {
if ($file == 'index.html' || $file == "null.txt") if ($file == 'index.html' || $file == "null.txt")
{ {
if (filesize($dir.'/'.$file)) if (filesize($dir.'/'.$file))
{ {
$potential[] = str_replace('../', '', $dir).'/'.$file; $potential[] = str_replace('../', '', $dir).'/'.$file;
} }
} }
else else
{ {
$potential[] = str_replace('../', '', $dir).'/'.$file; $potential[] = str_replace('../', '', $dir).'/'.$file;
} }
@@ -105,16 +111,17 @@ foreach ($public as $dir)
} }
} }
if (isset($potential)) if (isset($potential))
{ {
$text = ADLAN_ERR_3."<br /><br />"; //$text = ADLAN_ERR_3."<br /><br />";
$emessage->add(ADLAN_ERR_3, E_MESSAGE_WARNING);
foreach ($potential as $p_file) $text = '<ul>';
foreach ($potential as $p_file)
{ {
$text .= $p_file.'<br />'; $text .= '<li>'.$p_file.'</li>';
} }
$emessage->add($text, E_MESSAGE_WARNING);
$ns -> tablerender(ADLAN_ERR_1, $text); //$ns -> tablerender(ADLAN_ERR_1, $text);
} }
@@ -123,7 +130,7 @@ if (isset($potential))
// auto db update // auto db update
if ('0' == ADMINPERMS) if ('0' == ADMINPERMS)
{ {
require_once(e_ADMIN.'update_routines.php'); require_once(e_ADMIN.'update_routines.php');
update_check(); update_check();
@@ -131,7 +138,7 @@ if ('0' == ADMINPERMS)
// end auto db update // end auto db update
/* /*
if (e_QUERY == 'purge' && getperms('0')) if (e_QUERY == 'purge' && getperms('0'))
{ {
$admin_log->purge_log_events(false); $admin_log->purge_log_events(false);
} }
@@ -144,37 +151,37 @@ if(!defined("ADLINK_COLS"))
} }
function render_links($link, $title, $description, $perms, $icon = FALSE, $mode = FALSE) function render_links($link, $title, $description, $perms, $icon = FALSE, $mode = FALSE)
{ {
global $td,$tp; global $td,$tp;
$text = ''; $text = '';
if (getperms($perms)) if (getperms($perms))
{ {
$description = strip_tags($description); $description = strip_tags($description);
if ($mode == 'adminb') if ($mode == 'adminb')
{ {
$text = "<tr><td class='forumheader3'> $text = "<tr><td class='forumheader3'>
<div class='td' style='text-align:left; vertical-align:top; width:100%' <div class='td' style='text-align:left; vertical-align:top; width:100%'
onmouseover=\"eover(this, 'forumheader5')\" onmouseout=\"eover(this, 'td')\" onclick=\"document.location.href='".$link."'\"> onmouseover=\"eover(this, 'forumheader5')\" onmouseout=\"eover(this, 'td')\" onclick=\"document.location.href='".$link."'\">
".$icon." <b>".$title."</b> ".($description ? "[ <span class='smalltext'>".$description."</span> ]" : "")."</div></td></tr>"; ".$icon." <b>".$title."</b> ".($description ? "[ <span class='smalltext'>".$description."</span> ]" : "")."</div></td></tr>";
} }
else else
{ {
if ($td == (ADLINK_COLS+1)) if ($td == (ADLINK_COLS+1))
{ {
$text .= '</tr>'; $text .= '</tr>';
$td = 1; $td = 1;
} }
if ($td == 1) if ($td == 1)
{ {
$text .= '<tr>'; $text .= '<tr>';
} }
if ($mode == 'default') if ($mode == 'default')
{ {
$text .= "<td class='td' style='text-align:left; vertical-align:top; width:20%; white-space:nowrap' $text .= "<td class='td' style='text-align:left; vertical-align:top; width:20%; white-space:nowrap'
onmouseover=\"eover(this, 'forumheader5')\" onmouseout=\"eover(this, 'td')\" onclick=\"document.location.href='".$link."'\">".$icon." ".$tp->toHTML($title,FALSE,"defs, emotes_off")."</td>"; onmouseover=\"eover(this, 'forumheader5')\" onmouseout=\"eover(this, 'td')\" onclick=\"document.location.href='".$link."'\">".$icon." ".$tp->toHTML($title,FALSE,"defs, emotes_off")."</td>";
} }
elseif ($mode == 'classis') elseif ($mode == 'classis')
{ {
$text .= "<td style='text-align:center; vertical-align:top; width:20%'><a href='".$link."' title='{$description}'>".$icon."</a><br /> $text .= "<td style='text-align:center; vertical-align:top; width:20%'><a href='".$link."' title='{$description}'>".$icon."</a><br />
<a href='".$link."' title='{$description}'><b>".$tp->toHTML($title,FALSE,"defs, emotes_off")."</b></a><br /><br /></td>"; <a href='".$link."' title='{$description}'><b>".$tp->toHTML($title,FALSE,"defs, emotes_off")."</b></a><br /><br /></td>";
@@ -192,7 +199,7 @@ function render_links($link, $title, $description, $perms, $icon = FALSE, $mode
} }
function render_clean() function render_clean()
{ {
global $td; global $td;
while ($td <= ADLINK_COLS) { while ($td <= ADLINK_COLS) {
@@ -210,7 +217,7 @@ $newarray = asortbyindex($array_functions, 1);
require_once(e_ADMIN.'includes/'.$pref['adminstyle'].'.php'); require_once(e_ADMIN.'includes/'.$pref['adminstyle'].'.php');
function admin_info() function admin_info()
{ {
global $tp; global $tp;
@@ -239,7 +246,7 @@ function admin_info()
return $tp->parseTemplate($ADMIN_INFO_TEMPLATE); return $tp->parseTemplate($ADMIN_INFO_TEMPLATE);
} }
function status_request() function status_request()
{ {
global $pref; global $pref;
if ($pref['adminstyle'] == 'classis' || $pref['adminstyle'] == 'cascade' || $pref['adminstyle'] == 'beginner') { if ($pref['adminstyle'] == 'classis' || $pref['adminstyle'] == 'cascade' || $pref['adminstyle'] == 'beginner') {
@@ -250,7 +257,7 @@ function status_request()
} }
function latest_request() function latest_request()
{ {
global $pref; global $pref;
if ($pref['adminstyle'] == 'classis' || $pref['adminstyle'] == 'cascade' || $pref['adminstyle'] == 'beginner') { if ($pref['adminstyle'] == 'classis' || $pref['adminstyle'] == 'cascade' || $pref['adminstyle'] == 'beginner') {
@@ -260,7 +267,7 @@ function latest_request()
} }
} }
function log_request() function log_request()
{ {
global $pref; global $pref;
if ($pref['adminstyle'] == 'classis' || $pref['adminstyle'] == 'cascade'|| $pref['adminstyle'] == 'beginner') { if ($pref['adminstyle'] == 'classis' || $pref['adminstyle'] == 'cascade'|| $pref['adminstyle'] == 'beginner') {
@@ -283,9 +290,9 @@ function getPluginLinks($iconSize = E_16_PLUGMANAGER, $linkStyle = 'adminb')
$xml = new xmlClass; // We're going to have some plugins with plugin.xml files, surely? So create XML object now $xml = new xmlClass; // We're going to have some plugins with plugin.xml files, surely? So create XML object now
$xml->filter = array('@attributes' => FALSE,'description'=>FALSE,'administration' => FALSE); // .. and they're all going to need the same filter $xml->filter = array('@attributes' => FALSE,'description'=>FALSE,'administration' => FALSE); // .. and they're all going to need the same filter
if ($sql->db_Select("plugin", "*", "plugin_installflag=1")) if ($sql->db_Select("plugin", "*", "plugin_installflag=1"))
{ {
while ($row = $sql->db_Fetch()) while ($row = $sql->db_Fetch())
{ {
extract($row); // plugin_id int(10) unsigned NOT NULL auto_increment, extract($row); // plugin_id int(10) unsigned NOT NULL auto_increment,
// plugin_name varchar(100) NOT NULL default '', // plugin_name varchar(100) NOT NULL default '',
@@ -293,7 +300,7 @@ function getPluginLinks($iconSize = E_16_PLUGMANAGER, $linkStyle = 'adminb')
// plugin_path varchar(100) NOT NULL default '', // plugin_path varchar(100) NOT NULL default '',
// plugin_installflag tinyint(1) unsigned NOT NULL default '0', // plugin_installflag tinyint(1) unsigned NOT NULL default '0',
// plugin_addons text NOT NULL, // plugin_addons text NOT NULL,
if (is_readable(e_PLUGIN.$plugin_path."/plugin.xml")) if (is_readable(e_PLUGIN.$plugin_path."/plugin.xml"))
{ {
$readFile = $xml->loadXMLfile(e_PLUGIN.$plugin_path.'/plugin.xml', true, true); $readFile = $xml->loadXMLfile(e_PLUGIN.$plugin_path.'/plugin.xml', true, true);
@@ -315,7 +322,7 @@ function getPluginLinks($iconSize = E_16_PLUGMANAGER, $linkStyle = 'adminb')
{ {
include(e_PLUGIN.$plugin_path."/plugin.php"); include(e_PLUGIN.$plugin_path."/plugin.php");
} }
if ($eplug_conffile) if ($eplug_conffile)
{ {
$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off"); $eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off");
if ($iconSize == E_16_PLUGMANAGER) if ($iconSize == E_16_PLUGMANAGER)
@@ -333,7 +340,7 @@ function getPluginLinks($iconSize = E_16_PLUGMANAGER, $linkStyle = 'adminb')
} }
ksort($plugin_array, SORT_STRING); ksort($plugin_array, SORT_STRING);
foreach ($plugin_array as $plug_key => $plug_value) foreach ($plugin_array as $plug_key => $plug_value)
{ {
$text .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $plug_value['icon'], $linkStyle); $text .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $plug_value['icon'], $linkStyle);
} }

View File

@@ -9,8 +9,8 @@
* Administration - Database Utilities * Administration - Database Utilities
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/db.php,v $ * $Source: /cvs_backup/e107_0.8/e107_admin/db.php,v $
* $Revision: 1.7 $ * $Revision: 1.8 $
* $Date: 2008-12-30 13:51:41 $ * $Date: 2008-12-30 15:56:12 $
* $Author: secretr $ * $Author: secretr $
* *
*/ */
@@ -121,7 +121,7 @@ $text = "
<fieldset id='core-db-plugin-scan'> <fieldset id='core-db-plugin-scan'>
<legend class='e-hideme'>".DBLAN_10."</legend> <legend class='e-hideme'>".DBLAN_10."</legend>
<table cellpadding='0' cellspacing='0' class='adminlist'> <table cellpadding='0' cellspacing='0' class='adminlist'>
<colgroup span='4'> <colgroup span='2'>
<col style='width: 60%'></col> <col style='width: 60%'></col>
<col style='width: 40%'></col> <col style='width: 40%'></col>
</colgroup> </colgroup>

View File

@@ -1,108 +1,148 @@
<?php <?php
/* /*
+ ----------------------------------------------------------------------------+ * e107 website system
| e107 website system *
| * Copyright (C) 2001-2008 e107 Inc (e107.org)
| <20>Steve Dunstan 2001-2002 * Released under the terms and conditions of the
| http://e107.org * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
| jalist@e107.org *
| * Administration - e107 System Update
| Released under the terms and conditions of the *
| GNU General Public License (http://gnu.org). * $Source: /cvs_backup/e107_0.8/e107_admin/e107_update.php,v $
| * $Revision: 1.5 $
| $Source: /cvs_backup/e107_0.8/e107_admin/e107_update.php,v $ * $Date: 2008-12-30 15:56:12 $
| $Revision: 1.4 $ * $Author: secretr $
| $Date: 2008-06-16 20:48:47 $ *
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/ */
require_once("../class2.php"); require_once ("../class2.php");
$e_sub_cat = 'database';
require_once("auth.php");
require_once("update_routines.php");
$e_sub_cat = 'database';
require_once ("auth.php");
require_once ("update_routines.php");
require_once (e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
require_once (e_HANDLER."form_handler.php");
$frm = new e_form();
// Carry out core updates // Carry out core updates
function run_updates($dbupdate) function run_updates($dbupdate)
{ {
global $ns; global $emessage;
foreach($dbupdate as $func => $rmks) { foreach($dbupdate as $func => $rmks)
{
$installed = call_user_func("update_".$func); $installed = call_user_func("update_".$func);
if ((LAN_UPDATE == $_POST[$func]) && !$installed) { //?! (LAN_UPDATE == $_POST[$func])
if (function_exists("update_".$func)) { if(varsettrue($_POST[$func]) && !$installed)
$message .= LAN_UPDATE_7." {$rmks}<br />"; {
$error=call_user_func("update_".$func, "do"); if(function_exists("update_".$func))
if ($error!='') { {
$message = $error; $message = LAN_UPDATE_7." {$rmks}";
$error = call_user_func("update_".$func, "do");
if($error != '')
{
$emessage->add($message, E_MESSAGE_ERROR);
$emessage->add($error, E_MESSAGE_ERROR);
} }
else $emessage->add($message, E_MESSAGE_SUCCESS);
} }
} }
} }
if ($message) {
$ns->tablerender(LAN_UPDATE, $message);
}
} }
function show_updates($dbupdate, $what)
function show_updates($dbupdate)
{ {
global $ns; global $frm;
$text = "<form method='post' action='".e_SELF."'> $caption = constant('LAN_UPDATE_CAPTION_'.strtoupper($what));
<div style='width:100%'> $text = "
<table class='fborder' style='".ADMIN_WIDTH."'> <form method='post' action='".e_SELF."'>
<tr> <fieldset id='core-e107-update-{$what}'>
<td class='fcaption'>".LAN_UPDATE."</td> <legend>{$caption}</legend>
<td class='fcaption'>".LAN_UPDATE_2."</td> <table cellpadding='0' cellspacing='0' class='adminlist'>
</tr> <colgroup span='2'>
<col style='width: 60%'></col>
<col style='width: 40%'></col>
</colgroup>
<thead>
<tr>
<th>".LAN_UPDATE_55."</th>
<th class='last'>".LAN_UPDATE_2."</th>
</tr>
</thead>
<tbody>
"; ";
$updates = 0; $updates = 0;
foreach($dbupdate as $func => $rmks) { foreach($dbupdate as $func => $rmks)
if (function_exists("update_".$func)) { {
$text .= "<tr><td class='forumheader3' style='width: 60%'>{$rmks}</td>"; if(function_exists("update_".$func))
// echo "Core2 Check {$func}=>{$rmks}<br />"; {
if (call_user_func("update_".$func)) { $text .= "
$text .= "<td class='forumheader3' style='text-align:center; width: 40%'>".LAN_UPDATE_3."</td>"; <tr>
} else { <td>{$rmks}</td>
$updates++; ";
$text .= "<td class='forumheader3' style='text-align:center; width: 40%'><input class='button' type='submit' name='{$func}' value='".LAN_UPDATE."' /></td>"; // echo "Core2 Check {$func}=>{$rmks}<br />";
if(call_user_func("update_".$func))
{
$text .= "
<td>".LAN_UPDATE_3."</td>
";
} }
$text .= "</tr>"; else
{
$updates ++;
$text .= "
<td>".$frm->admin_button($func, LAN_UPDATE, 'update', '', "id=e-{$func}")."</td>
";
}
$text .= "
</tr>
";
} }
} }
$text .= "</table></div></form>"; $text .= "
$ns->tablerender(LAN_UPDATE, $text); </tbody>
return $updates; // Number of updates to do </table>
</fieldset>
</form>
";
echo $text;
return $updates; // Number of updates to do
} }
if($_POST)
if ($_POST)
{ {
$message = run_updates($dbupdate); $message = run_updates($dbupdate);
} }
if($_POST)
if ($_POST) { // Do plugin updates
{ // Do plugin updates $message = run_updates($dbupdatep);
$message = run_updates($dbupdatep);
} }
$total_updates = 0; $total_updates = 0;
if (isset($dbupdatep))
{ // Show plugin updates done
$total_updates += show_updates($dbupdatep);
}
// Show core updates done
$total_updates += show_updates($dbupdate);
if ($total_updates == 0) ob_start();
{ // No updates needed - clear the cache to be sure if(isset($dbupdatep))
$e107cache->set_sys("nq_admin_updatecheck", time().', 1, '.$e107info['e107_version'], TRUE); { // Show plugin updates done
$total_updates += show_updates($dbupdatep, 'plugin');
}
// Show core updates done
$total_updates += show_updates($dbupdate, 'core');
$text = ob_get_contents();
ob_end_clean();
$e107->ns->tablerender(LAN_UPDATE_56, $emessage->render().$text);
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");
require_once("footer.php");
?> ?>

View File

@@ -11,14 +11,17 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/includes/beginner.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/includes/beginner.php,v $
| $Revision: 1.3 $ | $Revision: 1.4 $
| $Date: 2008-08-25 10:46:31 $ | $Date: 2008-12-30 15:56:12 $
| $Author: e107steved $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
require_once(e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
if($_GET['mode'] == "e_advanced"){ if($_GET['mode'] == "e_advanced"){
$pref['adminstyle'] = "classis"; $pref['adminstyle'] = "classis";
save_prefs(); save_prefs();
@@ -46,7 +49,7 @@ if($_GET['mode'] == "e_advanced"){
if($buts != '') if($buts != '')
{ {
$ns->tablerender(ADLAN_47." ".ADMINNAME, $text); $ns->tablerender(ADLAN_47." ".ADMINNAME, $emessage->render().$text);
} }

View File

@@ -11,18 +11,21 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/includes/cascade.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/includes/cascade.php,v $
| $Revision: 1.3 $ | $Revision: 1.4 $
| $Date: 2008-08-25 10:46:31 $ | $Date: 2008-12-30 15:56:12 $
| $Author: e107steved $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
require_once(e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
$text = "<div style='text-align:center'> $text = "<div style='text-align:center'>
<table class='fborder' style='".ADMIN_WIDTH."'>"; <table class='fborder' style='".ADMIN_WIDTH."'>";
while (list($key, $funcinfo) = each($newarray)) while (list($key, $funcinfo) = each($newarray))
{ {
$text .= render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'adminb'); $text .= render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'adminb');
} }
@@ -39,6 +42,6 @@ $text .= getPluginLinks( E_16_PLUGMANAGER, 'adminb');
$text .= "</table></div>"; $text .= "</table></div>";
$ns->tablerender(ADLAN_47." ".ADMINNAME, $text); $ns->tablerender(ADLAN_47." ".ADMINNAME, $emessage->render().$text);
?> ?>

View File

@@ -11,39 +11,42 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/includes/categories.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/includes/categories.php,v $
| $Revision: 1.4 $ | $Revision: 1.5 $
| $Date: 2008-12-04 20:17:49 $ | $Date: 2008-12-30 15:56:12 $
| $Author: e107steved $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
require_once(e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
$text = "<div style='text-align:center'> $text = "<div style='text-align:center'>
<table class='fborder' style='".ADMIN_WIDTH."'>"; <table class='fborder' style='".ADMIN_WIDTH."'>";
foreach ($admin_cat['id'] as $cat_key => $cat_id) foreach ($admin_cat['id'] as $cat_key => $cat_id)
{ {
$text_check = FALSE; $text_check = FALSE;
$text_cat = "<tr><td class='fcaption' colspan='2'>".$admin_cat['title'][$cat_key]."</td></tr> $text_cat = "<tr><td class='fcaption' colspan='2'>".$admin_cat['title'][$cat_key]."</td></tr>
<tr><td class='forumheader3' style='text-align: center; vertical-align: middle; width: 72px; height: 48px'>".$admin_cat['lrg_img'][$cat_key]."</td><td class='forumheader3'> <tr><td class='forumheader3' style='text-align: center; vertical-align: middle; width: 72px; height: 48px'>".$admin_cat['lrg_img'][$cat_key]."</td><td class='forumheader3'>
<table style='width:100%'>"; <table style='width:100%'>";
if ($cat_key != 5) if ($cat_key != 5)
{ {
foreach ($newarray as $key => $funcinfo) foreach ($newarray as $key => $funcinfo)
{ {
if ($funcinfo[4] == $cat_key) if ($funcinfo[4] == $cat_key)
{ {
$text_rend = render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'default'); $text_rend = render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'default');
if ($text_rend) if ($text_rend)
{ {
$text_check = TRUE; $text_check = TRUE;
} }
$text_cat .= $text_rend; $text_cat .= $text_rend;
} }
} }
} }
else else
{ {
$text_rend = render_links(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", E_16_PLUGMANAGER, 'default'); $text_rend = render_links(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", E_16_PLUGMANAGER, 'default');
@@ -51,14 +54,14 @@ foreach ($admin_cat['id'] as $cat_key => $cat_id)
$xml = new xmlClass; // We're going to have some plugins with plugin.xml files, surely? So create XML object now $xml = new xmlClass; // We're going to have some plugins with plugin.xml files, surely? So create XML object now
$xml->filter = array('@attributes' => FALSE,'administration' => FALSE); // .. and they're all going to need the same filter $xml->filter = array('@attributes' => FALSE,'administration' => FALSE); // .. and they're all going to need the same filter
if ($text_rend) if ($text_rend)
{ {
$text_check = TRUE; $text_check = TRUE;
} }
$text_cat .= $text_rend; $text_cat .= $text_rend;
if ($sql->db_Select("plugin", "*", "plugin_installflag=1")) if ($sql->db_Select("plugin", "*", "plugin_installflag=1"))
{ {
while ($row = $sql->db_Fetch()) while ($row = $sql->db_Fetch())
{ {
extract($row); // plugin_id int(10) unsigned NOT NULL auto_increment, extract($row); // plugin_id int(10) unsigned NOT NULL auto_increment,
// plugin_name varchar(100) NOT NULL default '', // plugin_name varchar(100) NOT NULL default '',
@@ -66,7 +69,7 @@ foreach ($admin_cat['id'] as $cat_key => $cat_id)
// plugin_path varchar(100) NOT NULL default '', // plugin_path varchar(100) NOT NULL default '',
// plugin_installflag tinyint(1) unsigned NOT NULL default '0', // plugin_installflag tinyint(1) unsigned NOT NULL default '0',
// plugin_addons text NOT NULL, // plugin_addons text NOT NULL,
if (is_readable(e_PLUGIN.$plugin_path."/plugin.xml")) if (is_readable(e_PLUGIN.$plugin_path."/plugin.xml"))
{ {
$readFile = $xml->loadXMLfile(e_PLUGIN.$plugin_path.'/plugin.xml', true, true); $readFile = $xml->loadXMLfile(e_PLUGIN.$plugin_path.'/plugin.xml', true, true);
@@ -80,12 +83,12 @@ foreach ($admin_cat['id'] as $cat_key => $cat_id)
{ {
include(e_PLUGIN.$plugin_path."/plugin.php"); include(e_PLUGIN.$plugin_path."/plugin.php");
} }
if ($eplug_conffile) if ($eplug_conffile)
{ {
$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off"); $eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off");
$plugin_icon = $eplug_icon_small ? "<img src='".e_PLUGIN.$eplug_icon_small."' alt='".$eplug_caption."' style='border:0px; vertical-align:bottom; width: 16px; height: 16px' />" : E_16_PLUGIN; $plugin_icon = $eplug_icon_small ? "<img src='".e_PLUGIN.$eplug_icon_small."' alt='".$eplug_caption."' style='border:0px; vertical-align:bottom; width: 16px; height: 16px' />" : E_16_PLUGIN;
$plugin_array[ucfirst($eplug_name)] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon); $plugin_array[ucfirst($eplug_name)] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon);
if ($plugin_array[0]) if ($plugin_array[0])
{ {
$text_check = TRUE; $text_check = TRUE;
} }
@@ -94,7 +97,7 @@ foreach ($admin_cat['id'] as $cat_key => $cat_id)
} }
} }
ksort($plugin_array, SORT_STRING); ksort($plugin_array, SORT_STRING);
foreach ($plugin_array as $plug_key => $plug_value) foreach ($plugin_array as $plug_key => $plug_value)
{ {
$text_cat .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $plug_value['icon'], 'default'); $text_cat .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $plug_value['icon'], 'default');
} }
@@ -102,7 +105,7 @@ foreach ($admin_cat['id'] as $cat_key => $cat_id)
$text_cat .= render_clean(); $text_cat .= render_clean();
$text_cat .= "</table> $text_cat .= "</table>
</td></tr>"; </td></tr>";
if ($text_check) if ($text_check)
{ {
$text .= $text_cat; $text .= $text_cat;
} }
@@ -110,7 +113,7 @@ foreach ($admin_cat['id'] as $cat_key => $cat_id)
$text .= "</table></div>"; $text .= "</table></div>";
$ns->tablerender(ADLAN_47." ".ADMINNAME, $text); $ns->tablerender(ADLAN_47." ".ADMINNAME, $emessage->render().$text);
echo admin_info(); echo admin_info();

View File

@@ -11,14 +11,17 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/includes/classis.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/includes/classis.php,v $
| $Revision: 1.3 $ | $Revision: 1.4 $
| $Date: 2008-08-25 10:46:32 $ | $Date: 2008-12-30 15:56:12 $
| $Author: e107steved $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
require_once(e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
$buts = ""; $buts = "";
while (list($key, $funcinfo) = each($newarray)) while (list($key, $funcinfo) = each($newarray))
@@ -32,7 +35,7 @@ if($buts != "")
$text .= $buts; $text .= $buts;
$text .= render_clean(); $text .= render_clean();
$text .= "</table></div>"; $text .= "</table></div>";
$ns->tablerender(ADLAN_47." ".ADMINNAME, $text); $ns->tablerender(ADLAN_47." ".ADMINNAME, $emessage->render().$text);
} }
$text = "<div style='text-align:center'> $text = "<div style='text-align:center'>
<table style='".ADMIN_WIDTH."'>"; <table style='".ADMIN_WIDTH."'>";

View File

@@ -11,14 +11,17 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/includes/combo.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/includes/combo.php,v $
| $Revision: 1.3 $ | $Revision: 1.4 $
| $Date: 2008-08-25 10:46:32 $ | $Date: 2008-12-30 15:56:12 $
| $Author: e107steved $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
require_once(e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
$text = "<div style='text-align:center'> $text = "<div style='text-align:center'>
<table style='".ADMIN_WIDTH."'>"; <table style='".ADMIN_WIDTH."'>";
$buts = ""; $buts = "";
@@ -33,7 +36,7 @@ while ($td <= 5) {
$td = 1; $td = 1;
$text .= "</tr></table></div>"; $text .= "</tr></table></div>";
if($buts != ""){ if($buts != ""){
$ns->tablerender(ADLAN_47." ".ADMINNAME, $text); $ns->tablerender(ADLAN_47." ".ADMINNAME, $emessage->render().$text);
} }
$text = "<div style='text-align:center'> $text = "<div style='text-align:center'>

View File

@@ -11,13 +11,17 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/includes/compact.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/includes/compact.php,v $
| $Revision: 1.3 $ | $Revision: 1.4 $
| $Date: 2008-08-25 10:46:32 $ | $Date: 2008-12-30 15:56:12 $
| $Author: e107steved $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
require_once(e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
$buts = ""; $buts = "";
$text = "<div style='text-align:center'> $text = "<div style='text-align:center'>
<table style='".ADMIN_WIDTH."'>"; <table style='".ADMIN_WIDTH."'>";
@@ -37,7 +41,7 @@ $td = 1;
$text .= "</tr></table></div>"; $text .= "</tr></table></div>";
if($buts !=""){ if($buts !=""){
$ns->tablerender(ADLAN_47." ".ADMINNAME, $text); $ns->tablerender(ADLAN_47." ".ADMINNAME, $emessage->render().$text);
} }
$text = "<div style='text-align:center'> $text = "<div style='text-align:center'>
@@ -54,4 +58,4 @@ $ns->tablerender(ADLAN_CL_7, $text);
echo admin_info(); echo admin_info();
?> ?>

View File

@@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $
| $Revision: 1.35 $ | $Revision: 1.36 $
| $Date: 2008-12-17 21:02:25 $ | $Date: 2008-12-30 15:56:12 $
| $Author: e107steved $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -64,7 +64,7 @@ if ($dont_check_update === TRUE)
if ($tempData = $e107cache->retrieve_sys("nq_admin_updatecheck",3600, TRUE)) if ($tempData = $e107cache->retrieve_sys("nq_admin_updatecheck",3600, TRUE))
{ // See when we last checked for an admin update { // See when we last checked for an admin update
list($last_time, $dont_check_update,$last_ver) = explode(',',$tempData); list($last_time, $dont_check_update,$last_ver) = explode(',',$tempData);
if ($last_ver != $e107info['e107_version']) if ($last_ver != $e107info['e107_version'])
{ {
$dont_check_update = FALSE; // Do proper check on version change $dont_check_update = FALSE; // Do proper check on version change
} }
@@ -72,12 +72,12 @@ if ($dont_check_update === TRUE)
} }
if (!$dont_check_update) if (!$dont_check_update)
{ {
if ($sql->db_Select("plugin", "plugin_version, plugin_path", "plugin_installflag='1' ")) if ($sql->db_Select("plugin", "plugin_version, plugin_path", "plugin_installflag='1' "))
{ {
while ($row = $sql->db_Fetch()) while ($row = $sql->db_Fetch())
{ // Mark plugins for update which have a specific update file, or a plugin.php file to check { // Mark plugins for update which have a specific update file, or a plugin.php file to check
if(is_readable(e_PLUGIN.$row['plugin_path'].'/'.$row['plugin_path'].'_update_check.php') || is_readable(e_PLUGIN.$row['plugin_path'].'/plugin.php')) if(is_readable(e_PLUGIN.$row['plugin_path'].'/'.$row['plugin_path'].'_update_check.php') || is_readable(e_PLUGIN.$row['plugin_path'].'/plugin.php'))
{ {
$dbupdateplugs[$row['plugin_path']] = $row['plugin_version']; $dbupdateplugs[$row['plugin_path']] = $row['plugin_version'];
} }
@@ -104,23 +104,23 @@ $dbupdate["70x_to_706"] = LAN_UPDATE_8." .70x ".LAN_UPDATE_9." .706";
} // End if (!$dont_check_update) } // End if (!$dont_check_update)
function update_check() function update_check()
{ {
global $ns, $dont_check_update, $e107info; global $ns, $dont_check_update, $e107info;
$update_needed = FALSE; $update_needed = FALSE;
if ($dont_check_update === FALSE) if ($dont_check_update === FALSE)
{ {
global $dbupdate, $dbupdatep, $e107cache; global $dbupdate, $dbupdatep, $e107cache;
// See which core functions need update // See which core functions need update
foreach($dbupdate as $func => $rmks) foreach($dbupdate as $func => $rmks)
{ {
// echo "Core Check {$func}=>{$rmks}<br />"; // echo "Core Check {$func}=>{$rmks}<br />";
if (function_exists("update_".$func)) if (function_exists("update_".$func))
{ {
if (!call_user_func("update_".$func, FALSE)) if (!call_user_func("update_".$func, FALSE))
{ {
$update_needed = TRUE; $update_needed = TRUE;
continue; continue;
@@ -129,12 +129,12 @@ function update_check()
} }
// Now check plugins // Now check plugins
foreach($dbupdatep as $func => $rmks) foreach($dbupdatep as $func => $rmks)
{ {
// echo "Plugin Check {$func}=>{$rmks}<br />"; // echo "Plugin Check {$func}=>{$rmks}<br />";
if (function_exists("update_".$func)) if (function_exists("update_".$func))
{ {
if (!call_user_func("update_".$func, FALSE)) if (!call_user_func("update_".$func, FALSE))
{ {
$update_needed = TRUE; $update_needed = TRUE;
continue; continue;
@@ -143,19 +143,30 @@ function update_check()
} }
$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 else
{ {
$update_needed = ($dont_check_update == '2'); $update_needed = ($dont_check_update == '2');
} }
if ($update_needed === TRUE) if ($update_needed === TRUE)
{ {
$txt = "<div style='text-align:center;'>".ADLAN_120; require_once (e_HANDLER."form_handler.php");
$txt .= "<br /><form method='post' action='".e_ADMIN."e107_update.php'> $frm = new e_form();
<input class='button' type='submit' value='".LAN_UPDATE."' /> $txt = "
</form></div>";
$ns->tablerender(LAN_UPDATE, $txt); <form method='post' action='".e_ADMIN_ABS."e107_update.php'>
<div>
".ADLAN_120."
".$frm->admin_button('e107_system_update', LAN_UPDATE, 'update')."
</div>
</form>
";
require_once (e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
$emessage->add($txt);
} }
} }
@@ -181,9 +192,9 @@ function update_core_prefs($type='')
$do_save = TRUE; $do_save = TRUE;
} }
} }
if ($do_save) if ($do_save)
{ {
save_prefs(); save_prefs();
$admin_log->log_event('UPDATE_03',LAN_UPDATE_14.$e107info['e107_version'].'[!br!]'.implode(', ',$accum),E_LOG_INFORMATIVE,''); // Log result of actual update $admin_log->log_event('UPDATE_03',LAN_UPDATE_14.$e107info['e107_version'].'[!br!]'.implode(', ',$accum),E_LOG_INFORMATIVE,''); // Log result of actual update
} }
return $just_check; return $just_check;
@@ -195,14 +206,14 @@ if (defined('TEST_UPDATE'))
//-------------------------------------------- //--------------------------------------------
// Test routine - to activate, define TEST_UPDATE // Test routine - to activate, define TEST_UPDATE
//-------------------------------------------- //--------------------------------------------
function update_test_code($type='') function update_test_code($type='')
{ {
global $sql,$ns, $pref; global $sql,$ns, $pref;
$just_check = $type == 'do' ? FALSE : TRUE; // TRUE if we're just seeing whether an update is needed $just_check = $type == 'do' ? FALSE : TRUE; // TRUE if we're just seeing whether an update is needed
//--------------**************--------------- //--------------**************---------------
// Add your test code in here // Add your test code in here
//--------------**************--------------- //--------------**************---------------
//--------------**************--------------- //--------------**************---------------
// End of test code // End of test code
//--------------**************--------------- //--------------**************---------------
@@ -213,10 +224,10 @@ if (defined('TEST_UPDATE'))
//-------------------------------------------- //--------------------------------------------
// Upgrade later versions of 0.7.x to 0.8 // Upgrade later versions of 0.7.x to 0.8
//-------------------------------------------- //--------------------------------------------
function update_706_to_800($type='') function update_706_to_800($type='')
{ {
global $sql,$ns, $pref, $admin_log, $e107info; global $sql,$ns, $pref, $admin_log, $e107info;
// List of unwanted $pref values which can go // List of unwanted $pref values which can go
$obs_prefs = array('frontpage_type','rss_feeds', 'log_lvcount', 'zone', 'upload_allowedfiletype', 'real', 'forum_user_customtitle', $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', 'utf-compatmode','frontpage_method','standards_mode','image_owner','im_quality', 'signup_option_timezone',
@@ -225,25 +236,25 @@ function update_706_to_800($type='')
// List of DB tables not required (includes a few from 0.6xx) // List of DB tables not required (includes a few from 0.6xx)
$obs_tables = array('flood', 'headlines', 'stat_info', 'stat_counter', 'stat_last'); $obs_tables = array('flood', 'headlines', 'stat_info', 'stat_counter', 'stat_last');
// List of DB tables newly required (defined in core_sql.php) (The existing dblog table gets renamed) // List of DB tables newly required (defined in core_sql.php) (The existing dblog table gets renamed)
$new_tables = array('admin_log','audit_log', 'dblog'); $new_tables = array('admin_log','audit_log', 'dblog');
// List of changed DB tables (defined in core_sql.php) // List of changed DB tables (defined in core_sql.php)
// (primarily those which have changed significantly; for the odd field write some explicit code - it'll run faster) // (primarily those which have changed significantly; for the odd field write some explicit code - it'll run faster)
$changed_tables = array('user', 'dblog','admin_log', 'userclass_classes', 'banlist'); $changed_tables = array('user', 'dblog','admin_log', 'userclass_classes', 'banlist');
// List of changed DB tables from core plugins (defined in pluginname_sql.php file) // List of changed DB tables from core plugins (defined in pluginname_sql.php file)
// key = plugin directory nane. Data = comma-separated list of tables to check // key = plugin directory nane. Data = comma-separated list of tables to check
// (primarily those which have changed significantly; for the odd field write some explicit code - it'll run faster) // (primarily those which have changed significantly; for the odd field write some explicit code - it'll run faster)
$pluginChangedTables = array('linkwords' => 'linkwords'); $pluginChangedTables = array('linkwords' => 'linkwords');
// List of DB tables (key) and field (value) which need changing to accommodate IPV6 addresses // List of DB tables (key) and field (value) which need changing to accommodate IPV6 addresses
$ip_upgrade = array('comments' => 'comment_ip', $ip_upgrade = array('comments' => 'comment_ip',
'download_requests' => 'download_request_ip', 'download_requests' => 'download_request_ip',
'online' => 'online_ip', 'online' => 'online_ip',
'submitnews' => 'submitnews_ip', 'submitnews' => 'submitnews_ip',
@@ -298,7 +309,7 @@ function update_706_to_800($type='')
else else
{ {
$updateMessages[] = str_replace('--COUNT--',$nt_changed,LAN_UPDATE_20); // Log success $updateMessages[] = str_replace('--COUNT--',$nt_changed,LAN_UPDATE_20); // Log success
} }
} }
@@ -381,7 +392,7 @@ function update_706_to_800($type='')
if ($just_check) return update_needed(); if ($just_check) return update_needed();
$row=$sql->db_Fetch(); $row=$sql->db_Fetch();
//if online_extended is activated, we need to activate the new 'online' menu, and delete this record //if online_extended is activated, we need to activate the new 'online' menu, and delete this record
if($row['menu_location']!=0) if($row['menu_location']!=0)
{ {
@@ -415,7 +426,7 @@ function update_706_to_800($type='')
if ($just_check) return update_needed('Comment table author field update'); if ($just_check) return update_needed('Comment table author field update');
$commentMessage = LAN_UPDATE_33; $commentMessage = LAN_UPDATE_33;
if ((!$sql->db_Field("comments","comment_author_id")) // Check to see whether new fields already added - maybe data copy failed part way through if ((!$sql->db_Field("comments","comment_author_id")) // Check to see whether new fields already added - maybe data copy failed part way through
&& (!$sql->db_Select_gen("ALTER TABLE `#comments` && (!$sql->db_Select_gen("ALTER TABLE `#comments`
ADD COLUMN comment_author_id int(10) unsigned NOT NULL default '0' AFTER `comment_author`, ADD COLUMN comment_author_id int(10) unsigned NOT NULL default '0' AFTER `comment_author`,
ADD COLUMN comment_author_name varchar(100) NOT NULL default '' AFTER `comment_author_id`"))) ADD COLUMN comment_author_name varchar(100) NOT NULL default '' AFTER `comment_author_id`")))
{ {
@@ -483,7 +494,7 @@ function update_706_to_800($type='')
if (mysql_table_exists('newsfeed')) if (mysql_table_exists('newsfeed'))
{ // Need to extend field newsfeed_url varchar(250) NOT NULL default '' { // Need to extend field newsfeed_url varchar(250) NOT NULL default ''
if ($sql -> db_Query("SHOW FIELDS FROM ".MPREFIX."newsfeed LIKE 'newsfeed_url'")) if ($sql -> db_Query("SHOW FIELDS FROM ".MPREFIX."newsfeed LIKE 'newsfeed_url'"))
{ {
$row = $sql -> db_Fetch(); $row = $sql -> db_Fetch();
if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(250)') if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(250)')
@@ -499,7 +510,7 @@ function update_706_to_800($type='')
if (mysql_table_exists('download')) if (mysql_table_exists('download'))
{ // Need to extend field download_url varchar(255) NOT NULL default '' { // Need to extend field download_url varchar(255) NOT NULL default ''
if ($sql -> db_Query("SHOW FIELDS FROM ".MPREFIX."download LIKE 'download_url'")) if ($sql -> db_Query("SHOW FIELDS FROM ".MPREFIX."download LIKE 'download_url'"))
{ {
$row = $sql -> db_Fetch(); $row = $sql -> db_Fetch();
if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(255)') if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(255)')
@@ -514,7 +525,7 @@ function update_706_to_800($type='')
if (mysql_table_exists('download_mirror')) if (mysql_table_exists('download_mirror'))
{ // Need to extend field download_url varchar(255) NOT NULL default '' { // Need to extend field download_url varchar(255) NOT NULL default ''
if ($sql -> db_Query("SHOW FIELDS FROM ".MPREFIX."download_mirror LIKE 'mirror_url'")) if ($sql -> db_Query("SHOW FIELDS FROM ".MPREFIX."download_mirror LIKE 'mirror_url'"))
{ {
$row = $sql -> db_Fetch(); $row = $sql -> db_Fetch();
if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(255)') if (str_replace('varchar', 'char', strtolower($row['Type'])) != 'char(255)')
@@ -603,12 +614,12 @@ function update_706_to_800($type='')
// echo $db_parser->make_table_list($actual_defs); // echo $db_parser->make_table_list($actual_defs);
$actual_fields = $db_parser->parse_field_defs($actual_defs[0][2]); $actual_fields = $db_parser->parse_field_defs($actual_defs[0][2]);
if (E107_DBG_FILLIN8) echo "Actual table structure: <br />".$db_parser->make_field_list($actual_fields); if (E107_DBG_FILLIN8) echo "Actual table structure: <br />".$db_parser->make_field_list($actual_fields);
$diffs = $db_parser->compare_field_lists($req_fields,$actual_fields); $diffs = $db_parser->compare_field_lists($req_fields,$actual_fields);
if (count($diffs[0])) if (count($diffs[0]))
{ // Changes needed { // Changes needed
if ($just_check) return update_needed("Field changes rqd; table: ".$ct); if ($just_check) return update_needed("Field changes rqd; table: ".$ct);
// Do the changes here // Do the changes here
if (E107_DBG_FILLIN8) echo "List of changes found:<br />".$db_parser->make_changes_list($diffs); if (E107_DBG_FILLIN8) echo "List of changes found:<br />".$db_parser->make_changes_list($diffs);
$qry = 'ALTER TABLE '.MPREFIX.$ct.' '.implode(', ',$diffs[1]); $qry = 'ALTER TABLE '.MPREFIX.$ct.' '.implode(', ',$diffs[1]);
if (E107_DBG_FILLIN8) echo "Update Query used: ".$qry."<br />"; if (E107_DBG_FILLIN8) echo "Update Query used: ".$qry."<br />";
@@ -648,13 +659,13 @@ function update_706_to_800($type='')
// echo $db_parser->make_table_list($actual_defs); // echo $db_parser->make_table_list($actual_defs);
$actual_fields = $db_parser->parse_field_defs($actual_defs[0][2]); $actual_fields = $db_parser->parse_field_defs($actual_defs[0][2]);
if (E107_DBG_FILLIN8) echo "Actual table structure: <br />".$db_parser->make_field_list($actual_fields); if (E107_DBG_FILLIN8) echo "Actual table structure: <br />".$db_parser->make_field_list($actual_fields);
$diffs = $db_parser->compare_field_lists($req_fields,$actual_fields); $diffs = $db_parser->compare_field_lists($req_fields,$actual_fields);
if (count($diffs[0])) if (count($diffs[0]))
{ // Changes needed { // Changes needed
if (E107_DBG_FILLIN8) echo "List of changes found:<br />".$db_parser->make_changes_list($diffs); if (E107_DBG_FILLIN8) echo "List of changes found:<br />".$db_parser->make_changes_list($diffs);
if ($just_check) return update_needed("Field changes rqd; plugin table: ".$ct); if ($just_check) return update_needed("Field changes rqd; plugin table: ".$ct);
// Do the changes here // Do the changes here
$qry = 'ALTER TABLE '.MPREFIX.$ct.' '.implode(', ',$diffs[1]); $qry = 'ALTER TABLE '.MPREFIX.$ct.' '.implode(', ',$diffs[1]);
if (E107_DBG_FILLIN8) echo "Update Query used: ".$qry."<br />"; if (E107_DBG_FILLIN8) echo "Update Query used: ".$qry."<br />";
mysql_query($qry); mysql_query($qry);
@@ -669,20 +680,20 @@ function update_706_to_800($type='')
// Obsolete tables (list at top) // Obsolete tables (list at top)
foreach ($obs_tables as $ot) foreach ($obs_tables as $ot)
{ {
if (mysql_table_exists($ot)) if (mysql_table_exists($ot))
{ {
if ($just_check) return update_needed("Delete table: ".$ot); if ($just_check) return update_needed("Delete table: ".$ot);
mysql_query('DROP TABLE `'.MPREFIX.$ot.'`'); mysql_query('DROP TABLE `'.MPREFIX.$ot.'`');
$updateMessages[] = LAN_UPDATE_48.$ot; $updateMessages[] = LAN_UPDATE_48.$ot;
} }
} }
// Tables where IP address field needs updating to accommodate IPV6 // Tables where IP address field needs updating to accommodate IPV6
// Set to varchar(45) - just in case something uses the IPV4 subnet (see http://en.wikipedia.org/wiki/IPV6#Notation) // Set to varchar(45) - just in case something uses the IPV4 subnet (see http://en.wikipedia.org/wiki/IPV6#Notation)
foreach ($ip_upgrade as $t => $f) foreach ($ip_upgrade as $t => $f)
{ {
if (mysql_table_exists($t)) if (mysql_table_exists($t))
{ // Check for table - might add some core plugin tables in here { // Check for table - might add some core plugin tables in here
if ($field_info = ($sql->db_Field($t, $f, '', TRUE))) if ($field_info = ($sql->db_Field($t, $f, '', TRUE)))
{ {
@@ -716,12 +727,12 @@ function update_706_to_800($type='')
} }
if ($do_save) if ($do_save)
{ {
save_prefs(); save_prefs();
$updateMessages[] = LAN_UPDATE_50.implode(', ',$accum); $updateMessages[] = LAN_UPDATE_50.implode(', ',$accum);
} }
if ($just_check) return TRUE; if ($just_check) return TRUE;
$admin_log->log_event('UPDATE_01',LAN_UPDATE_14.$e107info['e107_version'].'[!br!]'.implode('[!br!]',$updateMessages),E_LOG_INFORMATIVE,''); // Log result of actual update $admin_log->log_event('UPDATE_01',LAN_UPDATE_14.$e107info['e107_version'].'[!br!]'.implode('[!br!]',$updateMessages),E_LOG_INFORMATIVE,''); // Log result of actual update
return $just_check; return $just_check;
@@ -729,9 +740,9 @@ function update_706_to_800($type='')
function update_70x_to_706($type='') function update_70x_to_706($type='')
{ {
global $sql,$ns, $pref, $e107info, $admin_log; global $sql,$ns, $pref, $e107info, $admin_log, $emessage;
$just_check = $type == 'do' ? FALSE : TRUE; $just_check = $type == 'do' ? FALSE : TRUE;
if(!$sql->db_Field("plugin",5)) // not plugin_rss so just add the new one. if(!$sql->db_Field("plugin",5)) // not plugin_rss so just add the new one.
@@ -740,7 +751,7 @@ function update_70x_to_706($type='')
mysql_query("ALTER TABLE `".MPREFIX."plugin` ADD `plugin_addons` TEXT NOT NULL ;"); mysql_query("ALTER TABLE `".MPREFIX."plugin` ADD `plugin_addons` TEXT NOT NULL ;");
catch_error(); catch_error();
} }
//rename plugin_rss field //rename plugin_rss field
if($sql->db_Field("plugin",5) == "plugin_rss") if($sql->db_Field("plugin",5) == "plugin_rss")
{ {
@@ -764,8 +775,9 @@ function update_70x_to_706($type='')
if ($just_check) return update_needed(); if ($just_check) return update_needed();
if(!mysql_query("ALTER TABLE `".MPREFIX."plugin` ADD UNIQUE (`plugin_path`);")) if(!mysql_query("ALTER TABLE `".MPREFIX."plugin` ADD UNIQUE (`plugin_path`);"))
{ {
$mes = "<div style='text-align:center'>".LAN_UPDATE_12." : <a href='".e_ADMIN."db.php?plugin'>".ADLAN_145."</a>.</div>"; $mes = LAN_UPDATE_12." : <a href='".e_ADMIN."db.php?plugin'>".ADLAN_145."</a>.";
$ns -> tablerender(LAN_ERROR,$mes); //$ns -> tablerender(LAN_ERROR,$mes);
$emessage->add($mes, E_MESSAGE_ERROR);
catch_error(); catch_error();
} }
} }
@@ -776,11 +788,11 @@ function update_70x_to_706($type='')
mysql_query("ALTER TABLE ".MPREFIX."online ADD online_active INT(10) UNSIGNED NOT NULL DEFAULT '0'"); mysql_query("ALTER TABLE ".MPREFIX."online ADD online_active INT(10) UNSIGNED NOT NULL DEFAULT '0'");
catch_error(); catch_error();
} }
if ($sql -> db_Query("SHOW INDEX FROM ".MPREFIX."tmp")) if ($sql -> db_Query("SHOW INDEX FROM ".MPREFIX."tmp"))
{ {
$row = $sql -> db_Fetch(); $row = $sql -> db_Fetch();
if (!in_array('tmp_ip', $row)) if (!in_array('tmp_ip', $row))
{ {
if ($just_check) return update_needed(); if ($just_check) return update_needed();
mysql_query("ALTER TABLE `".MPREFIX."tmp` ADD INDEX `tmp_ip` (`tmp_ip`);"); mysql_query("ALTER TABLE `".MPREFIX."tmp` ADD INDEX `tmp_ip` (`tmp_ip`);");
@@ -804,7 +816,7 @@ function update_70x_to_706($type='')
$pref['displayname_maxlength'] = 15; $pref['displayname_maxlength'] = 15;
save_prefs(); save_prefs();
} }
// If we get to here, in checking mode no updates are required. In update mode, all done. // If we get to here, in checking mode no updates are required. In update mode, all done.
if ($just_check) return TRUE; if ($just_check) return TRUE;
$admin_log->log_event('UPDATE_02',LAN_UPDATE_14.$e107info['e107_version'],E_LOG_INFORMATIVE,''); // Log result of actual update $admin_log->log_event('UPDATE_02',LAN_UPDATE_14.$e107info['e107_version'],E_LOG_INFORMATIVE,''); // Log result of actual update
@@ -843,11 +855,15 @@ function copy_user_timezone()
function update_needed($message='') function update_needed($message='')
{ {
global $ns, $update_debug; global $ns, $update_debug;
if ($update_debug) echo "Update: ".$message."<br />"; require_once (e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
if ($update_debug) $emessage->add("Update: ".$message, E_MESSAGE_DEBUG);
if(E107_DEBUG_LEVEL) if(E107_DEBUG_LEVEL)
{ {
$tmp = debug_backtrace(); $tmp = debug_backtrace();
$ns->tablerender("", "<div style='text-align:center'>Update required in ".basename(__FILE__)." on line ".$tmp[0]['line']."</div>"); //$ns->tablerender("", "<div style='text-align:center'>Update required in ".basename(__FILE__)." on line ".$tmp[0]['line']."</div>");
$emessage->add("Update required in ".basename(__FILE__)." on line ".$tmp[0]['line'], E_MESSAGE_DEBUG);
} }
return FALSE; return FALSE;
} }
@@ -874,12 +890,12 @@ function addIndexToTable($target, $indexSpec, $just_check, &$updateMessages, $op
$updateMessages[] = str_replace(array('--TABLE--','--INDEX--'),array($target,$indexSpec),LAN_UPDATE_54); $updateMessages[] = str_replace(array('--TABLE--','--INDEX--'),array($target,$indexSpec),LAN_UPDATE_54);
return !$just_check; // No point carrying on - return 'nothing to do' return !$just_check; // No point carrying on - return 'nothing to do'
} }
if ($sql -> db_Query("SHOW INDEX FROM ".MPREFIX.$target)) if ($sql -> db_Query("SHOW INDEX FROM ".MPREFIX.$target))
{ {
$found = FALSE; $found = FALSE;
while ($row = $sql -> db_Fetch()) while ($row = $sql -> db_Fetch())
{ // One index per field { // One index per field
if (in_array($indexSpec, $row)) if (in_array($indexSpec, $row))
{ {
return !$just_check; // Found - nothing to do return !$just_check; // Found - nothing to do
} }
@@ -898,7 +914,7 @@ function addIndexToTable($target, $indexSpec, $just_check, &$updateMessages, $op
function catch_error() function catch_error()
{ {
if (mysql_error()!='' && E107_DEBUG_LEVEL != 0) if (mysql_error()!='' && E107_DEBUG_LEVEL != 0)
{ {
$tmp2 = debug_backtrace(); $tmp2 = debug_backtrace();
$tmp = mysql_error(); $tmp = mysql_error();

View File

@@ -1,13 +1,10 @@
<?php <?php
/* /*
+ ----------------------------------------------------------------------------+ * Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
| e107 website system - Language File. * $Id: lan_e107_update.php,v 1.8 2008-12-30 15:56:12 secretr Exp $
| *
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_e107_update.php,v $ * Administration Language File
| $Revision: 1.7 $ *
| $Date: 2008-12-17 21:02:30 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/ */
define("LAN_UPDATE_2", "Action"); define("LAN_UPDATE_2", "Action");
@@ -59,11 +56,14 @@ define('LAN_UPDATE_51', 'Update plugin table definition: ');
define('LAN_UPDATE_52', 'Update downloads table'); define('LAN_UPDATE_52', 'Update downloads table');
define('LAN_UPDATE_53', 'Update download mirror table'); define('LAN_UPDATE_53', 'Update download mirror table');
define('LAN_UPDATE_54', 'Missing table --TABLE-- - cannot add index --INDEX--'); define('LAN_UPDATE_54', 'Missing table --TABLE-- - cannot add index --INDEX--');
define('LAN_UPDATE_55', ''); define('LAN_UPDATE_55', 'Description');
define('LAN_UPDATE_56', ''); define('LAN_UPDATE_56', 'System Update');
define('LAN_UPDATE_57', ''); define('LAN_UPDATE_57', '');
define('LAN_UPDATE_58', ''); define('LAN_UPDATE_58', '');
define('LAN_UPDATE_59', ''); define('LAN_UPDATE_59', '');
define('LAN_UPDATE_60', ''); define('LAN_UPDATE_60', '');
define('LAN_UPDATE_CAPTION_PLUGIN', 'Plugin Updates');
define('LAN_UPDATE_CAPTION_CORE', 'Core Updates');
?> ?>