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 |
1792
|
Luisehahne
|
// Include config file
|
19 |
|
|
$config_file = realpath('../config.php');
|
20 |
|
|
if(file_exists($config_file) && !defined('WB_URL'))
|
21 |
|
|
{
|
22 |
|
|
require_once($config_file);
|
23 |
|
|
}
|
24 |
1473
|
Luisehahne
|
|
25 |
2101
|
darkviper
|
//if(!class_exists('login', false)){ include(WB_PATH.'/framework/class.login.php'); }
|
26 |
|
|
//if(!class_exists('frontend', false)){ include(WB_PATH.'/framework/class.frontend.php'); }
|
27 |
1792
|
Luisehahne
|
|
28 |
|
|
require_once(WB_PATH.'/framework/functions.php');
|
29 |
|
|
|
30 |
|
|
$wb = new frontend(false);
|
31 |
|
|
|
32 |
1473
|
Luisehahne
|
// Make sure the login is enabled
|
33 |
|
|
if(!FRONTEND_LOGIN) {
|
34 |
1792
|
Luisehahne
|
header('Location: '.WB_URL.'/');
|
35 |
1473
|
Luisehahne
|
exit(0);
|
36 |
1719
|
Luisehahne
|
// if(INTRO_PAGE) {
|
37 |
|
|
// header('Location: '.WB_URL.PAGES_DIRECTORY.'/index.php');
|
38 |
|
|
// exit(0);
|
39 |
|
|
// } else {
|
40 |
|
|
// }
|
41 |
1473
|
Luisehahne
|
}
|
42 |
|
|
|
43 |
1792
|
Luisehahne
|
$page_id = defined('REFERRER_ID') ? REFERRER_ID : isset($_SESSION['PAGE_ID']) ? $_SESSION['PAGE_ID'] : 0;
|
44 |
1508
|
Luisehahne
|
|
45 |
1473
|
Luisehahne
|
// Required page details
|
46 |
|
|
$page_description = '';
|
47 |
|
|
$page_keywords = '';
|
48 |
1792
|
Luisehahne
|
// Work out level
|
49 |
|
|
$level = ($page_id > 0 )? level_count($page_id): $page_id;
|
50 |
|
|
// Work out root parent
|
51 |
|
|
$root_parent = ($page_id > 0 )? root_parent($page_id): $page_id;
|
52 |
|
|
|
53 |
1508
|
Luisehahne
|
define('PAGE_ID', $page_id);
|
54 |
1792
|
Luisehahne
|
define('ROOT_PARENT', $root_parent);
|
55 |
1473
|
Luisehahne
|
define('PARENT', 0);
|
56 |
1792
|
Luisehahne
|
define('LEVEL', $level);
|
57 |
|
|
|
58 |
1473
|
Luisehahne
|
define('PAGE_TITLE', $TEXT['PLEASE_LOGIN']);
|
59 |
|
|
define('MENU_TITLE', $TEXT['PLEASE_LOGIN']);
|
60 |
|
|
define('VISIBILITY', 'public');
|
61 |
|
|
// Set the page content include file
|
62 |
|
|
define('PAGE_CONTENT', WB_PATH.'/account/login_form.php');
|
63 |
|
|
|
64 |
|
|
// Create new login app
|
65 |
|
|
$requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']);
|
66 |
1529
|
Luisehahne
|
$redirect = strip_tags(isset(${$requestMethod}['redirect']) ? ${$requestMethod}['redirect'] : '');
|
67 |
1728
|
Luisehahne
|
//$redirect = ( (empty($redirect)) ? $_SERVER['HTTP_REFERER'] : $redirect);
|
68 |
1605
|
Luisehahne
|
$_SESSION['HTTP_REFERER'] = str_replace(WB_URL,'',$redirect);
|
69 |
1529
|
Luisehahne
|
|
70 |
1604
|
Luisehahne
|
$loginUrl = WB_URL.'/account/login.php';
|
71 |
1605
|
Luisehahne
|
$loginUrl .= (!empty($redirect) ? '?redirect=' .$_SESSION['HTTP_REFERER'] : '');
|
72 |
1529
|
Luisehahne
|
|
73 |
1833
|
Luisehahne
|
$WarningUrl = str_replace(WB_PATH,WB_URL,$wb->correct_theme_source('warning.html'));
|
74 |
1529
|
Luisehahne
|
// Setup template object, parse vars to it, then parse it
|
75 |
1719
|
Luisehahne
|
$ThemePath = realpath(WB_PATH.$wb->correct_theme_source('loginBox.htt'));
|
76 |
1529
|
Luisehahne
|
|
77 |
1473
|
Luisehahne
|
$thisApp = new Login(
|
78 |
|
|
array(
|
79 |
|
|
"MAX_ATTEMPS" => "3",
|
80 |
1833
|
Luisehahne
|
"WARNING_URL" => $WarningUrl,
|
81 |
1473
|
Luisehahne
|
"USERNAME_FIELDNAME" => 'username',
|
82 |
|
|
"PASSWORD_FIELDNAME" => 'password',
|
83 |
|
|
"REMEMBER_ME_OPTION" => SMART_LOGIN,
|
84 |
|
|
"MIN_USERNAME_LEN" => "2",
|
85 |
|
|
"MIN_PASSWORD_LEN" => "2",
|
86 |
|
|
"MAX_USERNAME_LEN" => "30",
|
87 |
|
|
"MAX_PASSWORD_LEN" => "30",
|
88 |
1529
|
Luisehahne
|
"LOGIN_URL" => $loginUrl,
|
89 |
1719
|
Luisehahne
|
"DEFAULT_URL" => WB_URL."/index.php",
|
90 |
1529
|
Luisehahne
|
"TEMPLATE_DIR" => $ThemePath,
|
91 |
1473
|
Luisehahne
|
"TEMPLATE_FILE" => "login.htt",
|
92 |
|
|
"FRONTEND" => true,
|
93 |
|
|
"FORGOTTEN_DETAILS_APP" => WB_URL."/account/forgot.php",
|
94 |
|
|
"USERS_TABLE" => TABLE_PREFIX."users",
|
95 |
|
|
"GROUPS_TABLE" => TABLE_PREFIX."groups",
|
96 |
|
|
"REDIRECT_URL" => $redirect
|
97 |
1792
|
Luisehahne
|
)
|
98 |
1473
|
Luisehahne
|
);
|
99 |
|
|
|
100 |
|
|
// Set extra outsider var
|
101 |
|
|
$globals[] = 'thisApp';
|
102 |
|
|
|
103 |
|
|
// Include the index (wrapper) file
|
104 |
|
|
require(WB_PATH.'/index.php');
|