PHP Error Undefined index: HTTP_ACCEPT_LANGUAGE /home/ledelas/ecommerce/protected/config/main.php(19) 07 // CWebApplication properties can be configured here. 08 09 function getLanguages() { 10 return array('fr'=>"français",'en'=>"english"); 11 } 12 13 function getLang() { 14 if (isset($_GET['lang'])) { 15 $lang=$_GET['lang']; 16 } else if ( $_SERVER['HTTP_HOST'] == "ledelas.com" || $_SERVER['HTTP_HOST'] == "www.ledelas.com" ) { 17 $lang= "en"; 18 } else { 19 $lang=substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2); 20 //$lang='fr'; for test 21 } 22 if ($lang != 'fr')$lang='en'; 23 return $lang; 24 } 25 26 function checkAdmin() { 27 if ( isset($_COOKIE['login']) && $_COOKIE['login']=='admin' ) return true; 28 die("must be admin"); 29 } 30 31 function getVersion() { Stack Trace #0 – /home/ledelas/ecommerce/protected/views/site/indexEmber.php(3): getLang() 1 <div class="prehome" id="prehome"> 2 <?php 3 $lang=getLang(); 4 $ip = IndexPage::model()->findByPk(1); 5 $langs= $ip->langs(array("condition"=>"lang='$lang'")); 6 echo $langs[0]->preHome; 7 8 #1 + /home/ledelas/yii-1.1.8.r3324/framework/web/CBaseController.php(119): require("/home/ledelas/ecommerce/protected/views/site/indexEmber.php") #2 + /home/ledelas/yii-1.1.8.r3324/framework/web/CBaseController.php(88): CBaseController->renderInternal("/home/ledelas/ecommerce/protected/views/site/indexEmber.php", null, true) #3 + /home/ledelas/yii-1.1.8.r3324/framework/web/CController.php(866): CBaseController->renderFile("/home/ledelas/ecommerce/protected/views/site/indexEmber.php", null, true) #4 + /home/ledelas/yii-1.1.8.r3324/framework/web/CController.php(779): CController->renderPartial("indexEmber", null, true) #5 – /home/ledelas/ecommerce/protected/controllers/SiteController.php(38): CController->render("indexEmber") 33 echo "OK<br>"; 34 } 35 public function actionIndex() 36 { 37 $this->layout='ledelas2'; 38 $this->render('indexEmber'); 39 } 40 public function actionIndex2() 41 { 42 $this->layout='ledelasPrecompile'; 43 $this->render('indexPrecompile'); #6 + /home/ledelas/yii-1.1.8.r3324/framework/web/actions/CInlineAction.php(50): SiteController->actionIndex() #7 + /home/ledelas/yii-1.1.8.r3324/framework/web/CController.php(300): CInlineAction->runWithParams(array()) #8 + /home/ledelas/yii-1.1.8.r3324/framework/web/CController.php(278): CController->runAction(CInlineAction) #9 + /home/ledelas/yii-1.1.8.r3324/framework/web/CController.php(257): CController->runActionWithFilters(CInlineAction, array()) #10 + /home/ledelas/yii-1.1.8.r3324/framework/web/CWebApplication.php(277): CController->run("") #11 + /home/ledelas/yii-1.1.8.r3324/framework/web/CWebApplication.php(136): CWebApplication->runController("") #12 + /home/ledelas/yii-1.1.8.r3324/framework/base/CApplication.php(158): CWebApplication->processRequest() #13 – /home/ledelas/ecommerce/ledelas.php(22): CApplication->run() 17 defined('YII_DEBUG') or define('YII_DEBUG',true); 18 // specify how many levels of call stack should be shown in each log message 19 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3); 20 21 require_once($yii); 22 Yii::createWebApplication($config)->run(); 23 2014-12-18 15:43:19 Apache/2.2.22 (Ubuntu) Yii Framework/1.1.8