Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        frontend
5
 * @package         account
6
 * @author          WebsiteBaker Project
7
 * @copyright       Ryan Djurovich
8
 * @copyright       WebsiteBaker Org. e.V.
9
 * @link            http://websitebaker.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.3
12
 * @requirements    PHP 5.3.6 and higher
13
 * @version         $Id: login.php 2 2017-07-02 15:14:29Z Manuela $
14
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/trunk/account/login.php $
15
 * @lastmodified    $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
16
 *
17
 */
18

    
19
if ( !defined( 'WB_PATH' ) ){ require(dirname(__DIR__).'/config.php'); }
20
if ( !class_exists('frontend')) { require(WB_PATH.'/framework/class.frontend.php');  }
21
// Create new frontend object
22
if (!isset($wb) || !($wb instanceof frontend)) { $wb = new frontend(); }
23

    
24
// Make sure the login is enabled
25
if(!FRONTEND_LOGIN) {
26
    if(INTRO_PAGE) {
27
        header('Location: '.WB_URL.'/index.php');
28
        exit(0);
29
    } else {
30
        header('Location: '.WB_URL.'/index.php');
31
        exit(0);
32
          if ( $wb->get_user_id() && $wb->ami_group_member( '1' ) ) {
33
          } else {
34
              $wb->print_missing_frontend_login();
35
          }
36
          exit(0);
37
    }
38
}
39

    
40
$page_id = @$_SESSION['PAGE_ID'] ?: 0;
41

    
42
// Required page details
43
// $page_id = 0;
44
$page_description = '';
45
$page_keywords = '';
46
define('PAGE_ID', $page_id);
47
define('ROOT_PARENT', 0);
48
define('PARENT', 0);
49
define('LEVEL', 0);
50
define('PAGE_TITLE', $TEXT['PLEASE_LOGIN']);
51
define('MENU_TITLE', $TEXT['PLEASE_LOGIN']);
52
define('VISIBILITY', 'public');
53
// Set the page content include file
54
define('PAGE_CONTENT', WB_PATH.'/account/login_form.php');
55

    
56
require_once(WB_PATH.'/framework/Login.php');
57
require_once(WB_PATH.'/framework/class.frontend.php');
58

    
59
// Create new frontend object
60
//$wb = new frontend();
61

    
62
// Create new login app
63
$requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']);
64
$redirect  = strip_tags(isset(${$requestMethod}['redirect']) ? ${$requestMethod}['redirect'] : '');
65
$redirect = ((isset($_SERVER['HTTP_REFERER']) && empty($redirect)) ?  $_SERVER['HTTP_REFERER'] : $redirect);
66
$_SESSION['HTTP_REFERER'] = str_replace(WB_URL,'',$redirect);
67

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

    
71
$ThemeUrl  = WB_URL.$wb->correct_theme_source('warning.html');
72
// Setup template object, parse vars to it, then parse it
73
$ThemePath = realpath(WB_PATH.$wb->correct_theme_source('login.htt'));
74

    
75
$thisApp = new Login(
76
                array(
77
                        "MAX_ATTEMPS" => "3",
78
                        "WARNING_URL" => $ThemeUrl."/warning.html",
79
                        "USERNAME_FIELDNAME" => 'username',
80
                        "PASSWORD_FIELDNAME" => 'password',
81
                        "REMEMBER_ME_OPTION" => SMART_LOGIN,
82
                        "MIN_USERNAME_LEN" => "2",
83
                        "MIN_PASSWORD_LEN" => "2",
84
                        "MAX_USERNAME_LEN" => "30",
85
                        "MAX_PASSWORD_LEN" => "30",
86
                        "LOGIN_URL" => $loginUrl,
87
                        "DEFAULT_URL" => WB_URL."/index.php",
88
                        "TEMPLATE_DIR" => $ThemePath,
89
                        "TEMPLATE_FILE" => "login.htt",
90
                        "FRONTEND" => true,
91
                        "FORGOTTEN_DETAILS_APP" => WB_URL."/account/forgot.php",
92
                        "USERS_TABLE" => TABLE_PREFIX."users",
93
                        "GROUPS_TABLE" => TABLE_PREFIX."groups",
94
                        "REDIRECT_URL" => $redirect
95
                )
96
        );
97

    
98
// Set extra outsider var
99
$globals[] = 'thisApp';
100

    
101
// Include the index (wrapper) file
102
require(WB_PATH.'/index.php');
(6-6/15)