Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        frontend
5
 * @package         account
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id: login.php 1529 2011-11-25 05:03:32Z Luisehahne $
14
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/account/login.php $
15
 * @lastmodified    $Date: 2011-11-25 06:03:32 +0100 (Fri, 25 Nov 2011) $
16
 *
17
 */
18

    
19
require_once("../config.php");
20

    
21
// Make sure the login is enabled
22
if(!FRONTEND_LOGIN) {
23
	if(INTRO_PAGE) {
24
		header('Location: '.WB_URL.PAGES_DIRECTORY.'/index.php');
25
		exit(0);
26
	} else {
27
		header('Location: '.WB_URL.'/index.php');
28
		exit(0);
29
	}
30
}
31

    
32
require_once(WB_PATH.'/framework/class.frontend.php');
33
$wb_inst = new wb();
34
$page_id = !empty($_SESSION['PAGE_ID']) ? $_SESSION['PAGE_ID'] : 0;
35

    
36
// Required page details
37
// $page_id = 0;
38
$page_description = '';
39
$page_keywords = '';
40
define('PAGE_ID', $page_id);
41
define('ROOT_PARENT', 0);
42
define('PARENT', 0);
43
define('LEVEL', 0);
44
define('PAGE_TITLE', $TEXT['PLEASE_LOGIN']);
45
define('MENU_TITLE', $TEXT['PLEASE_LOGIN']);
46
define('VISIBILITY', 'public');
47
// Set the page content include file
48
define('PAGE_CONTENT', WB_PATH.'/account/login_form.php');
49

    
50
require_once(WB_PATH.'/framework/class.login.php');
51
require_once(WB_PATH.'/framework/class.frontend.php');
52

    
53
// Create new frontend object
54
$wb = new frontend();
55

    
56
// Create new login app
57
$requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']);
58
$redirect  = strip_tags(isset(${$requestMethod}['redirect']) ? ${$requestMethod}['redirect'] : '');
59
$redirect = ((isset($_SERVER['HTTP_REFERER']) && empty($redirect)) ?  $_SERVER['HTTP_REFERER'] : $redirect);
60
$_SESSION['HTTP_REFERER'] = str_replace(WB_URL,'',$redirect);
61

    
62
$loginUrl  = WB_URL.'/account/login.php';
63
$loginUrl .= (!empty($redirect) ? '?redirect=' .$_SESSION['HTTP_REFERER'] : '');
64

    
65
$ThemeUrl  = WB_URL.$wb->correct_theme_source('warning.html');
66
// Setup template object, parse vars to it, then parse it
67
$ThemePath = realpath(WB_PATH.$wb->correct_theme_source('login.htt'));
68

    
69
$thisApp = new Login(
70
				array(
71
						"MAX_ATTEMPS" => "3",
72
						"WARNING_URL" => $ThemeUrl."/warning.html",
73
						"USERNAME_FIELDNAME" => 'username',
74
						"PASSWORD_FIELDNAME" => 'password',
75
						"REMEMBER_ME_OPTION" => SMART_LOGIN,
76
						"MIN_USERNAME_LEN" => "2",
77
						"MIN_PASSWORD_LEN" => "2",
78
						"MAX_USERNAME_LEN" => "30",
79
						"MAX_PASSWORD_LEN" => "30",
80
						"LOGIN_URL" => $loginUrl,
81
						"DEFAULT_URL" => WB_URL.PAGES_DIRECTORY."/index.php",
82
						"TEMPLATE_DIR" => $ThemePath,
83
						"TEMPLATE_FILE" => "login.htt",
84
						"FRONTEND" => true,
85
						"FORGOTTEN_DETAILS_APP" => WB_URL."/account/forgot.php",
86
						"USERS_TABLE" => TABLE_PREFIX."users",
87
						"GROUPS_TABLE" => TABLE_PREFIX."groups",
88
						"REDIRECT_URL" => $redirect
89
				)
90
		);
91

    
92
// Set extra outsider var
93
$globals[] = 'thisApp';
94

    
95
// Include the index (wrapper) file
96
require(WB_PATH.'/index.php');
(7-7/16)