Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        frontend
5
 * @package         account
6
 * @author          Ryan Djurovich, WebsiteBaker Project
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @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: login.php 2101 2014-02-13 23:41:55Z darkviper $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/account/login.php $
14
 * @lastmodified    $Date: 2014-02-14 00:41:55 +0100 (Fri, 14 Feb 2014) $
15
 *
16
 */
17

    
18
// 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

    
25
//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

    
28
require_once(WB_PATH.'/framework/functions.php');
29

    
30
$wb = new frontend(false);
31

    
32
// Make sure the login is enabled
33
if(!FRONTEND_LOGIN) {
34
		header('Location: '.WB_URL.'/');
35
		exit(0);
36
//	if(INTRO_PAGE) {
37
//		header('Location: '.WB_URL.PAGES_DIRECTORY.'/index.php');
38
//		exit(0);
39
//	} else {
40
//	}
41
}
42

    
43
$page_id = defined('REFERRER_ID') ? REFERRER_ID : isset($_SESSION['PAGE_ID']) ? $_SESSION['PAGE_ID'] : 0;
44

    
45
// Required page details
46
$page_description = '';
47
$page_keywords = '';
48
// 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
define('PAGE_ID', $page_id);
54
define('ROOT_PARENT', $root_parent);
55
define('PARENT', 0);
56
define('LEVEL', $level);
57

    
58
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
$redirect  = strip_tags(isset(${$requestMethod}['redirect']) ? ${$requestMethod}['redirect'] : '');
67
//$redirect = ( (empty($redirect)) ?  $_SERVER['HTTP_REFERER'] : $redirect);
68
$_SESSION['HTTP_REFERER'] = str_replace(WB_URL,'',$redirect);
69

    
70
$loginUrl  = WB_URL.'/account/login.php';
71
$loginUrl .= (!empty($redirect) ? '?redirect=' .$_SESSION['HTTP_REFERER'] : '');
72

    
73
$WarningUrl  = str_replace(WB_PATH,WB_URL,$wb->correct_theme_source('warning.html'));
74
// Setup template object, parse vars to it, then parse it
75
$ThemePath = realpath(WB_PATH.$wb->correct_theme_source('loginBox.htt'));
76

    
77
$thisApp = new Login(
78
				array(
79
						"MAX_ATTEMPS" => "3",
80
						"WARNING_URL" => $WarningUrl,
81
						"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
						"LOGIN_URL" => $loginUrl,
89
						"DEFAULT_URL" => WB_URL."/index.php",
90
						"TEMPLATE_DIR" => $ThemePath,
91
						"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
                    )
98
		);
99

    
100
// Set extra outsider var
101
$globals[] = 'thisApp';
102

    
103
// Include the index (wrapper) file
104
require(WB_PATH.'/index.php');
(12-12/22)