[FIXED] Mambots fired on Modules

Post Reply
User avatar
PhilTaylor-Prazgod
Joomla! Ace
Joomla! Ace
Posts: 1155
Joined: Sat Aug 20, 2005 12:32 pm
Location: Weymouth, UK
Contact:

[FIXED] Mambots fired on Modules

Post by PhilTaylor-Prazgod » Mon Jun 26, 2006 8:14 pm

Ref: http://forum.joomla.org/index.php/topic ... #msg374349
It appears that mambots are now fired on module content as well as content items! This was not the case before Joomla 1.0.10 (Or at least it never appeared so). this could effect all mambots

Please read my blog post on the difference and the impact it had on the Tags component (was ok on J 1.0.9 before Joomla 1.0.10, tags mambot never changed)
http://blog.phil-taylor.com/2006/06/26/ ... component/
Apparently its not just my components! Here is an email from a customer with a free module from someone else:
Hey Phil

It seems that as a result of the upgrade to ver 1.10.0, joomla is now treating the "Creative commons license module" as a comment item - thats why the joomla deliciousbot bot was putting links above (and then below when I changed the bot settings) the CC liscense module in the left sidebar.

So, for now, I just turned off the CC module. I'd like to get this straightened out, but....

....
Last edited by stingrey on Fri Aug 18, 2006 8:48 pm, edited 1 time in total.
Phil Taylor - Full Time Joomla/PHP Security Expert
Blue Flame Digital Solutions Limited.
-- https://myJoomla.com/ Multi Award Winning Joomla Security & Auditing Service
-- https://www.phil-taylor.com/

User avatar
stingrey
Joomla! Hero
Joomla! Hero
Posts: 2756
Joined: Mon Aug 15, 2005 4:36 pm
Location: Marikina, Metro Manila, Philippines
Contact:

Re: [J1.0.10] Mambots fired on Modules

Post by stingrey » Mon Jun 26, 2006 10:12 pm

Short answer is that yes content mambots will now affect custom/new module content as of 1.0.10

It was deemed a shortfall that was addressed in previous versions of 1.0.x and fixed in 1.0.10
Rey Gigataras
http://www.wizmediateam.com <-- great team of talented Web Designers and Programmers!
http://about.me/reygigataras <-- About Me :)
Partner, Business Development & Project Manager, Event Manager, Sports Coach :D

User avatar
eyezberg
Joomla! Hero
Joomla! Hero
Posts: 2860
Joined: Thu Aug 25, 2005 5:48 pm
Location: Geneva mostly
Contact:

Re: [J1.0.10] Mambots fired on Modules

Post by eyezberg » Tue Jun 27, 2006 6:01 am

What does that mean now?
It is a feature, not a bug?
How can this be turned of?
:(
Sometimes one pays most for the things one gets for nothing.
The important thing is not to stop questioning. Curiosity has its own reason for existing. AE
http://joomla15.[URL banned].com for J! 1.5 screenshots
http://www.eyezberg.com

User avatar
PhilTaylor-Prazgod
Joomla! Ace
Joomla! Ace
Posts: 1155
Joined: Sat Aug 20, 2005 12:32 pm
Location: Weymouth, UK
Contact:

Re: [J1.0.10] Mambots fired on Modules

Post by PhilTaylor-Prazgod » Tue Jun 27, 2006 7:16 am

stingrey wrote: Short answer is that yes content mambots will now affect custom/new module content as of 1.0.10

It was deemed a shortfall that was addressed in previous versions of 1.0.x and fixed in 1.0.10
Thank you for the confirmation.  Now that I know I was not going crazy I can patch all my components as almost all of them are effected :-)

I think this is going to become a FAQ :-)
Phil Taylor - Full Time Joomla/PHP Security Expert
Blue Flame Digital Solutions Limited.
-- https://myJoomla.com/ Multi Award Winning Joomla Security & Auditing Service
-- https://www.phil-taylor.com/

User avatar
eyezberg
Joomla! Hero
Joomla! Hero
Posts: 2860
Joined: Thu Aug 25, 2005 5:48 pm
Location: Geneva mostly
Contact:

Re: [J1.0.10] Mambots fired on Modules

Post by eyezberg » Tue Jun 27, 2006 8:24 am

Phil, any pointers as to how to patch everything to get rid of this?
Sometimes one pays most for the things one gets for nothing.
The important thing is not to stop questioning. Curiosity has its own reason for existing. AE
http://joomla15.[URL banned].com for J! 1.5 screenshots
http://www.eyezberg.com

