]> git.wh0rd.org - tt-rss.git/blobdiff - classes/article.php
include: convert some spaces to tabs
[tt-rss.git] / classes / article.php
index 869e746cf195d6df22f460181bfd98ce672e7f21..edf95b74318659d11f96355df9249ed47b99325b 100644 (file)
@@ -8,6 +8,8 @@ class Article extends Handler_Protected {
        }
 
        function redirect() {
+               $id = clean($_REQUEST['id']);
+
                $sth = $this->pdo->prepare("SELECT link FROM ttrss_entries, ttrss_user_entries
                                                WHERE id = ? AND id = ref_id AND owner_uid = ?
                                                LIMIT 1");
@@ -26,9 +28,9 @@ class Article extends Handler_Protected {
        }
 
        function view() {
-               $id = $_REQUEST["id"];
-               $cids = explode(",", $_REQUEST["cids"]);
-               $mode = $_REQUEST["mode"];
+               $id = clean($_REQUEST["id"]);
+               $cids = explode(",", clean($_REQUEST["cids"]));
+               $mode = clean($_REQUEST["mode"]);
 
                // in prefetch mode we only output requested cids, main article
                // just gets marked as read (it already exists in client cache)
@@ -208,7 +210,7 @@ class Article extends Handler_Protected {
 
                print __("Tags for this article (separated by commas):")."<br>";
 
-               $param = $_REQUEST['param'];
+               $param = clean($_REQUEST['param']);
 
                $tags = Article::get_article_tags($param);
 
@@ -239,8 +241,8 @@ class Article extends Handler_Protected {
        }
 
        function setScore() {
-               $ids = explode(",", $_REQUEST['id']);
-               $score = (int)$_REQUEST['score'];
+               $ids = explode(",", clean($_REQUEST['id']));
+               $score = (int)clean($_REQUEST['score']);
 
                $ids_qmarks = arr_qmarks($ids);
 
@@ -255,7 +257,7 @@ class Article extends Handler_Protected {
        }
 
        function getScore() {
-               $id = $_REQUEST['id'];
+               $id = clean($_REQUEST['id']);
 
                $sth = $this->pdo->prepare("SELECT score FROM ttrss_user_entries WHERE ref_id = ? AND owner_uid = ?");
                $sth->execute([$id, $_SESSION['uid']]);
@@ -271,9 +273,9 @@ class Article extends Handler_Protected {
 
        function setArticleTags() {
 
-               $id = $_REQUEST["id"];
+               $id = clean($_REQUEST["id"]);
 
-               $tags_str = $_REQUEST["tags_str"];
+               $tags_str = clean($_REQUEST["tags_str"]);
                $tags = array_unique(trim_array(explode(",", $tags_str)));
 
                $this->pdo->beginTransaction();
@@ -340,7 +342,7 @@ class Article extends Handler_Protected {
 
 
        function completeTags() {
-               $search = $_REQUEST["search"];
+               $search = clean($_REQUEST["search"]);
 
                $sth = $this->pdo->prepare("SELECT DISTINCT tag_name FROM ttrss_tags
                                WHERE owner_uid = ? AND
@@ -367,8 +369,8 @@ class Article extends Handler_Protected {
        private function labelops($assign) {
                $reply = array();
 
-               $ids = explode(",", $_REQUEST["ids"]);
-               $label_id = $_REQUEST["lid"];
+               $ids = explode(",", clean($_REQUEST["ids"]));
+               $label_id = clean($_REQUEST["lid"]);
 
                $label = db_escape_string(Labels::find_caption($label_id,
                $_SESSION["uid"]));
@@ -601,7 +603,7 @@ class Article extends Handler_Protected {
                        unset($line["tag_cache"]);
 
                        $line["content"] = sanitize($line["content"],
-                               sql_bool_to_bool($line['hide_images']),
+                               $line['hide_images'],
                                $owner_uid, $line["site_url"], false, $line["id"]);
 
                        foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE) as $p) {
@@ -632,12 +634,11 @@ class Article extends Handler_Protected {
                                $rv['content'] .= "<html><head>
                                                <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>
                                                <title>".$line["title"]."</title>".
-                                       stylesheet_tag("css/default.css")."
-
+                                               stylesheet_tag("css/default.css")."
                                                <link rel=\"shortcut icon\" type=\"image/png\" href=\"images/favicon.png\">
                                                <link rel=\"icon\" type=\"image/png\" sizes=\"72x72\" href=\"images/favicon-72px.png\">
 
-                                       </head><body id=\"ttrssZoom\">";
+                                       </head><body class=\"claro ttrss_utility ttrss_zoom\">";
                        }
 
                        $rv['content'] .= "<div class=\"postReply\" id=\"POST-$id\">";
@@ -754,9 +755,9 @@ class Article extends Handler_Protected {
 
                        if (!$zoom_mode) {
                                $rv['content'] .= Article::format_article_enclosures($id,
-                                       sql_bool_to_bool($line["always_display_enclosures"]),
+                                       $line["always_display_enclosures"],
                                        $line["content"],
-                                       sql_bool_to_bool($line["hide_images"]));
+                                       $line["hide_images"]);
                        }
 
                        $rv['content'] .= "</div>";
@@ -902,9 +903,14 @@ class Article extends Handler_Protected {
 
                // purge orphaned posts in main content table
 
+               if (DB_TYPE == "mysql")
+                       $limit_qpart = "LIMIT 5000";
+               else
+                       $limit_qpart = "";
+
                $pdo = Db::pdo();
                $res = $pdo->query("DELETE FROM ttrss_entries WHERE
-                       NOT EXISTS (SELECT ref_id FROM ttrss_user_entries WHERE ref_id = id)");
+                       NOT EXISTS (SELECT ref_id FROM ttrss_user_entries WHERE ref_id = id) $limit_qpart");
 
                if ($do_output) {
                        $rows = $res->rowCount();