web/common.php
author Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
Tue, 26 Apr 2011 13:57:29 +0200
changeset 122 4c3a15877f80
parent 119 4c86151704e9
child 143 2a3599a4b0f7
permissions -rwxr-xr-x
clean php and python scripts

<?php

/**
 * If you haven't edited php.ini to add the Zend Framework and the
 * Zend Framework Incubator to the PHP include_path, then do so here.
 * Don't use mine!
 */
set_include_path(
    'lib'
    . PATH_SEPARATOR . get_include_path()
);


include_once dirname(__FILE__).'/traduction.php';


/**
 * Make sure Zend_Oauth's Consumer is loaded
 */
require_once dirname(__FILE__).'/lib/Zend/Oauth/Consumer.php';

/** Zend_Locale */
require_once dirname(__FILE__).'/lib/Zend/Locale.php';
 
/** Zend_Translate_Adapter */
require_once dirname(__FILE__).'/lib/Zend/Translate/Adapter.php';

/**
 * Start up the ol' session engine
 */
session_start();

/**
 * Include the configuration data for our OAuth Client (array $configuration)
 */
include_once dirname(__FILE__).'/config.php';

/**
 * Setup an instance of the Consumer for use
 */
$consumer = new Zend_Oauth_Consumer($configuration);

/**
 * TRADUCTION
**/


Zend_Loader::loadClass('Zend_Translate'); 
Zend_Loader::loadClass('Zend_Http_Cookie'); 


$client = new Zend_Http_Client();
$translate = new Zend_Translate('array', $init, 'fr');

$translate->addTranslation($english, 'en');
$translate->addTranslation($japan, 'ja_JP');
$translate->addTranslation($french, 'fr');

$actual = $translate->getLocale();

//$translate->setLocale("en");
// $acceptCookie = $this->_request->getCookie('acceptCookie',0);

if(isset($_GET['lang'])==false and isset($_SESSION['lang'])==false){
	
	if($actual!='fr' and $actual!='en' and $actual!='ja_JP'){
		$translate->setLocale("fr");
		 $_SESSION['lang']="fr";
	}
	
} else if (isset($_GET['lang'])==true){
	$translate->setLocale($_GET['lang']);
    $_SESSION['lang'] = $_GET['lang'];
    $actual = $_SESSION['lang'];

} else if (isset($_SESSION['lang'])==true){
	$translate->setLocale( $_SESSION['lang']);
    $actual = $_SESSION['lang'];
	
}