Skip to content

Commit a737982

Browse files
committed
DBFixer fixes
1 parent e19ae98 commit a737982

File tree

5 files changed

+36
-14
lines changed

5 files changed

+36
-14
lines changed

src/classes/DbFixer.php

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class DbFixer extends \Ease\Html\UlTag {
1313
public function __construct() {
1414
parent::__construct();
1515
$this->fixContactIDs();
16+
// $this->fixServiceIDs();
1617
$this->fixHostNameIDs();
1718
$this->fixHostHostgroupID();
1819
$this->cleanUnusedServices();

src/classes/User.php

+19
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,25 @@ public function isAdmin() {
250250
return $this->getSettingValue('admin') === true;
251251
}
252252

253+
/**
254+
* Unpack settings
255+
*
256+
* @return boolean
257+
*/
258+
public function loginSuccess() {
259+
$this->restoreSettings();
260+
return parent::loginSuccess();
261+
}
262+
263+
public function restoreSettings() {
264+
$this->settings = empty($this->getDataValue($this->settingsColumn)) ? [] : unserialize($this->getDataValue($this->settingsColumn));
265+
}
266+
267+
public function __wakeup() {
268+
parent::__wakeup();
269+
$this->restoreSettings();
270+
}
271+
253272
/**
254273
* Common instance of User class
255274
*

src/classes/engine/Configurator.php

+14-12
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ public function __construct($itemID = null) {
144144
$_SESSION['parentCache'] = [];
145145
}
146146
$this->parentCache = &$_SESSION['parentCache'];
147+
$this->getFluentPDO(true, true);
147148
parent::__construct($itemID, Shared::singleton()->configuration);
148149
$this->user = Shared::user();
149150
// foreach ($this->useKeywords as $KeyWord => $ColumnType) {
@@ -231,7 +232,7 @@ public function loadFromSQL($itemID = null, $dataPrefix = null,
231232
if ($ownerid) {
232233
$this->owner = new User((int) $ownerid);
233234
}
234-
235+
$this->data = self::unserializeArrays($this->getData());
235236
return $result;
236237
}
237238

@@ -1478,21 +1479,22 @@ public function saveMembers() {
14781479
* @return array
14791480
*/
14801481
public static function unserializeArrays($allData) {
1481-
foreach ($allData as $keyWord => $keyData) {
1482-
if (is_array($keyData)) {
1483-
$allData[$keyWord] = self::unserializeArrays($keyData);
1484-
} else {
1485-
if (strlen($keyData) && (substr($keyData, 0, 2) == 'a:')) {
1486-
if (self::isSerialized($keyData)) {
1487-
$allData[$keyWord] = unserialize(stripslashes($keyData));
1488-
} else {
1489-
Shared::webPage()->addStatusMessage(_('Deserialization error') . ':' . $keyData,
1490-
'error');
1482+
if (is_array($allData)) {
1483+
foreach ($allData as $keyWord => $keyData) {
1484+
if (is_array($keyData)) {
1485+
$allData[$keyWord] = self::unserializeArrays($keyData);
1486+
} else {
1487+
if (strlen($keyData) && (substr($keyData, 0, 2) == 'a:')) {
1488+
if (self::isSerialized($keyData)) {
1489+
$allData[$keyWord] = unserialize(stripslashes($keyData));
1490+
} else {
1491+
Shared::webPage()->addStatusMessage(_('Deserialization error') . ':' . $keyData,
1492+
'error');
1493+
}
14911494
}
14921495
}
14931496
}
14941497
}
1495-
14961498
return $allData;
14971499
}
14981500

src/host.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Icinga Host Editor
77
*
88
* @author Vitex <vitex@hippy.cz>
9-
* @copyright 2012-2018 Vitex@hippy.cz (G)
9+
* @copyright 2012-2020 Vitex@hippy.cz (G)
1010
*/
1111
require_once 'includes/IEInit.php';
1212

src/settings.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function get_gravatar(email, size)
3939

4040
$settingsFrame = new \Ease\TWB\Panel(_('Settings'));
4141
$settingsFrame->addItem(new \Ease\Html\ATag('https://secure.gravatar.com/',
42-
$oUser, ['title' => _('Click to change icon')]));
42+
new \Ease\Html\ImgTag($oUser->getIcon()) , ['title' => _('Click to change icon')]));
4343

4444
$settingsFrame->addItem(new \Ease\TWB\FormGroup(_('Login name'),
4545
new UI\TextInputSaver('login', $oUser->getUserLogin(), $oUser)));

0 commit comments

Comments
 (0)