mirror of
https://github.com/openvk/openvk
synced 2025-07-07 08:19:49 +03:00
Compare commits
1 commit
5d3ad59f82
...
f0e3a83ef6
Author | SHA1 | Date | |
---|---|---|---|
|
f0e3a83ef6 |
5 changed files with 12 additions and 46 deletions
|
@ -104,7 +104,7 @@ class Document extends Media
|
||||||
if(!$file_format)
|
if(!$file_format)
|
||||||
throw new \TypeError("No file format");
|
throw new \TypeError("No file format");
|
||||||
|
|
||||||
if(!in_array(mb_strtolower($file_format), OPENVK_ROOT_CONF["openvk"]["preferences"]["docs"]["allowedFormats"]))
|
if(!in_array($file_format, OPENVK_ROOT_CONF["openvk"]["preferences"]["docs"]["allowedFormats"]))
|
||||||
throw new \TypeError("Forbidden file format");
|
throw new \TypeError("Forbidden file format");
|
||||||
|
|
||||||
if($file_size < 1 || $file_size > (OPENVK_ROOT_CONF["openvk"]["preferences"]["docs"]["maxSize"] * 1024 * 1024))
|
if($file_size < 1 || $file_size > (OPENVK_ROOT_CONF["openvk"]["preferences"]["docs"]["maxSize"] * 1024 * 1024))
|
||||||
|
@ -112,8 +112,8 @@ class Document extends Media
|
||||||
|
|
||||||
$hash = hash_file("whirlpool", $file["tmp_name"]);
|
$hash = hash_file("whirlpool", $file["tmp_name"]);
|
||||||
$this->stateChanges("original_name", ovk_proc_strtr($original_name, 255));
|
$this->stateChanges("original_name", ovk_proc_strtr($original_name, 255));
|
||||||
$this->tmp_format = mb_strtolower($file_format);
|
$this->tmp_format = $file_format;
|
||||||
$this->stateChanges("format", mb_strtolower($file_format));
|
$this->stateChanges("format", $file_format);
|
||||||
$this->stateChanges("filesize", $file_size);
|
$this->stateChanges("filesize", $file_size);
|
||||||
$this->stateChanges("hash", $hash);
|
$this->stateChanges("hash", $hash);
|
||||||
$this->stateChanges("access_key", bin2hex(random_bytes(9)));
|
$this->stateChanges("access_key", bin2hex(random_bytes(9)));
|
||||||
|
@ -166,11 +166,6 @@ class Document extends Media
|
||||||
return in_array($this->getVKAPIType(), [3, 4]);
|
return in_array($this->getVKAPIType(), [3, 4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isGif(): bool
|
|
||||||
{
|
|
||||||
return $this->getVKAPIType() == 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isCopiedBy($user = NULL): bool
|
function isCopiedBy($user = NULL): bool
|
||||||
{
|
{
|
||||||
if(!$user)
|
if(!$user)
|
||||||
|
@ -391,7 +386,7 @@ class Document extends Media
|
||||||
|
|
||||||
static function detectTypeByFormat(string $format)
|
static function detectTypeByFormat(string $format)
|
||||||
{
|
{
|
||||||
switch(mb_strtolower($format)) {
|
switch($format) {
|
||||||
case "txt": case "docx": case "doc": case "odt": case "pptx": case "ppt": case "xlsx": case "xls": case "md":
|
case "txt": case "docx": case "doc": case "odt": case "pptx": case "ppt": case "xlsx": case "xls": case "md":
|
||||||
return 1;
|
return 1;
|
||||||
case "zip": case "rar": case "7z":
|
case "zip": case "rar": case "7z":
|
||||||
|
|
|
@ -2,14 +2,8 @@
|
||||||
{var $copied = !isset($club) ? $doc->isCopiedBy($thisUser) : $doc->isCopiedBy($club)}
|
{var $copied = !isset($club) ? $doc->isCopiedBy($thisUser) : $doc->isCopiedBy($club)}
|
||||||
{var $modifiable = $doc->canBeModifiedBy($thisUser)}
|
{var $modifiable = $doc->canBeModifiedBy($thisUser)}
|
||||||
|
|
||||||
<a href="/doc{$doc->getPrettyId()}?key={$doc->getAccessKey()}" n:class="docMainItem, viewerOpener, docGalleryItem, $scroll_context ? scroll_node, $embed ? embeddable" data-id="{$doc->getPrettiestId()}">
|
<a href="/doc{$doc->getPrettyId()}?key={$doc->getAccessKey()}" n:class="docMainItem, viewerOpener, docGalleryItem, $scroll_context ? scroll_node" data-id="{$doc->getPrettiestId()}">
|
||||||
<img class="docGalleryItem_main_preview" loading="lazy" src="{$preview->getURLBySizeId('medium')}" alt="gallery photo">
|
<img loading="lazy" src="{$preview->getURLBySizeId('medium')}" alt="gallery photo">
|
||||||
{if $embed}
|
|
||||||
<div class="play-button">
|
|
||||||
<div class="play-button-ico"></div>
|
|
||||||
</div>
|
|
||||||
<img class="docGalleryItem_gif_preview" loading="lazy" src="{$doc->getURL()}" alt="gif photo view">
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<div class="doc_top_panel doc_shown_by_hover">
|
<div class="doc_top_panel doc_shown_by_hover">
|
||||||
<div class="doc_volume_action" n:if="!$modifiable" id="report_icon"></div>
|
<div class="doc_volume_action" n:if="!$modifiable" id="report_icon"></div>
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{if $attachment->isImage()}
|
{if $attachment->isImage()}
|
||||||
{include "../Documents/components/image.xml", doc => $attachment, copyImportance => true, showInfo => true, embed => $attachment->isGif()}
|
{include "../Documents/components/image.xml", doc => $attachment, copyImportance => true, showInfo => true}
|
||||||
{else}
|
{else}
|
||||||
{include "../Documents/components/doc.xml", doc => $attachment, copyImportance => true, noTags => true}
|
{include "../Documents/components/doc.xml", doc => $attachment, copyImportance => true, noTags => true}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -2574,7 +2574,7 @@ a.poll-retract-vote {
|
||||||
min-height: 63px;
|
min-height: 63px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-horizontal .upload-item .play-button, .compact_video .play-button, .docGalleryItem .play-button {
|
.post-horizontal .upload-item .play-button, .compact_video .play-button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
width: 30px;
|
width: 30px;
|
||||||
|
@ -2585,7 +2585,7 @@ a.poll-retract-vote {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-horizontal .upload-item .play-button .play-button-ico, .compact_video .play-button .play-button-ico, .docGalleryItem .play-button .play-button-ico {
|
.post-horizontal .upload-item .play-button .play-button-ico, .compact_video .play-button .play-button-ico {
|
||||||
background: url(/assets/packages/static/openvk/img/wall.png) no-repeat 1px 0;
|
background: url(/assets/packages/static/openvk/img/wall.png) no-repeat 1px 0;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
height: 15px;
|
height: 15px;
|
||||||
|
@ -4035,25 +4035,6 @@ hr {
|
||||||
/*width: 200px;*/
|
/*width: 200px;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
.attachments .docGalleryItem.embeddable {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
/*background: black;*/
|
|
||||||
}
|
|
||||||
|
|
||||||
.attachments .docGalleryItem.embeddable .docGalleryItem_gif_preview {
|
|
||||||
object-fit: contain;
|
|
||||||
}
|
|
||||||
|
|
||||||
.attachments .docGalleryItem.embeddable.playing .play-button, .attachments .docGalleryItem.embeddable.playing .doc_bottom_panel, .docGalleryItem .docGalleryItem_gif_preview, .attachments .docGalleryItem.embeddable.playing .docGalleryItem_main_preview {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.attachments .docGalleryItem.embeddable.playing .docGalleryItem_gif_preview {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.docGalleryItem img {
|
.docGalleryItem img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -4239,8 +4220,8 @@ hr {
|
||||||
|
|
||||||
.attachments .docGalleryItem {
|
.attachments .docGalleryItem {
|
||||||
display: block;
|
display: block;
|
||||||
min-width: 170px;
|
min-width: 130px;
|
||||||
height: 170px;
|
height: 150px;
|
||||||
width: 50%;
|
width: 50%;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ function showDocumentUploadDialog(target = null, append_to_url = null, after_upl
|
||||||
file = e.target.files[0]
|
file = e.target.files[0]
|
||||||
const name = file.name
|
const name = file.name
|
||||||
const format = name.split(".")[name.split(".").length - 1]
|
const format = name.split(".")[name.split(".").length - 1]
|
||||||
if(window.openvk.docs_allowed.indexOf(format.toLowerCase()) == -1) {
|
if(window.openvk.docs_allowed.indexOf(format) == -1) {
|
||||||
makeError(tr("error_file_invalid_format"))
|
makeError(tr("error_file_invalid_format"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -269,10 +269,6 @@ u(document).on("click", ".docListViewItem a.viewerOpener, a.docGalleryItem", asy
|
||||||
|
|
||||||
const target = u(e.target)
|
const target = u(e.target)
|
||||||
const link = target.closest('a')
|
const link = target.closest('a')
|
||||||
if(target.closest(".embeddable").length > 0) {
|
|
||||||
target.closest(".embeddable").toggleClass("playing")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
CMessageBox.toggleLoader()
|
CMessageBox.toggleLoader()
|
||||||
const url = link.nodes[0].href
|
const url = link.nodes[0].href
|
||||||
|
|
Loading…
Reference in a new issue