getRequest()->getParams(); $translator = Zend_Registry::get("translator"); $config = Zend_Registry::get("config"); $availableLanguages = implode("|", $config->translations->language->toArray()); $language = new Zend_Session_Namespace('LANGUAGE'); if (!preg_match("/\/($availableLanguages)\/?/is",$_SERVER['REQUEST_URI'])){ // check if we have a language defined if ($ns = Zend_Session::namespaceGet('LANGUAGE')){ $lang = $p['lang'] = $ns['lang']; } else { $lang = $p['lang'] = 'en'; } $language->lang = $lang; // also set the locale if (!Zend_Locale::isLocale($lang)){ $lang = 'en'; } $translator->setLocale($lang); unset($p['module'],$p['lang']); if ($p['action']=='index') unset($p['action']); if ($p['controller']=='index') unset($p['controller']); $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector'); $url = '/'.$lang.$_SERVER['REQUEST_URI']; //$url = '/'.$lang.'/'.implode('/',$p); $redirector->gotoUrl($url); } if (!Zend_Locale::isLocale($p['lang'])){ $p['lang']= 'en'; } $language->lang = $p['lang']; $translator->setLocale($p['lang']); } } ?>
Fatal error: Uncaught exception 'Zend_Log_Exception' with message '"/var/www/html/log/logfile.txt" cannot be opened with mode "a"' in /var/www/html/Zend/Log/Writer/Stream.php:81 Stack trace: #0 /var/www/html/application/controller/ErrorController.php(42): Zend_Log_Writer_Stream->__construct('/var/www/html/l...') #1 /var/www/html/Zend/Controller/Action.php(516): ErrorController->errorAction() #2 /var/www/html/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('errorAction') #3 /var/www/html/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #4 /var/www/html/index.php(127): Zend_Controller_Front->dispatch() #5 {main} Next exception 'Zend_Controller_Exception' with message '"/var/www/html/log/logfile.txt" cannot be opened with mode "a"#0 /var/www/html/application/controller/ErrorController.php(42): Zend_Log_Writer_Stream->__construct('/var/www/html/l...') #1 /var/www/html/Zend/Controller/Action in /var/www/html/Zend/Controller/Plugin/Broker.php on line 336