User avatar
PhilTaylor-Prazgod
Joomla! Ace
Joomla! Ace
Posts: 1155
Joined: Sat Aug 20, 2005 12:32 pm
Location: Weymouth, UK
Contact:

Re: [J1.0.10] Mambots fired on Modules

Post by PhilTaylor-Prazgod » Tue Jun 27, 2006 8:42 am

~Well according to the devs it doesnt need fixing as its meant to be that way :-)

However, I know my components do not need this "feature" so I have added a few lines of code in my mambot to check if the $row it is processing is a module or a content item.  There seems to be no easy way to guess which it is. Mambots process content's $row->text (Which is a join of introtext and fulltext), and content doesnt have the $row->content var when inside the mambot (Only modules send this into $row)

So based on this (loose) observation I have the following code at the right point (near the top of the bot's function) that simple returns if the $row->content is set or has a value (It appears to work, and the reports from customers confirm that this is a useable fix),

Code: Select all

if (@$row->content){
   return;
}
Phil Taylor - Full Time Joomla/PHP Security Expert
Blue Flame Digital Solutions Limited.
-- https://myJoomla.com/ Multi Award Winning Joomla Security & Auditing Service
-- https://www.phil-taylor.com/

User avatar
eyezberg
Joomla! Hero
Joomla! Hero
Posts: 2860
Joined: Thu Aug 25, 2005 5:48 pm
Location: Geneva mostly
Contact:

Re: [J1.0.10] Mambots fired on Modules

Post by eyezberg » Tue Jun 27, 2006 9:06 am

Thank you, will test on a few bots ;)
Sometimes one pays most for the things one gets for nothing.
The important thing is not to stop questioning. Curiosity has its own reason for existing. AE
http://joomla15.[URL banned].com for J! 1.5 screenshots
http://www.eyezberg.com

User avatar
Predator
Joomla! Ace
Joomla! Ace
Posts: 1827
Joined: Wed Aug 17, 2005 10:12 pm
Location: Germany-Bad Abbach
Contact:

Re: [J1.0.10] Mambots fired on Modules

Post by Predator » Tue Jun 27, 2006 1:46 pm

Thanks Phil,

easy and simple solution works without a prob ;)
The "Humor, Fun and Games" forum has  more than 2500 Posts, so why not build a "Humor, Fun and Games Working" Group?
.....
Malicious tongues say we have this WG right from the start, they call it core team :D

User avatar
eyezberg
Joomla! Hero
Joomla! Hero
Posts: 2860
Joined: Thu Aug 25, 2005 5:48 pm
Location: Geneva mostly
Contact:

Re: [J1.0.10] Mambots fired on Modules

Post by eyezberg » Tue Jun 27, 2006 8:29 pm

Phil,
just added that code to various bots: works GREAT!
Thanks a bunch.
Sometimes one pays most for the things one gets for nothing.
The important thing is not to stop questioning. Curiosity has its own reason for existing. AE
http://joomla15.[URL banned].com for J! 1.5 screenshots
http://www.eyezberg.com

User avatar
stingrey
Joomla! Hero
Joomla! Hero
Posts: 2756
Joined: Mon Aug 15, 2005 4:36 pm
Location: Marikina, Metro Manila, Philippines
Contact:

Re: [J1.0.10] Mambots fired on Modules

Post by stingrey » Wed Jun 28, 2006 2:38 pm

Will look to add a param to allow enabling/diabling of mambot parsing per custom/new module
Rey Gigataras
http://www.wizmediateam.com <-- great team of talented Web Designers and Programmers!
http://about.me/reygigataras <-- About Me :)
Partner, Business Development & Project Manager, Event Manager, Sports Coach :D

dealbro
Joomla! Apprentice
Joomla! Apprentice
Posts: 43
Joined: Fri Oct 28, 2005 2:04 am

Re: [J1.0.10] Mambots fired on Modules

Post by dealbro » Fri Jun 30, 2006 10:13 pm

Thank You for the solution.

BSB
PhilTaylor-Prazgod wrote: ~Well according to the devs it doesnt need fixing as its meant to be that way :-)

However, I know my components do not need this "feature" so I have added a few lines of code in my mambot to check if the $row it is processing is a module or a content item.  There seems to be no easy way to guess which it is. Mambots process content's $row->text (Which is a join of introtext and fulltext), and content doesnt have the $row->content var when inside the mambot (Only modules send this into $row)

