[2] | 1 | <?php |
---|
[354] | 2 | // +-----------------------------------------------------------------------+ |
---|
[8728] | 3 | // | Piwigo - a PHP based photo gallery | |
---|
[2297] | 4 | // +-----------------------------------------------------------------------+ |
---|
[26461] | 5 | // | Copyright(C) 2008-2014 Piwigo Team http://piwigo.org | |
---|
[2297] | 6 | // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | |
---|
| 7 | // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | |
---|
| 8 | // +-----------------------------------------------------------------------+ |
---|
| 9 | // | This program is free software; you can redistribute it and/or modify | |
---|
| 10 | // | it under the terms of the GNU General Public License as published by | |
---|
| 11 | // | the Free Software Foundation | |
---|
| 12 | // | | |
---|
| 13 | // | This program is distributed in the hope that it will be useful, but | |
---|
| 14 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
| 15 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
| 16 | // | General Public License for more details. | |
---|
| 17 | // | | |
---|
| 18 | // | You should have received a copy of the GNU General Public License | |
---|
| 19 | // | along with this program; if not, write to the Free Software | |
---|
| 20 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
| 21 | // | USA. | |
---|
| 22 | // +-----------------------------------------------------------------------+ |
---|
[2] | 23 | |
---|
[402] | 24 | //--------------------------------------------------------------------- include |
---|
[364] | 25 | define('PHPWG_ROOT_PATH','./'); |
---|
| 26 | include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); |
---|
[345] | 27 | |
---|
[1851] | 28 | // +-----------------------------------------------------------------------+ |
---|
| 29 | // | Check Access and exit when user status is not ok | |
---|
| 30 | // +-----------------------------------------------------------------------+ |
---|
[2325] | 31 | check_status(ACCESS_FREE); |
---|
[1851] | 32 | |
---|
[18063] | 33 | trigger_action('loc_begin_identification'); |
---|
| 34 | |
---|
[2] | 35 | //-------------------------------------------------------------- identification |
---|
[1052] | 36 | $redirect_to = ''; |
---|
| 37 | if ( !empty($_GET['redirect']) ) |
---|
| 38 | { |
---|
[1061] | 39 | $redirect_to = urldecode($_GET['redirect']); |
---|
[2029] | 40 | if ( is_a_guest() ) |
---|
[1052] | 41 | { |
---|
[25018] | 42 | $page['errors'][] = l10n('You are not authorized to access the requested page'); |
---|
[1052] | 43 | } |
---|
| 44 | } |
---|
| 45 | |
---|
[541] | 46 | if (isset($_POST['login'])) |
---|
[2] | 47 | { |
---|
[4956] | 48 | if (!isset($_COOKIE[session_name()])) |
---|
[2] | 49 | { |
---|
[25018] | 50 | $page['errors'][] = l10n('Cookies are blocked or not supported by your browser. You must enable cookies to connect.'); |
---|
[2] | 51 | } |
---|
| 52 | else |
---|
[4956] | 53 | { |
---|
[11989] | 54 | if ($conf['insensitive_case_logon'] == true) |
---|
| 55 | { |
---|
| 56 | $_POST['username'] = search_case_username($_POST['username']); |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | $redirect_to = isset($_POST['redirect']) ? urldecode($_POST['redirect']) : ''; |
---|
[4956] | 60 | $remember_me = isset($_POST['remember_me']) and $_POST['remember_me']==1; |
---|
[11989] | 61 | |
---|
[4956] | 62 | if ( try_log_user($_POST['username'], $_POST['password'], $remember_me) ) |
---|
| 63 | { |
---|
[11368] | 64 | redirect(empty($redirect_to) ? get_gallery_home_url() : $redirect_to); |
---|
[4956] | 65 | } |
---|
| 66 | else |
---|
| 67 | { |
---|
[25018] | 68 | $page['errors'][] = l10n('Invalid password!'); |
---|
[4956] | 69 | } |
---|
[2] | 70 | } |
---|
| 71 | } |
---|
[1568] | 72 | |
---|
[2] | 73 | //----------------------------------------------------- template initialization |
---|
[345] | 74 | // |
---|
| 75 | // Start output of page |
---|
| 76 | // |
---|
[5021] | 77 | $title = l10n('Identification'); |
---|
[850] | 78 | $page['body_id'] = 'theIdentificationPage'; |
---|
[345] | 79 | |
---|
[365] | 80 | $template->set_filenames( array('identification'=>'identification.tpl') ); |
---|
| 81 | |
---|
[2223] | 82 | $template->assign( |
---|
[402] | 83 | array( |
---|
[1052] | 84 | 'U_REDIRECT' => $redirect_to, |
---|
[1061] | 85 | |
---|
[2223] | 86 | 'F_LOGIN_ACTION' => get_root_url().'identification.php', |
---|
| 87 | 'authorize_remembering' => $conf['authorize_remembering'], |
---|
[402] | 88 | )); |
---|
[555] | 89 | |
---|
[12878] | 90 | if (!$conf['gallery_locked'] && $conf['allow_user_registration']) |
---|
[1652] | 91 | { |
---|
[2223] | 92 | $template->assign('U_REGISTER', get_root_url().'register.php' ); |
---|
[1652] | 93 | } |
---|
| 94 | |
---|
[12878] | 95 | if (!$conf['gallery_locked']) |
---|
| 96 | { |
---|
| 97 | $template->assign('U_LOST_PASSWORD', get_root_url().'password.php' ); |
---|
| 98 | } |
---|
| 99 | |
---|
[10812] | 100 | // include menubar |
---|
| 101 | $themeconf = $template->get_template_vars('themeconf'); |
---|
[12878] | 102 | if (!$conf['gallery_locked'] && (!isset($themeconf['hide_menu_on']) OR !in_array('theIdentificationPage', $themeconf['hide_menu_on']))) |
---|
[10812] | 103 | { |
---|
| 104 | include( PHPWG_ROOT_PATH.'include/menubar.inc.php'); |
---|
| 105 | } |
---|
| 106 | |
---|
[2] | 107 | //----------------------------------------------------------- html code display |
---|
[10812] | 108 | include(PHPWG_ROOT_PATH.'include/page_header.php'); |
---|
[18063] | 109 | trigger_action('loc_end_identification'); |
---|
[20609] | 110 | flush_page_messages(); |
---|
[2223] | 111 | $template->pparse('identification'); |
---|
[369] | 112 | include(PHPWG_ROOT_PATH.'include/page_tail.php'); |
---|
[362] | 113 | ?> |
---|