1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 12:48:26 +02:00

More $emessage removal and code clean-up

This commit is contained in:
Tijn Kuyper
2013-02-25 20:28:47 +01:00
parent e6e20fd8ef
commit a187f7c40d

View File

@@ -2,17 +2,14 @@
/* /*
* e107 website system * e107 website system
* *
* Copyright (C) 2008-2009 e107 Inc (e107.org) * Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the * Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
* *
* Administration Area - Languages * Administration Area - Languages
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/language.php,v $ * $URL$
* $Revision$ * $Id$
* $Date$
* $Author$
*
*/ */
require_once ("../class2.php"); require_once ("../class2.php");
if (!getperms('0')) if (!getperms('0'))
@@ -28,7 +25,7 @@ require_once ("auth.php");
require_once (e_HANDLER."form_handler.php"); require_once (e_HANDLER."form_handler.php");
require_once (e_HANDLER."message_handler.php"); require_once (e_HANDLER."message_handler.php");
$frm = e107::getForm(); $frm = e107::getForm();
$emessage = e107::getMessage(); $mes = e107::getMessage();
$tabs = table_list(); // array("news","content","links"); $tabs = table_list(); // array("news","content","links");
$lanlist = e107::getLanguage()->installed();// Bugfix - don't use e_LANLIST as it's cached (SESSION) $lanlist = e107::getLanguage()->installed();// Bugfix - don't use e_LANLIST as it's cached (SESSION)
$message = ''; $message = '';
@@ -52,11 +49,11 @@ if (isset($_POST['submit_prefs']) && isset($_POST['mainsitelanguage']))
if ($admin_log->logArrayDiffs($temp, $pref, 'LANG_01')) if ($admin_log->logArrayDiffs($temp, $pref, 'LANG_01'))
{ {
save_prefs(); // Only save if changes save_prefs(); // Only save if changes
$emessage->add(LAN_SETSAVED, E_MESSAGE_SUCCESS); //$mes->addSuccess(LAN_SETSAVED, E_MESSAGE_SUCCESS);
} }
else else
{ {
$emessage->add(LAN_NO_CHANGE); $mes->addInfo(LAN_NO_CHANGE);
} }
} }
// ----------------- delete tables --------------------------------------------- // ----------------- delete tables ---------------------------------------------
@@ -71,13 +68,13 @@ if (isset($_POST['del_existing']) && $_POST['lang_choices'])
$qry = "DROP TABLE ".$mySQLprefix."lan_".$lang."_".$del_table; $qry = "DROP TABLE ".$mySQLprefix."lan_".$lang."_".$del_table;
if (mysql_query($qry)) if (mysql_query($qry))
{ {
$message .= sprintf(LANG_LAN_28, $_POST['lang_choices'].' '.$del_table).'[!br!]'; $message .= sprintf(LANG_LAN_28, $_POST['lang_choices'].' '.$del_table).'[!br!]'; // can be removed?
$emessage->add(sprintf(LANG_LAN_28, $_POST['lang_choices'].' '.$del_table), E_MESSAGE_SUCCESS); $mes->addSuccess(sprintf(LANG_LAN_28, $_POST['lang_choices'].' '.$del_table));
} }
else else
{ {
$message .= sprintf(LANG_LAN_29, $_POST['lang_choices'].' '.$del_table).'[!br!]'; $message .= sprintf(LANG_LAN_29, $_POST['lang_choices'].' '.$del_table).'[!br!]'; // can be removed?
$emessage->add(sprintf(LANG_LAN_29, $_POST['lang_choices'].' '.$del_table), E_MESSAGE_WARNING); $mes->addWarning(sprintf(LANG_LAN_29, $_POST['lang_choices'].' '.$del_table));
} }
} }
} }
@@ -100,20 +97,20 @@ if (isset($_POST['create_tables']) && $_POST['language'])
$copdata = ($_POST['copydata_'.$value]) ? 1 : 0; $copdata = ($_POST['copydata_'.$value]) ? 1 : 0;
if ($sql->db_CopyTable($value, "lan_".$lang."_".$value, $_POST['drop'], $copdata)) if ($sql->db_CopyTable($value, "lan_".$lang."_".$value, $_POST['drop'], $copdata))
{ {
$message .= sprintf(LANG_LAN_30, $_POST['language'].' '.$value).'[!br!]'; $message .= sprintf(LANG_LAN_30, $_POST['language'].' '.$value).'[!br!]'; // can be removed?
$emessage->add(sprintf(LANG_LAN_30, $_POST['language'].' '.$value), E_MESSAGE_SUCCESS); $mes->addSuccess(sprintf(LANG_LAN_30, $_POST['language'].' '.$value));
} }
else else
{ {
if (!$_POST['drop']) if (!$_POST['drop'])
{ {
$message .= sprintf(LANG_LAN_00, $_POST['language'].' '.$value).'[!br!]'; $message .= sprintf(LANG_LAN_00, $_POST['language'].' '.$value).'[!br!]'; // can be removed?
$emessage->add(sprintf(LANG_LAN_00, $_POST['language'].' '.$value), E_MESSAGE_WARNING); $mes->addWarning(sprintf(LANG_LAN_00, $_POST['language'].' '.$value));
} }
else else
{ {
$message .= sprintf(LANG_LAN_01, $_POST['language'].' '.$value).'[!br!]'; $message .= sprintf(LANG_LAN_01, $_POST['language'].' '.$value).'[!br!]'; // can be removed?
$emessage->add(sprintf(LANG_LAN_01, $_POST['language'].' '.$value), E_MESSAGE_WARNING); $mes->addWarning(sprintf(LANG_LAN_01, $_POST['language'].' '.$value));
} }
} }
} }
@@ -124,20 +121,20 @@ if (isset($_POST['create_tables']) && $_POST['language'])
// Remove table. // Remove table.
if (mysql_query("DROP TABLE ".$mySQLprefix."lan_".$lang."_".$value)) if (mysql_query("DROP TABLE ".$mySQLprefix."lan_".$lang."_".$value))
{ {
$message .= $_POST['language'].' '.$value.' '.LAN_DELETED.'[!br!]'; $message .= $_POST['language'].' '.$value.' '.LAN_DELETED.'[!br!]'; // can be removed?
$emessage->add($_POST['language'].' '.$value.' '.LAN_DELETED, E_MESSAGE_SUCCESS); $mes->addSuccess($_POST['language'].' '.$value.' '.LAN_DELETED);
} }
else else
{ {
$message .= sprintf(LANG_LAN_02, $_POST['language'].' '.$value).'[!br!]'; $message .= sprintf(LANG_LAN_02, $_POST['language'].' '.$value).'[!br!]'; // can be removed?
$emessage->add(sprintf(LANG_LAN_02, $_POST['language'].' '.$value), E_MESSAGE_WARNING); $mes->addWarning(sprintf(LANG_LAN_02, $_POST['language'].' '.$value));
} }
} }
else else
{ {
// leave table. LANG_LAN_32 // leave table. LANG_LAN_32
$message .= sprintf(LANG_LAN_32, $_POST['language'].' '.$value).'[!br!]'; $message .= sprintf(LANG_LAN_32, $_POST['language'].' '.$value).'[!br!]'; // can be removed?
$emessage->add(sprintf(LANG_LAN_32, $_POST['language'].' '.$value)); $mes->addInfo(sprintf(LANG_LAN_32, $_POST['language'].' '.$value));
} }
} }
} }
@@ -174,11 +171,11 @@ if (varset($_POST['ziplang']) && varset($_POST['language']))
{ {
$text = zip_up_lang($_POST['language']); $text = zip_up_lang($_POST['language']);
$admin_log->log_event('LANG_04', $_POST['language'], E_LOG_INFORMATIVE, ''); $admin_log->log_event('LANG_04', $_POST['language'], E_LOG_INFORMATIVE, '');
$emessage->add(LANG_LAN_25.': '.$text); $mes->addInfo(LANG_LAN_25.': '.$text);
} }
else else
{ {
$emessage->add(LANG_LAN_36,E_MESSAGE_WARNING); $mes->addWarning(LANG_LAN_36);
} }
} }
if (varset($action) == "tools") if (varset($action) == "tools")
@@ -288,7 +285,7 @@ function disableUnused($data)
$data = str_replace(' * $URL$ $data = str_replace(' * $URL$
* $Revision$ * $Revision$
* $Id$ * $Id$
* $Author$',"",$data); * $Author$',"",$data); // TODO FIXME ?
$tmp = explode("\n",$data); $tmp = explode("\n",$data);
foreach($tmp as $line) foreach($tmp as $line)
@@ -441,7 +438,7 @@ if (isset($_POST['edit_existing']))
</fieldset> </fieldset>
</form> </form>
"; ";
$ns->tablerender($_POST['lang_choices'], $emessage->render().$text); $ns->tablerender($_POST['lang_choices'], $mes->render().$text);
} }
require_once (e_ADMIN."footer.php"); require_once (e_ADMIN."footer.php");
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -449,7 +446,8 @@ require_once (e_ADMIN."footer.php");
function multilang_prefs() function multilang_prefs()
{ {
global $pref,$lanlist; global $lanlist;
$pref = e107::getPref();
$mes = e107::getMessage(); $mes = e107::getMessage();
$frm = e107::getForm(); $frm = e107::getForm();
@@ -591,11 +589,13 @@ function table_list()
function multilang_db() function multilang_db()
{ {
global $pref, $emessage, $lanlist, $tabs; global $lanlist, $tabs;
$sql = e107::getDb(); $sql = e107::getDb();
$frm = e107::getForm(); $frm = e107::getForm();
$tp = e107::getParser(); $tp = e107::getParser();
$mes = e107::getMessage();
$pref = e107::getPref();
if (isset($pref['multilanguage']) && $pref['multilanguage']) if (isset($pref['multilanguage']) && $pref['multilanguage'])
{ {
@@ -679,7 +679,7 @@ function multilang_db()
</fieldset> </fieldset>
"; ";
e107::getRender()->tablerender(ADLAN_132.SEP.LANG_LAN_16, $emessage->render().$text); // Languages -> Tables e107::getRender()->tablerender(ADLAN_132.SEP.LANG_LAN_16, $mes->render().$text); // Languages -> Tables
} }
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -909,7 +909,7 @@ function available_langpacks()
function language_adminmenu() function language_adminmenu()
{ {
global $pref; $pref = e107::getPref();
$action = e_QUERY; $action = e_QUERY;
@@ -1109,12 +1109,12 @@ function unused($lanfile,$script,$reverse=false)
if(!$compare) if(!$compare)
{ {
$mes->add("Couldn't read ".$script, E_MESSAGE_ERROR); $mes->addError("Couldn't read ".$script);
} }
if(!$lanDefines) if(!$lanDefines)
{ {
$mes->add("Couldn't read ".$lanfile, E_MESSAGE_ERROR); $mes->addError("Couldn't read ".$lanfile);
} }
$srch = array("<?php","<?","?>"); $srch = array("<?php","<?","?>");