2020-06-07 19:04:43 +03:00
|
|
|
<?php declare(strict_types=1);
|
|
|
|
namespace openvk\Web\Presenters;
|
2020-06-16 17:15:36 +03:00
|
|
|
use openvk\Web\Themes\Themepacks;
|
2020-06-07 19:04:43 +03:00
|
|
|
use openvk\Web\Models\Repositories\{Users, Managers};
|
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;
|
|
|
|
|
|
|
|
function renderIndex(): void
|
|
|
|
{
|
|
|
|
if(!is_null($this->user)) {
|
|
|
|
header("HTTP/1.1 302 Found");
|
|
|
|
header("Location: /id" . $this->user->id);
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2020-07-13 09:16:52 +03:00
|
|
|
if($_SERVER['REQUEST_URI'] == "/id0") {
|
|
|
|
header("HTTP/1.1 302 Found");
|
|
|
|
header("Location: /");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2020-06-07 19:04:43 +03:00
|
|
|
$this->template->stats = (new Users)->getStatistics();
|
|
|
|
}
|
|
|
|
|
|
|
|
function renderRules(): void
|
|
|
|
{
|
2020-06-16 15:38:32 +03:00
|
|
|
$this->pass("openvk!Support->knowledgeBaseArticle", "rules");
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function renderHelp(): void
|
|
|
|
{}
|
|
|
|
|
|
|
|
function renderBB(): void
|
|
|
|
{}
|
|
|
|
|
|
|
|
function renderInvite(): void
|
2021-09-13 06:22:05 +03:00
|
|
|
{
|
|
|
|
$this->assertUserLoggedIn();
|
|
|
|
}
|
2020-06-07 19:04:43 +03:00
|
|
|
|
|
|
|
function renderDonate(): void
|
2020-07-17 20:56:33 +03:00
|
|
|
{
|
|
|
|
$this->pass("openvk!Support->knowledgeBaseArticle", "donate");
|
|
|
|
}
|
2020-06-07 19:04:43 +03:00
|
|
|
|
|
|
|
function renderPrivacy(): void
|
2020-06-16 15:38:32 +03:00
|
|
|
{
|
|
|
|
$this->pass("openvk!Support->knowledgeBaseArticle", "privacy");
|
|
|
|
}
|
2020-06-07 19:04:43 +03:00
|
|
|
|
|
|
|
function renderVersion(): void
|
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|
|
|
|
function renderLanguage(): void
|
|
|
|
{
|
2021-09-16 02:50:58 +03:00
|
|
|
$this->template->languages = getLanguages();
|
|
|
|
|
2020-06-07 19:04:43 +03:00
|
|
|
if(!is_null($_GET['lg'])){
|
2021-09-16 02:50:58 +03:00
|
|
|
setLanguage($_GET['lg']);
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-04 16:06:28 +03:00
|
|
|
function renderExportJSLanguage($lg = NULL): void
|
|
|
|
{
|
|
|
|
$localizer = Localizator::i();
|
|
|
|
$lang = $lg;
|
|
|
|
if(is_null($lg))
|
|
|
|
$this->throwError(404, "Not found", "Language is not found");
|
|
|
|
header("Content-Type: application/javascript");
|
|
|
|
echo "window.lang = " . json_encode($localizer->export($lang)) . ";"; // привет хардкод :DDD
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2020-06-07 19:04:43 +03:00
|
|
|
function renderSandbox(): void
|
|
|
|
{
|
2021-09-16 02:50:58 +03:00
|
|
|
$this->template->languages = getLanguages();
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|
|
|
|
}
|