Sorry, labels have been administratively disabled for this installation. Please contact instance owner or edit configuration file to enable this functionality.

"; return; } $subop = $_GET["subop"]; if ($subop == "edit") { $label_id = db_escape_string($_GET["id"]); $result = db_query($link, "SELECT sql_exp,description FROM ttrss_labels WHERE owner_uid = ".$_SESSION["uid"]." AND id = '$label_id' ORDER by description"); $line = db_fetch_assoc($result); $sql_exp = htmlspecialchars(db_unescape_string($line["sql_exp"])); $description = htmlspecialchars(db_unescape_string($line["description"])); print "
Label editor
"; print "
"; print "
"; print ""; print ""; print ""; print ""; print ""; print "
Caption: "; print "

SQL Expression:

"; print ""; print "
"; print "
"; print "
"; print "
"; $is_disabled = (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== FALSE) ? "disabled" : ""; print " "; print " "; print ""; print "
"; return; } if ($subop == "test") { $expr = db_unescape_string(trim($_GET["expr"])); $descr = db_unescape_string(trim($_GET["descr"])); print "
"; error_reporting(0); $result = db_query($link, "SELECT count(ttrss_entries.id) AS num_matches FROM ttrss_entries,ttrss_user_entries,ttrss_feeds WHERE ($expr) AND ttrss_user_entries.ref_id = ttrss_entries.id AND ttrss_user_entries.feed_id = ttrss_feeds.id AND ttrss_user_entries.owner_uid = " . $_SESSION["uid"], false); error_reporting (DEFAULT_ERROR_LEVEL); if (!$result) { print "

" . db_last_error($link) . "

"; print "
"; return; } $num_matches = db_fetch_result($result, 0, "num_matches");; if ($num_matches > 0) { if ($num_matches > 10) { $showing_msg = ", showing first 10"; } print "

Query returned $num_matches matches$showing_msg:

"; $result = db_query($link, "SELECT ttrss_entries.title, (SELECT title FROM ttrss_feeds WHERE id = feed_id) AS feed_title FROM ttrss_entries,ttrss_user_entries,ttrss_feeds WHERE ($expr) AND ttrss_user_entries.ref_id = ttrss_entries.id AND ttrss_user_entries.feed_id = ttrss_feeds.id AND ttrss_user_entries.owner_uid = " . $_SESSION["uid"] . " ORDER BY date_entered DESC LIMIT 10", false); print ""; } else { print "

Query didn't return any matches.

"; } print "
"; return; } if ($subop == "editSave") { $sql_exp = trim($_GET["sql_exp"]); $descr = db_escape_string(trim($_GET["description"])); $label_id = db_escape_string($_GET["id"]); $result = db_query($link, "UPDATE ttrss_labels SET sql_exp = '$sql_exp', description = '$descr' WHERE id = '$label_id'"); if (db_affected_rows($link, $result) != 0) { print_notice(T_sprintf("Saved label %s", htmlspecialchars($descr))); } } if ($subop == "remove") { if (!WEB_DEMO_MODE) { $ids = split(",", db_escape_string($_GET["ids"])); foreach ($ids as $id) { db_query($link, "DELETE FROM ttrss_labels WHERE id = '$id'"); } } } if ($subop == "add") { // no escaping is done here on purpose $sql_exp = trim($_GET["sql_exp"]); $description = db_escape_string($_GET["description"]); if (!$sql_exp || !$description) return; $result = db_query($link, "INSERT INTO ttrss_labels (sql_exp,description,owner_uid) VALUES ('$sql_exp', '$description', '".$_SESSION["uid"]."')"); if (db_affected_rows($link, $result) != 0) { print T_sprintf("Created label %s", htmlspecialchars($description)); } return; } set_pref($link, "_PREFS_ACTIVE_TAB", "labelConfig"); $sort = db_escape_string($_GET["sort"]); if (!$sort || $sort == "undefined") { $sort = "description"; } print " "; print "
"; print"
"; $result = db_query($link, "SELECT id,sql_exp,description FROM ttrss_labels WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY $sort"); // print "
PLACEHOLDER
"; if (db_num_rows($result) != 0) { print "

"; print ""; $lnum = 0; while ($line = db_fetch_assoc($result)) { $class = ($lnum % 2) ? "even" : "odd"; $label_id = $line["id"]; $edit_label_id = $_GET["id"]; if ($subop == "edit" && $label_id != $edit_label_id) { $class .= "Grayed"; $this_row_id = ""; } else { $this_row_id = "id=\"LILRR-$label_id\""; } print ""; $line["sql_exp"] = htmlspecialchars(db_unescape_string($line["sql_exp"])); $line["description"] = htmlspecialchars( db_unescape_string($line["description"])); if (!$line["description"]) $line["description"] = "[No caption]"; print ""; print ""; print ""; print ""; ++$lnum; } if ($lnum == 0) { print ""; } print "
Select: All, None "; print "
  ".__('Caption')." ".__('SQL Expression')."
" . $line["description"] . "" . $line["sql_exp"] . "
".__('No labels defined.')."
"; print "

"; print " "; } else { print "

".__('No labels defined.')."

"; } } ?>