switch ($action) { case 'submit': //Debug::setVerbosity( 11 ); Debug::Text('User Name: ' . $user_name, __FILE__, __LINE__, __METHOD__, 10); if (isset($config_vars['other']['web_session_expire']) and $config_vars['other']['web_session_expire'] != '') { $authentication->setEnableExpireSession((int) $config_vars['other']['web_session_expire']); } $authentication_result = $authentication->Login($user_name, $password); if ($authentication_result === TRUE) { $authentication->Check(); Debug::text('Login Language: ' . $language, __FILE__, __LINE__, __METHOD__, 10); TTi18n::setCountry(TTi18n::getCountryFromLocale()); TTi18n::setLanguage($language); TTi18n::setLocale(); TTi18n::setLocaleCookie(); Debug::text('Locale: ' . TTi18n::getLocale(), __FILE__, __LINE__, __METHOD__, 10); $clf = TTnew('CompanyListFactory'); $clf->getByID($authentication->getObject()->getCompany()); $current_company = $clf->getCurrent(); unset($clf); $create_new_station = FALSE; //If this is a new station, insert it now. if (isset($_COOKIE['StationID'])) { Debug::text('Station ID Cookie found! ' . $_COOKIE['StationID'], __FILE__, __LINE__, __METHOD__, 10); $slf = TTnew('StationListFactory'); $slf->getByStationIdandCompanyId($_COOKIE['StationID'], $current_company->getId()); $current_station = $slf->getCurrent(); unset($slf); if ($current_station->isNew()) { Debug::text('Station ID is NOT IN DB!! ' . $_COOKIE['StationID'], __FILE__, __LINE__, __METHOD__, 10); $create_new_station = TRUE;
function getLocale($language = NULL, $country = NULL) { $language = Misc::trimSortPrefix($language); if ($language == '' and is_object($this->getCurrentUserObject()) and is_object($this->getCurrentUserObject()->getUserPreferenceObject())) { $language = $this->getCurrentUserObject()->getUserPreferenceObject()->getLanguage(); } if ($country == '' and is_object($this->getCurrentUserObject())) { $country = $this->getCurrentUserObject()->getCountry(); } if ($language != '') { TTi18n::setLanguage($language); } if ($country != '') { TTi18n::setCountry($country); } TTi18n::setLocale(); //Sets master locale $retval = str_replace('.UTF-8', '', TTi18n::getLocale()); Debug::text('Locale: ' . $retval, __FILE__, __LINE__, __METHOD__, 10); return $retval; }