functions.php: Fixed some mild errors.
fetch_file_contents() using $updated when it was not defined - commented it out update_rss_feed_real() was also using $updated, undefined and had a inconsistent return, added return false; lookup_user_id($link, $user) was using $login for the SELECT not $user format_headline_subtoolbar() used $search_q before it was assigned to, re-ordered the code format_article() The 3rd arg "$feed_id" was never used in the function, it was set in the function Verified (and modified as needed) function calls in backend.php (5 Usages) and in modules/backend-rpc,php (1 usage) printTagCloud() Before ksort($tags) add a check for count($tags) == 0 return replace depreciated split() calls with explode() backend.php replace depreciated split() calls with explode() modules/backed-rpc.php replace depreciated split() calls with explode() in handle_rpc_request(), separate asort() from join(), asort() does not return an array. This fixes a problem where a new tag is added to an entry, but doesn't show up after clicking on save. User must do a screen refresh. A PHP error msg was being returned in the JSON response. .gitignore Make sure Mac OS X .DS_Store & PHPStorm project files (.idea/) are not included
This commit is contained in:
parent
9d9faf6dc2
commit
9949bd154e
|
@ -1,3 +1,7 @@
|
||||||
|
*~
|
||||||
|
*.DS_Store
|
||||||
|
#*
|
||||||
|
.idea/*
|
||||||
config.php
|
config.php
|
||||||
icons/*
|
icons/*
|
||||||
cache/*/*
|
cache/*/*
|
||||||
|
|
|
@ -205,7 +205,7 @@
|
||||||
case "view":
|
case "view":
|
||||||
|
|
||||||
$id = db_escape_string($_REQUEST["id"]);
|
$id = db_escape_string($_REQUEST["id"]);
|
||||||
$cids = split(",", db_escape_string($_REQUEST["cids"]));
|
$cids = explode(",", db_escape_string($_REQUEST["cids"]));
|
||||||
$mode = db_escape_string($_REQUEST["mode"]);
|
$mode = db_escape_string($_REQUEST["mode"]);
|
||||||
$omode = db_escape_string($_REQUEST["omode"]);
|
$omode = db_escape_string($_REQUEST["omode"]);
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@
|
||||||
if ($mode == "") {
|
if ($mode == "") {
|
||||||
array_push($articles, format_article($link, $id, false));
|
array_push($articles, format_article($link, $id, false));
|
||||||
} else if ($mode == "zoom") {
|
} else if ($mode == "zoom") {
|
||||||
array_push($articles, format_article($link, $id, false, true, true));
|
array_push($articles, format_article($link, $id, true, true));
|
||||||
} else if ($mode == "raw") {
|
} else if ($mode == "raw") {
|
||||||
if ($_REQUEST['html']) {
|
if ($_REQUEST['html']) {
|
||||||
header("Content-Type: text/html");
|
header("Content-Type: text/html");
|
||||||
|
@ -384,7 +384,7 @@
|
||||||
$articles = array();
|
$articles = array();
|
||||||
|
|
||||||
foreach ($topmost_article_ids as $id) {
|
foreach ($topmost_article_ids as $id) {
|
||||||
array_push($articles, format_article($link, $id, $feed, false));
|
array_push($articles, format_article($link, $id, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
$reply['articles'] = $articles;
|
$reply['articles'] = $articles;
|
||||||
|
|
|
@ -399,7 +399,7 @@
|
||||||
|
|
||||||
return $contents;
|
return $contents;
|
||||||
} else {
|
} else {
|
||||||
if ($login && $pass && $updated != 3) {
|
if ($login && $pass ){
|
||||||
$url_parts = array();
|
$url_parts = array();
|
||||||
|
|
||||||
preg_match("/(^[^:]*):\/\/(.*)/", $url, $url_parts);
|
preg_match("/(^[^:]*):\/\/(.*)/", $url, $url_parts);
|
||||||
|
@ -579,11 +579,11 @@
|
||||||
$cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
|
$cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
|
||||||
$fetch_url = db_fetch_result($result, 0, "feed_url");
|
$fetch_url = db_fetch_result($result, 0, "feed_url");
|
||||||
|
|
||||||
if ($update_interval < 0) { return; }
|
if ($update_interval < 0) { return false; }
|
||||||
|
|
||||||
$feed = db_escape_string($feed);
|
$feed = db_escape_string($feed);
|
||||||
|
|
||||||
if ($auth_login && $auth_pass && $updated != 3) {
|
if ($auth_login && $auth_pass ){
|
||||||
$url_parts = array();
|
$url_parts = array();
|
||||||
preg_match("/(^[^:]*):\/\/(.*)/", $fetch_url, $url_parts);
|
preg_match("/(^[^:]*):\/\/(.*)/", $fetch_url, $url_parts);
|
||||||
|
|
||||||
|
@ -1445,7 +1445,7 @@
|
||||||
foreach ($article_filters as $f) {
|
foreach ($article_filters as $f) {
|
||||||
if ($f[0] == "tag") {
|
if ($f[0] == "tag") {
|
||||||
|
|
||||||
$manual_tags = trim_array(split(",", $f[1]));
|
$manual_tags = trim_array(explode(",", $f[1]));
|
||||||
|
|
||||||
foreach ($manual_tags as $tag) {
|
foreach ($manual_tags as $tag) {
|
||||||
if (tag_is_valid($tag)) {
|
if (tag_is_valid($tag)) {
|
||||||
|
@ -1457,7 +1457,7 @@
|
||||||
|
|
||||||
// Skip boring tags
|
// Skip boring tags
|
||||||
|
|
||||||
$boring_tags = trim_array(split(",", mb_strtolower(get_pref($link,
|
$boring_tags = trim_array(explode(",", mb_strtolower(get_pref($link,
|
||||||
'BLACKLISTED_TAGS', $owner_uid, ''), 'utf-8')));
|
'BLACKLISTED_TAGS', $owner_uid, ''), 'utf-8')));
|
||||||
|
|
||||||
$filtered_tags = array();
|
$filtered_tags = array();
|
||||||
|
@ -1817,8 +1817,7 @@
|
||||||
|
|
||||||
function lookup_user_id($link, $user) {
|
function lookup_user_id($link, $user) {
|
||||||
|
|
||||||
$result = db_query($link, "SELECT id FROM ttrss_users WHERE
|
$result = db_query($link, "SELECT id FROM ttrss_users WHERE login = '$user'");
|
||||||
login = '$login'");
|
|
||||||
|
|
||||||
if (db_num_rows($result) == 1) {
|
if (db_num_rows($result) == 1) {
|
||||||
return db_fetch_result($result, 0, "id");
|
return db_fetch_result($result, 0, "id");
|
||||||
|
@ -3000,7 +2999,7 @@
|
||||||
|
|
||||||
function get_pgsql_version($link) {
|
function get_pgsql_version($link) {
|
||||||
$result = db_query($link, "SELECT version() AS version");
|
$result = db_query($link, "SELECT version() AS version");
|
||||||
$version = split(" ", db_fetch_result($result, 0, "version"));
|
$version = explode(" ", db_fetch_result($result, 0, "version"));
|
||||||
return $version[1];
|
return $version[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3345,7 +3344,7 @@
|
||||||
|
|
||||||
$search_query_part = "";
|
$search_query_part = "";
|
||||||
|
|
||||||
$keywords = split(" ", $search);
|
$keywords = explode(" ", $search);
|
||||||
$query_keywords = array();
|
$query_keywords = array();
|
||||||
|
|
||||||
foreach ($keywords as $k) {
|
foreach ($keywords as $k) {
|
||||||
|
@ -3356,7 +3355,7 @@
|
||||||
$not = "";
|
$not = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$commandpair = split(":", mb_strtolower($k), 2);
|
$commandpair = explode(":", mb_strtolower($k), 2);
|
||||||
|
|
||||||
if ($commandpair[0] == "note" && $commandpair[1]) {
|
if ($commandpair[0] == "note" && $commandpair[1]) {
|
||||||
|
|
||||||
|
@ -4317,7 +4316,7 @@
|
||||||
$fg_color = db_fetch_result($result, 0, "fg_color");
|
$fg_color = db_fetch_result($result, 0, "fg_color");
|
||||||
$bg_color = db_fetch_result($result, 0, "bg_color");
|
$bg_color = db_fetch_result($result, 0, "bg_color");
|
||||||
|
|
||||||
$reply .= "<span style='background : $bg_color; color : $fg_color'>";
|
$reply .= "<span style=\"background : $bg_color; color : $fg_color\" >";
|
||||||
$reply .= $feed_title;
|
$reply .= $feed_title;
|
||||||
$reply .= "</span>";
|
$reply .= "</span>";
|
||||||
} else {
|
} else {
|
||||||
|
@ -4678,8 +4677,7 @@
|
||||||
return $entry;
|
return $entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
function format_article($link, $id, $feed_id, $mark_as_read = true,
|
function format_article($link, $id, $mark_as_read = true, $zoom_mode = false) {
|
||||||
$zoom_mode = false) {
|
|
||||||
|
|
||||||
$rv = array();
|
$rv = array();
|
||||||
|
|
||||||
|
@ -4947,10 +4945,10 @@
|
||||||
|
|
||||||
if ($subop == "undefined") $subop = "";
|
if ($subop == "undefined") $subop = "";
|
||||||
|
|
||||||
$subop_split = split(":", $subop);
|
$subop_split = explode(":", $subop);
|
||||||
|
|
||||||
if ($subop == "CatchupSelected") {
|
if ($subop == "CatchupSelected") {
|
||||||
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
$ids = explode(",", db_escape_string($_REQUEST["ids"]));
|
||||||
$cmode = sprintf("%d", $_REQUEST["cmode"]);
|
$cmode = sprintf("%d", $_REQUEST["cmode"]);
|
||||||
|
|
||||||
catchupArticlesById($link, $ids, $cmode);
|
catchupArticlesById($link, $ids, $cmode);
|
||||||
|
@ -5556,6 +5554,8 @@
|
||||||
$tags[$line["tag_name"]] = $line["count"];
|
$tags[$line["tag_name"]] = $line["count"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( count($tags) == 0 ){ return; }
|
||||||
|
|
||||||
ksort($tags);
|
ksort($tags);
|
||||||
|
|
||||||
$max_size = 32; // max font size in pixels
|
$max_size = 32; // max font size in pixels
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
// Silent
|
// Silent
|
||||||
if ($subop == "remprofiles") {
|
if ($subop == "remprofiles") {
|
||||||
$ids = split(",", db_escape_string(trim($_REQUEST["ids"])));
|
$ids = explode(",", db_escape_string(trim($_REQUEST["ids"])));
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
if ($_SESSION["profile"] != $id) {
|
if ($_SESSION["profile"] != $id) {
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
|
|
||||||
// Silent
|
// Silent
|
||||||
if ($subop == "remarchive") {
|
if ($subop == "remarchive") {
|
||||||
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
$ids = explode(",", db_escape_string($_REQUEST["ids"]));
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
$result = db_query($link, "DELETE FROM ttrss_archived_feeds WHERE
|
$result = db_query($link, "DELETE FROM ttrss_archived_feeds WHERE
|
||||||
|
@ -186,7 +186,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($subop == "archive") {
|
if ($subop == "archive") {
|
||||||
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
$ids = explode(",", db_escape_string($_REQUEST["ids"]));
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
archive_article($link, $id, $_SESSION["uid"]);
|
archive_article($link, $id, $_SESSION["uid"]);
|
||||||
|
@ -260,7 +260,7 @@
|
||||||
|
|
||||||
/* GET["cmode"] = 0 - mark as read, 1 - as unread, 2 - toggle */
|
/* GET["cmode"] = 0 - mark as read, 1 - as unread, 2 - toggle */
|
||||||
if ($subop == "catchupSelected") {
|
if ($subop == "catchupSelected") {
|
||||||
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
$ids = explode(",", db_escape_string($_REQUEST["ids"]));
|
||||||
$cmode = sprintf("%d", $_REQUEST["cmode"]);
|
$cmode = sprintf("%d", $_REQUEST["cmode"]);
|
||||||
|
|
||||||
catchupArticlesById($link, $ids, $cmode);
|
catchupArticlesById($link, $ids, $cmode);
|
||||||
|
@ -270,7 +270,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($subop == "markSelected") {
|
if ($subop == "markSelected") {
|
||||||
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
$ids = explode(",", db_escape_string($_REQUEST["ids"]));
|
||||||
$cmode = sprintf("%d", $_REQUEST["cmode"]);
|
$cmode = sprintf("%d", $_REQUEST["cmode"]);
|
||||||
|
|
||||||
markArticlesById($link, $ids, $cmode);
|
markArticlesById($link, $ids, $cmode);
|
||||||
|
@ -280,7 +280,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($subop == "publishSelected") {
|
if ($subop == "publishSelected") {
|
||||||
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
$ids = explode(",", db_escape_string($_REQUEST["ids"]));
|
||||||
$cmode = sprintf("%d", $_REQUEST["cmode"]);
|
$cmode = sprintf("%d", $_REQUEST["cmode"]);
|
||||||
|
|
||||||
publishArticlesById($link, $ids, $cmode);
|
publishArticlesById($link, $ids, $cmode);
|
||||||
|
@ -320,7 +320,7 @@
|
||||||
$id = db_escape_string($_REQUEST["id"]);
|
$id = db_escape_string($_REQUEST["id"]);
|
||||||
|
|
||||||
$tags_str = db_escape_string($_REQUEST["tags_str"]);
|
$tags_str = db_escape_string($_REQUEST["tags_str"]);
|
||||||
$tags = array_unique(trim_array(split(",", $tags_str)));
|
$tags = array_unique(trim_array(explode(",", $tags_str)));
|
||||||
|
|
||||||
db_query($link, "BEGIN");
|
db_query($link, "BEGIN");
|
||||||
|
|
||||||
|
@ -359,7 +359,8 @@
|
||||||
|
|
||||||
/* update tag cache */
|
/* update tag cache */
|
||||||
|
|
||||||
$tags_str = asort(join(",", $tags_to_cache));
|
sort($tags_to_cache);
|
||||||
|
$tags_str = join(",", $tags_to_cache);
|
||||||
|
|
||||||
db_query($link, "UPDATE ttrss_user_entries
|
db_query($link, "UPDATE ttrss_user_entries
|
||||||
SET tag_cache = '$tags_str' WHERE ref_id = '$id'
|
SET tag_cache = '$tags_str' WHERE ref_id = '$id'
|
||||||
|
@ -413,7 +414,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($subop == "purge") {
|
if ($subop == "purge") {
|
||||||
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
$ids = explode(",", db_escape_string($_REQUEST["ids"]));
|
||||||
$days = sprintf("%d", $_REQUEST["days"]);
|
$days = sprintf("%d", $_REQUEST["days"]);
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
|
@ -443,7 +444,7 @@
|
||||||
} */
|
} */
|
||||||
|
|
||||||
if ($subop == "getArticles") {
|
if ($subop == "getArticles") {
|
||||||
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
$ids = explode(",", db_escape_string($_REQUEST["ids"]));
|
||||||
$articles = array();
|
$articles = array();
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
|
@ -468,7 +469,7 @@
|
||||||
if ($subop == "assignToLabel" || $subop == "removeFromLabel") {
|
if ($subop == "assignToLabel" || $subop == "removeFromLabel") {
|
||||||
$reply = array();
|
$reply = array();
|
||||||
|
|
||||||
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
$ids = explode(",", db_escape_string($_REQUEST["ids"]));
|
||||||
$label_id = db_escape_string($_REQUEST["lid"]);
|
$label_id = db_escape_string($_REQUEST["lid"]);
|
||||||
|
|
||||||
$label = db_escape_string(label_find_caption($link, $label_id,
|
$label = db_escape_string(label_find_caption($link, $label_id,
|
||||||
|
@ -559,7 +560,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $ids = split(",", db_escape_string($_REQUEST["ids"]));
|
/* $ids = explode(",", db_escape_string($_REQUEST["ids"]));
|
||||||
|
|
||||||
$subscribed = array();
|
$subscribed = array();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue