Compare commits

...

4 commits

Author SHA1 Message Date
ayato
428e1e9f95
Merge 14bcb8a271 into a12c77083b 2025-03-16 22:08:44 +05:00
Vladimir Barinov
a12c77083b
fix(links, away) (fixes #1253) 2025-03-16 17:57:21 +03:00
Vladimir Barinov
4815186b79
chore(statistics): change behavior of active users count (#1254) 2025-03-16 17:53:58 +03:00
Vladimir Barinov
9ef7d2d7c4
fix(age): calculation (fixes #1252) 2025-03-16 16:51:05 +03:00
4 changed files with 10 additions and 7 deletions

View file

@ -41,11 +41,11 @@ trait TRichText
return preg_replace_callback(
"%(([A-z]++):\/\/(\S*?\.\S*?))([\s)\[\]{},\"\'<]|\.\s|$)%",
(function (array $matches): string {
$href = str_replace("#", "&num;", $matches[1]);
$href = rawurlencode(str_replace(";", "&#59;", $href));
$link = str_replace("#", "&num;", $matches[3]);
$href = rawurlencode($matches[1]);
$href = str_replace("%26amp%3B", "%26", $href);
$link = $matches[3];
# this string breaks ampersands
$link = str_replace(";", "&#59;", $link);
# $link = str_replace(";", "&#59;", $link);
$rel = $this->isAd() ? "sponsored" : "ugc";
/*$server_domain = str_replace(':' . $_SERVER['SERVER_PORT'], '', $_SERVER['HTTP_HOST']);

View file

@ -524,7 +524,10 @@ class User extends RowModel
public function getAge(): ?int
{
return (int) floor((time() - $this->getBirthday()->timestamp()) / YEAR);
$birthday = new \DateTime();
$birthday->setTimestamp($this->getBirthday()->timestamp());
$today = new \DateTime();
return (int) $today->diff($birthday)->y;
}
public function get2faSecret(): ?string

View file

@ -157,7 +157,7 @@ class Users
{
return (object) [
"all" => (clone $this->users)->count('*'),
"active" => (clone $this->users)->where("online > 0")->count('*'),
"active" => (clone $this->users)->where("online >= ?", time() - MONTH)->count('*'),
"online" => (clone $this->users)->where("online >= ?", time() - 900)->count('*'),
];
}

View file

@ -20,7 +20,7 @@ final class AwayPresenter extends OpenVKPresenter
header("HTTP/1.0 302 Found");
header("X-Robots-Tag: noindex, nofollow, noarchive");
header("Location: " . $this->queryParam("to"));
header("Location: " . rawurldecode($this->queryParam("to")));
exit;
}