Changeset 5054 for branches/2.2/mobile/login.php
- Timestamp:
- 09/06/11 11:04:14 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/mobile/login.php
r4744 r5054 16 16 include_once('./mobile_header.inc.php'); 17 17 $GLOBALS['sessionid'] = @$_GET['sessionid'] ? $_GET['sessionid'] : @$_COOKIE['sessionid']; 18 19 if( isset($GLOBALS['sessionid']) ) 20 { 21 if( $_GET['cd'] != 10 && $_GET['cd'] != 1 && $_GET['cd'] !== 'logout_mobile' ) 22 { 23 start_prefered_app(); 24 } 25 } 18 19 function check_logoutcode($code) 20 { 21 $_return = ''; 26 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 27 63 if ( $GLOBALS['phpgw_info']['server']['use_https'] > 0 ) 28 64 { … … 59 95 $tmpl->set_var('lang_login', lang('login')); 60 96 61 62 97 //verificando a mensagem erro ou sucesso 63 98 $cd = check_logoutcode($_GET['cd']); 64 99 $tmpl->set_var('message', $cd); 65 100 66 if(trim($cd) != "") 101 if( trim($cd) != "" ) 102 { 67 103 $tmpl->parse('message_box', (($_GET['cd'] == 1) ? 'success_message' : 'error_message') ,true); 68 //detect if the user has a mobile browser 69 70 $browser = CreateObject('phpgwapi.browser'); 104 } 105 106 //detect if the user has a mobile browser 107 $browser = CreateObject('phpgwapi.browser'); 108 $platform = false; 71 109 72 110 switch ($browser->get_platform()) … … 78 116 case browser::PLATFORM_NOKIA: 79 117 case browser::PLATFORM_ANDROID: 80 $ tmpl->set_var('os_browser',$browser->get_platform());118 $platform = $browser->get_platform(); 81 119 break; 82 default: 83 $tmpl->set_var('os_browser',false); 84 //$tmpl->set_var('os_browser',$browser->get_platform()); 85 break; 86 } 87 88 function check_logoutcode($code) { 89 switch($code) { 90 case 'logout_mobile': 91 case 1: 92 logout(); 93 return lang('You have been successfully logged out'); 94 95 case 2: 96 return lang('Sorry, your login has expired'); 97 98 case 4: 99 return lang('Cookies are required to login to this site.'); 100 101 case 5: 102 return lang('Bad login or password'); 103 case 6: 104 return lang('Your password has expired, and you do not have access to change it'); 105 case 98: 106 return lang('Account is expired'); 107 case 99: 108 return lang('Blocked, too many attempts'); 109 case 10: 110 $GLOBALS['phpgw']->session->phpgw_setcookie('sessionid'); 111 $GLOBALS['phpgw']->session->phpgw_setcookie('kp3'); 112 $GLOBALS['phpgw']->session->phpgw_setcookie('domain'); 113 if($GLOBALS['phpgw_info']['server']['sessions_type'] == 'php4') { 114 $GLOBALS['phpgw']->session->phpgw_setcookie(PHPGW_PHPSESSID); 115 } 116 return lang('Your session could not be verified.'); 117 118 default: 119 return ''; 120 } 121 } 122 123 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 { 124 127 $submit = True; 125 $login = $_SERVER['PHP_AUTH_USER'];126 $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'))); 127 130 $passwd_type = 'text'; 128 } 129 // Automatic login from browser cookies 130 elseif(get_var('lem',array('GET','COOKIE')) && get_var('pem',array('GET','COOKIE'))) 131 { 132 if( $_GET['cd'] !== 'logout_mobile' ) 133 { 134 if(!$_GET['cd'] || $_GET['cd'] == '1' || $_GET['cd'] == '10') 135 { 136 $submit = True; 137 $login = base64_decode(get_var('lem',array('GET','COOKIE'))); 138 $passwd = base64_decode(get_var('pem',array('GET','COOKIE'))); 139 $passwd_type = 'text'; 140 } 141 else 142 { 143 $GLOBALS['phpgw']->session->phpgw_setcookie('lem'); 144 $GLOBALS['phpgw']->session->phpgw_setcookie('pem'); 145 } 146 } 147 } 148 else 149 { 150 $passwd = $_POST['passwd']; 151 $passwd_type = $_POST['passwd_type']; 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 { 141 $submit = True; 142 $login = $_SERVER['PHP_AUTH_USER']; 143 $passwd = $_SERVER['PHP_AUTH_PW']; 144 $passwd_type = 'text'; 145 } 146 else 147 { 148 $passwd = $_POST['passwd']; 149 $passwd_type = $_POST['passwd_type']; 150 } 152 151 } 153 152 … … 185 184 $_SESSION['phpgw_info']['user']['preferences']['expressoMail'] = $preferences['expressoMail']; 186 185 187 if($_POST['save_login'] == 'yes')186 if($_POST['save_login'] === 'on') 188 187 { 189 188 // Time to keep values into cookies … … 192 191 $GLOBALS['phpgw']->session->phpgw_setcookie('pem', base64_encode($passwd), $ttl); // pem = password 193 192 } 194 start_prefered_app(); 195 } 196 } 197 elseif ($_GET['lang']) 198 { 199 $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $_GET['lang']; 193 194 if( isset($GLOBALS['sessionid']) ) 195 { 196 if( $_GET['cd'] != 10 && $_GET['cd'] != 1 && $_GET['cd'] !== 'logout_mobile' && $_GET['cd'] != 66 ) 197 { 198 start_prefered_app(); 199 } 200 } 201 } 200 202 } 201 203 elseif(!isset($_COOKIE['last_loginid']) || !$prefs->account_id)
Note: See TracChangeset
for help on using the changeset viewer.