1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 21:27:25 +02:00

Code clean-up (global pointers, $e107->, headers). Got rid of all $e107->this->sql and tp

This commit is contained in:
Moc
2013-03-26 12:16:55 +01:00
parent e9d3ae3841
commit f65708cd5a
22 changed files with 352 additions and 421 deletions

View File

@@ -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 "<a href='".$this->e107->url->create('user/profile/view', $this->news_item)."'>".$this->news_item['user_name']."{$parm}</a>";
return "<a href='".e107::getUrl()->create('user/profile/view', $this->news_item)."'>".$this->news_item['user_name']."{$parm}</a>";
}
}
return "<a href='http://e107.org'>e107</a>";
@@ -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 "<a class='".$GLOBALS['NEWS_CSSMODE']."_category' style='".(isset($this->param['catlink']) ? $this->param['catlink'] : "#")."' href='".$this->e107->url->create('news/list/category', $this->news_item)."'>".$category_name."</a>";
return "<a class='".$GLOBALS['NEWS_CSSMODE']."_category' style='".(isset($this->param['catlink']) ? $this->param['catlink'] : "#")."' href='".e107::getUrl()->create('news/list/category', $this->news_item)."'>".$category_name."</a>";
}
function sc_newsdate($parm)
@@ -244,7 +244,7 @@ class news_shortcodes extends e_shortcode
}
else
{
return $es1."<a href='".$this->e107->url->create('news/view/item', $this->news_item)."'>".EXTENDEDSTRING."</a>".$es2;
return $es1."<a href='".e107::getUrl()->create('news/view/item', $this->news_item)."'>".EXTENDEDSTRING."</a>".$es2;
}
}
return '';
@@ -313,7 +313,7 @@ class news_shortcodes extends e_shortcode
break;
default:
return "<a href='".$this->e107->url->create('news/view/item', $this->news_item)."'><img class='news_image' src='".$src."' alt='' style='".$this->param['thumbnail']."' /></a>";
return "<a href='".e107::getUrl()->create('news/view/item', $this->news_item)."'><img class='news_image' src='".$src."' alt='' style='".$this->param['thumbnail']."' /></a>";
break;
}
}
@@ -349,7 +349,7 @@ class news_shortcodes extends e_shortcode
case 'url':
default:
return "<a href='".$this->e107->url->create('news/view/item', $this->news_item)."'><img class='news_image' src='".$src."' alt='' style='".$this->param['thumbnail']."' /></a>";
return "<a href='".e107::getUrl()->create('news/view/item', $this->news_item)."'><img class='news_image' src='".$src."' alt='' style='".$this->param['thumbnail']."' /></a>";
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 "<a href='".$this->e107->url->create('news/list/category', $this->news_item)."'><img style='".$this->param['caticon']."' src='".$src."' alt='' /></a>";
return "<a href='".e107::getUrl()->create('news/list/category', $this->news_item)."'><img style='".$this->param['caticon']."' src='".$src."' alt='' /></a>";
break;
}
}
@@ -463,6 +463,5 @@ class news_shortcodes extends e_shortcode
return implode(", ",$words);
}
}
?>

View File

@@ -292,7 +292,7 @@ class e_form
$ret .= "
<div id='{$id}-iconpicker' class='e-hideme'>
<div class='expand-container' id='{$id}-iconpicker-cn'>
".(!$ajax ? $e107->tp->parseTemplate('{ICONPICKER='.$sc_parameters.'}') : '')."
".(!$ajax ? $tp->parseTemplate('{ICONPICKER='.$sc_parameters.'}') : '')."
</div>
</div>
";
@@ -2216,10 +2216,10 @@ class e_form
}
if(false === $cls || check_class($cls))
{
/*
/*
$value .= "<a href='".e_SELF."?{$query}' class='e-tip btn btn-large' title='".LAN_EDIT."' data-placement='left'>
<img class='icon action edit list' src='".ADMIN_EDIT_ICON_PATH."' alt='".LAN_EDIT."' /></a>";
*/
*/
$value .= "<a href='".e_SELF."?{$query}' class='btn' title='".LAN_EDIT."' data-toggle='tooltip' data-placement='left'>
".ADMIN_EDIT_ICON."</a>";
@@ -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.
}

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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.

View File

@@ -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 = "<select name='event_cat_ids' class='tbox' style='width:140px;' {$insert} >\n<option value='all'>".EC_LAN_97."</option>\n";
$cal_arg = ($this->ecalClass->cal_super ? '' : " find_in_set(event_cat_class,'".USERCLASS_LIST."') AND ");
$cal_arg .= "(event_cat_name != '".EC_DEFAULT_CATEGORY."') ";
$this->ourDB->db_Select("event_cat", "*", $cal_arg);
while ($row = $this->ourDB->db_Fetch())
$sql->select("event_cat", "*", $cal_arg);
while ($row = $sql->fetch())
{
$selected = ($row['event_cat_id'] == $this->catFilter) ? " selected='selected'" : '';
$ret .= "<option class='tbox' value='".$row['event_cat_id']."'{$selected}>".$row['event_cat_name']."</option>\n";
@@ -409,14 +405,14 @@ class event_calendar_shortcodes
{
if (!$this->event['event_allday']) return '';
if (trim($parm) == '') return '';
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
return e107::getParser()->parseTemplate('{'.$parm.'}', FALSE, $this);
}
public function sc_ec_ifnot_allday($parm= '')
{
if ($this->event['event_allday']) return '';
if (trim($parm) == '') return '';
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
return e107::getParser()->parseTemplate('{'.$parm.'}', FALSE, $this);
}
public function sc_ec_ifnot_sameday($parm= '')
@@ -424,7 +420,7 @@ class event_calendar_shortcodes
if (intval($this->event['event_end']/86400) == intval($this->event['event_start']/86400)) return '';
if (!$this->event['event_allday']) return '';
if (trim($parm) == '') return;
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
return e107::getParser()->parseTemplate('{'.$parm.'}', FALSE, $this);
}
public function sc_ec_if_sameday($parm= '')
@@ -432,7 +428,7 @@ class event_calendar_shortcodes
if (intval($this->event['event_end']/86400) != intval($this->event['event_start']/86400)) return '';
if (!$this->event['event_allday']) return '';
if (trim($parm) == '') return;
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
return e107::getParser()->parseTemplate('{'.$parm.'}', FALSE, $this);
}
@@ -490,7 +486,6 @@ class event_calendar_shortcodes
}
public function sc_ec_mail_time_end($parm = '')
{
if ($this->event['event_allday'] ||($this->event['event_end'] == $this->event['event_start'])) return '';
@@ -513,23 +508,20 @@ class event_calendar_shortcodes
public function sc_ec_mail_details($parm = '')
{
return $this->e107->tp->toHTML($this->event['event_details'], TRUE,'E_BODY');
return e107::getParser()->toHTML($this->event['event_details'], TRUE,'E_BODY');
}
public function sc_ec_mail_category($parm = '')
{
return $this->event['event_cat_name'];
}
public function sc_ec_mail_contact($parm = '')
{
if ($this->event['event_contact'] == '') return '';
return $this->e107->tp->toHTML($this->event['event_contact'],TRUE,'LINKTEXT');
return e107::getParser()->toHTML($this->event['event_contact'],TRUE,'LINKTEXT');
}
@@ -567,7 +559,7 @@ class event_calendar_shortcodes
{
if(isset($this->ecalClass->pref['eventpost_lenday']) && $this->ecalClass->pref['eventpost_lenday'])
{
return "<strong>".$this->e107->tp->text_truncate($this->headerDay,$this->ecalClass->pref['eventpost_lenday'],'')."</strong>";
return "<strong>".e107::getParser()->text_truncate($this->headerDay,$this->ecalClass->pref['eventpost_lenday'],'')."</strong>";
}
else
{
@@ -648,10 +640,10 @@ class event_calendar_shortcodes
public function sc_ec_showevent_heading()
{
$linkut = mktime(0 , 0 , 0 , $this->month, $this->curDay, $this->year);
$show_title = $this->e107->tp->toHTML($this->event['event_title'],FALSE,'TITLE'); // Remove entities in case need to truncate
$show_title = e107::getParser()->toHTML($this->event['event_title'],FALSE,'TITLE'); // Remove entities in case need to truncate
if(isset($this->event['fulltopic']) && !$this->event['fulltopic'])
{
$show_title = $this->e107->tp->text_truncate($show_title, 10, '...');
$show_title = e107::getParser()->text_truncate($show_title, 10, '...');
}
if($this->event['startofevent'])
{
@@ -770,7 +762,7 @@ class event_calendar_shortcodes
public function sc_ec_event_details()
{
return $this->e107->tp->toHTML($this->event['event_details'], TRUE, 'BODY');
return e107::getParser()->toHTML($this->event['event_details'], TRUE, 'BODY');
}
@@ -804,7 +796,7 @@ class event_calendar_shortcodes
{ // Add a bbcode if none exists
$tm = '[link=mailto:'.trim($tm).']'.substr($tm,0,strpos($tm,'@')).'[/link]';
}
return $this->e107->tp->toHTML($tm,TRUE,'LINKTEXT'); // Return obfuscated email link
return e107::getParser()->toHTML($tm,TRUE,'LINKTEXT'); // Return obfuscated email link
}
@@ -843,7 +835,7 @@ class event_calendar_shortcodes
if ($this->event['event_allday']) $et += 2;
if (is_array($this->eventDisplayCodes))
{
return $this->e107->tp->parseTemplate($this->eventDisplayCodes[$et], FALSE, $this);
return e107::getParser()->parseTemplate($this->eventDisplayCodes[$et], FALSE, $this);
}
return '--** No template set **--';
}
@@ -879,7 +871,7 @@ class event_calendar_shortcodes
public function sc_ec_eventarchive_details()
{
$number = 40;
$rowtext = $this->e107->tp->toHTML($this->event['event_details'], TRUE, 'BODY');
$rowtext = e107::getParser()->toHTML($this->event['event_details'], TRUE, 'BODY');
$rowtext = strip_tags($rowtext);
$words = explode(' ', $rowtext);
$ret = implode(' ', array_slice($words, 0, $number));
@@ -979,8 +971,6 @@ class event_calendar_shortcodes
}
// Specific to the 'listings' page
//--------------------------------
@@ -989,8 +979,6 @@ class event_calendar_shortcodes
return $this->printVars['lt'];
}
public function sc_ec_pr_cat_list()
{
if (is_array($this->printVars['cat']))
@@ -1058,42 +1046,42 @@ class event_calendar_shortcodes
{
if ($this->printVars['ot'] != 'print') return;
if (trim($parm) == '') return;
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
return e107::getParser()->parseTemplate('{'.$parm.'}', FALSE, $this);
}
public function sc_ec_ifnot_print($parm = '')
{
if ($this->printVars['ot'] == 'print') return;
if (trim($parm) == '') return;
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
return e107::getParser()->parseTemplate('{'.$parm.'}', FALSE, $this);
}
public function sc_ec_if_display($parm = '')
{
if ($this->printVars['ot'] != 'display') return;
if (trim($parm) == '') return;
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
return e107::getParser()->parseTemplate('{'.$parm.'}', FALSE, $this);
}
public function sc_ec_ifnot_display($parm = '')
{
if ($this->printVars['ot'] == 'display') return;
if (trim($parm) == '') return;
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
return e107::getParser()->parseTemplate('{'.$parm.'}', FALSE, $this);
}
public function sc_ec_if_pdf($parm = '')
{
if ($this->printVars['ot'] != 'pdf') return;
if (trim($parm) == '') return;
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
return e107::getParser()->parseTemplate('{'.$parm.'}', FALSE, $this);
}
public function sc_ec_ifnot_pdf($parm = '')
{
if ($this->printVars['ot'] == 'pdf') return;
if (trim($parm) == '') return;
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
return e107::getParser()->parseTemplate('{'.$parm.'}', FALSE, $this);
}
} // END - shortcode class

View File

@@ -263,8 +263,8 @@ class calendar_menu_cron // include plugin-folder in the name.
// MAIL_CONTACT, MAIL_THREAD (maybe). Also MAIL_LINK, MAIL_SHORT_DATE
// Best to strip entities here rather than at entry - handles old events as well
// Note that certain user-related substitutions will work, however - |USERID|, |USERNAME|, |DISPLAYNAME|
$cal_title = html_entity_decode($this->e107->tp->parseTemplate($this->ecal_class->pref['eventpost_mailsubject'], TRUE),ENT_QUOTES,CHARSET);
$cal_msg = html_entity_decode($this->e107->tp->parseTemplate($cal_msg, TRUE),ENT_QUOTES,CHARSET);
$cal_title = html_entity_decode(e107::getParser()->parseTemplate($this->ecal_class->pref['eventpost_mailsubject'], TRUE),ENT_QUOTES,CHARSET);
$cal_msg = html_entity_decode(e107::getParser()->parseTemplate($cal_msg, TRUE),ENT_QUOTES,CHARSET);
// Four cases for the query:
// 1. No forced mailshots - based on event_subs table only Need INNER JOIN

View File

@@ -8,10 +8,6 @@
*
* Forthcoming events menu handler for event calendar
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/next_event_menu.php,v $
* $Revision$
* $Date$
* $Author$
*/
/**
@@ -21,7 +17,6 @@
*
* @package e107_plugins
* @subpackage event_calendar
* @version $Id$;
*/
if (!defined('e107_INIT')) { exit; }
@@ -87,7 +82,7 @@ if ($cal_totev > 0)
$cal_totev --; // Can use this to modify inter-event gap
$calSc->numEvents = $cal_totev; // Number of events to display
$calSc->event = $thisEvent; // Give shortcodes the event data
$cal_text .= $e107->tp->parseTemplate($EVENT_CAL_FE_LINE,FALSE, $calSc);
$cal_text .= $tp->parseTemplate($EVENT_CAL_FE_LINE,FALSE, $calSc);
}
}
else
@@ -96,7 +91,7 @@ else
$cal_text.= EC_LAN_141;
}
$calendar_title = e107::getParser()->toHTML($menu_title,FALSE,'TITLE'); // Allows multi-language title, shortcodes
$calendar_title = $tp->toHTML($menu_title,FALSE,'TITLE'); // Allows multi-language title, shortcodes
if ($link_in_heading == 1)
{
$calendar_title = "<a class='forumlink' href='".e_PLUGIN_ABS."calendar_menu/event.php' >".$calendar_title."</a>";

View File

@@ -13,6 +13,7 @@ if (!defined('e107_INIT')) exit;
global $menu_pref;
$e107 = e107::getInstance();
$tp = e107::getParser();
$sql = e107::getDb();
$gen = new convert;
@@ -42,7 +43,7 @@ if($results = $sql->gen($qry))
$datestamp = $gen->convert_date($row['post_datestamp'], 'short');
$id = $row['thread_id'];
$topic = ($row['thread_datestamp'] == $row['post_datestamp'] ? '' : 'Re:');
$topic .= strip_tags($e107->tp->toHTML($row['thread_name'], true, 'emotes_off, no_make_clickable, parse_bb', '', $pref['menu_wordwrap']));
$topic .= strip_tags($tp->toHTML($row['thread_name'], true, 'emotes_off, no_make_clickable, parse_bb', '', $pref['menu_wordwrap']));
if($row['post_user_anon'])
{
$poster = $row['post_user_anon'];
@@ -51,7 +52,7 @@ if($results = $sql->gen($qry))
{
if($row['user_name'])
{
$poster = "<a href='".$e107->url->create('user/profile/view', array('name' => $row['user_name'], 'id' => $row['post_user']))."'>{$row['user_name']}</a>";
$poster = "<a href='".e107::getUrl()->create('user/profile/view', array('name' => $row['user_name'], 'id' => $row['post_user']))."'>{$row['user_name']}</a>";
}
else
{
@@ -59,10 +60,10 @@ if($results = $sql->gen($qry))
}
}
$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']);
$post = strip_tags($tp->toHTML($row['post_entry'], true, 'emotes_off, no_make_clickable', '', $pref['menu_wordwrap']));
$post = $tp->text_truncate($post, $menu_pref['newforumposts_characters'], $menu_pref['newforumposts_postfix']);
$url = $e107->url->create('forum/thread/last', $row);
$url = e107::getUrl()->create('forum/thread/last', $row);
//TODO legacy bullet is not use here anymore
//$bullet = "<img src='".THEME_ABS.'images/'.(defined('BULLET') ? BULLET : 'bullet2.gif')."' alt='' />";

View File

@@ -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)
*
* List Class
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/list_class.php,v $
* $Revision$
* $Date$
* $Author$
*
*/
if (!defined('e107_INIT')) { exit; }
@@ -93,7 +89,7 @@ class listclass
{
//for each call to the template, provide the correct data set through load_globals
//list_shortcodes::load_globals();
return $this->e107->tp->parseTemplate($this->template[$template], true, $this->shortcodes);
return e107::getParser()->parseTemplate($this->template[$template], true, $this->shortcodes);
}
/**
@@ -104,9 +100,10 @@ class listclass
*/
function getListPrefs()
{
$sql = e107::getDb();
//check preferences from database
$num_rows = $this->e107->sql->db_Select_gen("SELECT * FROM #core WHERE e107_name='list' ");
$row = $this->e107->sql->db_Fetch();
$num_rows = $sql->gen("SELECT * FROM #core WHERE e107_name='list' ");
$row = $sql->fetch();
//insert default preferences
if (empty($row['e107_value']))
@@ -115,8 +112,8 @@ class listclass
$this->list_pref = $this->getDefaultPrefs();
$tmp = $this->e107->arrayStorage->WriteArray($this->list_pref);
$this->e107->sql->db_Insert("core", "'list', '$tmp' ");
$this->e107->sql->db_Select_gen("SELECT * FROM #core WHERE e107_name='list' ");
$sql->insert("core", "'list', '$tmp' ");
$sql->gen("SELECT * FROM #core WHERE e107_name='list' ");
}
$this->list_pref = $this->e107->arrayStorage->ReadArray($row['e107_value']);
@@ -161,16 +158,16 @@ class listclass
$s = $this->sections[$i];
if(varsettrue($this->list_pref[$s."_".$mode."_display"]) == '1')
{
$arr[$s]['caption'] = varsettrue($this->list_pref[$s."_".$mode."_caption"]);
$arr[$s]['display'] = varsettrue($this->list_pref[$s."_".$mode."_display"]);
$arr[$s]['open'] = varsettrue($this->list_pref[$s."_".$mode."_open"]);
$arr[$s]['author'] = varsettrue($this->list_pref[$s."_".$mode."_author"]);
$arr[$s]['category'] = varsettrue($this->list_pref[$s."_".$mode."_category"]);
$arr[$s]['date'] = varsettrue($this->list_pref[$s."_".$mode."_date"]);
$arr[$s]['icon'] = varsettrue($this->list_pref[$s."_".$mode."_icon"]);
$arr[$s]['amount'] = varsettrue($this->list_pref[$s."_".$mode."_amount"]);
$arr[$s]['order'] = varsettrue($this->list_pref[$s."_".$mode."_order"]);
$arr[$s]['section'] = $s;
$arr[$s]['caption'] = varsettrue($this->list_pref[$s."_".$mode."_caption"]);
$arr[$s]['display'] = varsettrue($this->list_pref[$s."_".$mode."_display"]);
$arr[$s]['open'] = varsettrue($this->list_pref[$s."_".$mode."_open"]);
$arr[$s]['author'] = varsettrue($this->list_pref[$s."_".$mode."_author"]);
$arr[$s]['category'] = varsettrue($this->list_pref[$s."_".$mode."_category"]);
$arr[$s]['date'] = varsettrue($this->list_pref[$s."_".$mode."_date"]);
$arr[$s]['icon'] = varsettrue($this->list_pref[$s."_".$mode."_icon"]);
$arr[$s]['amount'] = varsettrue($this->list_pref[$s."_".$mode."_amount"]);
$arr[$s]['order'] = varsettrue($this->list_pref[$s."_".$mode."_order"]);
$arr[$s]['section'] = $s;
}
}
//sort array on order values set in preferences
@@ -206,6 +203,7 @@ class listclass
*/
function getContentSections($mode='')
{
$sql = $e107::getDb();
global $pref;
if (!$content_install = isset($pref['plug_installed']['content']))
@@ -216,10 +214,10 @@ class listclass
$content_types = array();
//get top level categories
if($mainparents = $this->e107->sql->db_Select_gen("SELECT content_id, content_heading FROM #pcontent WHERE content_parent = '0' AND (content_datestamp=0 || content_datestamp < ".time().") AND (content_enddate=0 || content_enddate>".time().") ORDER BY content_heading"))
if($mainparents = $sql->gen("SELECT content_id, content_heading FROM #pcontent WHERE content_parent = '0' AND (content_datestamp=0 || content_datestamp < ".time().") AND (content_enddate=0 || content_enddate>".time().") ORDER BY content_heading"))
{
$content_name = 'content';
while($row = $this->e107->sql->db_Fetch())
while($row = $sql->fetch())
{
$content_types[] = "content_".$row['content_id'];
if(varsettrue($mode) == "add")
@@ -287,7 +285,7 @@ class listclass
{
if(!in_array($s, $this->content_types))
{
if ($plugin_installed = isset($pref['plug_installed'][$this->e107->tp->toDB($s, true)]))
if ($plugin_installed = isset($pref['plug_installed'][e107::getParser()->toDB($s, true)]))
{
$prf["$s_recent_menu_caption"] = $s;
$prf["$s_recent_page_caption"] = $s;
@@ -570,7 +568,7 @@ class listclass
$listArray = $class->getListData();
if (e107::getPref('profanity_filter'))
{
$parser = e107::getParser();
$tp = e107::getParser();
if (!is_object($parser->e_pf))
{
require_once(e_HANDLER.'profanity_filter.php');
@@ -580,7 +578,7 @@ class listclass
{
if (isset($v['heading']))
{
$listArray[$k]['heading'] = $parser->e_pf->filterProfanities($v['heading']);
$listArray[$k]['heading'] = $tp->e_pf->filterProfanities($v['heading']);
}
}
}
@@ -725,7 +723,7 @@ class listclass
*/
function displayTimelapse()
{
global $rs;
global $rs; //FIXME $frm
if(isset($this->list_pref['new_page_timelapse']) && $this->list_pref['new_page_timelapse'])
{

View File

@@ -40,9 +40,9 @@ class list_shortcodes
{
global $rc;
$e107 = e107::getInstance();
// $e107->tp->e_sc->scClasses['list_shortcodes']->rc = $rc;
// $e107->tp->e_sc->scClasses['list_shortcodes']->row = $rc->row;
// $e107->tp->e_sc->scClasses['list_shortcodes']->list_pref = $rc->list_pref;
// $tp->e_sc->scClasses['list_shortcodes']->rc = $rc;
// $tp->e_sc->scClasses['list_shortcodes']->row = $rc->row;
// $tp->e_sc->scClasses['list_shortcodes']->list_pref = $rc->list_pref;
}
*/

View File

@@ -6,12 +6,7 @@
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Administration - Site Maintenance
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/newsletter/nl_archive.php,v $
* $Revision$
* $Date$
* $Author$
* Administration - Newsletter archive
*
*/
@@ -21,7 +16,6 @@
*
* @package e107_plugins
* @subpackage newsletter
* @version $Id$;
*/
@@ -34,6 +28,8 @@ if (!$e107->isInstalled('newsletter') || !ADMIN)
include_lan(e_PLUGIN.'newsletter/languages/'.e_LANGUAGE.'.php');
require_once(HEADERF);
$sql = e107::getDb();
$action_parent_id = 0;
$action_nl_id = 0;
if(e_QUERY)
@@ -62,12 +58,12 @@ else
{
$limit_start = $_POST['limit_start'];
}
$nl_count = $e107->sql->db_Count('newsletter', '(*)', "WHERE newsletter_parent='".$action_parent_id."' AND newsletter_flag='1'");
$nl_count = $sql->count('newsletter', '(*)', "WHERE newsletter_parent='".$action_parent_id."' AND newsletter_flag='1'");
if ($nl_count > 0)
{
// Retrieve parent info
$e107->sql->db_Select('newsletter', "*", "newsletter_id='".$action_parent_id."'");
if ($row = $e107->sql->db_Fetch())
$sql->select('newsletter', "*", "newsletter_id='".$action_parent_id."'");
if ($row = $sql->fetch())
{
$parent_newsletter_title = $tp->toHTML($row['newsletter_title'],true);
$parent_newsletter_text = $tp->toHTML($row['newsletter_text'],true);
@@ -86,8 +82,8 @@ else
{ // This should only be done when action is 'showp'
$limit_start = $limit_start + $page_size;
}
$e107->sql->db_Select('newsletter', '*', "newsletter_parent='".$action_parent_id."' AND newsletter_flag='1' ORDER BY newsletter_datestamp DESC LIMIT ".$limit_start.",".$page_size);
while ($row = $e107->sql->db_Fetch())
$sql->select('newsletter', '*', "newsletter_parent='".$action_parent_id."' AND newsletter_flag='1' ORDER BY newsletter_datestamp DESC LIMIT ".$limit_start.",".$page_size);
while ($row = $sql->fetch())
{
$ga = new convert();
$newsletter_datestamp = $ga->convert_date($row['newsletter_datestamp'], 'long');
@@ -107,14 +103,14 @@ else
if($limit_start + $page_size < $nl_count)
{
$text .= "<form id='nl' method='post' action='".e_PLUGIN."newsletter/nl_archive.php?showp.".$action_parent_id."'>
<br /><input class='button' name='submit' type='submit' value='View older newsletters in archive'/>
<br /><input class='btn button' name='submit' type='submit' value='View older newsletters in archive'/>
<input type='hidden' name='limit_start' value='".$limit_start."'/></form>";
}
}
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<br />
@@ -129,7 +125,7 @@ else
// Display parent footer
$text .= "$parent_newsletter_footer<br />";
// Display back to newsletter overview button
$text .= "<br /><a href='javascript:history.go(-1);'><input class='button' type='submit' value='".NLLAN_71."'</a>";
$text .= "<br /><a href='javascript:history.go(-1);'><input class='btn button' type='submit' value='".NLLAN_71."'</a>";
}
else
{

View File

@@ -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 = "<a href='".e_HTTP."user.php?id.".$row['user_id']."'>".$row['user_name']."</a>";
$this->e107->ecache->set('online_menu_member_newest', $ret);
}

View File

@@ -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 = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
$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 .= '</form>';
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('', "<div class='alert alert-block'>". $message."</div>");
}
//-----------------------------------------
// DISPLAY TASKS
//-----------------------------------------
@@ -688,11 +673,4 @@ switch ($action)
require_once(FOOTERF);
exit;
?>

View File

@@ -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.'<br />';
}
@@ -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).'<br />';
}
$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("'", '&#039;', 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);
}
}
}
}

View File

@@ -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
<!-- content type=\"".$this -> contentType."\" -->
<rss version=\"0.92\">
<channel>
<title>".$this->e107->tp->toRss($rss_title)."</title>
<title>".$tp->toRss($rss_title)."</title>
<link>".$pref['siteurl']."</link>
<description>".$this->e107->tp->toRss($pref['sitedescription'])."</description>
<description>".$tp->toRss($pref['sitedescription'])."</description>
<lastBuildDate>".$itemdate = date("r", ($time + $this -> offset))."</lastBuildDate>
<docs>http://backend.userland.com/rss092</docs>\n";
@@ -421,11 +419,11 @@ class rssCreate
echo "
<item>
<title>".$this->e107->tp->toRss($value['title'])."</title>
<description>".substr($this->e107->tp->toRss($value['description']),0,150);
<title>".$tp->toRss($value['title'])."</title>
<description>".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 "&lt;a href=&quot;".$link."&quot;&gt;&lt;img src=&quot;".$news_thumbnail."&quot; height=&quot;50&quot; border=&quot;0&quot; hspace=&quot;10&quot; vspace=&quot;10&quot; align=&quot;right&quot;&gt;&lt;/a&gt;";
unset($news_thumbail);
}
@@ -451,14 +449,14 @@ class rssCreate
xmlns:sy=\"http://purl.org/rss/1.0/modules/syndication/\"
>
<channel>
<title>".$this->e107->tp->toRss($rss_title)."</title>
<title>".$tp->toRss($rss_title)."</title>
<link>".$pref['siteurl']."</link>
<description>".$this->e107->tp->toRss($pref['sitedescription'])."</description>\n";
<description>".$tp->toRss($pref['sitedescription'])."</description>\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 "<language>".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."</language>
<copyright>".$this->e107->tp->toRss(SITEDISCLAIMER)."</copyright>
<copyright>".$tp->toRss(SITEDISCLAIMER)."</copyright>
<managingEditor>".$this->nospam($pref['siteadminemail'])." (".$pref['siteadmin'].")</managingEditor>
<webMaster>".$this->nospam($pref['siteadminemail'])." (".$pref['siteadmin'].")</webMaster>
<pubDate>".date("r",($time + $this -> offset))."</pubDate>
@@ -475,12 +473,12 @@ class rssCreate
{
echo "
<image>
<title>".$this->e107->tp->toRss($rss_title)."</title>
<title>".$tp->toRss($rss_title)."</title>
<url>".(strstr(SITEBUTTON, "http:")!==FALSE ? SITEBUTTON : SITEURL.str_replace("../", "",SITEBUTTON))."</url>
<link>".$pref['siteurl']."</link>
<width>88</width>
<height>31</height>
<description>".$this->e107->tp->toRss($pref['sitedescription'])."</description>
<description>".$tp->toRss($pref['sitedescription'])."</description>
</image>\n";
}
@@ -489,7 +487,7 @@ class rssCreate
echo "
<textInput>
<title>Search</title>
<description>Search ".$this->e107->tp->toRss($pref['sitename'])."</description>
<description>Search ".$tp->toRss($pref['sitename'])."</description>
<name>query</name>
<link>".SITEURL.(substr(SITEURL, -1) == "/" ? "" : "/")."search.php</link>
</textInput>";
@@ -502,17 +500,17 @@ class rssCreate
echo "
<item>
<title>".$this->e107->tp->toRss($value['title'])."</title>\n";
<title>".$tp->toRss($value['title'])."</title>\n";
if($link)
{
echo "<link>".$link."</link>\n";
}
echo "<description>".$this->e107->tp->toRss($value['description'],TRUE);
echo "<description>".$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 "&lt;a href=&quot;".$link."&quot;&gt;&lt;img src=&quot;".$news_thumbnail."&quot; height=&quot;50&quot; border=&quot;0&quot; hspace=&quot;10&quot; vspace=&quot;10&quot; align=&quot;right&quot;&gt;&lt;/a&gt;";
unset($news_thumbail);
}
@@ -525,7 +523,7 @@ class rssCreate
if($value['category_name'] && $catlink)
{
echo "<category domain='".$catlink."'>".$this->e107->tp->toRss($value['category_name'])."</category>\n";
echo "<category domain='".$catlink."'>".$tp->toRss($value['category_name'])."</category>\n";
}
if($value['comment'])
@@ -573,9 +571,9 @@ class rssCreate
<!-- content type=\"".$this -> contentType."\" -->
<rdf:RDF xmlns=\"http://purl.org/rss/1.0/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:sy=\"http://purl.org/rss/1.0/modules/syndication/\" xmlns:admin=\"http://webns.net/mvcb/\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\">
<channel rdf:about=\"".$pref['siteurl']."\">
<title>".$this->e107->tp->toRss($rss_title)."</title>
<title>".$tp->toRss($rss_title)."</title>
<link>".$pref['siteurl']."</link>
<description>".$this->e107->tp->toRss($pref['sitedescription'])."</description>
<description>".$tp->toRss($pref['sitedescription'])."</description>
<dc:language>".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."</dc:language>
<dc:date>".$this->get_iso_8601_date($time + $this -> offset). "</dc:date>
<dc:creator>".$this->nospam($pref['siteadminemail'])."</dc:creator>
@@ -608,15 +606,15 @@ class rssCreate
echo "
<item rdf:about=\"".$link."\">
<title>".$this->e107->tp->toRss($value['title'])."</title>
<title>".$tp->toRss($value['title'])."</title>
<link>".$link."</link>
<dc:date>".$this->get_iso_8601_date($time + $this -> offset)."</dc:date>
<dc:creator>".$value['author']."</dc:creator>
<dc:subject>".$this->e107->tp->toRss($value['category_name'])."</dc:subject>
<description>".$this->e107->tp->toRss($value['description']);
<dc:subject>".$tp->toRss($value['category_name'])."</dc:subject>
<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 "&lt;a href=&quot;".$link."&quot;&gt;&lt;img src=&quot;".$news_thumbnail."&quot; height=&quot;50&quot; border=&quot;0&quot; hspace=&quot;10&quot; vspace=&quot;10&quot; align=&quot;right&quot;&gt;&lt;/a&gt;";
unset($news_thumbail);
}
@@ -640,7 +638,7 @@ class rssCreate
// Required
echo "
<id>".$pref['siteurl']."</id>\n
<title type='text'>".$this->e107->tp->toRss($rss_title)."</title>\n
<title type='text'>".$tp->toRss($rss_title)."</title>\n
<updated>".$this->get_iso_8601_date($time + $this -> offset)."</updated>\n";
// Recommended
@@ -676,7 +674,7 @@ class rssCreate
// Required
echo "
<id>".$value['link']."</id>\n
<title type='text'>".$this->e107->tp->toRss($value['title'])."</title>\n
<title type='text'>".$tp->toRss($value['title'])."</title>\n
<updated>".$this->get_iso_8601_date($value['pubdate'] + $this -> offset)."</updated>\n";
// Recommended
@@ -691,10 +689,10 @@ class rssCreate
//<content>complete story here</content>\n
echo "
<link rel='alternate' type='text/html' href='".$value['link']."' />\n
<summary type='text'>".$this->e107->tp->toRss($value['description']);
<summary type='text'>".$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 "&lt;a href=&quot;".$value['link']."&quot;&gt;&lt;img src=&quot;".$news_thumbnail."&quot; height=&quot;50&quot; border=&quot;0&quot; hspace=&quot;10&quot; vspace=&quot;10&quot; align=&quot;right&quot;&gt;&lt;/a&gt;";
unset($news_thumbail);
}
@@ -702,7 +700,7 @@ class rssCreate
// Optional
if($value['category_name']){
echo "<category term='".$this->e107->tp->toRss($value['category_name'])."'/>\n";
echo "<category term='".$tp->toRss($value['category_name'])."'/>\n";
}
//<contributor>
// <name>Jane Doe</name>
@@ -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

