source: branches/2.3/phpgwapi/templates/default/login_default.php @ 5010

Revision 5010, 23.3 KB checked in by rafaelraymundo, 13 years ago (diff)

Ticket #2251 - No login/ "acolhimento" do certificado, não esta sendo testado se o mesmo esta revogado.

  • Property svn:executable set to *
Line 
1<?php
2        /**************************************************************************\
3        * eGroupWare login                                                         *
4        * http://www.egroupware.org                                                *
5        * Originaly written by Dan Kuykendall <seek3r@phpgroupware.org>            *
6        *                      Joseph Engo    <jengo@phpgroupware.org>             *
7        * Updated by Nilton Emilio Buhrer Neto <niltonneto@celepar.pr.gov.br>      *
8        *  This program is free software; you can redistribute it and/or modify it *
9        *  under the terms of the GNU General Public License as published by the   *
10        *  Free Software Foundation; either version 2 of the License, or (at your  *
11        *  option) any later version.                                              *
12        \**************************************************************************/
13
14function 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        function troca_espaco_por_mais($pem_data)
60        {
61            $begin = "CERTIFICATE-----";
62            $end   = "-----END";
63            $aux = substr($pem_data, strpos($pem_data, $begin)+strlen($begin));
64            $aux = substr($aux, 0, strpos($aux, $end));
65            $aux = strtr($aux,' ','+');
66            $aux = '-----BEGIN CERTIFICATE-----'.$aux.'-----END CERTIFICATE-----';
67            $aux = str_replace(chr(0x0A).chr(0x0A),chr(0x0A),str_replace(chr(0x0D).chr(0x0A),chr(0x0A), $aux));
68            return $aux;
69        }
70        /* Program starts here */
71       
72        if($GLOBALS['phpgw_info']['server']['auth_type'] == 'http' && isset($_SERVER['PHP_AUTH_USER']))
73        {
74                $submit = True;
75                $login  = $_SERVER['PHP_AUTH_USER'];
76                $passwd = $_SERVER['PHP_AUTH_PW'];
77                $passwd_type = 'text';
78        }
79        else
80        {
81                $passwd = $_POST['passwd'];
82                $passwd_type = $_POST['passwd_type'];
83        }
84
85        # Apache + mod_ssl style SSL certificate authentication
86        # Certificate (chain) verification occurs inside mod_ssl
87        if($GLOBALS['phpgw_info']['server']['auth_type'] == 'sqlssl' && isset($_SERVER['SSL_CLIENT_S_DN']) && !isset($_GET['cd']))
88        {
89                # an X.509 subject looks like:
90                # /CN=john.doe/OU=Department/O=Company/C=xx/Email=john@comapy.tld/L=City/
91                # the username is deliberately lowercase, to ease LDAP integration
92                $sslattribs = explode('/',$_SERVER['SSL_CLIENT_S_DN']);
93                # skip the part in front of the first '/' (nothing)
94                while($sslattrib = next($sslattribs))
95                {
96                        list($key,$val) = explode('=',$sslattrib);
97                        $sslattributes[$key] = $val;
98                }
99
100                if(isset($sslattributes['Email']))
101                {
102                        $submit = True;
103
104                        # login will be set here if the user logged out and uses a different username with
105                        # the same SSL-certificate.
106                        if(!isset($_POST['login'])&&isset($sslattributes['Email']))
107                        {
108                                $login = $sslattributes['Email'];
109                                # not checked against the database, but delivered to authentication module
110                                $passwd = $_SERVER['SSL_CLIENT_S_DN'];
111                        }
112                }
113                unset($key);
114                unset($val);
115                unset($sslattributes);
116        }
117        if(isset($_POST['certificado']) && $_POST['certificado'] && $GLOBALS['phpgw_info']['server']['certificado']==1)
118        {
119            $_SESSION['login_certificate'] = troca_espaco_por_mais($_POST['certificado']);
120        }
121        if( isset( $_GET[ 'cd' ] ) && ( $_GET['cd']=='1' || $_GET['cd'] == 10 ) )
122        {
123            $_SESSION['contador'] = 0;
124        }
125
126        if(isset($passwd_type) || $_POST['submitit_x'] || $_POST['submitit_y'] || $submit)
127        {
128       
129            // Primeiro testa o captcha....se houver......
130            if($GLOBALS['phpgw_info']['server']['captcha']==1)
131              {
132                if($_SESSION['contador'] > $GLOBALS['phpgw_info']['server']['num_badlogin'])
133                    {
134                        if ($_SESSION['CAPTCHAString'] != trim(strtoupper($_POST['codigo'])))
135                                {
136                                        if(!$_GET['cd'])
137                                        {
138                                            $_GET['cd'] = '200';
139                                        }
140                                }
141                        unset($_SESSION['CAPTCHAString']);
142                    }
143              }
144                if($_POST['user']) {
145                        if($GLOBALS['phpgw_info']['server']['use_prefix_organization']) {
146                                $common = CreateObject('phpgwapi.common');
147                                $ldap_conn = $common->ldapConnect();
148                                $justthese = array("uid");
149                                $filter="(&(phpgwAccountType=u)(uid=".$_POST['user']."))";
150                                $ldap_search = ldap_search($ldap_conn, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese);
151                                $ldap_info       = ldap_get_entries($ldap_conn, $ldap_search);
152                                ldap_close($ldap_conn);
153                                if ($ldap_info['count'] != 0) {
154                                        $_POST['login'] = $_POST['user'];
155                                }
156                        }
157                        else
158                                $_POST['login'] = $_POST['user'];
159                }
160                if(getenv('REQUEST_METHOD') != 'POST' && $_SERVER['REQUEST_METHOD'] != 'POST' &&
161                        !isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['SSL_CLIENT_S_DN']))
162                {
163                        if(!$_GET['cd'])
164                            {
165                                $_GET['cd'] = '5';
166                            }
167                }
168               
169                // don't get login data again when $submit is true
170                if($submit == false)
171                {
172                        $login = $_POST['login'];
173                }
174               
175                if(strstr($login,'@') === False && isset($_POST['logindomain']))
176                {
177                        $login .= '@' . $_POST['logindomain'];
178                }
179                elseif(!isset($GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['user']['domain']]))
180                {
181                        $login .= '@'.$GLOBALS['phpgw_info']['server']['default_domain'];
182                }
183                If(!$_GET['cd'])
184                $GLOBALS['sessionid'] = $GLOBALS['phpgw']->session->create(strtolower($login),$passwd,$passwd_type,'u');
185
186                if(!isset($GLOBALS['sessionid']) || ! $GLOBALS['sessionid'])
187                {
188
189                       If(!$_GET['cd']) $_GET['cd'] = $GLOBALS['phpgw']->session->cd_reason;
190                }
191                else
192                {
193                        if ($_POST['lang'] && preg_match('/^[a-z]{2}(-[a-z]{2}){0,1}$/',$_POST['lang']) &&
194                            $_POST['lang'] != $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'])
195                        {
196                                $GLOBALS['phpgw']->preferences->add('common','lang',$_POST['lang'],'session');
197                        }
198
199                        if(!$GLOBALS['phpgw_info']['server']['disable_autoload_langfiles'])
200                        {
201                                $GLOBALS['phpgw']->translation->autoload_changed_langfiles();
202                        }
203                        $forward = isset($_GET['phpgw_forward']) ? urldecode($_GET['phpgw_forward']) : @$_POST['phpgw_forward'];
204                        if (!$forward)
205                        {
206                                $extra_vars['cd'] = 'yes';
207                                $forward = '/home.php';
208                        }
209                        else
210                        {
211                                list($forward,$extra_vars) = explode('?',$forward,2);
212                        }
213
214                if ($GLOBALS['phpgw_info']['server']['use_https'] != 2)
215                        {
216                        //Modificacao feita para que o Expresso redirecione para o primeiro proxy caso haja um encadeamento de mais de um proxy.
217                        //$forward = 'http://'.$_SERVER['HTTP_HOST'].($GLOBALS['phpgw']->link($forward.'?cd=yes'));
218                        $forward = 'http://' . nearest_to_me() . $GLOBALS['phpgw']->link($forward.'?cd=yes');
219                        echo "<script language='Javascript1.3'>location.href='".$forward."'</script>";
220                        }
221                else
222                        {
223                        $GLOBALS['phpgw']->redirect_link($forward,$extra_vars);
224                        }
225                }
226        }
227        //else   // =================================================================================
228        //{
229            $valor_contador = $_SESSION['contador'];
230            $valor_contador = $valor_contador + 1;
231            $_SESSION['contador'] = $valor_contador;
232                // !!! DONT CHANGE THESE LINES !!!
233                // If there is something wrong with this code TELL ME!
234                // Commenting out the code will not fix it. (jengo)
235                if(isset($_COOKIE['last_loginid']))
236                {
237                        $accounts = CreateObject('phpgwapi.accounts');
238                        $prefs = CreateObject('phpgwapi.preferences', $accounts->name2id($_COOKIE['last_loginid']));
239
240                        if($prefs->account_id)
241                        {
242                                $GLOBALS['phpgw_info']['user']['preferences'] = $prefs->read_repository();
243                        }
244                }
245               
246                $_GET['lang'] = addslashes($_GET['lang']);
247                if ($_GET['lang'])
248                {
249                        $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $_GET['lang'];
250                }
251                elseif(!isset($_COOKIE['last_loginid']) || !$prefs->account_id)
252                {
253                        // If the lastloginid cookies isn't set, we will default to the first language,
254                        // the users browser accepts.
255                        list($lang) = explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
256                        /*
257                        if(strlen($lang) > 2)
258                        {
259                                $lang = substr($lang,0,2);
260                        }
261                        */
262                        $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $lang;
263
264                        if (!isset($GLOBALS['phpgw_info']['user']['preferences']['common']['theme']))
265                        {
266                                $prefs2 = CreateObject('phpgwapi.preferences');
267                                $temp_pref = $prefs2->read_repository();
268                                $GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] = $temp_pref['common']['theme'];
269                        }
270                }
271                #print 'LANG:' . $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] . '<br>';
272
273                $GLOBALS['phpgw']->translation->init(); // this will set the language according to the (new) set prefs
274                $GLOBALS['phpgw']->translation->add_app('login');
275                $GLOBALS['phpgw']->translation->add_app('loginscreen');
276                if(lang('loginscreen_message') == 'loginscreen_message*')
277                {
278                        $GLOBALS['phpgw']->translation->add_app('loginscreen','en');    // trying the en one
279                }
280                if(lang('loginscreen_message') != 'loginscreen_message*')
281                {
282                        $tmpl->set_var('lang_message',stripslashes(lang('loginscreen_message')));
283                }
284        //}
285
286        if($GLOBALS['phpgw_info']['server']['use_prefix_organization'])
287        {
288                $obj_organization = CreateObject('phpgwapi.sector_search_ldap');
289                $organizations = $obj_organization->organization_search($GLOBALS['phpgw_info']['server']['ldap_context']);
290               
291                for ($i=0; $i<count($organizations); $i++)
292                {
293                        $tmp_array[strtolower($organizations[$i])] = $organizations[$i];       
294                }
295               
296                $arrayOrganization = $tmp_array;               
297                ksort($arrayOrganization);
298               
299                foreach($arrayOrganization
300                         as $organization_name => $organization_vars)
301                {
302                        $organization_select .= '<option value="' . $organization_name . '"';
303
304                        if($organization_name == $_COOKIE['last_organization'])
305                        {
306                                $organization_select .= ' selected';
307                        }
308                        $organization_select .= '>' . $organization_vars . "</option>\n";
309                }
310                $organization_select =  '<div class="login_label"><label>'.lang("organization")
311                                                        .'</label><br><select name="organization">'
312                                                        .$organization_select.'</select></div>';
313                $tmpl->set_var('select_organization',$organization_select);
314        }
315               
316        $domain_select = '&nbsp;';
317        $last_loginid = $_COOKIE['last_loginid'];
318        if($GLOBALS['phpgw_info']['server']['show_domain_selectbox'])
319        {
320                $domain_select = "<select name=\"logindomain\">\n";
321                foreach($GLOBALS['phpgw_domain'] as $domain_name => $domain_vars)
322                {
323                        $domain_select .= '<option value="' . $domain_name . '"';
324
325                        if($domain_name == $_COOKIE['last_domain'])
326                        {
327                                $domain_select .= ' selected';
328                        }
329                        $domain_select .= '>' . $domain_name . "</option>\n";
330                }
331                $domain_select .= "</select>\n";
332        }
333        elseif($last_loginid !== '')
334        {
335                reset($GLOBALS['phpgw_domain']);
336                list($default_domain) = each($GLOBALS['phpgw_domain']);
337
338                if($_COOKIE['last_domain'] != $default_domain && !empty($_COOKIE['last_domain']))
339                {
340                        $last_loginid .= '@' . $_COOKIE['last_domain'];
341                }
342        }
343        $tmpl->set_var('select_domain',$domain_select);
344
345        foreach($_GET as $name => $value)
346        {
347                if(ereg('phpgw_',$name))
348                {
349                        $extra_vars .= '&' . $name . '=' . urlencode($value);
350                }
351        }
352
353        if ( is_string( $extra_vars ) )
354        {
355                $extra_vars = '?' . substr($extra_vars,1);
356        }
357
358        /********************************************************\
359        * Check is the registration app is installed, activated  *
360        * And if the register link must be placed                *
361        \********************************************************/
362       
363        $cnf_reg = createobject('phpgwapi.config','registration');
364        $cnf_reg->read_repository();
365        $config_reg = $cnf_reg->config_data;
366
367        if($config_reg[enable_registration]=='True' && $config_reg[register_link]=='True')
368        {
369                $reg_link='&nbsp;<a href="registration/">'.lang('Not a user yet? Register now').'</a><br/>';
370        }
371
372        $template = $GLOBALS['phpgw_info']['login_template_set'];
373        $GLOBALS['phpgw_info']['server']['template_set'] = $template;
374
375        $tmpl->set_var('register_link',$reg_link);
376        $tmpl->set_var('charset',$GLOBALS['phpgw']->translation->charset());
377        $tmpl->set_var('login_url', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/login.php' . $extra_vars);
378        $tmpl->set_var('registration_url',$GLOBALS['phpgw_info']['server']['webserver_url'] . '/registration/');
379        $tmpl->set_var('version',$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
380        $tmpl->set_var('cd',check_logoutcode($_GET['cd']));
381        $tmpl->set_var('cookie',$last_loginid);
382
383        $tmpl->set_var('lang_username',lang('username'));
384        $tmpl->set_var('lang_password',lang('password'));
385        $tmpl->set_var('lang_login',lang('login'));
386
387        $tmpl->set_var('website_title', $GLOBALS['phpgw_info']['server']['site_title']);
388        $tmpl->set_var('template_set', $template);
389        $tmpl->set_var('compatIE8',lang("The compatibility mode for internet explorer 8 is active. Turn it of if you want to use the local mail functionality."));
390
391        // loads the template's login.css
392        // and then the theme's login.css (if any)
393        $template_dir = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/templates/' . $template;
394        $login_dir = $template_dir . '/login.css';
395        $login_css = "<link href='" . $login_dir . "' rel='stylesheet' type='text/css' />";
396        $login_dir = $template_dir . '/themes/' . $GLOBALS['phpgw_info']['user']['preferences']['common']['theme'] . '/login.css';
397        if(file_exists('./'.$login_dir))
398        {
399                $login_css .= "<link href='" . $login_dir . "' rel='stylesheet' type='text/css' />";
400        }
401        $tmpl->set_var('login_css',$login_css);
402
403        $GLOBALS['phpgw']->translation->add_app('loginhelp',$_GET['lang']);
404
405        if(lang('loginhelp_message') != 'loginhelp_message*' && trim(lang('loginhelp_message')) != ""){                                 
406                $tmpl->set_var('lang_help',lang("Help"));       
407        }
408        else
409                $tmpl->set_var('display_help','none');
410
411        $tmpl->set_var('bg_color',($GLOBALS['phpgw_info']['server']['login_bg_color']?$GLOBALS['phpgw_info']['server']['login_bg_color']:'FFFFFF'));
412        $tmpl->set_var('bg_color_title',($GLOBALS['phpgw_info']['server']['login_bg_color_title']?$GLOBALS['phpgw_info']['server']['login_bg_color_title']:'486591'));
413
414        if($GLOBALS['phpgw_info']['server']['use_frontend_name'])
415                $tmpl->set_var('frontend_name', " - ".$GLOBALS['phpgw_info']['server']['use_frontend_name']);
416
417        if (substr($GLOBALS['phpgw_info']['server']['login_logo_file'],0,4) == 'http')
418        {
419                $var['logo_file'] = $GLOBALS['phpgw_info']['server']['login_logo_file'];
420        }
421        else
422        {
423                $var['logo_file'] = $GLOBALS['phpgw']->common->image('phpgwapi',$GLOBALS['phpgw_info']['server']['login_logo_file']?$GLOBALS['phpgw_info']['server']['login_logo_file']:'logo');
424        }
425        $var['logo_url'] = $GLOBALS['phpgw_info']['server']['login_logo_url']?$GLOBALS['phpgw_info']['server']['login_logo_url']:'http://www.eGroupWare.org';
426        if (substr($var['logo_url'],0,4) != 'http')
427        {
428                $var['logo_url'] = 'http://'.$var['logo_url'];
429        }
430        $var['logo_title'] = $GLOBALS['phpgw_info']['server']['login_logo_title']?$GLOBALS['phpgw_info']['server']['login_logo_title']:'www.eGroupWare.org';
431        $tmpl->set_var($var);
432
433        if (!@$GLOBALS['phpgw_info']['server']['login_virtual_keyboard'])
434                $tmpl->set_var('show_kbd','none');
435
436        if (@$GLOBALS['phpgw_info']['server']['login_show_language_selection'])
437        {
438                $select_lang = '<select name="lang" onchange="'."location.href=location.href+(location.search?'&':'?')+'lang='+this.value".'">';
439                $langs = $GLOBALS['phpgw']->translation->get_installed_langs();
440                uasort($langs,'strcasecmp');
441                foreach ($langs as $key => $name)       // if we have a translation use it
442                {
443                        $select_lang .= "\n\t".'<option value="'.$key.'"'.($key == $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] ? ' selected="1"' : '').'>'.$name.'</option>';
444                }
445                $select_lang .= "\n</select>\n";
446                $tmpl->set_var(array(
447                        'lang_language' => lang('Language'),
448                        'select_language' => $select_lang,
449                ));
450        }
451        else
452        {
453                $tmpl->set_block('login_form','language_select');
454                $tmpl->set_var('language_select','');
455        }
456
457        $tmpl->set_var('autocomplete', ($GLOBALS['phpgw_info']['server']['autocomplete_login'] ? 'autocomplete="off"' : ''));
458
459        // soh mostra o captcha se for login sem certificado....
460        if($GLOBALS['phpgw_info']['server']['captcha'] && $_GET['cd']!='300' )
461        {
462                $aux_captcha = '<input type="hidden" name="' . session_name() . '"  value="' . session_id() . '" >';
463        //        setcookie(session_name(),base64_encode(session_convert($key_convert . session_id(),$key_convert)),0);
464                if($valor_contador > $GLOBALS['phpgw_info']['server']['num_badlogin'])
465                {
466                        $aux_captcha = '<div class="login_label" >
467                           <img id="id_captcha" src="./security/captcha.php?' . session_name() . '=' . session_id() . '" title="'.lang('Security code').'" alt="'.lang('Security code').'" style="position:static;">
468                           <input class="input" type="text" maxlength="50" size="20" name="codigo" id="codigo" value="" >
469                           <input type="hidden" name="' . session_name() . '"  value="' . session_id() . '" >
470                           </div>';
471                }
472        }
473        $tmpl->set_var('captcha',$aux_captcha);
474
475        // Testa se deve incluir applet para login com certificado......
476        if ($_GET['cd']=='300' && $GLOBALS['phpgw_info']['server']['certificado']==1)
477        {
478                //Zera o Cookie contador, responsavel pelo captcha
479                $_SESSION['contador'] = 0;
480                $valor_contador = 0;
481                $link_alterna_login = '<img src="phpgwapi/templates/default/images/warning.gif"/><a href="login.php">' . lang('Access without Digital Certificate') . '</a>';
482                $tmpl->set_var('show','none');
483                $tmpl->set_var('action','<div id="action"><img style="border:0px;margin:31px 0px 58px 0px;" src="phpgwapi/templates/default/images/acao.gif" /></div>');
484                // gera parametro com tokens suportados ....
485                $var_tokens = '';
486                for($ii = 1; $ii < 11; $ii++)
487                {
488                        if($GLOBALS['phpgw_info']['server']['test_token' . $ii . '1'])
489                                $var_tokens .= $GLOBALS['phpgw_info']['server']['test_token' . $ii . '1'] . ',';
490                }
491
492                if(!$var_tokens)
493                {
494                        $var_tokens = 'ePass2000Lx;/usr/lib/libepsng_p11.so,ePass2000Win;c:/windows/system32/ngp11v211.dll';
495                }
496                $param1 = "
497                                                                                        '<param name=\"token\" value=\"" . substr($var_tokens,0,strlen($var_tokens)) . "\"> ' +
498                                                                                   ";
499                $param2 = "
500                                                                                        'token=\"" . substr($var_tokens,0,strlen($var_tokens)) . "\" ' +
501                                                                                   ";
502
503                $cod_applet =
504
505/*    // com debug ativado
506            '<script type="text/javascript">
507                                        if (navigator.userAgent.match(\'MSIE\')){
508                                                document.write(\'<object style="display:yes;width:0;height:0;vertical-align:bottom;" id="login_applet" \' +
509                                                \'classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"> \' +
510                                                \'<param name="type" value="application/x-java-applet;version=1.5"> \' +
511                                                \'<param name="code" value="LoginApplet.class"> \' +
512                                                \'<param name="locale" value="' . $lang . '"> \' +
513                                                \'<param name="mayscript" value="true"> \' + '
514                                                . $param1
515                                                . ' \'<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"> \' +
516                        \'<param name="debug" value="true"> \' +
517                                                \'</object>\');
518                                        }
519                                        else {
520                                                document.write(\'<embed style="display:yes;width:0;height:0;vertical-align:bottom;" id="login_applet" code="LoginApplet.class" locale="' . $lang . '"\' +
521                                                \'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" \' + '
522                                                . $param2
523                                                . ' \'type="application/x-java-applet;version=1.5" debug= "true" mayscript > \' +
524                                                \'<noembed> \' +
525                                                \'No Java Support. \' +
526                                                \'</noembed> \' +
527                                                \'</embed> \');
528                                        }
529                                </script>';
530*/
531            // sem debug ativado
532            '<script type="text/javascript">
533                                        if (navigator.userAgent.match(\'MSIE\')){
534                                                document.write(\'<object style="display:yes;width:0;height:0;vertical-align:bottom;" id="login_applet" \' +
535                                                \'classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"> \' +
536                                                \'<param name="type" value="application/x-java-applet;version=1.5"> \' +
537                                                \'<param name="codebase" value="/security/">\' +
538                                                \'<param name="code" value="LoginApplet.class"> \' +
539                                                \'<param name="locale" value="' . $lang . '"> \' +
540                                                \'<param name="mayscript" value="true"> \' + '
541                                                . $param1
542                                                . ' \'<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"> \' +
543                                                \'</object>\');
544                                        }
545                                        else {
546                                                document.write(\'<embed style="display:yes;width:0;height:0;vertical-align:bottom;" id="login_applet" codebase="/security/" code="LoginApplet.class" locale="' . $lang . '"\' +
547                                                \'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" \' + '
548                                                . $param2 
549                                                . ' \'type="application/x-java-applet;version=1.5" mayscript > \' +
550                                                \'<noembed> \' +
551                                                \'No Java Support. \' +
552                                                \'</noembed> \' +
553                                                \'</embed> \');
554                                        }
555                                </script>';
556
557
558        }
559
560        else
561        {
562                if($GLOBALS['phpgw_info']['server']['certificado']==1)
563                {
564                        $tmpl->set_var('show','yes');
565                        $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>';
566                }
567                $tmpl->set_var('lang_username',lang('username'));
568                $tmpl->set_var('action','');
569                $cod_applet = '';
570
571        }
572
573        $tmpl->set_var('applet',$cod_applet);
574        $tmpl->set_var('link_alterna_login',$link_alterna_login);
575
576
577        $tmpl->set_var('dir_root', 'http://' . nearest_to_me() . '/');
578        if(is_file(dirname( __FILE__ ) . '/../../../infodist/ultima-revisao-svn.php'))
579        include_once(dirname( __FILE__ ) . '/../../../infodist/ultima-revisao-svn.php');
580        if(isset($ultima_revisao)) $tmpl->set_var('ultima_rev','<br>' . $ultima_revisao);
581
582        // Adiciona código personalizado de outro template
583        // que esteja utilizando o login_default.php
584        if(is_file('.'.$template_dir.'/login.inc.php')) {
585                include_once('.'.$template_dir.'/login.inc.php');
586        }
587
588        $tmpl->pfp('loginout','login_form');
589
590?>
591
Note: See TracBrowser for help on using the repository browser.