$configs = DBA::select('config', ['v', 'k'], ['cat' => $cat]);
while ($config = DBA::fetch($configs)) {
- $key = $config['k'];
+ $key = $config['k'];
+ $value = $config['v'];
- $return[$key] = $config['v'];
- $this->in_db[$cat][$key] = true;
+ if (isset($value) && $value !== '') {
+ $return[$key] = $value;
+ $this->in_db[$cat][$key] = true;
+ }
}
DBA::close($configs);
if (DBA::isResult($pconfigs)) {
while ($pconfig = DBA::fetch($pconfigs)) {
$key = $pconfig['k'];
+ $value = $pconfig['v'];
- $return[$key] = $pconfig['v'];
-
- $this->in_db[$uid][$cat][$key] = true;
+ if (isset($value) && $value !== '') {
+ $return[$key] = $value;
+ $this->in_db[$uid][$cat][$key] = true;
+ }
}
} else if ($cat != 'config') {
// Negative caching
$configs = DBA::select('config', ['cat', 'v', 'k']);
while ($config = DBA::fetch($configs)) {
- $return[$config['cat']][$config['k']] = $config['v'];
+ $value = $config['v'];
+ if (isset($value) && $value !== '') {
+ $return[$config['cat']][$config['k']] = $value;
+ }
}
DBA::close($configs);
$pconfigs = DBA::select('pconfig', ['cat', 'v', 'k'], ['uid' => $uid]);
while ($pconfig = DBA::fetch($pconfigs)) {
- $return[$pconfig['cat']][$pconfig['k']] = $pconfig['v'];
+ $value = $pconfig['v'];
+ if (isset($value) && $value !== '') {
+ $return[$pconfig['cat']][$pconfig['k']] = $value;
+ }
}
DBA::close($pconfigs);
$keys = array_keys($config[$category]);
foreach ($keys as $key) {
- if (isset($config[$category][$key])) {
+ $value = $config[$category][$key];
+ if (isset($value) && $value !== '!<unset>!') {
if ($overwrite) {
- $this->set($category, $key, $config[$category][$key]);
+ $this->set($category, $key, $value);
} else {
- $this->setDefault($category, $key, $config[$category][$key]);
+ $this->setDefault($category, $key, $value);
}
}
}
*/
public function loadP($uid, array $config)
{
- foreach ($config as $category => $values) {
- foreach ($values as $key => $value) {
- $this->setP($uid, $category, $key, $value);
+ $categories = array_keys($config);
+
+ foreach ($categories as $category) {
+ if (isset($config[$category]) && is_array($config[$category])) {
+
+ $keys = array_keys($config[$category]);
+
+ foreach ($keys as $key) {
+ $value = $config[$category][$key];
+ if (isset($value) && $value !== '!<unset>!') {
+ $this->setP($uid, $category, $key, $value);
+ }
+ }
}
}
}