lierduh |
07-27-2003 12:54 PM |
Edit: 2 Nov 2003.
I have mucked around a bit more to get this to work under vBulletin Version 3. A new post can be found here:
https://vborg.vbsupport.ru/showpost....&postcount=658
Quote:
07-26-03 at 02:41 AM lierduh said this in Post #584
I am using version 1.9, but I too have the sorting problem. I have noticed the last reference picks up the wrong Message-ID.
|
Ok, I fixed the References problem. Not a elegant way, but I post here anyway for someone who tries to do something similar, or even for me to remember what I did. I have not really tested the codes by the way.
1) Add two columns to post table.
ref (type: Text)
pre_postid (type: int, length:10)
2) hack newreply.php
diff newreply_old.php newreply.php
PHP Code:
26a27,30
> if (isset($pre_postid)) {
> $pre_postid=(int)$pre_postid;
> }
>
305c309
< $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')");
---
> $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')");
3) Modify template: newreply
Find: <input type="hidden" name="threadid" value="$threadid">
add a line
<input type="hidden" name="pre_postid" value="$postid">
4) Modify gateway.php
diff gateway_old.php gateway.php
PHP Code:
20c20
< include("global.php");
---
> require_once("global.php");
23c23
< include("nntp.php");
---
> require_once("nntp.php");
25c25
< include("class.POP3.php3");
---
> //require_once("class.POP3.php3");
27c27
< include("mime.php");
---
> require_once("mime.php");
66c66
< $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]) . ")");
---
> $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]) . ")");
74c74
< $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]) . ")");
---
> $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]) . ")");
125a126,132
> if ($message[references]){
> $elements=imap_mime_header_decode($message[references]);
> $message[references] = '';
> for($i=0;$i<count($elements);$i++) {
> $message[references] .= $elements[$i]->text;
> }
> }
214,216c221,223
< }
< $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();
---
> }
> $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();
258c265
< $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(from_name($message[from]))."','0','".$date."','$attachmentid','".addslashes($message[text])."','1','0','".addslashes(from_email($message[from]))."','0','1','1','".addslashes($message[msgid])."')");
---
> $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(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])."')");
608,613c615,617
< $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 ");
---
> $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 ");
629c633
< $DB_site->query("UPDATE post SET isusenetpost = -1, msgid = '<".addslashes($msgid).">' WHERE postid=$newthread[postid]");
---
> $DB_site->query("UPDATE post SET isusenetpost =1, msgid ='<".addslashes($msgid).">' , ref = '".$references."' WHERE postid=$newthread[postid]");
|