* [MOD] Set default user's preferences on demo mode

This commit is contained in:
nuxsmin
2017-04-13 21:03:19 +02:00
parent a11e8c25f2
commit ffe3e8e43d
5 changed files with 12 additions and 10 deletions

View File

@@ -46,6 +46,7 @@ use SP\Core\SessionUtil;
use SP\DataModel\TrackData;
use SP\DataModel\UserLoginData;
use SP\DataModel\UserPassRecoverData;
use SP\DataModel\UserPreferencesData;
use SP\Http\JsonResponse;
use SP\Http\Request;
use SP\Log\Log;
@@ -385,10 +386,15 @@ class LoginController
*/
protected function loadUserPreferences()
{
if (Checks::demoIsEnabled()) {
Session::setUserPreferences(new UserPreferencesData());
} else {
Session::setUserPreferences($this->UserData->getUserPreferences());
}
Language::setLanguage(true);
DiFactory::getTheme()->initTheme(true);
Session::setUserPreferences($this->UserData->getUserPreferences());
Session::setSessionType(Session::SESSION_INTERACTIVE);
Session::setAuthCompleted(true);

View File

@@ -93,9 +93,7 @@ class Language
*/
private function getUserLang()
{
$userId = Session::getUserData()->getUserId();
return ($userId > 0) ? UserPreferences::getItem()->getById($userId)->getLang() : '';
return (Session::getUserData()->getUserId() > 0) ? Session::getUserPreferences()->getLang() : '';
}
/**

View File

@@ -101,9 +101,7 @@ class Theme implements ThemeInterface
*/
protected function getUserTheme()
{
$userId = Session::getUserData()->getUserId();
return ($userId > 0) ? UserPreferences::getItem()->getById($userId)->getTheme() : '';
return (Session::getUserData()->getUserId() > 0) ? Session::getUserPreferences()->getTheme() : '';
}
/**

View File

@@ -231,11 +231,11 @@ class UserPreferencesData
* @return void
* @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.sleep
*/
function __wakeup()
public function __wakeup()
{
// Para realizar la conversión de nombre de propiedades que empiezan por _
foreach (get_object_vars($this) as $name => $value) {
if (substr($name, 0, 1) === '_') {
if (strpos($name, '_') === 0) {
$newName = substr($name, 1);
$this->$newName = $value;

View File

@@ -407,7 +407,7 @@ class Util
*/
public static function getVersion($retBuild = false, $normalized = false)
{
$build = 17041302;
$build = 17041303;
$version = [2, 1, 6];
if ($normalized === true) {