The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
phpAdsNew Banner Ads integration (advertisements, classified ads, Adsense, etc.) Details »» | |||||||||||||||||||||||||||
phpAdsNew Banner Ads integration (advertisements, classified ads, Adsense, etc.)
Developer Last Online: Nov 2023
OpenAds / phpAdsNew Integration 1.0.4 for vBulletin 3.[56].x
2006-06-08 by mip Integrates the OpenAds / phpAdsNew ads system by introducing a new template tag <ad ... />. You can even deliver your Adsense stuff via phpAdsNew using HTML banners. The features of phpAdsNew combined with the power of vBulletin's templating system gives you the possibility to place ads for specific user groups, forums, and keywords. PREREQUISITES: This plugin requires a working installation (local or remote) of a recent version ofOpenAds / phpAdsNew (free software released under the GPL). When using OpenAds, replace phpAdsNew in this documentation with OpenAds (phpAdsNew is just the predecessor of OpenAds). INSTALLATION: When having a previous version of this product installed, see section UPGRADE instead. Install product "phpadsnew-1.0.4.xml". Set phpAdsNew path in Server Settings and Optimization Options to point to either your local phpAdsNew installation or a remote server (using XML-RPC). It is strongly recommended to set $phpAds_config['compatibility_mode'] = true; in phpAdsNew config file, to prevent problems when phpAdsNew uses a database different from the one used by your vBulletin board. When using XML-RPC, make sure to have lib-xmlrpc-class.inc.php and lib-xmlrpc.inc.php copied from phpAdsNew misc/samples/xmlrpc/php/ to your forum's includes/ directory (not necessary when using a local phpAdsNew installation). Read the NOTES section below. Click INSTALL in this thread to mark product as "installed" and receive notifications when a new version comes out. UPGRADE:
USAGE: Use the newly introduced <ad ... /> tag in your templates. The syntax is similar to phpAdsNew's view_raw() function call - the tag understands what, clientid, target, source, and withtext as arguments. Please make yourself familiar with phpAdsNew prior to using this product. You can't expect this product to work, if you didn't check if your phpAdsNew is delivering your banners cleanly. Examples:
NOTES:
PS: This plugin is donationware - it helps you to make some money, so please be fair and honor my work with an adequate pecuniary donation. Donate via Paypal Show Your Support
|
Comments |
#572
|
|||
|
|||
I have a fresh vB3.8.2 with no other mods but this and two themes, one implements the <ad/> tag and another doesn't. The board is natively set to UTC+10 and I have added the time zone to the time stamps when viewing the only post on the board in each style it can be seen that when the ads are on the time stamp is UTC and when off reverts to board time. Board time is correctly reported at the bottom of the main page for the user in either case.
I continue to drill down on this. I am certain it has something to do with the local mode bug in openX but this still shouldn't throw vB - there must be some way of protecting the local variables in vB so that they are not zapped with the call out to openX by a simple plugin. By the By, something to be aware of is that if you use the disable hooks in config.php to check your board functionality with the way that this plugin works the <ad/> tags break the templates calling for view_ad which (with hooks disabled) is an undefined function - yielding thus a fatal error. Code:
Fatal error: Call to undefined function view_ad() in /var/www/archq/forums/global.php(614) : eval()'d code on line 1 Code:
define('DISABLE_HOOKS', true); |
#573
|
|||
|
|||
Thanks for taking the time to try and get this working.
|
#574
|
|||
|
|||
well, i finally decided to just install a older version of openads.
It works fine with this plugin and does the trick for me. IF the time problems get fixed, then i might try to upgrade to the new openads |
#575
|
|||
|
|||
That is good news as a fall back - I have set my board to time display detailed so they get a relative take on the time stamp - but it is far from a workable solution. I have too much running on openX and am going to pursue this to the bitter end
Cheers, Will |
#576
|
|||
|
|||
OK.... Drum roll:
The fix is almost absurdly simple. You have to specify the openads timezone variable before making the callout. I can only confirm this for vB3.8.3, phpAdsNew Banner Ads Integration 1.0.4, openX 2.8 and php5 so please don't go jumping into your plugins and stuffing up boards without backups and copying and pasting the original code to a text editor. The line needed is the spec of the local server timezone for your host: Code:
OA_setTimeZone('Australia/Sydney'); To fix this problem with Local Mode (not xml-rpc) method calls to openX 2.8 you need edit the plugin: view ad function Select all in the plugin code box and replace with this: Code:
if (!function_exists('view_ad')) { /** * Calls view_raw function from phpAdsNew either locally or via xml-rpc to get HTML advertisement code, see phpAdsNew for infos. * * @param string Zone name (zone:x) or keywords (keyword1|keyword2|...) * @param integer Client-ID * @param string Target * @param string Source * @param integer Withtext * * @return string */ function view_ad($what, $clientid = 0, $target = '', $source = '', $withtext = 0) { global $vbulletin; static $panpath; if (!$panpath) { trim($vbulletin->options['panpath']); $panpath = @parse_url($vbulletin->options['panpath']); } // Calculate an identifier for the requested ad - this could be used to cache banners retrieved via xmlrpc in future versions $adid = sprintf('%u', crc32($what . $clientid . $target . $source . $withtext)); if ($vbulletion->options['addtemplatename'] or $vbulletin->config['Misc']['debug']) { // Be verbose $adcomment = 'id="' . $adid . '" what="' . htmlspecialchars($what) . '" clientid="' . htmlspecialchars($clientid) . '" target="' . htmlspecialchars($target) . '" source="' . htmlspecialchars($source) . '" withtext="' . htmlspecialchars($withtext) . '"'; } else { $adcomment = $adid; } if ($vbulletin->options['panpath'] == '') { // Path to phpAdsNew is empty - disable ads return "<!-- ad {$adcomment} / -->"; } elseif (strtolower($panpath['scheme']) == 'http') { // get banner from phpAdsNew via xml-rpc /* // ATTN: // In phpAdsNew 2.0.6 (and maybe earlier versions) is a tiny bug which prevents xml-rpc from working cleanly. // // Patch: // --- phpAdsNew/misc/samples/xmlrpc/php/lib-xmlrpc.inc.php.orig Tue Aug 16 10:51:26 2005 // +++ phpAdsNew/misc/samples/xmlrpc/php/lib-xmlrpc.inc.php Thu Oct 27 17:12:26 2005 // @@ -76,6 +76,7 @@ // global $xmlrpcStruct; // // global $xmlrpcTypes; // + global $xmlrpc_valid_parents; // global $xmlEntities; // global $xmlrpcerr; // global $xmlrpcstr; // // See https://sourceforge.net/tracker/?func=detail&atid=111386&aid=1339623&group_id=11386 for details. */ global $xmlrpcbanner, $phpAds_remoteInfo; require_once(DIR . '/includes/lib-xmlrpc-class.inc.php'); // see misc/samples/xmlrpc/php/ directory of your phpAdsNew installation if (!$xmlrpcbanner) { $xmlrpcbanner = new phpAds_XmlRpc($panpath['host'], $panpath['path'], (intval($panpath['port']) > 0 ? $panpath['port'] : 80)); } $ad = $xmlrpcbanner->view_raw($what, $clientid, $target, $source, $withtext); return "<!-- BEGIN ad {$adcomment} -->{$ad['html']}<!-- END ad {$adid} -->"; } else { // get banner via direct invocation of phpAdsNew // this is basically taken from the invocationcode generated by phpAdsNew - it does its own checks to prevent multiple inclusion global $phpAds_context; if (@require($vbulletin->options['panpath'] . (strstr($vbulletin->options['panpath'] , '/phpadsnew.inc.php') ? '' : '/phpadsnew.inc.php' ))) { if (!isset($phpAds_context)) { $phpAds_context = array(); } $ad = view_raw($what, $clientid, $target, $source, $withtext, $phpAds_context); if ($vbulletin->options['panbandupes']) { // Remember bannerid to prevent showing banner multiple times on same page $phpAds_context[] = array('!=' => 'bannerid:'.$ad['bannerid']); } OA_setTimeZone('TIME/ZONE'); return "<!-- BEGIN ad {$adcomment} -->{$ad['html']}<!-- END ad {$adid} -->"; } } } } Code:
OA_setTimeZone('TIME/ZONE'); OR if you just want to insert the line yourself find: Code:
$phpAds_context[] = array('!=' => 'bannerid:'.$ad['bannerid']); } Code:
OA_setTimeZone('TIME/ZONE'); Code:
return "<!-- BEGIN ad {$adcomment} -->{$ad['html']}<!-- END ad {$adid} -->"; } or at least that has fixed the issue for me. Now I must say that I am not sure of what effect this might have on the openX server if it is not in the timezone that the main boards are - this could conceivable cause problems associated with skew of the statistics or other database date and time records within openX. If I notice anything like this I will report here. Cheers, Will |
#577
|
||||
|
||||
Fantastic Will, will try this now, have had to stay on 2.4.3 due to the ad tag bug.
Cheers Bruce |
#578
|
||||
|
||||
Are you using LWillmann's solution or something else? I have quite a few ads running with javascript and it's eating up my servers' resources...
|
#579
|
|||
|
|||
It's this Add-on with a modification (one only) to the plugin that delivers the ad.
|
#580
|
||||
|
||||
Thanks for the answer. Is the modification related to the ability to use local calls or not? I really wanted to get rid of the javascript...
|
#581
|
|||
|
|||
This mod invokes the ads via local mode or xml-rpc calls by defining a template tag <ad />.
The javascript invocation method is not implemented using the <ad /> tag to callout phpAdsNew [openX]. If I understand you correctly, you are using javascript invocation calls generated by the zone defined in phpAdsNew [openX]? This method is slow and very inefficient compared to local mode therefore I tried this mod in order to improve performance but immediately ran into the problem of it no longer being supported for vB3.8.x or openX (as such). Having a server with vB3.8.3 and openX 2.8 on the same localhost I thought I'd give this mod a go and see if it works. It does, but with the caveat that as soon as you invoke an ad using the <ad /> tag all timestamps on the board are reverted to UTC (whatever the server config or userCP setting) but the board time remains correct and displays correctly (timezone and all) at the bottom of the pages. The reason for this is that when making local mode calls to openX 2.8 the timezone is not correctly handled - as reported in this bug. Several workarounds are suggested and I found that ultimately defining the openX timezone prior to making the callout (with the localhost local timezone - nothing to do with a user's preference setting offset) fixed the problemo. So that, in a nutshell, is it. I have not experimented with xml-rpc but since this mod provides it as an alternative call I suspect it works as expected. You can therefore do away with javascript invocation by implementing this mod with the single plugin modification I posted above. HTH Cheers, \\' I suppose that this mod could be relaunched as OpenX Banner Ads Integration and stated as compatible with vB 3.8 and OpenX2.8 - much more testing would have to be done though and the local system timezone would have to be implemented as opposed to hardwiring it in the plugin. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|