From 2074ef8f376e2d6fc98d38cd04520139203cb439 Mon Sep 17 00:00:00 2001 From: Moc Date: Mon, 25 Mar 2013 18:48:48 +0100 Subject: [PATCH] Code clean-up (globals, $e107->, headers, $sql) --- .../shortcodes/batch/news_shortcodes.php | 28 +++++++++---------- e107_handlers/login.php | 13 +++++---- e107_plugins/chatbox_menu/e_list.php | 12 +++----- e107_plugins/download/e_tagwords.php | 7 +++-- e107_plugins/forum/e_list.php | 4 +-- e107_plugins/forum/forum.php | 5 ++-- e107_plugins/forum/forum_mod.php | 15 ++++------ e107_plugins/forum/forum_viewtopic.php | 15 +++++----- e107_plugins/forum/newforumposts_menu.php | 17 +++++------ .../shortcodes/batch/post_shortcodes.php | 9 +++--- .../shortcodes/batch/view_shortcodes.php | 16 +++++------ e107_plugins/list_new/list_admin_class.php | 28 +++++++++---------- e107_plugins/list_new/list_shortcodes.php | 23 ++++++--------- .../list_new/section/list_members.php | 12 +++----- e107_plugins/online/online_shortcodes.php | 4 +-- e107_plugins/pm/pm.php | 12 ++++---- e107_plugins/pm/pm_class.php | 7 +++-- 17 files changed, 106 insertions(+), 121 deletions(-) diff --git a/e107_core/shortcodes/batch/news_shortcodes.php b/e107_core/shortcodes/batch/news_shortcodes.php index 900c5b272..abee5f233 100644 --- a/e107_core/shortcodes/batch/news_shortcodes.php +++ b/e107_core/shortcodes/batch/news_shortcodes.php @@ -1,14 +1,13 @@ setClass("news"); - $news_body = $this->e107->tp->toHTML($this->news_item['news_body'], true, 'BODY, fromadmin', $this->news_item['news_author']); + $news_body = $tp->toHTML($this->news_item['news_body'], true, 'BODY, fromadmin', $this->news_item['news_author']); if($this->news_item['news_extended'] && (isset($_POST['preview']) || $this->param['current_action'] == 'extend') && $parm != 'noextend') { - $news_body .= $this->e107->tp->toHTML($this->news_item['news_extended'], true, 'BODY, fromadmin', $this->news_item['news_author']); + $news_body .= $tp->toHTML($this->news_item['news_extended'], true, 'BODY, fromadmin', $this->news_item['news_author']); } e107::getBB()->clearClass(); return $news_body; @@ -144,7 +144,7 @@ class news_shortcodes extends e_shortcode function sc_newscategory($parm) { - $category_name = $this->e107->tp->toHTML($this->news_item['category_name'], FALSE ,'defs'); + $category_name = e107::getParser()->toHTML($this->news_item['category_name'], FALSE ,'defs'); return "param['catlink'] : "#")."' href='".$this->e107->url->create('news/list/category', $this->news_item)."'>".$category_name.""; } @@ -204,7 +204,7 @@ class news_shortcodes extends e_shortcode { $pref = e107::getPref(); if (!$pref['plug_installed']['pdf']) { return ''; } - return $this->e107->tp->parseTemplate('{PDF='.LAN_NEWS_24.'^news.'.$this->news_item['news_id'].'}'); + return e107::getParser()->parseTemplate('{PDF='.LAN_NEWS_24.'^news.'.$this->news_item['news_id'].'}'); } function sc_newsid() @@ -252,13 +252,13 @@ class news_shortcodes extends e_shortcode function sc_captionclass() { - $news_title = $this->e107->tp->toHTML($this->news_item['news_title'], TRUE,'TITLE'); + $news_title = e107::getParser()->toHTML($this->news_item['news_title'], TRUE,'TITLE'); return "
".($this->news_item['news_render_type'] == 1 ? "news_item)."'>".$news_title."" : $news_title)."
"; } function sc_admincaption() { - $news_title = $this->e107->tp->toHTML($this->news_item['news_title'], TRUE,'TITLE'); + $news_title = e107::getParser()->toHTML($this->news_item['news_title'], TRUE,'TITLE'); return "
".($this->news_item['news_render_type'] == 1 ? "news_item)."'>".$news_title."" : $news_title)."
"; } @@ -333,7 +333,7 @@ class news_shortcodes extends e_shortcode else { // We store SC path in DB now + BC - $src = $this->news_item['news_thumbnail'][0] == '{' ? e107::getParser()->replaceConstants($this->news_item['news_thumbnail'], 'abs') : e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail']; + $src = $this->news_item['news_thumbnail'][0] == '{' ? $tp->replaceConstants($this->news_item['news_thumbnail'], 'abs') : e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail']; } @@ -431,7 +431,7 @@ class news_shortcodes extends e_shortcode $parm = explode('|', $parm, 2); $parm[1] = 'news_id='.$this->news_item['news_id'].(varset($parm[1]) ? '&'.$parm[1] : ''); e107::setRegistry('core/news/schook_data', array('data' => $this->news_item, 'params' => $this->param)); - return $this->e107->tp->parseTemplate('{'.strtoupper($parm[0]).'='.$parm[1].'}'); + return e107::getParser()->parseTemplate('{'.strtoupper($parm[0]).'='.$parm[1].'}'); } function sc_newsinfo() @@ -447,7 +447,7 @@ class news_shortcodes extends e_shortcode $info .= '
'.($news_item['news_allow_comments'] ? LAN_NEWS_13 : LAN_NEWS_12); $info .= LAN_NEWS_14.$news_item['news_start'].$news_item['news_end'].'
'; $info .= LAN_NEWS_15.strlen($news_item['news_body']).LAN_NEWS_16.strlen($news_item['news_extended']).LAN_NEWS_17."

