Article 2BXVS CodeSOD: Clean Up Your Act

CodeSOD: Clean Up Your Act

by
Ellis Morning
from The Daily WTF on (#2BXVS)

Censored2.jpg

Artie S. writes:

As part of a contract with a customer, we have to maintain some of their legacy applications. I found this today in a custom controller for a very old OpenCart site and am still laughing about it and thought you guys might enjoy it. I suppose it's NSFW, but it's code, right?

I threw in some blocks ( a- ) to make things safer for work. The other symbols (!, @) are part of the original sub.

public function isClean($body) { $bad_words = array('sha-t','sha-tty','sha-ttiest','sh!t','sh!tty','sh!ttiest','fa-ck','fa-cking','fa-cked','fa-cker','cunt','piss','pissed','crap','crappy','crappier','crappiest','cr@p','cr@ppy','cr@ppier','cr@ppiest','cock','tits','titties'); for($i=0;$i<count($bad_words);$i++) { $pos = strpos($body, $bad_words[$i]); if($pos!==false) { return false; } } return true; }
puppetlabs50.png[Advertisement] Manage IT infrastructure as code across all environments with Puppet. Puppet Enterprise now offers more control and insight, with role-based access control, activity logging and all-new Puppet Apps. Start your free trial today! TheDailyWtf?d=yIl2AUoC8zAq0KfGu1vUdA
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments