Changeset 1851


Ignore:
Timestamp:
12/16/09 15:37:45 (14 years ago)
Author:
rafaelraymundo
Message:

Ticket #827 - login do mobile passa verificar acesso via proxy.

Location:
trunk/mobile
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/mobile/index.php

    r623 r1851  
    44        $phpgw_info = array(); 
    55        $GLOBALS['sessionid'] = isset($_GET['sessionid']) ? $_GET['sessionid'] : @$_COOKIE['sessionid']; 
    6          
     6 
     7        $_SESSION['phpgw_info']['user']['preferences']['contactcenter']['cellShow'] = true; 
     8 
     9        $proxies=explode(',',$_SERVER['HTTP_X_FORWARDED_HOST']); 
     10        $fwConstruct = isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $proxies[0] : $_SERVER['HTTP_HOST']; 
     11 
    712        if(!$GLOBALS['sessionid']) 
    8         {                
    9                 $location = 'Location: login.php'; 
    10                 Header($location); 
     13        { 
     14                //$location = 'Location: ' . $fwConstruct . 'login.php'; 
     15                if ($_SERVER['HTTPS'] != 'on') 
     16                    { 
     17                        $aux = 'http://'; 
     18                    } 
     19                else 
     20                    { 
     21                         $aux = 'https://'; 
     22                    } 
     23                Header('Location: ' . $aux . $fwConstruct . '/mobile/login.php'); 
    1124                exit; 
    1225        } 
     
    1427        if ($GLOBALS['phpgw_info']['server']['use_https'] > 0)  { 
    1528                if ($_SERVER['HTTPS'] != 'on') { 
    16                         Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); 
     29                        Header('Location: https://' . $fwConstruct . '/' . $_SERVER['REQUEST_URI']); 
    1730                        exit; 
    1831                } 
     
    3750        } 
    3851 
    39          
     52 
    4053        $GLOBALS['phpgw_info']['flags'] = array( 
    4154                'noheader'   => True, 
     
    4760        include('../header.inc.php'); 
    4861        include('./mobile_header.inc.php'); 
    49          
     62 
    5063        if($mobileapp == 'home') 
    5164        { 
    5265                start_prefered_app(); 
    5366        } 
    54          
     67 
    5568        $GLOBALS[$class] = CreateObject(sprintf('%s.%s','mobile',$class)); 
    5669        $public_functions = $GLOBALS[$class]->public_functions; 
    5770        if((is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions[$method]) && ! $invalid_data) 
    58         {                                                
    59                 $GLOBALS['phpgw_info']['mobiletemplate'] = CreateObject("mobile.mobiletemplate");                                        
    60                 $GLOBALS['phpgw_info']['mobiletemplate'] -> print_page($class,$method);          
     71        { 
     72                $GLOBALS['phpgw_info']['mobiletemplate'] = CreateObject("mobile.mobiletemplate"); 
     73                $GLOBALS['phpgw_info']['mobiletemplate'] -> print_page($class,$method); 
    6174                unset($mobileapp); 
    6275                unset($class); 
     
    95108                { 
    96109                        $GLOBALS['phpgw']->log->commit(); 
    97                 }                
     110                } 
    98111                start_prefered_app(); 
    99112        } 
  • trunk/mobile/login.php

    r623 r1851  
    1111                'noheader'               => True 
    1212        ); 
    13          
    14         include('../header.inc.php');    
    15         include('./mobile_header.inc.php');      
     13 
     14        include('../header.inc.php'); 
     15        include('./mobile_header.inc.php'); 
    1616        $GLOBALS['sessionid'] = @$_GET['sessionid'] ? $_GET['sessionid'] : @$_COOKIE['sessionid']; 
    17          
     17 
    1818        if(isset($GLOBALS['sessionid']) && $_GET['cd'] != 10 && $_GET['cd'] != 1) 
    19                 start_prefered_app();            
     19                start_prefered_app(); 
    2020                if ($GLOBALS['phpgw_info']['server']['use_https'] > 0)  { 
    21                 if ($_SERVER['HTTPS'] != 'on') { 
    22                         Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); 
     21                if ($_SERVER['HTTPS'] != 'on') 
     22                    { 
     23                        $proxies=explode(',',$_SERVER['HTTP_X_FORWARDED_HOST']); 
     24                        $fwConstruct = isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $proxies[0] : $_SERVER['HTTP_HOST']; 
     25                        Header('Location: https://' . $fwConstruct . '/' . $_SERVER['REQUEST_URI']); 
    2326                        exit; 
    24                 } 
     27                    } 
    2528        } 
    26          
    27         $GLOBALS['phpgw']->session = CreateObject('phpgwapi.sessions');  
    28         $GLOBALS['phpgw_info']['server']['template_dir'] = PHPGW_SERVER_ROOT.$GLOBALS['phpgw_info']['flags']['currentdir'].'/templates/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'];        
     29 
     30        $GLOBALS['phpgw']->session = CreateObject('phpgwapi.sessions'); 
     31        $GLOBALS['phpgw_info']['server']['template_dir'] = PHPGW_SERVER_ROOT.$GLOBALS['phpgw_info']['flags']['currentdir'].'/templates/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set']; 
    2932        $tmpl = CreateObject('phpgwapi.Template', $GLOBALS['phpgw_info']['server']['template_dir']); 
    3033        $GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'] = $GLOBALS['phpgw_info']['login_template_set']; 
    3134        $tmpl->set_file(array('login_form' => 'login.tpl')); 
    3235        $tmpl->set_var('cd',check_logoutcode($_GET['cd'])); 
    33          
     36 
    3437        function check_logoutcode($code) { 
    3538                switch($code) { 
     
    9598                        $GLOBALS['phpgw']->redirect($GLOBALS['phpgw_info']['server']['webserver_url'] .$GLOBALS['phpgw_info']['flags']['currentdir'].'/login.php?cd=' . $GLOBALS['phpgw']->session->cd_reason); 
    9699                } 
    97                 else{            
     100                else{ 
    98101                        start_prefered_app(); 
    99102                } 
     
    115118        $tmpl->set_var('lang_username',"Usuário"); 
    116119        $tmpl->set_var('lang_password',"Senha"); 
    117         $tmpl->set_var('lang_login',"Login");    
     120        $tmpl->set_var('lang_login',"Login"); 
    118121        $tmpl->set_var('website_title', $GLOBALS['phpgw_info']['server']['site_title']); 
    119122        $tmpl->set_var('template_set',$GLOBALS['phpgw_info']['login_template_set']); 
     
    123126        $tmpl->pfp('loginout','login_form'); 
    124127 
    125         function logout(){               
     128        function logout(){ 
    126129                $verified = $GLOBALS['phpgw']->session->verify(); 
    127130                if ($verified) 
Note: See TracChangeset for help on using the changeset viewer.