1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

Upgrade Fixes and notice removals.

This commit is contained in:
Cameron 2012-12-07 15:16:42 -08:00
parent 1062988bba
commit df2a903e62
10 changed files with 194 additions and 156 deletions

View File

@ -18,6 +18,17 @@ if (!defined('e107_INIT'))
{
exit;
}
// Required for a clean v1.x -> v2 upgrade.
$core = e107::getConfig('core');
if($core->get('admintheme') != 'bootstrap')
{
$core->update('admintheme','bootstrap');
$core->update('adminstyle','infopanel');
$core->update('admincss','admin_style.css');
$core->set('e_jslib_core',array('prototype' => 'none', 'jquery'=> 'auto'));
$core->save();
e107::getRedirect()->redirect(e_SELF);
}
/* done in class2
@include_once(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_admin.php");
@ -129,16 +140,7 @@ else
// Fix - set cookie before login trigger
session_set(e_COOKIE, $cookieval, (time() + 3600 * 24 * 30));
// Required for a clean v1.x -> v2 upgrade.
$core = e107::getConfig('core');
if($core->get('admintheme') != 'bootstrap')
{
$core->update('admintheme','bootstrap');
$core->update('adminstyle','infopanel');
$core->update('admincss','admin_style.css');
$core->set('e_jslib_core',array('prototype' => 'none', 'jquery'=> 'auto'));
$core->save();
}
// ---
e107::getEvent()->trigger("login", $edata_li);
@ -192,9 +194,7 @@ else
margin-left:auto;
margin-right:auto;
margin-top:12%;
width:400px;
/*
padding: 10px 20px 0 20px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
@ -203,6 +203,8 @@ else
-webkit-box-shadow:5px 5px 20px #000000;
box-shadow:5px 5px 20px #000000;
background-color: #FEFEFE;
/*
*/
}
@ -228,6 +230,7 @@ else
input[disabled] { color: silver; }
button[disabled] span { color: silver; }
.title_clean { display:none; }
");

View File

