Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Error with AJAX and some freehosts which insert ads to the page

edited October 2010 in Vanilla 2.0 - 2.8
Hi all!

Just installed Vanilla on a freehost which appends an ad to the bottom of every page. When it recognises by the Content-type header that we are sending a HTML page, it searches for the closing tag; if it does find one, it prepends it with the ad source code, otherwise it simply appends the code to the end of the file. Now most of the AJAX calls in Vanilla result in a JSON response - but the response does not have the proper Content-type set, so the server parser thinks he should append the ad - and voila, broken JSON!

The solution for my particular freehost is dead simple, I just added "Header('Content-type: text/javascript');" into the 'library/core/class.controller.php' file at every place the JSON response is sent. Might work for others as well. Another place these ads made a mess was in the Dashboard, where enabling a plugin calls some TestPlugin action or something like that which should end in printing out "Success". There I too simply changed the Content-type header I suppose to text/plain or something which worked.

Still there are places in the application where the ad kicks in when it shouldn't - such as in the My Invitations dialog (and I suppose in other AJAX dialogs as well). I will continue to pursue this in my instance of Vanilla, but as I don't have much time to make something reasonable [read: publishable] out of it right now, I thought I'd post at least something for the others to start with and maybe the devs could take it from there.. :o)

Keep rocking, Vanilla 4 ever!
Sign In or Register to comment.