2025-01-31 18:20:13 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-06-07 19:04:43 +03:00
|
|
|
namespace openvk\Web\Presenters;
|
2025-01-31 18:20:13 +03:00
|
|
|
|
2020-06-16 17:15:36 +03:00
|
|
|
use openvk\Web\Themes\Themepacks;
|
2022-01-03 18:31:55 +03:00
|
|
|
use openvk\Web\Models\Repositories\{Users, Managers, Clubs, Posts};
|
2021-12-04 16:06:28 +03:00
|
|
|
use openvk\Web\Util\Localizator;
|
2020-06-07 19:04:43 +03:00
|
|
|
use Chandler\Session\Session;
|
|
|
|
|
|
|
|
final class AboutPresenter extends OpenVKPresenter
|
|
|
|
{
|
|
|
|
protected $banTolerant = true;
|
2022-01-31 14:45:53 +03:00
|
|
|
protected $activationTolerant = true;
|
2022-08-05 23:00:52 +03:00
|
|
|
protected $deactivationTolerant = true;
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function renderIndex(): void
|
2020-06-07 19:04:43 +03:00
|
|
|
{
|
2025-01-31 18:20:13 +03:00
|
|
|
if (!is_null($this->user)) {
|
|
|
|
if ($this->user->identity->getMainPage()) {
|
2022-08-09 08:52:36 +03:00
|
|
|
$this->redirect("/feed");
|
2025-01-31 18:20:13 +03:00
|
|
|
} else {
|
2022-08-09 08:52:36 +03:00
|
|
|
$this->redirect($this->user->identity->getURL());
|
2025-01-31 18:20:13 +03:00
|
|
|
}
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
if ($_SERVER['REQUEST_URI'] == "/id0") {
|
2022-08-09 08:52:36 +03:00
|
|
|
$this->redirect("/");
|
2020-07-13 09:16:52 +03:00
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
$this->template->stats = (new Users())->getStatistics();
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function renderRules(): void
|
2020-06-07 19:04:43 +03:00
|
|
|
{
|
2020-06-16 15:38:32 +03:00
|
|
|
$this->pass("openvk!Support->knowledgeBaseArticle", "rules");
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function renderHelp(): void {}
|
|
|
|
|
|
|
|
public function renderBB(): void {}
|
|
|
|
|
|
|
|
public function renderTour(): void {}
|
|
|
|
|
|
|
|
public function renderInvite(): void
|
2021-09-13 06:22:05 +03:00
|
|
|
{
|
|
|
|
$this->assertUserLoggedIn();
|
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function renderDonate(): void
|
2020-07-17 20:56:33 +03:00
|
|
|
{
|
|
|
|
$this->pass("openvk!Support->knowledgeBaseArticle", "donate");
|
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function renderPrivacy(): void
|
2020-06-16 15:38:32 +03:00
|
|
|
{
|
|
|
|
$this->pass("openvk!Support->knowledgeBaseArticle", "privacy");
|
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function renderVersion(): void
|
2020-06-07 19:04:43 +03:00
|
|
|
{
|
2020-06-16 17:15:36 +03:00
|
|
|
$this->template->themes = Themepacks::i()->getAllThemes();
|
2021-09-16 02:50:58 +03:00
|
|
|
$this->template->languages = getLanguages();
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|
2022-01-03 18:31:55 +03:00
|
|
|
|
2025-01-31 18:20:13 +03:00
|
|
|
public function renderAboutInstance(): void
|
2022-01-03 18:31:55 +03:00
|
|
|
{
|
2025-01-31 18:20:13 +03:00
|
|
|
$this->template->usersStats = (new Users())->getStatistics();
|
|
|
|
$this->template->clubsCount = (new Clubs())->getCount();
|
|
|
|
$this->template->postsCount = (new Posts())->getCount();
|
2022-09-12 20:46:40 +03:00
|
|
|
$this->template->popularClubs = [];
|
2025-01-31 18:20:13 +03:00
|
|
|
$this->template->admins = iterator_to_array((new Users())->getInstanceAdmins());
|
2022-01-03 18:31:55 +03:00
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function renderLanguage(): void
|
2020-06-07 19:04:43 +03:00
|
|
|
{
|
2021-09-16 02:50:58 +03:00
|
|
|
$this->template->languages = getLanguages();
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
if (!is_null($_GET['lg'])) {
|
2021-12-05 01:48:25 +03:00
|
|
|
$this->assertNoCSRF();
|
2021-09-16 02:50:58 +03:00
|
|
|
setLanguage($_GET['lg']);
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|
2022-11-06 06:20:00 +03:00
|
|
|
|
2025-01-31 18:20:13 +03:00
|
|
|
if (!is_null($_GET['jReturnTo'])) {
|
2022-11-06 06:20:00 +03:00
|
|
|
$this->redirect(rawurldecode($_GET['jReturnTo']));
|
2025-01-31 18:20:13 +03:00
|
|
|
}
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|
|
|
|
|
2025-01-31 18:20:13 +03:00
|
|
|
public function renderExportJSLanguage($lg = null): void
|
2021-12-04 16:06:28 +03:00
|
|
|
{
|
|
|
|
$localizer = Localizator::i();
|
|
|
|
$lang = $lg;
|
2025-01-31 18:20:13 +03:00
|
|
|
if (is_null($lg)) {
|
2021-12-04 16:06:28 +03:00
|
|
|
$this->throwError(404, "Not found", "Language is not found");
|
2025-01-31 18:20:13 +03:00
|
|
|
}
|
2021-12-04 16:06:28 +03:00
|
|
|
header("Content-Type: application/javascript");
|
2022-05-08 13:06:26 +03:00
|
|
|
echo "window.lang = " . json_encode($localizer->export($lang)) . ";"; # привет хардкод :DDD
|
2021-12-04 16:06:28 +03:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2025-01-31 18:20:13 +03:00
|
|
|
public function renderSandbox(): void
|
2020-06-07 19:04:43 +03:00
|
|
|
{
|
2021-09-16 02:50:58 +03:00
|
|
|
$this->template->languages = getLanguages();
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|
2021-12-27 19:35:14 +03:00
|
|
|
|
2025-01-31 18:20:13 +03:00
|
|
|
public function renderRobotsTxt(): void
|
2021-12-27 19:35:14 +03:00
|
|
|
{
|
2021-12-28 06:50:19 +03:00
|
|
|
$text = "# robots.txt file for openvk\n"
|
2021-12-27 19:35:14 +03:00
|
|
|
. "#\n"
|
|
|
|
. "# this includes only those links that are not in any way\n"
|
|
|
|
. "# covered from unauthorized persons (for example, due to\n"
|
|
|
|
. "# lack of rights to access the admin panel)\n\n"
|
|
|
|
. "User-Agent: *\n"
|
2022-08-21 00:01:36 +03:00
|
|
|
. "Disallow: /albums/create\n"
|
2025-01-31 18:20:13 +03:00
|
|
|
. "Disallow: /assets/packages/static/openvk/img/banned.jpg\n"
|
|
|
|
. "Disallow: /assets/packages/static/openvk/img/camera_200.png\n"
|
|
|
|
. "Disallow: /assets/packages/static/openvk/img/flags/\n"
|
|
|
|
. "Disallow: /assets/packages/static/openvk/img/oof.apng\n"
|
2022-08-21 00:01:36 +03:00
|
|
|
. "Disallow: /videos/upload\n"
|
|
|
|
. "Disallow: /invite\n"
|
|
|
|
. "Disallow: /groups_create\n"
|
|
|
|
. "Disallow: /notifications\n"
|
|
|
|
. "Disallow: /settings\n"
|
|
|
|
. "Disallow: /edit\n"
|
|
|
|
. "Disallow: /gifts\n"
|
|
|
|
. "Disallow: /support\n"
|
2021-12-27 19:35:14 +03:00
|
|
|
. "Disallow: /rpc\n"
|
|
|
|
. "Disallow: /language\n"
|
|
|
|
. "Disallow: /badbrowser.php\n"
|
|
|
|
. "Disallow: /logout\n"
|
|
|
|
. "Disallow: /away.php\n"
|
|
|
|
. "Disallow: /im?\n"
|
|
|
|
. "Disallow: *query=\n"
|
|
|
|
. "Disallow: *?lg=\n"
|
|
|
|
. "Disallow: *hash=\n"
|
|
|
|
. "Disallow: *?jReturnTo=\n"
|
|
|
|
. "Disallow: /method/*\n"
|
|
|
|
. "Disallow: /token*";
|
|
|
|
header("Content-Type: text/plain");
|
2021-12-28 06:50:19 +03:00
|
|
|
exit($text);
|
2021-12-27 19:35:14 +03:00
|
|
|
}
|
|
|
|
|
2025-01-31 18:20:13 +03:00
|
|
|
public function renderHumansTxt(): void
|
2021-12-27 19:35:14 +03:00
|
|
|
{
|
2022-05-08 13:06:26 +03:00
|
|
|
# :D
|
2022-08-09 08:52:36 +03:00
|
|
|
$this->redirect("https://github.com/openvk/openvk#readme");
|
2021-12-27 19:35:14 +03:00
|
|
|
}
|
2022-04-18 10:03:44 +03:00
|
|
|
|
2025-01-31 18:20:13 +03:00
|
|
|
public function renderDev(): void
|
2022-04-18 10:03:44 +03:00
|
|
|
{
|
2024-04-19 11:05:24 +03:00
|
|
|
$this->redirect("https://docs.ovk.to/");
|
2022-04-18 10:03:44 +03:00
|
|
|
}
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|