Changeset 5042 for trunk


Ignore:
Timestamp:
09/05/11 18:52:58 (13 years ago)
Author:
alexandrecorreia
Message:

Ticket #2260 - Sincronismo do branch2.2(versão 2.2.8) para 2.4 ajustes

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/home.php

    r3435 r5042  
    3636        ); 
    3737        include('header.inc.php'); 
     38         
     39        //detect browser 
     40        require_once('phpgwapi/inc/class.browser.inc.php'); 
     41         
     42        $ifMobile       = false; 
     43        $browser        = new browser(); 
     44         
     45         
     46        switch( $browser->get_platform() ) 
     47        { 
     48                case browser::PLATFORM_IPHONE: 
     49                case browser::PLATFORM_IPOD: 
     50                case browser::PLATFORM_IPAD: 
     51                case browser::PLATFORM_BLACKBERRY: 
     52                case browser::PLATFORM_ANDROID:                                          
     53                        $ifMobile = false; 
     54                        break;                   
     55        } 
     56         
     57        if( $ifMobile ) 
     58        { 
     59                if( $_GET['dont_redirect_if_moble'] != 1 ) 
     60                { 
     61                        $GLOBALS['phpgw']->redirect('/mobile/index.php'); 
     62                        exit;                    
     63                } 
     64        }  
     65         
     66         
    3867        $GLOBALS['phpgw_info']['flags']['app_header']=lang('home'); 
    3968 
  • trunk/index.php

    r3435 r5042  
    6969        if($app == 'home' && !$api_requested) 
    7070        { 
    71                 Header('Location: ' . $GLOBALS['phpgw']->link('/home.php')); 
     71                if( $_GET['dont_redirect_if_moble'] == 1 ) 
     72                        Header('Location: ' . $GLOBALS['phpgw']->link('/home.php?dont_redirect_if_moble=1')); 
     73                else 
     74                        Header('Location: ' . $GLOBALS['phpgw']->link('/home.php')); 
    7275        } 
    7376 
     
    125128                } 
    126129 
    127                 $GLOBALS['phpgw']->redirect_link('/home.php'); 
     130                if( $_GET['dont_redirect_if_moble'] == 1 ) 
     131                        Header('Location: ' . $GLOBALS['phpgw']->link('/home.php?dont_redirect_if_moble=1')); 
     132                else 
     133                        Header('Location: ' . $GLOBALS['phpgw']->link('/home.php')); 
     134                                 
     135                //$GLOBALS['phpgw']->redirect_link('/home.php'); 
    128136        } 
    129137 
  • trunk/login.php

    r4417 r5042  
    2727                // Force location to home, while logged in. 
    2828                $GLOBALS['sessionid'] = @$_GET['sessionid'] ? $_GET['sessionid'] : @$_COOKIE['sessionid']; 
     29                 
    2930                if(isset($GLOBALS['sessionid']) && $_GET['cd'] != 10) 
    30                         $GLOBALS['phpgw']->redirect_link('/home.php'); 
     31                { 
     32                        if( $_GET['cd'] != '66' ) 
     33                        { 
     34                                $GLOBALS['phpgw']->redirect_link('/home.php'); 
     35                        } 
     36                } 
     37                 
    3138                if ($GLOBALS['phpgw_info']['server']['use_https'] > 0) 
    3239                { 
    3340                        if ($_SERVER['HTTPS'] != 'on') 
    3441                        { 
    35                                 Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); 
     42                        Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); 
    3643                                exit; 
    3744                        } 
    3845                } 
    3946                         
    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                 } 
     47                $GLOBALS['phpgw']->session = CreateObject('phpgwapi.sessions'); 
    6648        } 
    6749        else 
     
    7052                exit; 
    7153        } 
     54         
     55        //detect if the user has a compatible browser, if don't have send him to expresso mini 
     56        $ifMobile = false; 
     57        $browser = CreateObject('phpgwapi.browser'); 
     58        switch ( $browser->get_platform() ) 
     59        { 
     60                case browser::PLATFORM_IPHONE: 
     61                case browser::PLATFORM_IPOD: 
     62                case browser::PLATFORM_IPAD: 
     63                case browser::PLATFORM_BLACKBERRY: 
     64                case browser::PLATFORM_NOKIA: 
     65                case browser::PLATFORM_ANDROID: 
     66                        $ifMobile = true;                                                
     67                        break; 
     68        } 
    7269 
    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']) 
     70        if( $ifMobile && $_GET['dont_redirect_if_moble'] != 1 )  
    8171        { 
    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; 
     72                $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = preg_replace("/\,.*/","",$GLOBALS['_SERVER']['HTTP_ACCEPT_LANGUAGE']); 
     73                if( $_GET['cd'] == '66' ) 
     74                        $GLOBALS['phpgw']->redirect_link('/mobile/login.php?cd=66'); 
     75                else 
     76                        $GLOBALS['phpgw']->redirect_link('/mobile/login.php'); 
    9477        } 
    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']); 
    10278        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']) 
    11579        { 
    116                 $GLOBALS['phpgw']->session->phpgw_setcookie('serverID', $GLOBALS['phpgw_info']['server']['use_frontend_id']); 
     80                $GLOBALS['phpgw_info']['server']['template_dir'] = PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info']['login_template_set']; 
     81                $tmpl = CreateObject('phpgwapi.Template', $GLOBALS['phpgw_info']['server']['template_dir']); 
     82         
     83                // read the images from the login-template-set, not the (maybe not even set) users template-set 
     84                $GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'] = $GLOBALS['phpgw_info']['login_template_set']; 
     85         
     86                // This is used for system downtime, to prevent new logins. 
     87                if($GLOBALS['phpgw_info']['server']['deny_all_logins']) 
     88                { 
     89                        $deny_msg=lang('Oops! You caught us in the middle of system maintainance.<br/> 
     90                        Please, check back with us shortly.'); 
     91         
     92                        $tmpl->set_file(array('login_form' => 'login_denylogin.tpl')); 
     93         
     94                        $tmpl->set_var('template_set','default'); 
     95                        $tmpl->set_var('deny_msg',$deny_msg); 
     96                        $tmpl->pfp('loginout','login_form'); 
     97                        exit; 
     98                } 
     99                $tmpl->set_file(array('login_form' => 'login.tpl')); 
     100         
     101                $tmpl->set_var('template',$GLOBALS['phpgw_info']['login_template_set']); 
     102                $tmpl->set_var('lang',$_GET['lang']?$_GET['lang']:preg_replace("/\,.*/","",$GLOBALS['_SERVER']['HTTP_ACCEPT_LANGUAGE'])); 
     103         
     104                if (count($GLOBALS['phpgw_info']['server']['login_logo_file']) > 0) 
     105                        $tmpl->set_var('logo_config',$GLOBALS['phpgw_info']['server']['login_logo_file']); 
     106                else 
     107                        $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> 
     108                        <td><div align="center"><font color="#9a9a9a" face="Verdana, Arial, Helvetica, sans-serif" size="1"> 
     109        <a title="Celepar Inform&aacute;tica do Paran&aacute;" target="_blank" href="http://www.celepar.pr.gov.br/"> 
     110        <img src="phpgwapi/templates/'.$GLOBALS['phpgw_info']['login_template_set'].'/images/logo_celepar.gif" border="0"></a>'); 
     111                // !! NOTE !! 
     112                // Do NOT and I repeat, do NOT touch ANYTHING to do with lang in this file. 
     113                // If there is a problem, tell me and I will fix it. (jengo) 
     114         
     115                // whoooo scaring 
     116         
     117                // ServerID => Identify the Apache Frontend. 
     118                if($GLOBALS['phpgw_info']['server']['usecookies'] == True && $GLOBALS['phpgw_info']['server']['use_frontend_id']) 
     119                { 
     120                        $GLOBALS['phpgw']->session->phpgw_setcookie('serverID', $GLOBALS['phpgw_info']['server']['use_frontend_id']); 
     121                } 
     122                if($GLOBALS['phpgw_info']['server']['captcha']==1) 
     123                { 
     124                        session_start(); 
     125                } 
     126                 
     127                include(personalize_include_path('phpgwapi','login')); 
    117128        } 
    118         if($GLOBALS['phpgw_info']['server']['captcha']==1) 
    119   { 
    120      session_start(); 
    121   } 
    122  
    123         $_SESSION['rootPath'] = realpath( './'); 
    124    
    125         include(personalize_include_path('phpgwapi','login')); 
    126129?> 
    127  
  • trunk/phpgwapi/templates/default/login_default.php

    r5036 r5042  
    5757                } 
    5858        } 
    59         function troca_espaco_por_mais($pem_data) 
    60         { 
    61             $begin = "CERTIFICATE-----"; 
    62             $end   = "-----END"; 
    63             $aux = substr($pem_data, strpos($pem_data, $begin)+strlen($begin)); 
    64             $aux = substr($aux, 0, strpos($aux, $end)); 
    65             $aux = strtr($aux,' ','+'); 
    66             $aux = '-----BEGIN CERTIFICATE-----'.$aux.'-----END CERTIFICATE-----'; 
    67             return $aux; 
    68         } 
    69         /* Program starts here */ 
    70          
     59         
     60        $ifMobile = false; 
     61        $browser = CreateObject('phpgwapi.browser'); 
     62        switch ( $browser->get_platform() ) 
     63        { 
     64                case browser::PLATFORM_IPHONE: 
     65                case browser::PLATFORM_IPOD: 
     66                case browser::PLATFORM_IPAD: 
     67                case browser::PLATFORM_BLACKBERRY: 
     68                case browser::PLATFORM_NOKIA: 
     69                case browser::PLATFORM_ANDROID: 
     70                        $ifMobile = true;                                                
     71                        break; 
     72        } 
     73         
     74        if( $ifMobile && $_GET['dont_redirect_if_moble'] != 1 )  
     75        { 
     76                $GLOBALS['phpgw']->redirect_link('/mobile/login.php'); 
     77        } 
     78        else 
     79        { 
     80        /* Program starts here */ 
    7181        if($GLOBALS['phpgw_info']['server']['auth_type'] == 'http' && isset($_SERVER['PHP_AUTH_USER'])) 
    7282        { 
     
    114124                unset($sslattributes); 
    115125        } 
    116         if(isset($_POST['certificado']) && $_POST['certificado']) 
    117         { 
    118             $_SESSION['login_certificate'] = troca_espaco_por_mais(str_replace(chr(0x0D).chr(0x0A),chr(0x0A),str_replace(chr(0x0A).chr(0x0A),chr(0x0A),$_POST['certificado']))); 
    119         } 
    120         if( isset( $_GET[ 'cd' ] ) && ( $_GET['cd']=='1' || $_GET['cd'] == 10 ) ) 
     126 
     127    if( isset( $_GET[ 'cd' ] ) && ( $_GET['cd']=='1' || $_GET['cd'] == 10 ) ) 
    121128        { 
    122129            $_SESSION['contador'] = 0; 
     
    210217                                list($forward,$extra_vars) = explode('?',$forward,2); 
    211218                        } 
    212  
    213219                if ($GLOBALS['phpgw_info']['server']['use_https'] != 2) 
    214220                        { 
     
    260266                        */ 
    261267                        $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $lang; 
    262  
    263                         if (!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['theme'])) 
    264                         { 
    265                                 $prefs2 = CreateObject('phpgwapi.preferences'); 
    266                                 $temp_pref = $prefs2->read_repository(); 
    267                                 $GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] = $temp_pref['common']['theme']; 
    268                         } 
    269268                } 
    270269                #print 'LANG:' . $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] . '<br>'; 
     
    386385        $tmpl->set_var('website_title', $GLOBALS['phpgw_info']['server']['site_title']); 
    387386        $tmpl->set_var('template_set', $template); 
    388         $tmpl->set_var('compatIE8',lang("The compatibility mode for internet explorer 8 is active. Turn it of if you want to use the local mail functionality.")); 
    389387 
    390388        // loads the template's login.css 
Note: See TracChangeset for help on using the changeset viewer.