]> git.wh0rd.org - tt-rss.git/blobdiff - classes/pref/prefs.php
hide purge options when config.php has forced things
[tt-rss.git] / classes / pref / prefs.php
index 9b467ccc15f092289018e48ff9c57743faac0b8c..81b19cfb5e92d53eaa469cb74be09b01928c737b 100644 (file)
@@ -162,7 +162,7 @@ class Pref_Prefs extends Handler_Protected {
 
                $prefs_blacklist = array("ALLOW_DUPLICATE_POSTS", "STRIP_UNSAFE_TAGS", "REVERSE_HEADLINES",
                        "SORT_HEADLINES_BY_FEED_DATE", "DEFAULT_ARTICLE_LIMIT",
-                       "FEEDS_SORT_BY_UNREAD");
+                       "FEEDS_SORT_BY_UNREAD", "CDM_EXPANDED");
 
                /* "FEEDS_SORT_BY_UNREAD", "HIDE_READ_FEEDS", "REVERSE_HEADLINES" */
 
@@ -172,6 +172,9 @@ class Pref_Prefs extends Handler_Protected {
                                        "DEFAULT_UPDATE_INTERVAL", "USER_TIMEZONE", "SORT_HEADLINES_BY_FEED_DATE",
                                        "SSL_CERT_SERIAL", "DIGEST_PREFERRED_TIME");
 
+               $digest_options = array("DIGEST_ENABLE", "DIGEST_CATCHUP", "DIGEST_PREFERRED_TIME");
+
+               $purge_options = array("PURGE_UNREAD_ARTICLES", "PURGE_OLD_DAYS");
 
                $_SESSION["prefs_op_result"] = "";
 
@@ -502,6 +505,12 @@ class Pref_Prefs extends Handler_Protected {
                                continue;
                        }
 
+                       /* Hide options from the user that are disabled in config.php. */
+                       if (FORCE_ARTICLE_PURGE && in_array($pref_name, $purge_options))
+                               continue;
+                       if (DIGEST_SUBJECT === false && in_array($pref_name, $digest_options))
+                               continue;
+
                        if ($active_section != $line["section_id"]) {
 
                                if ($active_section != "") {
@@ -570,14 +579,7 @@ class Pref_Prefs extends Handler_Protected {
 
                                $checked = ($value == "true") ? "checked=\"checked\"" : "";
 
-                               if ($pref_name == "PURGE_UNREAD_ARTICLES" && FORCE_ARTICLE_PURGE != 0) {
-                                       $disabled = "disabled=\"1\"";
-                                       $checked = "checked=\"checked\"";
-                               } else {
-                                       $disabled = "";
-                               }
-
-                               print "<input type='checkbox' name='$pref_name' $checked $disabled
+                               print "<input type='checkbox' name='$pref_name' $checked
                                        dojoType='dijit.form.CheckBox' id='CB_$pref_name' value='1'>";
 
                        } else if (array_search($pref_name, array('FRESH_ARTICLE_MAX_AGE',
@@ -585,15 +587,8 @@ class Pref_Prefs extends Handler_Protected {
 
                                $regexp = ($type_name == 'integer') ? 'regexp="^\d*$"' : '';
 
-                               if ($pref_name == "PURGE_OLD_DAYS" && FORCE_ARTICLE_PURGE != 0) {
-                                       $disabled = "disabled=\"1\"";
-                                       $value = FORCE_ARTICLE_PURGE;
-                               } else {
-                                       $disabled = "";
-                               }
-
                                print "<input dojoType=\"dijit.form.ValidationTextBox\"
-                                       required=\"1\" $regexp $disabled
+                                       required=\"1\" $regexp
                                        name=\"$pref_name\" value=\"$value\">";
 
                        } else if ($pref_name == "SSL_CERT_SERIAL") {