diff --git a/Web/Models/Entities/Post.php b/Web/Models/Entities/Post.php index 2d323a8e..8c38c567 100644 --- a/Web/Models/Entities/Post.php +++ b/Web/Models/Entities/Post.php @@ -254,6 +254,9 @@ class Post extends Postable if($this->isDeactivationMessage() || $this->isUpdateAvatarMessage()) return false; + if($this->getTargetWall() > 0) + return $this->getPublicationTime()->timestamp() + WEEK > time(); + return $user->getId() == $this->getOwner(false)->getId(); } diff --git a/Web/Presenters/templates/Photos/UploadPhoto.xml b/Web/Presenters/templates/Photos/UploadPhoto.xml index 16b03262..ab81d3aa 100644 --- a/Web/Presenters/templates/Photos/UploadPhoto.xml +++ b/Web/Presenters/templates/Photos/UploadPhoto.xml @@ -2,9 +2,13 @@ {block title}{_upload_photo}{/block} {block header} - {$thisUser->getCanonicalName()} + {$album->getOwner()->getCanonicalName()} » - {_albums} + {if $album->getOwner() instanceof openvk\Web\Models\Entities\Club} + {_albums} + {else} + {_albums} + {/if} » {$album->getName()} » diff --git a/Web/static/js/al_photos.js b/Web/static/js/al_photos.js index 41bf729b..b4632d60 100644 --- a/Web/static/js/al_photos.js +++ b/Web/static/js/al_photos.js @@ -6,6 +6,18 @@ $(document).on("change", "#uploadButton", (e) => { return; } + for(const file of e.currentTarget.files) { + if(!file.type.startsWith('image/')) { + MessageBox(tr("error"), tr("only_images_accepted", escapeHtml(file.name)), [tr("ok")], [() => {Function.noop}]) + return; + } + + if(file.size > 5 * 1024 * 1024) { + MessageBox(tr("error"), tr("max_filesize", 5), [tr("ok")], [() => {Function.noop}]) + return; + } + } + if(document.querySelector(".whiteBox").style.display == "block") { document.querySelector(".whiteBox").style.display = "none" document.querySelector(".insertThere").append(document.getElementById("fakeButton")); @@ -177,3 +189,10 @@ $(".container_gray").on("drop", (e) => { document.getElementById("uploadButton").files = files u("#uploadButton").trigger("change") }) + +u(".container_gray").on("paste", (e) => { + if(e.clipboardData.files.length > 0 && e.clipboardData.files.length < 10) { + document.getElementById("uploadButton").files = e.clipboardData.files; + u("#uploadButton").trigger("change") + } +})