|
|
|
@ -358,7 +358,7 @@ class Article extends Handler_Protected {
|
|
|
|
|
else
|
|
|
|
|
label_remove_article($id, $label, $_SESSION["uid"]);
|
|
|
|
|
|
|
|
|
|
$labels = get_article_labels($id, $_SESSION["uid"]);
|
|
|
|
|
$labels = $this->get_article_labels($id, $_SESSION["uid"]);
|
|
|
|
|
|
|
|
|
|
array_push($reply["info-for-headlines"],
|
|
|
|
|
array("id" => $id, "labels" => $this->format_article_labels($labels)));
|
|
|
|
@ -924,4 +924,49 @@ class Article extends Handler_Protected {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static function get_article_labels($id, $owner_uid = false) {
|
|
|
|
|
$rv = array();
|
|
|
|
|
|
|
|
|
|
if (!$owner_uid) $owner_uid = $_SESSION["uid"];
|
|
|
|
|
|
|
|
|
|
$result = db_query("SELECT label_cache FROM
|
|
|
|
|
ttrss_user_entries WHERE ref_id = '$id' AND owner_uid = " .
|
|
|
|
|
$owner_uid);
|
|
|
|
|
|
|
|
|
|
if (db_num_rows($result) > 0) {
|
|
|
|
|
$label_cache = db_fetch_result($result, 0, "label_cache");
|
|
|
|
|
|
|
|
|
|
if ($label_cache) {
|
|
|
|
|
$label_cache = json_decode($label_cache, true);
|
|
|
|
|
|
|
|
|
|
if ($label_cache["no-labels"] == 1)
|
|
|
|
|
return $rv;
|
|
|
|
|
else
|
|
|
|
|
return $label_cache;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$result = db_query(
|
|
|
|
|
"SELECT DISTINCT label_id,caption,fg_color,bg_color
|
|
|
|
|
FROM ttrss_labels2, ttrss_user_labels2
|
|
|
|
|
WHERE id = label_id
|
|
|
|
|
AND article_id = '$id'
|
|
|
|
|
AND owner_uid = ". $owner_uid . "
|
|
|
|
|
ORDER BY caption");
|
|
|
|
|
|
|
|
|
|
while ($line = db_fetch_assoc($result)) {
|
|
|
|
|
$rk = array(label_to_feed_id($line["label_id"]),
|
|
|
|
|
$line["caption"], $line["fg_color"],
|
|
|
|
|
$line["bg_color"]);
|
|
|
|
|
array_push($rv, $rk);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (count($rv) > 0)
|
|
|
|
|
label_update_cache($owner_uid, $id, $rv);
|
|
|
|
|
else
|
|
|
|
|
label_update_cache($owner_uid, $id, array("no-labels" => 1));
|
|
|
|
|
|
|
|
|
|
return $rv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|