Changeset 8232 for branches/2.5/phpgwapi


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.

Location:
branches/2.5/phpgwapi
Files:
62 added
26 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • branches/2.5/phpgwapi/inc/class.preferences.inc.php

    r7655 r8232  
    567567                                        $value = $this->db->db_addslashes(serialize($value));   // this addslashes is for the database 
    568568                                        $app = $this->db->db_addslashes($app); 
    569  
     569                                        if ($this->db->Type == "pgsql" && isset($value['signature'])){ 
     570                                                $value['signature'] = pg_escape_string($value['signature']);                                                     
     571                                        } 
    570572                                        $this->db->query($sql = "INSERT INTO phpgw_preferences" 
    571573                                                . " (preference_owner,preference_app,preference_value)" 
  • branches/2.5/phpgwapi/setup/setup.inc.php

    r7917 r8232  
    1414        $setup_info['phpgwapi']['name']      = 'phpgwapi'; 
    1515        $setup_info['phpgwapi']['title']     = 'API'; 
    16         $setup_info['phpgwapi']['version']   = '2.5.1'; 
    17         $setup_info['phpgwapi']['versions']['current_header'] = '2.5.0'; 
     16        $setup_info['phpgwapi']['version']   = '2.5.1.0'; 
     17        $setup_info['phpgwapi']['versions']['current_header'] = '2.5.1'; 
    1818        $setup_info['phpgwapi']['enable']    = 3; 
    1919        $setup_info['phpgwapi']['app_order'] = 1; 
     
    4141        $setup_info['phpgwapi']['tables'][]  = 'phpgw_history_log'; 
    4242        $setup_info['phpgwapi']['tables'][]  = 'phpgw_async'; 
    43  
    44  
    45  
    46  
  • branches/2.5/phpgwapi/setup/tables_baseline.inc.php

    r2 r8232  
    108108                                'sessionid' => array('type' => 'varchar', 'precision' => 30), 
    109109                                'loginid' => array('type' => 'varchar', 'precision' => 30), 
    110                                 'ip' => array('type' => 'varchar', 'precision' => 30), 
     110                                'ip' => array('type' => 'varchar', 'precision' => 255), 
    111111                                'li' => array('type' => 'int', 'precision' => 4), 
    112112                                'lo' => array('type' => 'int', 'precision' => 4) 
  • branches/2.5/phpgwapi/setup/tables_update.inc.php

    r7917 r8232  
    2020                $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0.008'; 
    2121                return $GLOBALS['setup_info']['phpgwapi']['currentver']; 
    22  
    2322        } 
    2423         
     
    2827                $GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.0.0.pre-alpha'; 
    2928                return $GLOBALS['setup_info']['phpgwapi']['currentver']; 
    30  
    3129        } 
    3230 
     
    176174                return $GLOBALS['setup_info']['phpgwapi']['currentver']; 
    177175        } 
    178     $test[] = '2.4.2';  
    179     function phpgwapi_upgrade2_4_2()  
    180     {  
    181             $GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.5.0';  
    182             return $GLOBALS['setup_info']['phpgwapi']['currentver'];  
    183     }  
    184   
    185     $test[] = '2.5.0';  
    186         function phpgwapi_upgrade2_5_0()  
    187         {  
    188                 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.5.1';  
    189                 global $setup_info,$phpgw_setup;  
    190                 $phpgw_setup->oProc->query("ALTER TABLE phpgw_access_log ALTER COLUMN ip TYPE character varying(255) ");  
    191   
    192                 return $GLOBALS['setup_info']['phpgwapi']['currentver'];  
    193         }  
    194       
    195  
     176    $test[] = '2.4.2'; 
     177    function phpgwapi_upgrade2_4_2() 
     178    { 
     179        $GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.5.0'; 
     180        return $GLOBALS['setup_info']['phpgwapi']['currentver']; 
     181    } 
     182 
     183    $test[] = '2.5.0'; 
     184        function phpgwapi_upgrade2_5_0() 
     185        { 
     186        $GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.5.1'; 
     187        global $setup_info,$phpgw_setup; 
     188        $phpgw_setup->oProc->query("ALTER TABLE phpgw_access_log ALTER COLUMN ip TYPE character varying(255) "); 
     189 
     190        return $GLOBALS['setup_info']['phpgwapi']['currentver']; 
     191        } 
     192 
     193    $test[] = '2.5.1'; 
     194    function phpgwapi_upgrade2_5_1() 
     195    { 
     196        global $phpgw_setup; 
     197 
     198        $phpgw_setup->oProc->query( 'select * from information_schema.tables where table_name= \'phpgw_vfs\''); 
     199        if( !$phpgw_setup->oProc->next_record() ) 
     200        { 
     201            $phpgw_setup->oProc->CreateTable('phpgw_vfs', array( 
     202                'fd' => array( 
     203                    'file_id' => array('type' => 'auto','nullable' => False), 
     204                    'owner_id' => array('type' => 'int','precision' => '4','nullable' => False), 
     205                    'createdby_id' => array('type' => 'int','precision' => '4'), 
     206                    'modifiedby_id' => array('type' => 'int','precision' => '4'), 
     207                    'created' => array('type' => 'timestamp','nullable' => False,'default' => '1970-01-01'), 
     208                    'modified' => array('type' => 'timestamp'), 
     209                    'size' => array('type' => 'int','precision' => '4'), 
     210                    'mime_type' => array('type' => 'varchar','precision' => '64'), 
     211                    'deleteable' => array('type' => 'char','precision' => '1','default' => 'Y'), 
     212                    'comment' => array('type' => 'varchar','precision' => '255'), 
     213                    'app' => array('type' => 'varchar','precision' => '25'), 
     214                    'directory' => array('type' => 'varchar','precision' => '255'), 
     215                    'name' => array('type' => 'varchar','precision' => '128','nullable' => False), 
     216                    'link_directory' => array('type' => 'varchar','precision' => '255'), 
     217                    'link_name' => array('type' => 'varchar','precision' => '128'), 
     218                    'version' => array('type' => 'varchar','precision' => '30','nullable' => False,'default' => '0.0.0.0'), 
     219                    'content' => array('type' => 'longtext') 
     220                ) 
     221            )); 
     222        } 
     223 
     224        $GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.5.1.0'; 
     225        return $GLOBALS['setup_info']['phpgwapi']['currentver']; 
     226    } 
    196227?> 
  • branches/2.5/phpgwapi/templates/default/css/azul.css

    r7531 r8232  
    154154{ 
    155155        background: url( ../../../../phpgwapi/templates/default/images/logo_expresso.jpg ) no-repeat 0 3px; 
     156        /*background: url( ../../../../phpgwapi/templates/default/images/logo_expresso.png ) no-repeat 0 3px;*/ 
    156157} 
    157158 
     
    178179{ 
    179180        background-image: url(../../../../phpgwapi/templates/default/images/back_app.png); 
     181        /*background-image: url(../../../../phpgwapi/templates/default/images/back_app_1.png);*/ 
    180182} 
    181183 
     
    183185{ 
    184186        background-image: url( ../../../../phpgwapi/templates/default/images/back_app_over.png ); 
     187        /*background-image: url( ../../../../phpgwapi/templates/default/images/back_app_over_1.png );*/  
    185188} 
    186189 
     
    188191{ 
    189192        background-image: url( ../../../../phpgwapi/templates/default/images/back_app_out.png ); 
     193        /*background-image: url( ../../../../phpgwapi/templates/default/images/back_app_out_1.png );*/ 
    190194} 
    191195 
     
    203207{ 
    204208        background-image: url( ../../../../phpgwapi/templates/default/images/fundo_topo.png ); 
     209        /*background-image: url( ../../../../phpgwapi/templates/default/images/fundo_topo_2.png );*/     
    205210} 
    206211 
  • branches/2.5/phpgwapi/templates/default/css/base.css

    r5754 r8232  
    262262.logo_expresso 
    263263{ 
    264         width: 191px; 
     264        /*width: 191px;*/ 
     265        width: 273px; 
    265266} 
    266267 
  • branches/2.5/phpgwapi/templates/default/navbar.tpl

    r4463 r8232  
    8787 
    8888<div class="toolbar" id="toolbar" style="visibility:hidden"> 
    89 <table border="0" height="50px" width="100%" cellpadding=0 cellspacing=0><tr> 
     89<table border="0" height="50px" width="93%" cellpadding=0 cellspacing=0><tr> 
    9090        <td class="logo_expresso">&nbsp;<br></td> 
    9191        <td align="center"> 
  • branches/2.5/phpgwapi/templates/news/login.tpl

    r5159 r8232  
    1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
    2 <HTML> 
     1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
     2<html> 
    33<!-- BEGIN login_form --> 
    4 <HEAD> 
    5 <META http-equiv="Content-Type" content="text/html; charset={charset}"> 
    6 <META name="AUTHOR" content="dGroupWare http://www.eGroupWare.org"> 
    7 <META NAME="description" CONTENT="{website_title} login screen, working environment powered by eGroupWare"> 
    8 <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"> 
    9 <META NAME="keywords" CONTENT="{website_title} login screen, eGroupWare, groupware, groupware suite"> 
    10 {login_css} 
    11 <TITLE>{website_title} - {lang_login}</TITLE> 
    12 <script src="./phpgwapi/templates/{template}/js/hash.js" type="text/javascript"></script> 
    13 <script src="./phpgwapi/templates/{template}/js/news.js" type="text/javascript"></script> 
    14 <script language="Javascript"> 
    15 <!-- 
    16  
    17         function setLogin(){ 
    18                 if( document.flogin.organization != null) 
    19                         document.flogin.login.value = document.flogin.organization.value+'-'+document.flogin.user.value; 
    20                 else 
    21                         document.flogin.login.value = document.flogin.user.value;                        
    22         } 
    23          
    24         function getLogin(){ 
    25                 var cookie = '{cookie}'; 
    26                 if( document.flogin.organization != null) 
    27                         document.flogin.user.value= cookie.substring(cookie.indexOf('-')+1,cookie.length); 
    28                 else     
    29                         document.flogin.user.value= cookie; 
    30  
    31                 if(document.flogin.user.value == '') { 
    32                         if(document.flogin.organization != null) 
    33                                 document.flogin.organization.focus(); 
    34                         else 
    35                                 document.flogin.user.focus(); 
    36                 } 
    37                 else 
    38                         document.flogin.passwd.focus(); 
    39         } 
    40          
    41         function openWindow(newWidth,newHeight,link) {                                   
    42                 newScreenX  = screen.width - newWidth;   
    43                 newScreenY  = 0;                 
    44                 Window1=window.open('{dir_root}'+link,'',"width="+newWidth+",height="+newHeight+",screenX="+newScreenX+",left="+newScreenX+",screenY="+newScreenY+",top="+newScreenY+",toolbar=no,scrollbars=yes,resizable=no"); 
    45         } 
    46         var opened = false, vkb = null, text = null;  
    47         var userstr = navigator.userAgent.toLowerCase();  
    48         var safari = (userstr.indexOf('applewebkit') != -1);  
    49         var gecko  = (userstr.indexOf('gecko') != -1) && !safari;  
    50         function loadvkbd(){  
    51                 if(typeof(VKeyboard) == 'function')  
    52                         keyb_change();  
    53                 else  
    54                 {  
    55                         vkbdscript=document.createElement('SCRIPT');  
    56                         vkbdscript.src="phpgwapi/js/jscode/vkboards.js";  
    57                         vkbdscript.onload = keyb_change;  
    58                         if(gecko || window.opera || safari)  
    59                                 vkbdscript.onload = keyb_change;  
    60                         else  
    61                                 setTimeout('keyb_change()',3000);   
    62                         document.body.appendChild(vkbdscript);  
    63                 }  
    64         }  
    65   
    66    var opened = false, vkb = null, text = null;  
    67   
    68    function keyb_change()  
    69    {  
    70      opened = !opened;  
    71   
    72      if(opened && !vkb)  
    73      {  
    74        vkb = new VKeyboard("keyboard",    // container's id  
    75                            keyb_callback, // reference to the callback function  
    76                            false,          // create the arrow keys or not? (this and the following params are optional)  
    77                            false,          // create up and down arrow keys?   
    78                            false,         // reserved  
    79                            false,          // create the numpad or not?  
    80                            "",            // font name ("" == system default)  
    81                            "14px",        // font size in px  
    82                            "#FFF",        // font color  
    83                            "#F00",        // font color for the dead keys  
    84                            "#83a6ce",        // keyboard base background color  
    85                            "#28599e",        // keys' background color  
    86                            "#DDD",        // background color of switched/selected item  
    87                            "#777",        // border color  
    88                            "#CCC",        // border/font color of "inactive" key (key with no value/disabled)  
    89                            "#83a6ce",        // background color of "inactive" key (key with no value/disabled)  
    90                            "#F77",        // border color of the language selector's cell  
    91                            true,          // show key flash on click? (false by default)  
    92                            "#CC3300",     // font color during flash  
    93                            "#FF9966",     // key background color during flash  
    94                            "#CC3300",     // key border color during flash  
    95                            false,         // embed VKeyboard into the page?  
    96                            true,          // use 1-pixel gap between the keys?  
    97                            0);            // index(0-based) of the initial layout  
    98      }  
    99      else  
    100        vkb.Show(opened);  
    101   
    102      text = document.getElementById("passwd");  
    103      text.focus();  
    104      if (!(gecko || window.opera || safari))  
    105      {  
    106         document.getElementById('keyboard').style.left = "0px";  
    107         document.getElementById('rodape').style.zIndex="-100";  
    108      }  
    109   
    110    }  
    111    // Callback function:  
    112    function keyb_callback(ch)  
    113    {  
    114      var val = text.value;  
    115   
    116      switch(ch)  
    117      {  
    118        case "BackSpace":  
    119          var min = (val.charCodeAt(val.length - 1) == 10) ? 2 : 1;  
    120          text.value = val.substr(0, val.length - min);  
    121          break;  
    122   
    123        case "Enter":  
    124          document.getElementById('loginForm').submit();  
    125          break;  
    126   
    127        default:  
    128          text.value += ch;  
    129      }  
    130    }  
    131  function setRange(ctrl, start, end){  
    132  }       
    133  var news = new News({public_news}); 
    134         --> 
    135 </script> 
    136 </HEAD> 
    137 <body scroll="no"  style="overflow:hidden" onLoad="javascript:getLogin();news.start(4000)" bgcolor="#ffffff"> 
    138 <form id="loginForm" name="flogin" method="post" action="{login_url}" {autocomplete}> 
    139 <div id="conteudo"> 
    140 <div style="position: absolute; top:0px; right: 10px;"><span class="login_label">{lang_language}&nbsp;&nbsp;</span>{select_language}</div> 
    141 <div align="center"> 
    142         <div id="conteudo_corpo"> 
    143                 <div id="superior"> 
    144                         <div id="news"> 
    145                                 <div id="news_block">                            
    146                                         <b><div id="news_subject"></div></b><div id="news_content"></div> 
     4        <head> 
     5                <title>{website_title} - {lang_login}</title> 
     6                <meta http-equiv="Content-Type" content="text/html; charset={charset}"> 
     7                <meta name="AUTHOR" content="dGroupWare http://www.eGroupWare.org"> 
     8                <meta NAME="description" CONTENT="{website_title} login screen, working environment powered by eGroupWare"> 
     9                <meta NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"> 
     10                <meta NAME="keywords" CONTENT="{website_title} login screen, eGroupWare, groupware, groupware suite">                    
     11                <link rel="stylesheet" type="text/css" href="./phpgwapi/templates/news/css/login.css"/> 
     12                <link rel="stylesheet" type="text/css" href="./prototype/plugins/jquery/jquery-ui.css" /> 
     13                <link rel="stylesheet" type="text/css" href="./prototype/plugins/jquery.keyboard/jquery.keypad.css">             
     14                <!-- JavaScript --> 
     15                <script type="text/javascript" src="./prototype/plugins/jquery/jquery.min.js"></script> 
     16                <script type="text/javascript" src="./prototype/plugins/jquery/jquery-ui.min.js"></script> 
     17                <script type="text/javascript" src="./prototype/plugins/jquery/jquery-ui.custom.min.js"></script> 
     18                <script type="text/javascript" src="./prototype/plugins/ejs/ejs.js"></script> 
     19                <script type="text/javascript" src="./prototype/plugins/ejs/ejs_production.js"></script> 
     20                <script type="text/javascript" src="./prototype/plugins/ejs/view.js"></script> 
     21                <script type="text/javascript" src="./prototype/plugins/jquery.cycle/jquery.cycle.js"></script> 
     22                <script type="text/javascript" src="./prototype/plugins/jquery.keyboard/jquery.keypad.js"></script> 
     23                <script type="text/javascript" src="./prototype/plugins/jquery.keyboard/jquery.keypad-pt-BR.js"></script>                
     24                <script type="text/javascript" src="./phpgwapi/templates/news/js/slider.js"></script> 
     25                <script type="text/javascript" src="./phpgwapi/templates/news/js/loginExpresso.js"></script> 
     26        </head> 
     27        <body> 
     28                <div id="container"> 
     29                        <div id="main"> 
     30                                <div id="login"> 
     31                                        <h1 id="logo-expresso">Expresso Livre</h1> 
     32                                        <form id="loginForm" name="flogin" method="post" action="{login_url}" {autocomplete}> 
     33                                                <input type="hidden" name="passwd_type" value="text"> 
     34                                        <input type="hidden" name="account type" value="u"> 
     35                                        <input type="hidden" name="login"> 
     36                                        <input type="hidden" name="show_kbd" value="{show_kbd}"> 
     37                                        <div style="display:{show_organization}">        
     38                                                        <label for="organizacao">Organização</label> 
     39                                                        <select name="organizacao" id="organizacao">{select_organization}</select> 
     40                                                </div> 
     41                                                <div id="captcha"> 
     42                                                        {captcha} 
     43                                                </div> 
     44                                                <label for="user">{lang_username}</label> 
     45                                                <input type="text" name="user" id="user"  value="{cookie}"/> 
     46                                                <label for="passwd">{lang_password}</label> 
     47                                                <input type="password" name="passwd" id="passwd" value=""/> 
     48                                                <br/> 
     49                                                <input type="submit" name="submitit" id="submitit" value="{lang_login}" onclick="loginExpresso.setLogin();" /> 
     50                                        </form> 
     51                                        <div id="keyboard"></div> 
     52                                        <div id="msg-login" class="sucesso" style="display:none;">{cd}</div> 
    14753                                </div> 
    148                                 <img onmouseover="this.className='news_button_over'" onmouseout="this.className='news_button'" class="news_button" onclick="javascript:news.update('previous')" title="{lang_previous}" src="./phpgwapi/templates/{template}/images/player-previous.png"/> 
    149                         <img onmouseover="this.className='news_button_over'" onmouseout="this.className='news_button'" class="news_button" onclick="javascript:news.pause()" title="{lang_pause}" src="./phpgwapi/templates/{template}/images/player-pause.png" id="img_player_pause" /> 
    150                         <img onmouseover="this.className='news_button_over'" onmouseout="this.className='news_button'" style="display:none" class="news_button" onclick="javascript:news.pause()" title="{lang_resume}" src="./phpgwapi/templates/{template}/images/player-resume.png" id="img_player_resume" /> 
    151                                 <img onmouseover="this.className='news_button_over'" onmouseout="this.className='news_button'" class="news_button"  onclick="javascript:news.update('next')" title="{lang_next}" src="./phpgwapi/templates/{template}/images/player-next.png"/>                                          
     54                                <div id="informacao-login"></div> 
    15255                        </div> 
    153                 <div id="login"> 
    154       <div align="center"> 
    155 <input type="hidden" name="passwd_type" value="text"> 
    156 <input type="hidden" name="account type" value="u"> 
    157 <input type="hidden" name="login"> 
    158 <div id="caixa_login"> 
    159           <div id="reflexo"> 
    160            <div class="titulo_login">Expresso Livre</div> 
    161            <div id="mensagem" class="msgInicial" >{cd}<br>{lang_message}</div> 
    162            {action} 
    163             <div id="conteudo_login" style="display:{show};">{select_organization} 
    164               <div class="login_label"> 
    165                 <label for="usuario">{lang_username}</label> 
    166                 <br /> 
    167                 <input class="input" type="text" maxlength="70" size="20" name="user" id="user" value=""> 
    168               </div> 
    169  
    170               <div class="login_label"> 
    171                 <label for="senha">{lang_password}</label> 
    172                 <br /> 
    173                 <input class="input" type="password" maxlength="50" size="20" name="passwd" id="passwd" value=""> 
    174                 <div id="keyboard"></div> 
    175               </div> 
    176                 {captcha} 
    177        
    178               <input value="{lang_login}" name="submitit" class="button" onclick="javascript:setLogin()" type="submit" style="margin-top:10px"/> 
    179               <img style="display:{show_kbd};" src="phpgwapi/templates/default/images/keyboard.png" alt="virtualkeyboard" title="virtualkeyboard" onclick="loadvkbd()" />  
    180             </div>  
    181                         <div id="alterna_login"> 
    182                          {link_alterna_login} 
    183                         </div> 
    184           </div> 
    185           <div id="rodape_login"> 
    186                 <div class="ajuda" style="display:{display_help}"> 
    187                                 <img src="./phpgwapi/templates/{template}/images/help.png"/> 
    188                                 <a title="{lang_help}" target="help" href="./help.php?lang={lang}">{lang_help}</a> 
    189                         </div> 
    190           </div> 
    191         </div> 
    192 </form> 
    193 </div> 
    194 </div> 
    195 </div> 
    196 <div id="inferior"><br /> 
    197 <div id="rodape"> 
    198 <table align="center" cellspacing="0" cellpadding="0" border="0"> 
    199         <tr> 
    200                 <td> 
    201                         <table border="0" cellpadding="0" cellspacing="0" width="300px"> 
    202                         <tbody> 
    203                                 <tr>  
    204                                 <td>{logo_config} 
    205                                 <br><a title="Projeto Expresso Livre" target="_blank" href="http://www.expressolivre.org/">Expresso Livre</a> {version} 
    206                                 {ultima_rev} 
    207                                 <br><a title="eGroupWare" target="_blank" href="http://www.egroupware.org/"> Powered by eGroupWare </a></div></td> 
    208                                 </tr> 
    209                         </tbody> 
    210                 </table> 
    211         </td> 
    212         </tr> 
    213 </table> 
    214 </div> 
    215 </div> 
    216 </div> 
    217 </div> 
    218 </div> 
    219 <div>{applet}</div> 
    220 </body></html> 
     56                        <center> 
     57                                <div id="footer"> 
     58                                        <ul id="footer-logos"> 
     59                                                <li><a href="http://www.pr.gov.br/" class="logo-governo">Governo do Paraná</a></li> 
     60                                                <li> 
     61                                                        <a href="http://www.pr.gov.br/" class="logo-celepar">Celepar - Tecnologia da Informação e Comunicação do Paraná</a> 
     62                                                        <span id="info-deploy"><a title="Projeto Expresso Livre" target="_blank" href="http://www.expressolivre.org/">Expresso Livre</a>&nbsp;{version} {ultima_rev}<br />Powered by <a title="eGroupWare" target="_blank" href="http://www.egroupware.org/">eGroupWare</a> 
     63                                                        </span> 
     64                                                </li> 
     65                                        </ul> 
     66                                </div> 
     67                        </center> 
     68                </div> 
     69                <div>{applet}</div> 
     70        </body> 
     71</html> 
  • 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.