Version: , by majglow
Developer Last Online: Aug 2008
Version: Unknown
Rating:
Released: 07-18-2003
Last Update: Never
Installs: 0
No support by the author.
Hi,
I want to use phpAdsNew with vBulletin (I saw the existing hack already but it isn't what I'm looking for).
All my banners for the forums will be in one zone in phpMyAdsNew with keywords associated with them. keyword forumx means the banner can be displayed in the forum with ID x and forumhome means it can be displayed on the home page.
So, I need to get vbulletin to return a list of all the forums that the page is currently in (the current forum and all the parent ones).
So, I hacked vBulletin to do that and I'm wondering if anything I did will make it break. Here is my code
In global.php I replaced every occurence of the query
Code:
SELECT forum.forumid,styleid,styleoverride FROM forum,thread WHERE forum.forumid=thread.forumid AND threadid='$threadid'
with
Code:
SELECT forum.forumid,styleid,styleoverride,forum.parentlist FROM forum,thread WHERE forum.forumid=thread.forumid AND threadid='$threadid'
then in the same file I made the following insertion (I added some of the previous lines for you to locate the area.
Code:
if (isset($pollid) and !isset($codestyleid)) {
$getforum=$DB_site->query_first("SELECT forum.forumid,styleid,styleoverride,forum.parentlist FROM forum,thread WHERE forum.forumid=thread.forumid AND pollid='".addslashes($pollid)."'");
if ($getforum['styleoverride']==1 or $bbuserinfo['styleid']<2) {
$codestyleid=$getforum['styleid'];
}
}
//--- Begin edit Majglow -----------------------------------------------------------------------
if (!isset($adkeyword) && isset($getforum)) {
$tmpparents = explode (",", $getforum["parentlist"]);
foreach ($tmpparents as $parent) {
if ($parent != "-1") {
$adkeyword .= "forum$parent,";
}
}
}
//--- End edit ---------------------------------------------------------------------------------
That's all for that file. In index.php, right before "require('./global.php'); I added the following line
Code:
$adkeyword = "forumhome,";
And, the final bit, in admin/functions.php I added the following snipit of code
Code:
global $adkeyword;
$newtext=str_replace("{adkeywords}",$adkeyword,$newtext);
which I added right after these lines:
Code:
while ($var=$DB_site->fetch_array($vars)) {
if ($var['findword']!="") {
$newtext=str_replace($var['findword'],$var['replaceword'],$newtext);
}
}
Anyway, this effectivly lets me use {adkeywords} in my templates (which I will only use in my direct banner selction string from phpAdsNew.
Well, I'm wondering if any of this code will make any of the normal vBulletin stuff break. It's just the modified query that is worrying me but all my tests show that it is working correctly.
Do you guys know of any problems right off of the top of your heads?
No, it will not break your vbulletin.
You might want to add this to remove the last comma:
$adkeyword substr($adkeyword,0,-1);
And you might also want to add a new replacement variable through the cp named {adkeywords} and add $adkeyword as the replacement, instead of actually hacking vbulletin to do that...