7 * LODEL - Logiciel d'Edition ELectronique.
9 * Copyright (c) 2001-2002, Ghislain Picard, Marin Dacos
10 * Copyright (c) 2003, Ghislain Picard, Marin Dacos, Luc Santeramo, Nicolas Nutten, Anne Gentil-Beccot
11 * Copyright (c) 2004, Ghislain Picard, Marin Dacos, Luc Santeramo, Anne Gentil-Beccot, Bruno Cénou
12 * Copyright (c) 2005, Ghislain Picard, Marin Dacos, Luc Santeramo, Gautier Poupeau, Jean Lamy, Bruno Cénou
13 * Copyright (c) 2006, Marin Dacos, Luc Santeramo, Bruno Cénou, Jean Lamy, Mikaël Cixous, Sophie Malafosse
14 * Copyright (c) 2007, Marin Dacos, Bruno Cénou, Sophie Malafosse, Pierre-Alain Mignot
15 * Copyright (c) 2008, Marin Dacos, Bruno Cénou, Pierre-Alain Mignot, Inès Secondat de Montesquieu, Jean-François Rivière
16 * Copyright (c) 2009, Marin Dacos, Bruno Cénou, Pierre-Alain Mignot, Inès Secondat de Montesquieu, Jean-François Rivière
18 * Home page: http://www.lodel.org
20 * E-Mail: lodel@lodel.org
24 * This program is free software; you can redistribute it and/or modify
25 * it under the terms of the GNU General Public License as published by
26 * the Free Software Foundation; either version 2 of the License, or
27 * (at your option) any later version.
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
34 * You should have received a copy of the GNU General Public License
35 * along with this program; if not, write to the Free Software
36 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
38 * @author Ghislain Picard
40 * @copyright 2001-2002, Ghislain Picard, Marin Dacos
41 * @copyright 2003, Ghislain Picard, Marin Dacos, Luc Santeramo, Nicolas Nutten, Anne Gentil-Beccot
42 * @copyright 2004, Ghislain Picard, Marin Dacos, Luc Santeramo, Anne Gentil-Beccot, Bruno Cénou
43 * @copyright 2005, Ghislain Picard, Marin Dacos, Luc Santeramo, Gautier Poupeau, Jean Lamy, Bruno Cénou
44 * @copyright 2006, Marin Dacos, Luc Santeramo, Bruno Cénou, Jean Lamy, Mikaël Cixous, Sophie Malafosse
45 * @copyright 2007, Marin Dacos, Bruno Cénou, Sophie Malafosse, Pierre-Alain Mignot
46 * @copyright 2008, Marin Dacos, Bruno Cénou, Pierre-Alain Mignot, Inès Secondat de Montesquieu, Jean-François Rivière
47 * @copyright 2009, Marin Dacos, Bruno Cénou, Pierre-Alain Mignot, Inès Secondat de Montesquieu, Jean-François Rivière
48 * @licence http://www.gnu.org/copyleft/gpl.html
50 * @package lodel/source/lodel/admin
52 define('backoffice', true
);
53 require 'siteconfig.php';
59 $login = C
::get('login');
61 if($login && C
::get('passwd') && C
::get('passwd2')) {
62 include 'loginfunc.php';
63 $retour = change_passwd(C
::get('datab'), $login, C
::get('old_passwd'), C
::get('passwd'), C
::get('passwd2'));
67 // on relance la procédure d'identification
68 if (!check_auth(C
::get('login'), C
::get('passwd'), C
::get('site', 'cfg'))) {
69 C
::set('error_login', 1);
71 //Vérifie que le site est bloqué si l'utilisateur est pas lodeladmin
72 if(C
::get('rights', 'lodeluser') < LEVEL_ADMINLODEL
) {
74 C
::set('site_bloque', $db->getOne(lq("SELECT 1 FROM #_MTP_sites WHERE name='".C
::get('site', 'cfg')."' AND status >= 32")));
76 if(C
::get('site_bloque') == 1) {
77 C
::set('error_site_bloque', 1);
81 // et on ouvre une session
82 $err = open_session(C
::get('login'));
83 if ((string)$err === 'error_opensession') {
87 check_internal_messaging();
88 header ("Location: http://". $_SERVER['SERVER_NAME']. ($_SERVER['SERVER_PORT'] != 80 ?
':'. $_SERVER['SERVER_PORT'] : ''). C
::get('url_retour'));
93 C
::set('suspended', 1);
95 case false
: // bad login/passwd
97 C
::set('error_login', 1);
101 include 'loginfunc.php';
103 if (!check_auth(C
::get('login'), C
::get('passwd'))) {
104 C
::set('error_login', 1);
107 //Vérifie que le site est bloqué si l'utilisateur est pas lodeladmin
108 if(C
::get('rights', 'lodeluser') < LEVEL_ADMINLODEL
) {
110 C
::set('site_bloque', $db->getOne(lq("SELECT 1 FROM #_MTP_sites WHERE name='".C
::get('site', 'cfg')."' AND status >= 32")));
112 if(C
::get('site_bloque') == 1) {
113 C
::set('error_site_bloque', 1);
117 //vérifie que le compte n'est pas en suspend. Si c'est le cas, on amène l'utilisateur à modifier son mdp, sinon on l'identifie
118 if(!check_suspended()) {
119 C
::set('suspended', 1);
124 if ((string)open_session(C
::get('login')) === 'error_opensession') {
125 C
::set('error_opensession', 1);
129 check_internal_messaging();
130 header ("Location: http".(C
::get('https', 'cfg') ?
's' : '')."://". $_SERVER['SERVER_NAME']. ($_SERVER['SERVER_PORT'] != 80 ?
':'. $_SERVER['SERVER_PORT'] : ''). C
::get('url_retour'));
134 C
::set('passwd', null
);
135 C
::set('passwd2', null
);
136 C
::set('old_passwd', null
);
137 // variable: sitebloque
138 /*if ($context['error_sitebloque']) { // on a deja verifie que la site est bloque.
139 $context['site_bloque'] = 1;
140 } else { // test si le site est bloque dans la DB.
143 $context['site_bloque'] = $db->getOne(lq("SELECT 1 FROM #_MTP_sites WHERE name='$site' AND status >= 32"));
147 View
::getView()->render('login');
149 catch(LodelException
$e)
151 echo $e->getContent();