From f65708cd5a88b0f3caa7abb0f47da9e39d7d7c98 Mon Sep 17 00:00:00 2001 From: Moc Date: Tue, 26 Mar 2013 12:16:55 +0100 Subject: [PATCH] Code clean-up (global pointers, $e107->, headers). Got rid of all $e107->this->sql and tp --- .../shortcodes/batch/news_shortcodes.php | 25 ++-- e107_handlers/form_handler.php | 10 +- e107_handlers/login.php | 4 +- e107_handlers/mailout_admin_class.php | 120 ++++++++---------- e107_handlers/userclass_class.php | 3 +- .../calendar_menu/calendar_shortcodes.php | 64 ++++------ e107_plugins/calendar_menu/e_cron.php | 4 +- .../calendar_menu/next_event_menu.php | 9 +- e107_plugins/forum/newforumposts_menu.php | 11 +- e107_plugins/list_new/list_class.php | 50 ++++---- e107_plugins/list_new/list_shortcodes.php | 6 +- e107_plugins/newsletter/nl_archive.php | 28 ++-- e107_plugins/online/online_shortcodes.php | 15 +-- e107_plugins/pm/pm.php | 82 +++++------- e107_plugins/pm/pm_class.php | 87 ++++++------- e107_plugins/rss_menu/rss.php | 84 ++++++------ e107_plugins/siteinfo/e_shortcode.php | 13 +- .../tagwords/section/e_tagwords_news.php | 12 +- .../tagwords/section/e_tagwords_page.php | 12 +- e107_plugins/tagwords/tagwords_class.php | 108 ++++++++-------- e107_plugins/tagwords/tagwords_menu.php | 11 +- e107_plugins/tagwords/tagwords_shortcodes.php | 15 +-- 22 files changed, 352 insertions(+), 421 deletions(-) diff --git a/e107_core/shortcodes/batch/news_shortcodes.php b/e107_core/shortcodes/batch/news_shortcodes.php index abee5f233..102b3cd7c 100644 --- a/e107_core/shortcodes/batch/news_shortcodes.php +++ b/e107_core/shortcodes/batch/news_shortcodes.php @@ -37,7 +37,7 @@ class news_shortcodes extends e_shortcode function sc_newstitle() { - return $this->e107->tp->toHTML($this->news_item['news_title'], TRUE, 'TITLE'); + return e107::getParser()->toHTML($this->news_item['news_title'], TRUE, 'TITLE'); } function sc_newsurltitle() @@ -76,7 +76,7 @@ class news_shortcodes extends e_shortcode } else { - return "news_item)."'>".$this->news_item['user_name']."{$parm}"; + return "news_item)."'>".$this->news_item['user_name']."{$parm}"; } } return "e107"; @@ -101,14 +101,14 @@ class news_shortcodes extends e_shortcode if (vartrue($pref['multilanguage'])) { // Can have multilanguage news table, monlingual comment table. If the comment table is multilingual, it'll only count entries in the current language - $news_item['news_comment_total'] = $sql->db_Count("comments", "(*)", "WHERE comment_item_id='".$news_item['news_id']."' AND comment_type='0' "); + $news_item['news_comment_total'] = $sql->count("comments", "(*)", "WHERE comment_item_id='".$news_item['news_id']."' AND comment_type='0' "); } //XXX - ??? - another query? We should cache it in news table. if ($pref['comments_icon'] && $news_item['news_comment_total']) { - $sql->db_Select('comments', 'comment_datestamp', "comment_item_id='".intval($news_item['news_id'])."' AND comment_type='0' ORDER BY comment_datestamp DESC LIMIT 0,1"); - list($comments['comment_datestamp']) = $sql->db_Fetch(); + $sql->select('comments', 'comment_datestamp', "comment_item_id='".intval($news_item['news_id'])."' AND comment_type='0' ORDER BY comment_datestamp DESC LIMIT 0,1"); + list($comments['comment_datestamp']) = $sql->fetch(); $latest_comment = $comments['comment_datestamp']; if ($latest_comment > USERLV ) { @@ -145,7 +145,7 @@ class news_shortcodes extends e_shortcode function sc_newscategory($parm) { $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.""; + return "param['catlink'] : "#")."' href='".e107::getUrl()->create('news/list/category', $this->news_item)."'>".$category_name.""; } function sc_newsdate($parm) @@ -244,7 +244,7 @@ class news_shortcodes extends e_shortcode } else { - return $es1."news_item)."'>".EXTENDEDSTRING."".$es2; + return $es1."news_item)."'>".EXTENDEDSTRING."".$es2; } } return ''; @@ -313,7 +313,7 @@ class news_shortcodes extends e_shortcode break; default: - return "news_item)."'>"; + return "news_item)."'>"; break; } } @@ -349,7 +349,7 @@ class news_shortcodes extends e_shortcode case 'url': default: - return "news_item)."'>"; + return "news_item)."'>"; break; } } @@ -362,7 +362,7 @@ class news_shortcodes extends e_shortcode function sc_newstitlelink($parm = '') { parse_str($parm, $parms); - $url = $this->e107->url->create('news/view/item', $this->news_item); + $url = e107::getUrl()->create('news/view/item', $this->news_item); if(isset($parms['href'])) { return $url; @@ -372,7 +372,7 @@ class news_shortcodes extends e_shortcode function sc_newsurl() { - return $this->e107->url->create('news/view/item', $this->news_item); + return e107::getUrl()->create('news/view/item', $this->news_item); } function sc_newscaticon($parm = '') @@ -409,7 +409,7 @@ class news_shortcodes extends e_shortcode case 'url': default: - return "news_item)."'>"; + return "news_item)."'>"; break; } } @@ -463,6 +463,5 @@ class news_shortcodes extends e_shortcode return implode(", ",$words); } - } ?> \ No newline at end of file diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 80252c389..114f45ff0 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -292,7 +292,7 @@ class e_form $ret .= "
- ".(!$ajax ? $e107->tp->parseTemplate('{ICONPICKER='.$sc_parameters.'}') : '')." + ".(!$ajax ? $tp->parseTemplate('{ICONPICKER='.$sc_parameters.'}') : '')."
"; @@ -2216,10 +2216,10 @@ class e_form } if(false === $cls || check_class($cls)) { - /* + /* $value .= " ".LAN_EDIT.""; - */ + */ $value .= " ".ADMIN_EDIT_ICON.""; @@ -3277,9 +3277,9 @@ class e_form } else // No Tabs Present - { + { $text .= $this->renderCreateFieldset($elid, $data, $model, false); - $text .= $this->renderCreateButtonsBar($elid, $data, $model, false); // Create/Update Buttons etc. + $text .= $this->renderCreateButtonsBar($elid, $data, $model, false); // Create/Update Buttons etc. } diff --git a/e107_handlers/login.php b/e107_handlers/login.php index ba9cbee46..2d26bf8d1 100644 --- a/e107_handlers/login.php +++ b/e107_handlers/login.php @@ -204,7 +204,7 @@ class userlogin if (($this->passResult !== FALSE) && ($this->passResult !== PASSWORD_VALID)) { // May want to rewrite password using salted hash (or whatever the preferred method is) - $pass_result has the value to write // If login by email address also allowed, will have to write that value too -// $this->e107->sql->db_Update('user',"`user_password` = '{$pass_result}' WHERE `user_id`=".intval($this->userData['user_id'])); +// $sql->update('user',"`user_password` = '{$pass_result}' WHERE `user_id`=".intval($this->userData['user_id'])); } @@ -290,7 +290,7 @@ class userlogin $fp = str_replace(e_HTTP, '', $fp); // This handles sites in a subdirectory properly (normally, will replace nothing) $fp = SITEURL.$fp; } - //$redir = ((strpos($fp, 'http') === FALSE) ? SITEURL : '').$this->e107->tp->replaceConstants($fp, TRUE, FALSE); + //$redir = ((strpos($fp, 'http') === FALSE) ? SITEURL : '').$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); } diff --git a/e107_handlers/mailout_admin_class.php b/e107_handlers/mailout_admin_class.php index d5f390b82..51908cf3f 100644 --- a/e107_handlers/mailout_admin_class.php +++ b/e107_handlers/mailout_admin_class.php @@ -8,9 +8,6 @@ * * Mailout - admin-related functions * - * $URL$ - * $Id$ - * */ /** @@ -18,7 +15,6 @@ * * @package e107 * @subpackage e107_handlers - * @version $Id: mailout_admin_class.php 12775 2012-06-01 08:09:14Z e107coders $; */ @@ -112,41 +108,41 @@ class mailoutAdminClass extends e107MailManager // Array of info associated with each task we might do protected $tasks = array( - 'makemail' => array('title' => LAN_MAILOUT_190, 'defaultSort' => '', 'defaultTable' => ''), - 'saved' => array('title' => LAN_MAILOUT_191, 'defaultSort' => 'mail_source_id', 'defaultTable' => 'mail_content'), - 'marksend' => array('title' => 'Internal: marksend', 'defaultSort' => 'mail_source_id', 'defaultTable' => 'mail_content'), - 'sent' => array('title' => LAN_MAILOUT_192, 'defaultSort' => 'mail_source_id', 'defaultTable' => 'mail_content'), - 'pending' => array('title' => LAN_MAILOUT_193, 'defaultSort' => 'mail_source_id', 'defaultTable' => 'mail_content'), - 'held' => array('title' => LAN_MAILOUT_194, 'defaultSort' => 'mail_source_id', 'defaultTable' => 'mail_content'), + 'makemail' => array('title' => LAN_MAILOUT_190, 'defaultSort' => '', 'defaultTable' => ''), + 'saved' => array('title' => LAN_MAILOUT_191, 'defaultSort' => 'mail_source_id', 'defaultTable' => 'mail_content'), + 'marksend' => array('title' => 'Internal: marksend', 'defaultSort' => 'mail_source_id', 'defaultTable' => 'mail_content'), + 'sent' => array('title' => LAN_MAILOUT_192, 'defaultSort' => 'mail_source_id', 'defaultTable' => 'mail_content'), + 'pending' => array('title' => LAN_MAILOUT_193, 'defaultSort' => 'mail_source_id', 'defaultTable' => 'mail_content'), + 'held' => array('title' => LAN_MAILOUT_194, 'defaultSort' => 'mail_source_id', 'defaultTable' => 'mail_content'), 'recipients' => array('title' => LAN_MAILOUT_173, 'defaultSort' => 'mail_recipient_email', 'defaultTable' => 'mail_recipients'), 'mailtargets' => array('title' => LAN_MAILOUT_173, 'defaultSort' => 'mail_recipient_email', 'defaultTable' => 'mail_recipients'), - 'prefs' => array('title' => ADLAN_40, 'defaultSort' => '', 'defaultTable' => ''), - 'maint' => array('title' => ADLAN_40, 'defaultSort' => '', 'defaultTable' => '') + 'prefs' => array('title' => ADLAN_40, 'defaultSort' => '', 'defaultTable' => ''), + 'maint' => array('title' => ADLAN_40, 'defaultSort' => '', 'defaultTable' => '') ); // Options for mail listing dropdown - actions apertaining to a stored email protected $modeOptions = array( 'saved' => array( - 'mailedit' => LAN_MAILOUT_163, - 'maildelete' => LAN_DELETE, + 'mailedit' => LAN_MAILOUT_163, + 'maildelete' => LAN_DELETE, 'mailshowtemplate' => LAN_MAILOUT_254 ), 'pending' => array( 'mailsendimmediately' => "Send Immediately", - 'mailhold' => LAN_MAILOUT_159, - 'mailcancel' => LAN_MAILOUT_160, - 'mailtargets' => LAN_MAILOUT_181 + 'mailhold' => LAN_MAILOUT_159, + 'mailcancel' => LAN_MAILOUT_160, + 'mailtargets' => LAN_MAILOUT_181 ), 'held' => array( - 'mailsendnow' => LAN_MAILOUT_158, - 'mailcancel' => LAN_MAILOUT_160, - 'mailtargets' => LAN_MAILOUT_181 + 'mailsendnow' => LAN_MAILOUT_158, + 'mailcancel' => LAN_MAILOUT_160, + 'mailtargets' => LAN_MAILOUT_181 ), 'sent' => array( - 'mailcopy' => LAN_MAILOUT_251, - 'maildelete' => LAN_DELETE, - 'mailtargets' => LAN_MAILOUT_181 + 'mailcopy' => LAN_MAILOUT_251, + 'maildelete' => LAN_DELETE, + 'mailtargets' => LAN_MAILOUT_181 ), 'recipients' => array( 'mailonedelete' => LAN_DELETE @@ -156,9 +152,9 @@ class mailoutAdminClass extends e107MailManager // List of fields to be included in email display for various options protected $mailDetailDisplay = array( - 'basic' => array('mail_source_id' => 1, 'mail_title' => 1, 'mail_subject' => 1, 'mail_body' => 200), - 'send' => array('mail_source_id' => 1, 'mail_title' => 1, 'mail_subject' => 1, 'mail_body' => 500, 'mail_send_style' => 1), - 'template' => array('mail_source_id' => 1, 'mail_title' => 1, 'mail_subject' => 1, 'mail_body' => 200, 'mail_body_templated' => 'chars'), + 'basic' => array('mail_source_id' => 1, 'mail_title' => 1, 'mail_subject' => 1, 'mail_body' => 200), + 'send' => array('mail_source_id' => 1, 'mail_title' => 1, 'mail_subject' => 1, 'mail_body' => 500, 'mail_send_style' => 1), + 'template' => array('mail_source_id' => 1, 'mail_title' => 1, 'mail_subject' => 1, 'mail_body' => 200, 'mail_body_templated' => 'chars'), ); @@ -191,7 +187,7 @@ class mailoutAdminClass extends e107MailManager } if (isset($_GET['fld'])) { - $temp = $this->e107->tp->toDB($_GET['fld']); + $temp = e107::getParser()->toDB($_GET['fld']); if (is_array($this->fields[$dbTable][$temp])) { $this->sortField = $temp; @@ -199,7 +195,7 @@ class mailoutAdminClass extends e107MailManager } if (isset($_GET['asc'])) { - $temp = strtolower($this->e107->tp->toDB($_GET['asc'])); + $temp = strtolower(e107::getParser()->toDB($_GET['asc'])); if (($temp == 'asc') || ($temp == 'desc')) { $this->sortOrder = $temp; @@ -209,7 +205,6 @@ class mailoutAdminClass extends e107MailManager } - /** * Set up new mode * @@ -319,8 +314,6 @@ class mailoutAdminClass extends e107MailManager } } - - /** * Get the user name associated with a user ID. * The result is cached in case required again @@ -335,9 +328,9 @@ class mailoutAdminClass extends e107MailManager { // Look up user $this->checkDB(2); // Make sure DB object created - if ($this->db2->db_Select('user','user_name, user_loginname', 'user_id='.intval($uid))) + if ($this->db2->select('user','user_name, user_loginname', 'user_id='.intval($uid))) { - $row = $this->db2->db_Fetch(MYSQL_ASSOC); + $row = $this->db2->fetch(MYSQL_ASSOC); $this->userCache[$uid] = $row['user_name'].' ('.$row['user_loginname'].')'; } else @@ -349,9 +342,6 @@ class mailoutAdminClass extends e107MailManager } - - - /** * Generate the HTML for displaying actions box for emails * @@ -581,8 +571,8 @@ class mailoutAdminClass extends e107MailManager GROUP BY uc.userclass_id "; - $this->db2->db_Select_gen($query); - while ($row = $this->db2->db_Fetch()) + $this->db2->gen($query); + while ($row = $this->db2->fetch()) { $public = ($row['userclass_editclass'] == e_UC_PUBLIC)? "(".LAN_MAILOUT_10.")" : ""; $selected = ($row['userclass_id'] == $curSel) ? " selected='selected'" : ''; @@ -678,10 +668,10 @@ class mailoutAdminClass extends e107MailManager $errList[] = LAN_MAILOUT_201; return $errList; } - if (!trim($email['mail_subject'])) $errList[] = LAN_MAILOUT_200; - if (!trim($email['mail_body'])) $errList[] = LAN_MAILOUT_202; - if (!trim($email['mail_sender_name'])) $errList[] = LAN_MAILOUT_203; - if (!trim($email['mail_sender_email'])) $errList[] = LAN_MAILOUT_204; + if (!trim($email['mail_subject'])) $errList[] = LAN_MAILOUT_200; + if (!trim($email['mail_body'])) $errList[] = LAN_MAILOUT_202; + if (!trim($email['mail_sender_name'])) $errList[] = LAN_MAILOUT_203; + if (!trim($email['mail_sender_email'])) $errList[] = LAN_MAILOUT_204; if (strlen($email['mail_send_style']) == 0) { // Can be a template name now $errList[] = LAN_MAILOUT_205; @@ -722,7 +712,6 @@ class mailoutAdminClass extends e107MailManager } - /** * Generate a table which shows some information about an email. * Intended to be part of a 2-column table - includes the row detail, but not the surrounding table definitions @@ -761,7 +750,7 @@ class mailoutAdminClass extends e107MailManager $text .= $gen->convert_date($val, 'short'); break; case 'trunc200' : - $text .= $this->e107->tp->text_truncate($val, 200, '...'); + $text .= e107::getParser()->text_truncate($val, 200, '...'); break; case 'chars' : // Show generated html as is $text .= htmlspecialchars($val, ENT_COMPAT, 'UTF-8'); @@ -836,12 +825,12 @@ class mailoutAdminClass extends e107MailManager global $HANDLERS_DIRECTORY; global $mailAdmin; - $sql = e107::getDb(); - $ns = e107::getRender(); - $tp = e107::getParser(); - $frm = e107::getForm(); - $mes = e107::getMessage(); - $pref = e107::getPref(); + $sql = e107::getDb(); + $ns = e107::getRender(); + $tp = e107::getParser(); + $frm = e107::getForm(); + $mes = e107::getMessage(); + $pref = e107::getPref(); if (!is_array($mailSource)) { @@ -1014,8 +1003,6 @@ class mailoutAdminClass extends e107MailManager } - - /** * Helper function manages the shortcodes which can be inserted */ @@ -1032,9 +1019,9 @@ class mailoutAdminClass extends e107MailManager $sc = array( '|DISPLAYNAME|' => LAN_MAILOUT_14, - '|USERNAME|' => LAN_MAILOUT_16, + '|USERNAME|' => LAN_MAILOUT_16, '|SIGNUP_LINK|' => LAN_MAILOUT_17, - '|USERID|' => LAN_MAILOUT_18, + '|USERID|' => LAN_MAILOUT_18, '|USERLASTVISIT|' => LAN_MAILOUT_178 ); @@ -1081,8 +1068,8 @@ class mailoutAdminClass extends e107MailManager */ public function showEmailTemplate($mailId) { - $mes = e107::getMessage(); - $ns = e107::getRender(); + $mes = e107::getMessage(); + $ns = e107::getRender(); $mailData = $this->retrieveEmail($mailId); @@ -1117,8 +1104,6 @@ class mailoutAdminClass extends e107MailManager } - - /** * Show a screen to confirm deletion of an email * @@ -1282,8 +1267,6 @@ class mailoutAdminClass extends e107MailManager } - - /** * Generate a list of emails to send * Returns various information to display in a confirmation screen @@ -1499,7 +1482,8 @@ class mailoutAdminClass extends e107MailManager $gen = new convert; $frm = e107::getForm(); $mes = e107::getMessage(); - $tp = e107::getRender(); + $tp = e107::getParser(); + $ns = e107::getRender(); $mailData = $this->retrieveEmail($mailID); @@ -1572,7 +1556,7 @@ class mailoutAdminClass extends e107MailManager $text .= $gen->convert_date($row[$fieldName], 'short'); break; case 'trunc200' : - $text .= $this->e107->tp->text_truncate($row[$fieldName], 200, '...'); + $text .= $tp->text_truncate($row[$fieldName], 200, '...'); break; case 'chars' : // Show generated html as is $text .= htmlspecialchars($row[$fieldName], ENT_COMPAT, 'UTF-8'); @@ -1652,7 +1636,7 @@ class mailoutAdminClass extends e107MailManager { if ($res) $results[] = str_replace(array('--COUNT--', '--TABLE--'), array($res, 'mail_content'), LAN_MAILOUT_227); } - if (($res = $this->db2->db_Delete('mail_recipients', '`mail_status` = '.MAIL_STATUS_TEMP)) === FALSE) + if (($res = $this->db2->delete('mail_recipients', '`mail_status` = '.MAIL_STATUS_TEMP)) === FALSE) { $results[] = 'Error '.$this->db2->mySQLlastErrNum.':'.$this->db2->mySQLlastErrText.' deleting temporary records from mail_recipients'; $noError = FALSE; @@ -1663,7 +1647,7 @@ class mailoutAdminClass extends e107MailManager } // Now look for 'orphaned' recipient records - if (($res = $this->db2->db_Select_gen("DELETE `#mail_recipients` FROM `#mail_recipients` + if (($res = $this->db2->gen("DELETE `#mail_recipients` FROM `#mail_recipients` LEFT JOIN `#mail_content` ON `#mail_recipients`.`mail_detail_id` = `#mail_content`.`mail_source_id` WHERE `#mail_content`.`mail_source_id` IS NULL")) === FALSE) { @@ -1676,7 +1660,7 @@ class mailoutAdminClass extends e107MailManager } // Scan content table for anomalies, out of time records - if (($res = $this->db2->db_Select_gen("SELECT * FROM `#mail_content` + if (($res = $this->db2->gen("SELECT * FROM `#mail_content` WHERE (`mail_content_status` >".MAIL_STATUS_FAILED.") AND (`mail_content_status` <=".MAIL_STATUS_MAX_ACTIVE.") AND ((`mail_togo_count`=0) OR ( (`mail_last_date` != 0) AND (`mail_last_date` < ".time().")))")) === FALSE) { @@ -1686,7 +1670,7 @@ class mailoutAdminClass extends e107MailManager else { $items = array(); // Store record number of any content record that needs to be changed - while ($row = $this->db2->db_Fetch(MYSQL_ASSOC)) + while ($row = $this->db2->fetch(MYSQL_ASSOC)) { $items[] = $row['mail_source_id']; if ($row['mail_source_id']) @@ -1722,7 +1706,7 @@ class mailoutAdminClass extends e107MailManager $notLast = TRUE; // This forces one more loop, so we can clean up for last record read $changeCount = 0; $saveRow = array(); - while (($row = $this->db2->db_Fetch(MYSQL_ASSOC)) || $notLast) + while (($row = $this->db2->fetch(MYSQL_ASSOC)) || $notLast) { if (($lastMail > 0 && $row === FALSE) || ($lastMail != $row['mail_source_id'])) { // Change of mail ID here - handle any accumulated info @@ -1740,7 +1724,7 @@ class mailoutAdminClass extends e107MailManager { // *************** Update mail record here ********************* $this->checkDB(1); - $this->db->db_Update('mail_content', array('data' => $changes, 'WHERE' => '`mail_source_id` = '.$lastMail, '_FIELDS' => $this->dbTypes['mail_content'])); + $this->db->update('mail_content', array('data' => $changes, 'WHERE' => '`mail_source_id` = '.$lastMail, '_FIELDS' => $this->dbTypes['mail_content'])); $line = "Count update for {$saveRow['mail_source_id']} - {$saveRow['mail_togo_count']}, {$saveRow['mail_sent_count']}, {$saveRow['mail_fail_count']}, {$saveRow['mail_bounce_count']} => "; $line .= implode (', ', $counters); $results[] = $line; diff --git a/e107_handlers/userclass_class.php b/e107_handlers/userclass_class.php index c0da45fc3..975d3b25a 100644 --- a/e107_handlers/userclass_class.php +++ b/e107_handlers/userclass_class.php @@ -1678,13 +1678,12 @@ class user_class_admin extends user_class { $newarray = array_diff(explode(',', $curclass), array('', $cid)); $new_userclass = implode(',', $newarray); - $uc_sql->db_Update('user', "user_class='".$e107->tp->toDB($new_userclass, true)."' WHERE user_id=".intval($uid)); + $uc_sql->update('user', "user_class='".e107::getParser()->toDB($new_userclass, true)."' WHERE user_id=".intval($uid)); } } - /** * Check class data record for a fixed class - certain fields have constraints on their values. * updates any values which are unacceptable. diff --git a/e107_plugins/calendar_menu/calendar_shortcodes.php b/e107_plugins/calendar_menu/calendar_shortcodes.php index 743c11f15..4d0d0c7d4 100644 --- a/e107_plugins/calendar_menu/calendar_shortcodes.php +++ b/e107_plugins/calendar_menu/calendar_shortcodes.php @@ -8,11 +8,6 @@ * * Shortcodes for event calendar * - * $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/calendar_shortcodes.php,v $ - * $Revision$ - * $Date$ - * $Author$ - * */ /** @@ -22,7 +17,6 @@ * * @package e107_plugins * @subpackage event_calendar - * @version $Id$; */ /* @@ -204,7 +198,7 @@ class event_calendar_shortcodes private $prop; // Start date for new event entry private $ds = ''; // Display type for some shortcodes (mostly event listing) - private $ourDB; // For when we need a DB object + //private $ourDB; // For when we need a DB object public function __construct() @@ -369,17 +363,19 @@ class event_calendar_shortcodes // Categories listing public function sc_ec_nav_categories($parm = '') { - if ($this->ourDB == NULL) + /*if ($this->ourDB == NULL) { - $this->ourDB = new db; // @todo use new method + $this->ourDB = new db; // @todo use new method - Moc: done, check if functional. } + */ + $sql = e107::getDb(); ($parm == 'nosubmit') ? $insert = '' : $insert = "onchange='this.form.submit()'"; $ret = " +
"; } } else // Show requested newsletter { - $e107->sql->db_Select('newsletter', '*', "newsletter_parent='".$action_parent_id."' AND newsletter_id='".$action_nl_id."' AND newsletter_flag='1'"); - if ($row = $e107->sql->db_Fetch()) + $sql->select('newsletter', '*', "newsletter_parent='".$action_parent_id."' AND newsletter_id='".$action_nl_id."' AND newsletter_flag='1'"); + if ($row = $sql->fetch()) { // Display parent header $text .= "$parent_newsletter_title
@@ -129,7 +125,7 @@ else // Display parent footer $text .= "$parent_newsletter_footer
"; // Display back to newsletter overview button - $text .= "
"; + $text .= "
"; } else { diff --git a/e107_plugins/online/online_shortcodes.php b/e107_plugins/online/online_shortcodes.php index 30e25ea0d..cc8b32c43 100644 --- a/e107_plugins/online/online_shortcodes.php +++ b/e107_plugins/online/online_shortcodes.php @@ -2,16 +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) * - * e107 Main + * Online shortcodes * - * $Source: /cvs_backup/e107_0.8/e107_plugins/online/online_shortcodes.php,v $ - * $Revision$ - * $Date$ - * $Author$ */ if (!defined('e107_INIT')) { exit; } @@ -86,7 +82,7 @@ class online_shortcodes $total_members = $this->e107->ecache->retrieve("online_menu_member_total", 120); if($total_members == false) { - $total_members = $this->e107->sql->db_Count('user','(*)',"where user_ban='0'"); + $total_members = e107::getDb()->count('user','(*)',"where user_ban='0'"); $this->e107->ecache->set("online_menu_member_total", $total_members); } return $total_members; @@ -95,11 +91,12 @@ class online_shortcodes function sc_online_member_newest() { + $sql = e107::getDb(); $ret = $this->e107->ecache->retrieve('online_menu_member_newest', 120); 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 = e107::getDb()->fetch(); + $newest_member_sql = $sql->select('user', 'user_id, user_name', "user_ban='0' ORDER BY user_join DESC LIMIT 1"); + $row = $sql->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 921832554..a94a369d0 100755 --- a/e107_plugins/pm/pm.php +++ b/e107_plugins/pm/pm.php @@ -2,16 +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) * * PM plugin - main user interface * - * $Source: /cvs_backup/e107_0.8/e107_plugins/pm/pm.php,v $ - * $Revision$ - * $Date$ - * $Author$ */ @@ -20,7 +16,6 @@ * * @package e107_plugins * @subpackage pm - * @version $Id$; */ @@ -34,15 +29,12 @@ if (!e107::isInstalled('pm')) exit; } - - if(vartrue($_POST['keyword'])) { pm_user_lookup(); } - require_once(e_PLUGIN.'pm/pm_class.php'); require_once(e_PLUGIN.'pm/pm_func.php'); include_lan(e_PLUGIN.'pm/languages/'.e_LANGUAGE.'.php'); @@ -83,9 +75,6 @@ $pmManager = new pmbox_manager($pm_prefs); - - - class pm_extended extends private_message { protected $pmManager = NULL; @@ -122,9 +111,9 @@ class pm_extended extends private_message if($to_uid) { $sql2 = new db; - if($sql2->db_Select('user', 'user_name', 'user_id = '.intval($to_uid))) + if($sql2->select('user', 'user_name', 'user_id = '.intval($to_uid))) { - $row=$sql2->db_Fetch(); + $row = $sql2->fetch(); $pm_info['from_name'] = $row['user_name']; } } @@ -196,8 +185,6 @@ class pm_extended extends private_message } - - /** * Show outbox * @param int $start - offset into list @@ -239,7 +226,6 @@ class pm_extended extends private_message } - /** * Show details of a pm * @param int $pmid - DB ID for PM @@ -249,44 +235,50 @@ class pm_extended extends private_message */ function show_pm($pmid, $comeFrom = '') { + $ns = e107::getRender(); + $tpl_file = THEME.'pm_template.php'; include_once(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/pm_template.php'); $pm_info = $this->pm_get($pmid); + // setScVar('pm_handler_shortcodes','pmInfo', $pm_info); $sc = e107::getScBatch('pm',TRUE); $sc->setVars($pm_info); + if($pm_info['pm_to'] != USERID && $pm_info['pm_from'] != USERID) { - $this->e107->ns->tablerender(LAN_PM, LAN_PM_60); + $ns->tablerender(LAN_PM, LAN_PM_60); require_once(FOOTERF); exit; } + if($pm_info['pm_read'] == 0 && $pm_info['pm_to'] == USERID) { // Inbox $now = time(); $pm_info['pm_read'] = $now; $this->pm_mark_read($pmid, $pm_info); } + $txt = e107::getParser()->parseTemplate($PM_SHOW, true); - $this->e107->ns->tablerender(LAN_PM, $txt); + $ns->tablerender(LAN_PM, $txt); + if (!$comeFrom) { if ($pm_info['pm_from'] == USERID) { $comeFrom = 'outbox'; } } + // Need to show inbox or outbox from start if ($comeFrom == 'outbox') { // Show Outbox - $this->e107->ns->tablerender(LAN_PM." - ".LAN_PM_26, $this->show_outbox(), 'PM'); + $ns->tablerender(LAN_PM." - ".LAN_PM_26, $this->show_outbox(), 'PM'); } else { // Show Inbox - $this->e107->ns->tablerender(LAN_PM.' - '.LAN_PM_25, $this->show_inbox(), 'PM'); + $ns->tablerender(LAN_PM.' - '.LAN_PM_25, $this->show_inbox(), 'PM'); } } - - /** * Show list of blocked users * @param int $start - not used at present; offset into list @@ -295,36 +287,35 @@ class pm_extended extends private_message */ public function showBlocked($start = 0) { + $tp = e107::getParser(); $tpl_file = THEME.'pm_template.php'; include(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/pm_template.php'); $pmBlocks = $this->block_get_user(); // TODO - handle pagination, maybe (is it likely to be necessary?) + $sc = e107::getScBatch('pm',TRUE); $sc->pmBlocks = $pmBlocks; $txt = "
"; - $txt .= e107::getParser()->parseTemplate($PM_BLOCKED_HEADER, true); + $txt .= $tp->parseTemplate($PM_BLOCKED_HEADER, true); if($pmTotalBlocked = count($pmBlocks)) { foreach($pmBlocks as $pmBlocked) { $sc->pmBlocked = $pmBlocked; // setScVar('pm_handler_shortcodes','pmBlocked', $pmBlocked); - $txt .= e107::getParser()->parseTemplate($PM_BLOCKED_TABLE, true); + $txt .= $tp->parseTemplate($PM_BLOCKED_TABLE, true); } } else { - $txt .= e107::getParser()->parseTemplate($PM_BLOCKED_EMPTY, true); + $txt .= $tp->parseTemplate($PM_BLOCKED_EMPTY, true); } - $txt .= e107::getParser()->parseTemplate($PM_BLOCKED_FOOTER, true); + $txt .= $tp->parseTemplate($PM_BLOCKED_FOOTER, true); $txt .= '
'; return $txt; } - - - /** * Send a PM based on $_POST parameters * @@ -333,8 +324,7 @@ class pm_extended extends private_message function post_pm() { // print_a($_POST); - - + if(!check_class($this->pmPrefs['pm_class'])) { return LAN_PM_12; @@ -382,7 +372,7 @@ class pm_extended extends private_message { if($to_info = $this->pm_getuid($to)) { // Check whether sender is blocked - if so, add one to count - if(!$this->e107->sql->db_Update('private_msg_block',"pm_block_count=pm_block_count+1 WHERE pm_block_from = '".USERID."' AND pm_block_to = '".$tp -> toDB($to)."'")) + if(!e107::getDb()->update('private_msg_block',"pm_block_count=pm_block_count+1 WHERE pm_block_from = '".USERID."' AND pm_block_to = '".$tp->toDB($to)."'")) { $_POST['to_array'][] = $to_info; } @@ -400,7 +390,7 @@ class pm_extended extends private_message return LAN_PM_17; } - if($this->e107->sql->db_Update('private_msg_block',"pm_block_count=pm_block_count+1 WHERE pm_block_from = '".USERID."' AND pm_block_to = '{$to_info['user_id']}'")) + if(e107::getDb()->update('private_msg_block',"pm_block_count=pm_block_count+1 WHERE pm_block_from = '".USERID."' AND pm_block_to = '{$to_info['user_id']}'")) { return LAN_PM_18.$to_info['user_name']; } @@ -480,10 +470,10 @@ function pm_user_lookup() $sql = e107::getDb(); $query = "SELECT * FROM #user WHERE user_name REGEXP '^".$_POST['keyword']."' "; - if($sql -> db_Select_gen($query)) + if($sql->gen($query)) { echo '['; - while($row = $sql-> db_Fetch()) + while($row = $sql->fetch()) { $u[] = "{\"caption\":\"".$row['user_name']."\",\"value\":".$row['user_id']."}"; } @@ -497,8 +487,6 @@ function pm_user_lookup() - - //$pm =& new private_message; $pm = new pm_extended($pm_prefs, &$pmManager); @@ -532,7 +520,7 @@ if($unread_timeout > 0) if(count($del_qry) > 0) { $qry = implode(' OR ', $del_qry).' AND (pm_from = '.USERID.' OR pm_to = '.USERID.')'; - if($sql->db_Select('private_msg', 'pm_id', $qry)) + if($sql->select('private_msg', 'pm_id', $qry)) { $delList = $sql->db_getList(); foreach($delList as $p) @@ -543,7 +531,6 @@ if(count($del_qry) > 0) } - if('del' == $action || isset($_POST['pm_delete_selected'])) { if(isset($_POST['pm_delete_selected'])) @@ -578,7 +565,6 @@ if('del' == $action || isset($_POST['pm_delete_selected'])) } - if('delblocked' == $action || isset($_POST['pm_delete_blocked_selected'])) { if(isset($_POST['pm_delete_blocked_selected'])) @@ -606,6 +592,7 @@ if('block' == $action) $pm_proc_id = 0; } + if('unblock' == $action) { $message = $pm->block_del($pm_proc_id); @@ -613,6 +600,7 @@ if('unblock' == $action) $pm_proc_id = 0; } + if('get' == $action) { $pm->send_file($pm_proc_id, intval($qs[2])); @@ -631,15 +619,12 @@ if(isset($_POST['postpm'])) $mes = e107::getMessage(); if($message != '') -{ - +{ $mes->add($message); - // $ns->tablerender('', "
". $message."
"); } - //----------------------------------------- // DISPLAY TASKS //----------------------------------------- @@ -688,11 +673,4 @@ switch ($action) require_once(FOOTERF); exit; - - - - - - - ?> \ No newline at end of file diff --git a/e107_plugins/pm/pm_class.php b/e107_plugins/pm/pm_class.php index 24ea610a4..0073caaf8 100755 --- a/e107_plugins/pm/pm_class.php +++ b/e107_plugins/pm/pm_class.php @@ -2,14 +2,12 @@ /* * e107 website system * - * Copyright (C) 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) * * PM plugin - base class API * - * $URL$ - * $Id$ */ @@ -18,7 +16,6 @@ * * @package e107_plugins * @subpackage pm - * @version $Id$; */ if (!defined('e107_INIT')) { exit; } @@ -28,7 +25,6 @@ class private_message protected $e107; protected $pmPrefs; - /** * Constructor * @@ -38,9 +34,7 @@ class private_message public function __construct($prefs) { $this->e107 = e107::getInstance(); - $this->pmPrefs = $prefs; - } - + $this->pmPrefs = $prefs; } /** @@ -63,7 +57,7 @@ class private_message } else { - $this->e107->sql->db_Select_gen("UPDATE `#private_msg` SET `pm_read` = {$now} WHERE `pm_id`=".intval($pm_id)); + e107::getDb()->gen("UPDATE `#private_msg` SET `pm_read` = {$now} WHERE `pm_id`=".intval($pm_id)); // TODO does this work properly? if(strpos($pm_info['pm_option'], '+rr') !== FALSE) { $this->pm_send_receipt($pm_info); @@ -87,9 +81,9 @@ class private_message LEFT JOIN #user AS uf ON uf.user_id = pm.pm_from WHERE pm.pm_id='".intval($pmid)."' "; - if ($this->e107->sql->db_Select_gen($qry)) + if (e107::getDb()->gen($qry)) { - $row = $this->e107->sql->db_Fetch(); + $row = e107::getDb()->fetch(); return $row; } return FALSE; @@ -114,7 +108,8 @@ class private_message */ function add($vars) { - $tp = $this->e107->tp; + $tp = e107::getParser(); + $sql = e107::getDb(); $pmsize = 0; $attachlist = ''; $pm_options = ''; @@ -208,7 +203,7 @@ class private_message $pmInfo['to_array'] = $targets[$i]; // Should be in exactly the right format $genInfo['gen_intdata'] = count($targets[$i]); $genInfo['gen_chardata'] = $array->WriteArray($pmInfo,TRUE); - $this->e107->sql->db_Insert('generic', array('data' => $genInfo, '_FIELD_TYPES' => array('gen_chardata' => 'string'))); // Don't want any of the clever sanitising now + $sql->insert('generic', array('data' => $genInfo, '_FIELD_TYPES' => array('gen_chardata' => 'string'))); // Don't want any of the clever sanitising now } $toclass .= ' ['.$totalSend.']'; $tolist = $targets[count($targets) - 1]; // Send the residue now (means user probably isn't kept hanging around too long if sending lots) @@ -219,7 +214,7 @@ class private_message set_time_limit(30); $info['pm_to'] = intval($u['user_id']); // Sending to a single user now - if($pmid = $this->e107->sql->db_Insert('private_msg', $info)) + if($pmid = $sql->insert('private_msg', $info)) { if($class == FALSE) { @@ -241,7 +236,7 @@ class private_message $info['pm_to'] = $toclass; // Class info to put into outbox $info['pm_sent_del'] = 0; $info['pm_read_del'] = 1; - if(!$pmid = $this->e107->sql->db_Insert('private_msg', $info)) + if(!$pmid = $sql->insert('private_msg', $info)) { $ret .= LAN_PM_41.'
'; } @@ -251,7 +246,7 @@ class private_message else { // Sending to a single person $info['pm_to'] = intval($vars['to_info']['user_id']); // Sending to a single user now - if($pmid = $this->e107->sql->db_Insert('private_msg', $info)) + if($pmid = $sql->insert('private_msg', $info)) { if(check_class($this->pmPrefs['notify_class'], $vars['to_info']['user_class'])) { @@ -277,12 +272,13 @@ class private_message */ function del($pmid, $force = FALSE) { + $sql = e107::getDb(); $pmid = (int)$pmid; $ret = ''; $newvals = ''; - if($this->e107->sql->db_Select('private_msg', '*', 'pm_id = '.$pmid.' AND (pm_from = '.USERID.' OR pm_to = '.USERID.')')) + if($sql->select('private_msg', '*', 'pm_id = '.$pmid.' AND (pm_from = '.USERID.' OR pm_to = '.USERID.')')) { - $row = $this->e107->sql->db_Fetch(); + $row = $sql->fetch(); if (!$force && ($row['pm_to'] == USERID)) { $newvals = 'pm_read_del = 1'; @@ -315,11 +311,11 @@ class private_message { $ret .= str_replace(array('--GOOD--', '--FAIL--'), $aCount, LAN_PM_71).'
'; } - $this->e107->sql->db_Delete('private_msg', 'pm_id = '.$pmid); + $sq->delete('private_msg', 'pm_id = '.$pmid); } else { - $this->e107->sql->db_Update('private_msg', $newvals.' WHERE pm_id = '.$pmid); + $sql->update('private_msg', $newvals.' WHERE pm_id = '.$pmid); } return $ret; } @@ -332,7 +328,7 @@ class private_message public function url($action, $params = array(), $options = array()) { if(strpos($action, '/') === false) $action = 'view/'.$action; - $this->e107->url->create('pm/'.$action, $params, $options); + e107::getUrl()->create('pm/'.$action, $params, $options); } /** @@ -391,11 +387,12 @@ class private_message */ function block_get($to = USERID) { + $sql = e107::getDb(); $ret = array(); $to = intval($to); // Precautionary - if ($this->e107->sql->db_Select('private_msg_block', 'pm_block_from', 'pm_block_to = '.$to)) + if ($sql->select('private_msg_block', 'pm_block_from', 'pm_block_to = '.$to)) { - while($row = $this->e107->sql->db_Fetch(MYSQL_ASSOC)) + while($row = $sql->fetch(MYSQL_ASSOC)) { $ret[] = $row['pm_block_from']; } @@ -413,11 +410,12 @@ class private_message */ function block_get_user($to = USERID) { + $sql = e107::getDb(); $ret = array(); $to = intval($to); // Precautionary - if ($this->e107->sql->db_Select_gen('SELECT pm.*, u.user_name FROM `#private_msg_block` AS pm LEFT JOIN `#user` AS u ON `pm`.`pm_block_from` = `u`.`user_id` WHERE pm_block_to = '.$to)) + if ($sql->gen('SELECT pm.*, u.user_name FROM `#private_msg_block` AS pm LEFT JOIN `#user` AS u ON `pm`.`pm_block_from` = `u`.`user_id` WHERE pm_block_to = '.$to)) { - while($row = $this->e107->sql->db_Fetch(MYSQL_ASSOC)) + while($row = $sql->fetch(MYSQL_ASSOC)) { $ret[] = $row; } @@ -436,18 +434,19 @@ class private_message */ function block_add($from, $to = USERID) { + $sql = e107::getDb(); $from = intval($from); - if($this->e107->sql->db_Select('user', 'user_name, user_perms', 'user_id = '.$from)) + if($sql->select('user', 'user_name, user_perms', 'user_id = '.$from)) { - $uinfo = $this->e107->sql->db_Fetch(); + $uinfo = $sql->fetch(); if (($uinfo['user_perms'] == '0') || ($uinfo['user_perms'] == '0.')) { // Don't allow block of main admin return LAN_PM_64; } - if(!$this->e107->sql->db_Count('private_msg_block', '(*)', 'WHERE pm_block_from = '.$from." AND pm_block_to = '".$this->e107->tp->toDB($to)."'")) + if(!$sql->count('private_msg_block', '(*)', 'WHERE pm_block_from = '.$from." AND pm_block_to = '".e107::getParser()->toDB($to)."'")) { - if($this->e107->sql->db_Insert('private_msg_block', array( + if($sql->insert('private_msg_block', array( 'pm_block_from' => $from, 'pm_block_to' => $to, 'pm_block_datestamp' => time() @@ -483,14 +482,15 @@ class private_message */ function block_del($from, $to = USERID) { + $sql = e107::getDb(); $from = intval($from); - if($this->e107->sql->db_Select('user', 'user_name', 'user_id = '.$from)) + if($sql->select('user', 'user_name', 'user_id = '.$from)) { - $uinfo = $this->e107->sql->db_Fetch(); - if($this->e107->sql->db_Select('private_msg_block', 'pm_block_id', 'pm_block_from = '.$from.' AND pm_block_to = '.intval($to))) + $uinfo = $sql->fetch(); + if($sql->select('private_msg_block', 'pm_block_id', 'pm_block_from = '.$from.' AND pm_block_to = '.intval($to))) { - $row = $this->e107->sql->db_Fetch(); - if($this->e107->sql->db_Delete('private_msg_block', 'pm_block_id = '.intval($row['pm_block_id']))) + $row = $sql->fetch(); + if($sql->delete('private_msg_block', 'pm_block_id = '.intval($row['pm_block_id']))) { return str_replace('{UNAME}', $uinfo['user_name'], LAN_PM_44); } @@ -520,11 +520,12 @@ class private_message */ function pm_getuid($var) { + $sql = e107::getDb(); $var = strip_if_magic($var); $var = str_replace("'", ''', trim($var)); // Display name uses entities for apostrophe - if($this->e107->sql->db_Select('user', 'user_id, user_name, user_class, user_email', "user_name LIKE '".$this->e107->sql -> escape($var, FALSE)."'")) + if($sql->select('user', 'user_id, user_name, user_class, user_email', "user_name LIKE '".$sql->escape($var, FALSE)."'")) { - $row = $this->e107->sql->db_Fetch(); + $row = $sql->fetch(); return $row; } return FALSE; @@ -556,7 +557,7 @@ class private_message } if($sql->gen($qry)) { - $ret = $sql->getList(); + $ret = $sql->db_getList(); return $ret; } return FALSE; @@ -574,6 +575,7 @@ class private_message */ function pm_get_inbox($uid = USERID, $from = 0, $limit = 10) { + $sql = e107::getDb(); $ret = array(); $total_messages = 0; $uid = intval($uid); @@ -587,10 +589,10 @@ class private_message ORDER BY pm.pm_sent DESC LIMIT ".$from.", ".$limit." "; - if($this->e107->sql->db_Select_gen($qry)) + if($sql->gen($qry)) { - $total_messages = $this->e107->sql->total_results; // Total number of messages - $ret['messages'] = $this->e107->sql->db_getList(); + $total_messages = $sql->total_results; // Total number of messages + $ret['messages'] = $sql->db_getList(); } $ret['total_messages'] = $total_messages; // Should always be defined return $ret; @@ -609,7 +611,6 @@ class private_message function pm_get_outbox($uid = USERID, $from = 0, $limit = 10) { $sql = e107::getDb(); - $ret = array(); $total_messages = 0; $uid = intval($uid); @@ -623,7 +624,7 @@ class private_message ORDER BY pm.pm_sent DESC LIMIT ".$from.', '.$limit; - if($sql->db_Select_gen($qry)) + if($sql->gen($qry)) { $total_messages = $sql->total_results; // Total number of messages $ret['messages'] = $sql->db_getList(); @@ -706,4 +707,4 @@ class private_message fclose($res); } } -} +} \ No newline at end of file diff --git a/e107_plugins/rss_menu/rss.php b/e107_plugins/rss_menu/rss.php index 2ec404e92..0c7f301e2 100644 --- a/e107_plugins/rss_menu/rss.php +++ b/e107_plugins/rss_menu/rss.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) * * RSS Feed management * -* $URL$ -* $Id$ -* */ /* @@ -31,6 +28,7 @@ if (!$e107->isInstalled('rss_menu')) exit; } +$tp = e107::getParser(); require_once(e_PLUGIN.'rss_menu/rss_shortcodes.php'); require_once(e_HANDLER.'userclass_class.php'); @@ -61,9 +59,9 @@ else if (e_QUERY) { $tmp = explode('.', e_QUERY); - $content_type = $e107->tp->toDB($tmp[0]); + $content_type = $tp->toDB($tmp[0]); $rss_type = intval(varset($tmp[1],0)); - $topic_id = $e107->tp->toDB($tmp[2],''); + $topic_id = $tp->toDB($tmp[2],''); } // List available rss feeds @@ -72,16 +70,16 @@ if (!$rss_type) require_once(HEADERF); // require_once(e_PLUGIN.'rss_menu/rss_template.php'); Already loaded - if(!$sql->db_Select('rss', '*', "`rss_class`=0 AND `rss_limit`>0 AND `rss_topicid` NOT REGEXP ('\\\*') ORDER BY `rss_name`")) + if(!$sql->select('rss', '*', "`rss_class`=0 AND `rss_limit`>0 AND `rss_topicid` NOT REGEXP ('\\\*') ORDER BY `rss_name`")) { $ns->tablerender(LAN_ERROR, RSS_LAN_ERROR_4); } else { $text = $RSS_LIST_HEADER; - while($row=$sql->db_Fetch()) + while($row = $sql->fetch()) { - $text .= $e107->tp->parseTemplate($RSS_LIST_TABLE, FALSE, $rss_shortcodes); + $text .= $tp->parseTemplate($RSS_LIST_TABLE, FALSE, $rss_shortcodes); } $text .= $RSS_LIST_FOOTER; $ns->tablerender(RSS_MENU_L2, $text); @@ -111,10 +109,10 @@ if(is_numeric($content_type) && isset($conversion[$content_type]) ) $check_topic = ($topic_id ? " AND rss_topicid = '".$topic_id."' " : ""); -if(!$sql -> db_Select('rss', '*', "rss_class!=2 AND rss_url='".$content_type."' ".$check_topic." AND rss_limit>0 ")) +if(!$sql->select('rss', '*', "rss_class!=2 AND rss_url='".$content_type."' ".$check_topic." AND rss_limit>0 ")) { // Check if wildcard present for topic_id $check_topic = ($topic_id ? " AND rss_topicid = '".str_replace($topic_id, "*", $topic_id)."' " : ""); - if(!$sql -> db_Select('rss', '*', "rss_class!=2 AND rss_url='".$content_type."' ".$check_topic." AND rss_limit>0 ")) + if(!$sql->select('rss', '*', "rss_class!=2 AND rss_url='".$content_type."' ".$check_topic." AND rss_limit>0 ")) { require_once(HEADERF); $ns->tablerender('', RSS_LAN_ERROR_1); @@ -123,12 +121,12 @@ if(!$sql -> db_Select('rss', '*', "rss_class!=2 AND rss_url='".$content_type."' } else { - $row = $sql->db_Fetch(); + $row = $sql->fetch(); } } else { - $row = $sql->db_Fetch(); + $row = $sql->fetch(); } @@ -212,7 +210,7 @@ class rssCreate LEFT JOIN #user AS u ON n.news_author = u.user_id LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id WHERE n.news_class IN (".USERCLASS_LIST.") AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") {$render} {$topic} ORDER BY n.news_datestamp DESC LIMIT 0,".$this -> limit; - $sql->db_Select_gen($this -> rssQuery); + $sql->gen($this->rssQuery); $tmp = $sql->db_getList(); $this -> rssItems = array(); $loop=0; @@ -262,7 +260,7 @@ class rssCreate case 5: $path=''; $this -> rssQuery = "SELECT * FROM `#comments` WHERE `comment_blocked` = 0 ORDER BY `comment_datestamp` DESC LIMIT 0,".$this -> limit; - $sql->db_Select_gen($this -> rssQuery); + $sql->gen($this -> rssQuery); $tmp = $sql->db_getList(); $this -> rssItems = array(); $loop=0; @@ -409,9 +407,9 @@ class rssCreate - ".$this->e107->tp->toRss($rss_title)." + ".$tp->toRss($rss_title)." ".$pref['siteurl']." - ".$this->e107->tp->toRss($pref['sitedescription'])." + ".$tp->toRss($pref['sitedescription'])." ".$itemdate = date("r", ($time + $this -> offset))." http://backend.userland.com/rss092\n"; @@ -421,11 +419,11 @@ class rssCreate echo " - ".$this->e107->tp->toRss($value['title'])." - ".substr($this->e107->tp->toRss($value['description']),0,150); + ".$tp->toRss($value['title'])." + ".substr($tp->toRss($value['description']),0,150); if($pref['rss_shownewsimage'] == 1 && strlen(trim($value['news_thumbnail'])) > 0) { - $news_thumbnail = SITEURLBASE.e_IMAGE_ABS."newspost_images/".$this->e107->tp->toRss($value['news_thumbnail']); + $news_thumbnail = SITEURLBASE.e_IMAGE_ABS."newspost_images/".$tp->toRss($value['news_thumbnail']); echo "<a href="".$link.""><img src="".$news_thumbnail."" height="50" border="0" hspace="10" vspace="10" align="right"></a>"; unset($news_thumbail); } @@ -451,14 +449,14 @@ class rssCreate xmlns:sy=\"http://purl.org/rss/1.0/modules/syndication/\" > - ".$this->e107->tp->toRss($rss_title)." + ".$tp->toRss($rss_title)." ".$pref['siteurl']." - ".$this->e107->tp->toRss($pref['sitedescription'])."\n"; + ".$tp->toRss($pref['sitedescription'])."\n"; - echo $this->e107->tp->toHtml($rss_custom_channel,FALSE)."\n"; // must not convert to CDATA. + echo $tp->toHtml($rss_custom_channel,FALSE)."\n"; // must not convert to CDATA. echo "".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")." - ".$this->e107->tp->toRss(SITEDISCLAIMER)." + ".$tp->toRss(SITEDISCLAIMER)." ".$this->nospam($pref['siteadminemail'])." (".$pref['siteadmin'].") ".$this->nospam($pref['siteadminemail'])." (".$pref['siteadmin'].") ".date("r",($time + $this -> offset))." @@ -475,12 +473,12 @@ class rssCreate { echo " - ".$this->e107->tp->toRss($rss_title)." + ".$tp->toRss($rss_title)." ".(strstr(SITEBUTTON, "http:")!==FALSE ? SITEBUTTON : SITEURL.str_replace("../", "",SITEBUTTON))." ".$pref['siteurl']." 88 31 - ".$this->e107->tp->toRss($pref['sitedescription'])." + ".$tp->toRss($pref['sitedescription'])." \n"; } @@ -489,7 +487,7 @@ class rssCreate echo " Search - Search ".$this->e107->tp->toRss($pref['sitename'])." + Search ".$tp->toRss($pref['sitename'])." query ".SITEURL.(substr(SITEURL, -1) == "/" ? "" : "/")."search.php "; @@ -502,17 +500,17 @@ class rssCreate echo " - ".$this->e107->tp->toRss($value['title'])."\n"; + ".$tp->toRss($value['title'])."\n"; if($link) { echo "".$link."\n"; } - echo "".$this->e107->tp->toRss($value['description'],TRUE); + echo "".$tp->toRss($value['description'],TRUE); if($pref['rss_shownewsimage'] == 1 && strlen(trim($value['news_thumbnail'])) > 0) //FIXME - Fixed path and height? { - $news_thumbnail = SITEURLBASE.e_IMAGE_ABS."newspost_images/".$this->e107->tp->toRss($value['news_thumbnail']); + $news_thumbnail = SITEURLBASE.e_IMAGE_ABS."newspost_images/".$tp->toRss($value['news_thumbnail']); echo "<a href="".$link.""><img src="".$news_thumbnail."" height="50" border="0" hspace="10" vspace="10" align="right"></a>"; unset($news_thumbail); } @@ -525,7 +523,7 @@ class rssCreate if($value['category_name'] && $catlink) { - echo "".$this->e107->tp->toRss($value['category_name'])."\n"; + echo "".$tp->toRss($value['category_name'])."\n"; } if($value['comment']) @@ -573,9 +571,9 @@ class rssCreate - ".$this->e107->tp->toRss($rss_title)." + ".$tp->toRss($rss_title)." ".$pref['siteurl']." - ".$this->e107->tp->toRss($pref['sitedescription'])." + ".$tp->toRss($pref['sitedescription'])." ".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")." ".$this->get_iso_8601_date($time + $this -> offset). " ".$this->nospam($pref['siteadminemail'])." @@ -608,15 +606,15 @@ class rssCreate echo " - ".$this->e107->tp->toRss($value['title'])." + ".$tp->toRss($value['title'])." ".$link." ".$this->get_iso_8601_date($time + $this -> offset)." ".$value['author']." - ".$this->e107->tp->toRss($value['category_name'])." - ".$this->e107->tp->toRss($value['description']); + ".$tp->toRss($value['category_name'])." + ".$tp->toRss($value['description']); if($pref['rss_shownewsimage'] == 1 && strlen(trim($value['news_thumbnail'])) > 0) { - $news_thumbnail = SITEURLBASE.e_IMAGE_ABS."newspost_images/".$this->e107->tp->toRss($value['news_thumbnail']); + $news_thumbnail = SITEURLBASE.e_IMAGE_ABS."newspost_images/".$tp->toRss($value['news_thumbnail']); echo "<a href="".$link.""><img src="".$news_thumbnail."" height="50" border="0" hspace="10" vspace="10" align="right"></a>"; unset($news_thumbail); } @@ -640,7 +638,7 @@ class rssCreate // Required echo " ".$pref['siteurl']."\n - ".$this->e107->tp->toRss($rss_title)."\n + ".$tp->toRss($rss_title)."\n ".$this->get_iso_8601_date($time + $this -> offset)."\n"; // Recommended @@ -676,7 +674,7 @@ class rssCreate // Required echo " ".$value['link']."\n - ".$this->e107->tp->toRss($value['title'])."\n + ".$tp->toRss($value['title'])."\n ".$this->get_iso_8601_date($value['pubdate'] + $this -> offset)."\n"; // Recommended @@ -691,10 +689,10 @@ class rssCreate //complete story here\n echo " \n - ".$this->e107->tp->toRss($value['description']); + ".$tp->toRss($value['description']); if($pref['rss_shownewsimage'] == 1 && strlen(trim($value['news_thumbnail'])) > 0) { - $news_thumbnail = SITEURLBASE.e_IMAGE_ABS."newspost_images/".$this->e107->tp->toRss($value['news_thumbnail']); + $news_thumbnail = SITEURLBASE.e_IMAGE_ABS."newspost_images/".$tp->toRss($value['news_thumbnail']); echo "<a href="".$value['link'].""><img src="".$news_thumbnail."" height="50" border="0" hspace="10" vspace="10" align="right"></a>"; unset($news_thumbail); } @@ -702,7 +700,7 @@ class rssCreate // Optional if($value['category_name']){ - echo "\n"; + echo "\n"; } // // Jane Doe @@ -745,4 +743,4 @@ class rssCreate $tmp = explode("@",$text); return ($tmp[0] != "") ? $tmp[0].RSS_LAN_2 : RSS_LAN_3; } -} // End class rssCreate +} // End class rssCreate \ No newline at end of file diff --git a/e107_plugins/siteinfo/e_shortcode.php b/e107_plugins/siteinfo/e_shortcode.php index 9f87ebf00..f1d4d96ae 100644 --- a/e107_plugins/siteinfo/e_shortcode.php +++ b/e107_plugins/siteinfo/e_shortcode.php @@ -1,7 +1,6 @@ tp->replaceConstants($_POST['sitebutton']) : (strstr(SITEBUTTON, 'http:') ? SITEBUTTON : e_IMAGE.SITEBUTTON); + $path = ($_POST['sitebutton'] && $_POST['ajax_used']) ? e107::getParser()->replaceConstants($_POST['sitebutton']) : (strstr(SITEBUTTON, 'http:') ? SITEBUTTON : e_IMAGE.SITEBUTTON); //TODO use CSS class? return ''.SITENAME.''; } function sc_sitedisclaimer() { - $e107 = e107::getInstance(); - return $e107->tp->toHtml(SITEDISCLAIMER, true, 'constants defs'); + return e107::getParser()->toHtml(SITEDISCLAIMER, true, 'constants defs'); } function sc_sitename($parm) @@ -69,7 +66,7 @@ class siteinfo_shortcodes // must match the folder name of the plugin. } else { - + if(vartrue($logopref) && is_readable($logop)) { $logo = $tp->replaceConstants($logopref,'abs'); @@ -90,7 +87,7 @@ class siteinfo_shortcodes // must match the folder name of the plugin. $logo = e_IMAGE_ABS.'logo.png'; // HTML path $path = e_IMAGE.'logo.png'; // PHP path } - + } //TODO Parm for resizing the logo image with thumb.php diff --git a/e107_plugins/tagwords/section/e_tagwords_news.php b/e107_plugins/tagwords/section/e_tagwords_news.php index f924a0580..a3346df11 100644 --- a/e107_plugins/tagwords/section/e_tagwords_news.php +++ b/e107_plugins/tagwords/section/e_tagwords_news.php @@ -1,7 +1,6 @@ row['news_id']; $url = e107::getUrl()->create('news/view/item', $this->row); - return "".$this->e107->tp->toHTML($this->row['news_title'], TRUE, '').""; + return "".e107::getParser()->toHTML($this->row['news_title'], TRUE, '').""; } function getRecord($id) { + $sql = e107::getDb(); $this->row = ''; + //FIXME - only if news mod rewrite is on $qry = "SELECT n.*, nc.* FROM #news as n @@ -44,12 +45,11 @@ class e_tagwords_news AND (n.news_end=0 || n.news_end>".time().") AND n.news_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; } } - ?> \ No newline at end of file diff --git a/e107_plugins/tagwords/section/e_tagwords_page.php b/e107_plugins/tagwords/section/e_tagwords_page.php index c5a7c9026..5ab689e6a 100644 --- a/e107_plugins/tagwords/section/e_tagwords_page.php +++ b/e107_plugins/tagwords/section/e_tagwords_page.php @@ -1,10 +1,10 @@ row['page_id']; $url = e107::getUrl()->create('page/view', $this->row, 'allow=page_id,page_title,page_sef'); - return "".$this->e107->tp->toHTML($this->row['page_title'], TRUE, '').""; + return "".e107::getParser()->toHTML($this->row['page_title'], TRUE, '').""; } function getRecord($id) { + $sql = e107::getDb(); $this->row = ''; $qry = "SELECT p.*, u.user_id, u.user_name FROM #page AS p LEFT JOIN #user AS u ON p.page_author = u.user_id WHERE p.page_id='{$id}' AND p.page_class IN (".USERCLASS_LIST.") "; - 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; } } - ?> \ No newline at end of file diff --git a/e107_plugins/tagwords/tagwords_class.php b/e107_plugins/tagwords/tagwords_class.php index 5e53a5f2d..eb619c929 100644 --- a/e107_plugins/tagwords/tagwords_class.php +++ b/e107_plugins/tagwords/tagwords_class.php @@ -2,15 +2,12 @@ /* * e107 website system * - * Copyright (C) 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) * * Tagwords Class * - * $URL$ - * $Id$ - * */ if(!defined("TAG_TEXTAREA_COLS")){ define("TAG_TEXTAREA_COLS", "70"); } @@ -141,6 +138,7 @@ class tagwords */ function tagwords_form($tag_type='', $tag_itemid='') { + $tp = e107::getParser(); $allowed = $this->getAllowedAreas(); if(count($allowed)==0) { @@ -157,10 +155,10 @@ class tagwords $this->word = false; if( $ret = $this->getRecords($tag_type, $tag_itemid) ) { - $this->word = $this->e107->tp->toForm($ret); + $this->word = $tp->toForm($ret); } - $caption = $this->e107->tp->parseTemplate($this->template['caption'], true, $this->shortcodes); - $text = $this->e107->tp->parseTemplate($this->template['form'], true, $this->shortcodes); + $caption = $tp->parseTemplate($this->template['caption'], true, $this->shortcodes); + $text = $tp->parseTemplate($this->template['form'], true, $this->shortcodes); return array('caption'=>$caption, 'html'=>$text); } @@ -174,18 +172,19 @@ class tagwords */ function getRecords($tag_type='', $tag_itemid='', $returnwordsonly=false, $link=true) { + $tp = e107::getParser(); $sqlgr = new db; $qry = " SELECT tag_word FROM #".$this->table." - WHERE tag_type='".$this->e107->tp->toDB($tag_type)."' + WHERE tag_type='".$tp->toDB($tag_type)."' AND tag_itemid='".intval($tag_itemid)."' ORDER BY tag_word "; - if($sqlgr->db_Select_gen($qry)) + if($sqlgr->gen($qry)) { $ret=array(); - while($row=$sqlgr->db_Fetch()) + while($row = $sqlgr->fetch()) { $ret[] = $row['tag_word']; } @@ -194,7 +193,7 @@ class tagwords $arr = array(); foreach($ret as $word) { - $word = $this->e107->tp->toHTML($word,true,'no_hook, emotes_off'); + $word = $tp->toHTML($word,true,'no_hook, emotes_off'); $arr[] = ($link ? trim($this->createTagWordLink($word)) : $word); } return implode($this->pref['tagwords_word_seperator'], $arr); @@ -270,10 +269,10 @@ class tagwords function createTagWordLink($word, $class='') { $word = trim($word); - /*$qry = $this->e107->tp->toDB($word); + /*$qry = $tp->toDB($word); $qry = str_replace(' ', '+', $qry);*/ $url = e107::getUrl()->create('tagwords/search', 'q='.$word); - $word = $this->e107->tp->toHTML($word,true,'no_hook, emotes_off'); + $word = e107::getParser()->toHTML($word,true,'no_hook, emotes_off'); $class = ($class ? "class='tag".intval($class)."'" : ""); return "".$word.""; } @@ -287,8 +286,10 @@ class tagwords */ function dbTagWords($tag_type='', $tag_itemid='', $tag_word='') { + $tp = e107::getParser(); + $sql = e107::getDb(); //prepare data - $tag_type = $this->e107->tp->toDB($tag_type); + $tag_type = $tp->toDB($tag_type); $tag_itemid = intval($tag_itemid); //get existing word records @@ -303,8 +304,8 @@ class tagwords foreach($delete_diff as $word) { $word = trim($word); - $word = $this->e107->tp->toDB($word); - $this->e107->sql->db_Delete($this->table, "tag_type='".$tag_type."' AND tag_itemid='".$tag_itemid."' AND tag_word='".$word."'"); + $word = $tp->toDB($word); + $sql->delete($this->table, "tag_type='".$tag_type."' AND tag_itemid='".$tag_itemid."' AND tag_word='".$word."'"); } //insert the differences (insert what has been added) @@ -312,13 +313,13 @@ class tagwords foreach($insert_diff as $word) { $word = trim($word); - $word = $this->e107->tp->toDB($word); + $word = $tp->toDB($word); $args = array(); $args['tag_id'] = 0; $args['tag_type'] = $tag_type; $args['tag_itemid'] = $tag_itemid; $args['tag_word'] = $word; - $this->e107->sql->db_Insert($this->table, $args); + $sql->insert($this->table, $args); } return "
".LAN_TAG_3; } @@ -330,7 +331,7 @@ class tagwords */ function dbDelete($tag_type='', $tag_itemid='') { - $this->e107->sql->db_Delete($this->table, "tag_type='".$tag_type."' AND tag_itemid='".$tag_itemid."' "); + e107::getDb()->delete($this->table, "tag_type='".$tag_type."' AND tag_itemid='".$tag_itemid."' "); } /* @@ -340,6 +341,7 @@ class tagwords */ function getAllTagWords($tagarea='') { + $sql = e107::getDb(); $tag_type=''; $allowed = $this->getAllowedAreas(); @@ -382,13 +384,13 @@ class tagwords WHERE tag_word!='' ".$typeqry." GROUP BY tag_word HAVING COUNT(tag_word)>=".intval($this->pref['tagwords_min'])." ".$menuqry." "; - if($this->e107->sql->db_Select_gen($qry)) + if($sql->gen($qry)) { $ret=array(); - while($row=$this->e107->sql->db_Fetch()) + while($row = $sql->fetch()) { $word = trim($row['tag_word']); - $word = $this->e107->tp->toHTML($word,true,'no_hook, emotes_off'); + $word = e107::getParser()->toHTML($word,true,'no_hook, emotes_off'); $ret[$word] = $row['number']; } return $ret; @@ -503,7 +505,7 @@ class tagwords break; case 'ns': default: - $this->e107->ns->tablerender($caption, "
".$message."
"); + e107::getRender()->tablerender($caption, "
".$message."
"); break; } } @@ -515,6 +517,7 @@ class tagwords */ function TagRender() { + $tp = e107::getParser(); $type = false; //decide whether to show the taglist or the tagcloud @@ -545,13 +548,13 @@ class tagwords //show the taglist or tagcloud if($type=='list') { - $text = $this->e107->tp->parseTemplate($this->template['cloudlist'], true, $this->shortcodes); - $this->e107->ns->tablerender(LAN_TAG_17, $text); + $text = $tp->parseTemplate($this->template['cloudlist'], true, $this->shortcodes); + e107::getRender()->tablerender(LAN_TAG_17, $text); } else { - $text = $this->e107->tp->parseTemplate($this->template['cloud'], true, $this->shortcodes); - $this->e107->ns->tablerender(LAN_TAG_16, $text); + $text = $tp->parseTemplate($this->template['cloud'], true, $this->shortcodes); + e107::getRender()->tablerender(LAN_TAG_16, $text); } return; } @@ -564,16 +567,17 @@ class tagwords */ function getRecordsByTag($word='') { + $sql = e107::getDb(); $typeqry = ''; $allowed = $this->getAllowedAreas(); if(count($allowed)>0) { $typeqry = " AND tag_type IN ('".implode("','", $allowed)."') "; } - if($this->e107->sql->db_Select_gen("SELECT tag_type, tag_itemid FROM #".$this->table." WHERE tag_word REGEXP('".$this->e107->tp->toDB($word)."') ".$typeqry." ")) + if($sql->gen("SELECT tag_type, tag_itemid FROM #".$this->table." WHERE tag_word REGEXP('".e107::getParser()->toDB($word)."') ".$typeqry." ")) { $ret = array(); - while($row=$this->e107->sql->db_Fetch()) + while($row = $sql->fetch()) { $ret[$row['tag_type']][] = $row['tag_itemid']; } @@ -588,6 +592,7 @@ class tagwords */ function TagSearchResults() { + $tp = e107::getParser(); global $row; //the full search query + every single word in the query will be used to search @@ -630,7 +635,7 @@ class tagwords $this->num = count($records, 1) - count($records); - $text = $this->e107->tp->parseTemplate($this->template['intro'], true, $this->shortcodes); + $text = $tp->parseTemplate($this->template['intro'], true, $this->shortcodes); foreach($records as $type=>$ids) { @@ -641,7 +646,7 @@ class tagwords $this->area = $this->$ins; //area (news, content, ...) - $text .= $this->e107->tp->parseTemplate($this->template['area'], true, $this->shortcodes); + $text .= $tp->parseTemplate($this->template['area'], true, $this->shortcodes); //records for found related tagword $text .= $this->template['link_start']; @@ -651,13 +656,13 @@ class tagwords if(method_exists($this->area, 'getRecord')) { $this->area->getRecord($this->id); - $text .= $this->e107->tp->parseTemplate($this->template['link_item'], true, $this->shortcodes); + $text .= $tp->parseTemplate($this->template['link_item'], true, $this->shortcodes); } } $text .= $this->template['link_end']; } } - $this->e107->ns->tablerender(LAN_TAG_1, $text); + e107::getRender()->tablerender(LAN_TAG_1, $text); return; } @@ -715,7 +720,7 @@ class tagwords $class = ceil($min_size + (($value - $min_qty) * $step)); $this->word = $this->createTagWordLink($key, $class); $this->number = $value; - $text .= $this->e107->tp->parseTemplate($t_item, true, $this->shortcodes); + $text .= e107::getParser()->parseTemplate($t_item, true, $this->shortcodes); } $text .= $t_end; return $text; @@ -739,7 +744,7 @@ class tagwords { $this->word = $this->createTagWordLink($key); $this->number = $value; - $text .= $this->e107->tp->parseTemplate($this->template['cloudlist_item'], true, $this->shortcodes); + $text .= e107::getParser()->parseTemplate($this->template['cloudlist_item'], true, $this->shortcodes); } $text .= $this->template['cloudlist_end']; return $text; @@ -785,15 +790,16 @@ class tagwords */ function get_prefs() { - $num_rows = $this->e107->sql->db_Select_gen("SELECT * FROM #core WHERE e107_name='".$this->table."' "); + $sql = e107::getDb(); + $num_rows = $sql->gen("SELECT * FROM #core WHERE e107_name='".$this->table."' "); if($num_rows == 0) { $p = $this->default_prefs(); $tmp = $this->e107->arrayStorage->WriteArray($p); - $this->e107->sql->db_Insert("core", "'".$this->table."', '{$tmp}' "); - $this->e107->sql->db_Select_gen("SELECT * FROM #core WHERE e107_name='".$this->table."' "); + $sql->insert("core", "'".$this->table."', '{$tmp}' "); + $sql->gen("SELECT * FROM #core WHERE e107_name='".$this->table."' "); } - $row = $this->e107->sql->db_Fetch(); + $row = $sql->fetch(); $p = $this->e107->arrayStorage->ReadArray($row['e107_value']); //validation @@ -810,23 +816,24 @@ class tagwords */ function update_prefs() { - $num_rows = $this->e107->sql->db_Select_gen("SELECT * FROM #core WHERE e107_name='".$this->table."' "); + $sql = e107::getDb(); + $num_rows = $sql->gen("SELECT * FROM #core WHERE e107_name='".$this->table."' "); if ($num_rows == 0) { $p = $this->default_prefs(); $tmp = $this->e107->arrayStorage->WriteArray($p); - $this->e107->sql->db_Insert("core", "'".$this->table."', '{$tmp}' "); + $sql->insert("core", "'".$this->table."', '{$tmp}' "); } else { - $row = $this->e107->sql->db_Fetch(); + $row = $sql->fetch(); //assign new preferences foreach($_POST as $k => $v) { if(preg_match("#^tagwords_#",$k)) { - $tagwords_pref[$k] = $this->e107->tp->toDB($v); + $tagwords_pref[$k] = e107::getParser()->toDB($v); } } $this->pref = $tagwords_pref; @@ -834,7 +841,7 @@ class tagwords //create new array of preferences $tmp = $this->e107->arrayStorage->WriteArray($tagwords_pref); - $this->e107->sql->db_Update("core", "e107_value = '{$tmp}' WHERE e107_name = '".$this->table."' "); + $sql->update("core", "e107_value = '{$tmp}' WHERE e107_name = '".$this->table."' "); } return; } @@ -845,18 +852,19 @@ class tagwords */ function validate() { + $sql = e107::getDb(); global $sql2; - if($this->e107->sql->db_Select_gen("SELECT * FROM #".$this->table." GROUP BY tag_type, tag_itemid ORDER BY tag_id")) + if($sql->gen("SELECT * FROM #".$this->table." GROUP BY tag_type, tag_itemid ORDER BY tag_id")) { - while($row=$this->e107->sql->db_Fetch()) + while($row= $sql->fetch()) { if(array_key_exists($row['tag_type'], $this->mapper)) { $name = "e_tagwords_{$this->mapper[$row['tag_type']]}"; - if(!$sql2->db_Select_gen("SELECT * FROM #".$row['tag_type']." WHERE ".$this->$name->settings['db_id']." = '".$row['tag_itemid']."' ")) + if(!$sql2->gen("SELECT * FROM #".$row['tag_type']." WHERE ".$this->$name->settings['db_id']." = '".$row['tag_itemid']."' ")) { - $sql2->db_Delete($this->table, "tag_type='".$row['tag_type']."' AND tag_itemid='".$row['tag_itemid']."' "); + $sql2->delete($this->table, "tag_type='".$row['tag_type']."' AND tag_itemid='".$row['tag_itemid']."' "); } } } @@ -871,8 +879,8 @@ class tagwords { $this->validate(); - $text = $this->e107->tp->parseTemplate($this->template['admin_options'], true, $this->shortcodes); - $this->e107->ns->tablerender(LAN_TAG_OPT_1, $text); + $text = e107::getParser()->parseTemplate($this->template['admin_options'], true, $this->shortcodes); + e107::getRender()->tablerender(LAN_TAG_OPT_1, $text); } } //end class diff --git a/e107_plugins/tagwords/tagwords_menu.php b/e107_plugins/tagwords/tagwords_menu.php index 41ded1f3d..3c0f539ad 100644 --- a/e107_plugins/tagwords/tagwords_menu.php +++ b/e107_plugins/tagwords/tagwords_menu.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) * * Tagwords Menu * - * $Source: /cvs_backup/e107_0.8/e107_plugins/tagwords/tagwords_menu.php,v $ - * $Revision$ - * $Date$ - * $Author$ - * */ if (!defined('e107_INIT')){ exit; } @@ -28,8 +23,8 @@ if(varsettrue($tag->pref['tagwords_class']) && !check_class($tag->pref['tagwords return; } -$text = $e107->tp->parseTemplate($tag->template['menu_cloud'], true, $tag->shortcodes); +$text = e107::getParser()->parseTemplate($tag->template['menu_cloud'], true, $tag->shortcodes); $caption = $tag->pref['tagwords_menu_caption'] ? defset($tag->pref['tagwords_menu_caption'], $tag->pref['tagwords_menu_caption']) : LAN_TAG_16; -$e107->ns->tablerender($caption, $text); +e107::getRender()->tablerender($caption, $text); ?> \ No newline at end of file diff --git a/e107_plugins/tagwords/tagwords_shortcodes.php b/e107_plugins/tagwords/tagwords_shortcodes.php index e391c6ada..e4dc4e02a 100644 --- a/e107_plugins/tagwords/tagwords_shortcodes.php +++ b/e107_plugins/tagwords/tagwords_shortcodes.php @@ -2,15 +2,12 @@ /* * e107 website system * - * Copyright (C) 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) * * Tagwords Shortcodes * - * $URL$ - * $Id$ - * */ if (!defined('e107_INIT')) { exit; } @@ -48,7 +45,7 @@ class tagwords_shortcodes extends e_shortcode { global $tag; - $value = (isset($_GET['q']) ? $this->e107->tp->toForm($_GET['q']) : ''); + $value = (isset($_GET['q']) ? e107::getParser()->toForm($_GET['q']) : ''); switch($sc_mode) { case 'menu': @@ -143,7 +140,7 @@ class tagwords_shortcodes extends e_shortcode switch($sc_mode) { case 'result': - return "".$tag->num." ".($tag->num==1 ? LAN_TAG_8 : LAN_TAG_9)." '".$this->e107->tp->toHTML($_GET['q'],true)."'"; + return "".$tag->num." ".($tag->num==1 ? LAN_TAG_8 : LAN_TAG_9)." '".e107::getParser()->toHTML($_GET['q'],true)."'"; break; case 'form': default: @@ -274,7 +271,7 @@ class tagwords_shortcodes extends e_shortcode global $tag; if( varsettrue($tag->pref['tagwords_view_search'])==1 || varsettrue($tag->pref['tagwords_view_sort'])==1 || varsettrue($tag->pref['tagwords_view_style'])==1 || varsettrue($tag->pref['tagwords_view_area'])==1 ) { - return $this->e107->tp->parseTemplate($tag->template['options'], true, $tag->shortcodes); + return e107::getParser()->parseTemplate($tag->template['options'], true, $tag->shortcodes); } } @@ -380,14 +377,14 @@ class tagwords_shortcodes extends e_shortcode { global $tag; $id = 'tagwords_menu_caption'; - return ""; + return ""; } function sc_tag_opt_seperator() { global $tag; $id = 'tagwords_word_seperator'; - return ""; + return ""; } function sc_tag_opt_activeareas()