So based on this (loose) observation I have the following code at the right point (near the top of the bot's function) that simple returns if the $row->content is set or has a value (It appears to work, and the reports from customers confirm that this is a useable fix),

Code: Select all

if (@$row->content){
   return;
}
PR6 Web Directory - http://www.mingleon.com/

User avatar
kai920
Joomla! Guru
Joomla! Guru
Posts: 542
Joined: Sun Sep 04, 2005 3:59 pm
Location: Hong Kong

Re: [TODO] Mambots fired on Modules

Post by kai920 » Mon Jul 03, 2006 3:36 pm

Thanks Phil, this worked great for the Google AdSense mambot.

cmeinck
Joomla! Intern
Joomla! Intern
Posts: 58
Joined: Tue Apr 04, 2006 10:58 pm

Re: [TODO] Mambots fired on Modules

Post by cmeinck » Tue Aug 15, 2006 7:21 pm

As an absolute non-coder, where in the mambot do I place this code? FWIW, I'm looking to edit ComboMax.

Thanks.

User avatar
kai920
Joomla! Guru
Joomla! Guru
Posts: 542
Joined: Sun Sep 04, 2005 3:59 pm
Location: Hong Kong

Re: [TODO] Mambots fired on Modules

Post by kai920 » Wed Aug 16, 2006 9:54 am

kai920 wrote: Thanks Phil, this worked great for the Google AdSense mambot.
Actually, if anyone is still reading this... I have a question... how do I stop this mambot from firing for components?

In my SMF logs I see a ton (and I mean A TON) of bot_adsense errors when users access the forums (com_smf).

friesengeist
Joomla! Guru
Joomla! Guru
Posts: 842
Joined: Sat Sep 10, 2005 10:31 pm

Re: [TODO] Mambots fired on Modules

Post by friesengeist » Wed Aug 16, 2006 12:53 pm

kai920 wrote: Actually, if anyone is still reading this... I have a question... how do I stop this mambot from firing for components?

In my SMF logs I see a ton (and I mean A TON) of bot_adsense errors when users access the forums (com_smf).
Content mambots are only fired for content items by Joomla!. If a content mambot is fired for com_smf, then this component does so itself.

Insert this into the mambot function to stop it from working when com_smf is called:

Code: Select all

global $option;
 if ($option == 'com_smf') {
     return;
 }
We may not be able to control the wind, but we can always adjust our sails

friesengeist
Joomla! Guru
Joomla! Guru
Posts: 842
Joined: Sat Sep 10, 2005 10:31 pm

Re: [TODO] Mambots fired on Modules

Post by friesengeist » Wed Aug 16, 2006 12:59 pm

cmeinck wrote: As an absolute non-coder, where in the mambot do I place this code? FWIW, I'm looking to edit ComboMax.
You need to put it into the mambot function. Usually, a mambot looks like this:
$_MAMBOTS->registerFunction( 'onAfterStart', 'botSomething' );
function botSomething() {
    [INSERT HERE]
    [OLD MAMBOT CODE HERE]
}
We may not be able to control the wind, but we can always adjust our sails

User avatar
PhilTaylor-Prazgod
Joomla! Ace
Joomla! Ace
Posts: 1155
Joined: Sat Aug 20, 2005 12:32 pm
Location: Weymouth, UK
Contact:

Re: [TODO] Mambots fired on Modules

Post by PhilTaylor-Prazgod » Wed Aug 16, 2006 1:06 pm

Content mambots are only fired for content items by Joomla!
Factually incorrect.

Content Mambots are fired on modules as well as content items since Joomla 1.0.10 (It was considered a bug that they did not fire on modules before this version so the developers "fixed" the bug and introduced this annoying "feature")
Phil Taylor - Full Time Joomla/PHP Security Expert
Blue Flame Digital Solutions Limited.
-- https://myJoomla.com/ Multi Award Winning Joomla Security & Auditing Service
-- https://www.phil-taylor.com/

friesengeist
Joomla! Guru
Joomla! Guru
Posts: 842
Joined: Sat Sep 10, 2005 10:31 pm

Re: [TODO] Mambots fired on Modules

Post by friesengeist » Wed Aug 16, 2006 1:11 pm

PhilTaylor-Prazgod wrote:
Content mambots are only fired for content items by Joomla!
Factually incorrect.

Content Mambots are fired on modules as well as content items since Joomla 1.0.10 (It was considered a bug that they did not fire on modules before this version so the developers "fixed" the bug and introduced this annoying "feature")
That's how soon one can forget about changes ;)
Phil, you are absolutely right
We may not be able to control the wind, but we can always adjust our sails

User avatar
kai920
Joomla! Guru
Joomla! Guru
Posts: 542
Joined: Sun Sep 04, 2005 3:59 pm
Location: Hong Kong

Re: [TODO] Mambots fired on Modules

Post by kai920 » Wed Aug 16, 2006 2:36 pm

$option = mosGetParam($_REQUEST, 'option');

global $option;

What are the differences between the above two lines?

User avatar
PhilTaylor-Prazgod
Joomla! Ace
Joomla! Ace
Posts: 1155
Joined: Sat Aug 20, 2005 12:32 pm
Location: Weymouth, UK
Contact:

Re: [TODO] Mambots fired on Modules

Post by PhilTaylor-Prazgod » Wed Aug 16, 2006 2:47 pm

kai920 wrote: $option = mosGetParam($_REQUEST, 'option');
This will read what the option equals in the URL
global $option;


This will read what the option equals in the global scope

(Note: the following are generic notes and not just about $option, they apply to all varibles passed by url and required in a script)

The url value and the global scope are probably going to be the same (as Joomla sets $option in the global scope), however if you are relying on getting the right value from the URL you should use the first one and not the second one.  It is also more secure as mosGetParam cleans the value,
Phil Taylor - Full Time Joomla/PHP Security Expert
Blue Flame Digital Solutions Limited.
-- https://myJoomla.com/ Multi Award Winning Joomla Security & Auditing Service
-- https://www.phil-taylor.com/

User avatar
stingrey
Joomla! Hero
Joomla! Hero
Posts: 2756
Joined: Mon Aug 15, 2005 4:36 pm
Location: Marikina, Metro Manila, Philippines
Contact:

Re: [TODO] Mambots fired on Modules

Post by stingrey » Fri Aug 18, 2006 8:48 pm

In 1.0.11 SVN there is now a new param for custom modules that will allow you to disable or enable mambots to act upon these content modules.
When creating new modules the default setting is to 'enable' mambot firing.

For existing custom mambots, the defailt is to 'disable' mambot firing.



Please note this issue should only affect 'custom/new' modules and not 3PD modules.
Rey Gigataras
http://www.wizmediateam.com <-- great team of talented Web Designers and Programmers!
http://about.me/reygigataras <-- About Me :)
Partner, Business Development & Project Manager, Event Manager, Sports Coach :D

averan
Joomla! Apprentice
Joomla! Apprentice
Posts: 48
Joined: Thu Nov 03, 2005 4:46 pm

not fixed??? Mambots fired on Modules

Post by averan » Fri Oct 27, 2006 7:21 pm

friesengeist wrote: $_MAMBOTS->registerFunction( 'onAfterStart', 'botSomething' );
function botSomething() {
    [INSERT HERE]
    [OLD MAMBOT CODE HERE]
}
this simply isn't working for me.  i'm having this issue with the ijoomla magazine component mambot: mos_magazine.php

its replacing text inside newsflash modules.  i followed your directions and inserted "if (@$row->content){ return;}" at the beginning of the function that is called out in registerFunction as well as tried it in other functions inside the bot, but with absolutely no effect whatsoever.

here's the beginning of the bot:

"$_MAMBOTS->registerFunction( 'onPrepareContent', 'botMagQuotes' );"

and here's the function being called out with Phil's conditional statement inserted:

"function botMagQuotes( $published, &$row, &$params, $page=0 ) {

if (@$row->content){
  return;
}

    global $_MAMBOTS, $my, $mosConfig_absolute_path,$mainframe,$database,$mosConfig_lang, $mosConfig_live_site;
    global $css_article_quote1,$css_article_quote2,$css_article_quote3,$Itemid,$_CONFIG;"


i should mention that i'm using Joomla 1.0.11.  i don't see any parameter options in the newsflash module to disable bots....i see the option for custom modules, but isn't newsflash a core module?  shouldn't it be set to disable bots by default??

anyone have any other ideas?  can i hack the newsflash module to ignore this specific bot?
Last edited by averan on Fri Oct 27, 2006 7:24 pm, edited 1 time in total.

redgsr
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sun Jan 07, 2007 6:06 am
Contact:

Re: [FIXED] Mambots fired on Modules

Post by redgsr » Sun Jan 07, 2007 6:13 am

Works fine for me after some tweaking

User avatar
ruigato
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 129
Joined: Sat Aug 20, 2005 4:12 pm
Location: Arouca - Portugal
Contact:

Re: [FIXED] Mambots fired on Modules

Post by ruigato » Sun Jul 01, 2007 2:31 am

sorry to come to this post again but i am having some hard times with the google adsense mambot.

I is something i realy need to one site, its a simple way to get some revenue, but unfortunately the bot is fired in some components that break with the google ad code inside.

Is there anyone willing to help on this?


Post Reply

Return to “Q&T 1.0.x Resolved - Archived”