source: trunk/identification.php @ 16930

Last change on this file since 16930 was 15578, checked in by mistic100, 12 years ago

feature:2538 little rework of messages system, now can be used on 'loc_end_index' and 'loc_end_picture'

  • Property svn:eol-style set to LF
File size: 4.3 KB
RevLine 
[2]1<?php
[354]2// +-----------------------------------------------------------------------+
[8728]3// | Piwigo - a PHP based photo gallery                                    |
[2297]4// +-----------------------------------------------------------------------+
[12878]5// | Copyright(C) 2008-2012 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]25define('PHPWG_ROOT_PATH','./');
26include_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]31check_status(ACCESS_FREE);
[1851]32
[2]33//-------------------------------------------------------------- identification
[1052]34$redirect_to = '';
35if ( !empty($_GET['redirect']) )
36{
[1061]37  $redirect_to = urldecode($_GET['redirect']);
[2029]38  if ( is_a_guest() )
[1052]39  {
[12764]40    array_push($page['errors'], l10n('You are not authorized to access the requested page'));
[1052]41  }
42}
43
[541]44if (isset($_POST['login']))
[2]45{
[4956]46  if (!isset($_COOKIE[session_name()]))
[2]47  {
[4956]48    array_push(
[12764]49      $page['errors'],
[4956]50      l10n('Cookies are blocked or not supported by your browser. You must enable cookies to connect.')
51      );
[2]52  }
53  else
[4956]54  { 
[11989]55    if ($conf['insensitive_case_logon'] == true)
56    {
57      $_POST['username'] = search_case_username($_POST['username']);
58    }
59   
60    $redirect_to = isset($_POST['redirect']) ? urldecode($_POST['redirect']) : '';
[4956]61    $remember_me = isset($_POST['remember_me']) and $_POST['remember_me']==1;
[11989]62   
[4956]63    if ( try_log_user($_POST['username'], $_POST['password'], $remember_me) )
64    {
[11368]65      redirect(empty($redirect_to) ? get_gallery_home_url() : $redirect_to);
[4956]66    }
67    else
68    {
[12764]69      array_push($page['errors'], l10n('Invalid password!') );
[4956]70    }
[2]71  }
72}
[1568]73
[2]74//----------------------------------------------------- template initialization
[345]75//
76// Start output of page
77//
[5021]78$title = l10n('Identification');
[850]79$page['body_id'] = 'theIdentificationPage';
[345]80
[365]81$template->set_filenames( array('identification'=>'identification.tpl') );
82
[2223]83$template->assign(
[402]84  array(
[1052]85    'U_REDIRECT' => $redirect_to,
[1061]86
[2223]87    'F_LOGIN_ACTION' => get_root_url().'identification.php',
88    'authorize_remembering' => $conf['authorize_remembering'],
[402]89    ));
[555]90
[12878]91if (!$conf['gallery_locked'] && $conf['allow_user_registration'])
[1652]92{
[2223]93  $template->assign('U_REGISTER', get_root_url().'register.php' );
[1652]94}
95
[12878]96if (!$conf['gallery_locked'])
97{
98  $template->assign('U_LOST_PASSWORD', get_root_url().'password.php' );
99}
100
[10812]101// include menubar
102$themeconf = $template->get_template_vars('themeconf');
[12878]103if (!$conf['gallery_locked'] && (!isset($themeconf['hide_menu_on']) OR !in_array('theIdentificationPage', $themeconf['hide_menu_on'])))
[10812]104{
105  include( PHPWG_ROOT_PATH.'include/menubar.inc.php');
106}
107
[2]108//----------------------------------------------------------- html code display
[10812]109include(PHPWG_ROOT_PATH.'include/page_header.php');
[15578]110include(PHPWG_ROOT_PATH.'include/page_messages.php');
[2223]111$template->pparse('identification');
[369]112include(PHPWG_ROOT_PATH.'include/page_tail.php');
[362]113?>
Note: See TracBrowser for help on using the repository browser.