mirror of
https://github.com/openvk/openvk
synced 2024-11-11 01:19:53 +03:00
Videos: Add upload disabling
This commit is contained in:
parent
d365bb6b95
commit
c803a6ff62
9 changed files with 22 additions and 5 deletions
|
@ -197,6 +197,9 @@ class Video extends Media
|
|||
|
||||
static function fastMake(int $owner, string $name = "Unnamed Video.ogv", string $description = "", array $file, bool $unlisted = true, bool $anon = false): Video
|
||||
{
|
||||
if(OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading'])
|
||||
exit(VIDEOS_FRIENDLY_ERROR);
|
||||
|
||||
$video = new Video;
|
||||
$video->setOwner($owner);
|
||||
$video->setName(ovk_proc_strtr($name, 61));
|
||||
|
|
|
@ -47,6 +47,9 @@ final class CommentPresenter extends OpenVKPresenter
|
|||
$club = (new Clubs)->get(abs($entity->getTargetWall()));
|
||||
else if($entity instanceof Topic)
|
||||
$club = $entity->getClub();
|
||||
|
||||
if($_FILES["_vid_attachment"] && OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading'])
|
||||
$this->flashFail("err", tr("error"), "Video uploads are disabled by the system administrator.");
|
||||
|
||||
$flags = 0;
|
||||
if($this->postParam("as_group") === "on" && !is_null($club) && $club->canBeModifiedBy($this->user->identity))
|
||||
|
|
|
@ -84,6 +84,9 @@ final class TopicsPresenter extends OpenVKPresenter
|
|||
if($this->postParam("as_group") === "on" && $club->canBeModifiedBy($this->user->identity))
|
||||
$flags |= 0b10000000;
|
||||
|
||||
if($_FILES["_vid_attachment"] && OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading'])
|
||||
$this->flashFail("err", tr("error"), "Video uploads are disabled by the system administrator.");
|
||||
|
||||
$topic = new Topic;
|
||||
$topic->setGroup($club->getId());
|
||||
$topic->setOwner($this->user->id);
|
||||
|
|
|
@ -56,6 +56,9 @@ final class VideosPresenter extends OpenVKPresenter
|
|||
{
|
||||
$this->assertUserLoggedIn();
|
||||
$this->willExecuteWriteAction();
|
||||
|
||||
if(OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading'])
|
||||
$this->flashFail("err", tr("error"), "Video uploads are disabled by the system administrator.");
|
||||
|
||||
if($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
if(!empty($this->postParam("name"))) {
|
||||
|
|
|
@ -229,6 +229,9 @@ final class WallPresenter extends OpenVKPresenter
|
|||
if(!$canPost)
|
||||
$this->flashFail("err", tr("not_enough_permissions"), tr("not_enough_permissions_comment"));
|
||||
|
||||
if($_FILES["_vid_attachment"] && OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading'])
|
||||
$this->flashFail("err", tr("error"), "Video uploads are disabled by the system administrator.");
|
||||
|
||||
$anon = OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["anonymousPosting"]["enable"];
|
||||
if($wallOwner instanceof Club && $this->postParam("as_group") === "on" && $this->postParam("force_sign") !== "on" && $anon) {
|
||||
$manager = $wallOwner->getManager($this->user->identity);
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
{_attachment}: <span>(unknown)</span>
|
||||
</div>
|
||||
<input type="file" class="postFileSel" id="postFilePic" name="_pic_attachment" accept="image/*" style="display: none;" />
|
||||
<input type="file" class="postFileSel" id="postFileVid" name="_vid_attachment" accept="video/*" style="display: none;" />
|
||||
<input n:if="!OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading']" type="file" class="postFileSel" id="postFileVid" name="_vid_attachment" accept="video/*" style="display: none;" />
|
||||
<br/>
|
||||
<div style="float: right; display: flex; flex-direction: column;">
|
||||
<a href="javascript:void(u('#post-buttons1 #wallAttachmentMenu').toggleClass('hidden'));">
|
||||
|
@ -49,7 +49,7 @@
|
|||
<img src="/assets/packages/static/openvk/img/oxygen-icons/16x16/mimetypes/application-x-egon.png" />
|
||||
{_attach_photo}
|
||||
</a>
|
||||
<a href="javascript:void(document.querySelector('#post-buttons1 input[name=_vid_attachment]').click());">
|
||||
<a n:if="!OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading']" href="javascript:void(document.querySelector('#post-buttons1 input[name=_vid_attachment]').click());">
|
||||
<img src="/assets/packages/static/openvk/img/oxygen-icons/16x16/mimetypes/application-vnd.rn-realmedia.png" />
|
||||
{_attach_video}
|
||||
</a>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<div style="padding-bottom: 0px; padding-top: 0;" class="summaryBar">
|
||||
<div class="summary">
|
||||
{tr("videos", $count)}
|
||||
<span n:if="isset($thisUser) && $thisUser->getId() == $user->getId()">
|
||||
<span n:if="isset($thisUser) && $thisUser->getId() == $user->getId() && !OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading']">
|
||||
|
|
||||
<a href="/videos/upload">{_upload_video}</a>
|
||||
</span>
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
</label>
|
||||
</div>
|
||||
<input type="file" class="postFileSel" id="postFilePic" name="_pic_attachment" accept="image/*" style="display:none;" />
|
||||
<input type="file" class="postFileSel" id="postFileVid" name="_vid_attachment" accept="video/*" style="display:none;" />
|
||||
<input n:if="!OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading']" type="file" class="postFileSel" id="postFileVid" name="_vid_attachment" accept="video/*" style="display:none;" />
|
||||
<input type="hidden" name="poll" value="none" />
|
||||
<input type="hidden" name="type" value="1" />
|
||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||
|
@ -71,7 +71,7 @@
|
|||
<img src="/assets/packages/static/openvk/img/oxygen-icons/16x16/mimetypes/application-x-egon.png" />
|
||||
{_photo}
|
||||
</a>
|
||||
<a href="javascript:void(document.querySelector('#post-buttons{$textAreaId} input[name=_vid_attachment]').click());">
|
||||
<a n:if="!OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading']" href="javascript:void(document.querySelector('#post-buttons{$textAreaId} input[name=_vid_attachment]').click());">
|
||||
<img src="/assets/packages/static/openvk/img/oxygen-icons/16x16/mimetypes/application-vnd.rn-realmedia.png" />
|
||||
{_video}
|
||||
</a>
|
||||
|
|
|
@ -20,6 +20,8 @@ openvk:
|
|||
photos:
|
||||
upgradeStructure: false
|
||||
photoSaving: "quick"
|
||||
videos:
|
||||
disableUploading: false
|
||||
apps:
|
||||
withdrawTax: 8
|
||||
security:
|
||||
|
|
Loading…
Reference in a new issue