mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +03:00
Use redirect() instead of header("Location: ...")
This commit is contained in:
parent
26d5553ca0
commit
200414b67d
13 changed files with 52 additions and 87 deletions
|
@ -14,20 +14,14 @@ final class AboutPresenter extends OpenVKPresenter
|
||||||
function renderIndex(): void
|
function renderIndex(): void
|
||||||
{
|
{
|
||||||
if(!is_null($this->user)) {
|
if(!is_null($this->user)) {
|
||||||
header("HTTP/1.1 302 Found");
|
|
||||||
|
|
||||||
if($this->user->identity->getMainPage())
|
if($this->user->identity->getMainPage())
|
||||||
header("Location: /feed");
|
$this->redirect("/feed");
|
||||||
else
|
else
|
||||||
header("Location: /id" . $this->user->id);
|
$this->redirect($this->user->identity->getURL());
|
||||||
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_SERVER['REQUEST_URI'] == "/id0") {
|
if($_SERVER['REQUEST_URI'] == "/id0") {
|
||||||
header("HTTP/1.1 302 Found");
|
$this->redirect("/");
|
||||||
header("Location: /");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->template->stats = (new Users)->getStatistics();
|
$this->template->stats = (new Users)->getStatistics();
|
||||||
|
@ -127,16 +121,11 @@ final class AboutPresenter extends OpenVKPresenter
|
||||||
function renderHumansTxt(): void
|
function renderHumansTxt(): void
|
||||||
{
|
{
|
||||||
# :D
|
# :D
|
||||||
|
$this->redirect("https://github.com/openvk/openvk#readme");
|
||||||
header("HTTP/1.1 302 Found");
|
|
||||||
header("Location: https://github.com/openvk/openvk#readme");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderDev(): void
|
function renderDev(): void
|
||||||
{
|
{
|
||||||
header("HTTP/1.1 302 Found");
|
$this->redirect("https://docs.openvk.su/");
|
||||||
header("Location: https://docs.openvk.su/");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,8 +170,7 @@ final class AdminPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
$voucher->save();
|
$voucher->save();
|
||||||
|
|
||||||
$this->redirect("/admin/vouchers/id" . $voucher->getId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/admin/vouchers/id" . $voucher->getId());
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderGiftCategories(): void
|
function renderGiftCategories(): void
|
||||||
|
@ -193,7 +192,7 @@ final class AdminPresenter extends OpenVKPresenter
|
||||||
if(!$cat)
|
if(!$cat)
|
||||||
$this->notFound();
|
$this->notFound();
|
||||||
else if($cat->getSlug() !== $slug)
|
else if($cat->getSlug() !== $slug)
|
||||||
$this->redirect("/admin/gifts/" . $cat->getSlug() . "." . $id . ".meta", static::REDIRECT_TEMPORARY);
|
$this->redirect("/admin/gifts/" . $cat->getSlug() . "." . $id . ".meta");
|
||||||
} else {
|
} else {
|
||||||
$gen = true;
|
$gen = true;
|
||||||
$cat = new GiftCategory;
|
$cat = new GiftCategory;
|
||||||
|
@ -234,7 +233,7 @@ final class AdminPresenter extends OpenVKPresenter
|
||||||
$cat->setDescription($code, $this->postParam("description_$code"));
|
$cat->setDescription($code, $this->postParam("description_$code"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->redirect("/admin/gifts/" . $cat->getSlug() . "." . $cat->getId() . ".meta", static::REDIRECT_TEMPORARY);
|
$this->redirect("/admin/gifts/" . $cat->getSlug() . "." . $cat->getId() . ".meta");
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderGifts(string $catSlug, int $catId): void
|
function renderGifts(string $catSlug, int $catId): void
|
||||||
|
@ -245,7 +244,7 @@ final class AdminPresenter extends OpenVKPresenter
|
||||||
if(!$cat)
|
if(!$cat)
|
||||||
$this->notFound();
|
$this->notFound();
|
||||||
else if($cat->getSlug() !== $catSlug)
|
else if($cat->getSlug() !== $catSlug)
|
||||||
$this->redirect("/admin/gifts/" . $cat->getSlug() . "." . $catId . "/", static::REDIRECT_TEMPORARY);
|
$this->redirect("/admin/gifts/" . $cat->getSlug() . "." . $catId . "/");
|
||||||
|
|
||||||
$this->template->cat = $cat;
|
$this->template->cat = $cat;
|
||||||
$this->template->gifts = iterator_to_array($cat->getGifts((int) ($this->queryParam("p") ?? 1), NULL, $this->template->count));
|
$this->template->gifts = iterator_to_array($cat->getGifts((int) ($this->queryParam("p") ?? 1), NULL, $this->template->count));
|
||||||
|
@ -284,7 +283,7 @@ final class AdminPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
$name = $catTo->getName();
|
$name = $catTo->getName();
|
||||||
$this->flash("succ", "Gift moved successfully", "This gift will now be in <b>$name</b>.");
|
$this->flash("succ", "Gift moved successfully", "This gift will now be in <b>$name</b>.");
|
||||||
$this->redirect("/admin/gifts/" . $catTo->getSlug() . "." . $catTo->getId() . "/", static::REDIRECT_TEMPORARY);
|
$this->redirect("/admin/gifts/" . $catTo->getSlug() . "." . $catTo->getId() . "/");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case "edit":
|
case "edit":
|
||||||
|
@ -328,7 +327,7 @@ final class AdminPresenter extends OpenVKPresenter
|
||||||
$cat->addGift($gift);
|
$cat->addGift($gift);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->redirect("/admin/gifts/id" . $gift->getId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/admin/gifts/id" . $gift->getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
function renderRegister(): void
|
function renderRegister(): void
|
||||||
{
|
{
|
||||||
if(!is_null($this->user))
|
if(!is_null($this->user))
|
||||||
$this->redirect("/id" . $this->user->id, static::REDIRECT_TEMPORARY);
|
$this->redirect($this->user->identity->getURL());
|
||||||
|
|
||||||
if(!$this->hasPermission("user", "register", -1)) exit("Вас забанили");
|
if(!$this->hasPermission("user", "register", -1)) exit("Вас забанили");
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->authenticator->authenticate($chUser->getId());
|
$this->authenticator->authenticate($chUser->getId());
|
||||||
$this->redirect("/id" . $user->getId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/id" . $user->getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,12 +138,11 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
$redirUrl = $this->requestParam("jReturnTo");
|
$redirUrl = $this->requestParam("jReturnTo");
|
||||||
|
|
||||||
if(!is_null($this->user))
|
if(!is_null($this->user))
|
||||||
$this->redirect($redirUrl ?? "/id" . $this->user->id, static::REDIRECT_TEMPORARY);
|
$this->redirect($redirUrl ?? $this->user->identity->getURL());
|
||||||
|
|
||||||
if(!$this->hasPermission("user", "login", -1)) exit("Вас забанили");
|
if(!$this->hasPermission("user", "login", -1)) exit("Вас забанили");
|
||||||
|
|
||||||
if($_SERVER["REQUEST_METHOD"] === "POST") {
|
if($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
|
||||||
$user = $this->db->table("ChandlerUsers")->where("login", $this->postParam("login"))->fetch();
|
$user = $this->db->table("ChandlerUsers")->where("login", $this->postParam("login"))->fetch();
|
||||||
if(!$user)
|
if(!$user)
|
||||||
$this->flashFail("err", tr("login_failed"), tr("invalid_username_or_password"));
|
$this->flashFail("err", tr("login_failed"), tr("invalid_username_or_password"));
|
||||||
|
@ -172,8 +171,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->authenticator->authenticate($user->id);
|
$this->authenticator->authenticate($user->id);
|
||||||
$this->redirect($redirUrl ?? "/id" . $user->related("profiles.user")->fetch()->id, static::REDIRECT_TEMPORARY);
|
$this->redirect($redirUrl ?? $ovkUser->getURL());
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +182,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
if($uuid === "unset") {
|
if($uuid === "unset") {
|
||||||
Session::i()->set("_su", NULL);
|
Session::i()->set("_su", NULL);
|
||||||
$this->redirect("/", static::REDIRECT_TEMPORARY);
|
$this->redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->db->table("ChandlerUsers")->where("id", $uuid))
|
if(!$this->db->table("ChandlerUsers")->where("id", $uuid))
|
||||||
|
@ -193,8 +191,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
$this->assertPermission('openvk\Web\Models\Entities\User', 'substitute', 0);
|
$this->assertPermission('openvk\Web\Models\Entities\User', 'substitute', 0);
|
||||||
Session::i()->set("_su", $uuid);
|
Session::i()->set("_su", $uuid);
|
||||||
$this->flash("succ", tr("profile_changed"), tr("profile_changed_comment"));
|
$this->flash("succ", tr("profile_changed"), tr("profile_changed_comment"));
|
||||||
$this->redirect("/", static::REDIRECT_TEMPORARY);
|
$this->redirect("/");
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderLogout(): void
|
function renderLogout(): void
|
||||||
|
@ -204,7 +201,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
$this->authenticator->logout();
|
$this->authenticator->logout();
|
||||||
Session::i()->set("_su", NULL);
|
Session::i()->set("_su", NULL);
|
||||||
|
|
||||||
$this->redirect("/", static::REDIRECT_TEMPORARY_PRESISTENT);
|
$this->redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderFinishRestoringPassword(): void
|
function renderFinishRestoringPassword(): void
|
||||||
|
@ -244,7 +241,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
function renderRestore(): void
|
function renderRestore(): void
|
||||||
{
|
{
|
||||||
if(!is_null($this->user))
|
if(!is_null($this->user))
|
||||||
$this->redirect("/id" . $this->user->id, static::REDIRECT_TEMPORARY);
|
$this->redirect($this->user->identity->getURL());
|
||||||
|
|
||||||
if(($this->queryParam("act") ?? "default") === "finish")
|
if(($this->queryParam("act") ?? "default") === "finish")
|
||||||
$this->pass("openvk!Auth->finishRestoringPassword");
|
$this->pass("openvk!Auth->finishRestoringPassword");
|
||||||
|
@ -274,7 +271,6 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
];
|
];
|
||||||
$this->sendmail($uRow->login, "password-reset", $params); #Vulnerability possible
|
$this->sendmail($uRow->login, "password-reset", $params); #Vulnerability possible
|
||||||
|
|
||||||
|
|
||||||
$this->flashFail("succ", tr("information_-1"), tr("password_reset_email_sent"));
|
$this->flashFail("succ", tr("information_-1"), tr("password_reset_email_sent"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,7 +278,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
function renderResendEmail(): void
|
function renderResendEmail(): void
|
||||||
{
|
{
|
||||||
if(!is_null($this->user) && $this->user->identity->isActivated())
|
if(!is_null($this->user) && $this->user->identity->isActivated())
|
||||||
$this->redirect("/id" . $this->user->id, static::REDIRECT_TEMPORARY);
|
$this->redirect($this->user->identity->getURL());
|
||||||
|
|
||||||
if($_SERVER["REQUEST_METHOD"] === "POST") {
|
if($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
$user = $this->user->identity;
|
$user = $this->user->identity;
|
||||||
|
@ -330,6 +326,6 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
$this->user->identity->reactivate();
|
$this->user->identity->reactivate();
|
||||||
|
|
||||||
$this->redirect("/", 2);
|
$this->redirect("/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ final class CommentPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
if(!is_null($this->user)) $comment->toggleLike($this->user->identity);
|
if(!is_null($this->user)) $comment->toggleLike($this->user->identity);
|
||||||
|
|
||||||
$this->redirect($_SERVER["HTTP_REFERER"], static::REDIRECT_TEMPORARY);
|
$this->redirect($_SERVER["HTTP_REFERER"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderMakeComment(string $repo, int $eId): void
|
function renderMakeComment(string $repo, int $eId): void
|
||||||
|
|
|
@ -91,7 +91,7 @@ final class GiftsPresenter extends OpenVKPresenter
|
||||||
$gift->used();
|
$gift->used();
|
||||||
|
|
||||||
$this->flash("succ", "Подарок отправлен", "Вы отправили подарок <b>" . $user->getFirstName() . "</b> за " . $gift->getPrice() . " голосов.");
|
$this->flash("succ", "Подарок отправлен", "Вы отправили подарок <b>" . $user->getFirstName() . "</b> за " . $gift->getPrice() . " голосов.");
|
||||||
$this->redirect($user->getURL(), static::REDIRECT_TEMPORARY);
|
$this->redirect($user->getURL());
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderStub(): void
|
function renderStub(): void
|
||||||
|
|
|
@ -54,8 +54,7 @@ final class GroupPresenter extends OpenVKPresenter
|
||||||
}
|
}
|
||||||
|
|
||||||
$club->toggleSubscription($this->user->identity);
|
$club->toggleSubscription($this->user->identity);
|
||||||
header("HTTP/1.1 302 Found");
|
$this->redirect("/club" . $club->getId());
|
||||||
header("Location: /club" . $club->getId());
|
|
||||||
}else{
|
}else{
|
||||||
$this->flashFail("err", "Ошибка", "Вы не ввели название группы.");
|
$this->flashFail("err", "Ошибка", "Вы не ввели название группы.");
|
||||||
}
|
}
|
||||||
|
@ -74,9 +73,7 @@ final class GroupPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
$club->toggleSubscription($this->user->identity);
|
$club->toggleSubscription($this->user->identity);
|
||||||
|
|
||||||
header("HTTP/1.1 302 Found");
|
$this->redirect($club->getURL());
|
||||||
header("Location: /club" . $club->getId());
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderFollowers(int $id): void
|
function renderFollowers(int $id): void
|
||||||
|
|
|
@ -61,9 +61,7 @@ abstract class OpenVKPresenter extends SimplePresenter
|
||||||
$this->flash($type, $title, $message, $code);
|
$this->flash($type, $title, $message, $code);
|
||||||
$referer = $_SERVER["HTTP_REFERER"] ?? "/";
|
$referer = $_SERVER["HTTP_REFERER"] ?? "/";
|
||||||
|
|
||||||
header("HTTP/1.1 302 Found");
|
$this->redirect($referer);
|
||||||
header("Location: $referer");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,9 +97,8 @@ abstract class OpenVKPresenter extends SimplePresenter
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->flash("err", tr("login_required_error"), tr("login_required_error_comment"));
|
$this->flash("err", tr("login_required_error"), tr("login_required_error_comment"));
|
||||||
header("HTTP/1.1 302 Found");
|
|
||||||
header("Location: $loginUrl");
|
$this->redirect($loginUrl);
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,9 +108,7 @@ abstract class OpenVKPresenter extends SimplePresenter
|
||||||
if($model !== "user") {
|
if($model !== "user") {
|
||||||
$this->flash("info", tr("login_required_error"), tr("login_required_error_comment"));
|
$this->flash("info", tr("login_required_error"), tr("login_required_error_comment"));
|
||||||
|
|
||||||
header("HTTP/1.1 302 Found");
|
$this->redirect("/login");
|
||||||
header("Location: /login");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ($action === "register" || $action === "login");
|
return ($action === "register" || $action === "login");
|
||||||
|
@ -227,7 +222,7 @@ abstract class OpenVKPresenter extends SimplePresenter
|
||||||
Authenticator::i()->logout();
|
Authenticator::i()->logout();
|
||||||
Session::i()->set("_su", NULL);
|
Session::i()->set("_su", NULL);
|
||||||
$this->flashFail("err", tr("error"), tr("profile_not_found"));
|
$this->flashFail("err", tr("error"), tr("profile_not_found"));
|
||||||
$this->redirect("/", static::REDIRECT_TEMPORARY);
|
$this->redirect("/");
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,9 +83,9 @@ final class PhotosPresenter extends OpenVKPresenter
|
||||||
$album->save();
|
$album->save();
|
||||||
|
|
||||||
if(isset($club))
|
if(isset($club))
|
||||||
$this->redirect("/album-" . $album->getOwner()->getId() . "_" . $album->getId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/album-" . $album->getOwner()->getId() . "_" . $album->getId());
|
||||||
else
|
else
|
||||||
$this->redirect("/album" . $album->getOwner()->getId() . "_" . $album->getId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/album" . $album->getOwner()->getId() . "_" . $album->getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ final class PhotosPresenter extends OpenVKPresenter
|
||||||
$photo->save();
|
$photo->save();
|
||||||
|
|
||||||
$this->flash("succ", "Изменения сохранены", "Обновлённое описание появится на странице с фоткой.");
|
$this->flash("succ", "Изменения сохранены", "Обновлённое описание появится на странице с фоткой.");
|
||||||
$this->redirect("/photo" . $photo->getPrettyId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/photo" . $photo->getPrettyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->template->photo = $photo;
|
$this->template->photo = $photo;
|
||||||
|
@ -245,7 +245,7 @@ final class PhotosPresenter extends OpenVKPresenter
|
||||||
$album->setEdited(time());
|
$album->setEdited(time());
|
||||||
$album->save();
|
$album->save();
|
||||||
|
|
||||||
$this->redirect("/photo" . $photo->getPrettyId() . "?from=album" . $album->getId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/photo" . $photo->getPrettyId() . "?from=album" . $album->getId());
|
||||||
} else {
|
} else {
|
||||||
$this->template->album = $album;
|
$this->template->album = $album;
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ final class PhotosPresenter extends OpenVKPresenter
|
||||||
$album->save();
|
$album->save();
|
||||||
|
|
||||||
$this->flash("succ", "Фотография удалена", "Эта фотография была успешно удалена.");
|
$this->flash("succ", "Фотография удалена", "Эта фотография была успешно удалена.");
|
||||||
$this->redirect("/album" . $album->getPrettyId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/album" . $album->getPrettyId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,6 +289,6 @@ final class PhotosPresenter extends OpenVKPresenter
|
||||||
$photo->delete();
|
$photo->delete();
|
||||||
|
|
||||||
$this->flash("succ", "Фотография удалена", "Эта фотография была успешно удалена.");
|
$this->flash("succ", "Фотография удалена", "Эта фотография была успешно удалена.");
|
||||||
$this->redirect("/id0", static::REDIRECT_TEMPORARY);
|
$this->redirect("/id0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,8 +100,7 @@ final class SupportPresenter extends OpenVKPresenter
|
||||||
Telegram::send($helpdeskChat, $telegramText);
|
Telegram::send($helpdeskChat, $telegramText);
|
||||||
}
|
}
|
||||||
|
|
||||||
header("HTTP/1.1 302 Found");
|
$this->redirect("/support/view/" . $ticket->getId());
|
||||||
header("Location: /support/view/" . $ticket->getId());
|
|
||||||
} else {
|
} else {
|
||||||
$this->flashFail("err", tr("error"), tr("you_have_not_entered_name_or_text"));
|
$this->flashFail("err", tr("error"), tr("you_have_not_entered_name_or_text"));
|
||||||
}
|
}
|
||||||
|
@ -192,8 +191,7 @@ final class SupportPresenter extends OpenVKPresenter
|
||||||
$comment->setCreated(time());
|
$comment->setCreated(time());
|
||||||
$comment->save();
|
$comment->save();
|
||||||
|
|
||||||
header("HTTP/1.1 302 Found");
|
$this->redirect("/support/view/" . $id);
|
||||||
header("Location: /support/view/" . $id);
|
|
||||||
} else {
|
} else {
|
||||||
$this->flashFail("err", tr("error"), tr("you_have_not_entered_text"));
|
$this->flashFail("err", tr("error"), tr("you_have_not_entered_text"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ final class TopicsPresenter extends OpenVKPresenter
|
||||||
}
|
}
|
||||||
} catch(ISE $ex) {
|
} catch(ISE $ex) {
|
||||||
$this->flash("err", "Не удалось опубликовать комментарий", "Файл медиаконтента повреждён или слишком велик.");
|
$this->flash("err", "Не удалось опубликовать комментарий", "Файл медиаконтента повреждён или слишком велик.");
|
||||||
$this->redirect("/topic" . $topic->getPrettyId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/topic" . $topic->getPrettyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($this->postParam("text")) || $photo || $video) {
|
if(!empty($this->postParam("text")) || $photo || $video) {
|
||||||
|
@ -123,7 +123,7 @@ final class TopicsPresenter extends OpenVKPresenter
|
||||||
$comment->save();
|
$comment->save();
|
||||||
} catch (\LengthException $ex) {
|
} catch (\LengthException $ex) {
|
||||||
$this->flash("err", "Не удалось опубликовать комментарий", "Комментарий слишком большой.");
|
$this->flash("err", "Не удалось опубликовать комментарий", "Комментарий слишком большой.");
|
||||||
$this->redirect("/topic" . $topic->getPrettyId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/topic" . $topic->getPrettyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_null($photo))
|
if(!is_null($photo))
|
||||||
|
@ -133,7 +133,7 @@ final class TopicsPresenter extends OpenVKPresenter
|
||||||
$comment->attach($video);
|
$comment->attach($video);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->redirect("/topic" . $topic->getPrettyId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/topic" . $topic->getPrettyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->template->club = $club;
|
$this->template->club = $club;
|
||||||
|
@ -167,7 +167,7 @@ final class TopicsPresenter extends OpenVKPresenter
|
||||||
$topic->save();
|
$topic->save();
|
||||||
|
|
||||||
$this->flash("succ", tr("changes_saved"), tr("topic_changes_saved_comment"));
|
$this->flash("succ", tr("changes_saved"), tr("topic_changes_saved_comment"));
|
||||||
$this->redirect("/topic" . $topic->getPrettyId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/topic" . $topic->getPrettyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->template->topic = $topic;
|
$this->template->topic = $topic;
|
||||||
|
@ -189,6 +189,6 @@ final class TopicsPresenter extends OpenVKPresenter
|
||||||
$this->willExecuteWriteAction();
|
$this->willExecuteWriteAction();
|
||||||
$topic->deleteTopic();
|
$topic->deleteTopic();
|
||||||
|
|
||||||
$this->redirect("/board" . $topic->getClub()->getId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/board" . $topic->getClub()->getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ final class UserPresenter extends OpenVKPresenter
|
||||||
$name = $user->getFullName();
|
$name = $user->getFullName();
|
||||||
$this->flash("err", "Ошибка доступа", "Вы не можете просматривать полный список подписок $name.");
|
$this->flash("err", "Ошибка доступа", "Вы не можете просматривать полный список подписок $name.");
|
||||||
|
|
||||||
$this->redirect("/id$id", static::REDIRECT_TEMPORARY_PRESISTENT);
|
$this->redirect($user->getURL());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ final class UserPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
$user->toggleSubscription($this->user->identity);
|
$user->toggleSubscription($this->user->identity);
|
||||||
|
|
||||||
$this->redirect("/id" . $user->getId());
|
$this->redirect($user->getURL());
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderSetAvatar(): void
|
function renderSetAvatar(): void
|
||||||
|
@ -587,7 +587,7 @@ final class UserPresenter extends OpenVKPresenter
|
||||||
$this->user->identity->save();
|
$this->user->identity->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->redirect("/", static::REDIRECT_TEMPORARY_PRESISTENT);
|
$this->redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderCoinsTransfer(): void
|
function renderCoinsTransfer(): void
|
||||||
|
|
|
@ -80,7 +80,7 @@ final class VideosPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
$video->save();
|
$video->save();
|
||||||
|
|
||||||
$this->redirect("/video" . $video->getPrettyId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/video" . $video->getPrettyId());
|
||||||
} else {
|
} else {
|
||||||
$this->flashFail("err", "Произошла ошибка", "Видео не может быть опубликовано без названия.");
|
$this->flashFail("err", "Произошла ошибка", "Видео не может быть опубликовано без названия.");
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ final class VideosPresenter extends OpenVKPresenter
|
||||||
$video->save();
|
$video->save();
|
||||||
|
|
||||||
$this->flash("succ", "Изменения сохранены", "Обновлённое описание появится на странице с видосиком.");
|
$this->flash("succ", "Изменения сохранены", "Обновлённое описание появится на странице с видосиком.");
|
||||||
$this->redirect("/video" . $video->getPrettyId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/video" . $video->getPrettyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->template->video = $video;
|
$this->template->video = $video;
|
||||||
|
@ -128,7 +128,6 @@ final class VideosPresenter extends OpenVKPresenter
|
||||||
$this->flashFail("err", "Не удалось удалить пост", "Вы не вошли в аккаунт.");
|
$this->flashFail("err", "Не удалось удалить пост", "Вы не вошли в аккаунт.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->redirect("/videos".$owner, static::REDIRECT_TEMPORARY);
|
$this->redirect("/videos" . $owner);
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,11 +294,7 @@ final class WallPresenter extends OpenVKPresenter
|
||||||
if($wall > 0 && $wall !== $this->user->identity->getId())
|
if($wall > 0 && $wall !== $this->user->identity->getId())
|
||||||
(new WallPostNotification($wallOwner, $post, $this->user->identity))->emit();
|
(new WallPostNotification($wallOwner, $post, $this->user->identity))->emit();
|
||||||
|
|
||||||
if($wall > 0)
|
$this->redirect($wallOwner->getURL());
|
||||||
$this->redirect("/id$wall", 2); #Will exit
|
|
||||||
|
|
||||||
$wall = $wall * -1;
|
|
||||||
$this->redirect("/club$wall", 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderPost(int $wall, int $post_id): void
|
function renderPost(int $wall, int $post_id): void
|
||||||
|
@ -337,10 +333,7 @@ final class WallPresenter extends OpenVKPresenter
|
||||||
$post->toggleLike($this->user->identity);
|
$post->toggleLike($this->user->identity);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->redirect(
|
$this->redirect("$_SERVER[HTTP_REFERER]#postGarter=" . $post->getId());
|
||||||
"$_SERVER[HTTP_REFERER]#postGarter=" . $post->getId(),
|
|
||||||
static::REDIRECT_TEMPORARY
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderShare(int $wall, int $post_id): void
|
function renderShare(int $wall, int $post_id): void
|
||||||
|
@ -392,8 +385,7 @@ final class WallPresenter extends OpenVKPresenter
|
||||||
$this->flashFail("err", tr("failed_to_delete_post"), tr("login_required_error_comment"));
|
$this->flashFail("err", tr("failed_to_delete_post"), tr("login_required_error_comment"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->redirect($wall < 0 ? "/club".($wall*-1) : "/id".$wall, static::REDIRECT_TEMPORARY);
|
$this->redirect($wall < 0 ? "/club" . ($wall*-1) : "/id" . $wall);
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderPin(int $wall, int $post_id): void
|
function renderPin(int $wall, int $post_id): void
|
||||||
|
|
Loading…
Reference in a new issue