2006-12-02 04:36:16 +00:00
|
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
+ ----------------------------------------------------------------------------+
|
|
|
|
|
| e107 website system
|
|
|
|
|
|
|
|
|
|
|
| <EFBFBD>Steve Dunstan 2001-2002
|
|
|
|
|
| http://e107.org
|
|
|
|
|
| jalist@e107.org
|
|
|
|
|
|
|
|
|
|
|
| Released under the terms and conditions of the
|
|
|
|
|
| GNU General Public License (http://gnu.org).
|
|
|
|
|
|
|
|
|
|
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/pm/pm_shortcodes.php,v $
|
2009-02-02 17:43:06 +00:00
|
|
|
|
| $Revision: 1.9 $
|
|
|
|
|
| $Date: 2009-02-02 17:43:00 $
|
|
|
|
|
| $Author: e107steved $
|
2006-12-02 04:36:16 +00:00
|
|
|
|
+----------------------------------------------------------------------------+
|
|
|
|
|
*/
|
|
|
|
|
if (!defined('e107_INIT')) { exit; }
|
|
|
|
|
include_once(e_HANDLER.'shortcode_handler.php');
|
|
|
|
|
include_once(e_PLUGIN.'pm/pm_func.php');
|
|
|
|
|
$pm_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
SC_BEGIN FORM_TOUSER
|
|
|
|
|
global $pm_prefs, $pm_info;
|
|
|
|
|
if($pm_info['from_name'])
|
|
|
|
|
{
|
|
|
|
|
return "<input type='hidden' name='pm_to' value='{$pm_info['from_name']}' />{$pm_info['from_name']}";
|
|
|
|
|
}
|
|
|
|
|
require_once(e_HANDLER."user_select_class.php");
|
|
|
|
|
$us = new user_select;
|
|
|
|
|
$type = ($pm_prefs['dropdown'] == TRUE ? 'list' : 'popup');
|
|
|
|
|
if(check_class($pm_prefs['multi_class']))
|
|
|
|
|
{
|
|
|
|
|
$ret = $us->select_form($type, 'textarea.pm_to');
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$ret = $us->select_form($type, 'pm_to');
|
|
|
|
|
}
|
|
|
|
|
return $ret;
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN FORM_TOCLASS
|
|
|
|
|
global $pm_prefs, $pm_info;
|
|
|
|
|
if($pm_info['from_name'])
|
|
|
|
|
{
|
|
|
|
|
return "";
|
|
|
|
|
}
|
2009-02-02 17:43:06 +00:00
|
|
|
|
if($pm_prefs['allow_userclass'] && check_class($pm_prefs['multi_class']))
|
2006-12-02 04:36:16 +00:00
|
|
|
|
{
|
|
|
|
|
$ret = "<input type='checkbox' name='to_userclass' value='1' />".LAN_PM_4." ";
|
|
|
|
|
require_once(e_HANDLER."userclass_class.php");
|
2007-02-10 10:19:35 +00:00
|
|
|
|
$args = (ADMIN ? "admin, classes" : "classes, matchclass");
|
2006-12-02 04:36:16 +00:00
|
|
|
|
if(check_class($pm_prefs['sendall_class']))
|
|
|
|
|
{
|
|
|
|
|
$args = "member, ".$args;
|
|
|
|
|
}
|
|
|
|
|
$ret .= r_userclass("pm_userclass", "", "off", $args);
|
2007-03-14 20:08:04 +00:00
|
|
|
|
if (strpos($ret,'option') === FALSE) $ret = '';
|
2006-12-02 04:36:16 +00:00
|
|
|
|
}
|
2007-03-14 20:08:04 +00:00
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
|
return $ret;
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN FORM_SUBJECT
|
|
|
|
|
global $pm_info;
|
|
|
|
|
$value = "";
|
|
|
|
|
if($pm_info['pm_subject'])
|
|
|
|
|
{
|
|
|
|
|
$value = $pm_info['pm_subject'];
|
|
|
|
|
if(substr($value, 0, strlen(LAN_PM_58)) != LAN_PM_58)
|
|
|
|
|
{
|
|
|
|
|
$value = LAN_PM_58.$value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return "<input class='tbox' type='text' name='pm_subject' value='{$value}' size='63' maxlength='255' />";
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN FORM_MESSAGE
|
|
|
|
|
global $pm_info;
|
|
|
|
|
$value = "";
|
|
|
|
|
if($pm_info['pm_text'])
|
|
|
|
|
{
|
|
|
|
|
if(isset($_POST['quote']))
|
|
|
|
|
{
|
|
|
|
|
$t = time();
|
|
|
|
|
$value = "[quote{$t}={$pm_info['from_name']}]\n{$pm_info['pm_text']}\n[/quote{$t}]\n\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return "<textarea class='tbox' name='pm_message' cols='60' rows='10' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>{$value}</textarea>";
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN EMOTES
|
|
|
|
|
require_once(e_HANDLER."emote.php");
|
|
|
|
|
return r_emote();
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN PM_POST_BUTTON
|
|
|
|
|
return "<input class='button' type='submit' name='postpm' value='".LAN_PM_1."' />";
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN PM_PREVIEW_BUTTON
|
|
|
|
|
return "<input class='button' type='submit' name='postpm' value='".LAN_PM_3."' />";
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN ATTACHMENT
|
|
|
|
|
global $pm_prefs;
|
|
|
|
|
if (check_class($pm_prefs['attach_class']))
|
|
|
|
|
{
|
|
|
|
|
$ret = "
|
|
|
|
|
<div id='up_container' >
|
|
|
|
|
<span id='upline' style='white-space:nowrap'>
|
|
|
|
|
<input class='tbox' type='file' name='file_userfile[]' size='40' />
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<input type='button' class='button' value='".LAN_PM_11."' onclick=\"duplicateHTML('upline','up_container');\" />
|
|
|
|
|
";
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN PM_ATTACHMENT_ICON
|
|
|
|
|
global $pm_info;
|
|
|
|
|
if($pm_info['pm_attachments'] != "")
|
|
|
|
|
{
|
|
|
|
|
return ATTACHMENT_ICON;
|
|
|
|
|
}
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN PM_ATTACHMENTS
|
|
|
|
|
global $pm_info;
|
|
|
|
|
if($pm_info['pm_attachments'] != "")
|
|
|
|
|
{
|
|
|
|
|
$attachments = explode(chr(0), $pm_info['pm_attachments']);
|
|
|
|
|
$i = 0;
|
|
|
|
|
foreach($attachments as $a)
|
|
|
|
|
{
|
|
|
|
|
list($timestamp, $fromid, $rand, $filename) = explode("_", $a, 4);
|
|
|
|
|
$ret .= "<a href='".e_SELF."?get.{$pm_info['pm_id']}.{$i}'>{$filename}</a><br />";
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
$ret = substr($ret, 0, -3);
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN RECEIPT
|
|
|
|
|
global $pm_prefs;
|
|
|
|
|
if (check_class($pm_prefs['receipt_class']))
|
|
|
|
|
{
|
|
|
|
|
return "<input type='checkbox' name='receipt' value='1' />".LAN_PM_10;
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN INBOX_TOTAL
|
|
|
|
|
$pm_inbox = pm_getInfo('inbox');
|
|
|
|
|
return $pm_inbox['inbox']['total'];
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN INBOX_UNREAD
|
|
|
|
|
$pm_inbox = pm_getInfo('inbox');
|
|
|
|
|
return intval($pm_inbox['inbox']['unread']);
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN INBOX_FILLED
|
|
|
|
|
$pm_inbox = pm_getInfo('inbox');
|
|
|
|
|
return (intval($pm_inbox['inbox']['filled']) > 0 ? $pm_inbox['inbox']['filled'] : "");
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN OUTBOX_TOTAL
|
|
|
|
|
$pm_outbox = pm_getInfo('outbox');
|
|
|
|
|
return $pm_outbox['outbox']['total'];
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN OUTBOX_UNREAD
|
|
|
|
|
$pm_outbox = pm_getInfo('outbox');
|
|
|
|
|
return intval($pm_outbox['outbox']['unread']);
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN OUTBOX_FILLED
|
|
|
|
|
$pm_outbox = pm_getInfo('outbox');
|
|
|
|
|
return (intval($pm_outbox['outbox']['filled']) > 0 ? $pm_outbox['outbox']['filled'] : "");
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN PM_DATE
|
|
|
|
|
global $pm_info;
|
|
|
|
|
require_once(e_HANDLER."date_handler.php");
|
|
|
|
|
if("lapse" != $parm)
|
|
|
|
|
{
|
|
|
|
|
return convert::convert_date($pm_info['pm_sent'], $parm);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return convert::computeLapse($pm_info['pm_sent']);
|
|
|
|
|
}
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN PM_READ
|
|
|
|
|
global $pm_info;
|
|
|
|
|
if($pm_info['pm_read'] == 0)
|
|
|
|
|
{
|
|
|
|
|
return LAN_PM_27;
|
|
|
|
|
}
|
|
|
|
|
if($pm_info['pm_read'] == 1)
|
|
|
|
|
{
|
|
|
|
|
return LAN_PM_28;
|
|
|
|
|
}
|
|
|
|
|
require_once(e_HANDLER."date_handler.php");
|
|
|
|
|
if("lapse" != $parm)
|
|
|
|
|
{
|
|
|
|
|
return convert::convert_date($pm_info['pm_read'], $parm);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return convert::computeLapse($pm_info['pm_read']);
|
|
|
|
|
}
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SC_BEGIN PM_FROM_TO
|
|
|
|
|
global $pm_info, $tp;
|
|
|
|
|
if($pm_info['pm_from'] == USERID)
|
|
|
|
|
{
|
|
|
|
|
$ret = LAN_PM_2.": <br />";
|
|
|
|
|
$pm_info['user_name'] = $pm_info['sent_name'];
|
|
|
|
|
$ret .= $tp->parseTemplate("{PM_TO=link}");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$ret = LAN_PM_31.": <br />";
|
|
|
|
|
$pm_info['user_name'] = $pm_info['from_name'];
|
|
|
|
|
$ret .= $tp->parseTemplate("{PM_FROM=link}");
|
|
|
|
|
}
|
|
|
|
|
return $ret;
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN PM_SUBJECT
|
|
|
|
|
global $pm_info, $tp;
|
2007-01-03 22:06:08 +00:00
|
|
|
|
$ret = $tp->toHTML($pm_info['pm_subject'], true, 'no_make_clickable,no_hook');
|
2006-12-02 04:36:16 +00:00
|
|
|
|
if('link' == $parm)
|
|
|
|
|
{
|
|
|
|
|
$ret = "<a href='".e_PLUGIN_ABS."pm/pm.php?show.{$pm_info['pm_id']}'>".$ret."</a>";
|
|
|
|
|
}
|
|
|
|
|
return $ret;
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN PM_FROM
|
|
|
|
|
global $pm_info;
|
|
|
|
|
if("link" == $parm)
|
|
|
|
|
{
|
|
|
|
|
return "<a href='".e_BASE."user.php?id.{$pm_info['pm_from']}'>{$pm_info['user_name']}</a>";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return $pm_info['user_name'];
|
|
|
|
|
}
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN PM_SELECT
|
|
|
|
|
global $pm_info;
|
|
|
|
|
return "<input type='checkbox' name='selected_pm[{$pm_info['pm_id']}]' value='1' />";
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN PM_READ_ICON
|
|
|
|
|
global $pm_info;
|
|
|
|
|
if($pm_info['pm_read'] > 0 )
|
|
|
|
|
{
|
|
|
|
|
return PM_READ_ICON;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return PM_UNREAD_ICON;
|
|
|
|
|
}
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN PM_AVATAR
|
|
|
|
|
global $pm_info, $tp;
|
|
|
|
|
return $tp->parseTemplate("{USER_AVATAR={$pm_info['user_image']}}");
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN PM_BLOCK_USER
|
|
|
|
|
global $pm_info, $pm_blocks;
|
|
|
|
|
if(in_array($pm_info['pm_from'], $pm_blocks))
|
|
|
|
|
{
|
|
|
|
|
return "<a href='".e_PLUGIN_ABS."pm/pm.php?unblock.{$pm_info['pm_from']}'><img src='".e_PLUGIN_ABS."pm/images/mail_unblock.png' title='".LAN_PM_51."' alt='".LAN_PM_51."' style='width: 16px; height: 16px; border: 0px' /></a>";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return "<a href='".e_PLUGIN_ABS."pm/pm.php?block.{$pm_info['pm_from']}'><img src='".e_PLUGIN_ABS."pm/images/mail_block.png' title='".LAN_PM_50."' alt='".LAN_PM_50."' style='width: 16px; height: 16px; border: 0px' /></a>";
|
|
|
|
|
}
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN PM_DELETE
|
|
|
|
|
global $pm_info;
|
2007-09-22 17:41:29 +00:00
|
|
|
|
if($parm != "")
|
2008-11-25 16:26:03 +00:00
|
|
|
|
{
|
2007-09-22 17:41:29 +00:00
|
|
|
|
$extra = '.'.$parm;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$extra = '.'.($pm_info['pm_from'] == USERID ? 'outbox' : 'inbox');
|
|
|
|
|
}
|
2006-12-02 04:36:16 +00:00
|
|
|
|
return "<a href='".e_PLUGIN_ABS."pm/pm.php?del.{$pm_info['pm_id']}{$extra}'><img src='".e_PLUGIN_ABS."pm/images/mail_delete.png' title='".LAN_PM_52."' alt='".LAN_PM_52."' style='width: 16px; height: 16px; border: 0px' /></a>";
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN DELETE_SELECTED
|
|
|
|
|
global $pm_info;
|
|
|
|
|
return "<input type='submit' name='pm_delete_selected' class='button' value='".LAN_PM_53."' />";
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN PM_TO
|
|
|
|
|
global $pm_info;
|
|
|
|
|
if(is_numeric($pm_info['pm_to']))
|
|
|
|
|
{
|
|
|
|
|
if("link" == $parm)
|
|
|
|
|
{
|
|
|
|
|
return "<a href='".e_BASE."user.php?id.{$pm_info['pm_to']}'>{$pm_info['user_name']}</a>";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return $pm_info['user_name'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return LAN_PM_63." ".$pm_info['pm_to'];
|
|
|
|
|
}
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN PM_MESSAGE
|
|
|
|
|
global $pm_info, $tp;
|
|
|
|
|
return $tp->toHTML($pm_info['pm_text'], true);
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN PM_REPLY
|
|
|
|
|
global $pm_info;
|
|
|
|
|
if($pm_info['pm_to'] == USERID)
|
|
|
|
|
{
|
|
|
|
|
$ret = "
|
|
|
|
|
<form method='post' action='".e_SELF."?reply.{$pm_info['pm_id']}'>
|
|
|
|
|
<input type='checkbox' name='quote' /> ".LAN_PM_54."  <input class='button' type='submit' name='reply' value='".LAN_PM_55."' />
|
|
|
|
|
</form>
|
|
|
|
|
";
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN SEND_PM_LINK
|
|
|
|
|
$pm_outbox = pm_getInfo('outbox');
|
|
|
|
|
if($pm_outbox['outbox']['filled'] < 100)
|
|
|
|
|
{
|
2008-11-25 16:26:03 +00:00
|
|
|
|
$e107 = e107::getInstance();
|
2008-11-25 17:38:56 +00:00
|
|
|
|
$link = $e107->url->getUrl('pm','main',array('f' => 'send'));
|
|
|
|
|
return "<a href='{$link}'>".PM_SEND_LINK."</a>";
|
2006-12-02 04:36:16 +00:00
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
SC_END
|
|
|
|
|
|
|
|
|
|
SC_BEGIN NEWPM_ANIMATE
|
|
|
|
|
global $pm_prefs, $pm_inbox;
|
|
|
|
|
if($pm_prefs['animate'])
|
|
|
|
|
{
|
|
|
|
|
$pm_inbox = pm_getInfo('inbox');
|
|
|
|
|
if($pm_inbox['inbox']['new'] > 0)
|
|
|
|
|
{
|
|
|
|
|
return NEWPM_ANIMATION;
|
|
|
|
|
}
|
|
|
|
|
}
|
2008-11-25 17:38:56 +00:00
|
|
|
|
return '';
|
2006-12-02 04:36:16 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
?>
|