Bug fixing, new map info dialog
This commit is contained in:
@@ -10,6 +10,7 @@ namespace Model;
|
||||
|
||||
use DB\SQL\Schema;
|
||||
use Controller;
|
||||
use Exception;
|
||||
|
||||
class UserModel extends BasicModel {
|
||||
|
||||
@@ -82,7 +83,7 @@ class UserModel extends BasicModel {
|
||||
// set active character with log data
|
||||
$activeUserCharacter = $this->getActiveUserCharacter();
|
||||
if($activeUserCharacter){
|
||||
$userData->character = $activeUserCharacter->getData(true);
|
||||
$userData->character = $activeUserCharacter->getData();
|
||||
}
|
||||
|
||||
return $userData;
|
||||
@@ -128,6 +129,28 @@ class UserModel extends BasicModel {
|
||||
return \Bcrypt::instance()->hash($password, $salt);
|
||||
}
|
||||
|
||||
/**
|
||||
* check if new user registration is allowed
|
||||
* @return bool
|
||||
* @throws Exception\RegistrationException
|
||||
*/
|
||||
public function beforeInsertEvent(){
|
||||
$registrationStatus = Controller\Controller::getRegistrationStatus();
|
||||
|
||||
switch($registrationStatus){
|
||||
case 0:
|
||||
$f3 = self::getF3();
|
||||
throw new Exception\RegistrationException($f3->get('PATHFINDER.REGISTRATION.MSG_DISABLED'));
|
||||
return false;
|
||||
break;
|
||||
case 1:
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* search for user by unique username
|
||||
* @param $name
|
||||
@@ -200,6 +223,12 @@ class UserModel extends BasicModel {
|
||||
return $maps;
|
||||
}
|
||||
|
||||
/**
|
||||
* get mapModel by id and check if user has access
|
||||
* @param $mapId
|
||||
* @return null
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getMap($mapId){
|
||||
$map = self::getNew('MapModel');
|
||||
$map->getById( (int)$mapId );
|
||||
@@ -287,8 +316,6 @@ class UserModel extends BasicModel {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $userCharacters;
|
||||
}
|
||||
|
||||
@@ -386,7 +413,6 @@ class UserModel extends BasicModel {
|
||||
$this->apis->current()->updateCharacters();
|
||||
$this->apis->next();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user