mirror of
https://github.com/e107inc/e107.git
synced 2025-08-13 18:14:26 +02:00
Private Message plugin working again to some extent.
This commit is contained in:
@@ -1,99 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* e107 website system
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
|
||||||
* Released under the terms and conditions of the
|
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/pm/plugin.php,v $
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
|
||||||
|
|
||||||
include_lan(e_PLUGIN."pm/languages/admin/".e_LANGUAGE.".php");
|
|
||||||
|
|
||||||
// Plugin info -------------------------------------------------------------------------------------------------------
|
|
||||||
$eplug_name = "ADLAN_PM";
|
|
||||||
$eplug_version = "3.0";
|
|
||||||
$eplug_author = "McFly";
|
|
||||||
$eplug_url = "";
|
|
||||||
$eplug_email = "mcfly@e107.org";
|
|
||||||
$eplug_description = ADLAN_PM_57;
|
|
||||||
$eplug_compatible = "e107v.7+";
|
|
||||||
// leave blank if no readme file
|
|
||||||
|
|
||||||
// Name of the plugin's folder -------------------------------------------------------------------------------------
|
|
||||||
$eplug_folder = "pm";
|
|
||||||
|
|
||||||
// Mane of menu item for plugin ----------------------------------------------------------------------------------
|
|
||||||
$eplug_menu_name = "pm";
|
|
||||||
|
|
||||||
// Name of the admin configuration file --------------------------------------------------------------------------
|
|
||||||
$eplug_conffile = "pm_conf.php";
|
|
||||||
|
|
||||||
// Icon image and caption text ------------------------------------------------------------------------------------
|
|
||||||
$eplug_icon = $eplug_folder."/images/pvt_message_32.png";
|
|
||||||
$eplug_icon_small = $eplug_folder."/images/pvt_message_16.png";
|
|
||||||
$eplug_caption = ADLAN_PM_2; //"Configure Private Messager";
|
|
||||||
|
|
||||||
// List of preferences -----------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// List of table names -----------------------------------------------------------------------------------------------
|
|
||||||
$eplug_table_names = array(
|
|
||||||
"private_msg",
|
|
||||||
"private_msg_block"
|
|
||||||
);
|
|
||||||
|
|
||||||
// List of sql requests to create tables -----------------------------------------------------------------------------
|
|
||||||
$eplug_tables = array(
|
|
||||||
"CREATE TABLE ".MPREFIX."private_msg (
|
|
||||||
pm_id int(10) unsigned NOT NULL auto_increment,
|
|
||||||
pm_from int(10) unsigned NOT NULL default '0',
|
|
||||||
pm_to varchar(250) NOT NULL default '',
|
|
||||||
pm_sent int(10) unsigned NOT NULL default '0',
|
|
||||||
pm_read int(10) unsigned NOT NULL default '0',
|
|
||||||
pm_subject text NOT NULL,
|
|
||||||
pm_text text NOT NULL,
|
|
||||||
pm_sent_del tinyint(1) unsigned NOT NULL default '0',
|
|
||||||
pm_read_del tinyint(1) unsigned NOT NULL default '0',
|
|
||||||
pm_attachments text NOT NULL,
|
|
||||||
pm_option varchar(250) NOT NULL default '',
|
|
||||||
pm_size int(10) unsigned NOT NULL default '0',
|
|
||||||
PRIMARY KEY (pm_id)
|
|
||||||
) ENGINE=MyISAM AUTO_INCREMENT=1 ;",
|
|
||||||
"CREATE TABLE ".MPREFIX."private_msg_block (
|
|
||||||
pm_block_id int(10) unsigned NOT NULL auto_increment,
|
|
||||||
pm_block_from int(10) unsigned NOT NULL default '0',
|
|
||||||
pm_block_to int(10) unsigned NOT NULL default '0',
|
|
||||||
pm_block_datestamp int(10) unsigned NOT NULL default '0',
|
|
||||||
pm_block_count int(10) unsigned NOT NULL default '0',
|
|
||||||
PRIMARY KEY (pm_block_id)
|
|
||||||
) ENGINE=MyISAM AUTO_INCREMENT=1 ;"
|
|
||||||
);
|
|
||||||
|
|
||||||
// Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
|
|
||||||
$eplug_link = FALSE;
|
|
||||||
$eplug_link_name = "";
|
|
||||||
$eplug_link_url = "";
|
|
||||||
|
|
||||||
// Text to display after plugin successfully installed ------------------------------------------------------------------
|
|
||||||
$eplug_done = ADLAN_PM_1;
|
|
||||||
|
|
||||||
if(!function_exists("pm_uninstall"))
|
|
||||||
{
|
|
||||||
//Remove prefs and menu entry during uninstall
|
|
||||||
function pm_uninstall()
|
|
||||||
{
|
|
||||||
global $sql;
|
|
||||||
$sql->db_Delete("core", "e107_name = 'pm_prefs'");
|
|
||||||
$sql->db_Delete("menus", "menu_name = 'private_msg_menu'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
@@ -6,4 +6,24 @@
|
|||||||
<adminLinks>
|
<adminLinks>
|
||||||
<link url='pm_conf.php' description='ADLAN_PM_2' icon='images/pvt_message_32.png' iconSmall='images/pvt_message_16.png' primary='true' />
|
<link url='pm_conf.php' description='ADLAN_PM_2' icon='images/pvt_message_32.png' iconSmall='images/pvt_message_16.png' primary='true' />
|
||||||
</adminLinks>
|
</adminLinks>
|
||||||
|
<pluginPrefs>
|
||||||
|
<pref name="title">PMLAN_PM</pref>
|
||||||
|
<pref name="animate">1</pref>
|
||||||
|
<pref name="dropdown">0</pref>
|
||||||
|
<pref name="read_timeout">0</pref>
|
||||||
|
<pref name="unread_timeout">0</pref>
|
||||||
|
<pref name="popup">0</pref>
|
||||||
|
<pref name="popup_delay"></pref>
|
||||||
|
<pref name="perpage">10</pref>
|
||||||
|
<pref name="pm_class">e_UC_MEMBER</pref>
|
||||||
|
<pref name="notify_class">e_UC_ADMIN</pref>
|
||||||
|
<pref name="receipt_class">e_UC_MEMBER</pref>
|
||||||
|
<pref name="attach_class">e_UC_ADMIN</pref>
|
||||||
|
<pref name="attach_size">500</pref>
|
||||||
|
<pref name="sendall_class">e_UC_ADMIN</pref>
|
||||||
|
<pref name="multi_class">e_UC_ADMIN</pref>
|
||||||
|
<pref name="allow_userclass">1</pref>
|
||||||
|
<pref name="pm_limits">0</pref>
|
||||||
|
<pref name="pm_max_send">100</pref>
|
||||||
|
</pluginPrefs>
|
||||||
</e107Plugin>
|
</e107Plugin>
|
@@ -57,7 +57,9 @@ if (!$action) $action = 'inbox';
|
|||||||
|
|
||||||
$pm_proc_id = intval(varset($qs[1],0));
|
$pm_proc_id = intval(varset($qs[1],0));
|
||||||
|
|
||||||
$pm_prefs = $sysprefs->getArray('pm_prefs');
|
//$pm_prefs = $sysprefs->getArray('pm_prefs');
|
||||||
|
|
||||||
|
$pm_prefs = e107::getPlugPref('pm');
|
||||||
|
|
||||||
|
|
||||||
$pm_prefs['perpage'] = intval($pm_prefs['perpage']);
|
$pm_prefs['perpage'] = intval($pm_prefs['perpage']);
|
||||||
@@ -74,9 +76,9 @@ if(!isset($pm_prefs['pm_class']) || !check_class($pm_prefs['pm_class']))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
setScVar('pm_handler_shortcodes','pmPrefs', $pm_prefs);
|
//setScVar('pm_handler_shortcodes','pmPrefs', $pm_prefs);
|
||||||
$pmManager = new pmbox_manager($pm_prefs);
|
$pmManager = new pmbox_manager($pm_prefs);
|
||||||
setScVar('pm_handler_shortcodes','pmManager', &$pmManager);
|
//setScVar('pm_handler_shortcodes','pmManager', &$pmManager);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -157,7 +159,11 @@ class pm_extended extends private_message
|
|||||||
include(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/pm_template.php');
|
include(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/pm_template.php');
|
||||||
$pm_blocks = $this->block_get();
|
$pm_blocks = $this->block_get();
|
||||||
$pmlist = $this->pm_get_inbox(USERID, $start, $this->pmPrefs['perpage']);
|
$pmlist = $this->pm_get_inbox(USERID, $start, $this->pmPrefs['perpage']);
|
||||||
setScVar('pm_handler_shortcodes', 'pmNextPrev', array('start' => $start, 'total' => $pmlist['total_messages']));
|
// setScVar('pm_handler_shortcodes', 'pmNextPrev', array('start' => $start, 'total' => $pmlist['total_messages']));
|
||||||
|
|
||||||
|
$sc = e107::getScBatch('pm',TRUE);
|
||||||
|
$sc->pmNextPrev = array('start' => $start, 'total' => $pmlist['total_messages']);
|
||||||
|
|
||||||
$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
|
$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
|
||||||
$txt .= $this->e107->tp->parseTemplate($PM_INBOX_HEADER, true);
|
$txt .= $this->e107->tp->parseTemplate($PM_INBOX_HEADER, true);
|
||||||
if($pmlist['total_messages'])
|
if($pmlist['total_messages'])
|
||||||
@@ -165,7 +171,10 @@ class pm_extended extends private_message
|
|||||||
foreach($pmlist['messages'] as $rec)
|
foreach($pmlist['messages'] as $rec)
|
||||||
{
|
{
|
||||||
if(trim($rec['pm_subject']) == '') { $rec['pm_subject'] = '['.LAN_PM_61.']'; }
|
if(trim($rec['pm_subject']) == '') { $rec['pm_subject'] = '['.LAN_PM_61.']'; }
|
||||||
setScVar('pm_handler_shortcodes','pmInfo', $rec);
|
// setScVar('pm_handler_shortcodes','pmInfo', $rec);
|
||||||
|
$sc->setVars($rec);
|
||||||
|
|
||||||
|
|
||||||
$txt .= $this->e107->tp->parseTemplate($PM_INBOX_TABLE, true);
|
$txt .= $this->e107->tp->parseTemplate($PM_INBOX_TABLE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -189,26 +198,34 @@ class pm_extended extends private_message
|
|||||||
*/
|
*/
|
||||||
function show_outbox($start = 0)
|
function show_outbox($start = 0)
|
||||||
{
|
{
|
||||||
|
$tp = e107::getParser();
|
||||||
|
|
||||||
$tpl_file = THEME.'pm_template.php';
|
$tpl_file = THEME.'pm_template.php';
|
||||||
include(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/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']);
|
$pmlist = $this->pm_get_outbox(USERID, $start, $this->pmPrefs['perpage']);
|
||||||
setScVar('pm_handler_shortcodes', 'pmNextPrev', array('start' => $start, 'total' => $pmlist['total_messages']));
|
// setScVar('pm_handler_shortcodes', 'pmNextPrev', array('start' => $start, 'total' => $pmlist['total_messages']));
|
||||||
|
|
||||||
|
$sc = e107::getScBatch('pm',TRUE);
|
||||||
|
$sc->pmNextPrev = array('start' => $start, 'total' => $pmlist['total_messages']);
|
||||||
|
|
||||||
|
|
||||||
$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
|
$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
|
||||||
$txt .= $this->e107->tp->parseTemplate($PM_OUTBOX_HEADER, true);
|
$txt .= $tp->parseTemplate($PM_OUTBOX_HEADER, true);
|
||||||
if($pmlist['total_messages'])
|
if($pmlist['total_messages'])
|
||||||
{
|
{
|
||||||
foreach($pmlist['messages'] as $rec)
|
foreach($pmlist['messages'] as $rec)
|
||||||
{
|
{
|
||||||
if(trim($rec['pm_subject']) == '') { $rec['pm_subject'] = '['.LAN_PM_61.']'; }
|
if(trim($rec['pm_subject']) == '') { $rec['pm_subject'] = '['.LAN_PM_61.']'; }
|
||||||
setScVar('pm_handler_shortcodes','pmInfo', $rec);
|
// setScVar('pm_handler_shortcodes','pmInfo', $rec);
|
||||||
$txt .= $this->e107->tp->parseTemplate($PM_OUTBOX_TABLE, true);
|
$sc->setVars($rec);
|
||||||
|
$txt .= $tp->parseTemplate($PM_OUTBOX_TABLE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$txt .= $this->e107->tp->parseTemplate($PM_OUTBOX_EMPTY, true);
|
$txt .= $tp->parseTemplate($PM_OUTBOX_EMPTY, true);
|
||||||
}
|
}
|
||||||
$txt .= $this->e107->tp->parseTemplate($PM_OUTBOX_FOOTER, true);
|
$txt .= $tp->parseTemplate($PM_OUTBOX_FOOTER, true);
|
||||||
$txt .= '</form>';
|
$txt .= '</form>';
|
||||||
return $txt;
|
return $txt;
|
||||||
}
|
}
|
||||||
@@ -227,7 +244,9 @@ class pm_extended extends private_message
|
|||||||
$tpl_file = THEME.'pm_template.php';
|
$tpl_file = THEME.'pm_template.php';
|
||||||
include_once(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/pm_template.php');
|
include_once(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/pm_template.php');
|
||||||
$pm_info = $this->pm_get($pmid);
|
$pm_info = $this->pm_get($pmid);
|
||||||
setScVar('pm_handler_shortcodes','pmInfo', $pm_info);
|
// 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)
|
if($pm_info['pm_to'] != USERID && $pm_info['pm_from'] != USERID)
|
||||||
{
|
{
|
||||||
$this->e107->ns->tablerender(LAN_PM, LAN_PM_60);
|
$this->e107->ns->tablerender(LAN_PM, LAN_PM_60);
|
||||||
@@ -271,14 +290,17 @@ class pm_extended extends private_message
|
|||||||
$tpl_file = THEME.'pm_template.php';
|
$tpl_file = THEME.'pm_template.php';
|
||||||
include(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/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?)
|
$pmBlocks = $this->block_get_user(); // TODO - handle pagination, maybe (is it likely to be necessary?)
|
||||||
setScVar('pm_handler_shortcodes','pmBlocks', $pmBlocks);
|
$sc = e107::getScBatch('pm',TRUE);
|
||||||
|
$sc->pmBlocks = $pmBlocks;
|
||||||
|
|
||||||
$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
|
$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
|
||||||
$txt .= $this->e107->tp->parseTemplate($PM_BLOCKED_HEADER, true);
|
$txt .= $this->e107->tp->parseTemplate($PM_BLOCKED_HEADER, true);
|
||||||
if($pmTotalBlocked = count($pmBlocks))
|
if($pmTotalBlocked = count($pmBlocks))
|
||||||
{
|
{
|
||||||
foreach($pmBlocks as $pmBlocked)
|
foreach($pmBlocks as $pmBlocked)
|
||||||
{
|
{
|
||||||
setScVar('pm_handler_shortcodes','pmBlocked', $pmBlocked);
|
$sc->pmBlocked = $pmBlocked;
|
||||||
|
// setScVar('pm_handler_shortcodes','pmBlocked', $pmBlocked);
|
||||||
$txt .= $this->e107->tp->parseTemplate($PM_BLOCKED_TABLE, true);
|
$txt .= $this->e107->tp->parseTemplate($PM_BLOCKED_TABLE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -607,6 +607,8 @@ class private_message
|
|||||||
*/
|
*/
|
||||||
function pm_get_outbox($uid = USERID, $from = 0, $limit = 10)
|
function pm_get_outbox($uid = USERID, $from = 0, $limit = 10)
|
||||||
{
|
{
|
||||||
|
$sql = e107::getDb();
|
||||||
|
|
||||||
$ret = array();
|
$ret = array();
|
||||||
$total_messages = 0;
|
$total_messages = 0;
|
||||||
$uid = intval($uid);
|
$uid = intval($uid);
|
||||||
@@ -619,10 +621,11 @@ class private_message
|
|||||||
WHERE pm.pm_from='{$uid}' AND pm.pm_sent_del=0
|
WHERE pm.pm_from='{$uid}' AND pm.pm_sent_del=0
|
||||||
ORDER BY pm.pm_sent DESC
|
ORDER BY pm.pm_sent DESC
|
||||||
LIMIT ".$from.', '.$limit;
|
LIMIT ".$from.', '.$limit;
|
||||||
if($this->e107->sql->db_Select_gen($qry))
|
|
||||||
|
if($sql->db_Select_gen($qry))
|
||||||
{
|
{
|
||||||
$total_messages = $this->e107->sql->total_results; // Total number of messages
|
$total_messages = $sql->total_results; // Total number of messages
|
||||||
$ret['messages'] = $this->e107->sql->db_getList();
|
$ret['messages'] = $sql->db_getList();
|
||||||
}
|
}
|
||||||
$ret['total_messages'] = $total_messages;
|
$ret['total_messages'] = $total_messages;
|
||||||
return $ret;
|
return $ret;
|
||||||
|
@@ -62,9 +62,14 @@ if($action == '')
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$pm_prefs = $sysprefs->getArray('pm_prefs');
|
// $pm_prefs = $sysprefs->getArray('pm_prefs');
|
||||||
|
$pm_prefs = e107::getPlugPref('pm');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//pm_prefs record not found in core table, set to defaults and create record
|
//pm_prefs record not found in core table, set to defaults and create record
|
||||||
|
/*
|
||||||
if(!is_array($pm_prefs))
|
if(!is_array($pm_prefs))
|
||||||
{
|
{
|
||||||
require_once(e_PLUGIN.'pm/pm_default.php');
|
require_once(e_PLUGIN.'pm/pm_default.php');
|
||||||
@@ -73,9 +78,10 @@ if(!is_array($pm_prefs))
|
|||||||
$emessage->add(ADLAN_PM_3, E_MESSAGE_INFO);
|
$emessage->add(ADLAN_PM_3, E_MESSAGE_INFO);
|
||||||
$e107->admin_log->log_event('PM_ADM_01', '');
|
$e107->admin_log->log_event('PM_ADM_01', '');
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Couple of bits of BC/upgrade
|
// Couple of bits of BC/upgrade
|
||||||
|
/*
|
||||||
$savePMP = FALSE;
|
$savePMP = FALSE;
|
||||||
if (isset($pref['pm_limits']))
|
if (isset($pref['pm_limits']))
|
||||||
{
|
{
|
||||||
@@ -104,10 +110,10 @@ if (isset($pm_prefs['allow_userclass']))
|
|||||||
|
|
||||||
if ($savePMP)
|
if ($savePMP)
|
||||||
{
|
{
|
||||||
$sysprefs->setArray('pm_prefs');
|
// $sysprefs->setArray('pm_prefs');
|
||||||
$emessage->add(ADLAN_PM_80, E_MESSAGE_SUCCESS);
|
// $emessage->add(ADLAN_PM_80, E_MESSAGE_SUCCESS);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//include_lan(e_PLUGIN.'pm/languages/admin/'.e_LANGUAGE.'.php');
|
//include_lan(e_PLUGIN.'pm/languages/admin/'.e_LANGUAGE.'.php');
|
||||||
|
|
||||||
@@ -124,8 +130,10 @@ if (isset($_POST['update_prefs']))
|
|||||||
}
|
}
|
||||||
if ($e107->admin_log->logArrayDiffs($temp, $pm_prefs, 'PM_ADM_02'))
|
if ($e107->admin_log->logArrayDiffs($temp, $pm_prefs, 'PM_ADM_02'))
|
||||||
{
|
{
|
||||||
$sysprefs->setArray('pm_prefs');
|
// $sysprefs->setArray('pm_prefs');
|
||||||
$emessage->add(ADLAN_PM_4, E_MESSAGE_SUCCESS);
|
//print_a($temp);
|
||||||
|
e107::getPlugConfig('pm')->setPref($temp)->save();
|
||||||
|
// $emessage->add(ADLAN_PM_4, E_MESSAGE_SUCCESS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -210,7 +218,7 @@ if(isset($_POST['updatelimits']))
|
|||||||
if($pm_prefs['pm_limits'] != $limitVal)
|
if($pm_prefs['pm_limits'] != $limitVal)
|
||||||
{
|
{
|
||||||
$pm_prefs['pm_limits'] = $limitVal;
|
$pm_prefs['pm_limits'] = $limitVal;
|
||||||
$sysprefs->setArray('pm_prefs');
|
//$sysprefs->setArray('pm_prefs');
|
||||||
$emessage->add(ADLAN_PM_8, E_MESSAGE_SUCCESS);
|
$emessage->add(ADLAN_PM_8, E_MESSAGE_SUCCESS);
|
||||||
}
|
}
|
||||||
foreach(array_keys($_POST['inbox_count']) as $id)
|
foreach(array_keys($_POST['inbox_count']) as $id)
|
||||||
|
@@ -35,7 +35,9 @@ class pmbox_manager
|
|||||||
public function __construct($prefs)
|
public function __construct($prefs)
|
||||||
{
|
{
|
||||||
$this->pmDB = e107::getDb();
|
$this->pmDB = e107::getDb();
|
||||||
$this->pmPrefs = $prefs;
|
// $this->pmPrefs = $prefs;
|
||||||
|
|
||||||
|
$this->pmPrefs = e107::getPlugPref('pm');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -26,12 +26,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
//if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
include_lan(e_PLUGIN.'pm/languages/'.e_LANGUAGE.'.php');
|
include_lan(e_PLUGIN.'pm/languages/'.e_LANGUAGE.'.php');
|
||||||
include_once(e_PLUGIN.'pm/pm_func.php');
|
include_once(e_PLUGIN.'pm/pm_func.php');
|
||||||
register_shortcode('pm_handler_shortcodes', true);
|
// register_shortcode('pm_handler_shortcodes', true);
|
||||||
initShortcodeClass('pm_handler_shortcodes');
|
// initShortcodeClass('pm_handler_shortcodes');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -77,28 +77,30 @@ PM_BLOCKED_DELETE
|
|||||||
DELETE_BLOCKED_SELECTED
|
DELETE_BLOCKED_SELECTED
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
class pm_shortcodes extends e_shortcode
|
||||||
class pm_handler_shortcodes
|
// class pm_handler_shortcodes
|
||||||
{
|
{
|
||||||
protected $e107;
|
|
||||||
public $pmPrefs; // PM system options
|
public $pmPrefs; // PM system options
|
||||||
public $pmInfo; // Data relating to current PM being displayed
|
public $pmInfo; // Data relating to current PM being displayed - replaced by $var.
|
||||||
public $pmBlocks = array(); // Array of blocked users.
|
public $pmBlocks = array(); // Array of blocked users.
|
||||||
public $pmBlocked = array(); // Block info when using 'display blocked' page
|
public $pmBlocked = array(); // Block info when using 'display blocked' page
|
||||||
public $nextPrev = array(); // Variables used by nextprev
|
public $nextPrev = array(); //XXX In USE ?? // Variables used by nextprev
|
||||||
public $pmManager = NULL; // Pointer to pmbox_manager class instance
|
public $pmManager = NULL; // Pointer to pmbox_manager class instance
|
||||||
|
public $pmNextPrev = array();
|
||||||
|
//public $var = array();
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->e107 = e107::getInstance();
|
$pm_prefs = e107::getPlugPref('pm');
|
||||||
|
$this->pmManager = new pmbox_manager($pm_prefs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_form_touser()
|
public function sc_pm_form_touser()
|
||||||
{
|
{
|
||||||
if(vartrue($this->pmInfo['from_name']))
|
if(vartrue($this->var['from_name']))
|
||||||
{
|
{
|
||||||
return "<input type='hidden' name='pm_to' value='{$this->pmInfo['from_name']}' />{$this->pmInfo['from_name']}";
|
return "<input type='hidden' name='pm_to' value='{$this->var['from_name']}' />{$this->var['from_name']}";
|
||||||
}
|
}
|
||||||
require_once(e_HANDLER.'user_select_class.php');
|
require_once(e_HANDLER.'user_select_class.php');
|
||||||
$us = new user_select;
|
$us = new user_select;
|
||||||
@@ -109,14 +111,17 @@ class pm_handler_shortcodes
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$frm = e107::getForm();
|
||||||
|
return $frm->text('pm_to','',10,'typeahead=users');
|
||||||
|
|
||||||
$ret = $us->select_form($type, 'pm_to', '', $this->pmPrefs['pm_class']);
|
$ret = $us->select_form($type, 'pm_to', '', $this->pmPrefs['pm_class']);
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sc_pm_form_toclass()
|
public function sc_pm_form_toclass()
|
||||||
{
|
{
|
||||||
if(vartrue($this->pmInfo['from_name']))
|
if(vartrue($this->var['from_name']))
|
||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -136,12 +141,12 @@ class pm_handler_shortcodes
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_form_subject()
|
public function sc_pm_form_subject()
|
||||||
{
|
{
|
||||||
$value = '';
|
$value = '';
|
||||||
if(vartrue($this->pmInfo['pm_subject']))
|
if(vartrue($this->var['pm_subject']))
|
||||||
{
|
{
|
||||||
$value = $this->pmInfo['pm_subject'];
|
$value = $this->var['pm_subject'];
|
||||||
if(substr($value, 0, strlen(LAN_PM_58)) != LAN_PM_58)
|
if(substr($value, 0, strlen(LAN_PM_58)) != LAN_PM_58)
|
||||||
{
|
{
|
||||||
$value = LAN_PM_58.$value;
|
$value = LAN_PM_58.$value;
|
||||||
@@ -151,41 +156,41 @@ class pm_handler_shortcodes
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_form_message()
|
public function sc_pm_form_message()
|
||||||
{
|
{
|
||||||
$value = '';
|
$value = '';
|
||||||
if(vartrue($this->pmInfo['pm_text']))
|
if(vartrue($this->var['pm_text']))
|
||||||
{
|
{
|
||||||
if(isset($_POST['quote']))
|
if(isset($_POST['quote']))
|
||||||
{
|
{
|
||||||
$t = time();
|
$t = time();
|
||||||
$value = "[quote{$t}={$this->pmInfo['from_name']}]\n{$this->pmInfo['pm_text']}\n[/quote{$t}]\n\n";
|
$value = "[quote{$t}={$this->var['from_name']}]\n{$this->var['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>";
|
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()
|
public function sc_pm_emotes()
|
||||||
{
|
{
|
||||||
require_once(e_HANDLER.'emote.php');
|
require_once(e_HANDLER.'emote.php');
|
||||||
return r_emote();
|
return r_emote();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_post_button()
|
public function sc_pm_post_button()
|
||||||
{
|
{
|
||||||
return "<input class='button btn' type='submit' name='postpm' value='".LAN_PM_1."' />";
|
return "<input class='button btn' type='submit' name='postpm' value='".LAN_PM_1."' />";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_preview_button()
|
public function sc_pm_preview_button()
|
||||||
{
|
{
|
||||||
return "<input class='button btn' type='submit' name='postpm' value='".LAN_PM_3."' />";
|
return "<input class='button btn' type='submit' name='postpm' value='".LAN_PM_3."' />";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_attachment()
|
public function sc_pm_attachment()
|
||||||
{
|
{
|
||||||
if (check_class($this->pmPrefs['attach_class']))
|
if (check_class($this->pmPrefs['attach_class']))
|
||||||
{
|
{
|
||||||
@@ -203,25 +208,25 @@ class pm_handler_shortcodes
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_attachment_icon()
|
public function sc_pm_attachment_icon()
|
||||||
{
|
{
|
||||||
if($this->pmInfo['pm_attachments'] != "")
|
if($this->var['pm_attachments'] != "")
|
||||||
{
|
{
|
||||||
return ATTACHMENT_ICON;
|
return ATTACHMENT_ICON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_attachments()
|
public function sc_pm_attachments()
|
||||||
{
|
{
|
||||||
if($this->pmInfo['pm_attachments'] != '')
|
if($this->var['pm_attachments'] != '')
|
||||||
{
|
{
|
||||||
$attachments = explode(chr(0), $this->pmInfo['pm_attachments']);
|
$attachments = explode(chr(0), $this->var['pm_attachments']);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach($attachments as $a)
|
foreach($attachments as $a)
|
||||||
{
|
{
|
||||||
list($timestamp, $fromid, $rand, $filename) = explode("_", $a, 4);
|
list($timestamp, $fromid, $rand, $filename) = explode("_", $a, 4);
|
||||||
$url = $this->url('action/get', array('id' => $this->pmInfo['pm_id'], 'index' => $i));
|
$url = $this->url('action/get', array('id' => $this->var['pm_id'], 'index' => $i));
|
||||||
$ret .= "<a href='".$url."'>{$filename}</a><br />";
|
$ret .= "<a href='".$url."'>{$filename}</a><br />";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@@ -231,7 +236,7 @@ class pm_handler_shortcodes
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_receipt()
|
public function sc_pm_receipt()
|
||||||
{
|
{
|
||||||
if (check_class($this->pmPrefs['receipt_class']))
|
if (check_class($this->pmPrefs['receipt_class']))
|
||||||
{
|
{
|
||||||
@@ -241,114 +246,117 @@ class pm_handler_shortcodes
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_inbox_total()
|
public function sc_pm_inbox_total()
|
||||||
{
|
{
|
||||||
$pm_inbox = $this->pmManager->pm_getInfo('inbox');
|
$pm_inbox = $this->pmManager->pm_getInfo('inbox');
|
||||||
return intval($pm_inbox['inbox']['total']);
|
return intval($pm_inbox['inbox']['total']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_inbox_unread()
|
public function sc_pm_inbox_unread()
|
||||||
{
|
{
|
||||||
$pm_inbox = $this->pmManager->pm_getInfo('inbox');
|
$pm_inbox = $this->pmManager->pm_getInfo('inbox');
|
||||||
return intval($pm_inbox['inbox']['unread']);
|
return intval($pm_inbox['inbox']['unread']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_inbox_filled()
|
public function sc_pm_inbox_filled()
|
||||||
{
|
{
|
||||||
$pm_inbox = $this->pmManager->pm_getInfo('inbox');
|
$pm_inbox = $this->pmManager->pm_getInfo('inbox');
|
||||||
return (intval($pm_inbox['inbox']['filled']) > 0 ? $pm_inbox['inbox']['filled'] : '');
|
return (intval($pm_inbox['inbox']['filled']) > 0 ? $pm_inbox['inbox']['filled'] : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_outbox_total()
|
public function sc_pm_outbox_total()
|
||||||
{
|
{
|
||||||
$pm_outbox = $this->pmManager->pm_getInfo('outbox');
|
$pm_outbox = $this->pmManager->pm_getInfo('outbox');
|
||||||
return intval($pm_outbox['outbox']['total']);
|
return intval($pm_outbox['outbox']['total']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_outbox_unread()
|
public function sc_pm_outbox_unread()
|
||||||
{
|
{
|
||||||
$pm_outbox = $this->pmManager->pm_getInfo('outbox');
|
$pm_outbox = $this->pmManager->pm_getInfo('outbox');
|
||||||
return intval($pm_outbox['outbox']['unread']);
|
return intval($pm_outbox['outbox']['unread']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_outbox_filled()
|
public function sc_pm_outbox_filled()
|
||||||
{
|
{
|
||||||
$pm_outbox = $this->pmManager->pm_getInfo('outbox');
|
$pm_outbox = $this->pmManager->pm_getInfo('outbox');
|
||||||
return (intval($pm_outbox['outbox']['filled']) > 0 ? $pm_outbox['outbox']['filled'] : '');
|
return (intval($pm_outbox['outbox']['filled']) > 0 ? $pm_outbox['outbox']['filled'] : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_date($parm = '')
|
public function sc_pm_date($parm = '')
|
||||||
{
|
{
|
||||||
require_once(e_HANDLER.'date_handler.php');
|
require_once(e_HANDLER.'date_handler.php');
|
||||||
if('lapse' != $parm)
|
if('lapse' != $parm)
|
||||||
{
|
{
|
||||||
return convert::convert_date($this->pmInfo['pm_sent'], $parm);
|
return convert::convert_date($this->var['pm_sent'], $parm);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return convert::computeLapse($this->pmInfo['pm_sent']);
|
return convert::computeLapse($this->var['pm_sent']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_read($parm = '')
|
public function sc_pm_read($parm = '')
|
||||||
{
|
{
|
||||||
if($this->pmInfo['pm_read'] == 0)
|
if($this->var['pm_read'] == 0)
|
||||||
{
|
{
|
||||||
return LAN_PM_27;
|
return LAN_PM_27;
|
||||||
}
|
}
|
||||||
if($this->pmInfo['pm_read'] == 1)
|
if($this->var['pm_read'] == 1)
|
||||||
{
|
{
|
||||||
return LAN_PM_28;
|
return LAN_PM_28;
|
||||||
}
|
}
|
||||||
require_once(e_HANDLER.'date_handler.php');
|
require_once(e_HANDLER.'date_handler.php');
|
||||||
if('lapse' != $parm)
|
if('lapse' != $parm)
|
||||||
{
|
{
|
||||||
return convert::convert_date($this->pmInfo['pm_read'], $parm);
|
return convert::convert_date($this->var['pm_read'], $parm);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return convert::computeLapse($this->pmInfo['pm_read']);
|
return convert::computeLapse($this->var['pm_read']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_from_to()
|
public function sc_pm_from_to()
|
||||||
{
|
{
|
||||||
if($this->pmInfo['pm_from'] == USERID)
|
$tp = e107::getParser();
|
||||||
|
|
||||||
|
if($this->var['pm_from'] == USERID)
|
||||||
{
|
{
|
||||||
$ret = LAN_PM_2.': <br />';
|
$ret = LAN_PM_2.': <br />';
|
||||||
$this->pmInfo['user_name'] = $this->pmInfo['sent_name'];
|
$this->var['user_name'] = $this->var['sent_name'];
|
||||||
$ret .= $this->e107->tp->parseTemplate("{PM_TO=link}");
|
$ret .= $tp->parseTemplate("{PM_TO=link}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$ret = LAN_PM_31.': <br />';
|
$ret = LAN_PM_31.': <br />';
|
||||||
$this->pmInfo['user_name'] = $this->pmInfo['from_name'];
|
$this->var['user_name'] = $this->var['from_name'];
|
||||||
$ret .= $this->e107->tp->parseTemplate("{PM_FROM=link}");
|
$ret .= $tp->parseTemplate("{PM_FROM=link}");
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_subject($parm = '')
|
public function sc_pm_subject($parm = '')
|
||||||
{
|
{
|
||||||
$ret = $this->e107->tp->toHTML($this->pmInfo['pm_subject'], true, 'USER_TITLE');
|
$tp = e107::getParser();
|
||||||
|
$ret = $tp->toHTML($this->var['pm_subject'], true, 'USER_TITLE');
|
||||||
$prm = explode(',',$parm);
|
$prm = explode(',',$parm);
|
||||||
if('link' == $prm[0])
|
if('link' == $prm[0])
|
||||||
{
|
{
|
||||||
$extra = '';
|
$extra = '';
|
||||||
// TODO - go with only one route version - view/message ???
|
// TODO - go with only one route version - view/message ???
|
||||||
if (isset($prm[1])) $extra = '.'.$prm[1];
|
if (isset($prm[1])) $extra = '.'.$prm[1];
|
||||||
if($extra == 'inbox') $url = $this->url('message', 'id='.$this->pmInfo['pm_id']);
|
if($extra == 'inbox') $url = $this->url('message', 'id='.$this->var['pm_id']);
|
||||||
elseif($extra == 'outbox') $url = $this->url('sent', 'id='.$this->pmInfo['pm_id']);
|
elseif($extra == 'outbox') $url = $this->url('sent', 'id='.$this->var['pm_id']);
|
||||||
else $url = $this->url('show', 'id='.$this->pmInfo['pm_id']);
|
else $url = $this->url('show', 'id='.$this->var['pm_id']);
|
||||||
|
|
||||||
$ret = "<a href='".$ret."'>".$ret."</a>";
|
$ret = "<a href='".$ret."'>".$ret."</a>";
|
||||||
}
|
}
|
||||||
@@ -356,28 +364,30 @@ class pm_handler_shortcodes
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_from($parm = '')
|
public function sc_pm_from($parm = '')
|
||||||
{
|
{
|
||||||
|
$url = e107::getUrl();
|
||||||
|
|
||||||
if('link' == $parm)
|
if('link' == $parm)
|
||||||
{
|
{
|
||||||
return "<a href='".$this->e107->url->create('user/profile/view', array('id' => $this->pmInfo['pm_from'], 'name' => $this->pmInfo['user_name']))."'>{$this->pmInfo['user_name']}</a>";
|
return "<a href='".$url->create('user/profile/view', array('id' => $this->var['pm_from'], 'name' => $this->var['user_name']))."'>{$this->var['user_name']}</a>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return $this->pmInfo['user_name'];
|
return $this->var['user_name'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_select()
|
public function sc_pm_select()
|
||||||
{
|
{
|
||||||
return "<input type='checkbox' name='selected_pm[{$this->pmInfo['pm_id']}]' value='1' />";
|
return "<input type='checkbox' name='selected_pm[{$this->var['pm_id']}]' value='1' />";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_read_icon()
|
public function sc_pm_read_icon()
|
||||||
{
|
{
|
||||||
if($this->pmInfo['pm_read'] > 0 )
|
if($this->var['pm_read'] > 0 )
|
||||||
{
|
{
|
||||||
return PM_READ_ICON;
|
return PM_READ_ICON;
|
||||||
}
|
}
|
||||||
@@ -388,26 +398,26 @@ class pm_handler_shortcodes
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_avatar()
|
public function sc_pm_avatar()
|
||||||
{
|
{
|
||||||
return $this->e107->tp->parseTemplate("{USER_AVATAR={$this->pmInfo['user_image']}}");
|
return e107::getParser()->parseTemplate("{USER_AVATAR={$this->var['user_image']}}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_block_user()
|
public function sc_pm_block_user()
|
||||||
{
|
{
|
||||||
if(in_array($this->pmInfo['pm_from'], $this->pmBlocks))
|
if(in_array($this->var['pm_from'], $this->pmBlocks))
|
||||||
{
|
{
|
||||||
return "<a href='".$this->url('action/unblock', 'id='.$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>";
|
return "<a href='".$this->url('action/unblock', 'id='.$this->var['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
|
else
|
||||||
{
|
{
|
||||||
return "<a href='".$this->url('action/block', 'id='.$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>";
|
return "<a href='".$this->url('action/block', 'id='.$this->var['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 = '')
|
public function sc_pm_delete($parm = '')
|
||||||
{
|
{
|
||||||
if($parm != '')
|
if($parm != '')
|
||||||
{
|
{
|
||||||
@@ -415,53 +425,54 @@ class pm_handler_shortcodes
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$extra = '.'.($this->pmInfo['pm_from'] == USERID ? 'outbox' : 'inbox');
|
$extra = '.'.($this->var['pm_from'] == USERID ? 'outbox' : 'inbox');
|
||||||
}
|
}
|
||||||
if($extra !== 'inbox' && $extra !== 'outbox') return '';
|
if($extra !== 'inbox' && $extra !== 'outbox') return '';
|
||||||
$action = $extra == 'outbox' ? 'delete-out' : 'delete-in';
|
$action = $extra == 'outbox' ? 'delete-out' : 'delete-in';
|
||||||
return "<a href='".$this->url('action/'.$action, 'id='.$this->pmInfo['pm_id'])."'><img src='".e_PLUGIN_ABS."pm/images/mail_delete.png' title='".LAN_PM_52."' alt='".LAN_PM_52."' class='icon S16' /></a>";
|
return "<a href='".$this->url('action/'.$action, 'id='.$this->var['pm_id'])."'><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()
|
public function sc_pm_delete_selected()
|
||||||
{
|
{
|
||||||
return "<input type='submit' name='pm_delete_selected' class='button' value='".LAN_PM_53."' />";
|
return "<input type='submit' name='pm_delete_selected' class='button btn btn-danger' value='".LAN_PM_53."' />";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_to($parm = '')
|
public function sc_pm_to($parm = '')
|
||||||
{
|
{
|
||||||
if(is_numeric($this->pmInfo['pm_to']))
|
if(is_numeric($this->var['pm_to']))
|
||||||
{
|
{
|
||||||
if('link' == $parm)
|
if('link' == $parm)
|
||||||
{
|
{
|
||||||
return "<a href='".$this->e107->url->create('user/profile/view', array('id' => $this->pmInfo['pm_to'], 'name' => $this->pmInfo['user_name']))."'>{$this->pmInfo['user_name']}</a>";
|
$url = e107::getUrl();
|
||||||
|
return "<a href='".$url->create('user/profile/view', array('id' => $this->var['pm_to'], 'name' => $this->var['user_name']))."'>{$this->var['user_name']}</a>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return $this->pmInfo['user_name'];
|
return $this->var['user_name'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return LAN_PM_63.' '.$this->pmInfo['pm_to'];
|
return LAN_PM_63.' '.$this->var['pm_to'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_message()
|
public function sc_pm_message()
|
||||||
{
|
{
|
||||||
return $this->e107->tp->toHTML($this->pmInfo['pm_text'], true);
|
return e107::getParser()->toHTML($this->var['pm_text'], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_reply()
|
public function sc_pm_reply()
|
||||||
{
|
{
|
||||||
if($this->pmInfo['pm_to'] == USERID)
|
if($this->var['pm_to'] == USERID)
|
||||||
{
|
{
|
||||||
// pm_id is mapped insisde the config to id key
|
// pm_id is mapped insisde the config to id key
|
||||||
$ret = "
|
$ret = "
|
||||||
<form method='post' action='".$this->url('reply', $this->pmInfo)."'>
|
<form method='post' action='".$this->url('reply', $this->var)."'>
|
||||||
<input type='checkbox' name='quote' /> ".LAN_PM_54."  <input class='button' type='submit' name='reply' value='".LAN_PM_55."' />
|
<input type='checkbox' name='quote' /> ".LAN_PM_54."  <input class='button' type='submit' name='reply' value='".LAN_PM_55."' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
@@ -470,7 +481,7 @@ class pm_handler_shortcodes
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_send_pm_link()
|
public function sc_pm_send_pm_link()
|
||||||
{
|
{
|
||||||
$pm_outbox = $this->pmManager->pm_getInfo('outbox');
|
$pm_outbox = $this->pmManager->pm_getInfo('outbox');
|
||||||
if($pm_outbox['outbox']['filled'] < 100)
|
if($pm_outbox['outbox']['filled'] < 100)
|
||||||
@@ -482,7 +493,7 @@ class pm_handler_shortcodes
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_newpm_animate()
|
public function sc_pm_newpm_animate()
|
||||||
{
|
{
|
||||||
if($this->pmPrefs['animate'])
|
if($this->pmPrefs['animate'])
|
||||||
{
|
{
|
||||||
@@ -496,27 +507,28 @@ class pm_handler_shortcodes
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_nextprev($parm = '')
|
public function sc_pm_nextprev($parm = '')
|
||||||
{
|
{
|
||||||
return $this->e107->tp->parseTemplate("{NEXTPREV={$this->pmNextPrev['total']},{$this->pmPrefs['perpage']},{$this->pmNextPrev['start']},".e_SELF."?{$parm}.[FROM]}");
|
return e107::getParser()->parseTemplate("{NEXTPREV={$this->pmNextPrev['total']},{$this->pmPrefs['perpage']},{$this->pmNextPrev['start']},".e_SELF."?{$parm}.[FROM]}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_blocked_senders_manage()
|
public function sc_pm_blocked_senders_manage()
|
||||||
{
|
{
|
||||||
$count = $this->e107->sql->db_Count('private_msg_block', '(*)', 'WHERE `pm_block_to` = '.USERID);
|
$sql = e107::getDb();
|
||||||
|
$count = $sql->db_Count('private_msg_block', '(*)', 'WHERE `pm_block_to` = '.USERID);
|
||||||
if (!$count) return '';
|
if (!$count) return '';
|
||||||
return LAN_PM_66;
|
return LAN_PM_66;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_blocked_select()
|
public function sc_pm_blocked_select()
|
||||||
{
|
{
|
||||||
return "<input type='checkbox' name='selected_pm[{$this->pmBlocked['pm_block_from']}]' value='1' />";
|
return "<input type='checkbox' name='selected_pm[{$this->pmBlocked['pm_block_from']}]' value='1' />";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_blocked_user($parm = '')
|
public function sc_pm_blocked_user($parm = '')
|
||||||
{
|
{
|
||||||
if (!$this->pmBlocked['user_name'])
|
if (!$this->pmBlocked['user_name'])
|
||||||
{
|
{
|
||||||
@@ -524,7 +536,9 @@ class pm_handler_shortcodes
|
|||||||
}
|
}
|
||||||
if('link' == $parm)
|
if('link' == $parm)
|
||||||
{
|
{
|
||||||
return "<a href='".$this->e107->url->create('user/profile/view', array('id' => $this->pmBlocked['pm_block_from'], 'name' => $this->pmBlocked['user_name']))."'>{$this->pmBlocked['user_name']}</a>";
|
|
||||||
|
$url = e107::getUrl();
|
||||||
|
return "<a href='".$url->create('user/profile/view', array('id' => $this->pmBlocked['pm_block_from'], 'name' => $this->pmBlocked['user_name']))."'>{$this->pmBlocked['user_name']}</a>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -533,20 +547,20 @@ class pm_handler_shortcodes
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_blocked_date($parm='')
|
public function sc_pm_blocked_date($parm='')
|
||||||
{
|
{
|
||||||
require_once(e_HANDLER.'date_handler.php');
|
require_once(e_HANDLER.'date_handler.php');
|
||||||
return convert::convert_date($this->pmBlocked['pm_block_datestamp'], $parm);
|
return convert::convert_date($this->pmBlocked['pm_block_datestamp'], $parm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sc_pm_blocked_delete()
|
public function sc_pm_blocked_delete()
|
||||||
{
|
{
|
||||||
return "<a href='".$this->url('action/delete-blocked', array('id' => $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>";
|
return "<a href='".$this->url('action/delete-blocked', array('id' => $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()
|
public function sc_pm_delete_blocked_selected()
|
||||||
{
|
{
|
||||||
return "<input type='submit' name='pm_delete_blocked_selected' class='button' value='".LAN_PM_53."' />";
|
return "<input type='submit' name='pm_delete_blocked_selected' class='button' value='".LAN_PM_53."' />";
|
||||||
}
|
}
|
||||||
@@ -556,8 +570,11 @@ class pm_handler_shortcodes
|
|||||||
*/
|
*/
|
||||||
public function url($action, $params = array(), $options = array())
|
public function url($action, $params = array(), $options = array())
|
||||||
{
|
{
|
||||||
|
if($action == "new"){ $action = 'send'; }
|
||||||
|
return e_PLUGIN."pm/pm.php?".$action; //FIXME
|
||||||
if(strpos($action, '/') === false) $action = 'view/'.$action;
|
if(strpos($action, '/') === false) $action = 'view/'.$action;
|
||||||
$this->e107->url->create('pm/'.$action, $params, $options);
|
|
||||||
|
e107::getUrl()->create('pm/'.$action, $params, $options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -68,7 +68,7 @@ $sc_style['PM_REPLY']['post'] = "</td>
|
|||||||
";
|
";
|
||||||
|
|
||||||
$PM_SEND_PM = "<div style='text-align: center'>
|
$PM_SEND_PM = "<div style='text-align: center'>
|
||||||
<table style='width:95%' class='fborder'>
|
<table style='width:95%' class='table fborder'>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan='2' class='fcaption'>".LAN_PM_1.": </td>
|
<td colspan='2' class='fcaption'>".LAN_PM_1.": </td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -95,7 +95,7 @@ $PM_SEND_PM = "<div style='text-align: center'>
|
|||||||
";
|
";
|
||||||
|
|
||||||
$PM_INBOX_HEADER = "
|
$PM_INBOX_HEADER = "
|
||||||
<table class='fborder' style='width:95%'>
|
<table class='table fborder' style='width:95%'>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='fcaption' style='width:1%'> </td>
|
<td class='fcaption' style='width:1%'> </td>
|
||||||
<td class='fcaption' style='width:1%'> </td>
|
<td class='fcaption' style='width:1%'> </td>
|
||||||
@@ -135,15 +135,18 @@ $PM_INBOX_FOOTER = "
|
|||||||
";
|
";
|
||||||
|
|
||||||
$PM_OUTBOX_HEADER = "
|
$PM_OUTBOX_HEADER = "
|
||||||
<table class='fborder' style='width:95%'>
|
<table class='table fborder' style='width:95%'>
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='fcaption' style='width:1%'> </td>
|
<th class='fcaption' style='width:1%'> </th>
|
||||||
<td class='fcaption' style='width:1%'> </td>
|
<th class='fcaption' style='width:1%'> </th>
|
||||||
<td class='fcaption' style='width:38%'>".LAN_PM_5."</td>
|
<th class='fcaption' style='width:38%'>".LAN_PM_5."</th>
|
||||||
<td class='fcaption' style='width:22%'>".LAN_PM_2."</td>
|
<th class='fcaption' style='width:22%'>".LAN_PM_2."</th>
|
||||||
<td class='fcaption' style='width:30%'>".LAN_PM_33."</td>
|
<th class='fcaption' style='width:30%'>".LAN_PM_33."</th>
|
||||||
<td class='fcaption' style='width:8%'> </td>
|
<th class='fcaption' style='width:8%'> </th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
";
|
";
|
||||||
|
|
||||||
$PM_OUTBOX_TABLE = "
|
$PM_OUTBOX_TABLE = "
|
||||||
@@ -171,12 +174,13 @@ $PM_OUTBOX_FOOTER = "
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{PM_NEXTPREV=outbox}
|
{PM_NEXTPREV=outbox}
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
";
|
";
|
||||||
|
|
||||||
|
|
||||||
$PM_BLOCKED_HEADER = "
|
$PM_BLOCKED_HEADER = "
|
||||||
<table class='fborder' style='width:95%'>
|
<table class='table fborder' style='width:95%'>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='fcaption' style='width:5%'> </td>
|
<td class='fcaption' style='width:5%'> </td>
|
||||||
<td class='fcaption' style='width:48%'>".LAN_PM_68."</td>
|
<td class='fcaption' style='width:48%'>".LAN_PM_68."</td>
|
||||||
@@ -213,7 +217,7 @@ $PM_BLOCKED_FOOTER = "
|
|||||||
|
|
||||||
$PM_SHOW =
|
$PM_SHOW =
|
||||||
"<div style='text-align: center'>
|
"<div style='text-align: center'>
|
||||||
<table class='fborder' style='width:95%'>
|
<table class='table fborder' style='width:95%'>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='fcaption' colspan='2'>{PM_SUBJECT}</td>
|
<td class='fcaption' colspan='2'>{PM_SUBJECT}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@@ -25,17 +25,29 @@
|
|||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
if (!e107::isInstalled('pm')) { return ''; }
|
if (!e107::isInstalled('pm')) { return ''; }
|
||||||
global $sysprefs, $pm_prefs;
|
|
||||||
if(!isset($pm_prefs['perpage']))
|
|
||||||
{
|
$pm_prefs = e107::getPlugPref('pm');
|
||||||
$pm_prefs = $sysprefs->getArray('pm_prefs');
|
//global $sysprefs, $pm_prefs;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
//if(!isset($pm_prefs['perpage']))
|
||||||
|
//{
|
||||||
|
// $pm_prefs = $sysprefs->getArray('pm_prefs');
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
require_once(e_PLUGIN.'pm/pm_func.php');
|
require_once(e_PLUGIN.'pm/pm_func.php');
|
||||||
|
|
||||||
e107::getScParser();
|
e107::getScParser();
|
||||||
|
|
||||||
require_once(e_PLUGIN.'pm/pm_shortcodes.php');
|
require_once(e_PLUGIN.'pm/pm_shortcodes.php');
|
||||||
setScVar('pm_handler_shortcodes','pmPrefs', $pm_prefs);
|
|
||||||
|
//setScVar('pm_handler_shortcodes','pmPrefs', $pm_prefs);
|
||||||
$pmManager = new pmbox_manager($pm_prefs);
|
$pmManager = new pmbox_manager($pm_prefs);
|
||||||
setScVar('pm_handler_shortcodes','pmManager', $pmManager);
|
|
||||||
|
//setScVar('pm_handler_shortcodes','pmManager', $pmManager);
|
||||||
|
|
||||||
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."' />");
|
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."' />");
|
||||||
define('PM_OUTBOX_ICON', "<img src='".e_PLUGIN_ABS."pm/images/mail_send.png' class='icon S16' alt='".LAN_PM_26."' title='".LAN_PM_26."' />");
|
define('PM_OUTBOX_ICON', "<img src='".e_PLUGIN_ABS."pm/images/mail_send.png' class='icon S16' alt='".LAN_PM_26."' title='".LAN_PM_26."' />");
|
||||||
@@ -61,15 +73,16 @@ $sc_style['PM_BLOCKED_SENDERS_MANAGE']['post'] = '</a> ]';
|
|||||||
|
|
||||||
if(!isset($pm_menu_template))
|
if(!isset($pm_menu_template))
|
||||||
{
|
{
|
||||||
|
//FIXME URL Breaks
|
||||||
$pm_menu_template = "
|
$pm_menu_template = "
|
||||||
<a href='{URL=pm|main|f=box&box=inbox}'>".PM_INBOX_ICON."</a>
|
<a href='{U/RL=pm|main|f=box&box=inbox}'>".PM_INBOX_ICON."</a>
|
||||||
<a href='{URL=pm|main|f=box&box=inbox}'>".LAN_PM_25."</a>
|
<a href='{U/RL=pm|main|f=box&box=inbox}'>".LAN_PM_25."</a>
|
||||||
{PM_NEWPM_ANIMATE}
|
{PM_NEWPM_ANIMATE}
|
||||||
<br />
|
<br />
|
||||||
{PM_INBOX_TOTAL} ".LAN_PM_36.", {PM_INBOX_UNREAD} ".LAN_PM_37." {PM_INBOX_FILLED}
|
{PM_INBOX_TOTAL} ".LAN_PM_36.", {PM_INBOX_UNREAD} ".LAN_PM_37." {PM_INBOX_FILLED}
|
||||||
<br />
|
<br />
|
||||||
<a href='{URL=pm|main|f=box&box=outbox}'>".PM_OUTBOX_ICON."</a>
|
<a href='{U/RL=pm|main|f=box&box=outbox}'>".PM_OUTBOX_ICON."</a>
|
||||||
<a href='{URL=pm|main|f=box&box=outbox}'>".LAN_PM_26."</a><br />
|
<a href='{U/RL=pm|main|f=box&box=outbox}'>".LAN_PM_26."</a><br />
|
||||||
{PM_OUTBOX_TOTAL} ".LAN_PM_36.", {PM_OUTBOX_UNREAD} ".LAN_PM_37." {PM_OUTBOX_FILLED}
|
{PM_OUTBOX_TOTAL} ".LAN_PM_36.", {PM_OUTBOX_UNREAD} ".LAN_PM_37." {PM_OUTBOX_FILLED}
|
||||||
{PM_SEND_PM_LINK}
|
{PM_SEND_PM_LINK}
|
||||||
{PM_BLOCKED_SENDERS_MANAGE}
|
{PM_BLOCKED_SENDERS_MANAGE}
|
||||||
@@ -80,12 +93,18 @@ if(!isset($pm_menu_template))
|
|||||||
if(check_class($pm_prefs['pm_class']))
|
if(check_class($pm_prefs['pm_class']))
|
||||||
{
|
{
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
|
$sc = e107::getScBatch('pm',TRUE);
|
||||||
|
|
||||||
$pm_inbox = $pmManager->pm_getInfo('inbox');
|
$pm_inbox = $pmManager->pm_getInfo('inbox');
|
||||||
|
|
||||||
$txt = "\n".$tp->parseTemplate($pm_menu_template, TRUE);
|
$txt = "\n".$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')
|
if($pm_inbox['inbox']['new'] > 0 && $pm_prefs['popup'] && strpos(e_SELF, 'pm.php') === FALSE && $_COOKIE['pm-alert'] != 'ON')
|
||||||
{
|
{
|
||||||
|
|
||||||
$txt .= pm_show_popup($pm_inbox, $pm_prefs['popup_delay']);
|
$txt .= pm_show_popup($pm_inbox, $pm_prefs['popup_delay']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$ns->tablerender(LAN_PM, $txt, 'pm');
|
$ns->tablerender(LAN_PM, $txt, 'pm');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
/*
|
//<?php
|
||||||
|
/*
|
||||||
|
*//*
|
||||||
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
@@ -15,8 +17,10 @@
|
|||||||
|
|
||||||
include_lan(e_PLUGIN.'pm/languages/'.e_LANGUAGE.'.php');
|
include_lan(e_PLUGIN.'pm/languages/'.e_LANGUAGE.'.php');
|
||||||
|
|
||||||
global $sysprefs, $pm_prefs;
|
// global $sysprefs, $pm_prefs;
|
||||||
$pm_prefs = $sysprefs->getArray("pm_prefs");
|
// $pm_prefs = $sysprefs->getArray("pm_prefs");
|
||||||
|
$pm_prefs = e107::getPlugPref('pm');
|
||||||
|
|
||||||
if(check_class($pm_prefs['pm_class']))
|
if(check_class($pm_prefs['pm_class']))
|
||||||
{
|
{
|
||||||
if(file_exists(THEME.'forum/pm.png'))
|
if(file_exists(THEME.'forum/pm.png'))
|
||||||
|
Reference in New Issue
Block a user