source: trunk/login.php @ 1152

Revision 1152, 5.1 KB checked in by amuller, 15 years ago (diff)

Ticket #475 - Mudando o nome dos templates azul para default e celepar para classic

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2//Valida a existencia do cookie, antes de grava-lo
3if(isset($_COOKIE['contador'])) {
4        $valor_cookie = $_COOKIE['contador'];
5        if($_POST['user'] && $_POST['passwd'])
6                {
7                $valor_cookie = $valor_cookie + 1;
8                setcookie("contador", $valor_cookie,0);
9                }
10        }
11        //Cookie inexistente: tenta gravar um
12        else
13        {
14        if (setcookie("contador", 1,0))
15                //echo "OK, cookie gravado.";
16                $valor_cookie = 1;
17                else
18                //echo "Nao gravou o cookie";
19                $valor_cookie = "9999"; // forca captcha
20        }
21// logout, inicia contador novamente.....
22if($_GET['cd']=='1' || $_COOKIE['sessionid'] || $_GET['cd'] == 10)
23        {
24        $valor_cookie = 1;
25        setcookie("contador", 1,0);
26        }
27
28        /**************************************************************************\
29        * eGroupWare login                                                         *
30        * http://www.egroupware.org                                                *
31        * Originaly written by Dan Kuykendall <seek3r@phpgroupware.org>            *
32        *                      Joseph Engo    <jengo@phpgroupware.org>             *
33        * Updated by Nilton Emilio Buhrer Neto <niltonneto@celepar.pr.gov.br>      *
34        *  This program is free software; you can redistribute it and/or modify it *
35        *  under the terms of the GNU General Public License as published by the   *
36        *  Free Software Foundation; either version 2 of the License, or (at your  *
37        *  option) any later version.                                              *
38        \**************************************************************************/
39
40        $phpgw_info = array();
41        $submit = False;                        // set to some initial value
42
43        $GLOBALS['phpgw_info']['flags'] = array(
44                'disable_Template_class' => True,
45                'login'                  => True,
46                'currentapp'             => 'login',
47                'noheader'               => True
48        );
49
50        if(file_exists('./header.inc.php'))
51        {
52                include('./header.inc.php');
53                // Force location to home, while logged in.
54                $GLOBALS['sessionid'] = @$_GET['sessionid'] ? $_GET['sessionid'] : @$_COOKIE['sessionid'];
55                if(isset($GLOBALS['sessionid']) && $_GET['cd'] != 10)
56                        $GLOBALS['phpgw']->redirect_link('/home.php');
57                if ($GLOBALS['phpgw_info']['server']['use_https'] > 0)
58                {
59                        if ($_SERVER['HTTPS'] != 'on')
60                        {
61                                Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
62                                exit;
63                        }
64                }
65                       
66                if(function_exists('CreateObject'))
67                {
68                        $GLOBALS['phpgw']->session = CreateObject('phpgwapi.sessions');
69                }
70                else
71                {
72                        Header('Location: setup/index.php');
73                        exit;
74                }
75        }
76        else
77        {
78                Header('Location: setup/index.php');
79                exit;
80        }
81
82        $GLOBALS['phpgw_info']['server']['template_dir'] = PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info']['login_template_set'];
83        $tmpl = CreateObject('phpgwapi.Template', $GLOBALS['phpgw_info']['server']['template_dir']);
84
85        // read the images from the login-template-set, not the (maybe not even set) users template-set
86        $GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'] = $GLOBALS['phpgw_info']['login_template_set'];
87
88        // This is used for system downtime, to prevent new logins.
89        if($GLOBALS['phpgw_info']['server']['deny_all_logins'])
90        {
91                $deny_msg=lang('Oops! You caught us in the middle of system maintainance.<br/>
92                Please, check back with us shortly.');
93
94                $tmpl->set_file(array
95                (
96                        'login_form' => 'login_denylogin.tpl'
97                ));
98
99                $tmpl->set_var('template_set','default');
100                $tmpl->set_var('deny_msg',$deny_msg);
101                $tmpl->pfp('loginout','login_form');
102                exit;
103        }
104        $tmpl->set_file(array('login_form' => 'login.tpl'));
105
106        $tmpl->set_var('template',$GLOBALS['phpgw_info']['login_template_set']);
107        $tmpl->set_var('lang',$_GET['lang']?$_GET['lang']:preg_replace("/\,.*/","",$GLOBALS['_SERVER']['HTTP_ACCEPT_LANGUAGE']));
108
109        if (count($GLOBALS['phpgw_info']['server']['login_logo_file']) > 0)
110                $tmpl->set_var('logo_config',$GLOBALS['phpgw_info']['server']['login_logo_file']);
111        else
112                $tmpl->set_var('logo_config','<a title="Governo do Paran&aacute" href="http://www.pr.gov.br" target="_blank"><img src="phpgwapi/templates/default/images/logo_governo.gif" border="0"></a></td>
113                <td><div align="center"><font color="#9a9a9a" face="Verdana, Arial, Helvetica, sans-serif" size="1">
114<a title="Celepar Inform&aacute;tica do Paran&aacute;" target="_blank" href="http://www.celepar.pr.gov.br/">
115<img src="phpgwapi/templates/default/images/logo_celepar.gif" border="0"></a>');
116        // !! NOTE !!
117        // Do NOT and I repeat, do NOT touch ANYTHING to do with lang in this file.
118        // If there is a problem, tell me and I will fix it. (jengo)
119
120        // whoooo scaring
121
122        // ServerID => Identify the Apache Frontend.
123        if($GLOBALS['phpgw_info']['server']['usecookies'] == True && $GLOBALS['phpgw_info']['server']['use_frontend_id'])
124        {
125                $GLOBALS['phpgw']->session->phpgw_setcookie('serverID', $GLOBALS['phpgw_info']['server']['use_frontend_id']);
126        }
127
128$login_include = $GLOBALS['phpgw_info']['server']['template_dir'] . '/login_' .  $GLOBALS['phpgw_info']['login_template_set'] . '.php';
129
130if(!$login_include || !file_exists($login_include))
131        {
132                $aux = explode('phpgwapi',$GLOBALS['phpgw_info']['server']['template_dir']);
133                $login_include = $aux[0] . 'phpgwapi/templates/default/login_default.php';
134        }
135
136include($login_include);
137
138?>
139
Note: See TracBrowser for help on using the repository browser.