diff options
author | Andrew Dolgov <[email protected]> | 2010-01-14 13:39:05 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2010-01-14 13:39:05 +0300 |
commit | dce46cade3ef1d24a12cf6d27abad5d93de95373 (patch) | |
tree | 6134e71244b7eeb72b1232ac40a736e76df7aede /modules/pref-prefs.php | |
parent | 7abf159d61a933106b9b7a704cf3e549a3b4ab01 (diff) |
query themes from filesystem; obsolete ttrss_themes
Diffstat (limited to 'modules/pref-prefs.php')
-rw-r--r-- | modules/pref-prefs.php | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/modules/pref-prefs.php b/modules/pref-prefs.php index 367dfe406..9b58cdbb4 100644 --- a/modules/pref-prefs.php +++ b/modules/pref-prefs.php @@ -85,7 +85,7 @@ // print_r($_POST); - $orig_theme_id = get_pref($link, "_THEME_ID"); + $orig_theme = get_pref($link, "_THEME_ID"); foreach (array_keys($_POST) as $pref_name) { @@ -96,17 +96,7 @@ } - if ($orig_theme_id != get_pref($link, "_THEME_ID")) { - - $result = db_query($link, "SELECT theme_path FROM ttrss_themes - WHERE id = '".get_pref($link, "_THEME_ID")."'"); - - if (db_num_rows($result) == 1) { - $theme_path = db_fetch_result($result, 0, "theme_path"); - } else { - $theme_path = ""; - } - + if ($orig_theme != get_pref($link, "_THEME_ID")) { print "PREFS_THEME_CHANGED"; } else { print __("The configuration was saved."); @@ -329,24 +319,28 @@ if ($line["section_id"] == 2) { print "<tr><td width=\"40%\">".__("Select theme")."</td>"; + + $user_theme = get_pref($link, "_THEME_ID"); + $themes = get_all_themes(); + print "<td><select name=\"_THEME_ID\">"; - print "<option value='0'>".__('Default')."</option>"; + print "<option value=''>".__('Default')."</option>"; print "<option disabled>--------</option>"; - - $user_theme_id = get_pref($link, "_THEME_ID"); - - $tmp_result = db_query($link, "SELECT - id,theme_name FROM ttrss_themes ORDER BY theme_name"); - - while ($tmp_line = db_fetch_assoc($tmp_result)) { - if ($tmp_line["id"] == $user_theme_id) { - $selected = "selected"; + + foreach ($themes as $t) { + $base = $t['base']; + $name = $t['name']; + + if ($base == $user_theme) { + $selected = "selected=\"1\""; } else { $selected = ""; } - print "<option value=\"".$tmp_line["id"]."\" $selected>" . - $tmp_line["theme_name"] . "</option>"; + + print "<option $selected value='$base'>$name</option>"; + } + print "</select></td></tr>"; } |