mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +03:00
fix possible bugs (13 серия)
This commit is contained in:
parent
de937f65a1
commit
49d8bc39a1
12 changed files with 28 additions and 19 deletions
|
@ -284,12 +284,16 @@ final class Wall extends VKAPIRequestHandler
|
|||
|
||||
foreach($psts as $pst) {
|
||||
$id = explode("_", $pst);
|
||||
$post = (new PostsRepo)->getPostById(intval($id[0]), intval($id[1]));
|
||||
$post = (new PostsRepo)->getPostById(intval($id[0]), intval($id[1]), true);
|
||||
|
||||
if($post && !$post->isDeleted()) {
|
||||
if(!$post->canBeViewedBy($this->getUser()))
|
||||
continue;
|
||||
|
||||
if($post->getSuggestionType() != 0 && !$post->canBeEditedBy($this->getUser())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$from_id = get_class($post->getOwner()) == "openvk\Web\Models\Entities\Club" ? $post->getOwner()->getId() * (-1) : $post->getOwner()->getId();
|
||||
$attachments = [];
|
||||
$repost = []; // чел высрал семь сигарет 😳 помянем 🕯
|
||||
|
@ -594,10 +598,6 @@ final class Wall extends VKAPIRequestHandler
|
|||
if($wall > 0 && $wall !== $this->user->identity->getId())
|
||||
(new WallPostNotification($wallOwner, $post, $this->user->identity))->emit();
|
||||
|
||||
if($should_be_suggested) {
|
||||
return (object)["post_id" => "on_view"];
|
||||
}
|
||||
|
||||
return (object)["post_id" => $post->getVirtualId()];
|
||||
}
|
||||
|
||||
|
@ -728,7 +728,7 @@ final class Wall extends VKAPIRequestHandler
|
|||
"date" => $comment->getPublicationTime()->timestamp(),
|
||||
"text" => $comment->getText(false),
|
||||
"post_id" => $post->getVirtualId(),
|
||||
"owner_id" => $post->isPostedOnBehalfOfGroup() ? $post->getOwner()->getId() * -1 : $post->getOwner()->getId(),
|
||||
"owner_id" => method_exists($post, 'isPostedOnBehalfOfGroup') && $post->isPostedOnBehalfOfGroup() ? $post->getOwner()->getId() * -1 : $post->getOwner()->getId(),
|
||||
"parents_stack" => [],
|
||||
"attachments" => $attachments,
|
||||
"thread" => [
|
||||
|
@ -815,7 +815,7 @@ final class Wall extends VKAPIRequestHandler
|
|||
"date" => $comment->getPublicationTime()->timestamp(),
|
||||
"text" => $comment->getText(false),
|
||||
"post_id" => $comment->getTarget()->getVirtualId(),
|
||||
"owner_id" => $comment->getTarget()->isPostedOnBehalfOfGroup() ? $comment->getTarget()->getOwner()->getId() * -1 : $comment->getTarget()->getOwner()->getId(),
|
||||
"owner_id" => method_exists($comment->getTarget(), 'isPostedOnBehalfOfGroup') && $comment->getTarget()->isPostedOnBehalfOfGroup() ? $comment->getTarget()->getOwner()->getId() * -1 : $comment->getTarget()->getOwner()->getId(),
|
||||
"parents_stack" => [],
|
||||
"attachments" => $attachments,
|
||||
"likes" => [
|
||||
|
@ -966,7 +966,7 @@ final class Wall extends VKAPIRequestHandler
|
|||
$this->fail(-66, "Post will be empty, don't saving.");
|
||||
}
|
||||
|
||||
$post = (new PostsRepo)->getPostById($owner_id, $post_id);
|
||||
$post = (new PostsRepo)->getPostById($owner_id, $post_id, true);
|
||||
|
||||
if(!$post || $post->isDeleted())
|
||||
$this->fail(102, "Invalid post");
|
||||
|
|
|
@ -151,6 +151,8 @@ final class InternalAPIPresenter extends OpenVKPresenter
|
|||
exit('');
|
||||
}
|
||||
|
||||
header("Content-Type: text/plain");
|
||||
|
||||
if($type == 'post') {
|
||||
$this->template->_template = 'components/post.xml';
|
||||
$this->template->post = $post;
|
||||
|
|
|
@ -168,10 +168,10 @@
|
|||
{/if}
|
||||
{var $canReport = $thisUser->getId() != $club->getOwner()->getId()}
|
||||
{if $canReport}
|
||||
<a class="profile_link" style="display:block;" href="javascript:reportVideo()">{_report}</a>
|
||||
<a class="profile_link" style="display:block;" href="javascript:reportClub()">{_report}</a>
|
||||
|
||||
<script>
|
||||
function reportVideo() {
|
||||
function reportClub() {
|
||||
uReportMsgTxt = tr("going_to_report_club");
|
||||
uReportMsgTxt += "<br/>"+tr("report_question_text");
|
||||
uReportMsgTxt += "<br/><br/><b>"+tr("report_reason")+"</b>: <input type='text' id='uReportMsgInput' placeholder='" + tr("reason") + "' />"
|
||||
|
|
|
@ -322,13 +322,13 @@
|
|||
</div>
|
||||
<div style="padding: 5px;">
|
||||
<div class="ovk-video" n:foreach="$videos as $video">
|
||||
<a href="/video{$video->getPrettyId()}" class="preview" align="center" id="videoOpen" data-id="{$video->getId()}">
|
||||
<a href="/video{$video->getPrettyId()}" class="preview" align="center" id="videoOpen" data-id="{$video->getPrettyId()}">
|
||||
<img
|
||||
src="{$video->getThumbnailURL()}"
|
||||
style="max-width: 170px; max-height: 127px; margin: auto;" />
|
||||
</a>
|
||||
<div>
|
||||
<b><a href="/video{$video->getPrettyId()}" id="videoOpen" data-id="{$video->getId()}">{ovk_proc_strtr($video->getName(), 30)}</a></b><br>
|
||||
<b><a href="/video{$video->getPrettyId()}" id="videoOpen" data-id="{$video->getPrettyId()}">{ovk_proc_strtr($video->getName(), 30)}</a></b><br>
|
||||
<span style="font-size: 10px;">{$video->getPublicationTime()} | {_comments} ({$video->getCommentsCount()})</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
{/if}
|
||||
|
||||
<a n:if="$canReport ?? false" class="profile_link" style="display:block;width:96%;" href="javascript:reportVideo({$video->getId()})">{_report}</a>
|
||||
<a n:if="$video->getType() == 0" href="{$video->getURL()}" download="" class="profile_link" style="display:block;width:96%;">{_download_video}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
</div>
|
||||
<div class="post-content" id="{$post->getPrettyId()}" data-localized-nsfw-text="{_nsfw_warning}">
|
||||
<div class="text" id="text{$post->getPrettyId()}">
|
||||
<span class="really_text">{$post->getText()|noescape}</span>
|
||||
<span data-text="{$post->getText(false)}" class="really_text">{$post->getText()|noescape}</span>
|
||||
|
||||
{var $width = ($GLOBALS["_bigWall"] ?? false) ? 550 : 320}
|
||||
{if isset($GLOBALS["_nesAttGloCou"])}
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<div class="text" id="text{$post->getPrettyId()}">
|
||||
{var $owner = $author->getId()}
|
||||
|
||||
<span class="really_text">{$post->getText()|noescape}</span>
|
||||
<span data-text="{$post->getText(false)}" class="really_text">{$post->getText()|noescape}</span>
|
||||
|
||||
{var $width = ($GLOBALS["_bigWall"] ?? false) ? 550 : 320}
|
||||
{if isset($GLOBALS["_nesAttGloCou"])}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
gap: 6px;
|
||||
z-index: 2;
|
||||
opacity: 0;
|
||||
height: 43px;
|
||||
}
|
||||
|
||||
.bsdn-player.bsdn-dirty > .bsdn_controls {
|
||||
|
|
|
@ -3608,8 +3608,8 @@ hr {
|
|||
text-align: center;
|
||||
}
|
||||
|
||||
.media-page-wrapper .video-page-wrapper-video {
|
||||
text-align: center;
|
||||
.media-page-wrapper .video-page-wrapper-video iframe {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.media-page-wrapper .photo-page-wrapper-photo img {
|
||||
|
|
|
@ -625,7 +625,7 @@ u(document).on("click", "#editPost", async (e) => {
|
|||
edit_place.html(`
|
||||
<div class='edit_menu'>
|
||||
<form id="write">
|
||||
<textarea placeholder="${tr('edit')}" name="text" style="width: 100%;resize: none;" class="expanded-textarea small-textarea">${escapeHtml(api_post.text)}</textarea>
|
||||
<textarea placeholder="${tr('edit')}" name="text" style="width: 100%;resize: none;" class="expanded-textarea small-textarea">${api_post.text}</textarea>
|
||||
|
||||
<div class='post-buttons'>
|
||||
<div class="post-horizontal"></div>
|
||||
|
@ -776,7 +776,7 @@ u(document).on("click", "#editPost", async (e) => {
|
|||
})).text()
|
||||
u(ev.target).removeClass('lagged')
|
||||
post.removeClass('editing')
|
||||
post.nodes[0].outerHTML = new_post_html
|
||||
post.nodes[0].outerHTML = u(new_post_html).last().outerHTML
|
||||
|
||||
bsdnHydrate()
|
||||
})
|
||||
|
@ -1582,6 +1582,10 @@ u(document).on('click', '.post.post-nsfw .post-content', (e) => {
|
|||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
|
||||
if(window.openvk.current_id == 0) {
|
||||
return
|
||||
}
|
||||
|
||||
u(e.target).closest('.post-nsfw').removeClass('post-nsfw')
|
||||
})
|
||||
|
||||
|
|
|
@ -174,4 +174,4 @@ u(document).on('click', 'body.dimmed .dimmer', async (e) => {
|
|||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
@ -236,6 +236,7 @@ function parseAttachments($attachments, array $allow_types = ['photo', 'video',
|
|||
{
|
||||
$exploded_attachments = is_array($attachments) ? $attachments : explode(",", $attachments);
|
||||
$exploded_attachments = array_slice($exploded_attachments, 0, OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["postSizes"]["maxAttachments"] ?? 10);
|
||||
$exploded_attachments = array_unique($exploded_attachments);
|
||||
$imploded_types = implode('|', $allow_types);
|
||||
$output_attachments = [];
|
||||
$repositories = [
|
||||
|
|
Loading…
Reference in a new issue