1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 20:05:55 +00:00

add UserHelper::find_user_by_login() and rewrite some user checks to invoke it instead of going through PDO

This commit is contained in:
Andrew Dolgov
2021-02-11 10:22:27 +03:00
parent 7af8744c85
commit 09e9f34bb4
7 changed files with 51 additions and 82 deletions

View File

@@ -248,19 +248,15 @@ class Handler_Public extends Handler {
$login = clean($_REQUEST["login"]);
$fresh = clean($_REQUEST["fresh"]) == "1";
$sth = $this->pdo->prepare("SELECT id FROM ttrss_users WHERE LOWER(login) = LOWER(?)");
$sth->execute([$login]);
if ($row = $sth->fetch()) {
$uid = $row["id"];
$uid = UserHelper::find_user_by_login($login);
if ($uid) {
print Feeds::getGlobalUnread($uid);
if ($fresh) {
print ";";
print Feeds::getFeedArticles(-3, false, true, $uid);
}
} else {
print "-1;User not found";
}