Bump.
Can anyone please help point me in the right direction for figuring out why the "who's online" pop-up window and the "private message" pop-up window are both blank on my site?
Here's the misc.php file. I think this is what is needed for the who's online window.
<?php
// $Id: misc.php,v 1.17.2.1 2005/06/26 18:57:58 mithyt2 Exp $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
// <https://xoops.org/> //
// ------------------------------------------------------------------------ //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// You may not change or alter any portion of this comment or credits //
// of supporting developers from this source code or any supporting //
// source code which is considered copyrighted (c) material of the //
// original comment or credit authors. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //
include "mainfile.php";
include_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/misc.php';
$action = isset($_GET['action']) ? trim($_GET['action']) : '';
$action = isset($_POST['action']) ? trim($_POST['action']) : $action;
$type = isset($_GET['type']) ? trim($_GET['type']) : '';
$type = isset($_POST['type']) ? trim($_POST['type']) : $type;
if ( $action == "showpopups" ) {
xoops_header(false);
// show javascript close button?
$closebutton = 1;
switch ( $type ) {
case "smilies":
$target = isset($_GET['target']) ? trim($_GET['target']) : '';
if ($target == '' || !preg_match('/^[0-9a-z_]*$/i', $target)) {
} else {
echo "<script type="text/javascript"><!--//
function doSmilie(addSmilie) {
var currentMessage = window.opener.xoopsGetElementById("".$target."").value;
window.opener.xoopsGetElementById("".$target."").value=currentMessage+addSmilie;
return;
}
//-->
</script>
";
echo '</head><body>
<table width="100%" class="outer">
<tr><th colspan="3">'._MSC_SMILIES.'</th></tr>
<tr class="head"><td>'._MSC_CODE.'</td><td>'._MSC_EMOTION.'</td><td>'._IMAGE.'</td></tr>';
if ($getsmiles = $xoopsDB->query("SELECT * FROM ".$xoopsDB->prefix("smiles"))) {
$rcolor = 'even';
while ( $smile = $xoopsDB->fetchArray($getsmiles) ) {
echo "<tr class='$rcolor'><td>".$smile['code']."</td><td>".$smile['emotion']."</td><td><img onmouseover='style.cursor="hand"' onclick='doSmilie(" ".$smile['code']." ");' src='".XOOPS_UPLOAD_URL."/".$smile['smile_url']."' alt='' /></td></tr>";
$rcolor = ($rcolor == 'even') ? 'odd' : 'even';
}
} else {
echo "Could not retrieve data from the database.";
}
echo '</table>'._MSC_CLICKASMILIE;
}
break;
case "avatars":
?>
<script language='javascript'>
<!--//
function myimage_onclick(counter){
window.opener.xoopsGetElementById("user_avatar").options[counter].selected = true;
showAvatar();
window.opener.xoopsGetElementById("user_avatar").focus();
window.close();
}
function showAvatar() {
window.opener.xoopsGetElementById("avatar").src='<?php echo XOOPS_UPLOAD_URL;?>/' + window.opener.xoopsGetElementById("user_avatar").options[window.opener.xoopsGetElementById("user_avatar").selectedIndex].value;
}
//-->
</script>
</head><body>
<h4><?php echo _MSC_AVAVATARS;?></h4>
<form name='avatars' action='<?php echo $_SERVER['REQUEST_URI'];?>'>
<table width='100%'><tr>
<?php
$avatar_handler =& xoops_gethandler('avatar');
$avatarslist =& $avatar_handler->getList('S');
$cntavs = 0;
$counter = isset($_GET['start']) ? intval($_GET['start']) : 0;
foreach ($avatarslist as $file => $name) {
echo '<td><img src="uploads/'.$file.'" alt="'.$name.'" style="padding:10px; vertical-align:top;" /><br />'.$name.'<br /><input name="myimage" type="button" value="'._SELECT.'" onclick="myimage_onclick('.$counter.')" /></td>';
$counter++;
$cntavs++;
if ($cntavs > 8) {
echo '</tr><tr>';
$cntavs=0;
}
}
echo '</tr></table></form></div>';
break;
case "friend":
if ( !$GLOBALS['xoopsSecurity']->check() || !isset($_POST['op']) || $_POST['op'] == "sendform") {
if ( $xoopsUser ) {
$yname = $xoopsUser->getVar("uname", 'e');
$ymail = $xoopsUser->getVar("email", 'e');
$fname = "";
$fmail = "";
} else {
$yname = "";
$ymail = "";
$fname = "";
$fmail = "";
}
printCheckForm();
echo '</head><body>';
echo "<div class='errorMsg'>".implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())."</div>";
echo '
<form action="'.XOOPS_URL.'/misc.php" method="post" onsubmit="return checkForm();"><table width="100%" class="outer" cellspacing="1"><tr><th colspan="2">'._MSC_RECOMMENDSITE.'</th></tr>';
echo "<tr><td class='head'>
<input type='hidden' name='op' value='sendsite' />
<input type='hidden' name='action' value='showpopups' />
<input type='hidden' name='type' value='friend' />n";
echo _MSC_YOURNAMEC."</td><td class='even'><input type='text' name='yname' value='$yname' id='yname' /></td></tr>
<tr><td class='head'>"._MSC_YOUREMAILC."</td><td class='odd'><input type='text' name='ymail' value='".$ymail."' id='ymail' /></td></tr>
<tr><td class='head'>"._MSC_FRIENDNAMEC."</td><td class='even'><input type='text' name='fname' value='$fname' id='fname' /></td></tr>
<tr><td class='head'>"._MSC_FRIENDEMAILC."</td><td class='odd'><input type='text' name='fmail' value='$fmail' id='fmail' /></td></tr>
<tr><td class='head'> </td><td class='even'><input type='submit' value='"._SEND."' /> <input value='"._CLOSE."' type='button' onclick='javascript:window.close();' />".$GLOBALS['xoopsSecurity']->getTokenHTML()."</td></tr>
</table></form>n";
$closebutton = 0;
} elseif ($_POST['op'] == "sendsite") {
$myts =& MyTextsanitizer::getInstance();
if ( $xoopsUser ) {
$ymail = $xoopsUser->getVar("email");
} else {
$ymail = isset($_POST['ymail']) ? $myts->stripSlashesGPC(trim($_POST['ymail'])) : '';
}
if ( !isset($_POST['yname']) || trim($_POST['yname']) == "" || $ymail == '' || !isset($_POST['fname']) || trim($_POST['fname']) == "" || !isset($_POST['fmail']) || trim($_POST['fmail']) == '' ) {
redirect_header(XOOPS_URL."/misc.php?action=showpopups&type=friend&op=sendform",2,_MSC_NEEDINFO);
exit();
}
$yname = $myts->stripSlashesGPC(trim($_POST['yname']));
$fname = $myts->stripSlashesGPC(trim($_POST['fname']));
$fmail = $myts->stripSlashesGPC(trim($_POST['fmail']));
if (!checkEmail($fmail) || !checkEmail($ymail)) {
$errormessage = _MSC_INVALIDEMAIL1."<br />"._MSC_INVALIDEMAIL2."";
redirect_header(XOOPS_URL."/misc.php?action=showpopups&type=friend&op=sendform",2,$errormessage);
exit();
}
$xoopsMailer =& getMailer();
$xoopsMailer->setTemplate("tellfriend.tpl");
$xoopsMailer->assign("SITENAME", $xoopsConfig['sitename']);
$xoopsMailer->assign("ADMINMAIL", $xoopsConfig['adminmail']);
$xoopsMailer->assign("SITEURL", XOOPS_URL."/");
$xoopsMailer->assign("YOUR_NAME", $yname);
$xoopsMailer->assign("FRIEND_NAME", $fname);
$xoopsMailer->setToEmails($fmail);
$xoopsMailer->setFromEmail($ymail);
$xoopsMailer->setFromName($yname);
$xoopsMailer->setSubject(sprintf(_MSC_INTSITE,$xoopsConfig['sitename']));
//OpenTable();
if ( !$xoopsMailer->send() ) {
echo $xoopsMailer->getErrors();
} else {
echo "<div><h4>"._MSC_REFERENCESENT."</h4></div>";
}
//CloseTable();
}
break;
case 'online':
$isadmin = $xoopsUserIsAdmin;
echo '<table width="100%" cellspacing="1" class="outer"><tr><th colspan="3">'._WHOSONLINE.'</th></tr>';
$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
$online_handler =& xoops_gethandler('online');
$online_total =& $online_handler->getCount();
$limit = ($online_total > 20) ? 20 : $online_total;
$criteria = new CriteriaCompo();
$criteria->setLimit($limit);
$criteria->setStart($start);
$onlines =& $online_handler->getAll($criteria);
$count = count($onlines);
$module_handler =& xoops_gethandler('module');
$modules =& $module_handler->getList(new Criteria('isactive', 1));
for ($i = 0; $i < $count; $i++) {
if ($onlines[$i]['online_uid'] == 0) {
$onlineUsers[$i]['user'] = '';
} else {
$onlineUsers[$i]['user'] =& new XoopsUser($onlines[$i]['online_uid']);
}
$onlineUsers[$i]['ip'] = $onlines[$i]['online_ip'];
$onlineUsers[$i]['updated'] = $onlines[$i]['online_updated'];
$onlineUsers[$i]['module'] = ($onlines[$i]['online_module'] > 0) ? $modules[$onlines[$i]['online_module']] : '';
}
$class = 'even';
for ($i = 0; $i < $count; $i++) {
$class = ($class == 'odd') ? 'even' : 'odd';
echo '<tr valign="middle" align="center" class="'.$class.'">';
if (is_object($onlineUsers[$i]['user'])) {
$avatar = $onlineUsers[$i]['user']->getVar('user_avatar') ? '<img src="'.XOOPS_UPLOAD_URL.'/'.$onlineUsers[$i]['user']->getVar('user_avatar').'" alt="" />' : ' ';
echo '<td>'.$avatar."</td><td><a href="javascript:window.opener.location='".XOOPS_URL."/userinfo.php?uid=".$onlineUsers[$i]['user']->getVar('uid')."';window.close();">".$onlineUsers[$i]['user']->getVar('uname')."</a>";
} else {
echo '<td> </td><td>'.$xoopsConfig['anonymous'];
}
if ($isadmin == 1) {
echo '<br />('.$onlineUsers[$i]['ip'].')';
}
echo '</td><td>'.$onlineUsers[$i]['module'].'</td></tr>';
}
echo '</table><br />';
if ($online_total > 20) {
include_once XOOPS_ROOT_PATH.'/class/pagenav.php';
$nav = new XoopsPageNav($online_total, 20, $start, 'start', 'action=showpopups&type=online');
echo '<div style="text-align: right;">'.$nav->renderNav().'</div>';
}
break;
case 'ssllogin':
if ($xoopsConfig['use_ssl'] && isset($_POST[$xoopsConfig['sslpost_name']]) && is_object($xoopsUser)) {
include_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/user.php';
echo sprintf(_US_LOGGINGU, $xoopsUser->getVar('uname'));
echo '<div style="text-align:center;"><input class="formButton" value="'._CLOSE.'" type="button" onclick="window.opener.location.reload();window.close();" /></div>';
$closebutton = false;
}
break;
default:
break;
}
if ($closebutton) {
echo '<div style="text-align:center;"><input class="formButton" value="'._CLOSE.'" type="button" onclick="javascript:window.close();" /></div>';
}
xoops_footer();
}
function printCheckForm()
{
?>
<script language='javascript'>
<!--//
function checkForm()
{
if ( xoopsGetElementById("yname").value == "" ){
alert( "<?php echo _MSC_ENTERYNAME;?>" );
xoopsGetElementById("yname").focus();
return false;
} else if ( xoopsGetElementById("fname").value == "" ){
alert( "<?php echo _MSC_ENTERFNAME;?>" );
xoopsGetElementById("fname").focus();
return false;
} else if ( xoopsGetElementById("fmail").value ==""){
alert( "<?php echo _MSC_ENTERFMAIL;?>" );
xoopsGetElementById("fmail").focus();
return false;
} else {
return true;
}
}
//-->
</script>
<?php
}
?>
And here is the pmlite.php file I think is needed for the private message pop up window.
<?php
// $Id: pmlite.php,v 1.11.4.3 2005/03/29 15:58:11 mithyt2 Exp $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
// <https://xoops.org/> //
// ------------------------------------------------------------------------ //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// You may not change or alter any portion of this comment or credits //
// of supporting developers from this source code or any supporting //
// source code which is considered copyrighted (c) material of the //
// original comment or credit authors. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //
$xoopsOption['pagetype'] = "pmsg";
include "mainfile.php";
$reply = !empty($_GET['reply']) ? 1 : 0;
$send = !empty($_GET['send']) ? 1 : 0;
$send2 = !empty($_GET['send2']) ? 1 : 0;
$to_userid = !empty($_GET['to_userid']) ? intval($_GET['to_userid']) : 0;
$msg_id = !empty($_GET['msg_id']) ? intval($_GET['msg_id']) : 0;
if ( empty($_GET['refresh'] ) && isset($_POST['op']) && $_POST['op'] != "submit" ) {
$jump = "pmlite.php?refresh=".time()."";
if ( $send == 1 ) {
$jump .= "&send=".$send."";
} elseif ( $send2 == 1 ) {
$jump .= "&send2=".$send2."&to_userid=".$to_userid."";
} elseif ( $reply == 1 ) {
$jump .= "&reply=".$reply."&msg_id=".$msg_id."";
} else {
}
echo "<html><head><meta http-equiv='Refresh' content='0; url=".$jump."' /></head><body></body></html>";
exit();
}
xoops_header();
if ($xoopsUser) {
$myts =& MyTextSanitizer::getInstance();
if (isset($_POST['op']) && $_POST['op'] == "submit") {
if (!$GLOBALS['xoopsSecurity']->check()) {
$security_error = true;
}
$res = $xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("users")." WHERE uid=".intval($_POST['to_userid'])."");
list($count) = $xoopsDB->fetchRow($res);
if ($count != 1) {
echo "<br /><br /><div><h4>"._PM_USERNOEXIST."<br />";
echo _PM_PLZTRYAGAIN."</h4><br />";
if (isset($security_error) && $security_error == true) {
echo implode('<br />', $GLOBALS['xoopsSecurity']->getErrors());
}
echo "[ <a href='javascript:history.go(-1)'>"._PM_GOBACK."</a> ]</div>";
} else {
$pm_handler =& xoops_gethandler('privmessage');
$pm =& $pm_handler->create();
$pm->setVar("subject", $_POST['subject']);
$pm->setVar("msg_text", $_POST['message']);
$pm->setVar("to_userid", $_POST['to_userid']);
$pm->setVar("from_userid", $xoopsUser->getVar("uid"));
if (!$pm_handler->insert($pm)) {
echo $pm->getHtmlErrors();
echo "<br /><a href='javascript:history.go(-1)'>"._PM_GOBACK."</a>";
} else {
echo "<br /><br /><div style='text-align:center;'><h4>"._PM_MESSAGEPOSTED."</h4><br /><a href="javascript:window.opener.location='".XOOPS_URL."/viewpmsg.php';window.close();">"._PM_CLICKHERE."</a><br /><br /><a href="javascript:window.close();">"._PM_ORCLOSEWINDOW."</a></div>";
}
}
} elseif ($reply == 1 || $send == 1 || $send2 == 1) {
include_once XOOPS_ROOT_PATH."/include/xoopscodes.php";
if ($reply == 1) {
$pm_handler =& xoops_gethandler('privmessage');
$pm =& $pm_handler->get($msg_id);
if ($pm->getVar("to_userid") == $xoopsUser->getVar('uid')) {
$pm_uname = XoopsUser::getUnameFromId($pm->getVar("from_userid"));
$message = "[quote]n";
$message .= sprintf(_PM_USERWROTE,$pm_uname);
$message .= "n".$pm->getVar("msg_text", "E")."n[/quote]";
} else {
unset($pm);
$reply = $send2 = 0;
}
}
echo "<form action='pmlite.php' method='post' name='coolsus'>n";
echo "<table width='300' align='center' class='outer'><tr><td class='head' width='25%'>"._PM_TO."</td>";
if ( $reply == 1 ) {
echo "<td class='even'><input type='hidden' name='to_userid' value='".$pm->getVar("from_userid")."' />".$pm_uname."</td>";
} elseif ( $send2 == 1 ) {
$to_username = XoopsUser::getUnameFromId($to_userid);
echo "<td class='even'><input type='hidden' name='to_userid' value='".$to_userid."' />".$to_username."</td>";
} else {
echo "<td class='even'><select name='to_userid'>";
$result = $xoopsDB->query("SELECT uid, uname FROM ".$xoopsDB->prefix("users")." WHERE level > 0 ORDER BY uname");
while ( list($ftouid, $ftouname) = $xoopsDB->fetchRow($result) ) {
echo "<option value='".$ftouid."'>".$myts->makeTboxData4Show($ftouname)."</option>";
}
echo "</select></td>";
}
echo "</tr>";
echo "<tr><td class='head' width='25%'>"._PM_SUBJECTC."</td>";
if ( $reply == 1 ) {
$subject = $pm->getVar('subject', 'E');
if (!preg_match("/^Re:/i",$subject)) {
$subject = 'Re: '.$subject;
}
echo "<td class='even'><input type='text' name='subject' value='".$subject."' size='30' maxlength='100' /></td>";
} else {
echo "<td class='even'><input type='text' name='subject' size='30' maxlength='100' /></td>";
}
echo "</tr>";
echo "<tr valign='top'><td class='head' width='25%'>"._PM_MESSAGEC."</td>";
echo "<td class='even'>";
xoopsCodeTarea("message",37,8);
xoopsSmilies("message");
echo "</td>";
echo "</tr>";
echo "<tr><td class='head'> </td><td class='even'>
<input type='hidden' name='op' value='submit' />".$GLOBALS['xoopsSecurity']->getTokenHTML()."
<input type='submit' class='formButton' name='submit' value='"._PM_SUBMIT."' />
<input type='reset' class='formButton' value='"._PM_CLEAR."' />
<input type='button' class='formButton' name='cancel' value='"._PM_CANCELSEND."' onclick='javascript:window.close();' />
</td></tr></table>n";
echo "</form>n";
}
} else {
echo _PM_SORRY."<br /><br /><a href='".XOOPS_URL."/register.php'>"._PM_REGISTERNOW."</a>.";
}
xoops_footer();
?>
Thanks,
Rob