1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 13:17:24 +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).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/admin.php,v $
| $Revision: 1.8 $
| $Date: 2008-12-29 16:11:02 $
| $Revision: 1.9 $
| $Date: 2008-12-30 15:56:12 $
| $Author: secretr $
+----------------------------------------------------------------------------+
*/
@@ -22,15 +22,19 @@ require_once('auth.php');
require_once(e_HANDLER.'admin_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
// --- check for 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>";
$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
@@ -67,9 +71,11 @@ 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
if (count($allowed_types) == 0)
{
echo "Setting default filetypes<br />";
$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 />';
// avatar check.
$public = array(e_FILE.'public', e_FILE.'public/avatars');
@@ -107,14 +113,15 @@ foreach ($public as $dir)
if (isset($potential))
{
$text = ADLAN_ERR_3."<br /><br />";
//$text = ADLAN_ERR_3."<br /><br />";
$emessage->add(ADLAN_ERR_3, E_MESSAGE_WARNING);
$text = '<ul>';
foreach ($potential as $p_file)
{
$text .= $p_file.'<br />';
$text .= '<li>'.$p_file.'</li>';
}
$ns -> tablerender(ADLAN_ERR_1, $text);
$emessage->add($text, E_MESSAGE_WARNING);
//$ns -> tablerender(ADLAN_ERR_1, $text);
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -11,14 +11,17 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/includes/categories.php,v $
| $Revision: 1.4 $
| $Date: 2008-12-04 20:17:49 $
| $Author: e107steved $
| $Revision: 1.5 $
| $Date: 2008-12-30 15:56:12 $
| $Author: secretr $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
require_once(e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
$text = "<div style='text-align:center'>
<table class='fborder' style='".ADMIN_WIDTH."'>";
@@ -110,7 +113,7 @@ foreach ($admin_cat['id'] as $cat_key => $cat_id)
$text .= "</table></div>";
$ns->tablerender(ADLAN_47." ".ADMINNAME, $text);
$ns->tablerender(ADLAN_47." ".ADMINNAME, $emessage->render().$text);
echo admin_info();

View File

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

View File

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

View File

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

View File

@@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $
| $Revision: 1.35 $
| $Date: 2008-12-17 21:02:25 $
| $Author: e107steved $
| $Revision: 1.36 $
| $Date: 2008-12-30 15:56:12 $
| $Author: secretr $
+----------------------------------------------------------------------------+
*/
@@ -151,11 +151,22 @@ function update_check()
if ($update_needed === TRUE)
{
$txt = "<div style='text-align:center;'>".ADLAN_120;
$txt .= "<br /><form method='post' action='".e_ADMIN."e107_update.php'>
<input class='button' type='submit' value='".LAN_UPDATE."' />
</form></div>";
$ns->tablerender(LAN_UPDATE, $txt);
require_once (e_HANDLER."form_handler.php");
$frm = new e_form();
$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);
}
}
@@ -731,7 +742,7 @@ function update_706_to_800($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;
if(!$sql->db_Field("plugin",5)) // not plugin_rss so just add the new one.
@@ -764,8 +775,9 @@ function update_70x_to_706($type='')
if ($just_check) return update_needed();
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>";
$ns -> tablerender(LAN_ERROR,$mes);
$mes = LAN_UPDATE_12." : <a href='".e_ADMIN."db.php?plugin'>".ADLAN_145."</a>.";
//$ns -> tablerender(LAN_ERROR,$mes);
$emessage->add($mes, E_MESSAGE_ERROR);
catch_error();
}
}
@@ -843,11 +855,15 @@ function copy_user_timezone()
function update_needed($message='')
{
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)
{
$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;
}

View File

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