Merge branch 'next' of github.com:TheSerapher/php-mmcfe-ng into next

This commit is contained in:
Sebastian Grewe 2013-06-13 13:51:59 +02:00
commit 82155b6f72
5 changed files with 21 additions and 10 deletions

View File

@ -69,7 +69,6 @@ class User {
); );
return $this->updateSingle($id, $field); return $this->updateSingle($id, $field);
} }
public function setUserToken($id) { public function setUserToken($id) {
$field = array( $field = array(
'name' => 'token', 'name' => 'token',
@ -78,6 +77,10 @@ class User {
); );
return $this->updateSingle($id, $field); return $this->updateSingle($id, $field);
} }
private function setUserIp($id, $ip) {
$field = array( 'name' => 'loggedIp', 'type' => 's', 'value' => $ip );
return $this->updateSingle($id, $field);
}
/** /**
* Fetch all users for administrative tasks * Fetch all users for administrative tasks
@ -106,6 +109,7 @@ class User {
} }
if ( $this->checkUserPassword($username, $password)) { if ( $this->checkUserPassword($username, $password)) {
$this->createSession($username); $this->createSession($username);
$this->setUserIp($this->getUserId($username), $_SERVER['REMOTE_ADDR']);
return true; return true;
} }
$this->setErrorMessage("Invalid username or password"); $this->setErrorMessage("Invalid username or password");

View File

@ -30,6 +30,7 @@ $config = array(
'max' => 250 'max' => 250
), ),
'website' => array( 'website' => array(
'registration' => true, // Allow new users to register
'name' => 'The Pool', 'name' => 'The Pool',
'slogan' => 'Resistance is futile', 'slogan' => 'Resistance is futile',
'email' => 'test@example.com', // Mail address used for notifications 'email' => 'test@example.com', // Mail address used for notifications

View File

@ -1,9 +1,13 @@
<?php <?php
// Make sure we are called from index.php // Make sure we are called from index.php
if (!defined('SECURITY')) if (!defined('SECURITY')) die('Hacking attempt');
die('Hacking attempt');
// Tempalte specifics if (!$config['website']['registration']) {
$smarty->assign("CONTENT", "default.tpl"); $_SESSION['POPUP'][] = array('CONTENT' => 'Account registration is currently disabled. Please try again later.', 'TYPE' => 'errormsg');
$smarty->assign("CONTENT", "disabled.tpl");
} else {
// Tempalte specifics
$smarty->assign("CONTENT", "default.tpl");
}
?> ?>

View File

@ -1,11 +1,10 @@
<?php <?php
// Make sure we are called from index.php // Make sure we are called from index.php
if (!defined('SECURITY')) if (!defined('SECURITY')) die('Hacking attempt');
die('Hacking attempt');
if (!$config['website']['registration']) {
if ($user->register($_POST['username'], $_POST['password1'], $_POST['password2'], $_POST['pin'], $_POST['email1'], $_POST['email2'])) { $_SESSION['POPUP'][] = array('CONTENT' => 'Account registration is currently disabled. Please try again later.', 'TYPE' => 'errormsg');
} else if ($user->register($_POST['username'], $_POST['password1'], $_POST['password2'], $_POST['pin'], $_POST['email1'], $_POST['email2']) && $config['website']['registration']) {
$_SESSION['POPUP'][] = array('CONTENT' => 'Account created, please login'); $_SESSION['POPUP'][] = array('CONTENT' => 'Account created, please login');
} else { } else {
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to create account: ' . $user->getError(), 'TYPE' => 'errormsg'); $_SESSION['POPUP'][] = array('CONTENT' => 'Unable to create account: ' . $user->getError(), 'TYPE' => 'errormsg');

View File

@ -0,0 +1,3 @@
{include file="global/block_header.tpl" BLOCK_HEADER="Registration disabled" BLOCK_STYLE="clear:none;"}
<br /><center><p><font size="5px">We are currently not accepting new user registrations.</font></p></center>
{include file="global/block_footer.tpl"}