@ -152,12 +152,12 @@ function show_updates($dbupdate, $what)
return $updates; // Number of updates to do
}
if(is_array($_POST['update_core']))
if(varset($_POST['update_core']) && is_array($_POST['update_core']))
{
$message = run_updates($dbupdate);
}
if(is_array($_POST['update'])) // Do plugin updates
if(varset($_POST['update']) && is_array($_POST['update'])) // Do plugin updates
{
$func = key($_POST['update']);
run_updates_plugin($func,FALSE);

View File

@ -124,7 +124,25 @@ EOF;
// $text = "<div >";
if (getperms('0') && !vartrue($user_pref['core-infopanel-mye107'])) // Set default icons.
{
$user_pref['core-infopanel-mye107'] = $pref['core-infopanel-default'];
$defArray = array (
0 => 'e-administrator',
1 => 'e-cpage',
2 => 'e-frontpage',
3 => 'e-mailout',
4 => 'e-image',
5 => 'e-menus',
6 => 'e-meta',
7 => 'e-newspost',
8 => 'e-plugin',
9 => 'e-prefs',
10 => 'e-links',
11 => 'e-theme',
12 => 'e-userclass2',
13 => 'e-users',
14 => 'e-wmessage'
);
$user_pref['core-infopanel-mye107'] = vartrue($pref['core-infopanel-default'],$defArray);
}
$array_functions_assoc = e107::getNav()->adminLinks('assoc');

View File

@ -121,7 +121,7 @@ if (!$dont_check_update)
}
$dbupdate['core_prefs'] = LAN_UPDATE_13; // Prefs check
$dbupdate['706_to_800'] = LAN_UPDATE_8.' 1.x '.LAN_UPDATE_9.' 2.0';
$dbupdate['70x_to_706'] = LAN_UPDATE_8.' .70x '.LAN_UPDATE_9.' .706';
// $dbupdate['70x_to_706'] = LAN_UPDATE_8.' .70x '.LAN_UPDATE_9.' .706';
} // End if (!$dont_check_update)
@ -298,6 +298,16 @@ function update_706_to_800($type='')
$serialized_prefs = array("'emote'", "'menu_pref'", "'search_prefs'", "'emote_default'");
$create_dir = array(e_MEDIA,e_SYSTEM,e_CACHE,e_CACHE_CONTENT,e_CACHE_IMAGE, e_CACHE_DB, e_LOG, e_BACKUP, e_CACHE_URL, e_TEMP);
foreach($create_dir as $dr)
{
if(!is_dir($dr))
{
mkdir($dr, 0755);
}
}
// List of changed DB tables (defined in core_sql.php)
// No Longer required. - automatically checked against core_sql.php.
// (primarily those which have changed significantly; for the odd field write some explicit code - it'll run faster)
@ -317,12 +327,18 @@ function update_706_to_800($type='')
);
*/
/*
$setCorePrefs = array( //modified prefs during upgrade.
'adminstyle' => 'infopanel',
'admintheme' => 'jayya'
'adminstyle' => 'infopanel',
'admintheme' => 'bootstrap',
'admincss' => 'admin_style.css',
'resize_dimensions' => array(
'news-image' => array('w' => 250, 'h' => 250),
'news-bbcode' => array('w' => 250, 'h' => 250),
'page-bbcode' => array('w' => 250, 'h' => 250)
)
);
*/
@ -393,45 +409,7 @@ function update_706_to_800($type='')
// Check notify prefs
$notify_prefs = $sysprefs -> get('notify_prefs');
$notify_prefs = $eArrayStorage -> ReadArray($notify_prefs);
$nt_changed = 0;
if(vartrue($notify_prefs['event']))
{
foreach ($notify_prefs['event'] as $e => $d)
{
if (isset($d['type']))
{
if ($just_check) return update_needed('Notify pref: '.$e.' outdated');
switch ($d['type'])
{
case 'main' :
$notify_prefs['event'][$e]['class'] = e_UC_MAINADMIN;
break;
case 'class' : // Should already have class defined
break;
case 'email' :
$notify_prefs['event'][$e]['class'] = 'email';
break;
case 'off' : // Need to disable
default :
$notify_prefs['event'][$e]['class'] = e_UC_NOBODY; // Just disable if we don't know what else to do
}
$nt_changed++;
unset($notify_prefs['event'][$e]['type']);
}
}
}
if ($nt_changed)
{
$s_prefs = $tp -> toDB($notify_prefs);
$s_prefs = $eArrayStorage -> WriteArray($s_prefs);
// Could we use $sysprefs->set($s_prefs,'notify_prefs') instead - avoids caching problems ????
$status = ($sql -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'") === FALSE) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$message = str_replace('--COUNT--',$nt_changed,LAN_UPDATE_20);
$log->logMessage($message, $status);
}
$statusTexts = array(E_MESSAGE_SUCCESS => 'Success', E_MESSAGE_ERROR => 'Fail', E_MESSAGE_INFO => 'Info');
@ -466,7 +444,7 @@ function update_706_to_800($type='')
$menuConfig = e107::getConfig('menu');
if ($menuConfig->get('most_members_online') || $menuConfig->get('most_guests_online') || $menuConfig->get('most_online_datestamp'))
{
$status = E_MESSAGE_SUCCESS;
$status = E_MESSAGE_DEBUG;
if ($just_check) return update_needed('Move online counts from menupref');
$newPrefs = e107::getConfig('history');
foreach (array('most_members_online', 'most_guests_online', 'most_online_datestamp') as $v)
@ -617,7 +595,7 @@ function update_706_to_800($type='')
}
}
$log->logMessage(LAN_UPDATE_21.'comments', E_MESSAGE_SUCCESS);
$log->logMessage(LAN_UPDATE_21.'comments', E_MESSAGE_DEBUG);
}
@ -732,7 +710,7 @@ function update_706_to_800($type='')
return FALSE;
}
//$updateMessages[] = LAN_UPDATE_41;
$log->logMessage(LAN_UPDATE_41);
$log->logMessage(LAN_UPDATE_41, E_MESSAGE_DEBUG);
}
}
@ -941,31 +919,7 @@ function update_706_to_800($type='')
// Saved emails - copy across
if ($sql->db_Select('generic', '*', "gen_type='massmail'"))
{
if ($just_check) return update_needed('Copy across saved emails');
require_once(e_HANDLER.'mail_manager_class.php');
$mailHandler = new e107MailManager;
$i = 0;
while ($row = $sql->db_Fetch(MYSQL_ASSOC))
{
$mailRecord = array(
'mail_create_date' => $row['gen_datestamp'],
'mail_creator' => $row['gen_user_id'],
'mail_title' => $row['gen_ip'],
'mail_subject' => $row['gen_ip'],
'mail_body' => $row['gen_chardata'],
'mail_content_status' => MAIL_STATUS_SAVED
);
$mailHandler->mailtoDb($mailRecord, TRUE);
$mailHandler->saveEmail($mailRecord, TRUE);
$sql2->db_Delete('generic', 'gen_id='.intval($row['gen_id'])); // Delete as we go in case operation fails part way through
$i++;
}
unset($mailHandler);
$log->logMessage(str_replace('--COUNT--', $i, LAN_UPDATE_28));
}
@ -1008,7 +962,88 @@ function update_706_to_800($type='')
$dbv->runFix(); // Fix entire core database structure.
//TODO - send notification messages to Log.
// --- Notify Prefs
$notify_prefs = $sysprefs -> get('notify_prefs');
$notify_prefs = $eArrayStorage -> ReadArray($notify_prefs);
$nt_changed = 0;
if(vartrue($notify_prefs['event']))
{
foreach ($notify_prefs['event'] as $e => $d)
{
if (isset($d['type']))
{
if ($just_check) return update_needed('Notify pref: '.$e.' outdated');
switch ($d['type'])
{
case 'main' :
$notify_prefs['event'][$e]['class'] = e_UC_MAINADMIN;
break;
case 'class' : // Should already have class defined
break;
case 'email' :
$notify_prefs['event'][$e]['class'] = 'email';
break;
case 'off' : // Need to disable
default :
$notify_prefs['event'][$e]['class'] = e_UC_NOBODY; // Just disable if we don't know what else to do
}
$nt_changed++;
unset($notify_prefs['event'][$e]['type']);
}
}
}
if ($nt_changed)
{
$s_prefs = $tp -> toDB($notify_prefs);
$s_prefs = $eArrayStorage -> WriteArray($s_prefs);
// Could we use $sysprefs->set($s_prefs,'notify_prefs') instead - avoids caching problems ????
$status = ($sql -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'") !== FALSE) ? E_MESSAGE_DEBUG : E_MESSAGE_ERROR;
$message = str_replace('--COUNT--',$nt_changed,LAN_UPDATE_20);
$log->logMessage($message, $status);
}
// --------------- Saved emails - copy across
if (!$just_check && $sql->db_Select('generic', '*', "gen_type='massmail'"))
{
if ($just_check) return update_needed('Copy across saved emails');
require_once(e_HANDLER.'mail_manager_class.php');
$mailHandler = new e107MailManager;
$i = 0;
while ($row = $sql->db_Fetch(MYSQL_ASSOC))
{
$mailRecord = array(
'mail_create_date' => $row['gen_datestamp'],
'mail_creator' => $row['gen_user_id'],
'mail_title' => $row['gen_ip'],
'mail_subject' => $row['gen_ip'],
'mail_body' => $row['gen_chardata'],
'mail_content_status' => MAIL_STATUS_SAVED
);
$mailHandler->mailtoDb($mailRecord, TRUE);
$mailHandler->saveEmail($mailRecord, TRUE);
$sql2->db_Delete('generic', 'gen_id='.intval($row['gen_id'])); // Delete as we go in case operation fails part way through
$i++;
}
unset($mailHandler);
$log->logMessage(str_replace('--COUNT--', $i, LAN_UPDATE_28));
}
// ------------------- Populate Plugin Table With Changes ------------------
@ -1026,46 +1061,7 @@ function update_706_to_800($type='')
//-- Media-manger import --------------------------------------------------
if(!is_dir(e_MEDIA))
{
mkdir(e_MEDIA,0755);
}
if(!is_dir(e_SYSTEM))
{
mkdir(e_SYSTEM,0755);
}
if(!is_dir(e_CACHE))
{
mkdir(e_CACHE,0755);
}
if(!is_dir(e_CACHE_CONTENT))
{
mkdir(e_CACHE_CONTENT,0755);
}
if(!is_dir(e_CACHE_IMAGE))
{
mkdir(e_CACHE_IMAGE,0755);
}
if(!is_dir(e_CACHE_DB))
{
mkdir(e_CACHE_DB,0755);
}
if(!is_dir(e_LOG))
{
mkdir(e_LOG,0755);
}
if(!is_dir(e_BACKUP))
{
mkdir(e_BACKUP,0755);
}
if(!is_dir(e_CACHE_URL))
{
mkdir(e_CACHE_URL,0755);
}
if(!is_dir(e_TEMP))
{
mkdir(e_TEMP,0755);
}
// Autogenerate filetypes.xml if not found.
if(!is_readable(e_SYSTEM."filetypes.xml"))

View File

@ -1265,7 +1265,7 @@ class admin_shortcodes
$tmpl = strtoupper(varset($parms['tmpl'], 'E_ADMIN_NAVIGATION'));
global $$tmpl;
require(e_ADMIN.'ad_links.php'); //FIXME loaded in boot.php but $admin_cat is not available here.
require_once(e_ADMIN.'ad_links.php'); //FIXME loaded in boot.php but $admin_cat is not available here.
require_once(e_HANDLER.'admin_handler.php');
if($parm == 'home' || $parm == 'logout' || $parm == 'language' || $parm == 'pm')

View File

@ -675,7 +675,7 @@ class db_verify
if(mysql_query($query))
{
$mes->add(LAN_UPDATED.' [&nbsp;'.$query.'&nbsp;]', E_MESSAGE_SUCCESS);
$mes->add(LAN_UPDATED.' [&nbsp;'.$query.'&nbsp;]', E_MESSAGE_DEBUG);
}
else
{

View File

@ -69,7 +69,7 @@ class e_media
// print_a($img_array);
// return;
$count = 0;
foreach($img_array as $f)
{
$fullpath = $tp->createConstants($f['path'].$f['fname'],1);
@ -95,7 +95,8 @@ class e_media
if($sql->db_Insert("core_media",$insert))
{
$mes->addSuccess("Imported Media: ".$f['fname']);
$count++;
$mes->addDebug("Imported Media: ".$f['fname']);
}
else
{
@ -103,6 +104,11 @@ class e_media
}
}
}
if($count)
{
// $mes->addSuccess("Imported {$count} Media items.");
}
return $this;
}

