".
@@ -227,6 +275,8 @@ function show_send($to_uid)
return $text;
}
+
+
function show_inbox($start = 0)
{
global $pm, $tp, $pm_shortcodes, $pm_info, $pm_blocks, $pmlist, $pm_start, $pm_prefs;
@@ -256,13 +306,16 @@ function show_inbox($start = 0)
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");
+ 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 = "
";
+ return $txt;
}
+
+
+
?>
\ No newline at end of file
diff --git a/e107_plugins/pm/pm_class.php b/e107_plugins/pm/pm_class.php
index c22ff5379..b39719725 100755
--- a/e107_plugins/pm/pm_class.php
+++ b/e107_plugins/pm/pm_class.php
@@ -9,9 +9,9 @@
*
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/pm/pm_class.php,v $
- * $Revision: 1.8 $
- * $Date: 2009-11-18 01:05:53 $
- * $Author: e107coders $
+ * $Revision: 1.9 $
+ * $Date: 2009-12-10 20:40:38 $
+ * $Author: e107steved $
*/
if (!defined('e107_INIT')) { exit; }
@@ -146,22 +146,22 @@ class private_message
{
global $sql;
$pmid = (int)$pmid;
- $ret = "";
+ $ret = '';
$del_pm = FALSE;
- $newvals = "";
- if($sql->db_Select("private_msg", "*", "pm_id = ".$pmid." AND (pm_from = ".USERID." OR pm_to = ".USERID.")"))
+ $newvals = '';
+ if($sql->db_Select('private_msg', '*', 'pm_id = '.$pmid.' AND (pm_from = '.USERID.' OR pm_to = '.USERID.')'))
{
$row = $sql->db_Fetch();
if($row['pm_to'] == USERID)
{
- $newvals = "pm_read_del = 1";
- $ret .= LAN_PM_42."
";
+ $newvals = 'pm_read_del = 1';
+ $ret .= LAN_PM_42.'
';
if($row['pm_sent_del'] == 1) { $del_pm = TRUE; }
}
if($row['pm_from'] == USERID)
{
- if($newvals != "") { $del_pm = TRUE; }
- $newvals = "pm_sent_del = 1";
+ if($newvals != '') { $del_pm = TRUE; }
+ $newvals = 'pm_sent_del = 1';
$ret .= LAN_PM_43."
";
if($row['pm_read_del'] == 1) { $del_pm = TRUE; }
}
@@ -170,16 +170,26 @@ class private_message
{
// Delete any attachments and remove PM from db
$attachments = explode(chr(0), $row['pm_attachments']);
+ $aCount = array(0,0);
foreach($attachments as $a)
{
- $filename = getcwd()."/attachments/{$a}";
- unlink($filename);
+ $a = trim($a);
+ if ($a)
+ {
+ // $filename = getcwd()."/attachments/{$a}";
+ $filename = e_PLUGIN.'pm/attachments/'.$a;
+ if (unlink($filename)) $aCount[0]++; else $aCount[1]++;
+ }
}
- $sql->db_Delete("private_msg", "pm_id = ".$pmid);
+ if ($aCount[0] || $aCount[1])
+ {
+ $ret .= str_replace(array('--GOOD--', '--FAIL--'), $aCount, LAN_PM_71).'
';
+ }
+ $sql->db_Delete('private_msg', 'pm_id = '.$pmid);
}
else
{
- $sql->db_Update("private_msg", $newvals." WHERE pm_id = ".$pmid);
+ $sql->db_Update('private_msg', $newvals.' WHERE pm_id = '.$pmid);
}
return $ret;
}
@@ -187,7 +197,7 @@ class private_message
function pm_send_notify($uid, $pminfo, $pmid, $attach_count = 0)
{
- require_once(e_HANDLER."mail.php");
+ require_once(e_HANDLER.'mail.php');
global $PLUGINS_DIRECTORY;
$subject = LAN_PM_100.SITENAME;
$pmlink = SITEURL.$PLUGINS_DIRECTORY."pm/pm.php?show.{$pmid}";
@@ -215,15 +225,43 @@ class private_message
sendemail($pminfo['from_email'], $subject, $txt, $pminfo['from_name']);
}
+
+ /**
+ * Get list of users blocked from sending to a specific user ID.
+ * @param integer $to - user ID
+ * @return array of blocked users as user IDs
+ */
function block_get($to = USERID)
+ {
+ global $sql;
+ $ret = array();
+ $to = intval($to); // Precautionary
+ if ($sql->db_Select('private_msg_block', 'pm_block_from', 'pm_block_to = '.$to))
+ {
+ while($row = $sql->db_Fetch(MYSQL_ASSOC))
+ {
+ $ret[] = $row['pm_block_from'];
+ }
+ }
+ return $ret;
+ }
+
+
+ /**
+ * Get list of users blocked from sending to a specific user ID.
+ * @param integer $to - user ID
+ * @return array of blocked users, including specific user info
+ */
+ function block_get_user($to = USERID)
{
global $sql, $tp;
$ret = array();
- if($sql->db_Select("private_msg_block", "pm_block_from", "pm_block_to = '".$tp -> toDB($to)."'"))
+ $to = intval($to); // Precautionary
+ if ($sql->db_Select_gen('SELECT pm.*, u.user_name FROM `#private_msg_block` AS pm LEFT JOIN `#user` AS u ON `pm`.`pm_block_from` = `u`.`user_id` WHERE pm_block_to = '.$to))
{
- while($row = $sql->db_Fetch())
+ while($row = $sql->db_Fetch(MYSQL_ASSOC))
{
- $ret[] = $row['pm_block_from'];
+ $ret[] = $row;
}
}
return $ret;
@@ -265,15 +303,16 @@ class private_message
function block_del($from, $to = USERID)
{
global $sql;
- if($sql->db_Select("user", "user_name", "user_id = '".intval($from)."'"))
+ $from = intval($from);
+ if($sql->db_Select('user', 'user_name', 'user_id = '.$from))
{
$uinfo = $sql->db_Fetch();
- if($sql->db_Select("private_msg_block", "pm_block_id", "pm_block_from = '".intval($from)."' AND pm_block_to = '".intval($to)."'"))
+ if($sql->db_Select('private_msg_block', 'pm_block_id', 'pm_block_from = '.$from.' AND pm_block_to = '.intval($to)))
{
$row = $sql->db_Fetch();
- if($sql->db_Delete("private_msg_block", "pm_block_id = '".intval($row['pm_block_id'])."'"))
+ if($sql->db_Delete('private_msg_block', 'pm_block_id = '.intval($row['pm_block_id'])))
{
- return str_replace("{UNAME}", $uinfo['user_name'], LAN_PM_44);
+ return str_replace('{UNAME}', $uinfo['user_name'], LAN_PM_44);
}
else
{
@@ -282,7 +321,7 @@ class private_message
}
else
{
- return str_replace("{UNAME}", $uinfo['user_name'], LAN_PM_46);
+ return str_replace('{UNAME}', $uinfo['user_name'], LAN_PM_46);
}
}
else
@@ -294,7 +333,7 @@ class private_message
function pm_getuid($var)
{
global $sql, $tp;
-
+ $var = trim($var);
if($sql->db_Select("user", "user_id, user_name, user_class, user_email", "user_name LIKE '".$sql -> escape(trim($var), TRUE)."'"))
{
$row = $sql->db_Fetch();
diff --git a/e107_plugins/pm/pm_conf.php b/e107_plugins/pm/pm_conf.php
index 37bc5a471..cbd037605 100755
--- a/e107_plugins/pm/pm_conf.php
+++ b/e107_plugins/pm/pm_conf.php
@@ -9,45 +9,47 @@
*
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/pm/pm_conf.php,v $
- * $Revision: 1.6 $
- * $Date: 2009-11-18 01:05:53 $
- * $Author: e107coders $
+ * $Revision: 1.7 $
+ * $Date: 2009-12-10 20:40:38 $
+ * $Author: e107steved $
*/
$retrieve_prefs[] = 'pm_prefs';
$eplug_admin = TRUE;
-require_once("../../class2.php");
-require_once(e_PLUGIN."pm/pm_class.php");
-require_once(e_HANDLER."userclass_class.php");
-require_once(e_HANDLER."form_handler.php");
+require_once('../../class2.php');
+require_once(e_PLUGIN.'pm/pm_class.php');
+require_once(e_HANDLER.'userclass_class.php');
+require_once(e_HANDLER.'form_handler.php');
-if (!getperms("P"))
+if (!e107::isInstalled('pm') || !getperms('P'))
{
- header("location:".e_BASE."index.php");
+ header('location:'.e_BASE.'index.php');
exit;
}
$action = e_QUERY;
-require_once(e_ADMIN."auth.php");
+require_once(e_ADMIN.'auth.php');
-if($action == "")
+if($action == '')
{
- $action = "main";
+ $action = 'main';
}
-$pm_prefs = $sysprefs->getArray("pm_prefs");
+$pm_prefs = $sysprefs->getArray('pm_prefs');
//pm_prefs record not found in core table, set to defaults and create record
if(!is_array($pm_prefs))
{
- require_once(e_PLUGIN."pm/pm_default.php");
- $pm_prefs = pm_set_default_prefs();
+ require_once(e_PLUGIN.'pm/pm_default.php');
+ $pm_prefs = pm_set_default_prefs(); // Use the default settings
$sysprefs->setArray('pm_prefs');
$message = ADLAN_PM_3;
}
-$lan_file = e_PLUGIN."pm/languages/admin/".e_LANGUAGE.".php";
+
+
+//$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");
if (isset($_POST['update_prefs']))
@@ -60,6 +62,7 @@ if (isset($_POST['update_prefs']))
$message = ADLAN_PM_4;
}
+
if(isset($_POST['addlimit']))
{
if($sql->db_Select('generic','gen_id',"gen_type = 'pm_limit' AND gen_datestamp = {$_POST['newlimit_class']}"))
@@ -109,24 +112,25 @@ if(isset($_POST['updatelimits']))
}
}
+
if(isset($message))
{
- $ns->tablerender("", $message);
+ $ns->tablerender('', $message);
}
-if($action == "main")
+switch ($action)
{
- $ns->tablerender(ADLAN_PM_12, show_options());
+ case 'main' :
+ $ns->tablerender(ADLAN_PM_12, show_options());
+ break;
+ case 'limits' :
+ $ns->tablerender(ADLAN_PM_14, show_limits());
+ $ns->tablerender(ADLAN_PM_15, add_limit());
+ break;
}
-if($action == "limits")
-{
- $ns->tablerender(ADLAN_PM_14, show_limits());
- $ns->tablerender(ADLAN_PM_15, add_limit());
-}
-
-require_once(e_ADMIN."footer.php");
+require_once(e_ADMIN.'footer.php');
function yes_no($fname)
{
@@ -138,6 +142,7 @@ function yes_no($fname)
}
+
function show_options()
{
global $pm_prefs;
@@ -217,6 +222,10 @@ function show_options()
return $txt;
}
+
+
+
+
function show_limits()
{
global $sql, $pref;
diff --git a/e107_plugins/pm/pm_default.php b/e107_plugins/pm/pm_default.php
index 58bdadeaf..9b58aa870 100755
--- a/e107_plugins/pm/pm_default.php
+++ b/e107_plugins/pm/pm_default.php
@@ -4,19 +4,20 @@ if (!defined('e107_INIT')) { exit; }
function pm_set_default_prefs()
{
$ret = array(
- 'title' => 'PMLAN_PM',
+ 'title' => 'PMLAN_PM',
'animate' => '1',
'dropdown' => '0',
- 'read_timeout' => '0',
+ 'read_timeout' => '0',
'unread_timeout' => '0',
'popup' => '0',
'popup_delay' => '',
+ 'perpage' => '10',
'pm_class' => e_UC_MEMBER,
'notify_class' => e_UC_ADMIN,
- 'receipt_class' => e_UC_MEMBER,
+ 'receipt_class' => e_UC_MEMBER,
'attach_class' => e_UC_ADMIN,
'attach_size' => 500,
- 'sendall_class' => e_UC_ADMIN,
+ 'sendall_class' => e_UC_ADMIN,
'multi_class' => e_UC_ADMIN,
'allow_userclass' => '1'
);
diff --git a/e107_plugins/pm/pm_shortcodes.php b/e107_plugins/pm/pm_shortcodes.php
index a65ab6c7b..1011e3a32 100755
--- a/e107_plugins/pm/pm_shortcodes.php
+++ b/e107_plugins/pm/pm_shortcodes.php
@@ -9,9 +9,9 @@
*
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/pm/pm_shortcodes.php,v $
- * $Revision: 1.13 $
- * $Date: 2009-11-18 01:05:53 $
- * $Author: e107coders $
+ * $Revision: 1.14 $
+ * $Date: 2009-12-10 20:40:38 $
+ * $Author: e107steved $
*/
if (!defined('e107_INIT')) { exit; }
@@ -29,27 +29,6 @@ if($pm_info['from_name'])
require_once(e_HANDLER."user_select_class.php");
$us = new user_select;
$type = ($pm_prefs['dropdown'] == TRUE ? 'list' : 'popup');
-
-
-$ret = "
-
- -
-
-
-
-
Type the name of a user
-
-
-
-
-
";
-
-return $ret;
-
-
-
if(check_class($pm_prefs['multi_class']))
{
$ret = $us->select_form($type, 'textarea.pm_to');
@@ -61,6 +40,7 @@ else
return $ret;
SC_END
+
SC_BEGIN FORM_TOCLASS
global $pm_prefs, $pm_info;
if($pm_info['from_name'])
@@ -259,10 +239,13 @@ SC_END
SC_BEGIN PM_SUBJECT
global $pm_info, $tp;
-$ret = $tp->toHTML($pm_info['pm_subject'], true, 'no_make_clickable,no_hook');
-if('link' == $parm)
+$ret = $tp->toHTML($pm_info['pm_subject'], true, 'USER_TITLE');
+$prm = explode(',',$parm);
+if('link' == $prm[0])
{
- $ret = "
".$ret."";
+ $extra = '';
+ if (isset($prm[1])) $extra = '.'.$prm[1];
+ $ret = "
".$ret."";
}
return $ret;
SC_END
@@ -392,10 +375,63 @@ if($pm_prefs['animate'])
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 "
";
+SC_END
+
+
+
+SC_BEGIN PM_BLOCKED_USER
+global $pmBlocked;
+if (!$pmBlocked['user_name'])
+{
+ return LAN_PM_72;
+}
+if('link' == $parm)
+{
+ return "
{$pmBlocked['user_name']}";
+}
+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 "

";
+SC_END
+
+SC_BEGIN DELETE_BLOCKED_SELECTED
+return "
";
+SC_END
+
*/
?>
\ No newline at end of file
diff --git a/e107_plugins/pm/pm_template.php b/e107_plugins/pm/pm_template.php
index d8d7378bd..4ac465479 100755
--- a/e107_plugins/pm/pm_template.php
+++ b/e107_plugins/pm/pm_template.php
@@ -9,9 +9,9 @@
*
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/pm/pm_template.php,v $
- * $Revision: 1.5 $
- * $Date: 2009-11-18 01:05:53 $
- * $Author: e107coders $
+ * $Revision: 1.6 $
+ * $Date: 2009-12-10 20:40:39 $
+ * $Author: e107steved $
*/
if (!defined('e107_INIT')) { exit; }
@@ -101,7 +101,7 @@ $PM_INBOX_TABLE = "
-
+
@@ -117,6 +117,7 @@ $PM_INBOX_EMPTY = "
$PM_INBOX_FOOTER = "
@@ -140,7 +141,7 @@ $PM_OUTBOX_TABLE = "
-
+
@@ -156,6 +157,7 @@ $PM_OUTBOX_EMPTY = "
$PM_OUTBOX_FOOTER = "
@@ -163,6 +165,43 @@ $PM_OUTBOX_FOOTER = "
";
+
+$PM_BLOCKED_HEADER = "
+
+
+ |
+ ".LAN_PM_68." |
+ ".LAN_PM_69." |
+ |
+
+";
+
+$PM_BLOCKED_TABLE = "
+
+
+
+
+
+
+";
+
+$PM_BLOCKED_EMPTY = "
+
+
+
+";
+
+$PM_BLOCKED_FOOTER = "
+
+
+
+
+";
+
+
+
$PM_SHOW =
"
diff --git a/e107_plugins/pm/private_msg_menu.php b/e107_plugins/pm/private_msg_menu.php
index 508511942..98f43a36e 100755
--- a/e107_plugins/pm/private_msg_menu.php
+++ b/e107_plugins/pm/private_msg_menu.php
@@ -9,24 +9,25 @@
*
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/pm/private_msg_menu.php,v $
- * $Revision: 1.9 $
- * $Date: 2009-11-18 01:05:53 $
- * $Author: e107coders $
+ * $Revision: 1.10 $
+ * $Date: 2009-12-10 20:40:39 $
+ * $Author: e107steved $
*/
if (!defined('e107_INIT')) { exit; }
+if (!e107::isInstalled('pm')) { return ''; }
global $sysprefs, $pref, $pm_prefs;
if(!isset($pm_prefs['perpage']))
{
- $pm_prefs = $sysprefs->getArray("pm_prefs");
+ $pm_prefs = $sysprefs->getArray('pm_prefs');
}
-require_once(e_PLUGIN."pm/pm_func.php");
+require_once(e_PLUGIN.'pm/pm_func.php');
pm_getInfo('clear');
-define("PM_INBOX_ICON", "
");
-define("PM_OUTBOX_ICON", "
");
-define("PM_SEND_LINK", LAN_PM_35);
-define("NEWPM_ANIMATION", "
");
+define('PM_INBOX_ICON', "
");
+define('PM_OUTBOX_ICON', "
");
+define('PM_SEND_LINK', LAN_PM_35);
+define('NEWPM_ANIMATION', "
");
$sc_style['SEND_PM_LINK']['pre'] = "
[ ";
@@ -41,6 +42,9 @@ $sc_style['OUTBOX_FILLED']['post'] = "%]";
$sc_style['NEWPM_ANIMATE']['pre'] = "";
$sc_style['NEWPM_ANIMATE']['post'] = "";
+$sc_style['BLOCKED_SENDERS_MANAGE']['pre'] = "
[ ";
+$sc_style['BLOCKED_SENDERS_MANAGE']['post'] = ' ]';
+
if(!isset($pm_menu_template))
{
@@ -55,6 +59,7 @@ if(!isset($pm_menu_template))
".LAN_PM_26."
{OUTBOX_TOTAL} ".LAN_PM_36.", {OUTBOX_UNREAD} ".LAN_PM_37." {OUTBOX_FILLED}
{SEND_PM_LINK}
+ {BLOCKED_SENDERS_MANAGE}
";
}
diff --git a/e107_plugins/pm/sendpm.sc b/e107_plugins/pm/sendpm.sc
index e9da1c868..cca3c3692 100644
--- a/e107_plugins/pm/sendpm.sc
+++ b/e107_plugins/pm/sendpm.sc
@@ -1,4 +1,4 @@
-include_lan(e_PLUGIN."pm/languages/".e_LANGUAGE.".php");
+include_lan(e_PLUGIN.'pm/languages/'.e_LANGUAGE.'.php');
global $sysprefs, $pm_prefs;
$pm_prefs = $sysprefs->getArray("pm_prefs");
@@ -6,13 +6,13 @@ if(check_class($pm_prefs['pm_class']))
{
if(file_exists(THEME."forum/pm.png"))
{
- $img = "
";
+ $img = "
";
}
else
{
- $img = "
";
+ $img = "
";
}
- return "{$img}";
+ return "{$img}";
}
else
{