Changeset 5061 for branches


Ignore:
Timestamp:
09/06/11 12:04:19 (13 years ago)
Author:
alexandrecorreia
Message:

Ticket #2261 - Corrigido os varios redirecionamentos no modulo mobile

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/login.php

    r4200 r5061  
    2828                $GLOBALS['sessionid'] = @$_GET['sessionid'] ? $_GET['sessionid'] : @$_COOKIE['sessionid']; 
    2929                if(isset($GLOBALS['sessionid']) && $_GET['cd'] != 10) 
    30                         $GLOBALS['phpgw']->redirect_link('/home.php'); 
     30                { 
     31                        if( $_GET['cd'] != '66' ) 
     32                        { 
     33                                $GLOBALS['phpgw']->redirect_link('/home.php'); 
     34                        } 
     35                } 
     36                 
    3137                if ($GLOBALS['phpgw_info']['server']['use_https'] > 0) 
    3238                { 
    3339                        if ($_SERVER['HTTPS'] != 'on') 
    3440                        { 
    35                                 Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); 
     41                        Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); 
    3642                                exit; 
    3743                        } 
    3844                } 
    3945                         
    40                 if(function_exists('CreateObject')) 
    41                 { 
    42                         if($_GET['dont_redirect_if_moble'] != 1) { 
    43                                 //detect if the user has a compatible browser, if don't have send him to expresso mini 
    44                                 $browser = CreateObject('phpgwapi.browser'); 
    45  
    46                                 switch ($browser->get_platform()) { 
    47                                         case browser::PLATFORM_IPHONE: 
    48                                         case browser::PLATFORM_IPOD: 
    49                                         case browser::PLATFORM_IPAD: 
    50                                         case browser::PLATFORM_BLACKBERRY: 
    51                                         case browser::PLATFORM_NOKIA: 
    52                                         case browser::PLATFORM_ANDROID: 
    53                                                         $GLOBALS['phpgw']->redirect_link('/mobile/'); 
    54                                                 break; 
    55                                         default: 
    56                                                 break; 
    57                                 } 
    58                         } 
    59                         $GLOBALS['phpgw']->session = CreateObject('phpgwapi.sessions'); 
    60                 } 
    61                 else 
    62                 { 
    63                         Header('Location: setup/index.php'); 
    64                         exit; 
    65                 } 
     46                $GLOBALS['phpgw']->session = CreateObject('phpgwapi.sessions'); 
    6647        } 
    6748        else 
     
    7051                exit; 
    7152        } 
     53         
     54        //detect if the user has a compatible browser, if don't have send him to expresso mini 
     55        $ifMobile = false; 
     56        $browser = CreateObject('phpgwapi.browser'); 
     57        switch ( $browser->get_platform() ) 
     58        { 
     59                case browser::PLATFORM_IPHONE: 
     60                case browser::PLATFORM_IPOD: 
     61                case browser::PLATFORM_IPAD: 
     62                case browser::PLATFORM_BLACKBERRY: 
     63                case browser::PLATFORM_NOKIA: 
     64                case browser::PLATFORM_ANDROID: 
     65                        $ifMobile = true;                                                
     66                        break; 
     67        } 
    7268 
    73         $GLOBALS['phpgw_info']['server']['template_dir'] = PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info']['login_template_set']; 
    74         $tmpl = CreateObject('phpgwapi.Template', $GLOBALS['phpgw_info']['server']['template_dir']); 
    75  
    76         // read the images from the login-template-set, not the (maybe not even set) users template-set 
    77         $GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'] = $GLOBALS['phpgw_info']['login_template_set']; 
    78  
    79         // This is used for system downtime, to prevent new logins. 
    80         if($GLOBALS['phpgw_info']['server']['deny_all_logins']) 
     69        if( $ifMobile && $_GET['dont_redirect_if_moble'] != 1 )  
    8170        { 
    82                 $deny_msg=lang('Oops! You caught us in the middle of system maintainance.<br/> 
    83                 Please, check back with us shortly.'); 
    84  
    85                 $tmpl->set_file(array 
    86                 ( 
    87                         'login_form' => 'login_denylogin.tpl' 
    88                 )); 
    89  
    90                 $tmpl->set_var('template_set','default'); 
    91                 $tmpl->set_var('deny_msg',$deny_msg); 
    92                 $tmpl->pfp('loginout','login_form'); 
    93                 exit; 
     71                $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = preg_replace("/\,.*/","",$GLOBALS['_SERVER']['HTTP_ACCEPT_LANGUAGE']); 
     72                if( $_GET['cd'] == '66' ) 
     73                        $GLOBALS['phpgw']->redirect_link('/mobile/login.php?cd=66'); 
     74                else 
     75                        $GLOBALS['phpgw']->redirect_link('/mobile/login.php'); 
    9476        } 
    95         $tmpl->set_file(array('login_form' => 'login.tpl')); 
    96  
    97         $tmpl->set_var('template',$GLOBALS['phpgw_info']['login_template_set']); 
    98         $tmpl->set_var('lang',$_GET['lang']?$_GET['lang']:preg_replace("/\,.*/","",$GLOBALS['_SERVER']['HTTP_ACCEPT_LANGUAGE'])); 
    99  
    100         if (count($GLOBALS['phpgw_info']['server']['login_logo_file']) > 0) 
    101                 $tmpl->set_var('logo_config',$GLOBALS['phpgw_info']['server']['login_logo_file']); 
    10277        else 
    103                 $tmpl->set_var('logo_config','<a title="Governo do Paran&aacute" href="http://www.pr.gov.br" target="_blank"><img src="phpgwapi/templates/'.$GLOBALS['phpgw_info']['login_template_set'].'/images/logo_governo.gif" border="0"></a></td> 
    104                 <td><div align="center"><font color="#9a9a9a" face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
    105 <a title="Celepar Inform&aacute;tica do Paran&aacute;" target="_blank" href="http://www.celepar.pr.gov.br/"> 
    106 <img src="phpgwapi/templates/'.$GLOBALS['phpgw_info']['login_template_set'].'/images/logo_celepar.gif" border="0"></a>'); 
    107         // !! NOTE !! 
    108         // Do NOT and I repeat, do NOT touch ANYTHING to do with lang in this file. 
    109         // If there is a problem, tell me and I will fix it. (jengo) 
    110  
    111         // whoooo scaring 
    112  
    113         // ServerID => Identify the Apache Frontend. 
    114         if($GLOBALS['phpgw_info']['server']['usecookies'] == True && $GLOBALS['phpgw_info']['server']['use_frontend_id']) 
    11578        { 
    116                 $GLOBALS['phpgw']->session->phpgw_setcookie('serverID', $GLOBALS['phpgw_info']['server']['use_frontend_id']); 
     79                $GLOBALS['phpgw_info']['server']['template_dir'] = PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info']['login_template_set']; 
     80                $tmpl = CreateObject('phpgwapi.Template', $GLOBALS['phpgw_info']['server']['template_dir']); 
     81         
     82                // read the images from the login-template-set, not the (maybe not even set) users template-set 
     83                $GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'] = $GLOBALS['phpgw_info']['login_template_set']; 
     84         
     85                // This is used for system downtime, to prevent new logins. 
     86                if($GLOBALS['phpgw_info']['server']['deny_all_logins']) 
     87                { 
     88                        $deny_msg=lang('Oops! You caught us in the middle of system maintainance.<br/> 
     89                        Please, check back with us shortly.'); 
     90         
     91                        $tmpl->set_file(array('login_form' => 'login_denylogin.tpl')); 
     92         
     93                        $tmpl->set_var('template_set','default'); 
     94                        $tmpl->set_var('deny_msg',$deny_msg); 
     95                        $tmpl->pfp('loginout','login_form'); 
     96                        exit; 
     97                } 
     98                $tmpl->set_file(array('login_form' => 'login.tpl')); 
     99         
     100                $tmpl->set_var('template',$GLOBALS['phpgw_info']['login_template_set']); 
     101                $tmpl->set_var('lang',$_GET['lang']?$_GET['lang']:preg_replace("/\,.*/","",$GLOBALS['_SERVER']['HTTP_ACCEPT_LANGUAGE'])); 
     102         
     103                if (count($GLOBALS['phpgw_info']['server']['login_logo_file']) > 0) 
     104                        $tmpl->set_var('logo_config',$GLOBALS['phpgw_info']['server']['login_logo_file']); 
     105                else 
     106                        $tmpl->set_var('logo_config','<a title="Governo do Paran&aacute" href="http://www.pr.gov.br" target="_blank"><img src="phpgwapi/templates/'.$GLOBALS['phpgw_info']['login_template_set'].'/images/logo_governo.gif" border="0"></a></td> 
     107                        <td><div align="center"><font color="#9a9a9a" face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
     108        <a title="Celepar Inform&aacute;tica do Paran&aacute;" target="_blank" href="http://www.celepar.pr.gov.br/"> 
     109        <img src="phpgwapi/templates/'.$GLOBALS['phpgw_info']['login_template_set'].'/images/logo_celepar.gif" border="0"></a>'); 
     110                // !! NOTE !! 
     111                // Do NOT and I repeat, do NOT touch ANYTHING to do with lang in this file. 
     112                // If there is a problem, tell me and I will fix it. (jengo) 
     113         
     114                // whoooo scaring 
     115         
     116                // ServerID => Identify the Apache Frontend. 
     117                if($GLOBALS['phpgw_info']['server']['usecookies'] == True && $GLOBALS['phpgw_info']['server']['use_frontend_id']) 
     118                { 
     119                        $GLOBALS['phpgw']->session->phpgw_setcookie('serverID', $GLOBALS['phpgw_info']['server']['use_frontend_id']); 
     120                } 
     121                if($GLOBALS['phpgw_info']['server']['captcha']==1) 
     122                { 
     123                        session_start(); 
     124                } 
     125                 
     126                include(personalize_include_path('phpgwapi','login')); 
    117127        } 
    118         if($GLOBALS['phpgw_info']['server']['captcha']==1) 
    119   { 
    120      session_start(); 
    121   } 
    122         include(personalize_include_path('phpgwapi','login')); 
    123128?> 
    124  
Note: See TracChangeset for help on using the changeset viewer.