True, 'login' => True, 'currentapp' => 'login', 'currentdir' => '/ac', 'noheader' => True ); include('../header.inc.php'); include('./mobile_header.inc.php'); $GLOBALS['sessionid'] = @$_GET['sessionid'] ? $_GET['sessionid'] : @$_COOKIE['sessionid']; if(isset($GLOBALS['sessionid']) && $_GET['cd'] != 10 && $_GET['cd'] != 1) start_prefered_app(); if ($GLOBALS['phpgw_info']['server']['use_https'] > 0) { if ($_SERVER['HTTPS'] != 'on') { $proxies=explode(',',$_SERVER['HTTP_X_FORWARDED_HOST']); $fwConstruct = isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $proxies[0] : $_SERVER['HTTP_HOST']; Header('Location: https://' . $fwConstruct . '/' . $_SERVER['REQUEST_URI']); exit; } } $GLOBALS['phpgw']->session = CreateObject('phpgwapi.sessions'); $GLOBALS['phpgw_info']['server']['template_dir'] = PHPGW_SERVER_ROOT.$GLOBALS['phpgw_info']['flags']['currentdir'].'/templates/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set']; $tmpl = CreateObject('phpgwapi.Template', $GLOBALS['phpgw_info']['server']['template_dir']); $GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'] = $GLOBALS['phpgw_info']['login_template_set']; $tmpl->set_file(array('login_form' => 'login.tpl')); $tmpl->set_var('cd',check_logoutcode($_GET['cd'])); function check_logoutcode($code) { switch($code) { case 1: logout(); //return lang('You have been successfully logged out'); return 'Você desconectou do Expresso Acessível com sucesso.'; case 2: //return lang('Sorry, your login has expired'); return 'Desculpe, sua conta está expirada.'; case 4: //return lang('Cookies are required to login to this site.'); return 'Cookies são requeridos para efetuar o login neste site.'; case 5: //return '' . lang('Bad login or password') . ''; return 'CPF ou senha inválidos.'; case 6: //return '' . lang('Your password has expired, and you do not have access to change it') . ''; return 'Desculpe, seu password está expirado.'; case 98: //return '' . lang('Account is expired') . ''; return 'Sua conta expirou.'; case 99: //return '' . lang('Blocked, too many attempts') . ''; return 'Bloqueado, devido as várias tentativas incorretas'; case 10: $GLOBALS['phpgw']->session->phpgw_setcookie('sessionid'); $GLOBALS['phpgw']->session->phpgw_setcookie('kp3'); $GLOBALS['phpgw']->session->phpgw_setcookie('domain'); if($GLOBALS['phpgw_info']['server']['sessions_type'] == 'php4') { $GLOBALS['phpgw']->session->phpgw_setcookie(PHPGW_PHPSESSID); } return '' . lang('Your session could not be verified.') . ''; default: return ' '; } } if($GLOBALS['phpgw_info']['server']['auth_type'] == 'http' && isset($_SERVER['PHP_AUTH_USER'])) { $submit = True; $login = $_SERVER['PHP_AUTH_USER']; $passwd = $_SERVER['PHP_AUTH_PW']; $passwd_type = 'text'; } else { $passwd = $_POST['passwd']; $passwd_type = $_POST['passwd_type']; } if(isset($passwd_type) || $_POST['submitit_x'] || $_POST['submitit_y'] || $submit) { if(getenv('REQUEST_METHOD') != 'POST' && $_SERVER['REQUEST_METHOD'] != 'POST' && !isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['SSL_CLIENT_S_DN'])){ $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link($GLOBALS['phpgw_info']['flags']['currentdir'].'/login.php','cd=5')); } if(!$submit) $login = $_POST['login']; $GLOBALS['sessionid'] = $GLOBALS['phpgw']->session->create(strtolower($login),$passwd,$passwd_type,'u'); if(!isset($GLOBALS['sessionid']) || ! $GLOBALS['sessionid']){ $GLOBALS['phpgw']->redirect($GLOBALS['phpgw_info']['server']['webserver_url'] .$GLOBALS['phpgw_info']['flags']['currentdir'].'/login.php?cd=' . $GLOBALS['phpgw']->session->cd_reason); } else{ start_prefered_app(); } } elseif ($_GET['lang']) { $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $_GET['lang']; } elseif(!isset($_COOKIE['last_loginid']) || !$prefs->account_id) { list($lang) = explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']); $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $lang; } $tmpl->set_var('charset',$GLOBALS['phpgw']->translation->charset()); $tmpl->set_var('cookie',$last_loginid); /*$tmpl->set_var('lang_username',lang('username')); $tmpl->set_var('lang_password',lang('password')); $tmpl->set_var('lang_login',lang('login'));*/ //a função lang não funciona no login em dispositivos móveis... verificar o motivo... $tmpl->set_var('lang_username',"Informe o seu usuário"); $tmpl->set_var('lang_password',"Informe a sua senha"); $tmpl->set_var('lang_login',"Submeter informações"); $tmpl->set_var('website_title', $GLOBALS['phpgw_info']['server']['site_title']); $tmpl->set_var('template_set',$GLOBALS['phpgw_info']['login_template_set']); $tmpl->set_var('language_select',''); $tmpl->set_var($var); $tmpl->set_block('login_form','language_select'); $tmpl->pfp('loginout','login_form'); function logout(){ $verified = $GLOBALS['phpgw']->session->verify(); if ($verified) { if (file_exists($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . $GLOBALS['sessionid'])) { $dh = opendir($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . $GLOBALS['sessionid']); while ($file = readdir($dh)) { if ($file != '.' && $file != '..') { unlink($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . $GLOBALS['sessionid'] . SEP . $file); } } rmdir($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . $GLOBALS['sessionid']); } $GLOBALS['phpgw']->hooks->process('logout'); $GLOBALS['phpgw']->session->destroy($GLOBALS['sessionid'],$GLOBALS['kp3']); } } ?>