]> git.wh0rd.org Git - tt-rss.git/commitdiff
fix update stopped by get_article_labels()
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 30 Oct 2012 10:59:09 +0000 (14:59 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 30 Oct 2012 10:59:09 +0000 (14:59 +0400)
include/functions.php
include/rssfuncs.php

index 4d7f61a2bc10faf3e7d99b3a0e1c963cc52d5b31..01ec33187c608437ecd38ba88bc7ea3996d591f5 100644 (file)
                }
        }
 
-       function get_article_labels($link, $id) {
+       function get_article_labels($link, $id, $owner_uid = false) {
                $rv = array();
 
+               if (!$owner_uid) $owner_uid = $_SESSION["uid"];
 
                $result = db_query($link, "SELECT label_cache FROM
                        ttrss_user_entries WHERE ref_id = '$id' AND owner_uid = " .
-                       $_SESSION["uid"]);
-
-               $label_cache = db_fetch_result($result, 0, "label_cache");
+                       $owner_uid);
 
-               if ($label_cache) {
+               if (db_num_rows($result) > 0) {
+                       $label_cache = db_fetch_result($result, 0, "label_cache");
 
-                       $label_cache = json_decode($label_cache, true);
+                       if ($label_cache) {
+                               $label_cache = json_decode($label_cache, true);
 
-                       if ($label_cache["no-labels"] == 1)
-                               return $rv;
-                       else
-                               return $label_cache;
+                               if ($label_cache["no-labels"] == 1)
+                                       return $rv;
+                               else
+                                       return $label_cache;
+                       }
                }
 
                $result = db_query($link,
                                FROM ttrss_labels2, ttrss_user_labels2
                        WHERE id = label_id
                                AND article_id = '$id'
-                               AND owner_uid = ".$_SESSION["uid"] . "
+                               AND owner_uid = ". $owner_uid . "
                        ORDER BY caption");
 
                while ($line = db_fetch_assoc($result)) {
index e90b3cc079fa74efa291da2865b69c83243fc1d3..12099293cec6098105d419346d2deaccee1d9e9b 100644 (file)
                                                }
                                        }
 
-                                       $article_labels = get_article_labels($link, $entry_ref_id);
+                                       $article_labels = get_article_labels($link, $entry_ref_id, $owner_uid);
 
                                        if (find_article_filter($article_filters, "filter")) {
                                                db_query($link, "COMMIT"); // close transaction in progress