getArray('pm_prefs');
}
require_once(e_PLUGIN.'pm/pm_func.php');
e107::getScParser();
require_once(e_PLUGIN.'pm/pm_shortcodes.php');
setScVar('pm_handler_shortcodes','pmPrefs', $pm_prefs);
$pmManager = new pmbox_manager($pm_prefs);
setScVar('pm_handler_shortcodes','pmManager', &$pmManager);
define('PM_INBOX_ICON', "");
define('PM_OUTBOX_ICON', "
");
define('PM_SEND_LINK', LAN_PM_35);
define('NEWPM_ANIMATION', "
");
$sc_style['PM_SEND_PM_LINK']['pre'] = "
[ ";
$sc_style['PM_SEND_PM_LINK']['post'] = " ]";
$sc_style['PM_INBOX_FILLED']['pre'] = "[";
$sc_style['PM_INBOX_FILLED']['post'] = "%]";
$sc_style['PM_OUTBOX_FILLED']['pre'] = "[";
$sc_style['PM_OUTBOX_FILLED']['post'] = "%]";
$sc_style['PM_NEWPM_ANIMATE']['pre'] = "";
$sc_style['PM_NEWPM_ANIMATE']['post'] = "";
$sc_style['PM_BLOCKED_SENDERS_MANAGE']['pre'] = "
[ ";
$sc_style['PM_BLOCKED_SENDERS_MANAGE']['post'] = ' ]';
if(!isset($pm_menu_template))
{
$pm_menu_template = "
".PM_INBOX_ICON."
".LAN_PM_25."
{PM_NEWPM_ANIMATE}
{PM_INBOX_TOTAL} ".LAN_PM_36.", {PM_INBOX_UNREAD} ".LAN_PM_37." {PM_INBOX_FILLED}
".PM_OUTBOX_ICON."
".LAN_PM_26."
{PM_OUTBOX_TOTAL} ".LAN_PM_36.", {PM_OUTBOX_UNREAD} ".LAN_PM_37." {PM_OUTBOX_FILLED}
{PM_SEND_PM_LINK}
{PM_BLOCKED_SENDERS_MANAGE}
";
}
if(check_class($pm_prefs['pm_class']))
{
$tp = e107::getParser();
$pm_inbox = $pmManager->pm_getInfo('inbox');
$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')
{
$txt .= pm_show_popup($pm_inbox, $pm_prefs['popup_delay']);
}
$ns->tablerender(LAN_PM, $txt, 'pm');
}
/**
* Function to show a popup (if enabled) when new PMs arrive.
*
* @param array $pm_inbox - information about current state of inbox
* @param int $alertdelay - delay between popups, in seconds (defaults to 60 if pref not set)
*
* @return string - text for display
*
* @todo - check JS - may be some problems, especially if using debug in FF
*/
function pm_show_popup($pm_inbox, $alertdelay = 0)
{
if($alertdelay == 0) { $alertdelay = 60; }
setcookie('pm-alert', 'ON', time()+$alertdelay);
$popuptext = "
--- ".LAN_PM." --- ".$pm_inbox['inbox']['new'].' '.LAN_PM_109." ".$pm_inbox['inbox']['unread'].' '.LAN_PM_37." |