diff options
author | Andrew Dolgov <[email protected]> | 2005-11-26 07:36:23 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2005-11-26 07:36:23 +0100 |
commit | 58f8ad544e5c7f65e5f91b56cc799fd430f120b2 (patch) | |
tree | ba528d4935f01a8ea9477a67e27d91db359b449c | |
parent | fa7b87490166af3d8f987bc4d9edad3b38a2237b (diff) |
theme select box
-rw-r--r-- | backend.php | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/backend.php b/backend.php index 3a07a0f23..fa3be8dc6 100644 --- a/backend.php +++ b/backend.php @@ -2249,6 +2249,22 @@ header("Location: prefs.php"); + } else if ($subop == "Change theme") { + + $theme = db_escape_string($_POST["theme"]); + + if ($theme == "Default") { + $theme_qpart = 'NULL'; + } else { + $theme_qpart = "'$theme'"; + } + + db_query($link, "UPDATE ttrss_users SET + theme_id = (SELECT id FROM ttrss_themes WHERE + theme_name = '$theme') WHERE id = " . $_SESSION["uid"]); + + header("Location: prefs.php"); + } else { if (!SINGLE_USER_MODE) { @@ -2316,6 +2332,44 @@ } + print "<form action=\"backend.php\" method=\"POST\">"; + + print "<table width=\"100%\" class=\"prefPrefsList\">"; + print "<tr><td colspan='3'><h3>Themes</h3></tr></td>"; + + print "<tr><td width=\"40%\">Select theme</td>"; + + print "<td><select name=\"theme\">"; + + print "<option>Default</option>"; + + $result = db_query($link, "SELECT + theme_id FROM ttrss_users WHERE id = " . $_SESSION["uid"]); + + $user_theme_id = db_fetch_result($result, 0, "theme_id"); + + $result = db_query($link, "SELECT + id,theme_name FROM ttrss_themes ORDER BY theme_name"); + + if (db_num_rows($result) > 0) { + print "<option disabled>--------</option>"; + while ($line = db_fetch_assoc($result)) { + if ($line["id"] == $user_theme_id) { + $selected = "selected"; + } else { + $selected = ""; + } + print "<option $selected>" . $line["theme_name"] . "</option>"; + } + } + + print "</select></td></tr>"; + print "</table>"; + print "<input type=\"hidden\" name=\"op\" value=\"pref-prefs\">"; + print "<p><input class=\"button\" type=\"submit\" + value=\"Change theme\" name=\"subop\">"; + print "</form>"; + $result = db_query($link, "SELECT ttrss_user_prefs.pref_name,short_desc,help_text,value,type_name, section_name,def_value |