Open Classifieds 1.6.2 released

I know it’s just 4 days since last release.

But today we found a bug, that made display always the mobile theme to the IE browsers….big mistake my apologies.

Also please see that our reaction against a bug (even if it’s not a security one) it’s pretty fast, we want this software to be reliable.

I’ve made just 2 changes more:

V 1.6.2
Bug in themes.php, displayed mobile theme to IE browsers
To install don’t require curl
Compressed pages to browser that support it, using ob_gzhandler

To upgrade from 1.6.1 you can simply dowload 1.6.2 and replace the files themes.php and functions.php from the /includes path

Once more sorry for any inconvenience :(

from Open Classifieds blog

Compress HTML before sending to the browser

Hany function ob_gzhandler that help facilitate sending gz-encoded data to web browsers that support compressed web pages.

This is the way I do it, checking the extension it’s loaded and that it’s possible to start the encoding:

if (extension_loaded('zlib')) {//check extension is loaded
    if(!ob_start("ob_gzhandler")) ob_start();//start HTML compression, if not normal buffer input mode
}

Open Classifieds 1.6.1 released

New release!

There’s plenty of new things and improvements, please update to the newest version.

Download Open Classifieds 1.6.1

Release notes: Continue reading ‘Open Classifieds 1.6.1 released’ »

Detect file extension in PHP

Super easy trick to find a file extension:

$file="some_file.jpg";
$ext=end(explode(".", $file);

Other ways:

Substring:

$ext = substr($file, strrpos($file, '.') + 1);

Using path info:

$info = pathinfo($file);
$ext=$info['extenstion'];

Function to check if visitor is a bot

This function will check whether the visitor is a search engine robot

function is_bot(){
	$botlist = array("Teoma", "alexa", "froogle", "Gigabot", "inktomi",
	"looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory",
	"Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot",
	"crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp",
	"msnbot", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz",
	"Baiduspider", "Feedfetcher-Google", "TechnoratiSnoop", "Rankivabot",
	"Mediapartners-Google", "Sogou web spider", "WebAlta Crawler","TweetmemeBot",
	"Butterfly","Twitturls","Me.dium","Twiceler");
 
	foreach($botlist as $bot){
		if(strpos($_SERVER['HTTP_USER_AGENT'],$bot)!==false)
		return true;	// Is a bot
	}
 
	return false;	// Not a bot
}

There’s any other better way?

Follow me