View File

@@ -1,7 +1,6 @@
<?php
/*
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id$
* Copyright (C) 2008-2013 e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
*
* Siteinfo shortcode batch
*/
@@ -11,16 +10,14 @@ class siteinfo_shortcodes // must match the folder name of the plugin.
{
function sc_sitebutton()
{
$e107 = e107::getInstance();
$path = ($_POST['sitebutton'] && $_POST['ajax_used']) ? $e107->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 '<a href="'.SITEURL.'"><img src="'.$path.'" alt="'.SITENAME.'" /></a>';
}
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

View File

@@ -1,7 +1,6 @@
<?php
/**
* Copyright (C) e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id$
* Copyright (C) 2008-2013 e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
*
* Tagwords core section
*/
@@ -29,12 +28,14 @@ class e_tagwords_news
}
//$url = e_BASE."news.php?item.".$this->row['news_id'];
$url = e107::getUrl()->create('news/view/item', $this->row);
return "<a href='".$url."'>".$this->e107->tp->toHTML($this->row['news_title'], TRUE, '')."</a>";
return "<a href='".$url."'>".e107::getParser()->toHTML($this->row['news_title'], TRUE, '')."</a>";
}
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;
}
}
?>

View File

@@ -1,10 +1,10 @@
<?php
/**
* Copyright (C) e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id$
* Copyright (C) 2008-2013 e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
*
* Tagwords core section
*/
if (!defined('e107_INIT')) { exit; }
class e_tagwords_page
@@ -29,23 +29,23 @@ class e_tagwords_page
}
$url = e_BASE."page.php?".$this->row['page_id'];
$url = e107::getUrl()->create('page/view', $this->row, 'allow=page_id,page_title,page_sef');
return "<a href='".$url."'>".$this->e107->tp->toHTML($this->row['page_title'], TRUE, '')."</a>";
return "<a href='".$url."'>".e107::getParser()->toHTML($this->row['page_title'], TRUE, '')."</a>";
}
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;
}
}
?>

