2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 10/14/2003 *
4 * =================== Last change: 04/28/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-login.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Login area (redirects to the real login module) *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Loginbereich (leitet an das richtige Lgin-Modul *
13 * -------------------------------------------------------------------- *
16 * $Tag:: 0.2.1-FINAL $ *
18 * -------------------------------------------------------------------- *
19 * Copyright (c) 2003 - 2009 by Roland Haeder *
20 * Copyright (c) 2009 - 2011 by Mailer Developer Team *
21 * For more information visit: http://www.mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
28 * This program is distributed in the hope that it will be useful, *
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
31 * GNU General Public License for more details. *
33 * You should have received a copy of the GNU General Public License *
34 * along with this program; if not, write to the Free Software *
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
37 ************************************************************************/
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
44 // Add description as navigation point
45 addYouAreHereLink('guest', __FILE__);
47 if ((!isExtensionActive('user')) && (!isAdmin())) {
48 displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=user%}');
52 // Initialize variables
60 if ((isMemberIdSet()) && (isSessionVariableSet('u_hash'))) {
61 // Maybe, then continue with it
62 $userid = getMemberId();
63 } elseif ((isPostRequestParameterSet('id')) && (isPostRequestParameterSet('password')) && (isFormSent())) {
64 // Set userid and crypt password when login data was submitted
65 if (isNicknameUsed(postRequestParameter('id'))) {
67 $userid = SQL_ESCAPE(postRequestParameter('id'));
69 // Direct userid entered
70 $userid = bigintval(postRequestParameter('id'));
72 } elseif (isPostRequestParameterSet('new_pass')) {
73 // New password requested
75 if (isPostRequestParameterSet('email')) {
77 $userid = SQL_ESCAPE(postRequestParameter('email'));
78 } elseif (isPostRequestParameterSet('id')) {
79 // Do we have nickname or userid?
80 if (isNicknameUsed(postRequestParameter('id'))) {
82 $userid = SQL_ESCAPE(postRequestParameter('id'));
84 // Direct userid entered
85 $userid = bigintval(postRequestParameter('id'));
95 // Login immidiately...
96 $url = 'modules.php?module=login';
97 } elseif ((isFormSent()) && ('' . $userid . '' != '' . postRequestParameter('id') . '')) {
98 // Invalid input (no nickname extension installed but nickname entered)
99 $errorCode = getCode('EXTENSION_PROBLEM');
100 } elseif (isFormSent()) {
101 // Try the login (see inc/libs/user_functions.php)
102 $url = doUserLogin(postRequestParameter('id'), postRequestParameter('password'));
103 } elseif ((isPostRequestParameterSet('new_pass')) && (isset($userid))) {
104 // Try the userid/email lookup (see inc/libs/user_functions.php)
105 $errorCode = doNewUserPassword(postRequestParameter('email'), $userid);
109 if (isGetRequestParameterSet('login')) {
111 $errorCode = getRequestParameter('login');
114 // No problems, no output by detault
115 $content['message'] = '';
118 if (!empty($errorCode)) {
119 // Do we have a userid set?
120 if (isSessionVariableSet('current_userid')) {
121 // Then prefetch data for this account
122 fetchUserData(getSession('current_userid'));
125 // @TODO Move this HTML code into a template
126 $content['message'] = '<tr>
127 <td colspan="4" align="center">
128 <span class="notice">' . getMessageFromErrorCode($errorCode) . '</span>
133 // Display login form with resend-password form
134 if (isExtensionActive('nickname')) {
135 loadTemplate('guest_nickname_login', false, $content);
137 loadTemplate('guest_login', false, $content);
140 // Was an URL constructed?
142 // URL was constructed
143 if (ifFatalErrorsDetected()) {
144 // Handle fatal errors
145 runFilterChain('handle_fatal_errors');