Project

General

Profile

1 1473 Luisehahne
<?php
2
/**
3
 *
4
 * @category        frontend
5
 * @package         account
6 1719 Luisehahne
 * @author          Ryan Djurovich, WebsiteBaker Project
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8 1473 Luisehahne
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id$
13
 * @filesource		$HeadURL$
14
 * @lastmodified    $Date$
15
 *
16
 */
17
18
require_once("../config.php");
19
20
// Make sure the login is enabled
21
if(!FRONTEND_LOGIN) {
22
		header('Location: '.WB_URL.'/index.php');
23
		exit(0);
24 1719 Luisehahne
//	if(INTRO_PAGE) {
25
//		header('Location: '.WB_URL.PAGES_DIRECTORY.'/index.php');
26
//		exit(0);
27
//	} else {
28
//	}
29 1473 Luisehahne
}
30
31 1508 Luisehahne
$page_id = !empty($_SESSION['PAGE_ID']) ? $_SESSION['PAGE_ID'] : 0;
32
33 1473 Luisehahne
// Required page details
34 1508 Luisehahne
// $page_id = 0;
35 1473 Luisehahne
$page_description = '';
36
$page_keywords = '';
37 1508 Luisehahne
define('PAGE_ID', $page_id);
38 1473 Luisehahne
define('ROOT_PARENT', 0);
39
define('PARENT', 0);
40
define('LEVEL', 0);
41
define('PAGE_TITLE', $TEXT['PLEASE_LOGIN']);
42
define('MENU_TITLE', $TEXT['PLEASE_LOGIN']);
43
define('VISIBILITY', 'public');
44
// Set the page content include file
45
define('PAGE_CONTENT', WB_PATH.'/account/login_form.php');
46
47
require_once(WB_PATH.'/framework/class.login.php');
48 1529 Luisehahne
require_once(WB_PATH.'/framework/class.frontend.php');
49 1473 Luisehahne
50 1529 Luisehahne
// Create new frontend object
51
$wb = new frontend();
52
53 1473 Luisehahne
// Create new login app
54
$requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']);
55 1529 Luisehahne
$redirect  = strip_tags(isset(${$requestMethod}['redirect']) ? ${$requestMethod}['redirect'] : '');
56 1728 Luisehahne
//$redirect = ( (empty($redirect)) ?  $_SERVER['HTTP_REFERER'] : $redirect);
57 1605 Luisehahne
$_SESSION['HTTP_REFERER'] = str_replace(WB_URL,'',$redirect);
58 1529 Luisehahne
59 1604 Luisehahne
$loginUrl  = WB_URL.'/account/login.php';
60 1605 Luisehahne
$loginUrl .= (!empty($redirect) ? '?redirect=' .$_SESSION['HTTP_REFERER'] : '');
61 1529 Luisehahne
62 1728 Luisehahne
//print '<pre style="text-align: left;"><strong>function '.__FUNCTION__.'( '.''.' );</strong>  basename: '.basename(__FILE__).'  line: '.__LINE__.' -> <br />';
63
//print_r( $redirect ); print '</pre>';
64
65 1529 Luisehahne
$ThemeUrl  = WB_URL.$wb->correct_theme_source('warning.html');
66
// Setup template object, parse vars to it, then parse it
67 1719 Luisehahne
$ThemePath = realpath(WB_PATH.$wb->correct_theme_source('loginBox.htt'));
68 1529 Luisehahne
69 1473 Luisehahne
$thisApp = new Login(
70
				array(
71
						"MAX_ATTEMPS" => "3",
72 1529 Luisehahne
						"WARNING_URL" => $ThemeUrl."/warning.html",
73 1473 Luisehahne
						"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 1529 Luisehahne
						"LOGIN_URL" => $loginUrl,
81 1719 Luisehahne
						"DEFAULT_URL" => WB_URL."/index.php",
82 1529 Luisehahne
						"TEMPLATE_DIR" => $ThemePath,
83 1473 Luisehahne
						"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');