mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 06:38:00 +02:00
PM plugin latest updates - use new-style shortcode system, restructure to get rid of many globals
This commit is contained in:
@@ -30,7 +30,7 @@ define('ADLAN_PM_27', "Allow posting of attachments");
|
||||
define('ADLAN_PM_28', "Maximum attachment size");
|
||||
define('ADLAN_PM_29', "Allow sending to all members");
|
||||
define('ADLAN_PM_30', "Allow sending to multiple recipients");
|
||||
define('ADLAN_PM_31', "Enable sending to userclass");
|
||||
define('ADLAN_PM_31', 'Userclass allowed to send to userclass');
|
||||
define('ADLAN_PM_32', "Update Settings");
|
||||
define('ADLAN_PM_33', "Inactive (no limits)");
|
||||
define('ADLAN_PM_34', "PM counts");
|
||||
@@ -83,6 +83,9 @@ define('ADLAN_PM_76', 'No changes made - nothing logged');
|
||||
define('ADLAN_PM_77', '(Empty all fields and Update to delete a limit)');
|
||||
define('ADLAN_PM_78', 'Check attachments');
|
||||
define('ADLAN_PM_79', '--ORPHANS-- unused attachments deleted. --MISSING-- missing attachments noted');
|
||||
define('ADLAN_PM_80', '');
|
||||
define('ADLAN_PM_80', 'Preference formats updated');
|
||||
define('ADLAN_PM_81', '');
|
||||
define('ADLAN_PM_82', '');
|
||||
define('ADLAN_PM_83', '');
|
||||
|
||||
?>
|
||||
|
@@ -9,22 +9,20 @@
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/pm/pm.php,v $
|
||||
* $Revision: 1.13 $
|
||||
* $Date: 2009-12-10 20:40:38 $
|
||||
* $Revision: 1.14 $
|
||||
* $Date: 2009-12-16 20:23:32 $
|
||||
* $Author: e107steved $
|
||||
*/
|
||||
|
||||
/*
|
||||
TODO:
|
||||
4. Check 'to' field - can sometimes be text
|
||||
|
||||
*/
|
||||
|
||||
$retrieve_prefs[] = 'pm_prefs';
|
||||
require_once('../../class2.php');
|
||||
|
||||
if($_POST['keyword'])
|
||||
{
|
||||
pm_user_lookup();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (!e107::isInstalled('pm'))
|
||||
{
|
||||
@@ -32,9 +30,20 @@ if (!e107::isInstalled('pm'))
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($_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');
|
||||
e107::getScParser();
|
||||
require_once(e_PLUGIN.'pm/pm_shortcodes.php');
|
||||
|
||||
define('ATTACHMENT_ICON', "<img src='".e_PLUGIN."pm/images/attach.png' alt='' />");
|
||||
|
||||
@@ -46,6 +55,13 @@ $pm_proc_id = intval(varset($qs[1],0));
|
||||
|
||||
$pm_prefs = $sysprefs->getArray('pm_prefs');
|
||||
|
||||
|
||||
$pm_prefs['perpage'] = intval($pm_prefs['perpage']);
|
||||
if($pm_prefs['perpage'] == 0)
|
||||
{
|
||||
$pm_prefs['perpage'] = 10;
|
||||
}
|
||||
|
||||
if(!isset($pm_prefs['pm_class']) || !check_class($pm_prefs['pm_class']))
|
||||
{
|
||||
require_once(HEADERF);
|
||||
@@ -54,13 +70,404 @@ if(!isset($pm_prefs['pm_class']) || !check_class($pm_prefs['pm_class']))
|
||||
exit;
|
||||
}
|
||||
|
||||
$pm =& new private_message;
|
||||
$message = '';
|
||||
$pm_prefs['perpage'] = intval($pm_prefs['perpage']);
|
||||
if($pm_prefs['perpage'] == 0)
|
||||
setScVar('pm_handler_shortcodes','pmPrefs', $pm_prefs);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class pm_extended extends private_message
|
||||
{
|
||||
$pm_prefs['perpage'] = 10;
|
||||
protected $e107;
|
||||
protected $pmPrefs;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $prefs - pref settings for PM plugin
|
||||
* @return none
|
||||
*/
|
||||
public function __construct($prefs)
|
||||
{
|
||||
$this->e107 = e107::getInstance();
|
||||
$this->pmPrefs = $prefs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Show the 'Send to' form
|
||||
* @param array|int $to_uid - a PM block of message to reply to, or UID of user to send to
|
||||
*
|
||||
* @return string text for display
|
||||
*/
|
||||
function show_send($to_uid)
|
||||
{
|
||||
$pm_outbox = pm_getInfo('outbox');
|
||||
if (is_array($to_uid))
|
||||
{
|
||||
$pm_info = $to_uid; // We've been passed a 'reply to' PM
|
||||
$to_uid = $pm_info['pm_from'];
|
||||
}
|
||||
if($to_uid)
|
||||
{
|
||||
$sql2 =& new db;
|
||||
if($sql2->db_Select('user', 'user_name', 'user_id = '.intval($to_uid)))
|
||||
{
|
||||
$row=$sql2->db_Fetch();
|
||||
$pm_info['from_name'] = $row['user_name'];
|
||||
}
|
||||
}
|
||||
echo "Show_send: {$to_uid} from {$pm_info['from_name']} is happening<br />";
|
||||
|
||||
if($pm_outbox['outbox']['filled'] >= 100)
|
||||
{
|
||||
return str_replace('{PERCENT}', $pm_outbox['outbox']['filled'], LAN_PM_13);
|
||||
}
|
||||
$tpl_file = THEME.'pm_template.php';
|
||||
include_once(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/pm_template.php');
|
||||
$enc = (check_class($this->pmPrefs['attach_class']) ? "enctype='multipart/form-data'" : '');
|
||||
setScVar('pm_handler_shortcodes','pmInfo', $pm_info);
|
||||
$text = "<form {$enc} method='post' action='".e_SELF."' id='dataform'>
|
||||
<div><input type='hidden' name='numsent' value='{$pm_outbox['outbox']['total']}' />".
|
||||
$this->e107->tp->parseTemplate($PM_SEND_PM, TRUE).
|
||||
'</div></form>';
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show inbox
|
||||
* @param int $start - offset into list
|
||||
*
|
||||
* @return string text for display
|
||||
*/
|
||||
|
||||
function show_inbox($start = 0)
|
||||
{
|
||||
$tpl_file = THEME.'pm_template.php';
|
||||
include(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/pm_template.php');
|
||||
$pm_blocks = $this->block_get();
|
||||
$pmlist = $this->pm_get_inbox(USERID, $start, $this->pmPrefs['perpage']);
|
||||
setScVar('pm_handler_shortcodes', 'pmNextPrev', array('start' => $start, 'total' => $pmlist['total_messages']));
|
||||
$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
|
||||
$txt .= $this->e107->tp->parseTemplate($PM_INBOX_HEADER, true);
|
||||
if($pmlist['total_messages'])
|
||||
{
|
||||
foreach($pmlist['messages'] as $rec)
|
||||
{
|
||||
if(trim($rec['pm_subject']) == '') { $rec['pm_subject'] = '['.LAN_PM_61.']'; }
|
||||
setScVar('pm_handler_shortcodes','pmInfo', $rec);
|
||||
$txt .= $this->e107->tp->parseTemplate($PM_INBOX_TABLE, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$txt .= $this->e107->tp->parseTemplate($PM_INBOX_EMPTY, true);
|
||||
}
|
||||
$txt .= $this->e107->tp->parseTemplate($PM_INBOX_FOOTER, true);
|
||||
$txt .= "</form>";
|
||||
return $txt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Show outbox
|
||||
* @param int $start - offset into list
|
||||
*
|
||||
* @return string text for display
|
||||
*/
|
||||
function show_outbox($start = 0)
|
||||
{
|
||||
$tpl_file = THEME.'pm_template.php';
|
||||
include(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/pm_template.php');
|
||||
$pmlist = $this->pm_get_outbox(USERID, $start, $this->pmPrefs['perpage']);
|
||||
setScVar('pm_handler_shortcodes', 'pmNextPrev', array('start' => $start, 'total' => $pmlist['total_messages']));
|
||||
$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
|
||||
$txt .= $this->e107->tp->parseTemplate($PM_OUTBOX_HEADER, true);
|
||||
if($pmlist['total_messages'])
|
||||
{
|
||||
foreach($pmlist['messages'] as $rec)
|
||||
{
|
||||
if(trim($rec['pm_subject']) == '') { $rec['pm_subject'] = '['.LAN_PM_61.']'; }
|
||||
setScVar('pm_handler_shortcodes','pmInfo', $rec);
|
||||
$txt .= $this->e107->tp->parseTemplate($PM_OUTBOX_TABLE, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$txt .= $this->e107->tp->parseTemplate($PM_OUTBOX_EMPTY, true);
|
||||
}
|
||||
$txt .= $this->e107->tp->parseTemplate($PM_OUTBOX_FOOTER, true);
|
||||
$txt .= '</form>';
|
||||
return $txt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Show details of a pm
|
||||
* @param int $pmid - DB ID for PM
|
||||
* @param string $comeFrom - inbox|outbox - determines whether inbox or outbox is shown after PM
|
||||
*
|
||||
* @return string text for display
|
||||
*/
|
||||
function show_pm($pmid, $comeFrom = '')
|
||||
{
|
||||
$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);
|
||||
if($pm_info['pm_to'] != USERID && $pm_info['pm_from'] != USERID)
|
||||
{
|
||||
$this->e107->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 .= $this->e107->tp->parseTemplate($PM_SHOW, true);
|
||||
$this->e107->ns->tablerender(LAN_PM, $txt);
|
||||
if (!$comeFrom)
|
||||
{
|
||||
if ($pm_info['pm_from'] == USERID) { $comeFrom = 'outbox'; }
|
||||
}
|
||||
if ($comeFrom == 'outbox')
|
||||
{ // Show Outbox
|
||||
$this->e107->ns->tablerender(LAN_PM." - ".LAN_PM_26, $this->show_outbox($pm_proc_id), 'PM');
|
||||
}
|
||||
else
|
||||
{ // Show Inbox
|
||||
$this->e107->ns->tablerender(LAN_PM." - ".LAN_PM_25, $this->show_inbox($pm_proc_id), 'PM');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Show list of blocked users
|
||||
* @param int $start - not used at present; offset into list
|
||||
*
|
||||
* @return string text for display
|
||||
*/
|
||||
public function showBlocked($start = 0)
|
||||
{
|
||||
$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?)
|
||||
setScVar('pm_handler_shortcodes','pmBlocks', $pmBlocks);
|
||||
$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
|
||||
$txt .= $this->e107->tp->parseTemplate($PM_BLOCKED_HEADER, true);
|
||||
if($pmTotalBlocked = count($pmBlocks))
|
||||
{
|
||||
foreach($pmBlocks as $pmBlocked)
|
||||
{
|
||||
setScVar('pm_handler_shortcodes','pmBlocked', $pmBlocked);
|
||||
$txt .= $this->e107->tp->parseTemplate($PM_BLOCKED_TABLE, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$txt .= $this->e107->tp->parseTemplate($PM_BLOCKED_EMPTY, true);
|
||||
}
|
||||
$txt .= $this->e107->tp->parseTemplate($PM_BLOCKED_FOOTER, true);
|
||||
$txt .= '</form>';
|
||||
return $txt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Send a PM based on $_POST parameters
|
||||
*
|
||||
* @return string text for display
|
||||
*/
|
||||
function post_pm()
|
||||
{
|
||||
if(!check_class($this->pmPrefs['pm_class']))
|
||||
{
|
||||
return LAN_PM_12;
|
||||
}
|
||||
|
||||
$pm_info = pm_getInfo('outbox');
|
||||
if($pm_info['outbox']['total'] != $_POST['numsent'])
|
||||
{
|
||||
return LAN_PM_14;
|
||||
}
|
||||
|
||||
if(isset($_POST['user']))
|
||||
{
|
||||
$_POST['pm_to'] = $_POST['user'];
|
||||
}
|
||||
if(isset($_POST['pm_to']))
|
||||
{
|
||||
$msg = '';
|
||||
if(isset($_POST['to_userclass']) && $_POST['to_userclass'])
|
||||
{
|
||||
if(!check_class($this->pmPrefs['opt_userclass']))
|
||||
{
|
||||
return LAN_PM_15;
|
||||
}
|
||||
elseif((!check_class($_POST['pm_userclass']) || !check_class($this->pmPrefs['multi_class'])) && !ADMIN)
|
||||
{
|
||||
return LAN_PM_16;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$to_array = explode("\n", trim($_POST['pm_to']));
|
||||
foreach($to_array as $k => $v)
|
||||
{
|
||||
$to_array[$k] = trim($v);
|
||||
}
|
||||
$to_array = array_unique($to_array);
|
||||
if(count($to_array) == 1)
|
||||
{
|
||||
$_POST['pm_to'] = $to_array[0];
|
||||
}
|
||||
if(check_class($this->pmPrefs['multi_class']) && count($to_array) > 1)
|
||||
{
|
||||
foreach($to_array as $to)
|
||||
{
|
||||
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)."'"))
|
||||
{
|
||||
$_POST['to_array'][] = $to_info;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($to_info = $this->pm_getuid($_POST['pm_to']))
|
||||
{
|
||||
$_POST['to_info'] = $to_info;
|
||||
}
|
||||
else
|
||||
{
|
||||
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']}'"))
|
||||
{
|
||||
return LAN_PM_18.$to_info['user_name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST['receipt']))
|
||||
{
|
||||
if(!check_class($this->pmPrefs['receipt_class']))
|
||||
{
|
||||
unset($_POST['receipt']);
|
||||
}
|
||||
}
|
||||
$totalsize = strlen($_POST['pm_message']);
|
||||
$maxsize = intval($this->pmPrefs['attach_size']) * 1024;
|
||||
foreach(array_keys($_FILES['file_userfile']['size']) as $fid)
|
||||
{
|
||||
if($maxsize > 0 && $_FILES['file_userfile']['size'][$fid] > $maxsize)
|
||||
{
|
||||
$msg .= str_replace("{FILENAME}", $_FILES['file_userfile']['name'][$fid], LAN_PM_62)."<br />";
|
||||
$_FILES['file_userfile']['size'][$fid] = 0;
|
||||
}
|
||||
$totalsize += $_FILES['file_userfile']['size'][$fid];
|
||||
}
|
||||
|
||||
if(intval($this->pmPrefs['pm_limit']) > 0)
|
||||
{
|
||||
if($this->pmPrefs['pm_limit'] == '1')
|
||||
{
|
||||
if($pm_info['outbox']['total'] == $pm_info['outbox']['limit'])
|
||||
{
|
||||
return LAN_PM_19;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($pm_info['outbox']['size'] + $totalsize > $pm_info['outbox']['limit'])
|
||||
{
|
||||
return LAN_PM_21;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($_FILES['file_userfile']['name'][0])
|
||||
{
|
||||
if(check_class($this->pmPrefs['attach_class']))
|
||||
{
|
||||
require_once(e_HANDLER.'upload_handler.php');
|
||||
$randnum = rand(1000, 9999);
|
||||
$_POST['uploaded'] = file_upload(e_PLUGIN.'pm/attachments', 'attachment', $randnum.'_');
|
||||
if($_POST['uploaded'] == FALSE)
|
||||
{
|
||||
unset($_POST['uploaded']);
|
||||
$msg .= LAN_PM_22."<br />";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg .= LAN_PM_23.'<br />';
|
||||
unset($_POST['uploaded']);
|
||||
}
|
||||
}
|
||||
$_POST['from_id'] = USERID;
|
||||
return $msg.$this->add($_POST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Look up users matching a keyword, output a list of those found
|
||||
* Direct echo
|
||||
*/
|
||||
function pm_user_lookup()
|
||||
{
|
||||
global $sql;
|
||||
|
||||
$query = "SELECT * FROM #user WHERE user_name REGEXP '^".$_POST['keyword']."' ";
|
||||
if($sql -> db_Select_gen($query))
|
||||
{
|
||||
echo '[';
|
||||
while($row = $sql-> db_Fetch())
|
||||
{
|
||||
$u[] = "{\"caption\":\"".$row['user_name']."\",\"value\":".$row['user_id']."}";
|
||||
}
|
||||
|
||||
echo implode(",",$u);
|
||||
echo ']';
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//$pm =& new private_message;
|
||||
$pm = new pm_extended($pm_prefs);
|
||||
|
||||
$message = '';
|
||||
$pmSource = '';
|
||||
if (isset($_POST['pm_come_from']))
|
||||
{
|
||||
@@ -182,7 +589,7 @@ require_once(HEADERF);
|
||||
|
||||
if(isset($_POST['postpm']))
|
||||
{
|
||||
$message = post_pm();
|
||||
$message = $pm->post_pm();
|
||||
$action = 'outbox';
|
||||
}
|
||||
|
||||
@@ -190,15 +597,18 @@ if(isset($_POST['postpm']))
|
||||
|
||||
if($message != '')
|
||||
{
|
||||
$ns->tablerender("", $message);
|
||||
$ns->tablerender('', $message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// DISPLAY TASKS
|
||||
//-----------------------------------------
|
||||
switch ($action)
|
||||
{
|
||||
case 'send' :
|
||||
$ns->tablerender(LAN_PM, show_send($pm_proc_id));
|
||||
$ns->tablerender(LAN_PM, $pm->show_send($pm_proc_id));
|
||||
break;
|
||||
|
||||
case 'reply' :
|
||||
@@ -211,7 +621,7 @@ switch ($action)
|
||||
}
|
||||
else
|
||||
{
|
||||
$ns->tablerender(LAN_PM, show_send());
|
||||
$ns->tablerender(LAN_PM, $pm->show_send($pm_info));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -221,19 +631,19 @@ switch ($action)
|
||||
break;
|
||||
|
||||
case 'inbox' :
|
||||
$ns->tablerender(LAN_PM." - ".LAN_PM_25, show_inbox($pm_proc_id), 'PM');
|
||||
$ns->tablerender(LAN_PM.' - '.LAN_PM_25, $pm->show_inbox($pm_proc_id), 'PM');
|
||||
break;
|
||||
|
||||
case 'outbox' :
|
||||
$ns->tablerender(LAN_PM." - ".LAN_PM_26, show_outbox($pm_proc_id), 'PM');
|
||||
$ns->tablerender(LAN_PM.' - '.LAN_PM_26, $pm->show_outbox($pm_proc_id), 'PM');
|
||||
break;
|
||||
|
||||
case 'show' :
|
||||
show_pm($pm_proc_id, $pmSource);
|
||||
$pm->show_pm($pm_proc_id, $pmSource);
|
||||
break;
|
||||
|
||||
case 'blocked' :
|
||||
$ns->tablerender(LAN_PM." - ".LAN_PM_66, showBlocked($pm_proc_id), 'PM');
|
||||
$ns->tablerender(LAN_PM.' - '.LAN_PM_66, $pm->showBlocked($pm_proc_id), 'PM');
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -246,323 +656,5 @@ exit;
|
||||
|
||||
|
||||
|
||||
function show_send($to_uid)
|
||||
{
|
||||
global $tp, $pm_info, $pm_prefs;
|
||||
$pm_outbox = pm_getInfo('outbox');
|
||||
if($to_uid)
|
||||
{
|
||||
$sql2 =& new db;
|
||||
if($sql2->db_Select('user', 'user_name', "user_id = '".intval($to_uid)."'"))
|
||||
{
|
||||
$row=$sql2->db_Fetch();
|
||||
$pm_info['from_name'] = $row['user_name'];
|
||||
}
|
||||
}
|
||||
|
||||
if($pm_outbox['outbox']['filled'] >= 100)
|
||||
{
|
||||
return str_replace('{PERCENT}', $pm_outbox['outbox']['filled'], LAN_PM_13);
|
||||
}
|
||||
require_once(e_PLUGIN.'pm/pm_shortcodes.php');
|
||||
$tpl_file = THEME."pm_template.php";
|
||||
include_once(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/pm_template.php');
|
||||
$enc = (check_class($pm_prefs['attach_class']) ? "enctype='multipart/form-data'" : "");
|
||||
$text = "<form {$enc} method='post' action='".e_SELF."' id='dataform'>
|
||||
<div><input type='hidden' name='numsent' value='{$pm_outbox['outbox']['total']}' />".
|
||||
$tp->parseTemplate($PM_SEND_PM, TRUE, $pm_shortcodes).
|
||||
"</div></form>";
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function show_inbox($start = 0)
|
||||
{
|
||||
global $pm, $tp, $pm_shortcodes, $pm_info, $pm_blocks, $pmlist, $pm_start, $pm_prefs;
|
||||
$pm_start = $start;
|
||||
require_once(e_PLUGIN."pm/pm_shortcodes.php");
|
||||
$tpl_file = THEME."pm_template.php";
|
||||
include(is_readable($tpl_file) ? $tpl_file : e_PLUGIN."pm/pm_template.php");
|
||||
$pm_blocks = $pm->block_get();
|
||||
$pmlist = $pm->pm_get_inbox(USERID, $pm_start, $pm_prefs['perpage']);
|
||||
$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
|
||||
$txt .= $tp->parseTemplate($PM_INBOX_HEADER, true, $pm_shortcodes);
|
||||
if($pmlist['total_messages'])
|
||||
{
|
||||
foreach($pmlist['messages'] as $rec)
|
||||
{
|
||||
if(trim($rec['pm_subject']) == '') { $rec['pm_subject'] = "[".LAN_PM_61."]"; }
|
||||
$pm_info = $rec;
|
||||
$txt .= $tp->parseTemplate($PM_INBOX_TABLE, true, $pm_shortcodes);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$txt .= $tp->parseTemplate($PM_INBOX_EMPTY, true, $pm_shortcodes);
|
||||
}
|
||||
$txt .= $tp->parseTemplate($PM_INBOX_FOOTER, true, $pm_shortcodes);
|
||||
$txt .= "</form>";
|
||||
return $txt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function show_outbox($start = 0)
|
||||
{
|
||||
global $pm, $tp, $pm_shortcodes, $pm_info, $pm_start, $pm_prefs, $pmlist;
|
||||
$pm_start = $start;
|
||||
require_once(e_PLUGIN.'pm/pm_shortcodes.php');
|
||||
$tpl_file = THEME.'pm_template.php';
|
||||
include(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/pm_template.php');
|
||||
$pmlist = $pm->pm_get_outbox(USERID, $pm_start, $pm_prefs['perpage']);
|
||||
$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
|
||||
$txt .= $tp->parseTemplate($PM_OUTBOX_HEADER, true, $pm_shortcodes);
|
||||
if($pmlist['total_messages'])
|
||||
{
|
||||
foreach($pmlist['messages'] as $rec)
|
||||
{
|
||||
if(trim($rec['pm_subject']) == '') { $rec['pm_subject'] = '['.LAN_PM_61.']'; }
|
||||
$pm_info = $rec;
|
||||
$txt .= $tp->parseTemplate($PM_OUTBOX_TABLE, true, $pm_shortcodes);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$txt .= $tp->parseTemplate($PM_OUTBOX_EMPTY, true, $pm_shortcodes);
|
||||
}
|
||||
$txt .= $tp->parseTemplate($PM_OUTBOX_FOOTER, true, $pm_shortcodes);
|
||||
$txt .= "</form>";
|
||||
return $txt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function show_pm($pmid, $comeFrom = '')
|
||||
{
|
||||
global $pm, $tp, $pm_shortcodes, $pm_info, $ns;
|
||||
require_once(e_PLUGIN.'pm/pm_shortcodes.php');
|
||||
$tpl_file = THEME.'pm_template.php';
|
||||
include_once(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/pm_template.php');
|
||||
$pm_info = $pm->pm_get($pmid);
|
||||
if($pm_info['pm_to'] != USERID && $pm_info['pm_from'] != USERID)
|
||||
{
|
||||
$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;
|
||||
$pm->pm_mark_read($pmid, $pm_info);
|
||||
}
|
||||
$txt .= $tp->parseTemplate($PM_SHOW, true, $pm_shortcodes);
|
||||
$ns -> tablerender(LAN_PM, $txt);
|
||||
if (!$comeFrom)
|
||||
{
|
||||
if ($pm_info['pm_from'] == USERID) { $comeFrom = 'outbox'; }
|
||||
}
|
||||
if ($comeFrom == 'outbox')
|
||||
{ // Show Outbox
|
||||
$ns->tablerender(LAN_PM." - ".LAN_PM_26, show_outbox($pm_proc_id), 'PM');
|
||||
}
|
||||
else
|
||||
{ // Show Inbox
|
||||
$ns->tablerender(LAN_PM." - ".LAN_PM_25, show_inbox($pm_proc_id), 'PM');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function post_pm()
|
||||
{
|
||||
global $pm_prefs, $pm, $pref, $sql, $tp;
|
||||
if(!check_class($pm_prefs['pm_class']))
|
||||
{
|
||||
return LAN_PM_12;
|
||||
}
|
||||
|
||||
$pm_info = pm_getInfo('outbox');
|
||||
if($pm_info['outbox']['total'] != $_POST['numsent'])
|
||||
{
|
||||
return LAN_PM_14;
|
||||
}
|
||||
|
||||
if(isset($_POST['user']))
|
||||
{
|
||||
$_POST['pm_to'] = $_POST['user'];
|
||||
}
|
||||
if(isset($_POST['pm_to']))
|
||||
{
|
||||
$msg = '';
|
||||
if(isset($_POST['to_userclass']) && $_POST['to_userclass'])
|
||||
{
|
||||
if(!$pm_prefs['allow_userclass'])
|
||||
{
|
||||
return LAN_PM_15;
|
||||
}
|
||||
elseif((!check_class($_POST['pm_userclass']) || !check_class($pm_prefs['multi_class'])) && !ADMIN)
|
||||
{
|
||||
return LAN_PM_16;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$to_array = explode("\n", trim($_POST['pm_to']));
|
||||
foreach($to_array as $k => $v)
|
||||
{
|
||||
$to_array[$k] = trim($v);
|
||||
}
|
||||
$to_array = array_unique($to_array);
|
||||
if(count($to_array) == 1)
|
||||
{
|
||||
$_POST['pm_to'] = $to_array[0];
|
||||
}
|
||||
if(check_class($pm_prefs['multi_class']) && count($to_array) > 1)
|
||||
{
|
||||
foreach($to_array as $to)
|
||||
{
|
||||
if($to_info = $pm->pm_getuid($to))
|
||||
{
|
||||
if(!$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)."'"))
|
||||
{
|
||||
$_POST['to_array'][] = $to_info;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($to_info = $pm->pm_getuid($_POST['pm_to']))
|
||||
{
|
||||
$_POST['to_info'] = $to_info;
|
||||
}
|
||||
else
|
||||
{
|
||||
return LAN_PM_17;
|
||||
}
|
||||
|
||||
if($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']}'"))
|
||||
{
|
||||
return LAN_PM_18.$to_info['user_name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST['receipt']))
|
||||
{
|
||||
if(!check_class($pm_prefs['receipt_class']))
|
||||
{
|
||||
unset($_POST['receipt']);
|
||||
}
|
||||
}
|
||||
$totalsize = strlen($_POST['pm_message']);
|
||||
$maxsize = intval($pm_prefs['attach_size']) * 1024;
|
||||
foreach(array_keys($_FILES['file_userfile']['size']) as $fid)
|
||||
{
|
||||
if($maxsize > 0 && $_FILES['file_userfile']['size'][$fid] > $maxsize)
|
||||
{
|
||||
$msg .= str_replace("{FILENAME}", $_FILES['file_userfile']['name'][$fid], LAN_PM_62)."<br />";
|
||||
$_FILES['file_userfile']['size'][$fid] = 0;
|
||||
}
|
||||
$totalsize += $_FILES['file_userfile']['size'][$fid];
|
||||
}
|
||||
|
||||
if(intval($pref['pm_limit']) > 0)
|
||||
{
|
||||
if($pref['pm_limit'] == '1')
|
||||
{
|
||||
if($pm_info['outbox']['total'] == $pm_info['outbox']['limit'])
|
||||
{
|
||||
return LAN_PM_19;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($pm_info['outbox']['size'] + $totalsize > $pm_info['outbox']['limit'])
|
||||
{
|
||||
return LAN_PM_21;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($_FILES['file_userfile']['name'][0])
|
||||
{
|
||||
if(check_class($pm_prefs['attach_class']))
|
||||
{
|
||||
require_once(e_HANDLER."upload_handler.php");
|
||||
$randnum = rand(1000, 9999);
|
||||
$_POST['uploaded'] = file_upload(e_PLUGIN."pm/attachments", "attachment", $randnum."_");
|
||||
if($_POST['uploaded'] == FALSE)
|
||||
{
|
||||
unset($_POST['uploaded']);
|
||||
$msg .= LAN_PM_22."<br />";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg .= LAN_PM_23."<br />";
|
||||
unset($_POST['uploaded']);
|
||||
}
|
||||
}
|
||||
$_POST['from_id'] = USERID;
|
||||
return $msg.$pm->add($_POST);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function pm_user_lookup()
|
||||
{
|
||||
global $sql;
|
||||
|
||||
|
||||
$query = "SELECT * FROM #user WHERE user_name REGEXP '^".$_POST['keyword']."' ";
|
||||
if($sql -> db_Select_gen($query))
|
||||
{
|
||||
echo "[";
|
||||
while($row = $sql-> db_Fetch())
|
||||
{
|
||||
$u[] = "{\"caption\":\"".$row['user_name']."\",\"value\":".$row['user_id']."}";
|
||||
}
|
||||
|
||||
echo implode(",",$u);
|
||||
echo "]";
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
function showBlocked($start = 0)
|
||||
{
|
||||
global $pm, $tp, $pm_shortcodes, $pmBlocked, $pmTotalBlocked, $pm_start, $pm_prefs ;
|
||||
$pm_start = $start;
|
||||
require_once(e_PLUGIN.'pm/pm_shortcodes.php');
|
||||
$tpl_file = THEME.'pm_template.php';
|
||||
include(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/pm_template.php');
|
||||
$pmBlocks = $pm->block_get_user(); // TODO - handle pagination, maybe (is it likely to be necessary?)
|
||||
$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
|
||||
$txt .= $tp->parseTemplate($PM_BLOCKED_HEADER, true, $pm_shortcodes);
|
||||
if($pmTotalBlocked = count($pmBlocks))
|
||||
{
|
||||
foreach($pmBlocks as $pmBlocked)
|
||||
{
|
||||
$txt .= $tp->parseTemplate($PM_BLOCKED_TABLE, true, $pm_shortcodes);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$txt .= $tp->parseTemplate($PM_BLOCKED_EMPTY, true, $pm_shortcodes);
|
||||
}
|
||||
$txt .= $tp->parseTemplate($PM_BLOCKED_FOOTER, true, $pm_shortcodes);
|
||||
$txt .= "</form>";
|
||||
return $txt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
@@ -9,8 +9,8 @@
|
||||
* PM Plugin - administration
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/pm/pm_conf.php,v $
|
||||
* $Revision: 1.9 $
|
||||
* $Date: 2009-12-13 12:32:28 $
|
||||
* $Revision: 1.10 $
|
||||
* $Date: 2009-12-16 20:23:35 $
|
||||
* $Author: e107steved $
|
||||
*/
|
||||
|
||||
@@ -20,11 +20,11 @@ TODO:
|
||||
1. Limits page needs some lines round the table
|
||||
2. Limits page - test
|
||||
3. Maintenance page - to be tested
|
||||
4. Check operation of user dropdown bit
|
||||
4. Check operation of user dropdown/popup bit
|
||||
5. User option to enable/disable email notification of PMs
|
||||
6. Cron-triggered bulk send.
|
||||
7. Is it right that limits are saved in $pref, not $pm_prefs? If not, import routine/change
|
||||
8. Put prefs into plugin.xml?
|
||||
7. What are implications of 'anyone but' userclasses?
|
||||
8. Put prefs into plugin.xml
|
||||
*/
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ if (!e107::isInstalled('pm') || !getperms('P'))
|
||||
}
|
||||
|
||||
require_once(e_PLUGIN.'pm/pm_class.php');
|
||||
require_once(e_HANDLER.'userclass_class.php');
|
||||
//require_once(e_HANDLER.'userclass_class.php'); Should already be loaded
|
||||
require_once(e_HANDLER.'form_handler.php');
|
||||
require_once (e_HANDLER.'message_handler.php');
|
||||
$emessage = &eMessage :: getInstance();
|
||||
@@ -53,6 +53,7 @@ if($action == '')
|
||||
$action = 'main';
|
||||
}
|
||||
|
||||
|
||||
$pm_prefs = $sysprefs->getArray('pm_prefs');
|
||||
|
||||
//pm_prefs record not found in core table, set to defaults and create record
|
||||
@@ -66,6 +67,39 @@ if(!is_array($pm_prefs))
|
||||
}
|
||||
|
||||
|
||||
// Couple of bits of BC/upgrade
|
||||
$savePMP = FALSE;
|
||||
if (isset($pref['pm_limits']))
|
||||
{
|
||||
if (!isset($pm_prefs['pm_limits']))
|
||||
{
|
||||
$pm_prefs['pm_limits'] = $pref['pm_limits'];
|
||||
$savePMP = TRUE;
|
||||
}
|
||||
unset($pref['pm_limits']);
|
||||
save_prefs();
|
||||
}
|
||||
|
||||
if (isset($pm_prefs['allow_userclass']))
|
||||
{
|
||||
if (!isset($pm_prefs['opt_userclass']))
|
||||
{
|
||||
$pm_prefs['opt_userclass'] = e_UC_NOBODY;
|
||||
if ($pm_prefs['allow_userclass'])
|
||||
{
|
||||
$pm_prefs['opt_userclass'] = e_UC_MEMBERS;
|
||||
}
|
||||
}
|
||||
unset($pm_prefs['allow_userclass']);
|
||||
$savePMP = TRUE;
|
||||
}
|
||||
|
||||
if ($savePMP)
|
||||
{
|
||||
$sysprefs->setArray('pm_prefs');
|
||||
$emessage->add(ADLAN_PM_80, E_MESSAGE_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
//$lan_file = e_PLUGIN.'pm/languages/admin/'.e_LANGUAGE.'.php';
|
||||
// include_once(is_readable($lan_file) ? $lan_file : e_PLUGIN."pm/languages/admin/English.php");
|
||||
@@ -98,7 +132,6 @@ if (isset($_POST['update_prefs']))
|
||||
if (isset($_POST['pm_maint_execute']))
|
||||
{
|
||||
$maintOpts = array();
|
||||
$emessage->add('Starting maintenance', E_MESSAGE_INFO);
|
||||
if (vartrue($_POST['pm_maint_sent']))
|
||||
{
|
||||
$maintOpts['sent'] = 1;
|
||||
@@ -167,10 +200,10 @@ if(isset($_POST['addlimit']))
|
||||
if(isset($_POST['updatelimits']))
|
||||
{
|
||||
$limitVal = intval($_POST['pm_limits']);
|
||||
if($pref['pm_limits'] != $limitVal)
|
||||
if($pm_prefs['pm_limits'] != $limitVal)
|
||||
{
|
||||
$pref['pm_limits'] = $limitVal;
|
||||
save_prefs();
|
||||
$pm_prefs['pm_limits'] = $limitVal;
|
||||
$sysprefs->setArray('pm_prefs');
|
||||
$emessage->add(ADLAN_PM_8, E_MESSAGE_SUCCESS);
|
||||
}
|
||||
foreach(array_keys($_POST['inbox_count']) as $id)
|
||||
@@ -226,8 +259,8 @@ switch ($action)
|
||||
$ns->tablerender(ADLAN_PM_12, show_options($pm_prefs));
|
||||
break;
|
||||
case 'limits' :
|
||||
$ns->tablerender(ADLAN_PM_14, show_limits());
|
||||
$ns->tablerender(ADLAN_PM_15, add_limit());
|
||||
$ns->tablerender(ADLAN_PM_14, show_limits($pm_prefs));
|
||||
$ns->tablerender(ADLAN_PM_15, add_limit($pm_prefs));
|
||||
break;
|
||||
case 'maint' :
|
||||
$ns->tablerender(ADLAN_PM_60, show_maint($pm_prefs));
|
||||
@@ -290,7 +323,7 @@ function show_options($pm_prefs)
|
||||
</tr>
|
||||
<tr>
|
||||
<td>".ADLAN_PM_23."</td>
|
||||
<td>".r_userclass('pm_option-pm_class', $pm_prefs['pm_class'], 'off', 'member,admin,classes')."</td>
|
||||
<td>".e107::getUserClass()->uc_dropdown('pm_option-pm_class', $pm_prefs['pm_class'], 'member,admin,classes')."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>".ADLAN_PM_24."</td>
|
||||
@@ -298,15 +331,15 @@ function show_options($pm_prefs)
|
||||
</tr>
|
||||
<tr>
|
||||
<td>".ADLAN_PM_25."</td>
|
||||
<td>".r_userclass('pm_option-notify_class', $pm_prefs['notify_class'], 'off', 'nobody,member,admin,classes')."</td>
|
||||
<td>".e107::getUserClass()->uc_dropdown('pm_option-notify_class', $pm_prefs['notify_class'], 'nobody,member,admin,classes')."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>".ADLAN_PM_26."</td>
|
||||
<td>".r_userclass('pm_option-receipt_class', $pm_prefs['receipt_class'], 'off', 'nobody,member,admin,classes')."</td>
|
||||
<td>".e107::getUserClass()->uc_dropdown('pm_option-receipt_class', $pm_prefs['receipt_class'], 'nobody,member,admin,classes')."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>".ADLAN_PM_27."</td>
|
||||
<td>".r_userclass('pm_option-attach_class', $pm_prefs['attach_class'], 'off', 'nobody,member,admin,classes')."</td>
|
||||
<td>".e107::getUserClass()->uc_dropdown('pm_option-attach_class', $pm_prefs['attach_class'], 'nobody,member,admin,classes')."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>".ADLAN_PM_28."</td>
|
||||
@@ -314,15 +347,15 @@ function show_options($pm_prefs)
|
||||
</tr>
|
||||
<tr>
|
||||
<td>".ADLAN_PM_29."</td>
|
||||
<td>".r_userclass('pm_option-sendall_class', $pm_prefs['sendall_class'], 'off', 'nobody,member,admin,classes')."</td>
|
||||
<td>".e107::getUserClass()->uc_dropdown('pm_option-sendall_class', $pm_prefs['sendall_class'], 'nobody,member,admin,classes')."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>".ADLAN_PM_30."</td>
|
||||
<td>".r_userclass('pm_option-multi_class', $pm_prefs['multi_class'], 'off', 'nobody,member,admin,classes')."</td>
|
||||
<td>".e107::getUserClass()->uc_dropdown('pm_option-multi_class', $pm_prefs['multi_class'], 'nobody,member,admin,classes')."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>".ADLAN_PM_31."</td>
|
||||
<td>".yes_no('pm_option-allow_userclass', $pm_prefs['allow_userclass'])."</td>
|
||||
<td>".e107::getUserClass()->uc_dropdown('pm_option-opt_userclass', $pm_prefs['opt_userclass'], 'nobody,member,admin,classes')."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' style='text-align:center'><input type='submit' class='button' name='update_prefs' value='".ADLAN_PM_32."' /></td>
|
||||
@@ -339,11 +372,11 @@ function show_options($pm_prefs)
|
||||
|
||||
|
||||
|
||||
function show_limits()
|
||||
function show_limits($pm_prefs)
|
||||
{
|
||||
global $sql, $pref;
|
||||
global $sql;
|
||||
|
||||
if (!isset($pref['pm_limits'])) { $pref['pm_limits'] = 0; }
|
||||
if (!isset($pm_prefs['pm_limits'])) { $pm_prefs['pm_limits'] = 0; }
|
||||
|
||||
if($sql->db_Select('generic', "gen_id as limit_id, gen_datestamp as limit_classnum, gen_user_id as inbox_count, gen_ip as outbox_count, gen_intdata as inbox_size, gen_chardata as outbox_size", "gen_type = 'pm_limit'"))
|
||||
{
|
||||
@@ -354,7 +387,7 @@ function show_limits()
|
||||
}
|
||||
$txt = "
|
||||
<fieldset id='plugin-pm-showlimits'>
|
||||
<form method='post' action='".e_SELF."'>
|
||||
<form method='post' action='".e_SELF.'?'.e_QUERY."'>
|
||||
<table cellpadding='0' cellspacing='0' class='adminedit'>
|
||||
<colgroup span='3'>
|
||||
<col class='col-label' />
|
||||
@@ -366,13 +399,13 @@ function show_limits()
|
||||
<td colspan='3' style='text-align:left'>".ADLAN_PM_45."
|
||||
<select name='pm_limits' class='tbox'>
|
||||
";
|
||||
$sel = ($pref['pm_limits'] == 0 ? "selected='selected'" : "");
|
||||
$sel = ($pm_prefs['pm_limits'] == 0 ? "selected='selected'" : "");
|
||||
$txt .= "<option value='0' {$sel}>".ADLAN_PM_33."</option>\n";
|
||||
|
||||
$sel = ($pref['pm_limits'] == 1 ? "selected='selected'" : "");
|
||||
$sel = ($pm_prefs['pm_limits'] == 1 ? "selected='selected'" : "");
|
||||
$txt .= "<option value='1' {$sel}>".ADLAN_PM_34."</option>\n";
|
||||
|
||||
$sel = ($pref['pm_limits'] == 2 ? "selected='selected'" : "");
|
||||
$sel = ($pm_prefs['pm_limits'] == 2 ? "selected='selected'" : "");
|
||||
$txt .= "<option value='2' {$sel}>".ADLAN_PM_35."</option>\n";
|
||||
|
||||
$txt .= "</select>\n";
|
||||
@@ -393,7 +426,7 @@ function show_limits()
|
||||
{
|
||||
$txt .= "
|
||||
<tr>
|
||||
<td>".r_userclass_name($row['limit_classnum'])."</td>
|
||||
<td>".e107::getUserClass()->uc_get_classname($row['limit_classnum'])."</td>
|
||||
<td>
|
||||
".ADLAN_PM_39."<input type='text' class='tbox' size='5' name='inbox_count[{$row['limit_id']}]' value='{$row['inbox_count']}' />
|
||||
".ADLAN_PM_40."<input type='text' class='tbox' size='5' name='outbox_count[{$row['limit_id']}]' value='{$row['outbox_count']}' />
|
||||
@@ -434,10 +467,10 @@ function show_limits()
|
||||
|
||||
|
||||
|
||||
function add_limit()
|
||||
function add_limit($pm_prefs)
|
||||
{
|
||||
global $sql, $pref;
|
||||
if($sql->db_Select("generic", "gen_id as limit_id, gen_datestamp as limit_classnum, gen_user_id as inbox_count, gen_ip as outbox_count, gen_intdata as inbox_size, gen_chardata as outbox_size", "gen_type = 'pm_limit'"))
|
||||
global $sql;
|
||||
if($sql->db_Select('generic', "gen_id as limit_id, gen_datestamp as limit_classnum, gen_user_id as inbox_count, gen_ip as outbox_count, gen_intdata as inbox_size, gen_chardata as outbox_size", "gen_type = 'pm_limit'"))
|
||||
{
|
||||
while($row = $sql->db_Fetch())
|
||||
{
|
||||
@@ -446,7 +479,7 @@ function add_limit()
|
||||
}
|
||||
$txt = "
|
||||
<fieldset id='plugin-pm-addlimit'>
|
||||
<form method='post' action='".e_SELF."?".e_QUERY."'>
|
||||
<form method='post' action='".e_SELF.'?'.e_QUERY."'>
|
||||
<table cellpadding='0' cellspacing='0' class='adminedit'>
|
||||
<colgroup span='3'>
|
||||
<col class='col-label' />
|
||||
@@ -463,7 +496,7 @@ function add_limit()
|
||||
|
||||
$txt .= "
|
||||
<tr>
|
||||
<td>".r_userclass("newlimit_class", 0, "off", "guest,member,admin,classes,language")."</td>
|
||||
<td>".e107::getUserClass()->uc_dropdown('newlimit_class', 0, 'guest,member,admin,classes')."</td>
|
||||
<td>
|
||||
".ADLAN_PM_39."<input type='text' class='tbox' size='5' name='new_inbox_count' value='' />
|
||||
".ADLAN_PM_40."<input type='text' class='tbox' size='5' name='new_outbox_count' value='' />
|
||||
@@ -584,7 +617,7 @@ function doMaint($opts, $pmPrefs)
|
||||
return array(E_MESSAGE_ERROR => array(ADLAN_PM_66));
|
||||
}
|
||||
|
||||
$results = array(E_MESSAGE_INFO => array(ADLAN_PM_67));
|
||||
$results = array(E_MESSAGE_INFO => array(ADLAN_PM_67)); // 'Maintenance started' - primarily for a log entry to mark start time
|
||||
$logResults = array();
|
||||
$e107 = e107::getInstance();
|
||||
$e107->admin_log->log_event('PM_ADM_04', implode(', ',array_keys($opts)));
|
||||
@@ -754,6 +787,13 @@ function doMaint($opts, $pmPrefs)
|
||||
|
||||
|
||||
$e107->admin_log->logArrayAll('PM_ADM_03',makeLogEntry($results));
|
||||
foreach ($results as $k => $r)
|
||||
{
|
||||
foreach ($r as $sk => $s)
|
||||
{
|
||||
$results[$k][$sk] = str_replace('[!br!]','<br />',$s);
|
||||
}
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
@@ -9,429 +9,530 @@
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/pm/pm_shortcodes.php,v $
|
||||
* $Revision: 1.15 $
|
||||
* $Date: 2009-12-13 21:52:32 $
|
||||
* $Revision: 1.16 $
|
||||
* $Date: 2009-12-16 20:23:37 $
|
||||
* $Author: e107steved $
|
||||
*/
|
||||
|
||||
// Note: all shortcodes now begin with 'PM', so some changes from previous versions
|
||||
|
||||
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
include_once(e_HANDLER.'shortcode_handler.php');
|
||||
|
||||
include_lan(e_PLUGIN.'pm/languages/'.e_LANGUAGE.'.php');
|
||||
include_once(e_PLUGIN.'pm/pm_func.php');
|
||||
$pm_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
|
||||
register_shortcode('pm_handler_shortcodes', true);
|
||||
initShortcodeClass('pm_handler_shortcodes');
|
||||
|
||||
|
||||
/*
|
||||
SC_BEGIN FORM_TOUSER
|
||||
global $pm_prefs, $pm_info;
|
||||
if($pm_info['from_name'])
|
||||
{
|
||||
return "<input type='hidden' name='pm_to' value='{$pm_info['from_name']}' />{$pm_info['from_name']}";
|
||||
}
|
||||
require_once(e_HANDLER."user_select_class.php");
|
||||
$us = new user_select;
|
||||
$type = ($pm_prefs['dropdown'] == TRUE ? 'list' : 'popup');
|
||||
if(check_class($pm_prefs['multi_class']))
|
||||
{
|
||||
$ret = $us->select_form($type, 'textarea.pm_to');
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret = $us->select_form($type, 'pm_to');
|
||||
}
|
||||
return $ret;
|
||||
SC_END
|
||||
|
||||
|
||||
SC_BEGIN FORM_TOCLASS
|
||||
global $pm_prefs, $pm_info;
|
||||
if($pm_info['from_name'])
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if($pm_prefs['allow_userclass'] && check_class($pm_prefs['multi_class']))
|
||||
{
|
||||
$ret = "<input type='checkbox' name='to_userclass' value='1' />".LAN_PM_4." ";
|
||||
require_once(e_HANDLER."userclass_class.php");
|
||||
$args = (ADMIN ? "admin, classes" : "classes, matchclass");
|
||||
if(check_class($pm_prefs['sendall_class']))
|
||||
{
|
||||
$args = "member, ".$args;
|
||||
}
|
||||
$ret .= r_userclass("pm_userclass", "", "off", $args);
|
||||
if (strpos($ret,'option') === FALSE) $ret = '';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
SC_END
|
||||
|
||||
SC_BEGIN FORM_SUBJECT
|
||||
global $pm_info;
|
||||
$value = "";
|
||||
if($pm_info['pm_subject'])
|
||||
{
|
||||
$value = $pm_info['pm_subject'];
|
||||
if(substr($value, 0, strlen(LAN_PM_58)) != LAN_PM_58)
|
||||
{
|
||||
$value = LAN_PM_58.$value;
|
||||
}
|
||||
}
|
||||
return "<input class='tbox' type='text' name='pm_subject' value='{$value}' size='63' maxlength='255' />";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN FORM_MESSAGE
|
||||
global $pm_info;
|
||||
$value = "";
|
||||
if($pm_info['pm_text'])
|
||||
{
|
||||
if(isset($_POST['quote']))
|
||||
{
|
||||
$t = time();
|
||||
$value = "[quote{$t}={$pm_info['from_name']}]\n{$pm_info['pm_text']}\n[/quote{$t}]\n\n";
|
||||
}
|
||||
}
|
||||
return "<textarea class='tbox' name='pm_message' cols='60' rows='10' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>{$value}</textarea>";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN EMOTES
|
||||
require_once(e_HANDLER."emote.php");
|
||||
return r_emote();
|
||||
SC_END
|
||||
|
||||
SC_BEGIN PM_POST_BUTTON
|
||||
return "<input class='button' type='submit' name='postpm' value='".LAN_PM_1."' />";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN PM_PREVIEW_BUTTON
|
||||
return "<input class='button' type='submit' name='postpm' value='".LAN_PM_3."' />";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN ATTACHMENT
|
||||
global $pm_prefs;
|
||||
if (check_class($pm_prefs['attach_class']))
|
||||
{
|
||||
$ret = "
|
||||
<div id='up_container' >
|
||||
<span id='upline' style='white-space:nowrap'>
|
||||
<input class='tbox' type='file' name='file_userfile[]' size='40' />
|
||||
</span>
|
||||
</div>
|
||||
<input type='button' class='button' value='".LAN_PM_11."' onclick=\"duplicateHTML('upline','up_container');\" />
|
||||
";
|
||||
return $ret;
|
||||
}
|
||||
return "";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN PM_ATTACHMENT_ICON
|
||||
global $pm_info;
|
||||
if($pm_info['pm_attachments'] != "")
|
||||
{
|
||||
return ATTACHMENT_ICON;
|
||||
}
|
||||
SC_END
|
||||
|
||||
SC_BEGIN PM_ATTACHMENTS
|
||||
global $pm_info;
|
||||
if($pm_info['pm_attachments'] != "")
|
||||
{
|
||||
$attachments = explode(chr(0), $pm_info['pm_attachments']);
|
||||
$i = 0;
|
||||
foreach($attachments as $a)
|
||||
{
|
||||
list($timestamp, $fromid, $rand, $filename) = explode("_", $a, 4);
|
||||
$ret .= "<a href='".e_SELF."?get.{$pm_info['pm_id']}.{$i}'>{$filename}</a><br />";
|
||||
$i++;
|
||||
}
|
||||
$ret = substr($ret, 0, -3);
|
||||
return $ret;
|
||||
}
|
||||
SC_END
|
||||
|
||||
SC_BEGIN RECEIPT
|
||||
global $pm_prefs;
|
||||
if (check_class($pm_prefs['receipt_class']))
|
||||
{
|
||||
return "<input type='checkbox' name='receipt' value='1' />".LAN_PM_10;
|
||||
}
|
||||
return "";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN INBOX_TOTAL
|
||||
$pm_inbox = pm_getInfo('inbox');
|
||||
return $pm_inbox['inbox']['total'];
|
||||
SC_END
|
||||
|
||||
SC_BEGIN INBOX_UNREAD
|
||||
$pm_inbox = pm_getInfo('inbox');
|
||||
return intval($pm_inbox['inbox']['unread']);
|
||||
SC_END
|
||||
|
||||
SC_BEGIN INBOX_FILLED
|
||||
$pm_inbox = pm_getInfo('inbox');
|
||||
return (intval($pm_inbox['inbox']['filled']) > 0 ? $pm_inbox['inbox']['filled'] : "");
|
||||
SC_END
|
||||
|
||||
SC_BEGIN OUTBOX_TOTAL
|
||||
$pm_outbox = pm_getInfo('outbox');
|
||||
return $pm_outbox['outbox']['total'];
|
||||
SC_END
|
||||
|
||||
SC_BEGIN OUTBOX_UNREAD
|
||||
$pm_outbox = pm_getInfo('outbox');
|
||||
return intval($pm_outbox['outbox']['unread']);
|
||||
SC_END
|
||||
|
||||
SC_BEGIN OUTBOX_FILLED
|
||||
$pm_outbox = pm_getInfo('outbox');
|
||||
return (intval($pm_outbox['outbox']['filled']) > 0 ? $pm_outbox['outbox']['filled'] : "");
|
||||
SC_END
|
||||
|
||||
SC_BEGIN PM_DATE
|
||||
global $pm_info;
|
||||
require_once(e_HANDLER."date_handler.php");
|
||||
if("lapse" != $parm)
|
||||
{
|
||||
return convert::convert_date($pm_info['pm_sent'], $parm);
|
||||
}
|
||||
else
|
||||
{
|
||||
return convert::computeLapse($pm_info['pm_sent']);
|
||||
}
|
||||
SC_END
|
||||
|
||||
SC_BEGIN PM_READ
|
||||
global $pm_info;
|
||||
if($pm_info['pm_read'] == 0)
|
||||
{
|
||||
return LAN_PM_27;
|
||||
}
|
||||
if($pm_info['pm_read'] == 1)
|
||||
{
|
||||
return LAN_PM_28;
|
||||
}
|
||||
require_once(e_HANDLER."date_handler.php");
|
||||
if("lapse" != $parm)
|
||||
{
|
||||
return convert::convert_date($pm_info['pm_read'], $parm);
|
||||
}
|
||||
else
|
||||
{
|
||||
return convert::computeLapse($pm_info['pm_read']);
|
||||
}
|
||||
SC_END
|
||||
|
||||
|
||||
SC_BEGIN PM_FROM_TO
|
||||
global $pm_info, $tp;
|
||||
if($pm_info['pm_from'] == USERID)
|
||||
{
|
||||
$ret = LAN_PM_2.": <br />";
|
||||
$pm_info['user_name'] = $pm_info['sent_name'];
|
||||
$ret .= $tp->parseTemplate("{PM_TO=link}");
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret = LAN_PM_31.": <br />";
|
||||
$pm_info['user_name'] = $pm_info['from_name'];
|
||||
$ret .= $tp->parseTemplate("{PM_FROM=link}");
|
||||
}
|
||||
return $ret;
|
||||
SC_END
|
||||
|
||||
SC_BEGIN PM_SUBJECT
|
||||
global $pm_info, $tp;
|
||||
$ret = $tp->toHTML($pm_info['pm_subject'], true, 'USER_TITLE');
|
||||
$prm = explode(',',$parm);
|
||||
if('link' == $prm[0])
|
||||
{
|
||||
$extra = '';
|
||||
if (isset($prm[1])) $extra = '.'.$prm[1];
|
||||
$ret = "<a href='".e_PLUGIN_ABS."pm/pm.php?show.{$pm_info['pm_id']}{$extra}'>".$ret."</a>";
|
||||
}
|
||||
return $ret;
|
||||
SC_END
|
||||
|
||||
SC_BEGIN PM_FROM
|
||||
global $pm_info;
|
||||
if("link" == $parm)
|
||||
{
|
||||
return "<a href='".e_HTTP."user.php?id.{$pm_info['pm_from']}'>{$pm_info['user_name']}</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $pm_info['user_name'];
|
||||
}
|
||||
SC_END
|
||||
|
||||
SC_BEGIN PM_SELECT
|
||||
global $pm_info;
|
||||
return "<input type='checkbox' name='selected_pm[{$pm_info['pm_id']}]' value='1' />";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN PM_READ_ICON
|
||||
global $pm_info;
|
||||
if($pm_info['pm_read'] > 0 )
|
||||
{
|
||||
return PM_READ_ICON;
|
||||
}
|
||||
else
|
||||
{
|
||||
return PM_UNREAD_ICON;
|
||||
}
|
||||
SC_END
|
||||
|
||||
SC_BEGIN PM_AVATAR
|
||||
global $pm_info, $tp;
|
||||
return $tp->parseTemplate("{USER_AVATAR={$pm_info['user_image']}}");
|
||||
SC_END
|
||||
|
||||
SC_BEGIN PM_BLOCK_USER
|
||||
global $pm_info, $pm_blocks;
|
||||
if(in_array($pm_info['pm_from'], $pm_blocks))
|
||||
{
|
||||
return "<a href='".e_PLUGIN_ABS."pm/pm.php?unblock.{$pm_info['pm_from']}'><img src='".e_PLUGIN_ABS."pm/images/mail_unblock.png' title='".LAN_PM_51."' alt='".LAN_PM_51."' class='icon S16' /></a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "<a href='".e_PLUGIN_ABS."pm/pm.php?block.{$pm_info['pm_from']}'><img src='".e_PLUGIN_ABS."pm/images/mail_block.png' title='".LAN_PM_50."' alt='".LAN_PM_50."' class='icon S16' /></a>";
|
||||
}
|
||||
SC_END
|
||||
|
||||
SC_BEGIN PM_DELETE
|
||||
global $pm_info;
|
||||
if($parm != "")
|
||||
{
|
||||
$extra = '.'.$parm;
|
||||
}
|
||||
else
|
||||
{
|
||||
$extra = '.'.($pm_info['pm_from'] == USERID ? 'outbox' : 'inbox');
|
||||
}
|
||||
return "<a href='".e_PLUGIN_ABS."pm/pm.php?del.{$pm_info['pm_id']}{$extra}'><img src='".e_PLUGIN_ABS."pm/images/mail_delete.png' title='".LAN_PM_52."' alt='".LAN_PM_52."' class='icon S16' /></a>";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN DELETE_SELECTED
|
||||
global $pm_info;
|
||||
return "<input type='submit' name='pm_delete_selected' class='button' value='".LAN_PM_53."' />";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN PM_TO
|
||||
global $pm_info;
|
||||
if(is_numeric($pm_info['pm_to']))
|
||||
{
|
||||
if("link" == $parm)
|
||||
{
|
||||
return "<a href='".e_HTTP."user.php?id.{$pm_info['pm_to']}'>{$pm_info['user_name']}</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $pm_info['user_name'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return LAN_PM_63." ".$pm_info['pm_to'];
|
||||
}
|
||||
SC_END
|
||||
|
||||
SC_BEGIN PM_MESSAGE
|
||||
global $pm_info, $tp;
|
||||
return $tp->toHTML($pm_info['pm_text'], true);
|
||||
SC_END
|
||||
|
||||
SC_BEGIN PM_REPLY
|
||||
global $pm_info;
|
||||
if($pm_info['pm_to'] == USERID)
|
||||
{
|
||||
$ret = "
|
||||
<form method='post' action='".e_SELF."?reply.{$pm_info['pm_id']}'>
|
||||
<input type='checkbox' name='quote' /> ".LAN_PM_54."  <input class='button' type='submit' name='reply' value='".LAN_PM_55."' />
|
||||
</form>
|
||||
";
|
||||
return $ret;
|
||||
}
|
||||
SC_END
|
||||
|
||||
SC_BEGIN SEND_PM_LINK
|
||||
$pm_outbox = pm_getInfo('outbox');
|
||||
if($pm_outbox['outbox']['filled'] < 100)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$link = $e107->url->getUrl('pm','main',array('f' => 'send'));
|
||||
return "<a href='{$link}'>".PM_SEND_LINK."</a>";
|
||||
}
|
||||
return "";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN NEWPM_ANIMATE
|
||||
global $pm_prefs, $pm_inbox;
|
||||
if($pm_prefs['animate'])
|
||||
{
|
||||
$pm_inbox = pm_getInfo('inbox');
|
||||
if($pm_inbox['inbox']['new'] > 0)
|
||||
{
|
||||
return NEWPM_ANIMATION;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
SC_END
|
||||
|
||||
|
||||
|
||||
SC_BEGIN PM_NEXTPREV
|
||||
global $pmlist, $tp, $pm_start, $pm_prefs, $pmlist;
|
||||
return $tp->parseTemplate("{NEXTPREV={$pmlist['total_messages']},{$pm_prefs['perpage']},{$pm_start},".e_SELF."?{$parm}.[FROM]}");
|
||||
SC_END
|
||||
|
||||
|
||||
//---------------------------------------
|
||||
// Blocked senders management
|
||||
//---------------------------------------
|
||||
SC_BEGIN BLOCKED_SENDERS_MANAGE
|
||||
global $sql;
|
||||
$count = $sql->db_Count('private_msg_block', '(*)', 'WHERE `pm_block_to` = '.USERID);
|
||||
if (!$count) return '';
|
||||
return LAN_PM_66;
|
||||
SC_END
|
||||
|
||||
|
||||
SC_BEGIN PM_BLOCKED_SELECT
|
||||
global $pmBlocked;
|
||||
return "<input type='checkbox' name='selected_pm[{$pmBlocked['pm_block_from']}]' value='1' />";
|
||||
SC_END
|
||||
|
||||
|
||||
|
||||
SC_BEGIN PM_BLOCKED_USER
|
||||
global $pmBlocked;
|
||||
if (!$pmBlocked['user_name'])
|
||||
{
|
||||
return LAN_PM_72;
|
||||
}
|
||||
if('link' == $parm)
|
||||
{
|
||||
return "<a href='".e_HTTP."user.php?id.{$pmBlocked['pm_block_from']}'>{$pmBlocked['user_name']}</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $pmBlocked['user_name'];
|
||||
}
|
||||
SC_END
|
||||
|
||||
|
||||
SC_BEGIN PM_BLOCKED_DATE
|
||||
global $pmBlocked;
|
||||
require_once(e_HANDLER.'date_handler.php');
|
||||
return convert::convert_date($pmBlocked['pm_block_datestamp'], $parm);
|
||||
SC_END
|
||||
|
||||
SC_BEGIN PM_BLOCKED_DELETE
|
||||
global $pmBlocked;
|
||||
return "<a href='".e_PLUGIN_ABS."pm/pm.php?delblocked.{$pmBlocked['pm_block_from']}'><img src='".e_PLUGIN_ABS."pm/images/mail_delete.png' title='".LAN_PM_52."' alt='".LAN_PM_52."' class='icon S16' /></a>";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN DELETE_BLOCKED_SELECTED
|
||||
return "<input type='submit' name='pm_delete_blocked_selected' class='button' value='".LAN_PM_53."' />";
|
||||
SC_END
|
||||
|
||||
PM_FORM_TOUSER - displays user entry box and selector
|
||||
PM_FORM_TOCLASS - displays user class selector (when allowed)
|
||||
PM_FORM_SUBJECT - displays subject of current PM
|
||||
PM_FORM_MESSAGE - displays message of current PM
|
||||
PM_EMOTES
|
||||
PM_POST_BUTTON
|
||||
PM_PREVIEW_BUTTON
|
||||
PM_ATTACHMENT
|
||||
PM_ATTACHMENT_ICON
|
||||
PM_ATTACHMENTS
|
||||
PM_RECEIPT
|
||||
PM_INBOX_TOTAL
|
||||
PM_INBOX_UNREAD
|
||||
PM_INBOX_FILLED
|
||||
PM_OUTBOX_TOTAL
|
||||
PM_OUTBOX_UNREAD
|
||||
PM_OUTBOX_FILLED
|
||||
PM_DATE
|
||||
PM_READ
|
||||
PM_FROM_TO
|
||||
PM_SUBJECT
|
||||
PM_FROM
|
||||
PM_SELECT
|
||||
PM_READ_ICON
|
||||
PM_AVATAR
|
||||
PM_BLOCK_USER
|
||||
PM_DELETE
|
||||
PM_DELETE_SELECTED
|
||||
PM_TO
|
||||
PM_MESSAGE
|
||||
PM_REPLY
|
||||
PM_SEND_PM_LINK
|
||||
PM_NEWPM_ANIMATE
|
||||
PM_NEXTPREV
|
||||
PM_BLOCKED_SENDERS_MANAGE
|
||||
PM_BLOCKED_SELECT
|
||||
PM_BLOCKED_USER
|
||||
PM_BLOCKED_DATE
|
||||
PM_BLOCKED_DELETE
|
||||
DELETE_BLOCKED_SELECTED
|
||||
*/
|
||||
|
||||
|
||||
class pm_handler_shortcodes
|
||||
{
|
||||
protected $e107;
|
||||
public $pmPrefs; // PM system options
|
||||
public $pmInfo; // Data relating to current PM being displayed
|
||||
public $pmBlocks = array(); // Array of blocked users.
|
||||
public $pmBlocked = array(); // Block info when using 'display blocked' page
|
||||
public $nextPrev = array(); // Variables used by nextprev
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->e107 = e107::getInstance();
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_form_touser()
|
||||
{
|
||||
if($this->pmInfo['from_name'])
|
||||
{
|
||||
return "<input type='hidden' name='pm_to' value='{$this->pmInfo['from_name']}' />{$this->pmInfo['from_name']}";
|
||||
}
|
||||
require_once(e_HANDLER.'user_select_class.php');
|
||||
$us = new user_select;
|
||||
$type = ($this->pmPrefs['dropdown'] == TRUE ? 'list' : 'popup');
|
||||
if(check_class($this->pmPrefs['multi_class']))
|
||||
{
|
||||
$ret = $us->select_form($type, 'textarea.pm_to');
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret = $us->select_form($type, 'pm_to');
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function sc_pm_form_toclass()
|
||||
{
|
||||
if($this->pmInfo['from_name'])
|
||||
{
|
||||
return '';
|
||||
}
|
||||
if(check_class($this->pmPrefs['opt_userclass']) && check_class($this->pmPrefs['multi_class']))
|
||||
{
|
||||
$ret = "<input type='checkbox' name='to_userclass' value='1' />".LAN_PM_4." ";
|
||||
require_once(e_HANDLER.'userclass_class.php');
|
||||
$args = (ADMIN ? 'admin, classes' : 'classes, matchclass');
|
||||
if(check_class($this->pmPrefs['sendall_class']))
|
||||
{
|
||||
$args = 'member, '.$args;
|
||||
}
|
||||
$ret .= e107::getUserClass()->uc_dropdown('pm_userclass', '', $args); // TODO: userclass
|
||||
if (strpos($ret,'option') === FALSE) $ret = '';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_form_subject()
|
||||
{
|
||||
$value = '';
|
||||
if($this->pmInfo['pm_subject'])
|
||||
{
|
||||
$value = $this->pmInfo['pm_subject'];
|
||||
if(substr($value, 0, strlen(LAN_PM_58)) != LAN_PM_58)
|
||||
{
|
||||
$value = LAN_PM_58.$value;
|
||||
}
|
||||
}
|
||||
return "<input class='tbox' type='text' name='pm_subject' value='{$value}' size='63' maxlength='255' />";
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_form_message()
|
||||
{
|
||||
$value = '';
|
||||
if($this->pmInfo['pm_text'])
|
||||
{
|
||||
if(isset($_POST['quote']))
|
||||
{
|
||||
$t = time();
|
||||
$value = "[quote{$t}={$this->pmInfo['from_name']}]\n{$this->pmInfo['pm_text']}\n[/quote{$t}]\n\n";
|
||||
}
|
||||
}
|
||||
return "<textarea class='tbox' name='pm_message' cols='60' rows='10' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>{$value}</textarea>";
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_emotes()
|
||||
{
|
||||
require_once(e_HANDLER.'emote.php');
|
||||
return r_emote();
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_post_button()
|
||||
{
|
||||
return "<input class='button' type='submit' name='postpm' value='".LAN_PM_1."' />";
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_preview_button()
|
||||
{
|
||||
return "<input class='button' type='submit' name='postpm' value='".LAN_PM_3."' />";
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_attachment()
|
||||
{
|
||||
if (check_class($this->pmPrefs['attach_class']))
|
||||
{
|
||||
$ret = "
|
||||
<div id='up_container' >
|
||||
<span id='upline' style='white-space:nowrap'>
|
||||
<input class='tbox' type='file' name='file_userfile[]' size='40' />
|
||||
</span>
|
||||
</div>
|
||||
<input type='button' class='button' value='".LAN_PM_11."' onclick=\"duplicateHTML('upline','up_container');\" />
|
||||
";
|
||||
return $ret;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_attachment_icon()
|
||||
{
|
||||
if($this->pmInfo['pm_attachments'] != "")
|
||||
{
|
||||
return ATTACHMENT_ICON;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_attachments()
|
||||
{
|
||||
if($this->pmInfo['pm_attachments'] != '')
|
||||
{
|
||||
$attachments = explode(chr(0), $this->pmInfo['pm_attachments']);
|
||||
$i = 0;
|
||||
foreach($attachments as $a)
|
||||
{
|
||||
list($timestamp, $fromid, $rand, $filename) = explode("_", $a, 4);
|
||||
$ret .= "<a href='".e_SELF."?get.{$this->pmInfo['pm_id']}.{$i}'>{$filename}</a><br />";
|
||||
$i++;
|
||||
}
|
||||
$ret = substr($ret, 0, -3);
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_receipt()
|
||||
{
|
||||
if (check_class($this->pmPrefs['receipt_class']))
|
||||
{
|
||||
return "<input type='checkbox' name='receipt' value='1' />".LAN_PM_10;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_inbox_total()
|
||||
{
|
||||
$pm_inbox = pm_getInfo('inbox');
|
||||
return intval($pm_inbox['inbox']['total']);
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_inbox_unread()
|
||||
{
|
||||
$pm_inbox = pm_getInfo('inbox');
|
||||
return intval($pm_inbox['inbox']['unread']);
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_inbox_filled()
|
||||
{
|
||||
$pm_inbox = pm_getInfo('inbox');
|
||||
return (intval($pm_inbox['inbox']['filled']) > 0 ? $pm_inbox['inbox']['filled'] : '');
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_outbox_total()
|
||||
{
|
||||
$pm_outbox = pm_getInfo('outbox');
|
||||
return intval($pm_outbox['outbox']['total']);
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_outbox_unread()
|
||||
{
|
||||
$pm_outbox = pm_getInfo('outbox');
|
||||
return intval($pm_outbox['outbox']['unread']);
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_outbox_filled()
|
||||
{
|
||||
$pm_outbox = pm_getInfo('outbox');
|
||||
return (intval($pm_outbox['outbox']['filled']) > 0 ? $pm_outbox['outbox']['filled'] : '');
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_date($parm = '')
|
||||
{
|
||||
require_once(e_HANDLER.'date_handler.php');
|
||||
if('lapse' != $parm)
|
||||
{
|
||||
return convert::convert_date($this->pmInfo['pm_sent'], $parm);
|
||||
}
|
||||
else
|
||||
{
|
||||
return convert::computeLapse($this->pmInfo['pm_sent']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_read($parm = '')
|
||||
{
|
||||
if($this->pmInfo['pm_read'] == 0)
|
||||
{
|
||||
return LAN_PM_27;
|
||||
}
|
||||
if($this->pmInfo['pm_read'] == 1)
|
||||
{
|
||||
return LAN_PM_28;
|
||||
}
|
||||
require_once(e_HANDLER.'date_handler.php');
|
||||
if('lapse' != $parm)
|
||||
{
|
||||
return convert::convert_date($this->pmInfo['pm_read'], $parm);
|
||||
}
|
||||
else
|
||||
{
|
||||
return convert::computeLapse($this->pmInfo['pm_read']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_from_to()
|
||||
{
|
||||
if($this->pmInfo['pm_from'] == USERID)
|
||||
{
|
||||
$ret = LAN_PM_2.': <br />';
|
||||
$this->pmInfo['user_name'] = $this->pmInfo['sent_name'];
|
||||
$ret .= $this->e107->tp->parseTemplate("{PM_TO=link}");
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret = LAN_PM_31.': <br />';
|
||||
$this->pmInfo['user_name'] = $this->pmInfo['from_name'];
|
||||
$ret .= $this->e107->tp->parseTemplate("{PM_FROM=link}");
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_subject($parm = '')
|
||||
{
|
||||
$ret = $this->e107->tp->toHTML($this->pmInfo['pm_subject'], true, 'USER_TITLE');
|
||||
$prm = explode(',',$parm);
|
||||
if('link' == $prm[0])
|
||||
{
|
||||
$extra = '';
|
||||
if (isset($prm[1])) $extra = '.'.$prm[1];
|
||||
$ret = "<a href='".e_PLUGIN_ABS."pm/pm.php?show.{$this->pmInfo['pm_id']}{$extra}'>".$ret."</a>";
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_from($parm = '')
|
||||
{
|
||||
if('link' == $parm)
|
||||
{
|
||||
return "<a href='".e_HTTP."user.php?id.{$this->pmInfo['pm_from']}'>{$this->pmInfo['user_name']}</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->pmInfo['user_name'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_select()
|
||||
{
|
||||
return "<input type='checkbox' name='selected_pm[{$this->pmInfo['pm_id']}]' value='1' />";
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_read_icon()
|
||||
{
|
||||
if($this->pmInfo['pm_read'] > 0 )
|
||||
{
|
||||
return PM_READ_ICON;
|
||||
}
|
||||
else
|
||||
{
|
||||
return PM_UNREAD_ICON;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_avatar()
|
||||
{
|
||||
return $this->e107->tp->parseTemplate("{USER_AVATAR={$this->pmInfo['user_image']}}");
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_block_user()
|
||||
{
|
||||
if(in_array($this->pmInfo['pm_from'], $this->pmBlocks))
|
||||
{
|
||||
return "<a href='".e_PLUGIN_ABS."pm/pm.php?unblock.{$this->pmInfo['pm_from']}'><img src='".e_PLUGIN_ABS."pm/images/mail_unblock.png' title='".LAN_PM_51."' alt='".LAN_PM_51."' class='icon S16' /></a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "<a href='".e_PLUGIN_ABS."pm/pm.php?block.{$this->pmInfo['pm_from']}'><img src='".e_PLUGIN_ABS."pm/images/mail_block.png' title='".LAN_PM_50."' alt='".LAN_PM_50."' class='icon S16' /></a>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_delete($parm = '')
|
||||
{
|
||||
if($parm != '')
|
||||
{
|
||||
$extra = '.'.$parm;
|
||||
}
|
||||
else
|
||||
{
|
||||
$extra = '.'.($this->pmInfo['pm_from'] == USERID ? 'outbox' : 'inbox');
|
||||
}
|
||||
return "<a href='".e_PLUGIN_ABS."pm/pm.php?del.{$this->pmInfo['pm_id']}{$extra}'><img src='".e_PLUGIN_ABS."pm/images/mail_delete.png' title='".LAN_PM_52."' alt='".LAN_PM_52."' class='icon S16' /></a>";
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_delete_selected()
|
||||
{
|
||||
return "<input type='submit' name='pm_delete_selected' class='button' value='".LAN_PM_53."' />";
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_to($parm = '')
|
||||
{
|
||||
if(is_numeric($this->pmInfo['pm_to']))
|
||||
{
|
||||
if('link' == $parm)
|
||||
{
|
||||
return "<a href='".e_HTTP."user.php?id.{$this->pmInfo['pm_to']}'>{$this->pmInfo['user_name']}</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->pmInfo['user_name'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return LAN_PM_63.' '.$this->pmInfo['pm_to'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_message()
|
||||
{
|
||||
return $this->e107->tp->toHTML($this->pmInfo['pm_text'], true);
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_reply()
|
||||
{
|
||||
if($this->pmInfo['pm_to'] == USERID)
|
||||
{
|
||||
$ret = "
|
||||
<form method='post' action='".e_SELF."?reply.{$this->pmInfo['pm_id']}'>
|
||||
<input type='checkbox' name='quote' /> ".LAN_PM_54."  <input class='button' type='submit' name='reply' value='".LAN_PM_55."' />
|
||||
</form>
|
||||
";
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_send_pm_link()
|
||||
{
|
||||
$pm_outbox = pm_getInfo('outbox');
|
||||
if($pm_outbox['outbox']['filled'] < 100)
|
||||
{
|
||||
$link = $this->e107->url->getUrl('pm','main',array('f' => 'send'));
|
||||
return "<a href='{$link}'>".PM_SEND_LINK."</a>";
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_newpm_animate()
|
||||
{
|
||||
if($this->pmPrefs['animate'])
|
||||
{
|
||||
$pm_inbox = pm_getInfo('inbox');
|
||||
if($pm_inbox['inbox']['new'] > 0)
|
||||
{
|
||||
return NEWPM_ANIMATION;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_nextprev()
|
||||
{
|
||||
return $this->e107->tp->parseTemplate("{NEXTPREV={$this->pmNextPrev['total']},{$this->pmPrefs['perpage']},{$this->pmNextPrev['start']},".e_SELF."?{$parm}.[FROM]}");
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_blocked_senders_manage()
|
||||
{
|
||||
$count = $this->e107->sql->db_Count('private_msg_block', '(*)', 'WHERE `pm_block_to` = '.USERID);
|
||||
if (!$count) return '';
|
||||
return LAN_PM_66;
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_blocked_select()
|
||||
{
|
||||
return "<input type='checkbox' name='selected_pm[{$this->pmBlocked['pm_block_from']}]' value='1' />";
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_blocked_user($parm = '')
|
||||
{
|
||||
if (!$this->pmBlocked['user_name'])
|
||||
{
|
||||
return LAN_PM_72;
|
||||
}
|
||||
if('link' == $parm)
|
||||
{
|
||||
return "<a href='".e_HTTP."user.php?id.{$this->pmBlocked['pm_block_from']}'>{$this->pmBlocked['user_name']}</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->pmBlocked['user_name'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_blocked_date()
|
||||
{
|
||||
require_once(e_HANDLER.'date_handler.php');
|
||||
return convert::convert_date($this->pmBlocked['pm_block_datestamp'], $parm);
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_blocked_delete()
|
||||
{
|
||||
return "<a href='".e_PLUGIN_ABS."pm/pm.php?delblocked.{$this->pmBlocked['pm_block_from']}'><img src='".e_PLUGIN_ABS."pm/images/mail_delete.png' title='".LAN_PM_52."' alt='".LAN_PM_52."' class='icon S16' /></a>";
|
||||
}
|
||||
|
||||
|
||||
public function sc_pm_delete_blocked_selected()
|
||||
{
|
||||
return "<input type='submit' name='pm_delete_blocked_selected' class='button' value='".LAN_PM_53."' />";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
@@ -9,8 +9,8 @@
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/pm/pm_template.php,v $
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 2009-12-10 20:40:39 $
|
||||
* $Revision: 1.7 $
|
||||
* $Date: 2009-12-16 20:23:37 $
|
||||
* $Author: e107steved $
|
||||
*/
|
||||
|
||||
@@ -18,8 +18,8 @@ if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
global $sc_style;
|
||||
|
||||
define("PM_READ_ICON", "<img src='".e_PLUGIN_ABS."/pm/images/read.png' class='icon S16' alt='".LAN_PM_111."' />");
|
||||
define("PM_UNREAD_ICON", "<img src='".e_PLUGIN_ABS."/pm/images/unread.png' class='icon S16' alt='".LAN_PM_27."' />");
|
||||
define('PM_READ_ICON', "<img src='".e_PLUGIN_ABS."/pm/images/read.png' class='icon S16' alt='".LAN_PM_111."' />");
|
||||
define('PM_UNREAD_ICON', "<img src='".e_PLUGIN_ABS."/pm/images/unread.png' class='icon S16' alt='".LAN_PM_27."' />");
|
||||
|
||||
$sc_style['PM_ATTACHMENT_ICON']['pre'] = " ";
|
||||
|
||||
@@ -29,26 +29,26 @@ $sc_style['PM_ATTACHMENTS']['post'] = "</div>";
|
||||
$sc_style['PM_NEXTPREV']['pre'] = "<tr><td class='forumheader' colspan='6' style='text-align:left'> ".LAN_PM_59;
|
||||
$sc_style['PM_NEXTPREV']['post'] = "</td></tr>";
|
||||
|
||||
$sc_style['EMOTES']['pre'] = "
|
||||
$sc_style['PM_EMOTES']['pre'] = "
|
||||
<tr>
|
||||
<td class='forumheader3'>".LAN_PM_7.": </td>
|
||||
<td class='forumheader3'>
|
||||
";
|
||||
$sc_style['EMOTES']['post'] = "</td></tr>";
|
||||
$sc_style['PM_EMOTES']['post'] = "</td></tr>";
|
||||
|
||||
$sc_style['ATTACHMENT']['pre'] = "
|
||||
$sc_style['PM_ATTACHMENT']['pre'] = "
|
||||
<tr>
|
||||
<td class='forumheader3'>".LAN_PM_8.": </td>
|
||||
<td class='forumheader3'>
|
||||
";
|
||||
$sc_style['ATTACHMENT']['post'] = "</td></tr>";
|
||||
$sc_style['PM_ATTACHMENT']['post'] = "</td></tr>";
|
||||
|
||||
$sc_style['RECEIPT']['pre'] = "
|
||||
$sc_style['PM_RECEIPT']['pre'] = "
|
||||
<tr>
|
||||
<td class='forumheader3'>".LAN_PM_9.": </td>
|
||||
<td class='forumheader3'>
|
||||
";
|
||||
$sc_style['RECEIPT']['post'] = "</td></tr>";
|
||||
$sc_style['PM_RECEIPT']['post'] = "</td></tr>";
|
||||
|
||||
$sc_style['PM_REPLY']['pre'] = "<tr>
|
||||
<td class='forumheader' style='text-align:center' colspan='2'>
|
||||
@@ -65,19 +65,19 @@ $PM_SEND_PM = "<div style='text-align: center'>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='forumheader3' style='width: 30%'>".LAN_PM_2.": </td>
|
||||
<td class='forumheader3' style='width: 70%; text-align:left'>{FORM_TOUSER}<br />{FORM_TOCLASS}</td>
|
||||
<td class='forumheader3' style='width: 70%; text-align:left'>{PM_FORM_TOUSER}<br />{PM_FORM_TOCLASS}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='forumheader3'>".LAN_PM_5.": </td>
|
||||
<td class='forumheader3'>{FORM_SUBJECT}</td>
|
||||
<td class='forumheader3'>{PM_FORM_SUBJECT}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='forumheader3'>".LAN_PM_6.": </td>
|
||||
<td class='forumheader3'>{FORM_MESSAGE}</td>
|
||||
<td class='forumheader3'>{PM_FORM_MESSAGE}</td>
|
||||
</tr>
|
||||
{EMOTES}
|
||||
{ATTACHMENT}
|
||||
{RECEIPT}
|
||||
{PM_EMOTES}
|
||||
{PM_ATTACHMENT}
|
||||
{PM_RECEIPT}
|
||||
<tr>
|
||||
<td class='forumheader' colspan='2' style='text-align:center;'>{PM_POST_BUTTON}</td>
|
||||
</tr>
|
||||
@@ -118,7 +118,7 @@ $PM_INBOX_FOOTER = "
|
||||
<tr>
|
||||
<td class='forumheader' colspan='6' style='text-align:center'>
|
||||
<input type='hidden' name='pm_come_from' value='inbox' />
|
||||
{DELETE_SELECTED}
|
||||
{PM_DELETE_SELECTED}
|
||||
</td>
|
||||
</tr>
|
||||
{PM_NEXTPREV=inbox}
|
||||
@@ -158,7 +158,7 @@ $PM_OUTBOX_FOOTER = "
|
||||
<tr>
|
||||
<td class='forumheader' colspan='6' style='text-align:center'>
|
||||
<input type='hidden' name='pm_come_from' value='outbox' />
|
||||
{DELETE_SELECTED}
|
||||
{PM_DELETE_SELECTED}
|
||||
</td>
|
||||
</tr>
|
||||
{PM_NEXTPREV=outbox}
|
||||
@@ -194,7 +194,7 @@ $PM_BLOCKED_EMPTY = "
|
||||
$PM_BLOCKED_FOOTER = "
|
||||
<tr>
|
||||
<td class='forumheader' colspan='4' style='text-align:center'>
|
||||
{DELETE_BLOCKED_SELECTED}
|
||||
{PM_DELETE_BLOCKED_SELECTED}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@@ -9,8 +9,8 @@
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/pm/private_msg_menu.php,v $
|
||||
* $Revision: 1.10 $
|
||||
* $Date: 2009-12-10 20:40:39 $
|
||||
* $Revision: 1.11 $
|
||||
* $Date: 2009-12-16 20:23:37 $
|
||||
* $Author: e107steved $
|
||||
*/
|
||||
|
||||
@@ -22,6 +22,9 @@ if(!isset($pm_prefs['perpage']))
|
||||
$pm_prefs = $sysprefs->getArray('pm_prefs');
|
||||
}
|
||||
require_once(e_PLUGIN.'pm/pm_func.php');
|
||||
e107::getScParser();
|
||||
require_once(e_PLUGIN.'pm/pm_shortcodes.php');
|
||||
setScVar('pm_handler_shortcodes','pmPrefs', $pm_prefs);
|
||||
pm_getInfo('clear');
|
||||
|
||||
define('PM_INBOX_ICON', "<img src='".e_PLUGIN_ABS."pm/images/mail_get.png' class='icon S16' alt='".LAN_PM_25."' title='".LAN_PM_25."' />");
|
||||
@@ -30,20 +33,20 @@ define('PM_SEND_LINK', LAN_PM_35);
|
||||
define('NEWPM_ANIMATION', "<img src='".e_PLUGIN_ABS."pm/images/newpm.gif' alt='' />");
|
||||
|
||||
|
||||
$sc_style['SEND_PM_LINK']['pre'] = "<br /><br />[ ";
|
||||
$sc_style['SEND_PM_LINK']['post'] = " ]";
|
||||
$sc_style['PM_SEND_PM_LINK']['pre'] = "<br /><br />[ ";
|
||||
$sc_style['PM_SEND_PM_LINK']['post'] = " ]";
|
||||
|
||||
$sc_style['INBOX_FILLED']['pre'] = "[";
|
||||
$sc_style['INBOX_FILLED']['post'] = "%]";
|
||||
$sc_style['PM_INBOX_FILLED']['pre'] = "[";
|
||||
$sc_style['PM_INBOX_FILLED']['post'] = "%]";
|
||||
|
||||
$sc_style['OUTBOX_FILLED']['pre'] = "[";
|
||||
$sc_style['OUTBOX_FILLED']['post'] = "%]";
|
||||
$sc_style['PM_OUTBOX_FILLED']['pre'] = "[";
|
||||
$sc_style['PM_OUTBOX_FILLED']['post'] = "%]";
|
||||
|
||||
$sc_style['NEWPM_ANIMATE']['pre'] = "<a href='".e_PLUGIN_ABS."pm/pm.php?inbox'>";
|
||||
$sc_style['NEWPM_ANIMATE']['post'] = "</a>";
|
||||
$sc_style['PM_NEWPM_ANIMATE']['pre'] = "<a href='".e_PLUGIN_ABS."pm/pm.php?inbox'>";
|
||||
$sc_style['PM_NEWPM_ANIMATE']['post'] = "</a>";
|
||||
|
||||
$sc_style['BLOCKED_SENDERS_MANAGE']['pre'] = "<br />[ <a href='".e_PLUGIN_ABS."pm/pm.php?blocked'>";
|
||||
$sc_style['BLOCKED_SENDERS_MANAGE']['post'] = '</a> ]';
|
||||
$sc_style['PM_BLOCKED_SENDERS_MANAGE']['pre'] = "<br />[ <a href='".e_PLUGIN_ABS."pm/pm.php?blocked'>";
|
||||
$sc_style['PM_BLOCKED_SENDERS_MANAGE']['post'] = '</a> ]';
|
||||
|
||||
|
||||
if(!isset($pm_menu_template))
|
||||
@@ -51,15 +54,15 @@ if(!isset($pm_menu_template))
|
||||
$pm_menu_template = "
|
||||
<a href='{URL=pm|main|f=box&box=inbox}'>".PM_INBOX_ICON."</a>
|
||||
<a href='{URL=pm|main|f=box&box=inbox}'>".LAN_PM_25."</a>
|
||||
{NEWPM_ANIMATE}
|
||||
{PM_NEWPM_ANIMATE}
|
||||
<br />
|
||||
{INBOX_TOTAL} ".LAN_PM_36.", {INBOX_UNREAD} ".LAN_PM_37." {INBOX_FILLED}
|
||||
{PM_INBOX_TOTAL} ".LAN_PM_36.", {PM_INBOX_UNREAD} ".LAN_PM_37." {PM_INBOX_FILLED}
|
||||
<br />
|
||||
<a href='{URL=pm|main|f=box&box=outbox}'>".PM_OUTBOX_ICON."</a>
|
||||
<a href='{URL=pm|main|f=box&box=outbox}'>".LAN_PM_26."</a><br />
|
||||
{OUTBOX_TOTAL} ".LAN_PM_36.", {OUTBOX_UNREAD} ".LAN_PM_37." {OUTBOX_FILLED}
|
||||
{SEND_PM_LINK}
|
||||
{BLOCKED_SENDERS_MANAGE}
|
||||
{PM_OUTBOX_TOTAL} ".LAN_PM_36.", {PM_OUTBOX_UNREAD} ".LAN_PM_37." {PM_OUTBOX_FILLED}
|
||||
{PM_SEND_PM_LINK}
|
||||
{PM_BLOCKED_SENDERS_MANAGE}
|
||||
";
|
||||
}
|
||||
|
||||
@@ -68,9 +71,9 @@ if(check_class($pm_prefs['pm_class']))
|
||||
{
|
||||
global $tp, $pm_inbox;
|
||||
$pm_inbox = pm_getInfo('inbox');
|
||||
require_once(e_PLUGIN."pm/pm_shortcodes.php");
|
||||
$txt = $tp->parseTemplate($pm_menu_template, TRUE, $pm_shortcodes);
|
||||
if($pm_inbox['inbox']['new'] > 0 && $pm_prefs['popup'] && strpos(e_SELF, "pm.php") === FALSE && $_COOKIE["pm-alert"] != "ON")
|
||||
// require_once(e_PLUGIN."pm/pm_shortcodes.php");
|
||||
$txt = $tp->parseTemplate($pm_menu_template, TRUE);
|
||||
if($pm_inbox['inbox']['new'] > 0 && $pm_prefs['popup'] && strpos(e_SELF, 'pm.php') === FALSE && $_COOKIE['pm-alert'] != 'ON')
|
||||
{
|
||||
$txt .= pm_show_popup();
|
||||
}
|
||||
|
Reference in New Issue
Block a user