"; - //return $this->e107->ns->tablerender(LAN_NEWS_18, $info); + //return $ns->tablerender(LAN_NEWS_18, $info); return $info; } diff --git a/e107_handlers/login.php b/e107_handlers/login.php index 878529a62..ba9cbee46 100644 --- a/e107_handlers/login.php +++ b/e107_handlers/login.php @@ -291,7 +291,7 @@ class userlogin $fp = SITEURL.$fp; } //$redir = ((strpos($fp, 'http') === FALSE) ? SITEURL : '').$this->e107->tp->replaceConstants($fp, TRUE, FALSE); - $redir = $this->e107->tp->replaceConstants($fp, TRUE, FALSE); + $redir = e107::getParser()->replaceConstants($fp, TRUE, FALSE); // $this->e107->admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","Redirect active",$redir,FALSE,FALSE); } break; @@ -364,17 +364,18 @@ class userlogin public function getLookupQuery($username, $forceLogin, $dbAlias = '') { $pref = e107::getPref(); + $tp = e107::getParser(); $username = preg_replace("/\sOR\s|\=|\#/", "", $username); if($forceLogin === 'provider') { - return "{$dbAlias}`user_xup`='".$this->e107->tp->toDB($username)."'"; + return "{$dbAlias}`user_xup`='".$tp->toDB($username)."'"; } - $qry[0] = "{$dbAlias}`user_loginname`= '".$this->e107->tp->toDB($username)."'"; // username only (default) - $qry[1] = "{$dbAlias}`user_email` = '".$this->e107->tp->toDB($username)."'"; // email only - $qry[2] = (strpos($username,'@') !== FALSE ) ? "{$dbAlias}`user_loginname`= '".$this->e107->tp->toDB($username)."' OR {$dbAlias}`user_email` = '".$this->e107->tp -> toDB($username)."'" : $qry[0]; //username or email + $qry[0] = "{$dbAlias}`user_loginname`= '".$tp->toDB($username)."'"; // username only (default) + $qry[1] = "{$dbAlias}`user_email` = '".$tp->toDB($username)."'"; // email only + $qry[2] = (strpos($username,'@') !== FALSE ) ? "{$dbAlias}`user_loginname`= '".$tp->toDB($username)."' OR {$dbAlias}`user_email` = '".$tp->toDB($username)."'" : $qry[0]; //username or email // Look up user in DB - even if email addresses allowed, still look up by user name as well - user could have specified email address for their login name @@ -538,7 +539,7 @@ class userlogin if($fails > 10) { e107::getIPHandler()->add_ban(4,LAN_LOGIN_18,$this->userIP,1); - e107::getDb()->insert("generic", "0, 'auto_banned', '".time()."', 0, '{$this->userIP}', '{$extra_text}', '".LAN_LOGIN_20.": ".$this->e107->tp -> toDB($username).", ".LAN_LOGIN_17.": ".md5($ouserpass)."' "); + e107::getDb()->insert("generic", "0, 'auto_banned', '".time()."', 0, '{$this->userIP}', '{$extra_text}', '".LAN_LOGIN_20.": ".e107::getParser()->toDB($username).", ".LAN_LOGIN_17.": ".md5($ouserpass)."' "); } } } diff --git a/e107_plugins/chatbox_menu/e_list.php b/e107_plugins/chatbox_menu/e_list.php index 4a1f97034..e7d14c726 100644 --- a/e107_plugins/chatbox_menu/e_list.php +++ b/e107_plugins/chatbox_menu/e_list.php @@ -2,17 +2,12 @@ /* * 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 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * * Chatbox e_list Handler * - * $Source: /cvs_backup/e107_0.8/e107_plugins/chatbox_menu/e_list.php,v $ - * $Revision$ - * $Date$ - * $Author$ - * */ if (!defined('e107_INIT')) { exit; } @@ -25,6 +20,7 @@ class list_chatbox_menu function getListData() { + $sql = e107::getDb(); $list_caption = $this->parent->settings['caption']; $list_display = ($this->parent->settings['open'] ? "" : "none"); @@ -41,13 +37,13 @@ class list_chatbox_menu $bullet = $this->parent->getBullet($this->parent->settings['icon']); - if(!$chatbox_posts = $this->parent->e107->sql->db_Select_gen("SELECT * FROM #chatbox WHERE ".$qry)) + if(!$chatbox_posts = $this->parent->$sql->gen("SELECT * FROM #chatbox WHERE ".$qry)) { $list_data = LIST_CHATBOX_2; } else { - while($row = $this->parent->e107->sql->db_Fetch()) + while($row = $this->parent->$sql->fetch()) { $cb_id = substr($row['cb_nick'] , 0, strpos($row['cb_nick'] , ".")); $cb_nick = substr($row['cb_nick'] , (strpos($row['cb_nick'] , ".")+1)); diff --git a/e107_plugins/download/e_tagwords.php b/e107_plugins/download/e_tagwords.php index f90837a57..bb2d9e26a 100644 --- a/e107_plugins/download/e_tagwords.php +++ b/e107_plugins/download/e_tagwords.php @@ -23,20 +23,21 @@ class e_tagwords_download $this->row = $this->getRecord($id); } $url = e_BASE."download.php?view.".$this->row['download_id']; - return "".$this->e107->tp->toHTML($this->row['download_name'], TRUE, '').""; + return "".e107::getParser()->toHTML($this->row['download_name'], TRUE, '').""; } function getRecord($id) { + $sql = e107::getDb(); $this->row = ''; $qry = "SELECT d.* FROM #download as d WHERE d.download_id='{$id}' AND d.download_class REGEXP '".e_CLASS_REGEXP."' "; - if($this->e107->sql->db_Select_gen($qry)) + if($sql->gen($qry)) { - $this->row=$this->e107->sql->db_Fetch(); + $this->row=$sql->fetch(); } return $this->row; } diff --git a/e107_plugins/forum/e_list.php b/e107_plugins/forum/e_list.php index cc0d4439f..867c73df7 100644 --- a/e107_plugins/forum/e_list.php +++ b/e107_plugins/forum/e_list.php @@ -61,13 +61,13 @@ class list_forum } - if(!$results = $this->parent->e107->sql->db_Select_gen($qry)) + if(!$results = $this->parent->$sql->gen($qry)) { $list_data = LIST_FORUM_2; } else { - $forumArray = $this->parent->e107->sql->db_getList(); + $forumArray = $this->parent->e107->$sql->getList(); $path = e_PLUGIN."forum/"; foreach($forumArray as $forumInfo) diff --git a/e107_plugins/forum/forum.php b/e107_plugins/forum/forum.php index bd2e518d8..b3115e27a 100644 --- a/e107_plugins/forum/forum.php +++ b/e107_plugins/forum/forum.php @@ -15,6 +15,7 @@ if(!defined('e107_INIT')) } $e107 = e107::getInstance(); $tp = e107::getParser(); +$sql = e107::getDb(); if (!$e107->isInstalled('forum')) { @@ -419,9 +420,9 @@ if (e_QUERY == 'track') WHERE thread_id IN({$trackedThreadList}) ORDER BY thread_lastpost DESC "; - if($e107->sql->db_Select_gen($qry)) + if($sql->gen($qry)) { - while($row = $e107->sql->db_Fetch(MYSQL_ASSOC)) + while($row = $sql->fetch(MYSQL_ASSOC)) { $trackVars->NEWIMAGE = IMAGE_nonew_small; if ($row['thread_datestamp'] > USERLV && !in_array($row['thread_id'], $viewed)) diff --git a/e107_plugins/forum/forum_mod.php b/e107_plugins/forum/forum_mod.php index ed7e72d6e..4c8bef676 100644 --- a/e107_plugins/forum/forum_mod.php +++ b/e107_plugins/forum/forum_mod.php @@ -2,14 +2,10 @@ /* * 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 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * - * - * - * $URL$ - * $Id$ */ if (!defined('e107_INIT')) { exit(); } @@ -18,6 +14,7 @@ include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_admin.php'); function forum_thread_moderate($p) { $e107 = e107::getInstance(); + $sql = e107::getDb(); foreach ($p as $key => $val) { if (preg_match("#(.*?)_(\d+)_x#", $key, $matches)) @@ -28,22 +25,22 @@ function forum_thread_moderate($p) switch ($act) { case 'lock': - $e107->sql->db_Update('forum_thread', 'thread_active=0 WHERE thread_id='.$id); + $sql->update('forum_thread', 'thread_active=0 WHERE thread_id='.$id); return FORLAN_CLOSE; break; case 'unlock': - $e107->sql->db_Update('forum_thread', 'thread_active=1 WHERE thread_id='.$id); + $sql->update('forum_thread', 'thread_active=1 WHERE thread_id='.$id); return FORLAN_OPEN; break; case 'stick': - $e107->sql->db_Update('forum_thread', 'thread_sticky=1 WHERE thread_id='.$id); + $sql->update('forum_thread', 'thread_sticky=1 WHERE thread_id='.$id); return FORLAN_STICK; break; case 'unstick': - $e107->sql->db_Update('forum_thread', 'thread_sticky=0 WHERE thread_id='.$id); + $sql->update('forum_thread', 'thread_sticky=0 WHERE thread_id='.$id); return FORLAN_UNSTICK; break; diff --git a/e107_plugins/forum/forum_viewtopic.php b/e107_plugins/forum/forum_viewtopic.php index d2f46c149..7a5804fa3 100644 --- a/e107_plugins/forum/forum_viewtopic.php +++ b/e107_plugins/forum/forum_viewtopic.php @@ -2,15 +2,12 @@ /* * e107 website system * - * Copyright (C) 2008-2011 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) * * Forum View Topic * - * $URL$ - * $Id$ - * */ require_once ('../../class2.php'); @@ -641,6 +638,8 @@ class e107ForumThread { global $forum, $thread; $e107 = e107::getInstance(); + $ns = e107::getRender(); + $sql = e107::getDb(); if (!isset($_GET['f'])) { @@ -703,15 +702,15 @@ class e107ForumThread sendemail(SITEADMINEMAIL, $subject, $report); } // no reference of 'head' $threadInfo['head']['thread_name'] - $e107->sql->db_Insert('generic', "0, 'reported_post', " . time() . ", '" . USERID . "', '{$this->threadInfo['thread_name']}', " . intval($this->threadId) . ", '{$report_add}'"); + $sql->insert('generic', "0, 'reported_post', " . time() . ", '" . USERID . "', '{$this->threadInfo['thread_name']}', " . intval($this->threadId) . ", '{$report_add}'"); define('e_PAGETITLE', LAN_01 . " / " . LAN_428); $url = $e107->url->create('forum/thread/post', array('id' => $postId, 'name' => $postInfo['thread_name'], 'thread' => $threadId)); // both post info and thread info contain thread name $text = LAN_424 . "

" . LAN_429 . ''; - return $e107->ns->tablerender(LAN_414, $text, array('forum_viewtopic', 'report'), true); + return $ns->tablerender(LAN_414, $text, array('forum_viewtopic', 'report'), true); } else { - $thread_name = $e107->tp->toHTML($postInfo['thread_name'], true, 'no_hook, emotes_off'); + $thread_name = e107::getParser()->toHTML($postInfo['thread_name'], true, 'no_hook, emotes_off'); define('e_PAGETITLE', LAN_01 . ' / ' . LAN_426 . ' ' . $thread_name); $url = $e107->url->create('forum/thread/post', array('id' => $postId, 'name' => $postInfo['thread_name'], 'thread' => $threadId)); $actionUrl = $e107->url->create('forum/thread/report', "id={$threadId}&post={$postId}"); @@ -740,7 +739,7 @@ class e107ForumThread "; - return $e107->ns->tablerender(LAN_414, $text, array('forum_viewtopic', 'report2'), true); + return e107::getRender()->tablerender(LAN_414, $text, array('forum_viewtopic', 'report2'), true); } // require_once (FOOTERF); exit; diff --git a/e107_plugins/forum/newforumposts_menu.php b/e107_plugins/forum/newforumposts_menu.php index 7d7541677..885e4497d 100755 --- a/e107_plugins/forum/newforumposts_menu.php +++ b/e107_plugins/forum/newforumposts_menu.php @@ -2,14 +2,10 @@ /* * 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 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * - * - * - * $URL$ - * $Id$ */ if (!defined('e107_INIT')) exit; @@ -17,6 +13,7 @@ if (!defined('e107_INIT')) exit; global $menu_pref; $e107 = e107::getInstance(); +$sql = e107::getDb(); $gen = new convert; include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_newforumposts_menu.php'); @@ -38,9 +35,9 @@ LEFT JOIN `#user` AS u ON u.user_id = p.post_user WHERE {$maxage} p.post_forum IN ({$forumList}) ORDER BY p.post_datestamp DESC LIMIT 0, ".$menu_pref['newforumposts_display']; -if($results = $e107->sql->db_Select_gen($qry)) +if($results = $sql->gen($qry)) { - while($row = $e107->sql->db_Fetch(MYSQL_ASSOC)) + while($row = $sql->fetch(MYSQL_ASSOC)) { $datestamp = $gen->convert_date($row['post_datestamp'], 'short'); $id = $row['thread_id']; @@ -62,8 +59,8 @@ if($results = $e107->sql->db_Select_gen($qry)) } } - $post = strip_tags($e107->tp->toHTML($row['post_entry'], true, 'emotes_off, no_make_clickable', '', $pref['menu_wordwrap'])); - $post = $e107->tp->text_truncate($post, $menu_pref['newforumposts_characters'], $menu_pref['newforumposts_postfix']); + $post = strip_tags(e107::getParser()->toHTML($row['post_entry'], true, 'emotes_off, no_make_clickable', '', $pref['menu_wordwrap'])); + $post = e107::getParser()->text_truncate($post, $menu_pref['newforumposts_characters'], $menu_pref['newforumposts_postfix']); $url = $e107->url->create('forum/thread/last', $row); //TODO legacy bullet is not use here anymore @@ -84,4 +81,4 @@ else { $text = NFP_2; } -$e107->ns->tablerender($menu_pref['newforumposts_caption'], $text, 'nfp_menu'); \ No newline at end of file +e107::getRender()->tablerender($menu_pref['newforumposts_caption'], $text, 'nfp_menu'); \ No newline at end of file diff --git a/e107_plugins/forum/shortcodes/batch/post_shortcodes.php b/e107_plugins/forum/shortcodes/batch/post_shortcodes.php index 6215b6386..a6fd69af1 100644 --- a/e107_plugins/forum/shortcodes/batch/post_shortcodes.php +++ b/e107_plugins/forum/shortcodes/batch/post_shortcodes.php @@ -15,8 +15,9 @@ class plugin_forum_post_shortcodes extends e_shortcode { $parm = ($parm ? $parm : 10); global $LATESTPOSTS_START, $LATESTPOSTS_END, $LATESTPOSTS_POST; + $tp = e107::getParser(); - $txt = $this->e107->tp->parseTemplate($LATESTPOSTS_START, true); + $txt = $tp->parseTemplate($LATESTPOSTS_START, true); $start = max($this->threadInfo['thread_total_replies'] - $parm, 0); $num = min($this->threadInfo['thread_total_replies'], $parm); @@ -26,9 +27,9 @@ class plugin_forum_post_shortcodes extends e_shortcode for($i = count($tmp); $i > 0; $i--) { $bach->setScVar('postInfo', $tmp[$i-1]); - $txt .= $this->e107->tp->parseTemplate($LATESTPOSTS_POST, true); + $txt .= $tp->parseTemplate($LATESTPOSTS_POST, true); } - $txt .= $this->e107->tp->parseTemplate($LATESTPOSTS_END, true); + $txt .= $tp->parseTemplate($LATESTPOSTS_END, true); return $txt; } @@ -37,7 +38,7 @@ class plugin_forum_post_shortcodes extends e_shortcode global $THREADTOPIC_REPLY; $tmp = $this->forum->postGet($this->threadInfo['thread_id'], 0, 1); e107::getScBatch('view', 'forum')->setScVar('postInfo', $tmp[0]); - return $this->e107->tp->parseTemplate($THREADTOPIC_REPLY, true); + return e107::getParser()->parseTemplate($THREADTOPIC_REPLY, true); } function sc_formstart() diff --git a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php index c36b4ea78..37cf0925b 100644 --- a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php +++ b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php @@ -55,7 +55,7 @@ class plugin_forum_view_shortcodes extends e_shortcode function sc_post() { $emote = (isset($this->postInfo['post_options']['no_emote']) ? ',emotes_off' : ''); - return $this->e107->tp->toHTML($this->postInfo['post_entry'], true, 'USER_BODY'.$emote, 'class:'.$this->postInfo['user_class']); + return e107::getParser()->toHTML($this->postInfo['post_entry'], true, 'USER_BODY'.$emote, 'class:'.$this->postInfo['user_class']); } function sc_postdeleted() @@ -108,7 +108,7 @@ class plugin_forum_view_shortcodes extends e_shortcode { if(plugInstalled('pm') && ($this->postInfo['post_user'] > 0)) { - return $this->e107->tp->parseTemplate("{SENDPM={$this->postInfo['post_user']}}"); + return e107::getParser()->parseTemplate("{SENDPM={$this->postInfo['post_user']}}"); } } @@ -164,7 +164,7 @@ class plugin_forum_view_shortcodes extends e_shortcode } else { - return ''.$this->e107->tp->toHTML($this->postInfo['post_user_anon']).''; + return ''.e107::getParser()->toHTML($this->postInfo['post_user_anon']).''; } } @@ -173,7 +173,7 @@ class plugin_forum_view_shortcodes extends e_shortcode { if($this->postInfo['user_name']) { - return (!$this->postInfo['user_hideemail'] ? $this->e107->tp->parseTemplate("{EMAILTO={$this->postInfo['user_email']}}") : ''); + return (!$this->postInfo['user_hideemail'] ? e107::getParser()->parseTemplate("{EMAILTO={$this->postInfo['user_email']}}") : ''); } return ''; @@ -183,7 +183,7 @@ class plugin_forum_view_shortcodes extends e_shortcode { if($this->postInfo['thread_start']) { - return $this->e107->tp->parseTemplate("{EMAIL_ITEM=".FORLAN_101."^plugin:forum.{$this->postInfo['post_thread']}}"); + return e107::getParser()->parseTemplate("{EMAIL_ITEM=".FORLAN_101."^plugin:forum.{$this->postInfo['post_thread']}}"); } } @@ -191,7 +191,7 @@ class plugin_forum_view_shortcodes extends e_shortcode { if($this->postInfo['thread_start']) { - return $this->e107->tp->parseTemplate("{PRINT_ITEM=".FORLAN_102."^plugin:forum.{$this->postInfo['post_thread']}}"); + return e107::getParser()->parseTemplate("{PRINT_ITEM=".FORLAN_102."^plugin:forum.{$this->postInfo['post_thread']}}"); } } @@ -221,7 +221,7 @@ class plugin_forum_view_shortcodes extends e_shortcode { if (USER && $this->postInfo['user_name']) { - return $this->e107->tp->parseTemplate("{PROFILE={$this->postInfo['post_user']}}"); + return e107::getParser()->parseTemplate("{PROFILE={$this->postInfo['post_user']}}"); } } @@ -245,7 +245,7 @@ class plugin_forum_view_shortcodes extends e_shortcode { if ($this->postInfo['user_customtitle']) { - return $this->e107->tp->toHTML($this->postInfo['user_customtitle']).'
'; + return e107::getParser()->toHTML($this->postInfo['user_customtitle']).'
'; } } diff --git a/e107_plugins/list_new/list_admin_class.php b/e107_plugins/list_new/list_admin_class.php index dba89335e..3e4949514 100644 --- a/e107_plugins/list_new/list_admin_class.php +++ b/e107_plugins/list_new/list_admin_class.php @@ -2,17 +2,12 @@ /* * 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 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * * List Admin Class * - * $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/list_admin_class.php,v $ - * $Revision$ - * $Date$ - * $Author$ - * */ if (!defined('e107_INIT')) { exit; } @@ -47,17 +42,19 @@ class list_admin */ function db_update_menu() { + $sql = e107::getDb(); + $tp = e107::getParser(); // Get the preferences so we've got a reference for changes $list_pref = $this->parent->getListPrefs(); $temp = array(); while(list($key, $value) = each($_POST)) { - if($value != LIST_ADMIN_2){ $temp[$this->e107->tp->toDB($key)] = $this->e107->tp->toDB($value); } + if($value != LIST_ADMIN_2){ $temp[$tp->toDB($key)] = $tp->toDB($value); } } if ($this->e107->admin_log->logArrayDiffs($temp, $list_pref, 'LISTNEW_01')) { $tmp = $this->e107->arrayStorage->WriteArray($list_pref); - $this->e107->sql->db_Update("core", "e107_value='{$tmp}' WHERE e107_name='list' "); + $sql->update("core", "e107_value='{$tmp}' WHERE e107_name='list' "); $message = LIST_ADMIN_3; } else @@ -98,7 +95,8 @@ class list_admin */ function parse_global_options($type) { - global $rs, $fl; + global $rs; + $fl = e107::getFile(); $text = ''; @@ -247,7 +245,7 @@ class list_admin for($i=0;$iparent->sections);$i++) { $this->row['FIELD_TITLE'] = $this->parent->titles[$i]; - $this->row['FIELD_ITEM'] = $rs->form_text($this->parent->sections[$i]."_".$type."_caption", 30, $this->e107->tp->toHTML($this->parent->list_pref[$this->parent->sections[$i]."_".$type."_caption"],"","defs"), "50", "tbox"); + $this->row['FIELD_ITEM'] = $rs->form_text($this->parent->sections[$i]."_".$type."_caption", 30, e1007::getParser()->toHTML($this->parent->list_pref[$this->parent->sections[$i]."_".$type."_caption"],"","defs"), "50", "tbox"); $this->row['FIELD'] .= $this->parseTemplate('FIELD_TABLE'); } $this->row['FIELD'] .= $this->parseTemplate('FIELD_TABLE_END'); @@ -268,6 +266,7 @@ class list_admin function parse_menu_options($type) { global $rs; + $tp = e107::getParser(); $this->row['ID'] = "list-new-".str_replace('_', '-', $type); $this->row['TITLE'] = ($type == "new_menu" ? LIST_ADMIN_OPT_5 : LIST_ADMIN_OPT_3); @@ -280,7 +279,7 @@ class list_admin $this->row['HEADING'] = LIST_ADMIN_LAN_3; $this->row['HELP'] = LIST_ADMIN_LAN_4; $this->row['CONTID'] = "list-new-menu-{$type}-expandable-caption"; - $this->row['FIELD'] = $rs->form_text($type."_caption", "30", $this->e107->tp->toHTML($this->parent->list_pref[$type."_caption"],"","defs"), "50", "tbox"); + $this->row['FIELD'] = $rs->form_text($type."_caption", "30", $tp->toHTML($this->parent->list_pref[$type."_caption"],"","defs"), "50", "tbox"); $text .= $this->parseTemplate('TOPIC_ROW'); //menu preference : icon : use @@ -375,6 +374,7 @@ class list_admin function parse_page_options($type) { global $rs; + $tp = e107::getParser(); $display = ($type == "recent_page" ? "display:none;" : ''); @@ -389,7 +389,7 @@ class list_admin $this->row['HEADING'] = LIST_ADMIN_LAN_3; $this->row['HELP'] = LIST_ADMIN_LAN_4; $this->row['CONTID'] = "list-new-page-{$type}-expandable-caption"; - $this->row['FIELD'] = $rs->form_text($type."_caption", "30", $this->e107->tp->toHTML($this->parent->list_pref[$type."_caption"],"","defs"), "50", "tbox"); + $this->row['FIELD'] = $rs->form_text($type."_caption", "30", $tp->toHTML($this->parent->list_pref[$type."_caption"],"","defs"), "50", "tbox"); $text .= $this->parseTemplate('TOPIC_ROW'); //page preference : icon : use @@ -475,7 +475,7 @@ class list_admin $this->row['HEADING'] = LIST_ADMIN_LAN_24; $this->row['HELP'] = LIST_ADMIN_LAN_25; $this->row['CONTID'] = "list-new-page-{$type}-expandable-wtext"; - $this->row['FIELD'] = $rs->form_textarea($type."_welcometext", "50", "5", $this->e107->tp->toHTML($this->parent->list_pref[$type."_welcometext"],"","defs"), "", "tbox"); + $this->row['FIELD'] = $rs->form_textarea($type."_welcometext", "50", "5", $tp->toHTML($this->parent->list_pref[$type."_welcometext"],"","defs"), "", "tbox"); $text .= $this->parseTemplate('TOPIC_ROW'); if($type == "new_page") @@ -542,7 +542,7 @@ class list_admin $frm = e107::getForm(); $this->row['TOPIC'] = LIST_ADMIN_11; - $this->row['FIELD'] = $frm->admin_button('update_menu',LIST_ADMIN_2,'update'); // $rs->form_button("submit", 'update_menu', LIST_ADMIN_2); + $this->row['FIELD'] = $frm->admin_button('update_menu',LIST_ADMIN_2,'update'); return "".$frm->admin_button('update_menu',LIST_ADMIN_2,'update').""; return $this->parseTemplate('TOPIC_ROW_NOEXPAND'); } diff --git a/e107_plugins/list_new/list_shortcodes.php b/e107_plugins/list_new/list_shortcodes.php index 73c1fc055..258ed651d 100644 --- a/e107_plugins/list_new/list_shortcodes.php +++ b/e107_plugins/list_new/list_shortcodes.php @@ -2,17 +2,12 @@ /* * 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 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * * List Shortcodes * - * $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/list_shortcodes.php,v $ - * $Revision$ - * $Date$ - * $Author$ - * */ /** @@ -53,37 +48,37 @@ class list_shortcodes function sc_list_date() { - return $this->e107->tp->toHTML($this->row['date'], true, ""); + return e107::getParser()->toHTML($this->row['date'], true, ""); } function sc_list_icon() { - return $this->e107->tp->toHTML($this->row['icon'], true, ""); + return e107::getParser()->toHTML($this->row['icon'], true, ""); } function sc_list_heading() { - return $this->e107->tp->toHTML($this->row['heading'], true, "TITLE"); + return e107::getParser()->toHTML($this->row['heading'], true, "TITLE"); } function sc_list_author() { - return $this->e107->tp->toHTML($this->row['author'], true, ""); + return e107::getParser()->toHTML($this->row['author'], true, ""); } function sc_list_category() { - return $this->e107->tp->toHTML($this->row['category'], true, ""); + return e107::getParser()->toHTML($this->row['category'], true, ""); } function sc_list_info() { - return $this->e107->tp->toHTML($this->row['info'], true, ""); + return e107::getParser()->toHTML($this->row['info'], true, ""); } function sc_list_caption() { - return $this->e107->tp->toHTML($this->rc->data['caption'], true, ""); + return e107::getParser()->toHTML($this->rc->data['caption'], true, ""); } function sc_list_displaystyle() @@ -99,7 +94,7 @@ class list_shortcodes function sc_list_col_welcometext() { - return $this->e107->tp->toHTML($this->list_pref[$this->rc->mode."_welcometext"], true, ""); + return e107::getParser()->toHTML($this->list_pref[$this->rc->mode."_welcometext"], true, ""); } function sc_list_col_cellwidth() diff --git a/e107_plugins/list_new/section/list_members.php b/e107_plugins/list_new/section/list_members.php index c5630cc53..a51da67e2 100644 --- a/e107_plugins/list_new/section/list_members.php +++ b/e107_plugins/list_new/section/list_members.php @@ -2,17 +2,12 @@ /* * 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 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * * Members e_list Handler * - * $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/section/list_members.php,v $ - * $Revision$ - * $Date$ - * $Author$ - * */ /** @@ -32,6 +27,7 @@ class list_members function getListData() { + $sql = e107::getDb(); $list_caption = $this->parent->settings['caption']; $list_display = ($this->parent->settings['open'] ? "" : "none"); @@ -44,13 +40,13 @@ class list_members $bullet = $this->parent->getBullet($this->parent->settings['icon']); - if(!$this->parent->e107->sql->db_Select_gen("SELECT user_id,user_name,user_join FROM #user WHERE ".$qry)) + if(!$this->parent->$sql->gen("SELECT user_id,user_name,user_join FROM #user WHERE ".$qry)) { $list_data = LIST_MEMBER_2; } else { - while($row = $this->parent->e107->sql->db_Fetch()) + while($row = $this->parent->$sql->fetch()) { $record = array(); $rowheading = $this->parent->parse_heading($row['user_name']); diff --git a/e107_plugins/online/online_shortcodes.php b/e107_plugins/online/online_shortcodes.php index 873fabbb0..30e25ea0d 100644 --- a/e107_plugins/online/online_shortcodes.php +++ b/e107_plugins/online/online_shortcodes.php @@ -51,7 +51,7 @@ class online_shortcodes function sc_online_tracking_disabled() { - return $this->e107->tp->toHTML(LAN_ONLINE_TRACKING_MESSAGE,TRUE); + return e107::getParser()->toHTML(LAN_ONLINE_TRACKING_MESSAGE,TRUE); } @@ -99,7 +99,7 @@ class online_shortcodes if($ret == false) { $newest_member_sql = $this->e107->sql->db_Select('user', 'user_id, user_name', "user_ban='0' ORDER BY user_join DESC LIMIT 1"); - $row = $this->e107->sql->db_Fetch(); + $row = e107::getDb()->fetch(); $ret = "".$row['user_name'].""; $this->e107->ecache->set('online_menu_member_newest', $ret); } diff --git a/e107_plugins/pm/pm.php b/e107_plugins/pm/pm.php index c53e5ee2c..921832554 100755 --- a/e107_plugins/pm/pm.php +++ b/e107_plugins/pm/pm.php @@ -144,7 +144,7 @@ class pm_extended extends private_message $text = "
". - $this->e107->tp->parseTemplate($PM_SEND_PM, TRUE). + e107::getParser()->parseTemplate($PM_SEND_PM, TRUE). '
'; return $text; } @@ -267,7 +267,7 @@ class pm_extended extends private_message $pm_info['pm_read'] = $now; $this->pm_mark_read($pmid, $pm_info); } - $txt = $this->e107->tp->parseTemplate($PM_SHOW, true); + $txt = e107::getParser()->parseTemplate($PM_SHOW, true); $this->e107->ns->tablerender(LAN_PM, $txt); if (!$comeFrom) { @@ -302,21 +302,21 @@ class pm_extended extends private_message $sc->pmBlocks = $pmBlocks; $txt = "
"; - $txt .= $this->e107->tp->parseTemplate($PM_BLOCKED_HEADER, true); + $txt .= e107::getParser()->parseTemplate($PM_BLOCKED_HEADER, true); if($pmTotalBlocked = count($pmBlocks)) { foreach($pmBlocks as $pmBlocked) { $sc->pmBlocked = $pmBlocked; // setScVar('pm_handler_shortcodes','pmBlocked', $pmBlocked); - $txt .= $this->e107->tp->parseTemplate($PM_BLOCKED_TABLE, true); + $txt .= e107::getParser()->parseTemplate($PM_BLOCKED_TABLE, true); } } else { - $txt .= $this->e107->tp->parseTemplate($PM_BLOCKED_EMPTY, true); + $txt .= e107::getParser()->parseTemplate($PM_BLOCKED_EMPTY, true); } - $txt .= $this->e107->tp->parseTemplate($PM_BLOCKED_FOOTER, true); + $txt .= e107::getParser()->parseTemplate($PM_BLOCKED_FOOTER, true); $txt .= '
'; return $txt; } diff --git a/e107_plugins/pm/pm_class.php b/e107_plugins/pm/pm_class.php index 05e0d788b..24ea610a4 100755 --- a/e107_plugins/pm/pm_class.php +++ b/e107_plugins/pm/pm_class.php @@ -540,6 +540,7 @@ class private_message */ function get_users_inclass($class) { + $sql = e107::getDb(); if($class == e_UC_MEMBER) { $qry = "SELECT user_id, user_name, user_email, user_class FROM `#user` WHERE 1"; @@ -550,12 +551,12 @@ class private_message } elseif($class) { - $regex = "(^|,)(".$this->e107->tp->toDB($class).")(,|$)"; + $regex = "(^|,)(".e107::getParser()->toDB($class).")(,|$)"; $qry = "SELECT user_id, user_name, user_email, user_class FROM `#user` WHERE user_class REGEXP '{$regex}'"; } - if($this->e107->sql->db_Select_gen($qry)) + if($sql->gen($qry)) { - $ret = $this->e107->sql->db_getList(); + $ret = $sql->getList(); return $ret; } return FALSE;