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 | |
---|
14 | $phpgw_info = array(); |
---|
15 | $submit = False; // set to some initial value |
---|
16 | |
---|
17 | $GLOBALS['phpgw_info']['flags'] = array( |
---|
18 | 'disable_Template_class' => True, |
---|
19 | 'login' => True, |
---|
20 | 'currentapp' => 'login', |
---|
21 | 'noheader' => True |
---|
22 | ); |
---|
23 | |
---|
24 | if(file_exists('./header.inc.php')) |
---|
25 | { |
---|
26 | include('./header.inc.php'); |
---|
27 | // Force location to home, while logged in. |
---|
28 | $GLOBALS['sessionid'] = @$_GET['sessionid'] ? $_GET['sessionid'] : @$_COOKIE['sessionid']; |
---|
29 | if(isset($GLOBALS['sessionid']) && $_GET['cd'] != 10) |
---|
30 | $GLOBALS['phpgw']->redirect_link('/home.php'); |
---|
31 | if ($GLOBALS['phpgw_info']['server']['use_https'] > 0) |
---|
32 | { |
---|
33 | if ($_SERVER['HTTPS'] != 'on') |
---|
34 | { |
---|
35 | Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
---|
36 | exit; |
---|
37 | } |
---|
38 | } |
---|
39 | |
---|
40 | if(function_exists('CreateObject')) |
---|
41 | { |
---|
42 | //detect if the user has a compatible browser, if don't have send him to expresso mini |
---|
43 | $browser = CreateObject('phpgwapi.browser'); |
---|
44 | |
---|
45 | switch ($browser->get_platform()) { |
---|
46 | case browser::PLATFORM_IPHONE: |
---|
47 | case browser::PLATFORM_IPOD: |
---|
48 | case browser::PLATFORM_IPAD: |
---|
49 | case browser::PLATFORM_BLACKBERRY: |
---|
50 | case browser::PLATFORM_NOKIA: |
---|
51 | case browser::PLATFORM_ANDROID: |
---|
52 | $GLOBALS['phpgw']->redirect_link('/mobile/'); |
---|
53 | break; |
---|
54 | default: |
---|
55 | break; |
---|
56 | } |
---|
57 | |
---|
58 | $GLOBALS['phpgw']->session = CreateObject('phpgwapi.sessions'); |
---|
59 | } |
---|
60 | else |
---|
61 | { |
---|
62 | Header('Location: setup/index.php'); |
---|
63 | exit; |
---|
64 | } |
---|
65 | } |
---|
66 | else |
---|
67 | { |
---|
68 | Header('Location: setup/index.php'); |
---|
69 | exit; |
---|
70 | } |
---|
71 | |
---|
72 | $GLOBALS['phpgw_info']['server']['template_dir'] = PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info']['login_template_set']; |
---|
73 | $tmpl = CreateObject('phpgwapi.Template', $GLOBALS['phpgw_info']['server']['template_dir']); |
---|
74 | |
---|
75 | // read the images from the login-template-set, not the (maybe not even set) users template-set |
---|
76 | $GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'] = $GLOBALS['phpgw_info']['login_template_set']; |
---|
77 | |
---|
78 | // This is used for system downtime, to prevent new logins. |
---|
79 | if($GLOBALS['phpgw_info']['server']['deny_all_logins']) |
---|
80 | { |
---|
81 | $deny_msg=lang('Oops! You caught us in the middle of system maintainance.<br/> |
---|
82 | Please, check back with us shortly.'); |
---|
83 | |
---|
84 | $tmpl->set_file(array |
---|
85 | ( |
---|
86 | 'login_form' => 'login_denylogin.tpl' |
---|
87 | )); |
---|
88 | |
---|
89 | $tmpl->set_var('template_set','default'); |
---|
90 | $tmpl->set_var('deny_msg',$deny_msg); |
---|
91 | $tmpl->pfp('loginout','login_form'); |
---|
92 | exit; |
---|
93 | } |
---|
94 | $tmpl->set_file(array('login_form' => 'login.tpl')); |
---|
95 | |
---|
96 | $tmpl->set_var('template',$GLOBALS['phpgw_info']['login_template_set']); |
---|
97 | $tmpl->set_var('lang',$_GET['lang']?$_GET['lang']:preg_replace("/\,.*/","",$GLOBALS['_SERVER']['HTTP_ACCEPT_LANGUAGE'])); |
---|
98 | |
---|
99 | if (count($GLOBALS['phpgw_info']['server']['login_logo_file']) > 0) |
---|
100 | $tmpl->set_var('logo_config',$GLOBALS['phpgw_info']['server']['login_logo_file']); |
---|
101 | else |
---|
102 | $tmpl->set_var('logo_config','<a title="Governo do Paraná" href="http://www.pr.gov.br" target="_blank"><img src="phpgwapi/templates/'.$GLOBALS['phpgw_info']['login_template_set'].'/images/logo_governo.gif" border="0"></a></td> |
---|
103 | <td><div align="center"><font color="#9a9a9a" face="Verdana, Arial, Helvetica, sans-serif" size="1"> |
---|
104 | <a title="Celepar Informática do Paraná" target="_blank" href="http://www.celepar.pr.gov.br/"> |
---|
105 | <img src="phpgwapi/templates/'.$GLOBALS['phpgw_info']['login_template_set'].'/images/logo_celepar.gif" border="0"></a>'); |
---|
106 | // !! NOTE !! |
---|
107 | // Do NOT and I repeat, do NOT touch ANYTHING to do with lang in this file. |
---|
108 | // If there is a problem, tell me and I will fix it. (jengo) |
---|
109 | |
---|
110 | // whoooo scaring |
---|
111 | |
---|
112 | // ServerID => Identify the Apache Frontend. |
---|
113 | if($GLOBALS['phpgw_info']['server']['usecookies'] == True && $GLOBALS['phpgw_info']['server']['use_frontend_id']) |
---|
114 | { |
---|
115 | $GLOBALS['phpgw']->session->phpgw_setcookie('serverID', $GLOBALS['phpgw_info']['server']['use_frontend_id']); |
---|
116 | } |
---|
117 | if($GLOBALS['phpgw_info']['server']['captcha']==1) |
---|
118 | { |
---|
119 | session_start(); |
---|
120 | } |
---|
121 | include(personalize_include_path('phpgwapi','login')); |
---|
122 | ?> |
---|
123 | |
---|