From 7fc19ff5e74db6201454dcfdb707a33a5e819af5 Mon Sep 17 00:00:00 2001 From: veselcraft Date: Mon, 9 May 2022 15:13:05 +0300 Subject: [PATCH] Global: Cancel changed from past commits that was created by accident --- Web/Presenters/WallPresenter.php | 39 +++++----- .../components/post/microblogpost.xml | 2 +- .../templates/components/textArea.xml | 8 +- Web/static/css/style.css | 77 ------------------- Web/static/js/al_wall.js | 59 ++------------ 5 files changed, 33 insertions(+), 152 deletions(-) diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php index 79aaafb6..b61f28ae 100644 --- a/Web/Presenters/WallPresenter.php +++ b/Web/Presenters/WallPresenter.php @@ -248,27 +248,24 @@ final class WallPresenter extends OpenVKPresenter if($this->postParam("force_sign") === "on") $flags |= 0b01000000; - $photos = []; - $_FILES["_pic_attachment"] = null; - foreach($_FILES as $file) { - bdump($file); - try { - if($file["error"] === UPLOAD_ERR_OK && preg_match('/^image\//', $file['type'])) { - $album = NULL; - if(!$anon && $wall > 0 && $wall === $this->user->id) - $album = (new Albums)->getUserWallAlbum($wallOwner); - - $photos[] = Photo::fastMake($this->user->id, $this->postParam("text"), $file, $album, $anon); - } - } catch(\DomainException $ex) { - $this->flashFail("err", tr("failed_to_publish_post"), tr("media_file_corrupted")); - } catch(ISE $ex) { - $this->flashFail("err", tr("failed_to_publish_post"), tr("media_file_corrupted_or_too_large")); - } + try { + $photo = NULL; + $video = NULL; + if($_FILES["_pic_attachment"]["error"] === UPLOAD_ERR_OK) { + $album = NULL; + if(!$anon && $wall > 0 && $wall === $this->user->id) + $album = (new Albums)->getUserWallAlbum($wallOwner); + + $photo = Photo::fastMake($this->user->id, $this->postParam("text"), $_FILES["_pic_attachment"], $album, $anon); + } if($_FILES["_vid_attachment"]["error"] === UPLOAD_ERR_OK) { $video = Video::fastMake($this->user->id, $this->postParam("text"), $_FILES["_vid_attachment"], $anon); } + } catch(\DomainException $ex) { + $this->flashFail("err", tr("failed_to_publish_post"), tr("media_file_corrupted")); + } catch(ISE $ex) { + $this->flashFail("err", tr("failed_to_publish_post"), tr("media_file_corrupted_or_too_large")); } if(empty($this->postParam("text")) && !$photo && !$video) @@ -288,9 +285,11 @@ final class WallPresenter extends OpenVKPresenter $this->flashFail("err", tr("failed_to_publish_post"), tr("post_is_too_big")); } - foreach($photos as $photo) { - $post->attach($photo); - } + if(!is_null($photo)) + $post->attach($photo); + + if(!is_null($video)) + $post->attach($video); if($wall > 0 && $wall !== $this->user->identity->getId()) (new WallPostNotification($wallOwner, $post, $this->user->identity))->emit(); diff --git a/Web/Presenters/templates/components/post/microblogpost.xml b/Web/Presenters/templates/components/post/microblogpost.xml index c06e54e9..249dee45 100644 --- a/Web/Presenters/templates/components/post/microblogpost.xml +++ b/Web/Presenters/templates/components/post/microblogpost.xml @@ -7,7 +7,7 @@ -
+ {_online} diff --git a/Web/Presenters/templates/components/textArea.xml b/Web/Presenters/templates/components/textArea.xml index fc0cd97d..9d81ac6d 100644 --- a/Web/Presenters/templates/components/textArea.xml +++ b/Web/Presenters/templates/components/textArea.xml @@ -8,8 +8,8 @@