| 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 |
2125
|
darkviper
|
// 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 |
1473
|
Luisehahne
|
|
| 23 |
1792
|
Luisehahne
|
$wb = new frontend(false);
|
| 24 |
|
|
|
| 25 |
1473
|
Luisehahne
|
// Make sure the login is enabled
|
| 26 |
2125
|
darkviper
|
if(!$oReg->FrontendLogin) {
|
| 27 |
|
|
header('Location: '.$oReg->AppUrl);
|
| 28 |
|
|
exit;
|
| 29 |
1473
|
Luisehahne
|
}
|
| 30 |
2125
|
darkviper
|
$page_id =
|
| 31 |
|
|
isset($oReg->ReferrerId)
|
| 32 |
|
|
? $oReg->ReferrerId
|
| 33 |
|
|
: isset($_SESSION['PAGE_ID']) ? $_SESSION['PAGE_ID'] : 0;
|
| 34 |
1473
|
Luisehahne
|
|
| 35 |
|
|
// Required page details
|
| 36 |
|
|
$page_description = '';
|
| 37 |
|
|
$page_keywords = '';
|
| 38 |
1792
|
Luisehahne
|
// Work out level
|
| 39 |
2125
|
darkviper
|
$level = ($page_id > 0 ) ? level_count($page_id) : $page_id;
|
| 40 |
1792
|
Luisehahne
|
// Work out root parent
|
| 41 |
2125
|
darkviper
|
$root_parent = ($page_id > 0 ) ? root_parent($page_id) : $page_id;
|
| 42 |
1792
|
Luisehahne
|
|
| 43 |
1508
|
Luisehahne
|
define('PAGE_ID', $page_id);
|
| 44 |
1792
|
Luisehahne
|
define('ROOT_PARENT', $root_parent);
|
| 45 |
1473
|
Luisehahne
|
define('PARENT', 0);
|
| 46 |
1792
|
Luisehahne
|
define('LEVEL', $level);
|
| 47 |
|
|
|
| 48 |
2125
|
darkviper
|
define('PAGE_TITLE', $oTrans->TEXT_PLEASE_LOGIN);
|
| 49 |
|
|
define('MENU_TITLE', $oTrans->TEXT_PLEASE_LOGIN);
|
| 50 |
1473
|
Luisehahne
|
define('VISIBILITY', 'public');
|
| 51 |
|
|
// Set the page content include file
|
| 52 |
2125
|
darkviper
|
define('PAGE_CONTENT', $oReg->AppPath.'account/login_form.php');
|
| 53 |
1473
|
Luisehahne
|
|
| 54 |
|
|
// Create new login app
|
| 55 |
|
|
$requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']);
|
| 56 |
2125
|
darkviper
|
$sRedirect = strip_tags(isset(${$requestMethod}['redirect']) ? ${$requestMethod}['redirect'] : '');
|
| 57 |
1728
|
Luisehahne
|
//$redirect = ( (empty($redirect)) ? $_SERVER['HTTP_REFERER'] : $redirect);
|
| 58 |
2125
|
darkviper
|
$_SESSION['HTTP_REFERER'] = str_replace($oReg->AppUrl,'/',$sRedirect);
|
| 59 |
1529
|
Luisehahne
|
|
| 60 |
2125
|
darkviper
|
$sLoginUrl = $oReg->AppUrl.'account/login.php';
|
| 61 |
|
|
$sLoginUrl .= (!empty($sRedirect) ? '?redirect=' .$_SESSION['HTTP_REFERER'] : '');
|
| 62 |
1529
|
Luisehahne
|
|
| 63 |
2125
|
darkviper
|
$sWarningUrl = str_replace($oReg->AppPath, $oReg->AppUrl, $wb->correct_theme_source('warning.html'));
|
| 64 |
1529
|
Luisehahne
|
// Setup template object, parse vars to it, then parse it
|
| 65 |
2125
|
darkviper
|
$sThemePath = realpath($oReg->AppPath . ltrim($wb->correct_theme_source('loginBox.htt'), '/'));
|
| 66 |
1529
|
Luisehahne
|
|
| 67 |
1473
|
Luisehahne
|
$thisApp = new Login(
|
| 68 |
2125
|
darkviper
|
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 |
1473
|
Luisehahne
|
// Set extra outsider var
|
| 90 |
|
|
$globals[] = 'thisApp';
|
| 91 |
|
|
// Include the index (wrapper) file
|
| 92 |
2125
|
darkviper
|
require($oReg->AppPath.'index.php');
|