Changeset 5043 for trunk/mobile/login.php
- Timestamp:
- 09/05/11 19:10:51 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mobile/login.php
r5037 r5043 16 16 include_once('./mobile_header.inc.php'); 17 17 $GLOBALS['sessionid'] = @$_GET['sessionid'] ? $_GET['sessionid'] : @$_COOKIE['sessionid']; 18 19 if(isset($GLOBALS['sessionid']) && $_GET['cd'] != 10 && $_GET['cd'] != 1) 20 start_prefered_app(); 18 19 function check_logoutcode($code) 20 { 21 $_return = ''; 21 22 23 switch($code) 24 { 25 case 'logout_mobile': 26 case 1: 27 logout(); 28 $_return = lang('You have been successfully logged out'); 29 break; 30 case 2: 31 $_return = lang('Sorry, your login has expired'); 32 break; 33 case 4: 34 $_return = lang('Cookies are required to login to this site.'); 35 break; 36 case 5: 37 $_return = lang('Bad login or password'); 38 break; 39 case 6: 40 $_return = lang('Your password has expired, and you do not have access to change it'); 41 break; 42 case 98: 43 $_return = lang('Account is expired'); 44 break; 45 case 99: 46 $_return = lang('Blocked, too many attempts'); 47 break; 48 case 10: 49 $GLOBALS['phpgw']->session->phpgw_setcookie('sessionid'); 50 $GLOBALS['phpgw']->session->phpgw_setcookie('kp3'); 51 $GLOBALS['phpgw']->session->phpgw_setcookie('domain'); 52 if($GLOBALS['phpgw_info']['server']['sessions_type'] == 'php4') 53 { 54 $GLOBALS['phpgw']->session->phpgw_setcookie(PHPGW_PHPSESSID); 55 } 56 $_return = lang('Your session could not be verified.'); 57 break; 58 } 59 60 return $_return; 61 } 62 22 63 if ( $GLOBALS['phpgw_info']['server']['use_https'] > 0 ) 23 64 { … … 35 76 $tmpl = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']); 36 77 $GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'] = $GLOBALS['phpgw_info']['login_template_set']; 78 79 //URL Expresso 80 $url_expresso = $GLOBALS['phpgw_info']['server']['webserver_url']; 81 $url_expresso = ( !empty($url_expresso) ) ? $url_expresso : '/'; 82 83 if(strrpos($url_expresso,'/') === false || strrpos($url_expresso,'/') != (strlen($url_expresso)-1)) 84 { 85 $url_expresso .= '/'; 86 } 87 37 88 $tmpl->set_file(array('login_form' => 'login.tpl')); 38 89 $tmpl->set_block('login_form','page'); 39 90 $tmpl->set_block('login_form','success_message'); 40 91 $tmpl->set_block('login_form','error_message'); 92 $tmpl->set_var('url_expresso', $url_expresso); 93 $tmpl->set_var('lang_username', lang('username')); 94 $tmpl->set_var('lang_password', lang('password')); 95 $tmpl->set_var('lang_login', lang('login')); 41 96 42 97 //verificando a mensagem erro ou sucesso … … 44 99 $tmpl->set_var('message', $cd); 45 100 46 if(trim($cd) != "") 101 if( trim($cd) != "" ) 102 { 47 103 $tmpl->parse('message_box', (($_GET['cd'] == 1) ? 'success_message' : 'error_message') ,true); 48 //detect if the user has a mobile browser 49 50 $browser = CreateObject('phpgwapi.browser'); 104 } 105 106 //detect if the user has a mobile browser 107 $browser = CreateObject('phpgwapi.browser'); 108 $platform = false; 51 109 52 110 switch ($browser->get_platform()) … … 58 116 case browser::PLATFORM_NOKIA: 59 117 case browser::PLATFORM_ANDROID: 60 $ tmpl->set_var('os_browser',$browser->get_platform());118 $platform = $browser->get_platform(); 61 119 break; 62 default: 63 $tmpl->set_var('os_browser',false); 64 //$tmpl->set_var('os_browser',$browser->get_platform()); 65 break; 66 } 67 68 function check_logoutcode($code) { 69 switch($code) { 70 case 1: 71 logout(); 72 return lang('You have been successfully logged out'); 73 74 case 2: 75 return lang('Sorry, your login has expired'); 76 77 case 4: 78 return lang('Cookies are required to login to this site.'); 79 80 case 5: 81 return lang('Bad login or password'); 82 case 6: 83 return lang('Your password has expired, and you do not have access to change it'); 84 case 98: 85 return lang('Account is expired'); 86 case 99: 87 return lang('Blocked, too many attempts'); 88 case 10: 89 $GLOBALS['phpgw']->session->phpgw_setcookie('sessionid'); 90 $GLOBALS['phpgw']->session->phpgw_setcookie('kp3'); 91 $GLOBALS['phpgw']->session->phpgw_setcookie('domain'); 92 if($GLOBALS['phpgw_info']['server']['sessions_type'] == 'php4') { 93 $GLOBALS['phpgw']->session->phpgw_setcookie(PHPGW_PHPSESSID); 94 } 95 return lang('Your session could not be verified.'); 96 default: 97 return ''; 98 } 99 } 100 101 if($GLOBALS['phpgw_info']['server']['auth_type'] == 'http' && isset($_SERVER['PHP_AUTH_USER'])) { 120 } 121 122 $tmpl->set_var('os_browser',$platform ); 123 124 // Automatic login from browser cookies 125 if( get_var('lem',array('GET','COOKIE')) && get_var('pem',array('GET','COOKIE')) ) 126 { 102 127 $submit = True; 103 $login = $_SERVER['PHP_AUTH_USER'];104 $passwd = $_SERVER['PHP_AUTH_PW'];128 $login = base64_decode(get_var('lem',array('GET','COOKIE'))); 129 $passwd = base64_decode(get_var('pem',array('GET','COOKIE'))); 105 130 $passwd_type = 'text'; 106 } 107 // Automatic login from browser cookies 108 elseif(get_var('lem',array('GET','COOKIE')) && get_var('pem',array('GET','COOKIE'))) 109 { 110 if(!$_GET['cd'] || $_GET['cd'] == '1' || $_GET['cd'] == '10') { 131 132 if( $_GET['cd'] == 66 ) 133 { 134 unset( $_GET['cd'] ); 135 } 136 } 137 else 138 { 139 if($GLOBALS['phpgw_info']['server']['auth_type'] == 'http' && isset($_SERVER['PHP_AUTH_USER'])) 140 { 111 141 $submit = True; 112 $login = base64_decode(get_var('lem',array('GET','COOKIE')));113 $passwd = base64_decode(get_var('pem',array('GET','COOKIE')));142 $login = $_SERVER['PHP_AUTH_USER']; 143 $passwd = $_SERVER['PHP_AUTH_PW']; 114 144 $passwd_type = 'text'; 115 145 } 116 else { 117 $GLOBALS['phpgw']->session->phpgw_setcookie('lem'); 118 $GLOBALS['phpgw']->session->phpgw_setcookie('pem'); 119 } 120 } 121 else 122 { 123 $passwd = $_POST['passwd']; 124 $passwd_type = $_POST['passwd_type']; 146 else 147 { 148 $passwd = $_POST['passwd']; 149 $passwd_type = $_POST['passwd_type']; 150 } 125 151 } 126 152 … … 183 209 $tmpl->set_var('charset',$GLOBALS['phpgw']->translation->charset()); 184 210 $tmpl->set_var('cookie',$last_loginid); 185 $tmpl->set_var('lang_username', lang('username'));186 $tmpl->set_var('lang_password', lang('password'));187 $tmpl->set_var('lang_login', lang('login'));188 211 $tmpl->set_var('lang_notices', lang('notices')); 189 212 $tmpl->set_var('website_title', $GLOBALS['phpgw_info']['server']['site_title']);
Note: See TracChangeset
for help on using the changeset viewer.