From 3d5308b8714d95b96cf1941cd797ad25b3e08f4a Mon Sep 17 00:00:00 2001 From: SecretR Date: Tue, 10 Jun 2014 16:30:13 +0300 Subject: [PATCH] Avoid possible fatal error --- e107_plugins/pm/private_msg_menu.php | 97 ++++++++++++++-------------- 1 file changed, 48 insertions(+), 49 deletions(-) diff --git a/e107_plugins/pm/private_msg_menu.php b/e107_plugins/pm/private_msg_menu.php index dc629a55f..b59655d15 100755 --- a/e107_plugins/pm/private_msg_menu.php +++ b/e107_plugins/pm/private_msg_menu.php @@ -26,6 +26,54 @@ if (!defined('e107_INIT')) { exit; } if (!e107::isInstalled('pm')) { return ''; } +/** + * 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 + */ +if(!function_exists('pm_show_popup')) +{ + function pm_show_popup($pm_inbox, $alertdelay = 0) + { + if($alertdelay == 0) { $alertdelay = 60; } + setcookie('pm-alert', 'ON', time()+$alertdelay); + $popuptext = " + + + ".$pm_inbox['inbox']['new'].' '.LAN_PM_109." + + + + + + + +
+ --- ".LAN_PM." ---
".$pm_inbox['inbox']['new'].' '.LAN_PM_109."
".$pm_inbox['inbox']['unread'].' '.LAN_PM_37."

+
+ +
+
+ + "; + $popuptext = str_replace("\n", '', $popuptext); + $popuptext = str_replace("\t", '', $popuptext); + $text .= " + "; + return $text; + } +} + $pm_prefs = e107::getPlugPref('pm'); //global $sysprefs, $pm_prefs; @@ -123,52 +171,3 @@ if(check_class($pm_prefs['pm_class'])) $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 = " - - - ".$pm_inbox['inbox']['new'].' '.LAN_PM_109." - - - - - - - -
- --- ".LAN_PM." ---
".$pm_inbox['inbox']['new'].' '.LAN_PM_109."
".$pm_inbox['inbox']['unread'].' '.LAN_PM_37."

-
- -
-
- - "; - $popuptext = str_replace("\n", '', $popuptext); - $popuptext = str_replace("\t", '', $popuptext); - $text .= " - "; - return $text; -} - -?> \ No newline at end of file