vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Will my code break vBulletin? (https://vborg.vbsupport.ru/showthread.php?t=55382)

majglow 07-18-2003 03:17 AM

Will my code break vBulletin?
 
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?

Thanks, carl
http://www.djforums.com/

rake 07-21-2003 06:59 PM

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...


All times are GMT. The time now is 08:08 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01004 seconds
  • Memory Usage 1,717KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete