Ignore:
Timestamp:
10/08/13 16:20:46 (11 years ago)
Author:
douglas
Message:

Ticket #0000 - Copiadas as alterações do Trunk. Versão final 2.5.1.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.5/phpgwapi/templates/news/login_news.php

    r7681 r8232  
    1212        \**************************************************************************/ 
    1313 
    14         function check_logoutcode($code) 
    15         { 
    16                 switch($code) 
    17                 { 
    18                         case 1: 
    19                                 return lang('You have been successfully logged out'); 
    20                                  
    21                         case 2: 
    22                                 return lang('Sorry, your login has expired'); 
    23                                  
    24                         case 4: 
    25                                 return lang('Cookies are required to login to this site.'); 
    26                                  
    27                         case 5: 
    28                                 return '<font color="FF0000">' . lang('Bad login or password') . '</font>'; 
    29  
    30                         case 6: 
    31                                 return '<font color="FF0000">' . lang('Your password has expired, and you do not have access to change it') . '</font>'; 
    32                                  
    33                         case 98: 
    34                                 return '<font color="FF0000">' . lang('Account is expired') . '</font>'; 
    35                                  
    36                         case 99: 
    37                                 return '<font color="FF0000">' . lang('Blocked, too many attempts(%1)! Retry in %2 minute(s)',$GLOBALS['phpgw_info']['server']['num_unsuccessful_id'],$GLOBALS['phpgw_info']['server']['block_time']) . '</font>'; 
    38                         case 200: 
    39                             //return '<font color="FF0000">' . lang('Invalid code') . '</font>'; 
    40                 return '<font color="FF0000">' . lang('Bad login or password') . '</font>'; 
    41                             break; 
    42                         case 10: 
    43                                 $GLOBALS['phpgw']->session->phpgw_setcookie('sessionid'); 
    44                                 $GLOBALS['phpgw']->session->phpgw_setcookie('kp3'); 
    45                                 $GLOBALS['phpgw']->session->phpgw_setcookie('domain'); 
    46  
    47                                 //fix for bug php4 expired sessions bug 
    48                                 if($GLOBALS['phpgw_info']['server']['sessions_type'] == 'php4') 
    49                                 { 
    50                                         $GLOBALS['phpgw']->session->phpgw_setcookie(PHPGW_PHPSESSID); 
    51                                 } 
    52  
    53                                 return '<font color="#FF0000">' . lang('Your session could not be verified.') . '</font>'; 
    54                                  
    55                         default: 
    56                                 return ''; 
    57                 } 
    58         } 
    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         { 
     14        require_once "logout_code.php"; 
     15 
    8016        /* Program starts here */ 
    8117        if($GLOBALS['phpgw_info']['server']['auth_type'] == 'http' && isset($_SERVER['PHP_AUTH_USER'])) 
     
    9430        # Apache + mod_ssl style SSL certificate authentication 
    9531        # Certificate (chain) verification occurs inside mod_ssl 
    96         if($GLOBALS['phpgw_info']['server']['auth_type'] == 'sqlssl' && isset($_SERVER['SSL_CLIENT_S_DN']) && !isset($_GET['cd'])) 
     32        if( $GLOBALS['phpgw_info']['server']['auth_type'] == 'sqlssl' && isset($_SERVER['SSL_CLIENT_S_DN']) && !isset($_GET['cd']) ) 
    9733        { 
    9834                # an X.509 subject looks like: 
     
    11349                        # login will be set here if the user logged out and uses a different username with 
    11450                        # the same SSL-certificate. 
    115                         if(!isset($_POST['login'])&&isset($sslattributes['Email'])) 
     51                        if( !isset($_POST['login']) && isset($sslattributes['Email']) ) 
    11652                        { 
    11753                                $login = $sslattributes['Email']; 
     
    12763    if( isset( $_GET[ 'cd' ] ) && ( $_GET['cd']=='1' || $_GET['cd'] == 10 ) ) 
    12864        { 
    129             $_SESSION['contador'] = 0; 
    130         } 
    131  
    132         if(isset($passwd_type) || $_POST['submitit_x'] || $_POST['submitit_y'] || $submit) 
    133         { 
    134          
     65                $_SESSION['contador_captcha'] = 0; 
     66        } 
     67 
     68        if( isset($passwd_type) || $_POST['submitit_x'] || $_POST['submitit_y'] || $submit ) 
     69        { 
    13570            // Primeiro testa o captcha....se houver...... 
    136             if($GLOBALS['phpgw_info']['server']['captcha']==1) 
    137               { 
    138                 if($_SESSION['contador'] > $GLOBALS['phpgw_info']['server']['num_badlogin']) 
    139                     { 
    140                         if ($_SESSION['CAPTCHAString'] != trim(strtoupper($_POST['codigo']))) 
    141                                 { 
    142                                         if(!$_GET['cd']) 
    143                                         { 
    144                                             $_GET['cd'] = '200'; 
    145                                         } 
    146                                 } 
    147                         unset($_SESSION['CAPTCHAString']); 
    148                     } 
    149               } 
    150                 if($_POST['user']) { 
    151                         if($GLOBALS['phpgw_info']['server']['use_prefix_organization']) { 
    152                                 $common = CreateObject('phpgwapi.common'); 
    153                                 $ldap_conn = $common->ldapConnect(); 
    154                                 $justthese = array("uid"); 
    155                                 $filter="(&(phpgwAccountType=u)(uid=".$_POST['user']."))"; 
    156                                 $ldap_search = ldap_search($ldap_conn, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 
    157                                 $ldap_info       = ldap_get_entries($ldap_conn, $ldap_search); 
     71        if( $GLOBALS['phpgw_info']['server']['captcha'] == 1 ) 
     72                { 
     73                        if( $_SESSION['contador_captcha'] > $GLOBALS['phpgw_info']['server']['num_badlogin'] ) 
     74                        { 
     75                                if ($_SESSION['CAPTCHAString'] != trim(strtoupper($_POST['codigo']))) 
     76                                { 
     77                                        if(!$_GET['cd']) 
     78                                        { 
     79                                                $_GET['cd'] = '200'; 
     80                                        } 
     81                                } 
     82                                 
     83                                unset($_SESSION['CAPTCHAString']); 
     84                        } 
     85                } 
     86                 
     87                if( $_POST['user'] ) 
     88                { 
     89                        if($GLOBALS['phpgw_info']['server']['use_prefix_organization']) 
     90                        { 
     91                                $common         = CreateObject('phpgwapi.common'); 
     92                                $ldap_conn      = $common->ldapConnect(); 
     93                                $justthese      = array("uid"); 
     94                                $filter         = "(&(phpgwAccountType=u)(uid=".$_POST['user']."))"; 
     95                                $ldap_search    = ldap_search($ldap_conn, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 
     96                                $ldap_info              = ldap_get_entries($ldap_conn, $ldap_search); 
     97                                 
    15898                                ldap_close($ldap_conn); 
    159                                 if ($ldap_info['count'] != 0) { 
     99                                 
     100                                if( $ldap_info['count'] != 0 ) 
     101                                { 
    160102                                        $_POST['login'] = $_POST['user']; 
    161103                                } 
    162104                        } 
    163105                        else 
     106                        { 
    164107                                $_POST['login'] = $_POST['user']; 
    165                 } 
     108                        } 
     109                } 
     110                 
    166111                if(getenv('REQUEST_METHOD') != 'POST' && $_SERVER['REQUEST_METHOD'] != 'POST' && 
    167112                        !isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['SSL_CLIENT_S_DN'])) 
    168113                { 
    169                         if(!$_GET['cd']) 
    170                             { 
    171                                 $_GET['cd'] = '5'; 
    172                             } 
     114            if(!$_GET['cd']) 
     115            { 
     116                $_GET['cd'] = '5'; 
     117            } 
    173118                } 
    174119                 
    175120                // don't get login data again when $submit is true 
    176                 if($submit == false) 
     121                if( $submit == false ) 
    177122                { 
    178123                        $login = $_POST['login']; 
    179124                } 
    180125                 
    181                 if(strstr($login,'@') === False && isset($_POST['logindomain'])) 
     126                if( strstr($login,'@') === False && isset($_POST['logindomain']) ) 
    182127                { 
    183128                        $login .= '@' . $_POST['logindomain']; 
     
    188133                } 
    189134                 
    190                 If(!$_GET['cd']) 
     135                if( !$_GET['cd'] ) 
     136                { 
    191137                        $GLOBALS['sessionid'] = $GLOBALS['phpgw']->session->create(strtolower($login),$passwd,$passwd_type,'u'); 
    192  
    193                 if(!isset($GLOBALS['sessionid']) || ! $GLOBALS['sessionid']) 
     138                } 
     139 
     140                if( !isset($GLOBALS['sessionid']) || ! $GLOBALS['sessionid'] ) 
    194141                { 
    195142                        If(!$_GET['cd']) $_GET['cd'] = $GLOBALS['phpgw']->session->cd_reason; 
     
    197144                else 
    198145                { 
    199                         if ($_POST['lang'] && preg_match('/^[a-z]{2}(-[a-z]{2}){0,1}$/',$_POST['lang']) && 
    200                             $_POST['lang'] != $GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) 
     146                        if( $_POST['lang'] && preg_match('/^[a-z]{2}(-[a-z]{2}){0,1}$/',$_POST['lang']) && 
     147                            $_POST['lang'] != $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] ) 
    201148                        { 
    202149                                $GLOBALS['phpgw']->preferences->add('common','lang',$_POST['lang'],'session'); 
     
    207154                                $GLOBALS['phpgw']->translation->autoload_changed_langfiles(); 
    208155                        } 
     156                         
    209157                        $forward = isset($_GET['phpgw_forward']) ? urldecode($_GET['phpgw_forward']) : @$_POST['phpgw_forward']; 
    210                         if (!$forward) 
     158                         
     159                        if ( !$forward ) 
    211160                        { 
    212161                                $extra_vars['cd'] = 'yes'; 
     
    217166                                list($forward,$extra_vars) = explode('?',$forward,2); 
    218167                        } 
    219                 if ($GLOBALS['phpgw_info']['server']['use_https'] != 2) 
    220                         { 
    221                         //Modificacao feita para que o Expresso redirecione para o primeiro proxy caso haja um encadeamento de mais de um proxy. 
    222                         //$forward = 'http://'.$_SERVER['HTTP_HOST'].($GLOBALS['phpgw']->link($forward.'?cd=yes')); 
    223                         $forward = 'http://' . nearest_to_me() . $GLOBALS['phpgw']->link($forward.'?cd=yes'); 
    224                         echo "<script language='Javascript1.3'>location.href='".$forward."'</script>"; 
    225                         } 
    226                 else 
    227                         { 
    228                         $GLOBALS['phpgw']->redirect_link($forward,$extra_vars); 
    229                         } 
    230                 } 
    231         } 
    232         //else   // ================================================================================= 
    233         //{ 
    234             $valor_contador = $_SESSION['contador']; 
    235             $valor_contador = $valor_contador + 1; 
    236             $_SESSION['contador'] = $valor_contador; 
    237                 // !!! DONT CHANGE THESE LINES !!! 
    238                 // If there is something wrong with this code TELL ME! 
    239                 // Commenting out the code will not fix it. (jengo) 
    240                 if(isset($_COOKIE['last_loginid'])) 
    241                 { 
    242                         $accounts = CreateObject('phpgwapi.accounts'); 
    243                         $prefs = CreateObject('phpgwapi.preferences', $accounts->name2id($_COOKIE['last_loginid'])); 
    244  
    245                         if($prefs->account_id) 
    246                         { 
    247                                 $GLOBALS['phpgw_info']['user']['preferences'] = $prefs->read_repository(); 
    248                         } 
    249                 } 
    250                  
    251                 $_GET['lang'] = addslashes($_GET['lang']); 
    252                 if ($_GET['lang']) 
    253                 { 
    254                         $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $_GET['lang']; 
    255                 } 
    256                 elseif(!isset($_COOKIE['last_loginid']) || !$prefs->account_id) 
    257                 { 
    258                         // If the lastloginid cookies isn't set, we will default to the first language, 
    259                         // the users browser accepts. 
    260                         list($lang) = explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']); 
    261                         /* 
    262                         if(strlen($lang) > 2) 
    263                         { 
    264                                 $lang = substr($lang,0,2); 
    265                         } 
    266                         */ 
    267                         $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $lang; 
    268                 } 
    269                 #print 'LANG:' . $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] . '<br>'; 
    270  
    271                 $GLOBALS['phpgw']->translation->init(); // this will set the language according to the (new) set prefs 
    272                 $GLOBALS['phpgw']->translation->add_app('login'); 
    273                 $GLOBALS['phpgw']->translation->add_app('loginscreen'); 
    274                 if(lang('loginscreen_message') == 'loginscreen_message*') 
    275                 { 
    276                         $GLOBALS['phpgw']->translation->add_app('loginscreen','en');    // trying the en one 
    277                 } 
    278                 if(lang('loginscreen_message') != 'loginscreen_message*') 
    279                 { 
    280                         $tmpl->set_var('lang_message',stripslashes(lang('loginscreen_message'))); 
    281                 } 
    282         //} 
    283  
    284         if($GLOBALS['phpgw_info']['server']['use_prefix_organization']) 
    285         { 
     168                         
     169                        if( $GLOBALS['phpgw_info']['server']['use_https'] != 2 ) 
     170                        { 
     171                                //Modificacao feita para que o Expresso redirecione para o primeiro proxy caso haja um encadeamento de mais de um proxy. 
     172                                //$forward = 'http://'.$_SERVER['HTTP_HOST'].($GLOBALS['phpgw']->link($forward.'?cd=yes')); 
     173                                $forward = 'http://' . nearest_to_me() . $GLOBALS['phpgw']->link($forward.'?cd=yes'); 
     174                                echo "<script language='Javascript1.3'>location.href='".$forward."'</script>"; 
     175                        } 
     176                        else 
     177                        { 
     178                                $GLOBALS['phpgw']->redirect_link($forward,$extra_vars); 
     179                        } 
     180                } 
     181        } 
     182 
     183        // Incrementar Contador para o Uso do Captcha 
     184    $_SESSION['contador_captcha']++; 
     185 
     186        // !!! DONT CHANGE THESE LINES !!! 
     187        // If there is something wrong with this code TELL ME! 
     188        // Commenting out the code will not fix it. (jengo) 
     189        if( isset( $_COOKIE['last_loginid'] ) ) 
     190        { 
     191                $accounts = CreateObject('phpgwapi.accounts'); 
     192 
     193                $prefs = CreateObject('phpgwapi.preferences', $accounts->name2id($_COOKIE['last_loginid'])); 
     194 
     195                if($prefs->account_id) 
     196                { 
     197                        $GLOBALS['phpgw_info']['user']['preferences'] = $prefs->read_repository(); 
     198                } 
     199        } 
     200         
     201        $_GET['lang'] = addslashes($_GET['lang']); 
     202         
     203        if ($_GET['lang']) 
     204        { 
     205                $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $_GET['lang']; 
     206        } 
     207        elseif(!isset($_COOKIE['last_loginid']) || !$prefs->account_id) 
     208        { 
     209                // If the lastloginid cookies isn't set, we will default to the first language, 
     210                // the users browser accepts. 
     211                list($lang) = explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']); 
     212                $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $lang; 
     213        } 
     214 
     215        $GLOBALS['phpgw']->translation->init(); // this will set the language according to the (new) set prefs 
     216        $GLOBALS['phpgw']->translation->add_app('login'); 
     217        $GLOBALS['phpgw']->translation->add_app('loginscreen'); 
     218 
     219        // OUs LDAP 
     220        $show_Organization = "none"; 
     221         
     222        if( $GLOBALS['phpgw_info']['server']['use_prefix_organization'] ) 
     223        { 
     224                $show_Organization = "block"; 
     225 
    286226                $obj_organization = CreateObject('phpgwapi.sector_search_ldap'); 
     227                 
    287228                $organizations = $obj_organization->organization_search($GLOBALS['phpgw_info']['server']['ldap_context']); 
    288  
    289         $organizations_count = count($organizations); 
    290                 for ($i=0; $i<$organizations_count; ++$i) 
     229                 
     230                for ($i=0; $i<count($organizations); $i++) 
    291231                { 
    292232                        $tmp_array[strtolower($organizations[$i])] = $organizations[$i];         
     
    294234                 
    295235                $arrayOrganization = $tmp_array;                 
     236                 
    296237                ksort($arrayOrganization); 
    297238                 
    298                 foreach($arrayOrganization 
    299                          as $organization_name => $organization_vars) 
     239                foreach($arrayOrganization as $organization_name => $organization_vars) 
    300240                { 
    301241                        $organization_select .= '<option value="' . $organization_name . '"'; 
    302242 
    303                         if($organization_name == $_COOKIE['last_organization']) 
     243                        if( $organization_name == $_COOKIE['last_organization'] ) 
    304244                        { 
    305245                                $organization_select .= ' selected'; 
     
    307247                        $organization_select .= '>' . $organization_vars . "</option>\n"; 
    308248                } 
    309                 $organization_select =  '<div class="login_label"><label>'.lang("organization") 
    310                                                         .'</label><br><select name="organization">' 
    311                                                         .$organization_select.'</select></div>'; 
     249 
    312250                $tmpl->set_var('select_organization',$organization_select); 
    313251        } 
     252 
     253        $tmpl->set_var( 'show_organization', $show_Organization ); 
    314254                 
    315255        $domain_select = '&nbsp;'; 
     256 
    316257        $last_loginid = $_COOKIE['last_loginid']; 
    317         if($GLOBALS['phpgw_info']['server']['show_domain_selectbox']) 
     258         
     259        if( $GLOBALS['phpgw_info']['server']['show_domain_selectbox'] ) 
    318260        { 
    319261                $domain_select = "<select name=\"logindomain\">\n"; 
     262                 
    320263                foreach($GLOBALS['phpgw_domain'] as $domain_name => $domain_vars) 
    321264                { 
     
    333276        { 
    334277                reset($GLOBALS['phpgw_domain']); 
     278                 
    335279                list($default_domain) = each($GLOBALS['phpgw_domain']); 
    336280 
     
    340284                } 
    341285        } 
     286 
    342287        $tmpl->set_var('select_domain',$domain_select); 
    343288 
    344         foreach($_GET as $name => $value) 
    345         { 
    346                 if(preg_match('/phpgw_/',$name)) 
     289        foreach($_GET as $name => $value) 
     290        { 
     291                if(ereg('phpgw_',$name)) 
    347292                { 
    348293                        $extra_vars .= '&' . $name . '=' . urlencode($value); 
     
    350295        } 
    351296 
    352         if ( is_string( $extra_vars ) ) 
     297        if( is_string( $extra_vars ) ) 
    353298        { 
    354299                $extra_vars = '?' . substr($extra_vars,1); 
     
    364309        $config_reg = $cnf_reg->config_data; 
    365310 
    366         if($config_reg['enable_registration']=='True' && $config_reg['register_link']=='True') 
     311        if($config_reg[enable_registration]=='True' && $config_reg[register_link]=='True') 
    367312        { 
    368313                $reg_link='&nbsp;<a href="registration/">'.lang('Not a user yet? Register now').'</a><br/>'; 
     
    370315 
    371316        $template = $GLOBALS['phpgw_info']['login_template_set']; 
     317 
    372318        $GLOBALS['phpgw_info']['server']['template_set'] = $template; 
    373319 
     
    387333        $tmpl->set_var('template_set', $template); 
    388334 
    389         // loads the template's login.css 
    390         // and then the theme's login.css (if any) 
    391         $template_dir = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/' . $template; 
    392         $login_dir = $template_dir . '/login.css'; 
    393         $login_css = "<link href='" . $login_dir . "' rel='stylesheet' type='text/css' />"; 
    394         $login_dir = $template_dir . '/themes/' . $GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] . '/login.css'; 
    395         if(file_exists('./'.$login_dir)) 
    396         { 
    397                 $login_css .= "<link href='" . $login_dir . "' rel='stylesheet' type='text/css' />"; 
    398         } 
    399         $tmpl->set_var('login_css',$login_css); 
    400  
    401         $GLOBALS['phpgw']->translation->add_app('loginhelp',$_GET['lang']); 
    402  
    403         if(lang('loginhelp_message') != 'loginhelp_message*' && trim(lang('loginhelp_message')) != ""){                                  
    404                 $tmpl->set_var('lang_help',lang("Help"));        
    405         } 
    406         else  
    407                 $tmpl->set_var('display_help','none'); 
    408  
    409         $tmpl->set_var('bg_color',($GLOBALS['phpgw_info']['server']['login_bg_color']?$GLOBALS['phpgw_info']['server']['login_bg_color']:'FFFFFF')); 
    410         $tmpl->set_var('bg_color_title',($GLOBALS['phpgw_info']['server']['login_bg_color_title']?$GLOBALS['phpgw_info']['server']['login_bg_color_title']:'486591')); 
    411  
    412         if($GLOBALS['phpgw_info']['server']['use_frontend_name']) 
    413                 $tmpl->set_var('frontend_name', " - ".$GLOBALS['phpgw_info']['server']['use_frontend_name']); 
    414  
    415         if (substr($GLOBALS['phpgw_info']['server']['login_logo_file'],0,4) == 'http') 
    416         { 
    417                 $var['logo_file'] = $GLOBALS['phpgw_info']['server']['login_logo_file']; 
    418         } 
    419         else 
    420         { 
    421                 $var['logo_file'] = $GLOBALS['phpgw']->common->image('phpgwapi',$GLOBALS['phpgw_info']['server']['login_logo_file']?$GLOBALS['phpgw_info']['server']['login_logo_file']:'logo'); 
    422         } 
    423         $var['logo_url'] = $GLOBALS['phpgw_info']['server']['login_logo_url']?$GLOBALS['phpgw_info']['server']['login_logo_url']:'http://www.eGroupWare.org'; 
    424         if (substr($var['logo_url'],0,4) != 'http') 
    425         { 
    426                 $var['logo_url'] = 'http://'.$var['logo_url']; 
    427         } 
    428         $var['logo_title'] = $GLOBALS['phpgw_info']['server']['login_logo_title']?$GLOBALS['phpgw_info']['server']['login_logo_title']:'www.eGroupWare.org'; 
    429         $tmpl->set_var($var); 
    430  
    431         if (!@$GLOBALS['phpgw_info']['server']['login_virtual_keyboard'])  
    432                 $tmpl->set_var('show_kbd','none');  
    433  
    434         if (@$GLOBALS['phpgw_info']['server']['login_show_language_selection']) 
    435         { 
    436                 $select_lang = '<select name="lang" onchange="'."location.href=location.href+(location.search?'&':'?')+'lang='+this.value".'">'; 
    437                 $langs = $GLOBALS['phpgw']->translation->get_installed_langs(); 
    438                 uasort($langs,'strcasecmp'); 
    439                 foreach ($langs as $key => $name)       // if we have a translation use it 
    440                 { 
    441                         $select_lang .= "\n\t".'<option value="'.$key.'"'.($key == $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] ? ' selected="1"' : '').'>'.$name.'</option>'; 
    442                 } 
    443                 $select_lang .= "\n</select>\n"; 
    444                 $tmpl->set_var(array( 
    445                         'lang_language' => lang('Language'), 
    446                         'select_language' => $select_lang, 
    447                 )); 
    448         } 
    449         else 
    450         { 
    451                 $tmpl->set_block('login_form','language_select'); 
    452                 $tmpl->set_var('language_select',''); 
    453         } 
     335        // Keyboard Virtual 
     336        $tmpl->set_var('show_kbd',$GLOBALS['phpgw_info']['server']['login_virtual_keyboard']);  
    454337 
    455338        $tmpl->set_var('autocomplete', ($GLOBALS['phpgw_info']['server']['autocomplete_login'] ? 'autocomplete="off"' : '')); 
     
    458341        if($GLOBALS['phpgw_info']['server']['captcha'] && $_GET['cd']!='300' ) 
    459342        { 
    460                 $aux_captcha = '<input type="hidden" name="' . session_name() . '"  value="' . session_id() . '" >'; 
    461         //        setcookie(session_name(),base64_encode(session_convert($key_convert . session_id(),$key_convert)),0); 
    462                 if($valor_contador > $GLOBALS['phpgw_info']['server']['num_badlogin']) 
    463                 { 
    464                         $aux_captcha = '<div class="login_label" > 
    465                            <img id="id_captcha" src="./security/captcha.php?' . session_name() . '=' . session_id() . '" title="'.lang('Security code').'" alt="'.lang('Security code').'" style="position:static;"> 
    466                            <input class="input" type="text" maxlength="50" size="20" name="codigo" id="codigo" value="" > 
    467                            <input type="hidden" name="' . session_name() . '"  value="' . session_id() . '" > 
    468                            </div>'; 
    469                 } 
    470         } 
    471         $tmpl->set_var('captcha',$aux_captcha); 
     343                $aux_captcha = '<input type="hidden" name="'.session_name().'"  value="'.session_id().'">'; 
     344 
     345                if( $_SESSION['contador_captcha'] > $GLOBALS['phpgw_info']['server']['num_badlogin'] ) 
     346                { 
     347                        $aux_captcha = '<div>' 
     348                           .'<img id="id_captcha" src="./security/captcha.php?' . session_name() . '=' . session_id() . '" title="'.lang('Security code').'" alt="'.lang('Security code').'" style="position:static;">' 
     349                           .'<input class="input" type="text" maxlength="50" size="15" name="codigo" id="codigo" value="" >' 
     350                           .'<input type="hidden" name="' . session_name() . '"  value="' . session_id() . '" >' 
     351                           .'</div>'; 
     352                } 
     353 
     354                $tmpl->set_var('captcha',$aux_captcha); 
     355        } 
    472356 
    473357        // Testa se deve incluir applet para login com certificado...... 
    474         if ($_GET['cd']=='300' && $GLOBALS['phpgw_info']['server']['certificado']==1) 
     358        if ( $_GET['cd']=='300' && $GLOBALS['phpgw_info']['server']['certificado'] == 1 ) 
    475359        { 
    476360                //Zera o Cookie contador, responsavel pelo captcha 
    477                 $_SESSION['contador'] = 0; 
    478                 $valor_contador = 0; 
    479                 $link_alterna_login = '<img src="phpgwapi/templates/news/images/warning.gif"/><a href="login.php">' . lang('Access without Digital Certificate') . '</a>'; 
     361                $_SESSION['contador_captcha'] = 0; 
     362                $link_alterna_login = '<img src="phpgwapi/templates/default/images/warning.gif"/><a href="login.php">' . lang('Access without Digital Certificate') . '</a>'; 
    480363                $tmpl->set_var('show','none'); 
    481                 $tmpl->set_var('action','<div id="action"><img style="border:0px;margin:31px 0px 58px 0px;" src="phpgwapi/templates/news/images/acao.gif" /></div>'); 
     364                $tmpl->set_var('action','<div id="action"><img style="border:0px;margin:31px 0px 58px 0px;" src="phpgwapi/templates/default/images/acao.gif" /></div>'); 
    482365                // gera parametro com tokens suportados .... 
    483366                $var_tokens = ''; 
    484                 for($ii = 1; $ii < 11; ++$ii) 
     367                 
     368                for($ii = 1; $ii < 11; $ii++) 
    485369                { 
    486370                        if($GLOBALS['phpgw_info']['server']['test_token' . $ii . '1']) 
     
    492376                        $var_tokens = 'ePass2000Lx;/usr/lib/libepsng_p11.so,ePass2000Win;c:/windows/system32/ngp11v211.dll'; 
    493377                } 
    494                 $param1 = " 
    495                                                                                         '<param name=\"token\" value=\"" . substr($var_tokens,0,strlen($var_tokens)) . "\"> ' + 
    496                                                                                    "; 
    497                 $param2 = " 
    498                                                                                         'token=\"" . substr($var_tokens,0,strlen($var_tokens)) . "\" ' + 
    499                                                                                    "; 
     378                 
     379                $param1 = "'<param name=\"token\" value=\"" . substr($var_tokens,0,strlen($var_tokens)) . "\">'+"; 
     380                $param2 = "'token=\"" . substr($var_tokens,0,strlen($var_tokens)) . "\" ' +"; 
    500381 
    501382                $cod_applet = 
    502  
    503 /*    // com debug ativado 
    504             '<script type="text/javascript"> 
    505                                         if (navigator.userAgent.match(\'MSIE\')){ 
    506                                                 document.write(\'<object style="display:yes;width:0;height:0;vertical-align:bottom;" id="login_applet" \' + 
    507                                                 \'classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"> \' + 
    508                                                 \'<param name="type" value="application/x-java-applet;version=1.5"> \' + 
    509                                                 \'<param name="code" value="LoginApplet.class"> \' + 
    510                                                 \'<param name="locale" value="' . $lang . '"> \' + 
    511                                                 \'<param name="mayscript" value="true"> \' + ' 
    512                                                 . $param1 
    513                                                 . ' \'<param name="archive" value="ExpressoCertLogin.jar,ExpressoCert.jar,commons-httpclient-3.1.jar,commons-logging-1.1.1.jar,commons-codec-1.3.jar,bcmail-jdk15-142.jar,mail.jar,activation.jar,bcprov-jdk15-142.jar"> \' + 
    514                         \'<param name="debug" value="true"> \' + 
    515                                                 \'</object>\'); 
    516                                         } 
    517                                         else { 
    518                                                 document.write(\'<embed style="display:yes;width:0;height:0;vertical-align:bottom;" id="login_applet" code="LoginApplet.class" locale="' . $lang . '"\' + 
    519                                                 \'archive="ExpressoCertLogin.jar,ExpressoCert.jar,commons-httpclient-3.1.jar,commons-logging-1.1.1.jar,commons-codec-1.3.jar,bcmail-jdk15-142.jar,mail.jar,activation.jar,bcprov-jdk15-142.jar" \' + ' 
    520                                                 . $param2 
    521                                                 . ' \'type="application/x-java-applet;version=1.5" debug= "true" mayscript > \' + 
    522                                                 \'<noembed> \' + 
    523                                                 \'No Java Support. \' + 
    524                                                 \'</noembed> \' + 
    525                                                 \'</embed> \'); 
    526                                         } 
    527                                 </script>'; 
    528 */ 
    529383            // sem debug ativado 
    530384            '<script type="text/javascript"> 
     
    553407                                </script>'; 
    554408 
    555  
    556         } 
    557  
     409        } 
    558410        else 
    559411        { 
     
    561413                { 
    562414                        $tmpl->set_var('show','yes'); 
    563                         $link_alterna_login = '<img src="phpgwapi/templates/news/images/lock1_icon.gif"/><a title="' . lang('Link to use digital certificate') . '" href="login.php?cd=300">' . lang('Logon with my digital certificate') . '</a>'; 
     415                        $link_alterna_login = '<img src="phpgwapi/templates/default/images/lock1_icon.gif"/><a title="' . lang('Link to use digital certificate') . '" href="login.php?cd=300">' . lang('Logon with my digital certificate') . '</a>'; 
    564416                } 
    565417                $tmpl->set_var('lang_username',lang('username')); 
    566418                $tmpl->set_var('action',''); 
    567419                $cod_applet = ''; 
    568  
    569420        } 
    570421 
    571422        $tmpl->set_var('applet',$cod_applet); 
    572423        $tmpl->set_var('link_alterna_login',$link_alterna_login); 
    573                  
    574         // Load News from NewsAdmin module - BEGIN 
    575         define('PHPGW_TEMPLATE_DIR','./phpgwapi/templates/'.$GLOBALS['phpgw_info']['login_template_set']); 
    576         $news = CreateObject('news_admin.uinews'); 
    577         $public_news = $news->bo->get_all_public_news(); 
    578         rsort($public_news);     
    579         $newslist = array(); 
    580         foreach($public_news as $i => $news){ 
    581                 $newslist[] = array_map('utf8_encode', $news); 
    582         } 
    583         $tmpl->set_var('public_news',json_encode($newslist)); 
    584         $tmpl->set_var('lang_previous',lang('Previous')); 
    585         $tmpl->set_var('lang_next',lang('Next')); 
    586         $tmpl->set_var('lang_pause',lang('Pause')); 
    587         $tmpl->set_var('lang_resume',lang('Resume')); 
    588          
    589         // Load News from NewsAdmin module - END 
    590          
     424 
    591425        $tmpl->set_var('dir_root', 'http://' . nearest_to_me() . '/'); 
    592426        if(is_file(dirname( __FILE__ ) . '/../../../infodist/ultima-revisao-svn.php')) 
     
    594428        if(isset($ultima_revisao)) $tmpl->set_var('ultima_rev','<br>' . $ultima_revisao); 
    595429 
    596         // Adiciona código personalizado de outro template 
     430        // Adiciona código personalizado de outro template 
    597431        // que esteja utilizando o login_default.php 
    598         if(is_file('.'.$template_dir.'/login.inc.php')) { 
     432        if(is_file('.'.$template_dir.'/login.inc.php')) 
     433        { 
    599434                include_once('.'.$template_dir.'/login.inc.php'); 
    600435        } 
    601436 
    602437        $tmpl->pfp('loginout','login_form'); 
    603         } 
    604438 
    605439?> 
    606  
Note: See TracChangeset for help on using the changeset viewer.