[2] | 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> * |
---|
[25] | 7 | * Updated by Nilton Emilio Buhrer Neto <niltonneto@celepar.pr.gov.br> * |
---|
[2] | 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 | \**************************************************************************/ |
---|
[3621] | 13 | |
---|
[2] | 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'); |
---|
[219] | 27 | // Force location to home, while logged in. |
---|
[222] | 28 | $GLOBALS['sessionid'] = @$_GET['sessionid'] ? $_GET['sessionid'] : @$_COOKIE['sessionid']; |
---|
[5042] | 29 | |
---|
[222] | 30 | if(isset($GLOBALS['sessionid']) && $_GET['cd'] != 10) |
---|
[5042] | 31 | { |
---|
| 32 | if( $_GET['cd'] != '66' ) |
---|
| 33 | { |
---|
| 34 | $GLOBALS['phpgw']->redirect_link('/home.php'); |
---|
| 35 | } |
---|
| 36 | } |
---|
| 37 | |
---|
[2] | 38 | if ($GLOBALS['phpgw_info']['server']['use_https'] > 0) |
---|
| 39 | { |
---|
| 40 | if ($_SERVER['HTTPS'] != 'on') |
---|
| 41 | { |
---|
[5042] | 42 | Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
---|
[2] | 43 | exit; |
---|
| 44 | } |
---|
| 45 | } |
---|
| 46 | |
---|
[5042] | 47 | $GLOBALS['phpgw']->session = CreateObject('phpgwapi.sessions'); |
---|
[2] | 48 | } |
---|
| 49 | else |
---|
| 50 | { |
---|
| 51 | Header('Location: setup/index.php'); |
---|
| 52 | exit; |
---|
| 53 | } |
---|
[5042] | 54 | |
---|
| 55 | //detect if the user has a compatible browser, if don't have send him to expresso mini |
---|
[5047] | 56 | $ifMobile = false; |
---|
[5042] | 57 | $browser = CreateObject('phpgwapi.browser'); |
---|
| 58 | switch ( $browser->get_platform() ) |
---|
| 59 | { |
---|
| 60 | case browser::PLATFORM_IPHONE: |
---|
| 61 | case browser::PLATFORM_IPOD: |
---|
| 62 | case browser::PLATFORM_IPAD: |
---|
| 63 | case browser::PLATFORM_BLACKBERRY: |
---|
| 64 | case browser::PLATFORM_NOKIA: |
---|
| 65 | case browser::PLATFORM_ANDROID: |
---|
| 66 | $ifMobile = true; |
---|
| 67 | break; |
---|
| 68 | } |
---|
[2] | 69 | |
---|
[5042] | 70 | if( $ifMobile && $_GET['dont_redirect_if_moble'] != 1 ) |
---|
[2] | 71 | { |
---|
[5042] | 72 | $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = preg_replace("/\,.*/","",$GLOBALS['_SERVER']['HTTP_ACCEPT_LANGUAGE']); |
---|
| 73 | if( $_GET['cd'] == '66' ) |
---|
| 74 | $GLOBALS['phpgw']->redirect_link('/mobile/login.php?cd=66'); |
---|
| 75 | else |
---|
| 76 | $GLOBALS['phpgw']->redirect_link('/mobile/login.php'); |
---|
[2] | 77 | } |
---|
[1085] | 78 | else |
---|
[2] | 79 | { |
---|
[5042] | 80 | $GLOBALS['phpgw_info']['server']['template_dir'] = PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $GLOBALS['phpgw_info']['login_template_set']; |
---|
| 81 | $tmpl = CreateObject('phpgwapi.Template', $GLOBALS['phpgw_info']['server']['template_dir']); |
---|
| 82 | |
---|
| 83 | // read the images from the login-template-set, not the (maybe not even set) users template-set |
---|
| 84 | $GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'] = $GLOBALS['phpgw_info']['login_template_set']; |
---|
| 85 | |
---|
| 86 | // This is used for system downtime, to prevent new logins. |
---|
| 87 | if($GLOBALS['phpgw_info']['server']['deny_all_logins']) |
---|
| 88 | { |
---|
| 89 | $deny_msg=lang('Oops! You caught us in the middle of system maintainance.<br/> |
---|
| 90 | Please, check back with us shortly.'); |
---|
| 91 | |
---|
| 92 | $tmpl->set_file(array('login_form' => 'login_denylogin.tpl')); |
---|
| 93 | |
---|
| 94 | $tmpl->set_var('template_set','default'); |
---|
| 95 | $tmpl->set_var('deny_msg',$deny_msg); |
---|
| 96 | $tmpl->pfp('loginout','login_form'); |
---|
| 97 | exit; |
---|
| 98 | } |
---|
| 99 | $tmpl->set_file(array('login_form' => 'login.tpl')); |
---|
| 100 | |
---|
| 101 | $tmpl->set_var('template',$GLOBALS['phpgw_info']['login_template_set']); |
---|
| 102 | $tmpl->set_var('lang',$_GET['lang']?$_GET['lang']:preg_replace("/\,.*/","",$GLOBALS['_SERVER']['HTTP_ACCEPT_LANGUAGE'])); |
---|
| 103 | |
---|
| 104 | if (count($GLOBALS['phpgw_info']['server']['login_logo_file']) > 0) |
---|
| 105 | $tmpl->set_var('logo_config',$GLOBALS['phpgw_info']['server']['login_logo_file']); |
---|
| 106 | else |
---|
| 107 | $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> |
---|
| 108 | <td><div align="center"><font color="#9a9a9a" face="Verdana, Arial, Helvetica, sans-serif" size="1"> |
---|
| 109 | <a title="Celepar Informática do Paraná" target="_blank" href="http://www.celepar.pr.gov.br/"> |
---|
| 110 | <img src="phpgwapi/templates/'.$GLOBALS['phpgw_info']['login_template_set'].'/images/logo_celepar.gif" border="0"></a>'); |
---|
| 111 | // !! NOTE !! |
---|
| 112 | // Do NOT and I repeat, do NOT touch ANYTHING to do with lang in this file. |
---|
| 113 | // If there is a problem, tell me and I will fix it. (jengo) |
---|
| 114 | |
---|
| 115 | // whoooo scaring |
---|
| 116 | |
---|
| 117 | // ServerID => Identify the Apache Frontend. |
---|
| 118 | if($GLOBALS['phpgw_info']['server']['usecookies'] == True && $GLOBALS['phpgw_info']['server']['use_frontend_id']) |
---|
| 119 | { |
---|
| 120 | $GLOBALS['phpgw']->session->phpgw_setcookie('serverID', $GLOBALS['phpgw_info']['server']['use_frontend_id']); |
---|
| 121 | } |
---|
| 122 | if($GLOBALS['phpgw_info']['server']['captcha']==1) |
---|
| 123 | { |
---|
| 124 | session_start(); |
---|
| 125 | } |
---|
| 126 | |
---|
| 127 | include(personalize_include_path('phpgwapi','login')); |
---|
[2] | 128 | } |
---|
[5399] | 129 | //Carregando na sessão configurações do usuario usado na nova API. |
---|
| 130 | $_SESSION['wallet']['user']['uid'] = $GLOBALS['phpgw_info']['user']['userid']; |
---|
| 131 | $_SESSION['wallet']['user']['uidNumber'] = $GLOBALS['phpgw_info']['user']['account_id']; |
---|
| 132 | $_SESSION['wallet']['user']['password'] = $GLOBALS['phpgw_info']['user']['passwd']; |
---|
[5804] | 133 | $_SESSION['wallet']['user']['cn'] = $GLOBALS['phpgw_info']['user']['firstname'].' '.$GLOBALS['phpgw_info']['user']['lastname']; |
---|
[5399] | 134 | $_SESSION['wallet']['user']['mail'] = $GLOBALS['phpgw_info']['user']['email']; |
---|
[5812] | 135 | |
---|
[5764] | 136 | $_SESSION['wallet']['Sieve']['user'] = $GLOBALS['phpgw_info']['user']['account_lid']; |
---|
| 137 | $_SESSION['wallet']['Sieve']['password'] = $GLOBALS['phpgw_info']['user']['passwd']; |
---|
| 138 | |
---|
| 139 | $_SESSION['wallet']['Cyrus']['user'] = $GLOBALS['phpgw_info']['user']['account_lid']; |
---|
| 140 | $_SESSION['wallet']['Cyrus']['password'] = $GLOBALS['phpgw_info']['user']['passwd']; |
---|
| 141 | |
---|
| 142 | |
---|
| 143 | $_SESSION['wallet']['PostgreSQL']['user'] = $GLOBALS['phpgw_info']['server']['db_user']; |
---|
| 144 | $_SESSION['wallet']['PostgreSQL']['password'] = $GLOBALS['phpgw_info']['server']['db_pass']; |
---|
| 145 | $_SESSION['wallet']['PostgreSQL']['dbname'] = $GLOBALS['phpgw_info']['server']['db_name']; |
---|
| 146 | $_SESSION['wallet']['PostgreSQL']['host'] = $GLOBALS['phpgw_info']['server']['db_host']; |
---|
| 147 | |
---|
| 148 | $_SESSION['wallet']['OpenLDAP']['context'] = $GLOBALS['phpgw_info']['server']['ldap_context']; |
---|
| 149 | $_SESSION['wallet']['OpenLDAP']['host'] = $GLOBALS['phpgw_info']['server']['ldap_host']; |
---|
| 150 | |
---|
[5091] | 151 | ?> |
---|