Location: PHPKode > projects > Gemibloo > Gemibloo1_0_alpha1/index.php
<?php
	define('PHP_MINIMAL_VERSION', 5.0);
	/**
	*Check PHP version
	*
	* @author Olivier G <hide@address.com>
	* @version 1.0
	* @license http://opensource.org/licenses/gpl-license.php GNU Public License
	* @link http://gemibloo.fr
	*/
	function fCheckVersion(){
		if(FALSE === phpversion()){
		 	return 'Cannot check installed PHP version';
		 }
		if(floatval(phpversion() < PHP_MINIMAL_VERSION))
			return 'You are using a version of PHP that is not at least the minimal required version ('.PHP_MINIMAL_VERSION.').';
		else
			return TRUE;
	}//fCheckVersion
	/**
	*Check if all requested libraries are available
	*
	* @author Olivier G <hide@address.com>
	* @version 1.0
	* @license http://opensource.org/licenses/gpl-license.php GNU Public License
	* @link http://gemibloo.fr
	*/
	function fCheckLibraries(){
		$out = "";
		if(FALSE === function_exists('imap_open'))
		   $out.= 'Imap';
		if(FALSE === function_exists('mysql_connect'))
		   $out.= 'MySQL';
		if(FALSE === function_exists('exif_read_data'))
		   $out.= 'Exif';
		if(FALSE === function_exists('curl_init'))
		   $out.= 'Curl';
		 /*if(FALSE === function_exists('iterator_count'))
		   $out.= 'SPL';*/	   
		
		if(empty($out))
			return TRUE;
		else
			return 'One or several required PHP libraries are missing ('.$out.').';
	}//fCheckLibraries
	/**
	*Set write access right to a few files and folders
	*
	* @author Olivier G <hide@address.com>
	* @version 1.0
	* @license http://opensource.org/licenses/gpl-license.php GNU Public License
	* @link http://gemibloo.fr
	*/
	function fChangeFileRights(){
		$files = array(
			'_index.php',
			'index.php',
			'./data',
			'./data/cache',
			'./log'
		);
		//Loop through all files to set write right
		foreach($files as $file){
			if(FALSE === file_exists($file))
				return 'Missing file ('.$file.')';
			if(FALSE === chmod($file,0705))
				return 'File rights cannot be changed ('.$file.')';		
		}
		return TRUE;
	}//fChangeFileRights
	
	//Main code
	if( (TRUE !== ($status = fCheckVersion())) 
		|| (TRUE !== ($status = fCheckLibraries()))
		|| (TRUE !== ($status = fChangeFileRights()))){
			echo $status.' As a consequence Gemibloo cannot be installed. Sorry :(';	
	 }else
		header('Location:install.php');
?>
Return current item: Gemibloo