mirror of
https://github.com/openvk/openvk
synced 2025-07-05 15:29:57 +03:00
Compare commits
4 commits
d7519d46e3
...
396780f602
Author | SHA1 | Date | |
---|---|---|---|
|
396780f602 | ||
|
b90a0fa013 | ||
|
60ed57a7f6 | ||
|
cafd8d2718 |
5 changed files with 32 additions and 18 deletions
|
@ -60,6 +60,11 @@ abstract class MediaCollection extends RowModel
|
|||
}
|
||||
}
|
||||
|
||||
public function getOwnerId(): int
|
||||
{
|
||||
return (int) $this->getRecord()->owner;
|
||||
}
|
||||
|
||||
public function getPrettyId(): string
|
||||
{
|
||||
return $this->getRecord()->owner . "_" . $this->getRecord()->id;
|
||||
|
|
|
@ -284,13 +284,15 @@ final class PhotosPresenter extends OpenVKPresenter
|
|||
}
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "GET" || $this->queryParam("act") == "finish") {
|
||||
if (!$album) {
|
||||
if (!$album || $album->isCreatedBySystem()) {
|
||||
$this->flashFail("err", tr("error"), tr("error_adding_to_deleted"));
|
||||
}
|
||||
}
|
||||
|
||||
if ($album && !$album->canBeModifiedBy($this->user->identity)) {
|
||||
$this->flashFail("err", tr("error_access_denied_short"), tr("error_access_denied"));
|
||||
if ($album->getOwnerId() != $this->user->id) {
|
||||
$this->flashFail("err", tr("error_access_denied_short"), tr("error_access_denied"));
|
||||
}
|
||||
}
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
|
|
|
@ -129,13 +129,15 @@
|
|||
{var $avatarLink = ((is_null($avatarPhoto) ? FALSE : $avatarPhoto->isAnonymous()) ? "/photo" . ("s/" . base_convert((string) $avatarPhoto->getId(), 10, 32)) : $club->getAvatarLink())}
|
||||
<div class="avatar_block" style="position:relative;" data-club="{$club->getId()}">
|
||||
{if $thisUser && $club->canBeModifiedBy($thisUser)}
|
||||
<a {if $avatarPhoto}style="display:none"{/if} class="add_image_text" id="add_image">{_add_image}</a>
|
||||
<div {if !$avatarPhoto}style="display:none"{/if} class="avatar_controls">
|
||||
<div class="avatarDelete hoverable"></div>
|
||||
<div class="avatar_variants">
|
||||
<a class="_add_image hoverable" id="add_image"><span>{_upload_new_picture}</span></a>
|
||||
</div>
|
||||
<div class="avatar_controls">
|
||||
<div {if !$hasAvatar}style="display:none"{/if} class="avatarDelete hoverable"></div>
|
||||
<div class="avatar_variants">
|
||||
<a {if $hasAvatar}style="display:none"{/if} class="_add_image hoverable upload_image" id="add_image">
|
||||
<span>{_add_image}</span></a>
|
||||
<a {if !$hasAvatar}style="display:none"{/if} class="_add_image hoverable set_image" id="add_image">
|
||||
<span>{_upload_new_picture}</span></a>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<a href="{$avatarLink|nocheck}">
|
||||
|
|
|
@ -73,11 +73,13 @@
|
|||
{var $hasAvatar = !str_contains($user->getAvatarUrl('miniscule'), "/assets/packages/static/openvk/img/camera_200.png")}
|
||||
|
||||
{if $thisUser && $user->getId() == $thisUser->getId()}
|
||||
<a {if $hasAvatar}style="display:none"{/if} class="add_image_text" id="add_image">{_add_image}</a>
|
||||
<div {if !$hasAvatar}style="display:none"{/if} class="avatar_controls">
|
||||
<div class="avatarDelete hoverable"></div>
|
||||
<div class="avatar_controls">
|
||||
<div {if !$hasAvatar}style="display:none"{/if} class="avatarDelete hoverable"></div>
|
||||
<div class="avatar_variants">
|
||||
<a class="_add_image hoverable" id="add_image"><span>{_upload_new_picture}</span></a>
|
||||
<a {if $hasAvatar}style="display:none"{/if} class="_add_image hoverable upload_image" id="add_image">
|
||||
<span>{_add_image}</span></a>
|
||||
<a {if !$hasAvatar}style="display:none"{/if} class="_add_image hoverable set_image" id="add_image">
|
||||
<span>{_upload_new_picture}</span></a>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
|
|
@ -2206,9 +2206,11 @@ $(document).on("click", "#add_image", (e) => {
|
|||
|
||||
document.querySelector("#bigAvatar").src = response.url
|
||||
document.querySelector("#bigAvatar").parentNode.href = "/photo" + response.new_photo
|
||||
|
||||
document.querySelector(".add_image_text").style.display = "none"
|
||||
|
||||
document.querySelector(".avatar_controls").style.display = "block"
|
||||
document.querySelector(".avatar_controls .set_image").style.display = "block"
|
||||
document.querySelector(".avatar_controls .avatarDelete").style.display = "block"
|
||||
document.querySelector(".avatar_controls .upload_image").style.display = "none"
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -2332,17 +2334,18 @@ $(document).on("click", ".avatarDelete", (e) => {
|
|||
}
|
||||
|
||||
document.querySelector(".avatarDelete").classList.remove("lagged")
|
||||
|
||||
|
||||
u("body").removeClass("dimmed");
|
||||
document.querySelector("html").style.overflowY = "scroll"
|
||||
u(".ovk-diag-cont").remove()
|
||||
|
||||
document.querySelector("#bigAvatar").src = response.url
|
||||
document.querySelector("#bigAvatar").parentNode.href = response.new_photo ? ("/photo" + response.new_photo) : "javascript:void(0)"
|
||||
|
||||
|
||||
if(!response.has_new_photo) {
|
||||
document.querySelector(".avatar_controls").style.display = "none"
|
||||
document.querySelector(".add_image_text").style.display = "block"
|
||||
document.querySelector(".avatar_controls .set_image").style.display = "none"
|
||||
document.querySelector(".avatar_controls .avatarDelete").style.display = "none"
|
||||
document.querySelector(".avatar_controls .upload_image").style.display = "block"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue