I worked on the instructions a little - maybe they'll be easier now. If lierduh or anybody else objects to my changing the instructions I'll be happy to delete them. I didn't write this hack, have no input on it and can only report on what worked for me - so here goes:
edit: I had the same problem lierduh did. There are a couple places here where the forum software thows a couple of spaces in "allowsmilie" in the text below. If you just paste this stuff in it'll cause database errors so once you're finished editing newreply.php and gateway.php, replace all instances of "allowsmili e" with "allowsmilie". This appears to be a bug in vB3 -
1) Add two columns to post table. Run these queries against your forum database either from a command line or phpMyAdmin or whatever else you have
ALTER TABLE post ADD COLUMN ref TEXT;
ALTER TABLE post ADD COLUMN pre_postid INT(10);
please note that all line numbers were taken from the original files - since we're adding a couple of lines here and there the numbers will be off just a little
2)open forumhome/newreply.php
find (around line 27):
PHP Code:
if (isset($postid)) {
add under it:
PHP Code:
if (isset($pre_postid)) {
$pre_postid=(int)$pre_postid;
}
find (around line 305):
PHP Code:
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,attachmentid,pagetext,allowsmilie,showsignature,ipaddress,iconid,visible) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($title))."','".addslashes($postusername)."','$bbuserinfo[userid]','".time()."','$attachmentid','".addslashes($message)."','$allowsmilie','$signature','$ipaddress','$iconid','$visible')");
replace it with:
PHP Code:
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,attachmentid,pagetext,allowsmilie,showsignature,ipaddress,iconid,visible,pre_postid) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($title))."','".addslashes($postusername)."','$bbuserinfo[userid]','".time()."','$attachmentid','".addslashes($message)."','$allowsmilie','$signature','$ipaddress','$iconid','$visible','$pre_postid')");
save newreply.php
3) Modify template: newreply
find:
PHP Code:
<input type="hidden" name="threadid" value="$threadid">
add under it:
PHP Code:
<input type="hidden" name="pre_postid" value="$postid">
4) Modify gateway.php
find (around line 19):
PHP Code:
header("Content-Type: text/plain");
include("global.php");
// Load NNTP classes
include("nntp.php");
// POP3 class
include("class.POP3.php3");
// Load Mime message parser
include("mime.php");
replace it with
PHP Code:
header("Content-Type: text/plain");
require_once("global.php");
// Load NNTP classes
require_once("nntp.php");
// POP3 class
//require_once("class.POP3.php3");
// Load Mime message parser
require_once("mime.php");
find (around line 66):
PHP Code:
$get_newthreads=$DB_site->query("SELECT post.postid,post.username,post.userid,post.dateline,post.attachmentid,post.pagetext,post.showsignature,post.ipaddress,thread.pollid,thread.title,post.threadid,thread.forumid FROM thread,post WHERE post.isusenetpost=0 AND thread.threadid=post.threadid AND post.dateline=thread.dateline AND post.userid=thread.postuserid AND (thread.forumid=". implode(" OR thread.forumid=", $group[forum]) . ")");
replace it with:
PHP Code:
$get_newthreads=$DB_site->query("SELECT post.postid,post.username,post.userid,post.dateline,post.attachmentid,post.pagetext,post.showsignature,post.ipaddress,thread.pollid,thread.title,post.threadid,thread.forumid,post.pre_postid FROM thread,post WHERE post.isusenetpost=0 AND thread.threadid=post.threadid AND post.dateline=thread.dateline AND post.userid=thread.postuserid AND (thread.forumid=". implode(" OR thread.forumid=", $group[forum]) . ")");
find (around line 74):
PHP Code:
$get_newposts=$DB_site->query("SELECT post.postid,post.username,post.userid,post.dateline,post.attachmentid,post.pagetext,post.showsignature,post.ipaddress,thread.title,post.threadid,thread.forumid,thread.msgid,thread.prefix FROM thread,post WHERE post.isusenetpost=0 AND thread.threadid=post.threadid AND (thread.forumid=". implode(" OR thread.forumid=", $group[forum]) . ")");
replace it with:
PHP Code:
$get_newposts=$DB_site->query("SELECT post.postid,post.username,post.userid,post.dateline,post.attachmentid,post.pagetext,post.showsignature,post.ipaddress,thread.title,post.threadid,thread.forumid,thread.msgid,thread.prefix,post.pre_postid FROM thread,post WHERE post.isusenetpost=0 AND thread.threadid=post.threadid AND (thread.forumid=". implode(" OR thread.forumid=", $group[forum]) . ")");
find (around line 119):
PHP Code:
if ($message[from]){
$elements=imap_mime_header_decode($message[from]);
$message[from] = '';
for($i=0;$i<count($elements);$i++) {
$message[from] .= $elements[$i]->text;
}
}
}
add under it:
PHP Code:
if ($message[references]){
$elements=imap_mime_header_decode($message[references]);
$message[references] = '';
for($i=0;$i<count($elements);$i++) {
$message[references] .= $elements[$i]->text;
}
}
find (around line 214):
PHP Code:
}
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,attachmentid,pagetext,allowsmilie,showsignature,ipaddress,iconid,visible,isusenetpost,msgid) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($message[subject]))."','".addslashes(htmlspecialchars(from_name($message[from])))."','0','".$date."','$attachmentid','".addslashes($message[text])."','1','0','".addslashes(htmlspecialchars(from_email($message[from])))."','0','1','1','".addslashes($message[msgid])."')");
$postid=$DB_site->insert_id();
replace it with:
PHP Code:
}
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,attachmentid,pagetext,allowsmilie,showsignature,ipaddress,iconid,visible,isusenetpost,msgid,ref) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($message[subject]))."','".addslashes(htmlspecialchars(from_name($message[from])))."','0','".$date."','$attachmentid','".addslashes($message[text])."','1','0','".addslashes(htmlspecialchars(from_email($message[from])))."','0','1','1','".addslashes($message[msgid])."','".addslashes($message[references])."')");
$postid=$DB_site->insert_id();
find (around line 258):
PHP Code:
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,attachmentid,pagetext,allowsmili e,showsignature,ipaddress,iconid,visible,isusenetpost,msgid) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($message[subject]))."','".addslashes(from_name($message[from]))."','0','".$date."','$attachmentid','".addslashes($message[text])."','1','0','".addslashes(from_email($message[from]))."','0','1','1','".addslashes($message[msgid])."')");
replace it with:
PHP Code:
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,attachmentid,pagetext,allowsmili e,showsignature,ipaddress,iconid,visible,isusenetpost,msgid,ref) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($message[subject]))."','".addslashes(from_name($message[from]))."','0','".$date."','$attachmentid','".addslashes($message[text])."','1','0','".addslashes(from_email($message[from]))."','0','1','1','".addslashes($message[msgid])."','".addslashes($message[references])."')");
find (around line 608):
PHP Code:
$get_attachinfo=$DB_site->query("SELECT msgid FROM post WHERE threadid=$newthread[threadid]");
$ref = '';
while ($thisref=$DB_site->fetch_array($get_attachinfo)){
if ($thisref[msgid] and strlen($ref) < 600){ $ref .= "$thisref[msgid] "; }
}
$ref = "\r\nReferences: ".wordwrap($ref, 210, "\r\n ");
replace it with:
PHP Code:
$get_references=$DB_site->query_first("SELECT msgid,ref FROM post WHERE postid=$newthread[pre_postid]");
$references = $get_references[ref] . " " . $get_references[msgid];
$ref = "\r\nReferences: ".wordwrap(stripslashes($references), 210, "\r\n ");
find (around line 629):
PHP Code:
$DB_site->query("UPDATE post SET isusenetpost = -1, msgid = '<".addslashes($msgid).">' WHERE postid=$newthread[postid]");
replace it with:
PHP Code:
$DB_site->query("UPDATE post SET isusenetpost =1, msgid ='<".addslashes($msgid).">' , ref = '".$references."' WHERE postid=$newthread[postid]");
|