View File

@@ -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 "<a href='".$url."' ".$class." title=''>".$word."</a>";
}
@@ -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 "<br />".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, "<div style='text-align:center'><b>".$message."</b></div>");
e107::getRender()->tablerender($caption, "<div style='text-align:center'><b>".$message."</b></div>");
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

View File

@@ -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);
?>

View File

@@ -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 "<b>".$tag->num."</b> ".($tag->num==1 ? LAN_TAG_8 : LAN_TAG_9)." '<b>".$this->e107->tp->toHTML($_GET['q'],true)."</b>'";
return "<b>".$tag->num."</b> ".($tag->num==1 ? LAN_TAG_8 : LAN_TAG_9)." '<b>".e107::getParser()->toHTML($_GET['q'],true)."</b>'";
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 "<input class='tbox' type='text' id='".$id."' name='".$id."' value='".$this->e107->tp->toForm($tag->pref[$id],"","defs")."' size='30' maxlength='100' />";
return "<input class='tbox' type='text' id='".$id."' name='".$id."' value='".e107::getParser()->toForm($tag->pref[$id],"","defs")."' size='30' maxlength='100' />";
}
function sc_tag_opt_seperator()
{
global $tag;
$id = 'tagwords_word_seperator';
return "<input class='tbox' type='text' id='".$id."' name='".$id."' value='".$this->e107->tp->toForm($tag->pref[$id])."' size='3' maxlength='10' />";
return "<input class='tbox' type='text' id='".$id."' name='".$id."' value='".e107::getParser()->toForm($tag->pref[$id])."' size='3' maxlength='10' />";
}
function sc_tag_opt_activeareas()