True, 'login' => True, 'currentapp' => 'login', 'currentdir' => '/mobile', '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', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']); $GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'] = $GLOBALS['phpgw_info']['login_template_set']; $tmpl->set_file(array('login_form' => 'login.tpl')); $tmpl->set_block('login_form','page'); $tmpl->set_block('login_form','success_message'); $tmpl->set_block('login_form','error_message'); //verificando a mensagem erro ou sucesso $cd = check_logoutcode($_GET['cd']); $tmpl->set_var('message', $cd); if(trim($cd) != "") $tmpl->parse('message_box', (($_GET['cd'] == 1) ? 'success_message' : 'error_message') ,true); function check_logoutcode($code) { switch($code) { case 1: logout(); return lang('You have been successfully logged out'); case 2: return lang('Sorry, your login has expired'); case 4: return lang('Cookies are required to login to this site.'); case 5: return lang('Bad login or password'); case 6: return lang('Your password has expired, and you do not have access to change it'); case 98: return lang('Account is expired'); case 99: return lang('Blocked, too many attempts'); 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 { if(isset($_POST['max_resolution']) && $_POST['max_resolution'] > 600) { $GLOBALS['phpgw_info']['user']['preferences']['common']['default_mobile_app'] = 'mobilemail'; $GLOBALS['phpgw']->session->appsession('mobile.layout','mobile','mini_desktop'); } else { $GLOBALS['phpgw']->session->appsession('mobile.layout','mobile','mini_mobile'); } 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')); $tmpl->set_var('lang_notices', lang('notices')); $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','page'); 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']); } } ?>