mirror of
https://github.com/e107inc/e107.git
synced 2025-08-29 01:00:20 +02:00
Code clean-up (global pointers, $e107->, headers). Got rid of all $e107->this->sql and tp
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
@@ -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("'", ''', 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user