Ejemplo n.º 1
0
 */
extract(FormVariables::GetVariables(array('action', 'user_name', 'password', 'password_reset', 'language')));
$validator = new Validator();
$action = Misc::findSubmitButton();
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();