mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +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
|
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 = new Video;
|
||||||
$video->setOwner($owner);
|
$video->setOwner($owner);
|
||||||
$video->setName(ovk_proc_strtr($name, 61));
|
$video->setName(ovk_proc_strtr($name, 61));
|
||||||
|
|
|
@ -48,6 +48,9 @@ final class CommentPresenter extends OpenVKPresenter
|
||||||
else if($entity instanceof Topic)
|
else if($entity instanceof Topic)
|
||||||
$club = $entity->getClub();
|
$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;
|
$flags = 0;
|
||||||
if($this->postParam("as_group") === "on" && !is_null($club) && $club->canBeModifiedBy($this->user->identity))
|
if($this->postParam("as_group") === "on" && !is_null($club) && $club->canBeModifiedBy($this->user->identity))
|
||||||
$flags |= 0b10000000;
|
$flags |= 0b10000000;
|
||||||
|
|
|
@ -84,6 +84,9 @@ final class TopicsPresenter extends OpenVKPresenter
|
||||||
if($this->postParam("as_group") === "on" && $club->canBeModifiedBy($this->user->identity))
|
if($this->postParam("as_group") === "on" && $club->canBeModifiedBy($this->user->identity))
|
||||||
$flags |= 0b10000000;
|
$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 = new Topic;
|
||||||
$topic->setGroup($club->getId());
|
$topic->setGroup($club->getId());
|
||||||
$topic->setOwner($this->user->id);
|
$topic->setOwner($this->user->id);
|
||||||
|
|
|
@ -57,6 +57,9 @@ final class VideosPresenter extends OpenVKPresenter
|
||||||
$this->assertUserLoggedIn();
|
$this->assertUserLoggedIn();
|
||||||
$this->willExecuteWriteAction();
|
$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($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
if(!empty($this->postParam("name"))) {
|
if(!empty($this->postParam("name"))) {
|
||||||
$video = new Video;
|
$video = new Video;
|
||||||
|
|
|
@ -229,6 +229,9 @@ final class WallPresenter extends OpenVKPresenter
|
||||||
if(!$canPost)
|
if(!$canPost)
|
||||||
$this->flashFail("err", tr("not_enough_permissions"), tr("not_enough_permissions_comment"));
|
$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"];
|
$anon = OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["anonymousPosting"]["enable"];
|
||||||
if($wallOwner instanceof Club && $this->postParam("as_group") === "on" && $this->postParam("force_sign") !== "on" && $anon) {
|
if($wallOwner instanceof Club && $this->postParam("as_group") === "on" && $this->postParam("force_sign") !== "on" && $anon) {
|
||||||
$manager = $wallOwner->getManager($this->user->identity);
|
$manager = $wallOwner->getManager($this->user->identity);
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
{_attachment}: <span>(unknown)</span>
|
{_attachment}: <span>(unknown)</span>
|
||||||
</div>
|
</div>
|
||||||
<input type="file" class="postFileSel" id="postFilePic" name="_pic_attachment" accept="image/*" style="display: none;" />
|
<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/>
|
<br/>
|
||||||
<div style="float: right; display: flex; flex-direction: column;">
|
<div style="float: right; display: flex; flex-direction: column;">
|
||||||
<a href="javascript:void(u('#post-buttons1 #wallAttachmentMenu').toggleClass('hidden'));">
|
<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" />
|
<img src="/assets/packages/static/openvk/img/oxygen-icons/16x16/mimetypes/application-x-egon.png" />
|
||||||
{_attach_photo}
|
{_attach_photo}
|
||||||
</a>
|
</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" />
|
<img src="/assets/packages/static/openvk/img/oxygen-icons/16x16/mimetypes/application-vnd.rn-realmedia.png" />
|
||||||
{_attach_video}
|
{_attach_video}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<div style="padding-bottom: 0px; padding-top: 0;" class="summaryBar">
|
<div style="padding-bottom: 0px; padding-top: 0;" class="summaryBar">
|
||||||
<div class="summary">
|
<div class="summary">
|
||||||
{tr("videos", $count)}
|
{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>
|
<a href="/videos/upload">{_upload_video}</a>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<input type="file" class="postFileSel" id="postFilePic" name="_pic_attachment" accept="image/*" style="display:none;" />
|
<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="poll" value="none" />
|
||||||
<input type="hidden" name="type" value="1" />
|
<input type="hidden" name="type" value="1" />
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<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" />
|
<img src="/assets/packages/static/openvk/img/oxygen-icons/16x16/mimetypes/application-x-egon.png" />
|
||||||
{_photo}
|
{_photo}
|
||||||
</a>
|
</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" />
|
<img src="/assets/packages/static/openvk/img/oxygen-icons/16x16/mimetypes/application-vnd.rn-realmedia.png" />
|
||||||
{_video}
|
{_video}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -20,6 +20,8 @@ openvk:
|
||||||
photos:
|
photos:
|
||||||
upgradeStructure: false
|
upgradeStructure: false
|
||||||
photoSaving: "quick"
|
photoSaving: "quick"
|
||||||
|
videos:
|
||||||
|
disableUploading: false
|
||||||
apps:
|
apps:
|
||||||
withdrawTax: 8
|
withdrawTax: 8
|
||||||
security:
|
security:
|
||||||
|
|
Loading…
Reference in a new issue