Closed (fixed)
Project:
Advertisement
Version:
5.x-1.1
Component:
adserve.php
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
18 Jun 2007 at 04:21 UTC
Updated:
2 Aug 2007 at 03:15 UTC
Jump to comment: Most recent file
In the Current adserve.php file on line 171 when this if statement occurs :
if (empty($ads)) {
adserve_variable('error', TRUE);
$output = 'No active ads were found in the '. (empty($nids) ? 'tids' : 'nids') ." '$id'.";
}
This produces the following to be displayed in the JavaScript
document.write('<!-- No active ads were found in the tids '0'. -->');
So because " ' " is being used inside a " ' " this is causing a Javascript error on the document.write
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | fix_multiline_ads.diff | 714 bytes | dasil003 |
Comments
Comment #1
jeremy commentedThanks, I'll be sure this is fixed in the next release.
Comment #2
dasil003 commentedHere's a patch that fixes this issue (hopefully, untested) in addition to a problem if the output is multiple lines. Javascript doesn't like multiple line strings, so I'm splitting them. I HAVE tested the line splitting functionality, and am using it in production to make the ad_flash module work, where previously it was not displaying the flash ads in the blocks.
My patch is from the subversion of my project. Sorry I don't have time to do the CVS checkout and create a patch in the proper context.
Comment #3
jeremy commentedYes, the "'" needs to be escaped, this portion will be merged soon.
My gut feeling is that the splitting functionality should be moved out of adserve.php into ad_text.module's ad_text_display_prepare() function. Why are there \n's being generated by the ad_flash module? This could also be implemented as a one line preg_replace_all().
Comment #4
jeremy commentedThe primary problem of quotes breaking the output has been fixed by added a call to addslashes() in in adserve.php. The issue of displaying multi-line ads is not addressed as your implementation didn't work in my testing. If you want to pursue that issue, please open a new issue (and reference this one). I'd prefer to see it added to the function ad_text_display_prepare() in the ad_text module.
Comment #5
(not verified) commented