]> git.wh0rd.org - tt-rss.git/blobdiff - backend.php
UI improvements
[tt-rss.git] / backend.php
index 223842f349ad609689cd50a3e018f26e37876ecb..1a53d1c68d5abdc5f32d6076b7245de29653d555 100644 (file)
@@ -1,13 +1,8 @@
 <?php
        require_once "sessions.php";
        require_once "modules/backend-rpc.php";
-       
-       header("Cache-Control: no-cache, must-revalidate");
-       header("Cache-Control: no-cache, must-revalidate");
 
-       header("Pragma: no-cache");
-       header("Expires: -1");
-       
+
 /*     if ($_GET["debug"]) {
                define('DEFAULT_ERROR_LEVEL', E_ALL);
        } else {
@@ -16,9 +11,7 @@
        
        error_reporting(DEFAULT_ERROR_LEVEL); */
 
-       $op = $_REQUEST["op"];
-
-       define('SCHEMA_VERSION', 12);
+       define('SCHEMA_VERSION', 13);
 
        require_once "sanity_check.php";
        require_once "config.php";
        require_once "db-prefs.php";
        require_once "functions.php";
 
+       no_cache_incantation();
+
+       $script_started = getmicrotime();
+
+       $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); 
+
+       if (!$link) {
+               if (DB_TYPE == "mysql") {
+                       print mysql_error();
+               }
+               // PG seems to display its own errors just fine by default.             
+               return;
+       }
+
+       if (DB_TYPE == "pgsql") {
+               pg_query("set client_encoding = 'UTF-8'");
+               pg_set_client_encoding("UNICODE");
+       }
+
+       $op = $_REQUEST["op"];
+
        $print_exec_time = false;
 
        if ((!$op || $op == "rpc" || $op == "rss" || $op == "digestSend" ||
@@ -40,8 +54,9 @@
                header("Content-Type: application/xml");
                print_error_xml(7); exit;
        }
-
-       if (!$_SESSION["uid"] && $op != "globalUpdateFeeds" && $op != "rss" && $op != "getUnread") {
+       
+       if (!($_SESSION["uid"] && validate_session($link)) && $op != "globalUpdateFeeds" 
+                       && $op != "rss" && $op != "getUnread") {
 
                if ($op == "rpc") {
                        print_error_xml(6); die;
@@ -51,9 +66,9 @@
                                <p>Error: Not logged in.</p>
                                <script type=\"text/javascript\">
                                        if (parent.window != 'undefined') {
-                                               parent.window.location = \"login.php\";         
+                                               parent.window.location = \"tt-rss.php\";                
                                        } else {
-                                               window.location = \"login.php\";
+                                               window.location = \"tt-rss.php\";
                                        }
                                </script>
                        </body></html>
        require_once "modules/pref-users.php";
        require_once "modules/pref-feed-browser.php"; 
 
-       $script_started = getmicrotime();
-
-       $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); 
-
-       if (!$link) {
-               if (DB_TYPE == "mysql") {
-                       print mysql_error();
-               }
-               // PG seems to display its own errors just fine by default.             
-               return;
-       }
-
-       if (DB_TYPE == "pgsql") {
-               pg_query("set client_encoding = 'utf-8'");
-       }
 
        if (!sanity_check($link)) { return; }
 
                }
 
                print_headline_subtoolbar($link, $feed_site_url, $feed_title, false, 
-                       $rtl_content, $feed, $cat_view, $search, $match_on, $search_mode, $offset);
+                       $rtl_content, $feed, $cat_view, $search, $match_on, $search_mode, 
+                       $offset, $limit);
 
                print "<div id=\"headlinesInnerContainer\">";
 
        
                                if ($line["marked"] == "t" || $line["marked"] == "1") {
                                        $marked_pic = "<img id=\"FMARKPIC-$id\" src=\"images/mark_set.png\" 
+                                               class=\"markedPic\"
                                                alt=\"Reset mark\" onclick='javascript:toggleMark($id)'>";
                                } else {
                                        $marked_pic = "<img id=\"FMARKPIC-$id\" src=\"images/mark_unset.png\" 
+                                               class=\"markedPic\"
                                                alt=\"Set mark\" onclick='javascript:toggleMark($id)'>";
                                }
 
 
                                        print "<div class=\"cdmHeader\">";
 
-                                       print "<div style=\"float : right\">$updated_fmt $id
-                                               <!-- <a class=\"cdmToggleLink\"
-                                                       href=\"javascript:toggleUnread($id)\">Toggle unread</a> -->
-                                       </div>";
+                                       print "<div class=\"articleUpdated\">$updated_fmt</div>";
                                        
                                        print "<a class=\"title\" 
                                                onclick=\"javascript:toggleUnread($id, 0)\"
 
                                        print "<div class=\"cdmContent\">" . $line["content_preview"] . "</div><br clear=\"all\">";
 
-                                       print "<div style=\"float : right\">$marked_pic</div>
-                                               <div lass=\"cdmFooter\">
-                                                       <input type=\"checkbox\" onclick=\"toggleSelectRowById(this, 
-                                                       'RROW-$id')\" class=\"feedCheckBox\" id=\"RCHK-$id\"></div>";
+                                       print "<div class=\"cdmFooter\">";
+
+                                       print "$marked_pic";
+
+                                       print "<input type=\"checkbox\" onclick=\"toggleSelectRowById(this, 
+                                                       'RROW-$id')\" class=\"feedCheckBox\" id=\"RCHK-$id\">";
+
+                                       $tags = get_article_tags($link, $id);
+
+                                       $tags_str = "";
+
+                                       foreach ($tags as $tag) {
+                                               $num_tags++;
+                                               $tags_str .= "<a href=\"javascript:viewfeed('$tag')\">$tag</a>, "; 
+                                       }
+
+                                       $tags_str = preg_replace("/, $/", "", $tags_str);
+
+                                       if ($tags_str == "") $tags_str = "no tags";
+       
+                                       print " $tags_str <a title=\"Edit tags for this article\" 
+                                                       href=\"javascript:editArticleTags($id, $feed_id, true)\">(+)</a>";
+
+                                       print "</div>";
 
 #                                      print "<div align=\"center\"><a class=\"cdmToggleLink\"
 #                                                      href=\"javascript:toggleUnread($id)\">