1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 05:07:27 +02:00

Fix passing by reference

This commit is contained in:
Steve Davies
2012-12-08 18:16:20 +00:00
parent 18cfd5f13d
commit cbcf7581a4

View File

@@ -1,139 +1,139 @@
<?php <?php
/* /*
* e107 website system * e107 website system
* *
* Copyright (C) 2008-2009 e107 Inc (e107.org) * Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the * Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
* *
* PM plugin - menu display * PM plugin - menu display
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/pm/private_msg_menu.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/pm/private_msg_menu.php,v $
* $Revision$ * $Revision$
* $Date$ * $Date$
* $Author$ * $Author$
*/ */
/** /**
* e107 Private messenger plugin * e107 Private messenger plugin
* *
* @package e107_plugins * @package e107_plugins
* @subpackage pm * @subpackage pm
* @version $Id$; * @version $Id$;
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
if (!e107::isInstalled('pm')) { return ''; } if (!e107::isInstalled('pm')) { return ''; }
global $sysprefs, $pm_prefs; global $sysprefs, $pm_prefs;
if(!isset($pm_prefs['perpage'])) 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');
e107::getScParser(); e107::getScParser();
require_once(e_PLUGIN.'pm/pm_shortcodes.php'); require_once(e_PLUGIN.'pm/pm_shortcodes.php');
setScVar('pm_handler_shortcodes','pmPrefs', $pm_prefs); setScVar('pm_handler_shortcodes','pmPrefs', $pm_prefs);
$pmManager = new pmbox_manager($pm_prefs); $pmManager = new pmbox_manager($pm_prefs);
setScVar('pm_handler_shortcodes','pmManager', &$pmManager); setScVar('pm_handler_shortcodes','pmManager', $pmManager);
define('PM_INBOX_ICON', "<img src='".e_PLUGIN_ABS."pm/images/mail_get.png' class='icon S16' alt='".LAN_PM_25."' title='".LAN_PM_25."' />"); define('PM_INBOX_ICON', "<img src='".e_PLUGIN_ABS."pm/images/mail_get.png' class='icon S16' alt='".LAN_PM_25."' title='".LAN_PM_25."' />");
define('PM_OUTBOX_ICON', "<img src='".e_PLUGIN_ABS."pm/images/mail_send.png' class='icon S16' alt='".LAN_PM_26."' title='".LAN_PM_26."' />"); define('PM_OUTBOX_ICON', "<img src='".e_PLUGIN_ABS."pm/images/mail_send.png' class='icon S16' alt='".LAN_PM_26."' title='".LAN_PM_26."' />");
define('PM_SEND_LINK', LAN_PM_35); define('PM_SEND_LINK', LAN_PM_35);
define('NEWPM_ANIMATION', "<img src='".e_PLUGIN_ABS."pm/images/newpm.gif' alt='' />"); define('NEWPM_ANIMATION', "<img src='".e_PLUGIN_ABS."pm/images/newpm.gif' alt='' />");
$sc_style['PM_SEND_PM_LINK']['pre'] = "<br /><br />[ "; $sc_style['PM_SEND_PM_LINK']['pre'] = "<br /><br />[ ";
$sc_style['PM_SEND_PM_LINK']['post'] = " ]"; $sc_style['PM_SEND_PM_LINK']['post'] = " ]";
$sc_style['PM_INBOX_FILLED']['pre'] = "["; $sc_style['PM_INBOX_FILLED']['pre'] = "[";
$sc_style['PM_INBOX_FILLED']['post'] = "%]"; $sc_style['PM_INBOX_FILLED']['post'] = "%]";
$sc_style['PM_OUTBOX_FILLED']['pre'] = "["; $sc_style['PM_OUTBOX_FILLED']['pre'] = "[";
$sc_style['PM_OUTBOX_FILLED']['post'] = "%]"; $sc_style['PM_OUTBOX_FILLED']['post'] = "%]";
$sc_style['PM_NEWPM_ANIMATE']['pre'] = "<a href='".e_PLUGIN_ABS."pm/pm.php?inbox'>"; $sc_style['PM_NEWPM_ANIMATE']['pre'] = "<a href='".e_PLUGIN_ABS."pm/pm.php?inbox'>";
$sc_style['PM_NEWPM_ANIMATE']['post'] = "</a>"; $sc_style['PM_NEWPM_ANIMATE']['post'] = "</a>";
$sc_style['PM_BLOCKED_SENDERS_MANAGE']['pre'] = "<br />[ <a href='".e_PLUGIN_ABS."pm/pm.php?blocked'>"; $sc_style['PM_BLOCKED_SENDERS_MANAGE']['pre'] = "<br />[ <a href='".e_PLUGIN_ABS."pm/pm.php?blocked'>";
$sc_style['PM_BLOCKED_SENDERS_MANAGE']['post'] = '</a> ]'; $sc_style['PM_BLOCKED_SENDERS_MANAGE']['post'] = '</a> ]';
if(!isset($pm_menu_template)) if(!isset($pm_menu_template))
{ {
$pm_menu_template = " $pm_menu_template = "
<a href='{URL=pm|main|f=box&box=inbox}'>".PM_INBOX_ICON."</a> <a href='{URL=pm|main|f=box&box=inbox}'>".PM_INBOX_ICON."</a>
<a href='{URL=pm|main|f=box&box=inbox}'>".LAN_PM_25."</a> <a href='{URL=pm|main|f=box&box=inbox}'>".LAN_PM_25."</a>
{PM_NEWPM_ANIMATE} {PM_NEWPM_ANIMATE}
<br /> <br />
{PM_INBOX_TOTAL} ".LAN_PM_36.", {PM_INBOX_UNREAD} ".LAN_PM_37." {PM_INBOX_FILLED} {PM_INBOX_TOTAL} ".LAN_PM_36.", {PM_INBOX_UNREAD} ".LAN_PM_37." {PM_INBOX_FILLED}
<br /> <br />
<a href='{URL=pm|main|f=box&box=outbox}'>".PM_OUTBOX_ICON."</a> <a href='{URL=pm|main|f=box&box=outbox}'>".PM_OUTBOX_ICON."</a>
<a href='{URL=pm|main|f=box&box=outbox}'>".LAN_PM_26."</a><br /> <a href='{URL=pm|main|f=box&box=outbox}'>".LAN_PM_26."</a><br />
{PM_OUTBOX_TOTAL} ".LAN_PM_36.", {PM_OUTBOX_UNREAD} ".LAN_PM_37." {PM_OUTBOX_FILLED} {PM_OUTBOX_TOTAL} ".LAN_PM_36.", {PM_OUTBOX_UNREAD} ".LAN_PM_37." {PM_OUTBOX_FILLED}
{PM_SEND_PM_LINK} {PM_SEND_PM_LINK}
{PM_BLOCKED_SENDERS_MANAGE} {PM_BLOCKED_SENDERS_MANAGE}
"; ";
} }
if(check_class($pm_prefs['pm_class'])) if(check_class($pm_prefs['pm_class']))
{ {
$tp = e107::getParser(); $tp = e107::getParser();
$pm_inbox = $pmManager->pm_getInfo('inbox'); $pm_inbox = $pmManager->pm_getInfo('inbox');
$txt = "\n".$tp->parseTemplate($pm_menu_template, TRUE); $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') 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']); $txt .= pm_show_popup($pm_inbox, $pm_prefs['popup_delay']);
} }
$ns->tablerender(LAN_PM, $txt, 'pm'); $ns->tablerender(LAN_PM, $txt, 'pm');
} }
/** /**
* Function to show a popup (if enabled) when new PMs arrive. * Function to show a popup (if enabled) when new PMs arrive.
* *
* @param array $pm_inbox - information about current state of inbox * @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) * @param int $alertdelay - delay between popups, in seconds (defaults to 60 if pref not set)
* *
* @return string - text for display * @return string - text for display
* *
* @todo - check JS - may be some problems, especially if using debug in FF * @todo - check JS - may be some problems, especially if using debug in FF
*/ */
function pm_show_popup($pm_inbox, $alertdelay = 0) function pm_show_popup($pm_inbox, $alertdelay = 0)
{ {
if($alertdelay == 0) { $alertdelay = 60; } if($alertdelay == 0) { $alertdelay = 60; }
setcookie('pm-alert', 'ON', time()+$alertdelay); setcookie('pm-alert', 'ON', time()+$alertdelay);
$popuptext = " $popuptext = "
<html> <html>
<head> <head>
<title>".$pm_inbox['inbox']['new'].' '.LAN_PM_109."</title> <title>".$pm_inbox['inbox']['new'].' '.LAN_PM_109."</title>
<link rel=\'stylesheet\' href=\'".THEME."style.css\'> <link rel=\'stylesheet\' href=\'".THEME."style.css\'>
</head> </head>
<body style=\'padding-left:2px;padding-right:2px; padding:2px; padding-bottom:2px; margin:0px; text-align:center\' marginheight=\'0\' marginleft=\'0\' topmargin=\'0\' leftmargin=\'0\'> <body style=\'padding-left:2px;padding-right:2px; padding:2px; padding-bottom:2px; margin:0px; text-align:center\' marginheight=\'0\' marginleft=\'0\' topmargin=\'0\' leftmargin=\'0\'>
<table style=\'width:100%; text-align:center; height:99%; padding-bottom:2px\' class=\'bodytable\'> <table style=\'width:100%; text-align:center; height:99%; padding-bottom:2px\' class=\'bodytable\'>
<tr> <tr>
<td width=100% style='text-align:center'> <td width=100% style='text-align:center'>
<b>--- ".LAN_PM." ---</b><br />".$pm_inbox['inbox']['new'].' '.LAN_PM_109."<br />".$pm_inbox['inbox']['unread'].' '.LAN_PM_37."<br /><br /> <b>--- ".LAN_PM." ---</b><br />".$pm_inbox['inbox']['new'].' '.LAN_PM_109."<br />".$pm_inbox['inbox']['unread'].' '.LAN_PM_37."<br /><br />
<form> <form>
<input class=\'button\' type=\'submit\' onclick=\'self.close();\' value = \'".LAN_PM_110."\' /> <input class=\'button\' type=\'submit\' onclick=\'self.close();\' value = \'".LAN_PM_110."\' />
</form> </form>
</td> </td>
</tr> </tr>
</table> </table>
</body> </body>
</html> "; </html> ";
$popuptext = str_replace("\n", '', $popuptext); $popuptext = str_replace("\n", '', $popuptext);
$popuptext = str_replace("\t", '', $popuptext); $popuptext = str_replace("\t", '', $popuptext);
$text .= " $text .= "
<script type='text/javascript'> <script type='text/javascript'>
winl=(screen.width-200)/2; winl=(screen.width-200)/2;
wint = (screen.height-100)/2; wint = (screen.height-100)/2;
winProp = 'width=200,height=100,left='+winl+',top='+wint+',scrollbars=no'; winProp = 'width=200,height=100,left='+winl+',top='+wint+',scrollbars=no';
window.open('javascript:document.write(\"".$popuptext."\");', 'pm_popup', winProp); window.open('javascript:document.write(\"".$popuptext."\");', 'pm_popup', winProp);
</script >"; </script >";
return $text; return $text;
} }
?> ?>