diff options
author | Richard Beales <[email protected]> | 2013-03-19 19:20:14 +0000 |
---|---|---|
committer | Richard Beales <[email protected]> | 2013-03-19 19:20:14 +0000 |
commit | 598a8f37a2ce94186166d1c3b22cc65efdebe4a4 (patch) | |
tree | 0243d171f3f0b3bc61861f780089d82d93933557 /classes/pref | |
parent | 05809dfdf7cbf7699be6408c0f49d325585726b5 (diff) | |
parent | 451ff72289aa705c8f1d57af604881a66a77e95d (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'classes/pref')
-rw-r--r-- | classes/pref/feeds.php | 28 | ||||
-rw-r--r-- | classes/pref/prefs.php | 31 |
2 files changed, 49 insertions, 10 deletions
diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index bfcc75f0d..285995dfc 100644 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -613,6 +613,18 @@ class Pref_Feeds extends Handler_Protected { name=\"always_display_enclosures\" $checked> <label for=\"always_display_enclosures\">".__('Always display image attachments')."</label>"; + $hide_images = sql_bool_to_bool(db_fetch_result($result, 0, "hide_images")); + + if ($hide_images) { + $checked = "checked=\"1\""; + } else { + $checked = ""; + } + + print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"hide_images\" + name=\"hide_images\" + $checked> <label for=\"hide_images\">". + __('Do not embed images')."</label>"; $cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images")); @@ -804,6 +816,14 @@ class Pref_Feeds extends Handler_Protected { print " "; $this->batch_edit_cbox("always_display_enclosures", "always_display_enclosures_l"); + print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"hide_images\" + name=\"hide_images\" + dojoType=\"dijit.form.CheckBox\"> <label class='insensitive' id=\"hide_images_l\" + for=\"hide_images\">". + __('Do not embed images')."</label>"; + + print " "; $this->batch_edit_cbox("hide_images", "hide_images_l"); + print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"cache_images\" name=\"cache_images\" dojoType=\"dijit.form.CheckBox\"> <label class='insensitive' id=\"cache_images_l\" @@ -856,7 +876,8 @@ class Pref_Feeds extends Handler_Protected { db_escape_string($_POST["include_in_digest"])); $cache_images = checkbox_to_sql_bool( db_escape_string($_POST["cache_images"])); - + $hide_images = checkbox_to_sql_bool( + db_escape_string($_POST["hide_images"])); $always_display_enclosures = checkbox_to_sql_bool( db_escape_string($_POST["always_display_enclosures"])); @@ -887,6 +908,7 @@ class Pref_Feeds extends Handler_Protected { auth_pass = '$auth_pass', private = $private, cache_images = $cache_images, + hide_images = $hide_images, include_in_digest = $include_in_digest, always_display_enclosures = $always_display_enclosures, mark_unread_on_update = $mark_unread_on_update @@ -952,6 +974,10 @@ class Pref_Feeds extends Handler_Protected { $qpart = "cache_images = $cache_images"; break; + case "hide_images": + $qpart = "hide_images = $hide_images"; + break; + case "cat_id": $qpart = $category_qpart_nocomma; break; diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index 810b1e164..8b8630c82 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -42,6 +42,12 @@ class Pref_Prefs extends Handler_Protected { $_SESSION["prefs_cache"] = false; + $boolean_prefs = explode(",", $_POST["boolean_prefs"]); + + foreach ($boolean_prefs as $pref) { + if (!isset($_POST[$pref])) $_POST[$pref] = 'false'; + } + foreach (array_keys($_POST) as $pref_name) { $pref_name = db_escape_string($pref_name); @@ -429,6 +435,8 @@ class Pref_Prefs extends Handler_Protected { $active_section = ""; + $listed_boolean_prefs = array(); + while ($line = db_fetch_assoc($result)) { if (in_array($line["pref_name"], $prefs_blacklist)) { @@ -463,7 +471,10 @@ class Pref_Prefs extends Handler_Protected { $def_value = $line["def_value"]; $help_text = $line["help_text"]; - print "<td width=\"40%\" class=\"prefName\" id=\"$pref_name\">" . __($line["short_desc"]); + print "<td width=\"40%\" class=\"prefName\" id=\"$pref_name\">"; + print "<label for='CB_$pref_name'>"; + print __($line["short_desc"]); + print "</label>"; if ($help_text) print "<div class=\"prefHelp\">".__($help_text)."</div>"; @@ -497,21 +508,19 @@ class Pref_Prefs extends Handler_Protected { } else if ($type_name == "bool") { - if ($value == "true") { - $value = __("Yes"); - } else { - $value = __("No"); - } + array_push($listed_boolean_prefs, $pref_name); + + $checked = ($value == "true") ? "checked=\"checked\"" : ""; if ($pref_name == "PURGE_UNREAD_ARTICLES" && FORCE_ARTICLE_PURGE != 0) { $disabled = "disabled=\"1\""; - $value = __("Yes"); + $checked = "checked=\"checked\""; } else { $disabled = ""; } - print_radio($pref_name, $value, __("Yes"), array(__("Yes"), __("No")), - $disabled); + print "<input type='checkbox' name='$pref_name' $checked $disabled + dojoType='dijit.form.CheckBox' id='CB_$pref_name' value='1'>"; } else if (array_search($pref_name, array('FRESH_ARTICLE_MAX_AGE', 'DEFAULT_ARTICLE_LIMIT', 'PURGE_OLD_DAYS', 'LONG_DATE_FORMAT', 'SHORT_DATE_FORMAT')) !== false) { @@ -568,6 +577,10 @@ class Pref_Prefs extends Handler_Protected { print "</table>"; + $listed_boolean_prefs = htmlspecialchars(join(",", $listed_boolean_prefs)); + + print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"boolean_prefs\" value=\"$listed_boolean_prefs\">"; + global $pluginhost; $pluginhost->run_hooks($pluginhost::HOOK_PREFS_TAB_SECTION, "hook_prefs_tab_section", "prefPrefsPrefsInside"); |