Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools
Will my code break vBulletin? Details »»
Will my code break vBulletin?
Version: , by majglow majglow is offline
Developer Last Online: Aug 2008 Show Printable Version Email this Page

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?

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

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 07-21-2003, 06:59 PM
rake's Avatar
rake rake is offline
 
Join Date: Nov 2002
Posts: 311
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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...
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:07 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.03767 seconds
  • Memory Usage 2,203KB
  • Queries Executed 17 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (6)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (1)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete