Location: PHPKode > projects > Gemibloo > Gemibloo1_0_alpha1/install.php
<?php
/**
	* Gemibloo installer
	*
	* Is called only once because rename files
	*
	* @author Olivier G <hide@address.com>
	* @version 1.0
	* @license http://opensource.org/licenses/gpl-license.php GNU Public License
	* @link http://gemibloo.fr
	*/
	require_once(dirname(__FILE__)."/application/core/lib/class.Fireeagle.php");
	require_once(dirname(__FILE__)."/application/core/class/class.PluginLoader.php");

	ini_set('error_reporting', E_NONE);

	define('GEMIBLOO_VERSION', '1_0_alpha1');
	define('PARAM_FILENAME', '/param/parameters');
	define('TAG', '%%');
	define ('SQL_REQUEST_1', 'DROP TABLE IF EXISTS `Gemibloo_main_'.GEMIBLOO_VERSION.'`;');
	define('SQL_REQUEST_2', 'CREATE TABLE IF NOT EXISTS `Gemibloo_main_'.GEMIBLOO_VERSION."` (`id` int(10) unsigned NOT NULL auto_increment, `lat` float(10,5) NOT NULL, `lng` float(10,5) NOT NULL,`content` varchar(255) character set utf8 collate utf8_bin NOT NULL, `timestamp` int(11) NOT NULL, `image` tinytext character set utf8 collate utf8_bin NOT NULL, `ratioHW` float(4,2) NOT NULL, `location` varchar(255) character set utf8 collate utf8_bin NOT NULL, `seen` int(10) unsigned NOT NULL default '0',  PRIMARY KEY  (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
	define('GEMIBLOO_WEBSITE', 'http://www.gemibloo.fr/');
	define('REGISTRATION_URL', GEMIBLOO_WEBSITE.'register/index.php5');
	define('GEMIBLOO_URL', substr($_SERVER['HTTP_REFERER'],0,strrpos($_SERVER['HTTP_REFERER'], '/')+1));

	/**
	*Check if can connect to the MySQL database with provided parameters
	*/	
	function fCheckDatabase(){
		if(FALSE === ($link = mysql_connect($_POST['DB_SERVER'], $_POST['DB_USR'], $_POST['DB_PWD']))){
			echo 'KO: cannot connect to MySQL server';exit;}
		if(FALSE === ($db = mysql_select_db($_POST['DB_DATABASE'], $link))){
			echo 'KO: cannot select MySQL database';mysql_close($link);exit;}
		if(FALSE === ($tables = mysql_query("SHOW TABLES FROM ".$_POST['DB_DATABASE'], $link))){
			echo 'KO: cannot retrieve tables';mysql_close($link);exit;}
		$warning = '';
		while ($row = mysql_fetch_row($tables)) {
			if(0 == strcasecmp('gemibloo_main_'.GEMIBLOO_VERSION, $row[0])){
				$warning = ' but Gemibloo v'.GEMIBLOO_VERSION.'  seem already installed. You are going to loose all your data...';
				break;
			}
		}
		mysql_free_result($tables);
		if(FALSE === ($version = mysql_get_server_info($link)))
			echo 'OK '.$warning;
		else
			echo 'OK with this database v'.$version.$warning;
		mysql_close($link);
	}//fGetDatabases

	/**
	*Check if can connect to the mailbox with provided parameters
	*/		
	function fCheckMailbox(){
		if(FALSE === ($mbox = imap_open($_POST['EMAIL_SERVER'], $_POST['EMAIL_USR'], $_POST['EMAIL_PWD'], OP_HALFOPEN))){
			echo 'KO: cannot connect to server';exit;}
		$status = imap_status($mbox, $_POST['EMAIL_SERVER'].'INBOX', SA_ALL);
		if (!$status)
			echo 'KO: cannot get mailbox status';
		else
			echo 'OK with '.imap_check($mbox)->Mailbox;
		imap_close($mbox);
	}//fCheckMailbox

	/**
	*Check if can connect to the Twitter account
	*/		
	function fCheckTwitter(){
		if(FALSE === ($curl_handle = curl_init())){
				echo 'KO: cannot initialize connection';exit;}
		curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 20);
		curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
		curl_setopt($curl_handle, CURLOPT_USERPWD, $_POST['TWITTER_USR'].':'.$_POST['TWITTER_PWD']);
		curl_setopt($curl_handle, CURLOPT_URL, 'http://twitter.com/account/verify_credentials.json');
		if(FALSE === ($result = curl_exec($curl_handle))){
				echo 'KO: cannot execute request';curl_close($curl_handle);exit;}
		$responseInfo = curl_getinfo($curl_handle); 
		if(200 != intval($responseInfo['http_code']))
			echo 'KO: unknown Twitter account or wrong password';
		else{
			$result = json_decode($result);
			echo "<img src='".$result->profile_image_url."'/>OK";
		}
		curl_close($curl_handle);
	}//fCheckTwitter

	/**
	*Check if can connect to the Fireeagle user account
	*/			
	function fCheckFireeagle(){
		try{
			$fe = new FireEagle($_POST['FIREEAGLE_APP_TOKEN'], $_POST['FIREEAGLE_APP_SECRET'], $_POST['FIREEAGLE_USER_TOKEN'], $_POST['FIREEAGLE_USER_SECRET']);
			$loc = $fe->user();
		}catch(Exception $e){echo 'KO: wrong parameters';exit;}
		echo 'OK ';
	}//fCheckFireeagle
	
	/**
	*Create Gemibloo tables in the target database
	*/		
	function fCreateDBTables(){
		if(FALSE === ($link = mysql_connect($_POST['DB_SERVER'], $_POST['DB_USR'], $_POST['DB_PWD'])))
			return 'KO: cannot connect to MySQL server';
		if(FALSE === mysql_select_db($_POST['DB_DATABASE'], $link)){
			mysql_close($link);return 'KO: cannot select MySQL database';}
		if(FALSE === mysql_query(SQL_REQUEST_1, $link)){
			return 'KO: cannot execute SQL request 1: '.mysql_error();}
		if(FALSE === mysql_query(SQL_REQUEST_2, $link)){
			mysql_close($link);return 'KO: cannot execute SQL request 2: '.mysql_error();}
		mysql_close($link);
		return 'OK';
	}//fCreateDBTables

	/**
	*Create Gemibloo parameters file with provided parameters
	*/		
	function fCreateParamFile(){

		$filename = dirname(__FILE__).PARAM_FILENAME.'.php';
		//Load core parameter template file
		$coreParamFullPath = dirname(__FILE__).'/param/core.param';
		if( FALSE === ($handle = fopen($coreParamFullPath, 'r')))
			return  'KO: cannot open core parameter template file';
		if( FALSE === ($contents = fread($handle, filesize($coreParamFullPath)))){
			fclose($handle); return 'KO: cannot read core parameter template file';}
		fclose($handle);

		//Load all plugin parameter files
		$import = new PluginLoader(IMPORT_PLUGINS_DIR);
		if( FALSE === $import->fGetParametersTemplateFile(&$contents))
			return 'KO: cannot load import plugin parameter file.';
		$export = new PluginLoader(EXPORT_PLUGINS_DIR);
		if( FALSE === $export->fGetParametersTemplateFile(&$contents))
			return 'KO: cannot load export plugin parameter file.';

		//Extract all tags from the stream
		echo "BEFORE:$contents";
		if( FALSE === preg_match_all('#'.TAG.'(.*?)'.TAG.'#', $contents, $matches)){
			fclose($handle); return 'KO: cannot find tags in template file';}
		//Loops through tags and replace them by the value of the variable with same name
		echo "\n\nDUMP:";
		foreach($matches[1] as $match){
			if('GEOBLOG_URL' == $match)
				$contents = str_replace(TAG.$match.TAG, GEMIBLOO_URL, $contents);
			else
				$contents = str_replace(TAG.$match.TAG, $_POST[$match], $contents);
		}
		$contents = "<?php\n".$contents."\n?>";

		if( FALSE === ($handle = fopen($filename, 'w')))
			return 'KO: cannot open parameters file';
		if( FALSE === fwrite($handle, $contents))
			return 'KO: cannot write parameters file';
		fclose($handle);
		chmod($filename, 0404);

		//Renames index and current script
		if(FALSE === rename ("index.php", "index.old" ))
			return 'KO: cannnot rename file';
		if(FALSE === rename("_index.php", "index.php" ))
			return 'KO: cannnot rename file';
		chmod("index.php", 0404);
		
		if( 2 != intval($_POST['REGISTRATION_MODE'])){//register with gemibloo website only if public or private
			$session = curl_init(REGISTRATION_URL);
			curl_setopt($session, CURLOPT_CONNECTTIMEOUT, 10);
			curl_setopt($session, CURLOPT_TIMEOUT, 10);
			curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
			curl_setopt($session, CURLOPT_HEADER, false);
			curl_setopt($session, CURLOPT_POST, true);
			//curl_setopt($session, CURLOPT_PROXY, 'TODO:8080');
			curl_setopt($session, CURLOPT_POSTFIELDS, array('name' => GEMIBLOO_URL, 'version' => GEMIBLOO_VERSION, 'is_public' => ((0==$registration_mode)?'true':'false')));
			curl_exec($session);
			curl_close($session);
		}//if
		return 'OK';
	}//fCreateParamFile

	/**
	*Save parameters and ask FireEagle send user to FE authentification page.
	*/	
	function fGetFireEagleAuthorizeURL(){
		$_SESSION['data'] = $_POST;
		$fe = new FireEagle($_POST['FIREEAGLE_APP_TOKEN'], $_POST['FIREEAGLE_APP_SECRET']);
		$tok = $fe->getRequestToken();
		if (!isset($tok['oauth_token'])
		    || !is_string($tok['oauth_token'])
		    || !isset($tok['oauth_token_secret'])
		    || !is_string($tok['oauth_token_secret'])) {
			echo "ERROR! FireEagle::getRequestToken() returned an invalid response.  Giving up.";
			exit;
		}
		$_SESSION['request_token'] = $tok['oauth_token'];
		$_SESSION['request_secret'] = $tok['oauth_token_secret'];
		header("Location: ".$fe->getAuthorizeURL($_SESSION['request_token']));
	}//fGetFireEagleAuthorizeURL

	/**
	*Retrieve user credential. This fonction is the real callback for Fire Eagle
	*/		
	function fGetFireEagleUserCredentials(){
		if ($_GET['oauth_token'] != $_SESSION['request_token'])
			return false;
		$fe = new FireEagle($_SESSION['data']['FIREEAGLE_APP_TOKEN'], $_SESSION['data']['FIREEAGLE_APP_SECRET'], $_SESSION['request_token'], $_SESSION['request_secret']);
		$tok = $fe->getAccessToken();
		if (!isset($tok['oauth_token']) || !is_string($tok['oauth_token']) || !isset($tok['oauth_token_secret']) || !is_string($tok['oauth_token_secret']))
			return false;
		$_SESSION['data']['FIREEAGLE_USER_TOKEN'] = $tok['oauth_token'];
		$_SESSION['data']['FIREEAGLE_USER_SECRET'] = $tok['oauth_token_secret'];
	}//fGetFireEagleUserCredentials

	/**
	*Main function: 
	*
	*/	
	function fMain(){
		ob_start();
		session_start();
		if( isset($_POST['operation']))
			$operation = $_POST['operation'];
		elseif(isset($_GET['operation']))
			$operation = $_GET['operation'];
		else
			$operation = NULL;
		if(!empty($operation)){
			//Web service
			switch(intval($operation)){
				case 1: fCheckDatabase();exit;
				case 2: fCheckMailbox();exit;
				case 3: fCheckTwitter();exit;
				case 4: fCheckFireeagle();exit;
				case 5: 
					if('OK' != ($msg = fCreateDBTables()))
						break;
					if('OK' != ($msg = fCreateParamFile()))
						break;
					unset($msg);
					//At this stage, index is no more this file but the font-office of Gemibloo (see rename in fCreateParamFile).
					header('Location: index.php?first=true');
					break;
				case 6: fGetFireEagleAuthorizeURL();exit;
				case 7: fGetFireEagleUserCredentials();break;//callback function for Fire Eagle
				default://nothing
			}//switch
		}//if
?>
<!--------------------------------------------------------------------------------------------------------------------->
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title>Gemibloo v<?php echo GEMIBLOO_VERSION; ?> - Installer</title>
		<meta name="robots" content="noindex, nofollow"/>
		<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
		<meta http-equiv="description" content="Gemibloo - Installer"/>
		<meta http-equiv="content-language" content="en"/>
		<link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
		<link href="front/css/install.css" rel="stylesheet" type="text/css"/>
	</head>
	<body>
		<div id="logo"><img src="front/images/logo_gemibloo.png" width="83" height="138"/></div>
		<h1>Gemibloo v<?php echo GEMIBLOO_VERSION; ?>: Installer</h1>
		<?php 
			if(isset($msg)) 
				echo "<p class='failure'>".$msg."</p>";
		?>
		<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
			<input type="hidden" name="operation" id="operation" value=""/>
			<input type="hidden" name="GEMIBLOO_VERSION" value="<?php echo GEMIBLOO_VERSION;?>"/>
		<table>
			<tr>
				<td colspan="2" class="nota">This installer page is displayed only once. Afterwards, it will be replaced  automatically by the Gemibloo front-office.</td>
			</tr>
			<tr>
				<td colspan="2" class="section"><hr/># Core #<hr/></td>
			</tr>
			<tr>
				<td colspan="2" class="title"><img src="front/images/mysql_logo.png" width="113" height="59" alt="MySQL_logo" style="vertical-align:text-bottom"> Database</td>
			</tr>
			<tr>
				<td colspan="2"  class="nota">All blog entries are stored in the MySQL database provided in this section.</td>
			</tr>
			<tr>
				<td class="label">Server <span class='nota'>(format: host[:port])</span>:</td>
				<td class="edit"><input type="text" name="DB_SERVER" id="DB_SERVER" class="input1" size="40" value="<?php if(isset($_SESSION['data']['DB_SERVER'])) echo $_SESSION['data']['DB_SERVER']; ?>" onchange="javascript:fProcessChange(1);"/></td>
			</tr>
			<tr>
				<td class="label">Username:</td>
				<td class="edit"><input type="text" name="DB_USR" id="DB_USR" class="input1" size="40" value="<?php if(isset($_SESSION['data']['DB_USR'])) echo $_SESSION['data']['DB_USR']; ?>"onchange="javascript:fProcessChange(1);"/></td>
			</tr>
			<tr>
				<td class="label">Password:</td>
				<td class="edit"><input type="text" name="DB_PWD" id="DB_PWD" class="input1" size="40" value="<?php if(isset($_SESSION['data']['DB_PWD'])) echo $_SESSION['data']['DB_PWD']; ?>"onchange="javascript:fProcessChange(1);"/></td>
			</tr>
			<tr>
				<td class="label">Database:</td>
				<td class="edit"><input type="text" name="DB_DATABASE" id="DB_DATABASE" class="input1" size="40" value="<?php if(isset($_SESSION['data']['DB_DATABASE'])) echo $_SESSION['data']['DB_DATABASE']; ?>" onchange="javascript:fProcessChange(1);"/></td>
			</tr>
			<tr>
				<td class="right"><input type="button" value="Check database connection" onclick="javascript:fProcessCheck(1);"/></td>
				<td class="result" id="ope1_result"></td>
			</tr>
			<tr>
				<td colspan="2"  class="title"><img src="front/images/maps_logo.jpg" width="60" height="31" alt="Maps_logo" style="vertical-align:text-bottom"> Maps</td>
			</tr>
			<tr>
				<td colspan="2"  class="nota">All entries are displayed on maps. You must sign-up for a provider API to get your key.</td>
			</tr>
			<tr>
				<td class="label">Maps provider:</td>
				<td class="edit">
					<input type="radio" name="MAPS_PROVIDER" value="google" checked="checked"/>Google <a class="external" href="http://code.google.com/apis/maps/signup.html"  onclick='window.open(this.href); return false;'>sign-up</a>
					<br/><input type="radio" name="MAPS_PROVIDER" value="openstreetmap"/>OpenStreetMap <a class="external" href="http://code.google.com/apis/maps/signup.html"  onclick='window.open(this.href); return false;'>sign-up</a>					
					<!--<br/><input type="radio" name="MAPS_PROVIDER" value="yahoo"/>Yahoo <a class="external" href="http://developer.yahoo.com/maps/"  onclick='window.open(this.href); return false;'>sign-up</a>
					<br/><input type="radio" name="MAPS_PROVIDER" value="viamichelin"/>Via Michelin <a class="external" href="http://dev.viamichelin.com/wswebsite/gbr/dyn/controller/ApiRegister"  onclick='window.open(this.href); return false;'>sign-up</a>-->
				</td>
			</tr>
			<tr>
				<td class="label">API key:</td>
				<td class="edit"><input type="text" name="MAPS_API_KEY" id="MAPS_API_KEY" size="40" value="<?php if(isset($_SESSION['data']['MAPS_API_KEY'])) echo $_SESSION['data']['MAPS_API_KEY']; ?>"/></td>
			</tr>
			<tr>
				<td colspan="2"  class="title">Miscellaneous</td>
			</tr>
			<tr>
				<td class="label">Number of entries displayed:</td>
				<td class="edit"><input type="text" name="MAX_ENTRIES" value="8" id="MAX_ENTRIES" size="40" value="<?php if(isset($_SESSION['data']['MAX_ENTRIES'])) echo $_SESSION['data']['MAX_ENTRIES']; ?>"/></td>
			</tr>
			<tr>
				<td class="label">Delay between mailbox check (in sec):</td>
				<td class="edit"><input type="text" name="VALIDITY_DELAY" value="300" id="VALIDITY_DELAY" size="40" value="<?php if(isset($_SESSION['data']['VALIDITY_DELAY'])) echo $_SESSION['data']['VALIDITY_DELAY']; ?>"/></td>
			</tr>
			<tr>
				<td colspan="2"  class="nota">You can register your Gemibloo based blog with Gemibloo <a class="external" href="<?php echo GEMIBLOO_WEBSITE;?>" onclick='window.open(this.href); return false;'>website</a> in order to be either publicly listed (coming project) or privately listed (used only by the Gemibloo team for internal purpose).</td>
			</tr>
			<tr>
				<td class="label">Registration mode:</td>
				<td class="edit">
					<input type="radio" name="REGISTRATION_MODE" value="0" checked="checked"/>Public
					<br/><input type="radio" name="REGISTRATION_MODE" value="1"/>Private
					<br/><input type="radio" name="REGISTRATION_MODE" value="2"/>None
				</td>
			</tr>
			<tr>
				<td colspan="2" class="section"><hr/># Import plugins #<hr/></td>
			</tr>
			<tr>
				<td colspan="2"  class="title"><input type="checkbox" id="chkbx2" name="MAILBOX_EXTENSION" 
					<?php 
						if(isset($_SESSION['data']['MAILBOX_EXTENSION']))
							 echo "checked = 'checked' "; 
					?> 
					onchange="javascript:fToggleParam(2);"/>&nbsp;Import plugin: <img src="front/images/mailbox_logo.png" width="31" height="30" alt="Mailbox_logo" style="vertical-align:text-bottom"> Mailbox</td>
			</tr>
			<tr>
				<td colspan="2"  class="nota">Gemibloo is feed by messages found in a dedicated mailbox provided in this section.<span class='bold red'>This mailbox should be used only by Gemibloo.</span></td>
			</tr>
			<tr>
				<td class="label">Server  <span class='nota'>(format: {host[:port][/options]} )</span>:<br/><span class='nota'>Exemple: {imap.gmail.com:993/imap/ssl}</span></td>
				<td class="edit"><input type="text" name="EMAIL_SERVER" id="EMAIL_SERVER" disabled="disabled" class="input2" size="40" value="<?php if(isset($_SESSION['data']['EMAIL_SERVER'])) echo $_SESSION['data']['EMAIL_SERVER']; ?>" onchange="javascript:fProcessChange(2);fCheckMailboxServerStructure();"/></td>
			</tr>
			<tr>
				<td class="label">Username:<br/><span class='nota'>Exemple: hide@address.com</span></td>
				<td class="edit"><input type="text" name="EMAIL_USR" id="EMAIL_USR" disabled="disabled" class="input2" size="40" value="<?php if(isset($_SESSION['data']['EMAIL_USR'])) echo $_SESSION['data']['EMAIL_USR']; ?>" onchange="javascript:fProcessChange(2);"/></td>
			</tr>
			<tr>
				<td class="label">Password:</td>
				<td class="edit"><input type="text" name="EMAIL_PWD" id="EMAIL_PWD" disabled="disabled" class="input2" size="40" value="<?php if(isset($_SESSION['data']['EMAIL_PWD'])) echo $_SESSION['data']['EMAIL_PWD']; ?>" onchange="javascript:fProcessChange(2);"/></td>
			</tr>
			<tr>
				<td class="right"><input type="button" value="Check mailbox connection" onclick="javascript:fProcessCheck(2);"/></td>
				<td class="result" id="ope2_result"></td>
			</tr>
			<tr>
				<td colspan="2" class="section"><hr/># Export plugins #<hr/></td>
			</tr>
			<tr>
				<td colspan="2"  class="title"><input type="checkbox" id="chkbx3" name="TWITTER_EXTENSION" 
					<?php 
						if(isset($_SESSION['data']['TWITTER_EXTENSION']))
							 echo "checked = 'checked' "; 
					?> 
					onchange="javascript:fToggleParam(3);"/>&nbsp;Export plugin: <a class="external" href="http://twitter.com/" title="Twitter" onclick="window.open(this.href); return false;"><img src="front/images/twitter_logo.png" width="125" height="29" alt="Twitter_logo" style="vertical-align:text-bottom"></a></td>
			</tr>
			<tr>
				<td colspan="2"  class="nota">Gemibloo can automatically update your status on Twitter service if you want it to. You must already have a user <a class="external" href="https://twitter.com/signup" onclick='window.open(this.href); return false;'>account</a>.</td>
			</tr>
			<tr>
				<td class="label">Username:</td>
				<td class="edit"><input type="text" name="TWITTER_USR" id="TWITTER_USR" size="40" class="input3" disabled="disabled" value="<?php if(isset($_SESSION['data']['TWITTER_USR'])) echo $_SESSION['data']['TWITTER_USR']; ?>" onchange="javascript:fProcessChange(3);"/></td>
			</tr>
			<tr>
				<td class="label">Password:</td>
				<td class="edit"><input type="text" name="TWITTER_PWD" id="TWITTER_PWD" size="40" class="input3" disabled="disabled" value="<?php if(isset($_SESSION['data']['TWITTER_PWD'])) echo $_SESSION['data']['TWITTER_PWD']; ?>" onchange="javascript:fProcessChange(3);"/></td>
			</tr>
			<tr>
				<td class="right"><input type="button" value="Check Twitter connection" onclick="javascript:fProcessCheck(3);"/></td>
				<td class="result" id="ope3_result"></td>
			</tr>
			<tr>
				<td colspan="2"  class="title"><hr/><input type="checkbox"  id="chkbx4" name="FIREEAGLE_EXTENSION" 
					<?php 
						if(isset($_SESSION['data']['FIREEAGLE_EXTENSION']))
							 echo "checked='checked' "; 
					?> 
					onchange="javascript:fToggleParam(4);"/>&nbsp;Export plugin: <a class="external" href="http://fireeagle.yahoo.net/" title="Fire Eagle_logo" onclick="window.open(this.href); return false;"><img src="front/images/fireeagle_logo.png" width="125" height="27" alt="Fire Eagle" style="vertical-align:text-bottom"></a></td>
			<tr>
			<tr>
				<td colspan="2"  class="nota">Gemibloo can automatically update your status on FireEagle service if you want it to. You must already have a user <a class="external" href="http://fireeagle.yahoo.net/" onclick='window.open(this.href); return false;'>account</a>.</td>
			</tr>
			<tr>
				<td colspan="2" class="nota">'Gemibloo on your server' as a whole is an application you need to register <a class="external" href="https://fireeagle.yahoo.net/developer/create"  onclick='window.open(this.href); return false;'>here</a> with access authorization set to <span class='bold'>Both accessing and updating</span>, authentification mode set to <span class='bold'>Auth for web-based services</span> and callbak URL set to <span class='bold red'>http://<?php echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>?operation=7</span>. Then you can pick up a Consumer Key and a Consumer Secret you must copy &amp; paste below.</td>
			</tr>
			<tr>
				<td class="label">Consumer token:</td>
				<td class="edit"><input type="text" name="FIREEAGLE_APP_TOKEN" id="FIREEAGLE_APP_TOKEN" size="40" class="input4" disabled="disabled" value="<?php if(isset($_SESSION['data']['FIREEAGLE_APP_TOKEN'])) echo $_SESSION['data']['FIREEAGLE_APP_TOKEN']; ?>" onchange="javascript:fProcessChange(4);"/></td>
			</tr>
			<tr>
				<td class="label">Consumer secret:</td>
				<td class="edit"><input type="text" name="FIREEAGLE_APP_SECRET" id="FIREEAGLE_APP_SECRET" size="40" class="input4" disabled="disabled" value="<?php if(isset($_SESSION['data']['FIREEAGLE_APP_SECRET'])) echo $_SESSION['data']['FIREEAGLE_APP_SECRET']; ?>" onchange="javascript:fProcessChange(4);"//></td>
			</tr>
			<tr>
				<td colspan="2" class="nota">If you want to understand how 'Auth for Web Apps' works you can read this <a class="external" href="https://fireeagle.yahoo.net/developer/documentation/web_auth"  onclick='window.open(this.href); return false;'>page</a>.<br/>
				Click <a href="javascript:fGetFECredentials();">here</a> to automatically get  your user credentials. You are redirected first on Fire Eagle authentification page then you come back on the Gemibloo installer page (all your data are stored in between).
				</td>
			</tr>
			<tr>
				<td class="label">User token:</td>
				<td class="edit"><input type="text" name="FIREEAGLE_USER_TOKEN" id="FIREEAGLE_USER_TOKEN" size="40" class="input4" disabled="disabled" value="<?php if(isset($_SESSION['data']['FIREEAGLE_USER_TOKEN'])) echo $_SESSION['data']['FIREEAGLE_USER_TOKEN']; ?>" onchange="javascript:fProcessChange(4);"//></td>
			</tr>
			<tr>
				<td class="label">User secret:</td>
				<td class="edit"><input type="text" name="FIREEAGLE_USER_SECRET" id="FIREEAGLE_USER_SECRET" size="40" class="input4" disabled="disabled"  value="<?php if(isset($_SESSION['data']['FIREEAGLE_USER_SECRET'])) echo $_SESSION['data']['FIREEAGLE_USER_SECRET']; ?>" onchange="javascript:fProcessChange(4);"//></td>
			</tr>
			<tr>
				<td class="right"><input type="button" value="Check FireEagle connection"  onclick="javascript:fProcessCheck(4);"/></td>
				<td class="result" id="ope4_result"></td>
			</tr>
			<tr>
				<td colspan=2 id="validation_cell"><hr/><br/><input type="button" id="validation_btn" value="Install Gemibloo"  onclick="javascript:fCheckAllTextFields();"/></td>
			</tr>
		</table>
		</form>
		<br/>
		<a class="external" href="<?php echo GEMIBLOO_WEBSITE;?>" onclick="window.open(this.href); return false;" title="Gemibloo website"><img src="front/images/powered_by.png" alt="Powered by Gemibloo" width="80" height="15"/></a>
		<script type="text/javascript" src="front/js/jquery-1.2.6.min.js"></script>
		<script type="text/javascript" src="front/js/install.js"></script>
	</body>
</html>
<!--------------------------------------------------------------------------------------------------------------------->
<?php
	}//fMain

	fMain();
?>
Return current item: Gemibloo