Firefox PHP

'Float to top' for phorum 3.2.11

Posted by badguy 
'Float to top' for phorum 3.2.11
November 07, 2001 03:15AM
0. To apply to running phorum,
0.1) make a backup of your current working Phorum directory as well as your tables.
0.2) run hack.php in your root directory of phorum. and after that you must delete this file.

1. edit file: list.php

replace line 92-181


if($thread==0 || $action==0){
$sSQL = "Select max(thread) as thread from $ForumTableName where approved='Y'";
$q->query($DB, $sSQL);
if($q->numrows()>0){
$rec=$q->getrow();
$maxthread = isset($rec["thread"]) ? $rec["thread"] : 0;
}
else{
$maxthread=0;
}

...
...
...

if($$phcollapse==0){
$sSQL = "Select id,parent,thread,subject,author,datestamp from $ForumTableName where approved='Y' AND thread<=$max and thread>=$min order by thread desc, id asc";
}
else{
$sSQL = "Select id,thread,subject,author,datestamp from $ForumTableName where approved='Y' AND thread = id AND thread<=$max AND thread>=$min order by thread desc";
}

with following codes

// float to top hack
$myflag="";
if ($thread!=0) {
$myflag = " and modifystamp < $thread";
if($action==1){
$sSQL = "Select modifystamp as maxtime from $ForumTableName WHERE approved='Y' AND modifystamp > $thread ORDER BY modifystamp DESC".$limit;

$q->query($DB, $sSQL);
if($q->numrows()>0){
$rec=$q->getrow();
if (isset($rec["maxtime"])) {
$myflag = " AND modifystamp <= ".$rec["maxtime"];
}
}
}
}

if($$phcollapse==0){
$sSQL = "SELECT thread, modifystamp FROM $ForumTableName WHERE approved='Y' $myflag GROUP BY thread, modifystamp ORDER BY modifystamp desc, thread desc".$limit;
} else {
if($DB->type=="mysql"){
$convfunc="FROM_UNIXTIME";
}
else{
$convfunc="datetime";
}
$sSQL = "SELECT thread, modifystamp, count(id) AS tcount, $convfunc(modifystamp) AS latest, max(id) as maxid FROM $ForumTableName WHERE approved='Y' $myflag GROUP BY thread, modifystamp ORDER BY modifystamp desc, thread desc".$limit;
}
$thread_list = new query($DB, $sSQL);

if($DB->type=="postgresql"){
$q->query($DB, "set QUERY_LIMIT TO '0'");
}

$rec=$thread_list->getrow();

if(empty($rec["thread"]) && $action!=0){
Header("Location: $forum_url/$list_page.$ext?f=$num$GetVars");
exit();
}

$aryThreadstring=array();
$threads=array();
$max=0;
$min=0;
while (is_array($rec)){
if($rec["modifystamp"]>$max) {
$max=$rec["modifystamp"];
if($min==0) {
$min=$max;
}
} elseif ($rec["modifystamp"]<$min) {
$min=$rec["modifystamp"];
}
$aryThreadstring[$rec["thread"]] = $rec["thread"];
$threads[]=$rec;
$rec=$thread_list->getrow();
}
$threadstring = implode(",",$aryThreadstring);

if (!empty($threadstring)) {

if($$phcollapse==0){
$sSQL = "Select id,parent,thread,subject,author,datestamp from $ForumTableName WHERE approved='Y' $myflag and thread IN (".$threadstring.") order by modifystamp desc, id asc";
} else {
$sSQL = "Select id,0 as parent,thread,subject,author,datestamp from $ForumTableName WHERE approved='Y' AND parent = 0 $myflag and thread IN (".$threadstring.") order by modifystamp desc";
}
}

$headers=array();
// float to top hack

2. edit file: include/post.php

search for (line: 314-318)

$sSQL = "Insert Into $ForumTableName (id, author, email, datestamp, subject, host, thread, parent, email_reply, attachment, approved, msgid) values ('$id', '$author', '$email', '$datestamp', '$subject', '$host', '$thread', '$parent', '$email_reply', '$org_attachment', '$approved', '$msgid')";
$q->query($DB, $sSQL);
if(!$q->result){
return($q->error()."<br>$sSQL");
}

right after these codes (line 319), insert these

// float to top hack
$NOW=time();
$sSQL = "UPDATE $ForumTableName SET modifystamp = $NOW WHERE thread = $thread";
$q->query($DB, $sSQL);
if($err=$q->error()){
echo($err."<br>$sSQL");
}
// float to top hack

3. edit file: db/mysql.php

search and replace line 175-176

if($table=="main"){
$sSQL="CREATE TABLE $table_name (id bigint(20) unsigned DEFAULT '0' NOT NULL, datestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, thread int(11) DEFAULT '0' NOT NULL, parent int(11) DEFAULT '0' NOT NULL, author char(37) DEFAULT '' NOT NULL, subject char(255) DEFAULT '' NOT NULL, email char(200) DEFAULT '' NOT NULL, attachment char(64) DEFAULT '' NOT NULL, host char(50) DEFAULT '' NOT NULL, email_reply char(1) NOT NULL DEFAULT 'N', approved char(1) NOT NULL DEFAULT 'N', msgid char(100) DEFAULT '' NOT NULL, PRIMARY KEY (id), KEY author (author), KEY datestamp (datestamp), KEY subject (subject), KEY thread (thread), KEY parent (parent), KEY approved (approved), KEY msgid (msgid))";

with following codes

if($table=="main"){
$sSQL="CREATE TABLE $table_name (
id bigint(20) unsigned DEFAULT '0' NOT NULL,
datestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
thread int(11) DEFAULT '0' NOT NULL,
parent int(11) DEFAULT '0' NOT NULL,
author char(37) DEFAULT '' NOT NULL,
subject char(255) DEFAULT '' NOT NULL,
email char(200) DEFAULT '' NOT NULL,
attachment char(64) DEFAULT '' NOT NULL,
host char(50) DEFAULT '' NOT NULL,
email_reply char(1) NOT NULL DEFAULT 'N',
approved char(1) NOT NULL DEFAULT 'N',
msgid char(100) DEFAULT '' NOT NULL,
modifystamp int(10) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (id),
KEY author (author),
KEY datestamp (datestamp),
KEY subject (subject),
KEY thread (thread),
KEY parent (parent),
KEY approved (approved),
KEY msgid (msgid),
KEY modifystamp (modifystamp)
)";

4. upload all edited files and done.

You can test this hack at [forums.bang-or.com]

Have fun

badguy
Re: 'Float to top' for phorum 3.2.11
November 07, 2001 03:18AM
Ohh. sorry I'm forgot to upload hack file :)
Attachments:
open | download - hack.txt (6.4 KB)
open | download - hack.php.txt (1.5 KB)
Re: 'Float to top' for phorum 3.2.11
November 09, 2001 12:48AM
thank you soooooooooo much
I'll test this tomorrow
let you know how it went
Re: 'Float to top' for phorum 3.2.11
November 09, 2001 01:03AM
super duper works
bravo
clap clap clap
and thanks
i wanna know the details of atleast email id hacking for just fun and knowledge.Please help me out..........
Sorry, you do not have permission to post/reply in this forum.