source: trunk/identification.php @ 12764

Last change on this file since 12764 was 12764, checked in by mistic100, 9 years ago

feature:2538 Make a unified messages management
use only $pageinfos and $pageerrors vars and and necessary template to all main pages

  • Property svn:eol-style set to LF
File size: 4.2 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Piwigo - a PHP based photo gallery                                    |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
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// +-----------------------------------------------------------------------+
23
24//--------------------------------------------------------------------- include
25define('PHPWG_ROOT_PATH','./');
26include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
27
28// +-----------------------------------------------------------------------+
29// | Check Access and exit when user status is not ok                      |
30// +-----------------------------------------------------------------------+
31check_status(ACCESS_FREE);
32
33//-------------------------------------------------------------- identification
34$redirect_to = '';
35if ( !empty($_GET['redirect']) )
36{
37  $redirect_to = urldecode($_GET['redirect']);
38  if ( is_a_guest() )
39  {
40    array_push($page['errors'], l10n('You are not authorized to access the requested page'));
41  }
42}
43
44if (isset($_POST['login']))
45{
46  if (!isset($_COOKIE[session_name()]))
47  {
48    array_push(
49      $page['errors'],
50      l10n('Cookies are blocked or not supported by your browser. You must enable cookies to connect.')
51      );
52  }
53  else
54  { 
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']) : '';
61    $remember_me = isset($_POST['remember_me']) and $_POST['remember_me']==1;
62   
63    if ( try_log_user($_POST['username'], $_POST['password'], $remember_me) )
64    {
65      redirect(empty($redirect_to) ? get_gallery_home_url() : $redirect_to);
66    }
67    else
68    {
69      array_push($page['errors'], l10n('Invalid password!') );
70    }
71  }
72}
73
74//----------------------------------------------------- template initialization
75//
76// Start output of page
77//
78$title = l10n('Identification');
79$page['body_id'] = 'theIdentificationPage';
80
81$template->set_filenames( array('identification'=>'identification.tpl') );
82
83$template->assign(
84  array(
85    'U_LOST_PASSWORD' => get_root_url().'password.php',
86    'U_REDIRECT' => $redirect_to,
87
88    'F_LOGIN_ACTION' => get_root_url().'identification.php',
89    'authorize_remembering' => $conf['authorize_remembering'],
90    ));
91
92if ($conf['allow_user_registration'])
93{
94  $template->assign('U_REGISTER', get_root_url().'register.php' );
95}
96
97// include menubar
98$themeconf = $template->get_template_vars('themeconf');
99if (!isset($themeconf['hide_menu_on']) OR !in_array('theIdentificationPage', $themeconf['hide_menu_on']))
100{
101  include( PHPWG_ROOT_PATH.'include/menubar.inc.php');
102}
103
104//----------------------------------------------------------- html code display
105include(PHPWG_ROOT_PATH.'include/page_header.php');
106$template->pparse('identification');
107include(PHPWG_ROOT_PATH.'include/page_tail.php');
108?>
Note: See TracBrowser for help on using the repository browser.