]> git.wh0rd.org - tt-rss.git/blobdiff - backend.php
tabbed preferences
[tt-rss.git] / backend.php
index c468ad0c4c259155aa320c7538ba059ca44a7da7..8b8a90709735f631055142f3612f1f3abe3a5faa 100644 (file)
                }
 
                if ($subop == "forceUpdateAllFeeds" || $subop == "updateAllFeeds") {
+               
                        update_all_feeds($link, true);                  
 
                        $omode = $_GET["omode"];
                                </head><body>";
                }
 
+               if ($subop == "ForceUpdate" && sprintf("%d", $feed) > 0) {
+
+                       $tmp_result = db_query($link, "SELECT feed_url FROM ttrss_feeds
+                               WHERE id = '$feed'");
+
+                       $feed_url = db_fetch_result($tmp_result, 0, "feed_url");
+
+                       update_rss_feed($link, $feed_url, $feed);
+
+               }
+
                if ($subop == "MarkAllRead")  {
 
                        if (sprintf("%d", $feed) != 0) {
                        
                                } else if ($feed < -10) { // label
 
-                                       // FIXME, implement catchup for labels
+                                       $label_id = -$feed - 11;
+
+                                       $tmp_result = db_query($link, "SELECT sql_exp FROM ttrss_labels
+                                               WHERE id = '$label_id'");
 
+                                       if ($tmp_result) {
+                                               $sql_exp = db_fetch_result($tmp_result, 0, "sql_exp");
+
+                                               db_query($link, "UPDATE ttrss_entries 
+                                                       SET unread = false,last_read = NOW()
+                                                       WHERE $sql_exp");
+                                       }
                                }
                        } else { // tag
                                // FIXME, implement catchup for tags
                
                        }
 
+               print "<h3>OPML Import</h3>
+               <form   enctype=\"multipart/form-data\" method=\"POST\" action=\"opml.php\">
+                       File: <input id=\"opml_file\" name=\"opml_file\" type=\"file\">&nbsp;
+                       <input class=\"button\" name=\"op\" onclick=\"return validateOpmlImport();\"
+                               type=\"submit\" value=\"Import\">
+                       </form>";
+
        }
 
        if ($op == "pref-filters") {
 
        }
 
+       if ($op == "dlg") {
+               $id = $_GET["id"];
+               $param = $_GET["param"];
+
+               if ($id == "quickAddFeed") {
+                       print "Feed URL: <input 
+                       onblur=\"javascript:enableHotkeys()\" onfocus=\"javascript:disableHotkeys()\"
+                       id=\"qafInput\">
+                       <input class=\"button\"
+                               type=\"submit\" onclick=\"javascript:qafAdd()\" value=\"Add feed\">
+                       <input class=\"button\"
+                               type=\"submit\" onclick=\"javascript:closeDlg()\" 
+                               value=\"Cancel\">";
+               }
+
+               if ($id == "quickDelFeed") {
+
+                       $param = db_escape_string($param);
+
+                       $result = db_query($link, "SELECT title FROM ttrss_feeds WHERE id = '$param'");
+
+                       if ($result) {
+
+                               $f_title = db_fetch_result($result, 0, "title");
+               
+                               print "Remove current feed ($f_title)?&nbsp;
+                               <input class=\"button\"
+                                       type=\"submit\" onclick=\"javascript:qfdDelete($param)\" value=\"Remove\">
+                               <input class=\"button\"
+                                       type=\"submit\" onclick=\"javascript:closeDlg()\" 
+                                       value=\"Cancel\">";
+                       } else {
+                               print "Error: Feed $param not found.&nbsp;
+                               <input class=\"button\"
+                                       type=\"submit\" onclick=\"javascript:closeDlg()\" 
+                                       value=\"Cancel\">";             
+                       }
+               }
+
+               if ($id == "search") {
+
+                       print "<input id=\"searchbox\" class=\"extSearch\"                      
+                       onblur=\"javascript:enableHotkeys()\" onfocus=\"javascript:disableHotkeys()\"
+                       onchange=\"javascript:search()\">
+                       <select id=\"searchmodebox\">
+                               <option selected>All feeds</option>
+                               <option>This feed</option>
+                       </select>               
+                       <input type=\"submit\" 
+                               class=\"button\" onclick=\"javascript:search()\" value=\"Search\">
+                       <input class=\"button\"
+                               type=\"submit\" onclick=\"javascript:closeDlg()\" 
+                               value=\"Close\">";
+
+               }
+
+       }
+
        db_close($link);
 ?>