From 89db5e219264fc28473605936a211c64c944096b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC?=
<68551925+Artem13327@users.noreply.github.com>
Date: Thu, 8 Sep 2022 00:02:11 +0300
Subject: [PATCH 01/15] The user must agree to the rules in order to register.
(#716)
---
.idea/deployment.xml | 14 ++++++++++++++
.idea/discord.xml | 7 +++++++
Web/Presenters/AuthPresenter.php | 3 +++
Web/Presenters/templates/Auth/Register.xml | 5 ++++-
locales/ru.strings | 2 ++
5 files changed, 30 insertions(+), 1 deletion(-)
create mode 100644 .idea/deployment.xml
create mode 100644 .idea/discord.xml
diff --git a/.idea/deployment.xml b/.idea/deployment.xml
new file mode 100644
index 00000000..dc2a86a5
--- /dev/null
+++ b/.idea/deployment.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/discord.xml b/.idea/discord.xml
new file mode 100644
index 00000000..30bab2ab
--- /dev/null
+++ b/.idea/discord.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Web/Presenters/AuthPresenter.php b/Web/Presenters/AuthPresenter.php
index f934f7fe..bb9d7272 100644
--- a/Web/Presenters/AuthPresenter.php
+++ b/Web/Presenters/AuthPresenter.php
@@ -84,6 +84,9 @@ final class AuthPresenter extends OpenVKPresenter
if (strtotime($this->postParam("birthday")) > time())
$this->flashFail("err", tr("invalid_birth_date"), tr("invalid_birth_date_comment"));
+ if (!$this->postParam("confirmation"))
+ $this->flashFail("err", tr("error"), tr("checkbox_in_registration_unchecked"));
+
try {
$user = new User;
$user->setFirst_Name($this->postParam("first_name"));
diff --git a/Web/Presenters/templates/Auth/Register.xml b/Web/Presenters/templates/Auth/Register.xml
index 23f40aa1..16532cb1 100644
--- a/Web/Presenters/templates/Auth/Register.xml
+++ b/Web/Presenters/templates/Auth/Register.xml
@@ -87,12 +87,15 @@
{captcha_template()|noescape}
+
-
+
|
+ {_checkbox_in_registration|noescape}
+
{_log_in}
|
diff --git a/locales/ru.strings b/locales/ru.strings
index abdee6ff..68f6d69f 100644
--- a/locales/ru.strings
+++ b/locales/ru.strings
@@ -15,6 +15,8 @@
"password" = "Пароль";
"registration" = "Регистрация";
"forgot_password" = "Забыли пароль?";
+"checkbox_in_registration" = "Я согласен с политикой конфиденциальности и правилами сайта";
+"checkbox_in_registration_unchecked" = "Вы должны согласиться с политикой конфиденциальности и правилами, чтобы зарегистрироваться.";
"login_failed" = "Не удалось войти";
"invalid_username_or_password" = "Неверное имя пользователя или пароль. Забыли пароль?";
From 38e51a2b9d3d82622f19b816d20d6a544bd85495 Mon Sep 17 00:00:00 2001
From: n1rwana
Date: Thu, 8 Sep 2022 00:06:17 +0300
Subject: [PATCH 02/15] Deleted the files added by PhpStorm in the previous
commit
---
.idea/.gitignore | 8 -
.idea/deployment.xml | 14 -
.idea/discord.xml | 7 -
.idea/intellij-latte/xmlSources/Latte.dtd | 46 ---
.idea/intellij-latte/xmlSources/Latte.xml | 290 ------------------
.../xmlSources/NetteApplication.xml | 59 ----
.../intellij-latte/xmlSources/NetteForms.xml | 41 ---
.idea/misc.xml | 6 -
.idea/modules.xml | 8 -
.idea/openvk.iml | 46 ---
.idea/php.xml | 48 ---
.idea/runConfigurations.xml | 10 -
.idea/vcs.xml | 6 -
13 files changed, 589 deletions(-)
delete mode 100644 .idea/.gitignore
delete mode 100644 .idea/deployment.xml
delete mode 100644 .idea/discord.xml
delete mode 100644 .idea/intellij-latte/xmlSources/Latte.dtd
delete mode 100644 .idea/intellij-latte/xmlSources/Latte.xml
delete mode 100644 .idea/intellij-latte/xmlSources/NetteApplication.xml
delete mode 100644 .idea/intellij-latte/xmlSources/NetteForms.xml
delete mode 100644 .idea/misc.xml
delete mode 100644 .idea/modules.xml
delete mode 100644 .idea/openvk.iml
delete mode 100644 .idea/php.xml
delete mode 100644 .idea/runConfigurations.xml
delete mode 100644 .idea/vcs.xml
diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 13566b81..00000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
-# Editor-based HTTP Client requests
-/httpRequests/
-# Datasource local storage ignored files
-/dataSources/
-/dataSources.local.xml
diff --git a/.idea/deployment.xml b/.idea/deployment.xml
deleted file mode 100644
index dc2a86a5..00000000
--- a/.idea/deployment.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/discord.xml b/.idea/discord.xml
deleted file mode 100644
index 30bab2ab..00000000
--- a/.idea/discord.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/intellij-latte/xmlSources/Latte.dtd b/.idea/intellij-latte/xmlSources/Latte.dtd
deleted file mode 100644
index 0cf3a95a..00000000
--- a/.idea/intellij-latte/xmlSources/Latte.dtd
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/.idea/intellij-latte/xmlSources/Latte.xml b/.idea/intellij-latte/xmlSources/Latte.xml
deleted file mode 100644
index 0bfceaf8..00000000
--- a/.idea/intellij-latte/xmlSources/Latte.xml
+++ /dev/null
@@ -1,290 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/intellij-latte/xmlSources/NetteApplication.xml b/.idea/intellij-latte/xmlSources/NetteApplication.xml
deleted file mode 100644
index aa4a4685..00000000
--- a/.idea/intellij-latte/xmlSources/NetteApplication.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/intellij-latte/xmlSources/NetteForms.xml b/.idea/intellij-latte/xmlSources/NetteForms.xml
deleted file mode 100644
index 036e07f6..00000000
--- a/.idea/intellij-latte/xmlSources/NetteForms.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 639900d1..00000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index de1f1bbf..00000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/openvk.iml b/.idea/openvk.iml
deleted file mode 100644
index fe58bea6..00000000
--- a/.idea/openvk.iml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/php.xml b/.idea/php.xml
deleted file mode 100644
index 7b4f97fd..00000000
--- a/.idea/php.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
deleted file mode 100644
index 797acea5..00000000
--- a/.idea/runConfigurations.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 35eb1ddf..00000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
From e28964c813c14b9d51ab1f748fc9d198219a3807 Mon Sep 17 00:00:00 2001
From: n1rwana
Date: Thu, 8 Sep 2022 00:22:15 +0300
Subject: [PATCH 03/15] =?UTF-8?q?Now=20only=20unnecessary=20PhpStorm=20fil?=
=?UTF-8?q?es=20are=20removed=F0=9F=91=89=F0=9F=8F=BB=F0=9F=91=88?=
=?UTF-8?q?=F0=9F=8F=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/.gitignore | 8 +
.idea/intellij-latte/xmlSources/Latte.dtd | 35 +++
.idea/intellij-latte/xmlSources/Latte.xml | 290 ++++++++++++++++++
.../xmlSources/NetteApplication.xml | 59 ++++
.../intellij-latte/xmlSources/NetteForms.xml | 41 +++
.idea/misc.xml | 6 +
.idea/modules.xml | 8 +
.idea/openvk.iml | 46 +++
.idea/php.xml | 48 +++
.idea/runConfigurations.xml | 10 +
.idea/vcs.xml | 6 +
11 files changed, 557 insertions(+)
create mode 100644 .idea/.gitignore
create mode 100644 .idea/intellij-latte/xmlSources/Latte.dtd
create mode 100644 .idea/intellij-latte/xmlSources/Latte.xml
create mode 100644 .idea/intellij-latte/xmlSources/NetteApplication.xml
create mode 100644 .idea/intellij-latte/xmlSources/NetteForms.xml
create mode 100644 .idea/misc.xml
create mode 100644 .idea/modules.xml
create mode 100644 .idea/openvk.iml
create mode 100644 .idea/php.xml
create mode 100644 .idea/runConfigurations.xml
create mode 100644 .idea/vcs.xml
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 00000000..ecca0076
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
\ No newline at end of file
diff --git a/.idea/intellij-latte/xmlSources/Latte.dtd b/.idea/intellij-latte/xmlSources/Latte.dtd
new file mode 100644
index 00000000..9b8273f5
--- /dev/null
+++ b/.idea/intellij-latte/xmlSources/Latte.dtd
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/intellij-latte/xmlSources/Latte.xml b/.idea/intellij-latte/xmlSources/Latte.xml
new file mode 100644
index 00000000..e7bb3f7a
--- /dev/null
+++ b/.idea/intellij-latte/xmlSources/Latte.xml
@@ -0,0 +1,290 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/intellij-latte/xmlSources/NetteApplication.xml b/.idea/intellij-latte/xmlSources/NetteApplication.xml
new file mode 100644
index 00000000..aa4a4685
--- /dev/null
+++ b/.idea/intellij-latte/xmlSources/NetteApplication.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/intellij-latte/xmlSources/NetteForms.xml b/.idea/intellij-latte/xmlSources/NetteForms.xml
new file mode 100644
index 00000000..036e07f6
--- /dev/null
+++ b/.idea/intellij-latte/xmlSources/NetteForms.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 00000000..f4364fd5
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 00000000..af99c76e
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/openvk.iml b/.idea/openvk.iml
new file mode 100644
index 00000000..16097db5
--- /dev/null
+++ b/.idea/openvk.iml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/php.xml b/.idea/php.xml
new file mode 100644
index 00000000..28cf2b65
--- /dev/null
+++ b/.idea/php.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 00000000..7b45e612
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 00000000..9db25eef
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
From 384c0da78b90085b243cb43b53c1d36df8e3483a Mon Sep 17 00:00:00 2001
From: celestora
Date: Mon, 12 Sep 2022 20:46:40 +0300
Subject: [PATCH 04/15] Revert Clubs::getPopularClubs change
This functionality is so unstable it causes majority of installations to fail miserably out of the box. The performance also is a major concern. Might re-add later. Sometime.
btw i amended
---
Web/Models/Repositories/Clubs.php | 4 ++++
Web/Presenters/AboutPresenter.php | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/Web/Models/Repositories/Clubs.php b/Web/Models/Repositories/Clubs.php
index b7b59251..4a1b28fe 100644
--- a/Web/Models/Repositories/Clubs.php
+++ b/Web/Models/Repositories/Clubs.php
@@ -45,6 +45,9 @@ class Clubs
function getPopularClubs(): \Traversable
{
+ // TODO rewrite
+
+ /*
$query = "SELECT ROW_NUMBER() OVER (ORDER BY `subscriptions` DESC) as `place`, `target` as `id`, COUNT(`follower`) as `subscriptions` FROM `subscriptions` WHERE `model` = \"openvk\\\Web\\\Models\\\Entities\\\Club\" GROUP BY `target` ORDER BY `subscriptions` DESC, `id` LIMIT 30;";
$entries = DatabaseConnection::i()->getConnection()->query($query);
@@ -54,6 +57,7 @@ class Clubs
"club" => $this->get($entry["id"]),
"subscriptions" => $entry["subscriptions"],
];
+ */
}
use \Nette\SmartObject;
diff --git a/Web/Presenters/AboutPresenter.php b/Web/Presenters/AboutPresenter.php
index 6a281d07..dd503aff 100644
--- a/Web/Presenters/AboutPresenter.php
+++ b/Web/Presenters/AboutPresenter.php
@@ -64,7 +64,7 @@ final class AboutPresenter extends OpenVKPresenter
$this->template->usersStats = (new Users)->getStatistics();
$this->template->clubsCount = (new Clubs)->getCount();
$this->template->postsCount = (new Posts)->getCount();
- $this->template->popularClubs = iterator_to_array((new Clubs)->getPopularClubs());
+ $this->template->popularClubs = [];
$this->template->admins = iterator_to_array((new Users)->getInstanceAdmins());
}
From 2cdcb0dc4e806ad7ba2dee7cd13629f7c7511915 Mon Sep 17 00:00:00 2001
From: n1rwana
Date: Wed, 14 Sep 2022 13:27:48 +0300
Subject: [PATCH 05/15] Ticket deletion fixed (#727)
* Ticket deletion fixed
* ?act=list
---
Web/Presenters/SupportPresenter.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Web/Presenters/SupportPresenter.php b/Web/Presenters/SupportPresenter.php
index 22f09201..99a1908d 100644
--- a/Web/Presenters/SupportPresenter.php
+++ b/Web/Presenters/SupportPresenter.php
@@ -155,11 +155,12 @@ final class SupportPresenter extends OpenVKPresenter
$this->notFound();
} else {
if($ticket->getUserId() !== $this->user->id && $this->hasPermission('openvk\Web\Models\Entities\TicketReply', 'write', 0))
- $this->redirect("/support/tickets");
+ $_redirect = "/support/tickets";
else
- $this->redirect("/support");
+ $_redirect = "/support?act=list";
$ticket->delete();
+ $this->redirect($_redirect);
}
}
}
From 1aed452a12d5bde469609c011b16c8af194ef68d Mon Sep 17 00:00:00 2001
From: Jaroslaw <92401420+AlesAlte@users.noreply.github.com>
Date: Sat, 17 Sep 2022 00:04:35 +0300
Subject: [PATCH 06/15] Ukrainian: translation of new functions (#728)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Correction of localization errors
* Переклад: Блокування посилань
* Add @AlesAlte to contributor Ukrainian locale
* Update ua.strings
* Small fix
---
locales/list.yml | 2 +-
locales/ua.strings | 38 +++++++++++++++++++++++++++++++-------
2 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/locales/list.yml b/locales/list.yml
index e072c152..b6ff0a44 100644
--- a/locales/list.yml
+++ b/locales/list.yml
@@ -13,7 +13,7 @@ list:
flag: "ua"
name: "Ukrainian"
native_name: "Україньска"
- author: "Andrej Lenťaj, Maxim Hrabovi (dechioyo) and Kirill (mbsoft)"
+ author: "Yaroslav Bjelograd, Andrej Lenťaj, Maxim Hrabovi (dechioyo) and Kirill (mbsoft)"
- code: "by"
flag: "by"
name: "Belarussian"
diff --git a/locales/ua.strings b/locales/ua.strings
index ef701a0b..fdeca0bc 100644
--- a/locales/ua.strings
+++ b/locales/ua.strings
@@ -15,6 +15,8 @@
"password" = "Пароль";
"registration" = "Реєстрація";
"forgot_password" = "Забули пароль?";
+"checkbox_in_registration" = "Я згоден з політикою конфіденційності і правилами сайту";
+"checkbox_in_registration_unchecked" = "Ви повинні погодитися з політикою конфіденційності та правилами, щоб зареєструватися.";
"login_failed" = "Не вдалося увійти";
"invalid_username_or_password" = "Неправильне ім'я користувача або пароль. Забули пароль?";
@@ -210,6 +212,7 @@
/* Friends */
+"friends" = "Друзі";
"followers" = "Підписники";
"follower" = "Підписник";
"friends_add" = "Додати в друзі";
@@ -218,10 +221,11 @@
"friends_accept" = "Прийняти заявку";
"send_message" = "Відправити повідомлення";
"incoming_req" = "Підписники";
+"outcoming_req" = "Вихідні";
+"req" = "Заявки";
"outcoming_req" = "Заявки";
"friends_online" = "Друзі онлайн";
"all_friends" = "Усі друзі";
-"req" = "Заявки";
"req_zero" = "Не знайдено жодної заявки...";
"req_one" = "Знайдена $1 заявка";
@@ -235,18 +239,18 @@
"friends_many" = "$1 друзів";
"friends_other" = "$1 друзів";
-"friends_list_zero" = "У вас поки немає друзів";
-"friends_list_one" = "У Вас $1 друг";
-"friends_list_few" = "У Вас $1 друг";
-"friends_many" = "$1 друзів";
-"friends_other" = "$1 друзів";
-
"friends_online_zero" = "Жодного друга онлайн";
"friends_online_one" = "$1 друг онлайн";
"friends_online_few" = "$1 друга онлайн";
"friends_online_many" = "$1 друзів онлайн";
"friends_online_other" = "$1 друзів онлайн";
+"friends_list_zero" = "У вас поки немає друзів";
+"friends_list_one" = "У Вас $1 друг";
+"friends_list_few" = "У Вас $1 друг";
+"friends_many" = "$1 друзів";
+"friends_other" = "$1 друзів";
+
"followers_zero" = "Жодного підписника";
"followers_one" = "$1 підписник";
"followers_few" = "$1 підписника";
@@ -1122,6 +1126,17 @@
"admin_commerce_disabled" = "Комерція відключена системним адміністратором";
"admin_commerce_disabled_desc" = "Налаштування ваучерів та подарунків будуть збережені, але не матимуть впливу.";
+"admin_banned_links" = "Заблоковані посилання";
+"admin_banned_link" = "Посилання";
+"admin_banned_domain" = "Домен";
+"admin_banned_link_description" = "З протоколом (https://example.org/)";
+"admin_banned_link_regexp" = "Регулярний вираз";
+"admin_banned_link_regexp_description" = "Підставляється після домену, зазначеного вище. Не заповнюйте, якщо хочете заблокувати весь домен";
+"admin_banned_link_reason" = "Причина";
+"admin_banned_link_initiator" = "Ініціатор";
+"admin_banned_link_not_specified" = "Посилання не зазначено";
+"admin_banned_link_not_found" = "Посилання не знайдено";
+
/* Paginator (deprecated) */
"paginator_back" = "Назад";
@@ -1185,3 +1200,12 @@
"cookies_popup_content" = "Цей веб-сайт використовує cookies для того, щоб ідентифікувати вашу сесію і нічого більше. Ознайомтеся з нашою політикою конфіденційності для отримання додаткової інформації.";
"cookies_popup_agree" = "Згоден";
+
+/* Away */
+
+"url_is_banned" = "Перехід неможливий";
+"url_is_banned_comment" = "Адміністрація $1 не рекомендує переходити за цим посиланням.";
+"url_is_banned_comment_r" = "Адміністрація $1 не рекомендує переходити за цим посиланням.
Підстава: $2";
+"url_is_banned_default_reason" = "Посилання, за яким Ви спробували перейти, може вести на сайт, що був створений з метою обману користувачів і отримання шляхом цього неправомірного прибутку.";
+"url_is_banned_title" = "Посилання на підозрілий сайт";
+"url_is_banned_proceed" = "Перейти за посиланням";
From ed7faa4a160f55b84f4201803795098577f27aa4 Mon Sep 17 00:00:00 2001
From: Vladimir Lapskiy <94683384+el-psy-congroo-desu@users.noreply.github.com>
Date: Sat, 17 Sep 2022 02:05:25 +0500
Subject: [PATCH 07/15] VKAPI: Friends.getRequests added some parameters that i
forgot about and fix count requests in the response (#724)
* VKAPI: Friends.getRequests method did not give more than 6 elements
* VKAPI: Friends.getRequests i'm forget add some parameters LOL
---
VKAPI/Handlers/Friends.php | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/VKAPI/Handlers/Friends.php b/VKAPI/Handlers/Friends.php
index ca9b7573..20c537a5 100644
--- a/VKAPI/Handlers/Friends.php
+++ b/VKAPI/Handlers/Friends.php
@@ -133,15 +133,18 @@ final class Friends extends VKAPIRequestHandler
return $response;
}
- function getRequests(string $fields = "", int $offset = 0, int $count = 100): object
+ function getRequests(string $fields = "", int $offset = 0, int $count = 100, int $extended = 0): object
{
+ if ($count >= 1000)
+ $this->fail(100, "One of the required parameters was not passed or is invalid.");
+
$this->requireUser();
$i = 0;
$offset++;
$followers = [];
- foreach($this->getUser()->getFollowers() as $follower) {
+ foreach($this->getUser()->getFollowers($offset, $count) as $follower) {
$followers[$i] = $follower->getId();
$i++;
}
@@ -149,8 +152,10 @@ final class Friends extends VKAPIRequestHandler
$response = $followers;
$usersApi = new Users($this->getUser());
- if(!is_null($fields))
- $response = $usersApi->get(implode(',', $followers), $fields, 0, $count); # FIXME
+ if($extended == 1)
+ $response = $usersApi->get(implode(',', $followers), $fields, 0, $count);
+ else
+ $response = $usersApi->get(implode(',', $followers), "", 0, $count);
foreach($response as $user)
$user->user_id = $user->id;
From 753be2aaff6711637fcbfacfc543748629e5e043 Mon Sep 17 00:00:00 2001
From: n1rwana
Date: Sat, 17 Sep 2022 00:19:46 +0300
Subject: [PATCH 08/15] Maintenance (#719)
---
Web/Presenters/AppsPresenter.php | 2 +-
Web/Presenters/CommentPresenter.php | 1 +
Web/Presenters/GiftsPresenter.php | 1 +
Web/Presenters/GroupPresenter.php | 3 +-
Web/Presenters/MaintenancePresenter.php | 35 +++++++++++++++++++
Web/Presenters/MessengerPresenter.php | 6 ++--
Web/Presenters/NotesPresenter.php | 3 +-
Web/Presenters/NotificationPresenter.php | 2 ++
Web/Presenters/OpenVKPresenter.php | 28 ++++++++++-----
Web/Presenters/PhotosPresenter.php | 3 +-
Web/Presenters/SupportPresenter.php | 1 +
Web/Presenters/TopicsPresenter.php | 3 +-
Web/Presenters/UserPresenter.php | 5 +--
Web/Presenters/VideosPresenter.php | 3 +-
Web/Presenters/templates/Maintenance/All.xml | 20 +++++++++++
.../templates/Maintenance/Section.xml | 20 +++++++++++
Web/di.yml | 1 +
Web/routes.yml | 4 +++
locales/en.strings | 9 +++++
locales/ru.strings | 9 +++++
openvk-example.yml | 14 ++++++++
21 files changed, 155 insertions(+), 18 deletions(-)
create mode 100644 Web/Presenters/MaintenancePresenter.php
create mode 100644 Web/Presenters/templates/Maintenance/All.xml
create mode 100644 Web/Presenters/templates/Maintenance/Section.xml
diff --git a/Web/Presenters/AppsPresenter.php b/Web/Presenters/AppsPresenter.php
index 02fb8922..8dcfb8a4 100644
--- a/Web/Presenters/AppsPresenter.php
+++ b/Web/Presenters/AppsPresenter.php
@@ -6,7 +6,7 @@ use openvk\Web\Models\Repositories\Applications;
final class AppsPresenter extends OpenVKPresenter
{
private $apps;
-
+ protected $presenterName = "apps";
function __construct(Applications $apps)
{
$this->apps = $apps;
diff --git a/Web/Presenters/CommentPresenter.php b/Web/Presenters/CommentPresenter.php
index cbdac84e..0429b32e 100644
--- a/Web/Presenters/CommentPresenter.php
+++ b/Web/Presenters/CommentPresenter.php
@@ -6,6 +6,7 @@ use openvk\Web\Models\Repositories\{Comments, Clubs};
final class CommentPresenter extends OpenVKPresenter
{
+ protected $presenterName = "comment";
private $models = [
"posts" => "openvk\\Web\\Models\\Repositories\\Posts",
"photos" => "openvk\\Web\\Models\\Repositories\\Photos",
diff --git a/Web/Presenters/GiftsPresenter.php b/Web/Presenters/GiftsPresenter.php
index b99e5ba9..8f59bdcb 100644
--- a/Web/Presenters/GiftsPresenter.php
+++ b/Web/Presenters/GiftsPresenter.php
@@ -7,6 +7,7 @@ final class GiftsPresenter extends OpenVKPresenter
{
private $gifts;
private $users;
+ protected $presenterName = "gifts";
function __construct(Gifts $gifts, Users $users)
{
diff --git a/Web/Presenters/GroupPresenter.php b/Web/Presenters/GroupPresenter.php
index a83386db..00d74c2e 100644
--- a/Web/Presenters/GroupPresenter.php
+++ b/Web/Presenters/GroupPresenter.php
@@ -8,7 +8,8 @@ use Chandler\Security\Authenticator;
final class GroupPresenter extends OpenVKPresenter
{
private $clubs;
-
+ protected $presenterName = "group";
+
function __construct(Clubs $clubs)
{
$this->clubs = $clubs;
diff --git a/Web/Presenters/MaintenancePresenter.php b/Web/Presenters/MaintenancePresenter.php
new file mode 100644
index 00000000..d4a5a6ef
--- /dev/null
+++ b/Web/Presenters/MaintenancePresenter.php
@@ -0,0 +1,35 @@
+flashFail("err", tr("error"), tr("forbidden"));
+
+ $this->template->name = [
+ "photos" => tr("my_photos"),
+ "videos" => tr("my_videos"),
+ "messenger" => tr("my_messages"),
+ "user" => tr("users"),
+ "group" => tr("my_groups"),
+ "comment" => tr("comments"),
+ "gifts" => tr("gifts"),
+ "apps" => tr("apps"),
+ "notes" => tr("my_notes"),
+ "notification" => tr("my_feedback"),
+ "support" => tr("menu_support"),
+ "topics" => tr("topics")
+ ][$name] ?? $name;
+ }
+
+ function renderAll(): void
+ {
+
+ }
+}
diff --git a/Web/Presenters/MessengerPresenter.php b/Web/Presenters/MessengerPresenter.php
index cea440ba..593d9245 100644
--- a/Web/Presenters/MessengerPresenter.php
+++ b/Web/Presenters/MessengerPresenter.php
@@ -9,11 +9,13 @@ final class MessengerPresenter extends OpenVKPresenter
{
private $messages;
private $signaler;
-
+ protected $presenterName = "messenger";
+
function __construct(Messages $messages)
{
$this->messages = $messages;
$this->signaler = SignalManager::i();
+
parent::__construct();
}
@@ -30,7 +32,7 @@ final class MessengerPresenter extends OpenVKPresenter
function renderIndex(): void
{
$this->assertUserLoggedIn();
-
+
if(isset($_GET["sel"]))
$this->pass("openvk!Messenger->app", $_GET["sel"]);
diff --git a/Web/Presenters/NotesPresenter.php b/Web/Presenters/NotesPresenter.php
index 363d814c..50437ad7 100644
--- a/Web/Presenters/NotesPresenter.php
+++ b/Web/Presenters/NotesPresenter.php
@@ -6,7 +6,8 @@ use openvk\Web\Models\Entities\Note;
final class NotesPresenter extends OpenVKPresenter
{
private $notes;
-
+ protected $presenterName = "notes";
+
function __construct(Notes $notes)
{
$this->notes = $notes;
diff --git a/Web/Presenters/NotificationPresenter.php b/Web/Presenters/NotificationPresenter.php
index d12f27f0..3bd7a321 100644
--- a/Web/Presenters/NotificationPresenter.php
+++ b/Web/Presenters/NotificationPresenter.php
@@ -3,6 +3,8 @@ namespace openvk\Web\Presenters;
final class NotificationPresenter extends OpenVKPresenter
{
+ protected $presenterName = "notification";
+
function renderFeed(): void
{
$this->assertUserLoggedIn();
diff --git a/Web/Presenters/OpenVKPresenter.php b/Web/Presenters/OpenVKPresenter.php
index 2a19fa03..5b7908a8 100755
--- a/Web/Presenters/OpenVKPresenter.php
+++ b/Web/Presenters/OpenVKPresenter.php
@@ -17,7 +17,8 @@ abstract class OpenVKPresenter extends SimplePresenter
protected $deactivationTolerant = false;
protected $errorTemplate = "@error";
protected $user = NULL;
-
+ protected $presenterName;
+
private function calculateQueryString(array $data): string
{
$rawUrl = "tcp+stratum://fakeurl.net$_SERVER[REQUEST_URI]"; #HTTP_HOST can be tainted
@@ -196,12 +197,13 @@ abstract class OpenVKPresenter extends SimplePresenter
function onStartup(): void
{
$user = Authenticator::i()->getUser();
-
+
$this->template->isXmas = intval(date('d')) >= 1 && date('m') == 12 || intval(date('d')) <= 15 && date('m') == 1 ? true : false;
$this->template->isTimezoned = Session::i()->get("_timezoneOffset");
-
+
$userValidated = 0;
$cacheTime = OPENVK_ROOT_CONF["openvk"]["preferences"]["nginxCacheTime"] ?? 0;
+
if(!is_null($user)) {
$this->user = (object) [];
$this->user->raw = $user;
@@ -226,7 +228,7 @@ abstract class OpenVKPresenter extends SimplePresenter
}
exit;
}
-
+
if($this->user->identity->isBanned() && !$this->banTolerant) {
header("HTTP/1.1 403 Forbidden");
$this->getTemplatingEngine()->render(__DIR__ . "/templates/@banned.xml", [
@@ -247,23 +249,33 @@ abstract class OpenVKPresenter extends SimplePresenter
]);
exit;
}
-
+
$userValidated = 1;
$cacheTime = 0; # Force no cache
if($this->user->identity->onlineStatus() == 0 && !($this->user->identity->isDeleted() || $this->user->identity->isBanned())) {
$this->user->identity->setOnline(time());
$this->user->identity->save();
}
-
+
$this->template->ticketAnsweredCount = (new Tickets)->getTicketsCountByUserId($this->user->id, 1);
if($user->can("write")->model("openvk\Web\Models\Entities\TicketReply")->whichBelongsTo(0))
$this->template->helpdeskTicketNotAnsweredCount = (new Tickets)->getTicketCount(0);
}
-
+
header("X-OpenVK-User-Validated: $userValidated");
header("X-Accel-Expires: $cacheTime");
setlocale(LC_TIME, ...(explode(";", tr("__locale"))));
-
+
+ if (!OPENVK_ROOT_CONF["openvk"]["preferences"]["maintenanceMode"]["all"]) {
+ if (OPENVK_ROOT_CONF["openvk"]["preferences"]["maintenanceMode"][$this->presenterName]) {
+ $this->pass("openvk!Maintenance->section", $this->presenterName);
+ }
+ } else {
+ if ($this->presenterName != "maintenance") {
+ $this->redirect("/maintenances/");
+ }
+ }
+
parent::onStartup();
}
diff --git a/Web/Presenters/PhotosPresenter.php b/Web/Presenters/PhotosPresenter.php
index eacf76d4..3dd2a774 100644
--- a/Web/Presenters/PhotosPresenter.php
+++ b/Web/Presenters/PhotosPresenter.php
@@ -9,7 +9,8 @@ final class PhotosPresenter extends OpenVKPresenter
private $users;
private $photos;
private $albums;
-
+ protected $presenterName = "photos";
+
function __construct(Photos $photos, Albums $albums, Users $users)
{
$this->users = $users;
diff --git a/Web/Presenters/SupportPresenter.php b/Web/Presenters/SupportPresenter.php
index 99a1908d..8f4fd7d3 100644
--- a/Web/Presenters/SupportPresenter.php
+++ b/Web/Presenters/SupportPresenter.php
@@ -11,6 +11,7 @@ final class SupportPresenter extends OpenVKPresenter
{
protected $banTolerant = true;
protected $deactivationTolerant = true;
+ protected $presenterName = "support";
private $tickets;
private $comments;
diff --git a/Web/Presenters/TopicsPresenter.php b/Web/Presenters/TopicsPresenter.php
index 6dd1ec6c..528b51ad 100644
--- a/Web/Presenters/TopicsPresenter.php
+++ b/Web/Presenters/TopicsPresenter.php
@@ -7,7 +7,8 @@ final class TopicsPresenter extends OpenVKPresenter
{
private $topics;
private $clubs;
-
+ protected $presenterName = "topics";
+
function __construct(Topics $topics, Clubs $clubs)
{
$this->topics = $topics;
diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php
index bfda79e8..48ebb660 100644
--- a/Web/Presenters/UserPresenter.php
+++ b/Web/Presenters/UserPresenter.php
@@ -15,12 +15,13 @@ use Nette\Database\UniqueConstraintViolationException;
final class UserPresenter extends OpenVKPresenter
{
private $users;
-
public $deactivationTolerant = false;
+ protected $presenterName = "user";
+
function __construct(Users $users)
{
$this->users = $users;
-
+
parent::__construct();
}
diff --git a/Web/Presenters/VideosPresenter.php b/Web/Presenters/VideosPresenter.php
index e7b24344..6db7771d 100644
--- a/Web/Presenters/VideosPresenter.php
+++ b/Web/Presenters/VideosPresenter.php
@@ -8,7 +8,8 @@ final class VideosPresenter extends OpenVKPresenter
{
private $videos;
private $users;
-
+ protected $presenterName = "videos";
+
function __construct(Videos $videos, Users $users)
{
$this->videos = $videos;
diff --git a/Web/Presenters/templates/Maintenance/All.xml b/Web/Presenters/templates/Maintenance/All.xml
new file mode 100644
index 00000000..e8f88e2c
--- /dev/null
+++ b/Web/Presenters/templates/Maintenance/All.xml
@@ -0,0 +1,20 @@
+{extends "../@layout.xml"}
+
+{block title}
+ {_global_maintenance}
+{/block}
+
+{block header}
+ {_global_maintenance}
+{/block}
+
+{block content}
+
+
+
+
+ {_undergoing_global_maintenance}
+
+
+
+{/block}
diff --git a/Web/Presenters/templates/Maintenance/Section.xml b/Web/Presenters/templates/Maintenance/Section.xml
new file mode 100644
index 00000000..9bdb0965
--- /dev/null
+++ b/Web/Presenters/templates/Maintenance/Section.xml
@@ -0,0 +1,20 @@
+{extends "../@layout.xml"}
+
+{block title}
+ {_section_maintenance}
+{/block}
+
+{block header}
+ {_section_maintenance}
+{/block}
+
+{block content}
+
+
+
+
+ {tr("undergoing_section_maintenance", $name)|noescape}
+
+
+
+{/block}
diff --git a/Web/di.yml b/Web/di.yml
index f18654b4..f4b04650 100644
--- a/Web/di.yml
+++ b/Web/di.yml
@@ -44,3 +44,4 @@ services:
- openvk\Web\Models\Repositories\Applications
- openvk\Web\Models\Repositories\ContentSearchRepository
- openvk\Web\Models\Repositories\BannedLinks
+ - openvk\Web\Presenters\MaintenancePresenter
diff --git a/Web/routes.yml b/Web/routes.yml
index 0ee44444..d6f63a11 100644
--- a/Web/routes.yml
+++ b/Web/routes.yml
@@ -331,3 +331,7 @@ routes:
handler: "UnknownTextRouteStrategy->delegate"
placeholders:
shortCode: "[a-z][a-z0-9\\@\\.\\_]{0,30}[a-z0-9]"
+ - url: "/maintenance/{text}"
+ handler: "Maintenance->section"
+ - url: "/maintenances/"
+ handler: "Maintenance->all"
diff --git a/locales/en.strings b/locales/en.strings
index 2e3461b7..240dd5d0 100644
--- a/locales/en.strings
+++ b/locales/en.strings
@@ -1147,3 +1147,12 @@
"url_is_banned_default_reason" = "The link you are trying to open may lead you to a site that was created for the purpose of deceiving users with the intention of gaining profit.";
"url_is_banned_title" = "Link to a suspicious site";
"url_is_banned_proceed" = "Follow the link";
+
+/* Maintenance */
+
+"global_maintenance" = "Undergoing maintenance";
+"section_maintenance" = "The section is not available";
+"undergoing_global_maintenance" = "Unfortunately, the instance is now closed for technical work. We are already working on troubleshooting. Please try to come back later.";
+"undergoing_section_maintenance" = "Unfortunately, the $1 section is temporarily unavailable. We are already working on troubleshooting. Please try to come back later.";
+
+"topics" = "Topics";
diff --git a/locales/ru.strings b/locales/ru.strings
index 68f6d69f..2f176233 100644
--- a/locales/ru.strings
+++ b/locales/ru.strings
@@ -1208,3 +1208,12 @@
"url_is_banned_default_reason" = "Ссылка, по которой вы попытались перейти, может вести на сайт, который был создан с целью обмана пользователей и получения за счёт этого прибыли.";
"url_is_banned_title" = "Ссылка на подозрительный сайт";
"url_is_banned_proceed" = "Перейти по ссылке";
+
+/* Maintenance */
+
+"global_maintenance" = "Технические работы";
+"section_maintenance" = "Раздел недоступен";
+"undergoing_global_maintenance" = "К сожалению, сейчас инстанс закрыт на технические работы. Мы уже работаем над устранением неисправностей. Пожалуйста, попробуйте зайти позже.";
+"undergoing_section_maintenance" = "К сожалению, раздел $1 временно недоступен. Мы уже работаем над устранением неисправностей. Пожалуйста, попробуйте зайти позже.";
+
+"topics" = "Темы";
diff --git a/openvk-example.yml b/openvk-example.yml
index 64b7b38c..47eacd24 100644
--- a/openvk-example.yml
+++ b/openvk-example.yml
@@ -58,6 +58,20 @@ openvk:
susLinks:
warnings: true
showReason: true
+ maintenanceMode:
+ all: false
+ photos: false
+ videos: false
+ messenger: false
+ user: false
+ group: false
+ comment: false
+ gifts: false
+ apps: false
+ notes: false
+ notification: false
+ support: false
+ topics: false
ton:
enabled: false
address: "🅿"
From 5b3a1f50e94cbd22655536fbb5350d2eb09b99c1 Mon Sep 17 00:00:00 2001
From: n1rwana
Date: Sat, 17 Sep 2022 00:21:29 +0300
Subject: [PATCH 09/15] Shortcode aliases (#690)
* Shortcode aliases
* Fixes
* Newline
* Fixes + SQLs renamed
* Fixed clubs aliases
---
Web/Models/Entities/Alias.php | 34 ++++++++++++++++++
Web/Models/Entities/User.php | 4 +++
Web/Models/Repositories/Aliases.php | 35 +++++++++++++++++++
Web/Models/Repositories/Clubs.php | 13 ++++++-
Web/Models/Repositories/Users.php | 15 +++++++-
Web/di.yml | 1 +
...-banned-urls.sql => 00032-banned-urls.sql} | 0
install/sqls/00033-shortcode-aliases.sql | 12 +++++++
8 files changed, 112 insertions(+), 2 deletions(-)
create mode 100644 Web/Models/Entities/Alias.php
create mode 100644 Web/Models/Repositories/Aliases.php
rename install/sqls/{00031-banned-urls.sql => 00032-banned-urls.sql} (100%)
create mode 100644 install/sqls/00033-shortcode-aliases.sql
diff --git a/Web/Models/Entities/Alias.php b/Web/Models/Entities/Alias.php
new file mode 100644
index 00000000..99f7baae
--- /dev/null
+++ b/Web/Models/Entities/Alias.php
@@ -0,0 +1,34 @@
+getRecord()->owner_id;
+ }
+
+ function getType(): string
+ {
+ if ($this->getOwnerId() < 0)
+ return "club";
+
+ return "user";
+ }
+
+ function getUser(): ?User
+ {
+ return (new Users)->get($this->getOwnerId());
+ }
+
+ function getClub(): ?Club
+ {
+ return (new Clubs)->get($this->getOwnerId() * -1);
+ }
+}
diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php
index 115bf8c2..f1045f62 100644
--- a/Web/Models/Entities/User.php
+++ b/Web/Models/Entities/User.php
@@ -908,6 +908,10 @@ class User extends RowModel
$pClub = DatabaseConnection::i()->getContext()->table("groups")->where("shortcode", $code)->fetch();
if(!is_null($pClub))
return false;
+
+ $pAlias = DatabaseConnection::i()->getContext()->table("aliases")->where("shortcode", $code)->fetch();
+ if(!is_null($pAlias))
+ return false;
}
$this->stateChanges("shortcode", $code);
diff --git a/Web/Models/Repositories/Aliases.php b/Web/Models/Repositories/Aliases.php
new file mode 100644
index 00000000..e74532a1
--- /dev/null
+++ b/Web/Models/Repositories/Aliases.php
@@ -0,0 +1,35 @@
+context = DB::i()->getContext();
+ $this->aliases = $this->context->table("aliases");
+ }
+
+ private function toAlias(?ActiveRow $ar): ?Alias
+ {
+ return is_null($ar) ? NULL : new Alias($ar);
+ }
+
+ function get(int $id): ?Alias
+ {
+ return $this->toAlias($this->aliases->get($id));
+ }
+
+ function getByShortcode(string $shortcode): ?Alias
+ {
+ return $this->toAlias($this->aliases->where("shortcode", $shortcode)->fetch());
+ }
+}
diff --git a/Web/Models/Repositories/Clubs.php b/Web/Models/Repositories/Clubs.php
index 4a1b28fe..edbe75c6 100644
--- a/Web/Models/Repositories/Clubs.php
+++ b/Web/Models/Repositories/Clubs.php
@@ -1,6 +1,7 @@
toClub($this->clubs->where("shortcode", $url)->fetch());
+ $shortcode = $this->toClub($this->clubs->where("shortcode", $url)->fetch());
+
+ if ($shortcode)
+ return $shortcode;
+
+ $alias = (new Aliases)->getByShortcode($url);
+
+ if (!$alias) return NULL;
+ if ($alias->getType() !== "club") return NULL;
+
+ return $alias->getClub();
}
function get(int $id): ?Club
diff --git a/Web/Models/Repositories/Users.php b/Web/Models/Repositories/Users.php
index 9cd7d001..63e77df0 100644
--- a/Web/Models/Repositories/Users.php
+++ b/Web/Models/Repositories/Users.php
@@ -1,6 +1,7 @@
context = DatabaseConnection::i()->getContext();
$this->users = $this->context->table("profiles");
+ $this->aliases = $this->context->table("aliases");
}
private function toUser(?ActiveRow $ar): ?User
@@ -28,7 +31,17 @@ class Users
function getByShortURL(string $url): ?User
{
- return $this->toUser($this->users->where("shortcode", $url)->fetch());
+ $shortcode = $this->toUser($this->users->where("shortcode", $url)->fetch());
+
+ if ($shortcode)
+ return $shortcode;
+
+ $alias = (new Aliases)->getByShortcode($url);
+
+ if (!$alias) return NULL;
+ if ($alias->getType() !== "user") return NULL;
+
+ return $alias->getUser();
}
function getByChandlerUser(ChandlerUser $user): ?User
diff --git a/Web/di.yml b/Web/di.yml
index f4b04650..ec867809 100644
--- a/Web/di.yml
+++ b/Web/di.yml
@@ -43,5 +43,6 @@ services:
- openvk\Web\Models\Repositories\Topics
- openvk\Web\Models\Repositories\Applications
- openvk\Web\Models\Repositories\ContentSearchRepository
+ - openvk\Web\Models\Repositories\Aliases
- openvk\Web\Models\Repositories\BannedLinks
- openvk\Web\Presenters\MaintenancePresenter
diff --git a/install/sqls/00031-banned-urls.sql b/install/sqls/00032-banned-urls.sql
similarity index 100%
rename from install/sqls/00031-banned-urls.sql
rename to install/sqls/00032-banned-urls.sql
diff --git a/install/sqls/00033-shortcode-aliases.sql b/install/sqls/00033-shortcode-aliases.sql
new file mode 100644
index 00000000..520f0502
--- /dev/null
+++ b/install/sqls/00033-shortcode-aliases.sql
@@ -0,0 +1,12 @@
+CREATE TABLE `aliases` (
+ `id` bigint UNSIGNED NOT NULL,
+ `owner_id` bigint NOT NULL,
+ `shortcode` varchar(36) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+
+ALTER TABLE `aliases`
+ ADD PRIMARY KEY (`id`);
+
+ALTER TABLE `aliases`
+ MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;
+COMMIT;
From 283d8c1c2d5674e59efd0a07ddf43f640bb18eec Mon Sep 17 00:00:00 2001
From: Vladimir Barinov
Date: Sat, 17 Sep 2022 00:25:44 +0300
Subject: [PATCH 10/15] Install SQLs: Fix MariaDB compatibility
---
install/sqls/00032-banned-urls.sql | 9 ++++-----
install/sqls/00033-shortcode-aliases.sql | 3 +--
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/install/sqls/00032-banned-urls.sql b/install/sqls/00032-banned-urls.sql
index c208eb37..0df7b275 100644
--- a/install/sqls/00032-banned-urls.sql
+++ b/install/sqls/00032-banned-urls.sql
@@ -1,14 +1,13 @@
CREATE TABLE `links_banned` (
`id` bigint UNSIGNED NOT NULL,
- `domain` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
- `regexp_rule` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
- `reason` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
+ `domain` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
+ `regexp_rule` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
+ `reason` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_nopad_ci,
`initiator` bigint UNSIGNED NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
ALTER TABLE `links_banned`
ADD PRIMARY KEY (`id`);
ALTER TABLE `links_banned`
MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;
-COMMIT;
\ No newline at end of file
diff --git a/install/sqls/00033-shortcode-aliases.sql b/install/sqls/00033-shortcode-aliases.sql
index 520f0502..d47975c0 100644
--- a/install/sqls/00033-shortcode-aliases.sql
+++ b/install/sqls/00033-shortcode-aliases.sql
@@ -2,11 +2,10 @@ CREATE TABLE `aliases` (
`id` bigint UNSIGNED NOT NULL,
`owner_id` bigint NOT NULL,
`shortcode` varchar(36) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
ALTER TABLE `aliases`
ADD PRIMARY KEY (`id`);
ALTER TABLE `aliases`
MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;
-COMMIT;
From 697a36520530c1efe6e13e192925b7be0d8f66a2 Mon Sep 17 00:00:00 2001
From: veselcraft
Date: Mon, 19 Sep 2022 16:54:23 +0300
Subject: [PATCH 11/15] Longpool: Update format for use in modern clients
---
Web/Events/NewMessageEvent.php | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/Web/Events/NewMessageEvent.php b/Web/Events/NewMessageEvent.php
index 49d102b3..3b828e90 100644
--- a/Web/Events/NewMessageEvent.php
+++ b/Web/Events/NewMessageEvent.php
@@ -27,14 +27,23 @@ class NewMessageEvent implements ILPEmitable
if($peer === $userId)
$peer = $msg->getRecipient()->getId();
+ /*
+ * Source:
+ * https://github.com/danyadev/longpoll-doc
+ */
+
return [
4, # event type
+ $msg->getId(), # messageId
256, # checked for spam flag
$peer, # TODO calculate peer correctly
$msg->getSendTime()->timestamp(), # creation time in unix
$msg->getText(), # text (formatted)
+ [], # empty additional info
[], # empty attachments
$msg->getId() << 2, # id as random_id
+ $peer, # conversation id
+ 0 # not edited yet
];
}
}
From b38f4f23460d9083505c58512f4db186172d46c4 Mon Sep 17 00:00:00 2001
From: veselcraft
Date: Mon, 19 Sep 2022 17:13:37 +0300
Subject: [PATCH 12/15] Longpoll: Add wait parameter as in original VK
---
Web/Presenters/MessengerPresenter.php | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/Web/Presenters/MessengerPresenter.php b/Web/Presenters/MessengerPresenter.php
index 593d9245..46094c43 100644
--- a/Web/Presenters/MessengerPresenter.php
+++ b/Web/Presenters/MessengerPresenter.php
@@ -95,6 +95,13 @@ final class MessengerPresenter extends OpenVKPresenter
}
$legacy = $this->queryParam("version") < 3;
+
+ $time = intval($this->queryParam("wait"));
+
+ if($time > 60)
+ $time = 60;
+ elseif($time == 0)
+ $time = 25; // default
$this->signaler->listen(function($event, $eId) use ($id) {
exit(json_encode([
@@ -103,7 +110,7 @@ final class MessengerPresenter extends OpenVKPresenter
$event->getVKAPISummary($id),
],
]));
- }, $id);
+ }, $id, $time);
}
function renderApiGetMessages(int $sel, int $lastMsg): void
From 6eeb05236e9634256f9bcdd4fc42db99c4e77070 Mon Sep 17 00:00:00 2001
From: Maxim Leshchenko
Date: Tue, 20 Sep 2022 16:16:34 +0200
Subject: [PATCH 13/15] Russian: Fix typo in page edit
---
locales/ru.strings | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/locales/ru.strings b/locales/ru.strings
index 2f176233..6a7b8f46 100644
--- a/locales/ru.strings
+++ b/locales/ru.strings
@@ -992,7 +992,7 @@
"changes_saved_comment" = "Новые данные появятся на вашей странице";
"photo_saved" = "Фотография сохранена";
-"photo_saved_comment" = "Новое изображние профиля появится у вас на странице";
+"photo_saved_comment" = "Новое изображение профиля появится у вас на странице";
"shared_succ" = "Запись появится на вашей стене. Нажмите на уведомление, чтобы перейти к своей стене.";
From 729784ecfff4c35bbf4e062c39ae8ef57c77a1da Mon Sep 17 00:00:00 2001
From: Maxim Leshchenko
Date: Fri, 23 Sep 2022 16:29:17 +0200
Subject: [PATCH 14/15] Groups: Display links not only for managed groups in My
Groups Closes #664
---
Web/Presenters/templates/User/Groups.xml | 32 ++++++++++++------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/Web/Presenters/templates/User/Groups.xml b/Web/Presenters/templates/User/Groups.xml
index 18c2e9d8..cc32b3d0 100644
--- a/Web/Presenters/templates/User/Groups.xml
+++ b/Web/Presenters/templates/User/Groups.xml
@@ -79,9 +79,9 @@
{/block}
{block actions}
+ {_check_community}
{if $x->canBeModifiedBy($thisUser ?? NULL)}
{var $clubPinned = $thisUser->isClubPinned($x)}
- {_check_community}
{if $clubPinned}
{_remove_from_left_menu}
@@ -89,21 +89,21 @@
{_add_to_left_menu}
{/if}
- {if $x->getSubscriptionStatus($thisUser) == false}
-
- {else}
-
- {/if}
+ {/if}
+ {if $x->getSubscriptionStatus($thisUser) == false}
+
+ {else}
+
{/if}
{/block}
From 7d72cd182bdcdcafa0bdec390245571f4f594f40 Mon Sep 17 00:00:00 2001
From: Maxim Leshchenko
Date: Fri, 23 Sep 2022 17:10:29 +0200
Subject: [PATCH 15/15] Users: Do not show the request tab in the list of other
user's friends Closes #605
---
Web/Presenters/templates/User/Friends.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Web/Presenters/templates/User/Friends.xml b/Web/Presenters/templates/User/Friends.xml
index d85fbd56..ed140cf1 100644
--- a/Web/Presenters/templates/User/Friends.xml
+++ b/Web/Presenters/templates/User/Friends.xml
@@ -53,7 +53,7 @@
-