]> git.wh0rd.org Git - tt-rss.git/commitdiff
add ability to hide feeds from browser (closes #21)
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 30 Dec 2005 04:11:48 +0000 (05:11 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 30 Dec 2005 04:11:48 +0000 (05:11 +0100)
backend.php
functions.php
prefs.js

index d5f3d4bc718b81cdd75ba9a1fb9f73655ab225c7..4213b8667afa6d64c26f400aca6cf1d7cc62f312 100644 (file)
                        print "<p>Showing top 50 registered feeds, sorted by popularity:</p>";
 
                        $result = db_query($link, "SELECT feed_url,count(id) AS subscribers 
-                               FROM ttrss_feeds WHERE auth_login = '' AND auth_pass = '' 
+                               FROM ttrss_feeds 
+                               WHERE auth_login = '' AND auth_pass = '' AND private = false
                                GROUP BY feed_url ORDER BY subscribers DESC LIMIT 50");
                        
                        print "<ul class='browseFeedList' id='browseFeedList'>";
                        print "<td><input type=\"password\" id=\"iedit_pass\" 
                                value=\"$auth_pass\"></td></tr>";
 
+                       $row_class = toggleEvenOdd($row_class);
+                       $private = sql_bool_to_bool(db_fetch_result($result, 0, "private"));
+
+                       if ($private) {
+                               $checked = "checked";
+                       } else {
+                               $checked = "";
+                       }
+
+                       print "<tr class='$row_class'><td>Options:</td>";
+                       print "<td><input type=\"checkbox\" id=\"iedit_private\" 
+                               $checked> Hide from feed browser</td></tr>";
+
                        print "</table>";
                        print "</div>";
 
                        $auth_login = db_escape_string($_POST["login"]);
                        $auth_pass = db_escape_string($_POST["pass"]);
                        $parent_feed = db_escape_string($_POST["pfeed"]);
+                       $private = db_escape_string($_POST["private"]);
 
                        if (strtoupper($upd_intl) == "DEFAULT")
                                $upd_intl = 0;
                                update_interval = '$upd_intl',
                                purge_interval = '$purge_intl',
                                auth_login = '$auth_login',
-                               auth_pass = '$auth_pass'
+                               auth_pass = '$auth_pass',
+                               private = '$private'                            
                                WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);                    
                }
 
index c67a7a99b985d38e28f6d05650f425d019db1d03..de5eb8a2ec50e51aebd2ec6d19bddc1a849a9ab3 100644 (file)
                        return "false";
                }
        }
+
+       function sql_bool_to_bool($s) {
+               if ($s == "t" || $s == "1") {
+                       return true;
+               } else {
+                       return false;
+               }
+       }
        
+
        function toggleEvenOdd($a) {
                if ($a == "even") 
                        return "odd";
index 744a3b387f69d1726674b8c060aa25af19e2e1eb..a4096df56510e61da3812104b58eab591be850d1 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -675,6 +675,8 @@ function feedEditSave() {
                var upd_intl = document.getElementById("iedit_updintl").value;
                var purge_intl = document.getElementById("iedit_purgintl").value;
                var fcat = document.getElementById("iedit_fcat");
+
+               var private = document.getElementById("iedit_private").checked;
        
                var fcat_id = 0;
        
@@ -705,8 +707,9 @@ function feedEditSave() {
                var query = "op=pref-feeds&subop=editSave&id=" +
                        feed + "&l=" + param_escape(link) + "&t=" + param_escape(title) +
                        "&ui=" + param_escape(upd_intl) + "&pi=" + param_escape(purge_intl) +
-                       "&catid=" + param_escape(fcat_id) + "&login=" + param_escape(auth_login) +
-                       "&pfeed=" + param_escape(parent_feed_id) + "&pass=" + param_escape(auth_pass);
+                       "&catid=" + param_escape(fcat_id) + "&login=" + param_escape(auth_login) +                      
+                       "&pfeed=" + param_escape(parent_feed_id) + "&pass=" + param_escape(auth_pass) +
+                       "&private=" + param_escape(private);
 
                xmlhttp.open("POST", "backend.php", true);
                xmlhttp.onreadystatechange=feedlist_callback;