To all my loyal "fans" and others:
I am sorry to withdraw this hack. However there are so many problems with it it's just not worth putting you guys through it. Therefore I am ceasing work on it and will no longer be able to support it.
To remove the hack, run the following query from phpMyAdmin or Telnet:
Code:
DELETE FROM template WHERE title='toppostall' OR title='toppost24' OR title='topposttoday'
then "un-make" the changes you made to index.php and admin/functions.php. These are:
Remove from index.php
Code:
if ($loadtoppost==1) {
$today = mktime(0,0,0); $yesterday = $today-86400;
$toptemp = gettemplate('toppost24',0,0);
$top24 = explode("|||",$toptemp);
if ($top24[0] != $yesterday and $top24[1] != $today) {
gettop24();
$top24 = gettemplate('toppost24',0,0);
$top24 = explode("|||",$top24);
}
$ttopthreadname = $top24[2]; $ttopthreadnum = $top24[3]; $ttoppostname = $top24[4]; $ttoppostnum = $top24[5];
$tttu = $top24[6]; $ttpu = $top24[7];
gettoptoday();
$toptoday = gettemplate('topposttoday',0,0);
$toptoday = explode("|||",$toptoday);
$tttopthreadname = $toptoday[0]; $tttopthreadnum = $toptoday[1]; $ttttu = $toptoday[2];
$tttoppostname = $toptoday[3]; $tttoppostnum = $toptoday[4]; $tttpu = $toptoday[5];
$topatemp = gettemplate('toppostall',0,0);
$topall = explode("|||",$topatemp);
if ($topall[0] != $today) {
gettopall();
$topall = gettemplate('toppostall',0,0);
$topall = explode("|||",$topall);
}
$topthreadname = $topall[1]; $topthreadnum = $topall[2]; $toppostname = $topall[3]; $toppostnum = $topall[4];
$topthreaddate = date($dateformat,$topall[5]); $toppostdate = date($dateformat,$topall[6]);
$ttu = $topall[7]; $tpu = $topall[8];
eval("\$topposterinfo = \"".gettemplate('topposters')."\";");
}
Code:
$templatesused.=",topposters";
From admin/functions.php, change
Code:
global $templatecache,$DB_site,$templatesetid,$loadmaxusers,$loadbirthdays,$loadtoppost;
to
Code:
global $templatecache,$DB_site,$templatesetid,$loadmaxusers,$loadbirthdays;
Then remove
Code:
".iif ($loadtoppost,"OR (title = 'toppostall')","")."
".iif ($loadtoppost,"OR (title = 'toppost24')","")."
".iif ($loadtoppost,"OR (title = 'topposttoday')","")."
Code:
// ###################### Start gettoptoday #######################
function gettoptoday() {
global $DB_site;
$today = mktime(0,0,0); $tommorrow = $today+86400;
$ttopt = $DB_site->query_first("SELECT userid,COUNT(*) AS threads,username FROM thread,user WHERE dateline>=$today AND dateline<=$tommorrow AND postuserid>0 AND postuserid=userid GROUP BY postusername ORDER BY threads DESC");
$ttopp = $DB_site->query_first("SELECT user.username AS uuname,COUNT(*) AS posts,user.userid AS uuid FROM post,user WHERE dateline>=$today AND dateline<=$tommorrow AND post.userid>0 AND user.userid=post.userid GROUP BY post.username ORDER BY posts DESC");
$sep = "|||";
if ($ttopt[username] == "") {
$ttopt[username] = "No one yet";
$ttopt[userid] = 0;
$ttopt[threads] = 0;
}
if ($ttopp[uuname] == "") {
$ttopp[uuname] = "No one yet";
$ttopp[uuid] = 0;
$ttopp[posts] = 0;
}
$template = "$ttopt[username]$sep$ttopt[threads]$sep$ttopt[userid]$sep$ttopp[uuname]$sep$ttopp[posts]$sep$ttopp[uuid]";
$DB_site->query("UPDATE template SET template='".addslashes($template)."' WHERE title='topposttoday'");
}
// ###################### Start gettop24 #######################
function gettop24() {
global $DB_site;
$today = mktime(0,0,0); $yesterday = $today-86400;
$ttopt = $DB_site->query_first("SELECT username,COUNT(*) AS threads,userid FROM thread,user WHERE dateline<=$today AND dateline>=$yesterday AND postuserid>0 AND postuserid=userid GROUP BY postusername ORDER BY threads DESC");
$ttopp = $DB_site->query_first("SELECT user.username AS uuname,COUNT(*) AS posts,user.userid AS uuid FROM post,user WHERE dateline<=$today AND dateline>=$yesterday AND post.userid>0 AND user.userid=post.userid GROUP BY post.username ORDER BY posts DESC");
$sep = "|||";
$template = "$yesterday$sep$today$sep$ttopt[username]$sep$ttopt[threads]$sep$ttopp[uuname]$sep$ttopp[posts]$sep$ttopt[userid]$sep$ttopp[uuid]";
$DB_site->query("UPDATE template SET template='".addslashes($template)."' WHERE title='toppost24'");
}
// ###################### Start gettopall #######################
function gettopall() {
global $DB_site, $topall;
$today = mktime(0,0,0); $yesterday = $today-86400;
$topt = $DB_site->query_first("SELECT username,COUNT(*) AS threads,userid FROM thread,user WHERE dateline<=$today AND dateline>=$yesterday AND postuserid>0 AND postuserid=userid GROUP BY postusername ORDER BY threads DESC");
$topp = $DB_site->query_first("SELECT user.username AS uuname,COUNT(*) AS posts,user.userid AS uuid FROM post,user WHERE dateline<=$today AND dateline>=$yesterday AND post.userid>0 AND user.userid=post.userid GROUP BY post.username ORDER BY posts DESC");
$topalle = explode("|||",$topall);
if ($topalle[4] < $topp[posts]) {
$toppb = $topp[posts]; $toppa = $topp[uuname];
$toppd = $yesterday; $toppc = $topp[uuid];
} else {
$toppb = $topalle[4]; $toppa = $topalle[3];
$toppd = $topalle[6]; $toppc = $topalle[8];
}
if ($topalle[2] < $topt[threads]) {
$toptb = $topt[threads]; $topta = $topt[username];
$toptd = $yesterday; $toptc = $topt[userid];
} else {
$toptb = $topalle[2]; $topta = $topalle[1];
$toptd = $topalle[5]; $toptc = $topalle[7];
}
$sep = "|||";
$template = "$today$sep$topta$sep$toptb$sep$toppa$sep$toppb$sep$toptd$sep$toppd$sep$toptc$sep$toppc";
$DB_site->query("UPDATE template SET template='".addslashes($template)."' WHERE title='toppostall'");
}
Finally, remove the custom template topposters.
This should remove the hack completely from your vBulletin installation.
Bookmarks