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

Code clean-up (globals, $e107->, $mes, headers)

This commit is contained in:
Moc
2013-03-24 13:07:15 +01:00
parent fd4fff52d4
commit 8d6d54a38f
12 changed files with 157 additions and 182 deletions

View File

@@ -162,6 +162,7 @@ class admin_shortcodes
$e107 = e107::getInstance();
$sql = e107::getDb();
$pref = e107::getPref();
$ns = e107::getRender();
e107::plugLan('user_menu', '', true);
@@ -300,7 +301,7 @@ class admin_shortcodes
if(isset($params['nomenu'])) { return $select; }
if($select) { $text .= "<div class='center'>{$select}</div>"; }
return $e107->ns->tablerender(UTHEME_MENU_L2, $text, '', true);
return $ns->tablerender(UTHEME_MENU_L2, $text, '', true);
}

View File

@@ -1,7 +1,8 @@
<?php
function custom_shortcode($parm)
{
global $pref;
$pref = e107::getPref();
$tp = e107::getParser();
$e107 = e107::getInstance();
$custom_query = explode('+', $parm);
switch($custom_query[0])
@@ -55,7 +56,7 @@ function custom_shortcode($parm)
else
{
$quotes = file($qotdf_file);
$quote = $e107->tp->toHTML($quotes[rand(0, count($quotes) -1 )], true);
$quote = $tp->toHTML($quotes[rand(0, count($quotes) -1 )], true);
}
return $quote;
break;
@@ -90,7 +91,7 @@ function custom_shortcode($parm)
break;
case 'welcomemessage':
return $e107->tp->parseTemplate('{WMESSAGE}');
return $tp->parseTemplate('{WMESSAGE}');
break;
}
}

View File

@@ -1,7 +1,5 @@
<?php
// $Id$
function wmessage_shortcode($parm)
{
$e107 = e107::getInstance();
@@ -42,7 +40,8 @@ function wmessage_shortcode($parm)
if (deftrue('e_FRONTPAGE') || ($parm == 'force') || ((e_SELF == $front_url) && (($parm == 'ignore_query') || (e_QUERY == $front_qry))))
{
// Actually want to display a welcome message here
global $ns;
$ns = e107::getRender();
$tp = e107::getParser();
if($cacheData = $e107cache->retrieve('wmessage'))
{
@@ -52,20 +51,19 @@ function wmessage_shortcode($parm)
if (!defined('WMFLAG'))
{
$qry = "
SELECT * FROM #generic
WHERE gen_type ='wmessage' AND gen_intdata IN (".USERCLASS_LIST.')';
$wmessage = array();
$wmcaption = '';
if($e107->sql->db_Select_gen($qry))
if($sql->gen($qry))
{
while ($row = $e107->sql->db_Fetch())
while ($row = $sql->fetch())
{
$wmessage[] = $e107->tp->toHTML($row['gen_chardata'], TRUE, 'BODY, defs', 'admin');
$wmessage[] = $tp->toHTML($row['gen_chardata'], TRUE, 'BODY, defs', 'admin');
if(!$wmcaption)
{
$wmcaption = $e107->tp->toHTML($row['gen_ip'], TRUE, 'TITLE');
$wmcaption = $tp->toHTML($row['gen_ip'], TRUE, 'TITLE');
}
}
}

View File

@@ -2,14 +2,12 @@
/*
* e107 website system
*
* Copyright (C) 2008-2012 e107 Inc (e107.org)
* Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Default Header
*
* $URL$
* $Id$
*/
if (!defined('e107_INIT')) { exit; }
@@ -21,7 +19,9 @@ if(!defined('USER_AREA'))
define('ADMIN_AREA',FALSE);
$e107 = e107::getInstance();
$e107->sql->db_Mark_Time('(Header Top)');
$sql = e107::getDb();
$sql->db_Mark_Time('(Header Top)');
@@ -579,7 +579,7 @@ echo "<body".$body_onload.">\n";
// Header included notification, from this point header includes are not possible
define('HEADER_INIT', TRUE);
$e107->sql->db_Mark_Time("Main Page Body");
$sql->db_Mark_Time("Main Page Body");
//
// K: (The rest is ignored for popups, which have no menus)