Version: , by bonnmac
Developer Last Online: Mar 2006
Version: Unknown
Rating:
Released: 05-13-2002
Last Update: Never
Installs: 0
No support by the author.
Okay I've installed about 19 hacks so far and nothing went wrong till now.... The last hack that I had to edit this file was
"11 - vB v2.2.3- Away message for users" Now every thing works hack wise. My problem is when you send a "private message" it doesn't redirect you back to the board. It just takes you to a blank white screen. your PM gets sent but then you have to go up into explorer bar and back out of private.php.... I've included my "private.php" file hoping maybe someone can tell me what's wrong. Thanks a bunch.
PHP Code:
<?php
error_reporting(7);
// enhanced
// received mass-forward action -> work out what to do with it
if ($action=="dostuff" && $fmulti!="") {
if (!is_array($HTTP_POST_VARS['privatemessage'])) {
// no selected messages: go to normal dostuff action and get error
$move="yes";
} elseif (count($HTTP_POST_VARS[privatemessage])==1) {
// only one message selected: use standard PM forwarding page
$action = "newmessage";
$forward = true;
$privatemessageid = key($HTTP_POST_VARS[privatemessage]);
} else {
// multiple messages selected: build URL and redirect to private2.php
$urlstring = '';
while (list($key,) = each ($HTTP_POST_VARS[privatemessage])) $urlstring .= "&m[$key]=1";
header("Location: private2.php?s=$s&action=fmulti".$urlstring);
exit;
}
}
// intercept request for read receipts page and redirect
if ($folderid=="tracking") {
header("Location: private2.php?s=$s");
exit;
}
// /enhanced
$templatesused = "usercpnav,privfolder_bit,privfolder_messages,privfolder_nomessages,privfolder,postbit_avatar,postbit_useremail,icq,aim,yahoo,postbit_homepage,postbit_profile,postbit_signature,privmsg,priv_reply,priv_sendprivmsg,redirect_pmthanks,redirect_pmdelete,priv_showfolders_folderbit,priv_showfolders,posticons,posticonbit";
$templatesused .= ",vbcode_smilies,vbcode_smiliebit,vbcode_smilies_getmore,vbcode_buttons,vbcode_sizebits,vbcode_fontbits,vbcode_colorbits";
// enhanced
// templates for new PM functionality
$templatesused .= ",priv_readreceiptsoption,priv_dateselect,privfolder_deletedbit,privfolder_denyreceipt,priv_senttomultiple,priv_requestreceipt,priv_buddymasspmlink,privfolder_massforward,priv_readreceiptslink,";
// /enhanced
require("./global.php");
// get decent textarea size for user's browser
$textareacols = gettextareawidth();
// select correct part of FORUMJUMP menu
$frmjmpsel[pm] = "selected";
// ###################### Start pmcodeparse #######################
function pmcodeparse($bbcode) {
global $privallowhtml, $privallowbbimagecode, $privallowsmilies, $privallowbbcode;
$bbcode=bbcodeparse2($bbcode,$privallowhtml,$privallowbbimagecode,$privallowsmilies,$privallowbbcode, 1);
return $bbcode;
}
if (!isset($action) or $action=="") {
$action="getfolder";
}
if ($enablepms==0) {
eval("standarderror(\"".gettemplate("error_pmadminoff")."\");");
exit;
}
//check usergroup of user to see if they can use PMs
$permissions=getpermissions($forumid);
if (!$permissions[canusepm]) {
show_nopermission();
}
//check if the user will receive PMs
if (!$bbuserinfo[receivepm]) {
eval("standarderror(\"".gettemplate("error_pmturnedoff")."\");");
exit;
}
$folderselect = array();
function makefolderjump() {
global $bbuserinfo,$folderid,$folderselect;
$folderjump = '';
// enhanced
if ($folderid==-1) $folderselect[$sent] = "selected";
// /enhanced
//get all folder names (for dropdown)
//reference with $foldernames[#] .
if (trim($bbuserinfo[ignorelist])!="") {
$ignoreusers="AND privatemessage.fromuserid<>".implode(" AND privatemessage.fromuserid<>",explode(" ",trim($bbuserinfo[ignorelist])));
} else {
$ignoreusers="";
}
// enhanced - add $dateconds to query
$messages = $DB_site->query("SELECT
privatemessage.*,
IF(ISNULL(touser.username),'[Deleted User]',touser.username) AS tousername,
IF(ISNULL(fromuser.username),'[Deleted User]',fromuser.username) AS fromusername,
icon.title AS icontitle,icon.iconpath
FROM privatemessage
LEFT JOIN icon ON icon.iconid=privatemessage.iconid
LEFT JOIN user AS touser ON (touser.userid=privatemessage.touserid)
LEFT JOIN user AS fromuser ON (fromuser.userid=privatemessage.fromuserid)
WHERE privatemessage.userid='$bbuserinfo[userid]'
AND folderid='".intval($folderid)."'
$ignoreusers $dateconds ORDER BY dateline DESC");
$privmsgsbit = '';
while ($privatemessage=$DB_site->fetch_array($messages)) {
// get the more useful of the to/from field
if ($privatemessage[touserid]==$bbuserinfo[userid]) {
$privatemessage[displayuserid]=$privatemessage[fromuserid];
$privatemessage[displayusername]=$privatemessage[fromusername];
} else {
$privatemessage[displayuserid]=$privatemessage[touserid];
$privatemessage[displayusername]=$privatemessage[tousername];
}
if ($privatemessage['displayuserid']=="") {
$privatemessage['displayusername'] = "N/A";
}
$message = $DB_site->query_first("SELECT privatemessage.*,icon.title as icontitle,icon.iconpath
FROM privatemessage
LEFT JOIN icon ON (privatemessage.iconid = icon.iconid)
WHERE privatemessageid=$privatemessageid");
if ($message[userid]!=$bbuserinfo[userid]) {
$idname="privatemessage";
eval("standarderror(\"".gettemplate("error_invalidid")."\");");
exit;
}
// enhanced
if ($permissions[cantrackpm]) {
eval("\$readreceiptsoption = \"".gettemplate("priv_readreceiptsoption")."\";");
eval("\$readreceiptslink = \"".gettemplate("priv_readreceiptslink")."\";");
} else {
$readreceiptsoption = '';
$readreceiptslink = '';
}
$receiptSQL = "";
if ($message[receipt]==1) {
if (($permissions[candenypmreceipts]) && ($noreceipt=="yes")) {
$receiptSQL = ", receipt=0";
} else {
$receiptSQL = ", receipt=2";
}
}
// show error if message has been cancelled by sender
if ($message[deleteprompt]) {
$idname="privatemessage";
eval("standarderror(\"".gettemplate("error_invalidid")."\");");
exit;
}
// check for forward-to-buddylist permission
if ($permissions[maxbuddypm]) {
eval("\$buddyforwardlink = \"".gettemplate("priv_forwardtobuddylink")."\";");
} else {
$buddyforwardlink = '';
}
// /enhanced
if ($message[messageread]==0) {
// enhanced - added $receiptSQL
$DB_site->query("UPDATE privatemessage SET messageread=1, readtime='".time()."' $receiptSQL WHERE privatemessageid=$privatemessageid");
// /enhanced
}
$post=$DB_site->query_first("SELECT
user.*,userfield.*".iif($avatarenabled,",avatar.avatarpath,customavatar.dateline AS avatardateline,NOT ISNULL(customavatar.avatardata) AS hascustomavatar ","")."
FROM user,userfield
".iif ($avatarenabled,"LEFT JOIN avatar ON avatar.avatarid=user.avatarid
LEFT JOIN customavatar ON customavatar.userid=user.userid ","")."
WHERE userfield.userid=user.userid AND user.userid=$message[fromuserid]");
$userinfo=$post;
unset($onlinestatus);
if ($post['lastactivity'] > $datecut and !$post['invisible'] and $post['lastvisit'] != $post['lastactivity']) {
eval("\$onlinestatus = \"".gettemplate("postbit_online")."\";");
} else {
eval("\$onlinestatus = \"".gettemplate("postbit_offline")."\";");
}
if ($bbuserinfo['showavatars']) {
if ($post[avatarid]!=0) {
$avatarurl=$post[avatarpath];
} else {
if ($post[hascustomavatar] and $avatarenabled) {
$avatarurl="avatar.php?userid=$post[userid]&dateline=$post[avatardateline]";
} else {
$avatarurl="";
}
}
if ($avatarurl=="") {
$post[avatar]="";
} else {
eval("\$post[avatar] = \"".gettemplate("postbit_avatar")."\";");
}
}
$post[joindate]=vbdate($registereddateformat,$post[joindate]);
if ($post[customtitle]==2) {
$post[usertitle] = htmlspecialchars($post[usertitle]);
}
if ($post[showemail] and $displayemails) {
eval("\$post[useremail] = \"".gettemplate("postbit_useremail")."\";");
} else {
$post[useremail]="";
}
if ($post[icq]!="") {
eval("\$post[icqicon] = \"".gettemplate("icq")."\";");
} else {
$post[icqicon]="";
}
if ($post[aim]!="") {
eval("\$post[aimicon] = \"".gettemplate("aim")."\";");
} else {
$post[aimicon]="";
}
if ($post[yahoo]!="") {
eval("\$post[yahooicon] = \"".gettemplate("yahoo")."\";");
} else {
$post[yahooicon]="";
}
if ($post[homepage]!="" and $post[homepage]!="http://") {
eval("\$post[homepage] = \"".gettemplate("postbit_homepage")."\";");
} else {
$post[homepage]="";
}
if ($getnextnewest=$DB_site->query_first("SELECT privatemessageid
FROM privatemessage
WHERE folderid='$message[folderid]'
AND dateline>'$message[dateline]'
AND userid='$message[userid]'
ORDER BY dateline LIMIT 1")) {
$nextnewestid=$getnextnewest[privatemessageid];
eval("\$nextnewest = \"".gettemplate("privmsg_nextnewest")."\";");
} else {
$nextnewest = '';
}
if ($getnextoldest=$DB_site->query_first("SELECT privatemessageid
FROM privatemessage
WHERE folderid='$message[folderid]'
AND dateline<'$message[dateline]'
AND userid='$message[userid]'
ORDER BY dateline DESC LIMIT 1")) {
$nextoldestid=$getnextoldest[privatemessageid];
eval("\$nextoldest = \"".gettemplate("privmsg_nextoldest")."\";");
} else {
$nextoldest = '';
}
$message = $DB_site->query_first("SELECT * FROM privatemessage WHERE privatemessageid=$privatemessageid");
//check to make sure that this owner owns this message, and that the message has not been cancelled.
if ($message[userid]!=$bbuserinfo[userid] or $message[deleteprompt]==1) {
$idname="privatemessage";
eval("standarderror(\"".gettemplate("error_invalidid")."\");");
exit;
}
$fromusergroup=$DB_site->query_first("SELECT canusepm FROM user,usergroup WHERE user.usergroupid=usergroup.usergroupid AND user.userid='$fromuserinfo[userid]'");
if (!$fromuserinfo['receivepm'] or !$fromusergroup['canusepm']) {
$touser = $fromuserinfo['username'];
eval("standarderror(\"".gettemplate("error_pmrecipturnedoff")."\");");
}
if (strtolower(substr($message[title],0,3))=="re:" or strtolower(substr($message[title],0,3))=="fw:") {
$message[title]=trim(substr($message[title],3));
}
if ($forward=="true") {
$subject="Fw: $message[title]";
} else {
$userid=$message[fromuserid];
$subject="Re: $message[title]";
}
eval("\$message[message] = \"".gettemplate("priv_reply",1,0)."\";");
} else {
$message = array();
}
if (isset($userid)) {
$touserinfo=getuserinfo($userid);
$tousergroup=$DB_site->query_first("SELECT canusepm FROM user,usergroup WHERE user.usergroupid=usergroup.usergroupid AND user.userid='$touserinfo[userid]'");
if (!$touserinfo['receivepm'] or !$tousergroup['canusepm']) {
$touser = $touserinfo['username'];
eval("standarderror(\"".gettemplate("error_pmrecipturnedoff")."\");");
}
}
if ($bbuserinfo[userid]!=0 and !$previewpost and $bbuserinfo[signature]!="") {
$signaturechecked="CHECKED";
} else {
$signaturechecked = '';
}
// ############################### start send message ###############################
if ($HTTP_POST_VARS['action']=="dosend") {
if ($message=="" or $touser=="" or $title=="") {
eval("standarderror(\"".gettemplate("error_requiredfields")."\");");
exit;
}
$touser = htmlspecialchars($touser);
if ($touserinfo = $DB_site->query_first("SELECT user.*, usergroup.canusepm FROM user,usergroup WHERE user.usergroupid=usergroup.usergroupid AND username='".addslashes($touser)."'")) {
$touserid = $touserinfo[userid];
} else {
eval("standarderror(\"".gettemplate("error_pminvalidrecipient")."\");");
exit;
}
if (!$touserinfo['receivepm'] or !$touserinfo['canusepm']) {
eval("standarderror(\"".gettemplate("error_pmrecipturnedoff")."\");");
exit;
}
if (strlen($message)>$pmmaxchars and $pmmaxchars!=0 and $bbuserinfo[usergroupid] != 6) {
eval("standarderror(\"".gettemplate("error_pmtoolong")."\");");
}
$prevtime=$DB_site->query_first("SELECT MAX(dateline) AS dateline FROM privatemessage WHERE fromuserid=$bbuserinfo[userid]");
if (time()-$prevtime[dateline]<$pmfloodtime and $pmfloodtime!=0 and !ismoderator()) {
eval("standarderror(\"".gettemplate("error_pmfloodcheck")."\");");
exit;
}
if ($pmquota>0 and $touserinfo[usergroupid] != 6 and $bbuserinfo[usergroupid] != 6) {
$msgcount = $DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$touserinfo[userid]");
if ($msgcount[messages]>=$pmquota) {
// mailbox full. email user and display error
// enhanced - added $receipt to insert
$DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title,message,dateline,showsignature,iconid,messageread,folderid,receipt) VALUES (NULL,$touserinfo[userid],$touserinfo[userid],$bbuserinfo[userid],'".addslashes(htmlspecialchars($title))."','".addslashes($message)."',".time().",'$signature','$iconid',0,0,$receipt)");
// enhanced
if ($prevmessageid) {
if ($forward) {
$DB_site->query("UPDATE privatemessage SET messageread=3 WHERE privatemessageid=".intval($prevmessageid));
} else {
$DB_site->query("UPDATE privatemessage SET messageread=2 WHERE privatemessageid=".intval($prevmessageid));
}
}
// /enhanced
if ($savecopy) {
$DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title,message,dateline,showsignature,iconid,messageread,folderid) VALUES (NULL,$bbuserinfo[userid],$touserinfo[userid],$bbuserinfo[userid],'".addslashes(htmlspecialchars($title))."','".addslashes($message)."',".time().",'$signature','$iconid',1,-1)");
}
if ($userignored!=1) {
if ($touserinfo[pmpopup]==1) {
if ($noshutdownfunc) {
$DB_site->query("UPDATE user SET pmpopup=2 WHERE userid=$touserinfo[userid]");
} else {
$shutdownqueries[]="UPDATE LOW_PRIORITY user SET pmpopup=2 WHERE userid=$touserinfo[userid]";
}
}
if ($touserinfo[emailonpm]) {
eval("\$emailmsg = \"".gettemplate("email_pmreceived",1,0)."\";");
eval("\$emailsubject = \"".gettemplate("emailsubject_pmreceived",1,0)."\";");
mail($touserinfo[email],$emailsubject,$emailmsg,"From: \"$bbtitle Mailer\" <$webmasteremail>");
}
}
// Leave Away Message in Profile (v1.2)
if ($touserinfo[away]=="1") {
// ############################### start do stuff (move, etc) ###############################
if ($HTTP_POST_VARS['action']=="dostuff") {
$what = '';
if ($delete!="") {
$what="delete";
}
if ($move!="") {
$what="move";
}
if ($what=="mark") {
// ************************
// mark as (un)read
}
if ($what=="move") {
if (is_array($privatemessage)) {
while(list($key,$val)=each($privatemessage)) {
$DB_site->query("UPDATE privatemessage SET folderid=".intval($folderid)." WHERE privatemessageid=".intval($key)." AND userid=$bbuserinfo[userid]");
} //end while
} else {
eval("standarderror(\"".gettemplate("error_pmnoselected")."\");");
exit;
}
eval("standardredirect(\"".gettemplate("redirect_pmmove")."\",\"private.php?s=$session[sessionhash]&folderid=".intval($folderid)."\");");
}
if ($what=="delete") {
if (is_array($privatemessage)) {
while(list($key,$val)=each($privatemessage)) {
$DB_site->query("DELETE FROM privatemessage WHERE privatemessageid=".intval($key)." AND userid=$bbuserinfo[userid]");
} //end while
} else {
eval("standarderror(\"".gettemplate("error_pmnoselected")."\");");
exit;
}
eval("standardredirect(\"".gettemplate("redirect_pmdelete")."\",\"private.php?s=$session[sessionhash]&folderid=".intval($thisfolder)."\");");
}
}
// ############################### start delete ###############################
if ($HTTP_POST_VARS['action']=="dodelete") {
if (!$delete) {
eval("standarderror(\"".gettemplate("error_pmnotchecked")."\");");
exit;
}
$privatemessageid=verifyid("privatemessage",$privatemessageid);
$DB_site->query("DELETE FROM privatemessage WHERE privatemessageid=$privatemessageid AND userid=$bbuserinfo[userid]");