]> git.wh0rd.org - tt-rss.git/blobdiff - functions.php
some basic w3c compliance for static code
[tt-rss.git] / functions.php
index 701d3ec57f59140aa0182a47d9e4b78915925806..c20bba7f3c8ed64a4d6dc9d68bd43651087871fb 100644 (file)
@@ -86,6 +86,7 @@
 
        define('MAGPIE_USER_AGENT_EXT', ' (Tiny Tiny RSS/' . VERSION . ')');
        define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');
+       define('MAGPIE_CACHE_AGE', 60*15); // 15 minutes
 
        require_once "simplepie/simplepie.inc";
        require_once "magpierss/rss_fetch.inc";
                print "<select name=\"$id\" id='$id' $attributes>";
                foreach (array_keys($values) as $v) {
                        if ($v == $default)
-                               $sel = "selected";
+                               $sel = 'selected="selected"';
                         else
                                $sel = "";
                        
                                        setcookie("ttrss_lang", $_SESSION["language"], 
                                                time() + SESSION_COOKIE_LIFETIME);
                                }
+
+                               /* bump counters stamp since we're getting reloaded anyway */
+
+                               $_SESSION["get_all_counters_stamp"] = time();
                        }
 
                } else {
                print "<param key=\"default_view_limit\" value=\"" . 
                        (int) get_pref($link, "_DEFAULT_VIEW_LIMIT") . "\"/>";
 
+               print "<param key=\"default_view_order_by\" value=\"" . 
+                       get_pref($link, "_DEFAULT_VIEW_ORDER_BY") . "\"/>";
+
                print "<param key=\"prefs_active_tab\" value=\"" . 
                        get_pref($link, "_PREFS_ACTIVE_TAB") . "\"/>";
 
 
                        $view_query_part = "";
        
-                       if ($view_mode == "adaptive") {
+                       if ($view_mode == "adaptive" || $view_query_part == "noscores") {
                                if ($search) {
                                        $view_query_part = " ";
                                } else if ($feed != -1) {
                                $tmp_result = db_query($link, "SELECT sql_exp FROM ttrss_labels
                                        WHERE id = '$label_id'");
                        
-                               $query_strategy_part = db_fetch_result($tmp_result, 0, "sql_exp");
+                               $query_strategy_part = "(" . db_fetch_result($tmp_result, 0, "sql_exp") . ")";
 
                                if (!$query_strategy_part) {
                                        return false;
                                $order_by = "updated DESC";
                        }
 
-                       $order_by = "score DESC, $order_by";
+                       if ($view_mode != "noscores") {
+                               $order_by = "score DESC, $order_by";
+                       }
 
                        if ($override_order) {
                                $order_by = $override_order;
                                        $view_query_part
                                        $query_strategy_part ORDER BY $order_by
                                        $limit_query_part $offset_query_part";
-                                       
-                               $result = db_query($link, $query);
-       
+
                                if ($_GET["debug"]) print $query;
+
+                               $result = db_query($link, $query);
        
                        } else {
                                // browsing by tag
        }
 
        function outputHeadlinesList($link, $feed, $subop, $view_mode, $limit, $cat_view,
-                                       $next_unread_feed, $offset, $vgr_last_feed = false) {
+                                       $next_unread_feed, $offset, $vgr_last_feed = false, 
+                                       $override_order = false) {
 
                $disable_cache = false;
 
                if ($_GET["debug"]) $timing_info = print_checkpoint("H0", $timing_info);
 
                $qfh_ret = queryFeedHeadlines($link, $feed, $limit, $view_mode, $cat_view, 
-                       $search, $search_mode, $match_on, false, $real_offset);
+                       $search, $search_mode, $match_on, $override_order, $real_offset);
 
                if ($_GET["debug"]) $timing_info = print_checkpoint("H1", $timing_info);
 
 
        function rounded_table_start($classname, $header = "&nbsp;") {
                print "<table width='100%' class='$classname' cellspacing='0' cellpadding='0'>";
-               print "<tr><td class='c1'>&nbsp;</td><td class='top'>$header</td><td class='c2'>&nbsp;</tr>";
+               print "<tr><td class='c1'>&nbsp;</td><td class='top'>$header</td><td class='c2'>&nbsp;</td></tr>";
                print "<tr><td class='left'>&nbsp;</td><td class='content'>";
        }
 
        function rounded_table_end($footer = "&nbsp;") {
                print "</td><td class='right'>&nbsp;</td></tr>";
-               print "<tr><td class='c4'>&nbsp;</td><td class='bottom'>$footer</td><td class='c3'>&nbsp;</tr>";
+               print "<tr><td class='c4'>&nbsp;</td><td class='bottom'>$footer</td><td class='c3'>&nbsp;</td></tr>";
                print "</table>";
        }