Merge pull request #3963 from annando/default-features

Additional features should now work with the forumlist as well
pull/3964/head
Hypolite Petovan 2017-11-26 08:51:14 -05:00 committed by GitHub
commit e82bbc75cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 16 deletions

View File

@ -16,14 +16,14 @@ use Friendica\Core\PConfig;
function feature_enabled($uid, $feature) {
$x = Config::get('feature_lock', $feature, false);
if (!$x) {
if ($x === false) {
$x = PConfig::get($uid, 'feature', $feature, false);
if (!$x) {
$x = Config::get('feature', $feature, false);
if (!$x) {
$x = get_feature_default($feature);
}
}
}
if ($x === false) {
$x = Config::get('feature', $feature, false);
}
if ($x === false) {
$x = get_feature_default($feature);
}
$arr = array('uid' => $uid, 'feature' => $feature, 'enabled' => $x);
@ -125,10 +125,9 @@ function get_features($filtered = true) {
$kquantity = count($arr[$k]);
for ($y = 0; $y < $kquantity; $y ++) {
if (is_array($arr[$k][$y])) {
if (!$arr[$k][$y][4]) {
if ($arr[$k][$y][4] === false) {
$has_items = true;
}
else {
} else {
unset($arr[$k][$y]);
}
}

View File

@ -13,13 +13,14 @@ use dba;
/**
* @brief Arbitrary sytem configuration storage
* Note:
* Please do not store booleans - convert to 0/1 integer values
* The Config::get() functions return boolean false for keys that are unset,
* and this could lead to subtle bugs.
*
* There are a few places in the code (such as the admin panel) where boolean
* configurations need to be fixed as of 10/08/2011.
* Note:
* If we ever would decide to return exactly the variable type as entered,
* we will have fun with the additional features. :-)
*
* The config class always returns strings but in the default features
* we use a "false" to determine if the config value isn't set.
*
*/
class Config
{