diff --git a/e107_plugins/pm/languages/English.php b/e107_plugins/pm/languages/English.php index 6baa7deb9..798e474f0 100755 --- a/e107_plugins/pm/languages/English.php +++ b/e107_plugins/pm/languages/English.php @@ -66,6 +66,17 @@ define('LAN_PM_62', "File: [{FILENAME}] exceeds size limit - not attached"); define('LAN_PM_63', "class:"); define('LAN_PM_64', 'ERROR: You are not permitted to block messages from site administrators'); define('LAN_PM_65', 'ERROR: Nothing to send'); +define('LAN_PM_66', 'Blocked Senders'); +define('LAN_PM_67', 'No users blocked'); +define('LAN_PM_68', 'User Name'); +define('LAN_PM_69', 'Date blocked'); +define('LAN_PM_70', 'Deleting block on user'); +define('LAN_PM_71', '--GOOD-- attachment(s) deleted. --FAIL-- failure(s)'); +define('LAN_PM_72', ''); +define('LAN_PM_73', ''); +define('LAN_PM_74', ''); +define('LAN_PM_75', ''); +define('LAN_PM_76', ''); define("LAN_PM_100", "New PM from "); define("LAN_PM_101", "You have received a new Private Message from "); diff --git a/e107_plugins/pm/pm.php b/e107_plugins/pm/pm.php index f0e9b8770..a5de2e89f 100755 --- a/e107_plugins/pm/pm.php +++ b/e107_plugins/pm/pm.php @@ -9,13 +9,14 @@ * * * $Source: /cvs_backup/e107_0.8/e107_plugins/pm/pm.php,v $ - * $Revision: 1.12 $ - * $Date: 2009-11-18 01:05:53 $ - * $Author: e107coders $ + * $Revision: 1.13 $ + * $Date: 2009-12-10 20:40:38 $ + * $Author: e107steved $ */ + $retrieve_prefs[] = 'pm_prefs'; -require_once("../../class2.php"); +require_once('../../class2.php'); if($_POST['keyword']) { @@ -25,21 +26,25 @@ require_once("../../class2.php"); +if (!e107::isInstalled('pm')) +{ + header('location:'.e_BASE.'index.php'); + exit; +} -require_once(e_PLUGIN."pm/pm_class.php"); -require_once(e_PLUGIN."pm/pm_func.php"); -$lan_file = e_PLUGIN."pm/languages/".e_LANGUAGE.".php"; -include_once(is_readable($lan_file) ? $lan_file : e_PLUGIN."pm/languages/English.php"); +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'); -define("ATTACHMENT_ICON", ""); +define('ATTACHMENT_ICON', ""); -$qs = explode(".", e_QUERY); +$qs = explode('.', e_QUERY); $action = varset($qs[0],'inbox'); if (!$action) $action = 'inbox'; $pm_proc_id = intval(varset($qs[1],0)); -$pm_prefs = $sysprefs->getArray("pm_prefs"); +$pm_prefs = $sysprefs->getArray('pm_prefs'); if(!isset($pm_prefs['pm_class']) || !check_class($pm_prefs['pm_class'])) { @@ -50,12 +55,24 @@ if(!isset($pm_prefs['pm_class']) || !check_class($pm_prefs['pm_class'])) } $pm =& new private_message; -$message = ""; +$message = ''; $pm_prefs['perpage'] = intval($pm_prefs['perpage']); if($pm_prefs['perpage'] == 0) { $pm_prefs['perpage'] = 10; } +$pmSource = ''; +if (isset($_POST['pm_come_from'])) +{ + $pmSource = $tp->toDB($_POST['pm_come_from']); +} +elseif (isset($qs[2])) +{ + $pmSource = $tp->toDB($qs[2]); +} + + + //Auto-delete message, if timeout set in admin $del_qry = array(); $read_timeout = intval($pm_prefs['read_timeout']); @@ -72,8 +89,8 @@ if($unread_timeout > 0) } if(count($del_qry) > 0) { - $qry = implode(" OR ", $del_qry); - if($sql->db_Select("private_msg", "pm_id", $qry)) + $qry = implode(' OR ', $del_qry).' AND (pm_from = '.USERID.' OR pm_to = '.USERID.')'; + if($sql->db_Select('private_msg', 'pm_id', $qry)) { $delList = $sql->db_getList(); foreach($delList as $p) @@ -83,13 +100,15 @@ if(count($del_qry) > 0) } } -if("del" == $action || isset($_POST['pm_delete_selected'])) + + +if('del' == $action || isset($_POST['pm_delete_selected'])) { if(isset($_POST['pm_delete_selected'])) { foreach(array_keys($_POST['selected_pm']) as $id) { - $message .= LAN_PM_24.": $id
"; + $message .= LAN_PM_24.": {$id}
"; $message .= $pm->del($id); } } @@ -97,25 +116,47 @@ if("del" == $action || isset($_POST['pm_delete_selected'])) { $message = $pm->del($pm_proc_id); } - if($qs[2] != "") + if ($pmSource) { - $action = $qs[2]; + $action = $pmSource; } else { - if(substr($_SERVER['HTTP_REFERER'], -5) == "inbox") + if(substr($_SERVER['HTTP_REFERER'], -5) == 'inbox') { - $action = "inbox"; + $action = 'inbox'; } - if(substr($_SERVER['HTTP_REFERER'], -6) == "outbox") + elseif(substr($_SERVER['HTTP_REFERER'], -6) == 'outbox') { - $action = "outbox"; + $action = 'outbox'; } } $pm_proc_id = 0; unset($qs); } + + +if('delblocked' == $action || isset($_POST['pm_delete_blocked_selected'])) +{ + if(isset($_POST['pm_delete_blocked_selected'])) + { + foreach(array_keys($_POST['selected_pm']) as $id) + { + $message .= LAN_PM_70.": {$id}
"; + $message .= $pm->block_del($id).'
'; + } + } + elseif('delblocked' == $action) + { + $message = $pm->block_del($pm_proc_id); + } + $action = 'blocked'; + $pm_proc_id = 0; + unset($qs); +} + + if('block' == $action) { $message = $pm->block_add($pm_proc_id); @@ -130,17 +171,12 @@ if('unblock' == $action) $pm_proc_id = 0; } -if("get" == $action) +if('get' == $action) { $pm->send_file($pm_proc_id, intval($qs[2])); exit; } -$eplug_js[] = e_FILE."jslib/prototype/prototype.js"; -$eplug_js[] = e_PLUGIN."pm/textboxlist.js"; -$eplug_js[] = e_PLUGIN."pm/test.js"; -$eplug_css[] = e_PLUGIN."pm/test.css"; -// test. require_once(HEADERF); @@ -150,54 +186,66 @@ if(isset($_POST['postpm'])) $action = 'outbox'; } -if($message != "") + + +if($message != '') { $ns->tablerender("", $message); } -if("send" == $action) -{ - $ns->tablerender(LAN_PM, show_send($pm_proc_id)); -} -if("reply" == $action) + +switch ($action) { - $pmid = $pm_proc_id; - if($pm_info = $pm->pm_get($pmid)) - { - if($pm_info['pm_to'] != USERID) + case 'send' : + $ns->tablerender(LAN_PM, show_send($pm_proc_id)); + break; + + case 'reply' : + $pmid = $pm_proc_id; + if($pm_info = $pm->pm_get($pmid)) { - $ns->tablerender(LAN_PM, LAN_PM_56); + if($pm_info['pm_to'] != USERID) + { + $ns->tablerender(LAN_PM, LAN_PM_56); + } + else + { + $ns->tablerender(LAN_PM, show_send()); + } } else { - $ns->tablerender(LAN_PM, show_send()); + $ns->tablerender(LAN_PM, LAN_PM_57); } - } - else - { - $ns->tablerender(LAN_PM, LAN_PM_57); - } + break; + + case 'inbox' : + $ns->tablerender(LAN_PM." - ".LAN_PM_25, show_inbox($pm_proc_id), 'PM'); + break; + + case 'outbox' : + $ns->tablerender(LAN_PM." - ".LAN_PM_26, show_outbox($pm_proc_id), 'PM'); + break; + + case 'show' : + show_pm($pm_proc_id, $pmSource); + break; + + case 'blocked' : + $ns->tablerender(LAN_PM." - ".LAN_PM_66, showBlocked($pm_proc_id), 'PM'); + break; } -if("inbox" == $action) -{ - $ns->tablerender(LAN_PM." - ".LAN_PM_25, show_inbox($pm_proc_id), "PM"); -} - -if("outbox" == $action) -{ - $ns->tablerender(LAN_PM." - ".LAN_PM_26, show_outbox($pm_proc_id), "PM"); -} - -if("show" == $action) -{ - show_pm($pm_proc_id); -} require_once(FOOTERF); exit; + + + + + function show_send($to_uid) { global $tp, $pm_info, $pm_prefs; @@ -216,9 +264,9 @@ function show_send($to_uid) { return str_replace('{PERCENT}', $pm_outbox['outbox']['filled'], LAN_PM_13); } - require_once(e_PLUGIN."pm/pm_shortcodes.php"); + 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"); + 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 = "
". @@ -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 = ""; $txt .= $tp->parseTemplate($PM_OUTBOX_HEADER, true, $pm_shortcodes); @@ -270,7 +323,7 @@ function show_outbox($start = 0) { 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.']'; } $pm_info = $rec; $txt .= $tp->parseTemplate($PM_OUTBOX_TABLE, true, $pm_shortcodes); } @@ -284,12 +337,14 @@ function show_outbox($start = 0) return $txt; } -function show_pm($pmid) + + +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"); + 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) { @@ -305,16 +360,24 @@ function show_pm($pmid) } $txt .= $tp->parseTemplate($PM_SHOW, true, $pm_shortcodes); $ns -> tablerender(LAN_PM, $txt); - if($pm_info['pm_from'] == USERID) + 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"); + $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"); + $ns->tablerender(LAN_PM." - ".LAN_PM_25, show_inbox($pm_proc_id), 'PM'); } } + + + + function post_pm() { global $pm_prefs, $pm, $pref, $sql, $tp; @@ -335,7 +398,7 @@ function post_pm() } if(isset($_POST['pm_to'])) { - $msg = ""; + $msg = ''; if(isset($_POST['to_userclass']) && $_POST['to_userclass']) { if(!$pm_prefs['allow_userclass']) @@ -468,34 +531,38 @@ function pm_user_lookup() echo implode(",",$u); echo "]"; - - // echo "[{\"caption\":\"Manuel Mujica Lainez\",\"value\":4},{\"caption\":\"Gustavo Nielsen\",\"value\":3},{\"caption\":\"Silvina Ocampo\",\"value\":3},{\"caption\":\"Victoria Ocampo\", \"value\":3},{\"caption\":\"Hector German Oesterheld\", \"value\":3},{\"caption\":\"Olga Orozco\", \"value\":3},{\"caption\":\"Juan L. Ortiz\", \"value\":3},{\"caption\":\"Alicia Partnoy\", \"value\":3},{\"caption\":\"Roberto Payro\", \"value\":3},{\"caption\":\"Ricardo Piglia\", \"value\":3},{\"caption\":\"Felipe Pigna\", \"value\":3},{\"caption\":\"Alejandra Pizarnik\", \"value\":3},{\"caption\":\"Antonio Porchia\", \"value\":3},{\"caption\":\"Juan Carlos Portantiero\", \"value\":3},{\"caption\":\"Manuel Puig\", \"value\":3},{\"caption\":\"Andres Rivera\", \"value\":3},{\"caption\":\"Mario Rodriguez Cobos\", \"value\":3},{\"caption\":\"Arturo Andres Roig\", \"value\":3},{\"caption\":\"Ricardo Rojas\", \"value\":3}]"; } exit; } -function headerjs() + +function showBlocked($start = 0) { -return " "; - - - - - + 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 = ""; + $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 .= ""; + 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 = "
    - -
  1. - -
    - -
    Type the name of a user
    -
      - -
    - -
    -
  2. -
"; - -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 "".LAN_PM_52.""; +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 = " {PM_SELECT} {PM_READ_ICON} - {PM_SUBJECT=link}{PM_ATTACHMENT_ICON} + {PM_SUBJECT=link,inbox}{PM_ATTACHMENT_ICON} {PM_FROM=link} {PM_DATE} {PM_DELETE=inbox} {PM_BLOCK_USER} @@ -117,6 +117,7 @@ $PM_INBOX_EMPTY = " $PM_INBOX_FOOTER = " + {DELETE_SELECTED} @@ -140,7 +141,7 @@ $PM_OUTBOX_TABLE = " {PM_SELECT} {PM_READ_ICON} - {PM_SUBJECT=link}{PM_ATTACHMENT_ICON} + {PM_SUBJECT=link,outbox}{PM_ATTACHMENT_ICON} {PM_TO=link} {PM_DATE} {PM_DELETE=outbox} @@ -156,6 +157,7 @@ $PM_OUTBOX_EMPTY = " $PM_OUTBOX_FOOTER = " + {DELETE_SELECTED} @@ -163,6 +165,43 @@ $PM_OUTBOX_FOOTER = " "; + +$PM_BLOCKED_HEADER = " + + + + + + + +"; + +$PM_BLOCKED_TABLE = " + + + + + + +"; + +$PM_BLOCKED_EMPTY = " + + + +"; + +$PM_BLOCKED_FOOTER = " + + + +
 ".LAN_PM_68."".LAN_PM_69." 
{PM_BLOCKED_SELECT}{PM_BLOCKED_USER=link}{PM_BLOCKED_DATE}{PM_BLOCKED_DELETE}
".LAN_PM_67."
+ {DELETE_BLOCKED_SELECTED} +
+"; + + + $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", "".LAN_PM_25.""); -define("PM_OUTBOX_ICON", "".LAN_PM_26.""); -define("PM_SEND_LINK", LAN_PM_35); -define("NEWPM_ANIMATION", ""); +define('PM_INBOX_ICON', "".LAN_PM_25.""); +define('PM_OUTBOX_ICON', "".LAN_PM_26.""); +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 = "".LAN_PM.""; + $img = "".LAN_PM.""; } else { - $img = "".LAN_PM.""; + $img = "".LAN_PM.""; } - return "{$img}"; + return "{$img}"; } else {