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