View File

@ -24,6 +24,7 @@ define('E_MESSAGE_SUCCESS', 'success');
define('E_MESSAGE_WARNING', 'warning');
define('E_MESSAGE_ERROR', 'error');
define('E_MESSAGE_DEBUG', 'debug');
define('E_MESSAGE_NODISPLAY', 'nodisplay'); // Appears to be needed by update_routine
//FIXME - language file! new?

View File

@ -105,8 +105,14 @@ class override {
}
}
$tmp = (isset($this->functions[$override]) && strpos($this->functions[$override],"::")) ? explode("::",$this->functions[$override]) : $this->functions[$override];
if($override && isset($this->functions[$override]))
{
$tmp = (strpos($this->functions[$override],"::")) ? explode("::",$this->functions[$override]) : $this->functions[$override];
}
else
{
$tmp = false;
}
if(is_array($tmp) && class_exists($tmp[0]))
{
$cl = new $tmp[0];
@ -116,7 +122,7 @@ class override {
}
}
if (function_exists($this->functions[$override]))
if ($override && isset($this->functions[$override]) && function_exists($this->functions[$override]))
{
return $this->functions[$override];

View File

@ -72,32 +72,40 @@
//XXX Do NOT use 'title' attributes - these should go in the <a>
define("ADMIN_TRUE_ICON", "<i class='S16 e-true-16'></i>");
define("ADMIN_FALSE_ICON", "<i class='S16 e-false-16'></i>");
define("ADMIN_EDIT_ICON", "<i class='S16 e-edit-16' ></i>");
define("ADMIN_DELETE_ICON", "<i class='S16 e-delete-16'></i>");
define("ADMIN_UP_ICON", "<i class='S16 e-up-16'></i>");
define("ADMIN_DOWN_ICON", "<i class='S16 e-down-16'></i>");
define("ADMIN_WARNING_ICON", "<i class='S16 e-warning-16'></i>");
define("ADMIN_INFO_ICON", "<i class='S16 e-info-16'></i>");
define("ADMIN_CONFIGURE_ICON", "<i class='S16 e-configure-16'></i>");
define("ADMIN_ADD_ICON", "<i class='S16 e-add-16'></i>");
define("ADMIN_VIEW_ICON", "<i class='S16 e-search-16'></i>");
define("ADMIN_URL_ICON", "<i class='S16 e-forums-16'></i>");
define("ADMIN_INSTALLPLUGIN_ICON", "<i class='S16 e-plugin_install-16'></i>");
define("ADMIN_UNINSTALLPLUGIN_ICON","<i class='S16 e-plugin_uninstall-16'></i>");
define("ADMIN_UPGRADEPLUGIN_ICON", "<i class='S16 e-up-16'></i>");
define("ADMIN_EXECUTE_ICON", "<i class='S16 e-execute-16'></i>");
define("ADMIN_SORT_ICON", "<i class='S16 e-sort'></i>");
if(!defined('ADMIN_EDIT_ICON') && !defined('ADMIN_TRUE_ICON'))
{
define("ADMIN_TRUE_ICON", "<i class='S16 e-true-16'></i>");
define("ADMIN_FALSE_ICON", "<i class='S16 e-false-16'></i>");
define("ADMIN_EDIT_ICON", "<i class='S16 e-edit-16' ></i>");
define("ADMIN_DELETE_ICON", "<i class='S16 e-delete-16'></i>");
define("ADMIN_UP_ICON", "<i class='S16 e-up-16'></i>");
define("ADMIN_DOWN_ICON", "<i class='S16 e-down-16'></i>");
define("ADMIN_WARNING_ICON", "<i class='S16 e-warning-16'></i>");
define("ADMIN_INFO_ICON", "<i class='S16 e-info-16'></i>");
define("ADMIN_CONFIGURE_ICON", "<i class='S16 e-configure-16'></i>");
define("ADMIN_ADD_ICON", "<i class='S16 e-add-16'></i>");
define("ADMIN_VIEW_ICON", "<i class='S16 e-search-16'></i>");
define("ADMIN_URL_ICON", "<i class='S16 e-forums-16'></i>");
define("ADMIN_INSTALLPLUGIN_ICON", "<i class='S16 e-plugin_install-16'></i>");
define("ADMIN_UNINSTALLPLUGIN_ICON","<i class='S16 e-plugin_uninstall-16'></i>");
define("ADMIN_UPGRADEPLUGIN_ICON", "<i class='S16 e-up-16'></i>");
define("ADMIN_EXECUTE_ICON", "<i class='S16 e-execute-16'></i>");
define("ADMIN_SORT_ICON", "<i class='S16 e-sort'></i>");
define("ADMIN_TRUE_ICON_PATH", e_IMAGE_ABS."admin_images/true_16.png"); //XXX DEPRECATED but used in v1.x
define("ADMIN_FALSE_ICON_PATH", e_IMAGE_ABS."admin_images/false_16.png"); //XXX DEPRECATED but used in v1.x
define("ADMIN_EDIT_ICON_PATH", e_IMAGE_ABS."admin_images/edit_16.png"); //XXX DEPRECATED but used in v1.x
define("ADMIN_DELETE_ICON_PATH", e_IMAGE_ABS."admin_images/delete_16.png"); //XXX DEPRECATED but used in v1.x
define("ADMIN_WARNING_ICON_PATH", e_IMAGE_ABS."admin_images/warning_16.png"); //XXX DEPRECATED but used in v1.x
}
define("ADMIN_TRUE_ICON_PATH", e_IMAGE_ABS."admin_images/true_16.png"); //XXX DEPRECATED but used in v1.x
define("ADMIN_FALSE_ICON_PATH", e_IMAGE_ABS."admin_images/false_16.png"); //XXX DEPRECATED but used in v1.x
define("ADMIN_EDIT_ICON_PATH", e_IMAGE_ABS."admin_images/edit_16.png"); //XXX DEPRECATED but used in v1.x
define("ADMIN_DELETE_ICON_PATH", e_IMAGE_ABS."admin_images/delete_16.png"); //XXX DEPRECATED but used in v1.x
define("ADMIN_WARNING_ICON_PATH", e_IMAGE_ABS."admin_images/warning_16.png"); //XXX DEPRECATED but used in v1.x