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 2125 2015-06-17 18:42:26Z darkviper $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/account/login.php $
14
 * @lastmodified    $Date: 2015-06-17 20:42:26 +0200 (Wed, 17 Jun 2015) $
15
 *
16
 */
17

    
18
// Include the configuration file
19
$sStartFile = dirname(__DIR__).'/framework/initialize.php';
20
if (!defined('SYSTEM_RUN')) { require($sStartFile); }
21
require_once($oReg->AppPath.'framework/functions.php');
22

    
23
$wb = new frontend(false);
24

    
25
// Make sure the login is enabled
26
if(!$oReg->FrontendLogin) {
27
    header('Location: '.$oReg->AppUrl);
28
    exit;
29
}
30
$page_id =
31
    isset($oReg->ReferrerId)
32
    ? $oReg->ReferrerId
33
    : isset($_SESSION['PAGE_ID']) ? $_SESSION['PAGE_ID'] : 0;
34

    
35
// Required page details
36
$page_description = '';
37
$page_keywords = '';
38
// Work out level
39
$level = ($page_id > 0 ) ? level_count($page_id) : $page_id;
40
// Work out root parent
41
$root_parent = ($page_id > 0 ) ? root_parent($page_id) : $page_id;
42

    
43
define('PAGE_ID', $page_id);
44
define('ROOT_PARENT', $root_parent);
45
define('PARENT', 0);
46
define('LEVEL', $level);
47

    
48
define('PAGE_TITLE', $oTrans->TEXT_PLEASE_LOGIN);
49
define('MENU_TITLE', $oTrans->TEXT_PLEASE_LOGIN);
50
define('VISIBILITY', 'public');
51
// Set the page content include file
52
define('PAGE_CONTENT', $oReg->AppPath.'account/login_form.php');
53

    
54
// Create new login app
55
$requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']);
56
$sRedirect  = strip_tags(isset(${$requestMethod}['redirect']) ? ${$requestMethod}['redirect'] : '');
57
//$redirect = ( (empty($redirect)) ?  $_SERVER['HTTP_REFERER'] : $redirect);
58
$_SESSION['HTTP_REFERER'] = str_replace($oReg->AppUrl,'/',$sRedirect);
59

    
60
$sLoginUrl  = $oReg->AppUrl.'account/login.php';
61
$sLoginUrl .= (!empty($sRedirect) ? '?redirect=' .$_SESSION['HTTP_REFERER'] : '');
62

    
63
$sWarningUrl  = str_replace($oReg->AppPath, $oReg->AppUrl, $wb->correct_theme_source('warning.html'));
64
// Setup template object, parse vars to it, then parse it
65
$sThemePath = realpath($oReg->AppPath . ltrim($wb->correct_theme_source('loginBox.htt'), '/'));
66

    
67
$thisApp = new Login(
68
    array(
69
        'MAX_ATTEMPS'           => 3,
70
        'WARNING_URL'           => $sWarningUrl,
71
        'USERNAME_FIELDNAME'    => 'username',
72
        'PASSWORD_FIELDNAME'    => 'password',
73
        'REMEMBER_ME_OPTION'    => $oReg->SmartLogin,
74
        'MIN_USERNAME_LEN'      => 2,
75
        'MIN_PASSWORD_LEN'      => 3,
76
        'MAX_USERNAME_LEN'      => 100,
77
        'MAX_PASSWORD_LEN'      => 100,
78
        'LOGIN_URL'             => $sLoginUrl,
79
        'DEFAULT_URL'           => $oReg->AppUrl.'index.php',
80
        'TEMPLATE_DIR'          => $sThemePath,
81
        'TEMPLATE_FILE'         => 'login.htt',
82
        'FRONTEND'              => true,
83
        'FORGOTTEN_DETAILS_APP' => $oReg->AppUrl.'/account/forgot.php',
84
        'USERS_TABLE'           => $oDb->TablePrefix.'users',
85
        'GROUPS_TABLE'          => $oDb->TablePrefix.'groups',
86
        'REDIRECT_URL'          => $sRedirect
87
    )
88
);
89
// Set extra outsider var
90
$globals[] = 'thisApp';
91
// Include the index (wrapper) file
92
require($oReg->AppPath.'index.php');
(12-12/22)