]> git.wh0rd.org Git - tt-rss.git/commitdiff
theme select box
authorAndrew Dolgov <fox@bah.spb.su>
Sat, 26 Nov 2005 06:36:23 +0000 (07:36 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sat, 26 Nov 2005 06:36:23 +0000 (07:36 +0100)
backend.php

index 3a07a0f2395475ed10dd7a5872edd812ed25188c..fa3be8dc669c796542ca58dc58dc26db0e36fe4f 100644 (file)
 
                        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) {
 
                        }
 
+                       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