Project

General

Profile

1 1473 Luisehahne
<?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$
14
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
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 1508 Luisehahne
$page_id = !empty($_SESSION['PAGE_ID']) ? $_SESSION['PAGE_ID'] : 0;
33
34 1473 Luisehahne
// Required page details
35 1508 Luisehahne
// $page_id = 0;
36 1473 Luisehahne
$page_description = '';
37
$page_keywords = '';
38 1508 Luisehahne
define('PAGE_ID', $page_id);
39 1473 Luisehahne
define('ROOT_PARENT', 0);
40
define('PARENT', 0);
41
define('LEVEL', 0);
42
define('PAGE_TITLE', $TEXT['PLEASE_LOGIN']);
43
define('MENU_TITLE', $TEXT['PLEASE_LOGIN']);
44
define('VISIBILITY', 'public');
45
// Set the page content include file
46
define('PAGE_CONTENT', WB_PATH.'/account/login_form.php');
47
48
require_once(WB_PATH.'/framework/class.login.php');
49 1529 Luisehahne
require_once(WB_PATH.'/framework/class.frontend.php');
50 1473 Luisehahne
51 1529 Luisehahne
// Create new frontend object
52
$wb = new frontend();
53
54 1473 Luisehahne
// Create new login app
55
$requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']);
56 1529 Luisehahne
$redirect  = strip_tags(isset(${$requestMethod}['redirect']) ? ${$requestMethod}['redirect'] : '');
57 1603 Luisehahne
$redirect = ((isset($_SESSION['HTTP_REFERER']) && ($redirect='')) ?  $_SESSION['HTTP_REFERER'] : $redirect);
58
// $_SESSION['HTTP_REFERER'] = str_replace(WB_URL,'',$redirect);
59 1529 Luisehahne
60 1604 Luisehahne
$loginUrl  = WB_URL.'/account/login.php';
61
$loginUrl .= (($redirect!='') ? '?redirect=' .$_SESSION['HTTP_REFERER'] : $loginUrl);
62 1529 Luisehahne
63
$ThemeUrl  = WB_URL.$wb->correct_theme_source('warning.html');
64
// Setup template object, parse vars to it, then parse it
65
$ThemePath = realpath(WB_PATH.$wb->correct_theme_source('login.htt'));
66
67 1473 Luisehahne
$thisApp = new Login(
68
				array(
69
						"MAX_ATTEMPS" => "3",
70 1529 Luisehahne
						"WARNING_URL" => $ThemeUrl."/warning.html",
71 1473 Luisehahne
						"USERNAME_FIELDNAME" => 'username',
72
						"PASSWORD_FIELDNAME" => 'password',
73
						"REMEMBER_ME_OPTION" => SMART_LOGIN,
74
						"MIN_USERNAME_LEN" => "2",
75
						"MIN_PASSWORD_LEN" => "2",
76
						"MAX_USERNAME_LEN" => "30",
77
						"MAX_PASSWORD_LEN" => "30",
78 1529 Luisehahne
						"LOGIN_URL" => $loginUrl,
79 1473 Luisehahne
						"DEFAULT_URL" => WB_URL.PAGES_DIRECTORY."/index.php",
80 1529 Luisehahne
						"TEMPLATE_DIR" => $ThemePath,
81 1473 Luisehahne
						"TEMPLATE_FILE" => "login.htt",
82
						"FRONTEND" => true,
83
						"FORGOTTEN_DETAILS_APP" => WB_URL."/account/forgot.php",
84
						"USERS_TABLE" => TABLE_PREFIX."users",
85
						"GROUPS_TABLE" => TABLE_PREFIX."groups",
86
						"REDIRECT_URL" => $redirect
87
				)
88
		);
89
90
// Set extra outsider var
91
$globals[] = 'thisApp';
92
93
// Include the index (wrapper) file
94
require(WB_PATH.'/index.php');