Merge branch 'master' of github.com:openvk/openvk

This commit is contained in:
veselcraft 2021-12-14 15:15:49 +03:00
commit c0e0690872
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E
2627 changed files with 3622 additions and 195 deletions

3
.gitmodules vendored
View file

@ -1,3 +0,0 @@
[submodule "Web/static/img/oxygen-icons"]
path = Web/static/img/oxygen-icons
url = https://github.com/KDE/oxygen-icons5.git

View file

@ -34,11 +34,16 @@ class Comment extends Post
*/ */
function getOwner(bool $honourFlags = true, bool $real = false): RowModel function getOwner(bool $honourFlags = true, bool $real = false): RowModel
{ {
if($honourFlags && $this->isPostedOnBehalfOfGroup()) { if($honourFlags && $this->isPostedOnBehalfOfGroup() && $this->getTarget() instanceof Post)
if($this->getTarget() instanceof Post)
return (new Clubs)->get(abs($this->getTarget()->getTargetWall())); return (new Clubs)->get(abs($this->getTarget()->getTargetWall()));
}
return parent::getOwner($honourFlags, $real); return parent::getOwner($honourFlags, $real);
} }
function canBeDeletedBy(User $user): bool
{
return $this->getOwner()->getId() == $user->getId() ||
$this->getTarget()->getOwner()->getId() == $user->getId() ||
$this->getTarget() instanceof Post && $this->getTarget()->getTargetWall() < 0 && (new Clubs)->get(abs($this->getTarget()->getTargetWall()))->canBeModifiedBy($user);
}
} }

View file

@ -1,5 +1,6 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace openvk\Web\Models\Entities\Traits; namespace openvk\Web\Models\Entities\Traits;
use Wkhooy\ObsceneCensorRus;
trait TRichText trait TRichText
{ {
@ -69,6 +70,9 @@ trait TRichText
$text = nl2br($text); $text = nl2br($text);
} }
if(OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["christian"])
ObsceneCensorRus::filterText($text);
return $text; return $text;
} }
} }

View file

@ -106,8 +106,7 @@ final class CommentPresenter extends OpenVKPresenter
$comment = (new Comments)->get($id); $comment = (new Comments)->get($id);
if(!$comment) $this->notFound(); if(!$comment) $this->notFound();
if($comment->getOwner()->getId() !== $this->user->id) if(!$comment->canBeDeletedBy($this->user->identity))
if($comment->getTarget()->getOwner()->getId() !== $this->user->id)
$this->throwError(403, "Forbidden", "У вас недостаточно прав чтобы редактировать этот ресурс."); $this->throwError(403, "Forbidden", "У вас недостаточно прав чтобы редактировать этот ресурс.");
$comment->delete(); $comment->delete();

View file

@ -198,6 +198,7 @@ abstract class OpenVKPresenter extends SimplePresenter
header("HTTP/1.1 403 Forbidden"); header("HTTP/1.1 403 Forbidden");
$this->getTemplatingEngine()->render(__DIR__ . "/templates/@banned.xml", [ $this->getTemplatingEngine()->render(__DIR__ . "/templates/@banned.xml", [
"thisUser" => $this->user->identity, "thisUser" => $this->user->identity,
"csrfToken" => $GLOBALS["csrfToken"],
]); ]);
exit; exit;
} }
@ -221,25 +222,23 @@ abstract class OpenVKPresenter extends SimplePresenter
{ {
parent::onBeforeRender(); parent::onBeforeRender();
if(!is_null($this->user)) { $theme = NULL;
if(Session::i()->get("_tempTheme")) {
$theme = Themepacks::i()[Session::i()->get("_tempTheme", "ovk")];
Session::i()->set("_tempTheme", NULL);
} else if($this->requestParam("themePreview")) {
$theme = Themepacks::i()[$this->requestParam("themePreview")];
} else if($this->user->identity !== null && $this->user->identity->getTheme()) {
$theme = $this->user->identity->getTheme(); $theme = $this->user->identity->getTheme();
if(!is_null($theme) && $theme->overridesTemplates()) { }
$this->template->theme = $theme;
if(!is_null($theme) && $theme->overridesTemplates())
$this->template->_templatePath = $theme->getBaseDir() . "/tpl"; $this->template->_templatePath = $theme->getBaseDir() . "/tpl";
}
}
if(!is_null(Session::i()->get("_error"))) { if(!is_null(Session::i()->get("_error"))) {
$this->template->flashMessage = json_decode(Session::i()->get("_error")); $this->template->flashMessage = json_decode(Session::i()->get("_error"));
Session::i()->set("_error", NULL); Session::i()->set("_error", NULL);
} }
if(Session::i()->get("_tempTheme"))
$this->template->theme = Themepacks::i()[Session::i()->get("_tempTheme", "ovk")];
else if($this->requestParam("themePreview"))
$this->template->theme = Themepacks::i()[$this->requestParam("themePreview")];
else if($this->user->identity !== null && $this->user->identity->getTheme())
$this->template->theme = $this->user->identity->getTheme();
// Знаю, каша ебаная, целестора рефактор всё равно сделает :)))
} }
} }

View file

@ -1,22 +1,20 @@
{extends "@layout.xml"} {extends "@layout.xml"}
{block title}Вам бан{/block} {block title}{_"banned_title"}{/block}
{block header} {block header}
Вы были верискокнуты {_"banned_header"}
{/block} {/block}
{block content} {block content}
<center> <center>
<img src="/assets/packages/static/openvk/img/oof.apng" alt="Пользователь заблокирован." style="width: 20%;" /> <img src="/assets/packages/static/openvk/img/oof.apng" alt="{_'banned_alt'}" style="width: 20%;" />
</center> </center>
<p> <p>
Извините, <b>{$thisUser->getCanonicalName()}</b>, но вы были верискокнуты.<br/> {tr("banned_1", htmlentities($thisUser->getCanonicalName()))|noescape}<br/>
А причина этому проста: <b>{$thisUser->getBanReason()}</b>. К сожалению, на этот раз {tr("banned_2", htmlentities($thisUser->getBanReason()))|noescape}
нам пришлось заблокировать вас навсегда.
</p> </p>
<hr/> <hr/>
<p> <p>
Вы всё ещё можете <a href="/support?act=new">написать в службу поддержки</a>, если считаете что произошла ошибка {tr("banned_3", urlencode($csrfToken))|noescape}
или <a href="/logout">выйти</a>.
</p> </p>
{/block} {/block}

View file

@ -201,8 +201,8 @@
style="max-width: 100%; margin-top: 50px;" /> style="max-width: 100%; margin-top: 50px;" />
</a> </a>
{else} {else}
<a href="/support" class="link">Поддержка</a> <a href="/support" class="link">{_"menu_support"}</a>
<a href="/logout" class="link">Выйти</a> <a href="/logout?hash={urlencode($csrfToken)}" class="link">{_"menu_logout"}</a>
{/if} {/if}
{else} {else}
<form id="fastLogin" action="/login" method="POST" enctype="multipart/form-data"> <form id="fastLogin" action="/login" method="POST" enctype="multipart/form-data">

View file

@ -9,7 +9,7 @@
{/block} {/block}
{block header} {block header}
OpenVK » {=OPENVK_ROOT_CONF["openvk"]["appearance"]["name"]} »
{if $type === "users"} {if $type === "users"}
{tr("search_for_people")} {tr("search_for_people")}
{else} {else}
@ -21,7 +21,7 @@
<form style="margin-left: 12px;"> <form style="margin-left: 12px;">
<input name="type" type="hidden" value="{$_GET['type'] ?? 'users'}" /> <input name="type" type="hidden" value="{$_GET['type'] ?? 'users'}" />
<input name="query" type="text" placeholder="{_"header_search"}" value="{$_GET['query'] ?? ''}" style="width: 90%" /> <input name="query" type="text" placeholder="{_"header_search"}" value="{$_GET['query'] ?? ''}" style="width: 90%" />
<input type="submit" class="button" value="{_"search_button"}" style="width: 9%" /> <input type="submit" class="button" value="{_"search_button"}" style="width: 7%" />
</form> </form>
<p style="margin-left: 15px;"> <p style="margin-left: 15px;">

View file

@ -1,7 +1,7 @@
<center> <center>
<img src="/assets/packages/static/openvk/img/oof.apng" alt="Пользователь заблокирован." style="width: 20%;" /> <img src="/assets/packages/static/openvk/img/oof.apng" alt="Пользователь заблокирован." style="width: 20%;" />
<p> <p>
К сожалению, нам пришлось заблокировать страницу пользователя <b>{$user->getFirstName()}</b>.<br/> {tr("user_banned", htmlentities($user->getFirstName()))|noescape}<br/>
Комментарий модератора: <b>{$user->getBanReason()}</b>. {_"user_banned_comment"} <b>{$user->getBanReason()}</b>.
</p> </p>
</center> </center>

View file

@ -29,9 +29,7 @@
</div> </div>
<div n:if="isset($thisUser) &&! ($compact ?? false)" class="post-menu"> <div n:if="isset($thisUser) &&! ($compact ?? false)" class="post-menu">
<a href="#_comment{$comment->getId()}" class="date">{$comment->getPublicationTime()}</a>&nbsp;| <a href="#_comment{$comment->getId()}" class="date">{$comment->getPublicationTime()}</a>&nbsp;|
{var canDelete = $comment->getOwner()->getId() == $thisUser->getId()} {if $comment->canBeDeletedBy($thisUser)}
{var canDelete = $canDelete || $comment->getTarget()->getOwner()->getId() == $thisUser->getId()}
{if $canDelete}
<a href="/comment{$comment->getId()}/delete">{_"delete"}</a>&nbsp;| <a href="/comment{$comment->getId()}/delete">{_"delete"}</a>&nbsp;|
{/if} {/if}
<a class="comment-reply">Ответить</a> <a class="comment-reply">Ответить</a>

View file

@ -10,7 +10,9 @@
{foreach $comments as $comment} {foreach $comments as $comment}
{include "comment.xml", comment => $comment} {include "comment.xml", comment => $comment}
{/foreach} {/foreach}
<div style="margin-top: 11px;">
{include "paginator.xml", conf => (object) ["page" => $page, "count" => $count, "amount" => sizeof($comments), "perPage" => 10]} {include "paginator.xml", conf => (object) ["page" => $page, "count" => $count, "amount" => sizeof($comments), "perPage" => 10]}
</div>
{else} {else}
<!-- {if $model === "photos"} <!-- {if $model === "photos"}
<p>Будьте первым, кто оставит комментарий к этой фотографии</p> <p>Будьте первым, кто оставит комментарий к этой фотографии</p>

View file

@ -8,7 +8,7 @@
</div> </div>
<div id="post-buttons{$textAreaId}" style="display: none;"> <div id="post-buttons{$textAreaId}" style="display: none;">
<div class="post-upload"> <div class="post-upload">
Вложение: <span>(unknown)</span> {_attachment}: <span>(unknown)</span>
</div> </div>
<div n:if="$postOpts ?? true" class="post-opts"> <div n:if="$postOpts ?? true" class="post-opts">
{var anonEnabled = OPENVK_ROOT_CONF['openvk']['preferences']['wall']['anonymousPosting']['enable']} {var anonEnabled = OPENVK_ROOT_CONF['openvk']['preferences']['wall']['anonymousPosting']['enable']}
@ -35,7 +35,7 @@
{/if} {/if}
<label n:if="$anonEnabled" id="octoberAnonOpt"> <label n:if="$anonEnabled" id="octoberAnonOpt">
<input type="checkbox" name="anon" /> Анонимно <input type="checkbox" name="anon" /> {_"as_anonymous"}
</label> </label>
<label> <label>
@ -55,7 +55,7 @@
<input type="submit" value="{_'write'}" class="button" /> <input type="submit" value="{_'write'}" class="button" />
<div style="float: right; display: flex; flex-direction: column;"> <div style="float: right; display: flex; flex-direction: column;">
<a href="javascript:void(u('#post-buttons{$textAreaId} #wallAttachmentMenu').toggleClass('hidden'));"> <a href="javascript:void(u('#post-buttons{$textAreaId} #wallAttachmentMenu').toggleClass('hidden'));">
Прикрепить {_attach}
</a> </a>
<div id="wallAttachmentMenu" class="hidden"> <div id="wallAttachmentMenu" class="hidden">
@ -65,11 +65,11 @@
</a> </a>
<a href="javascript:void(document.querySelector('#post-buttons{$textAreaId} input[name=_vid_attachment]').click());"> <a 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" />
Прикрепить видео {_attach_video}
</a> </a>
<a n:if="$graffiti ?? false" href="javascript:initGraffiti({$textAreaId});"> <a n:if="$graffiti ?? false" href="javascript:initGraffiti({$textAreaId});">
<img src="/assets/packages/static/openvk/img/oxygen-icons/16x16/actions/draw-brush.png" /> <img src="/assets/packages/static/openvk/img/oxygen-icons/16x16/actions/draw-brush.png" />
Нарисовать граффити {_draw_graffiti}
</a> </a>
</div> </div>
</div> </div>

View file

@ -57,7 +57,7 @@ class Localizator
$lang = is_null($lang) ? static::DEFAULT_LANG : $lang; $lang = is_null($lang) ? static::DEFAULT_LANG : $lang;
$array = @self::parse(dirname(__FILE__) . "/../../locales/$lang.strings"); $array = @self::parse(dirname(__FILE__) . "/../../locales/$lang.strings");
return $array[$id] ?? "@$id"; return $array[$id] ?? (!empty($array["__fallback"]) ? $this->_($id, $array["__fallback"]) : "@$id");
} }
function export($lang = NULL): ?array function export($lang = NULL): ?array

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 B

@ -1 +0,0 @@
Subproject commit 9d4eb793307e7af10c39c9da3b46646d97ad9dc2

View file

@ -0,0 +1 @@
system-run.png

View file

@ -0,0 +1 @@
run-build.png

View file

@ -0,0 +1 @@
appointment-new.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

View file

@ -0,0 +1 @@
folder-new.png

View file

@ -0,0 +1 @@
fork.png

View file

@ -0,0 +1 @@
im-user.png

View file

@ -0,0 +1 @@
flag-red.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 797 B

View file

@ -0,0 +1 @@
address-book-new.png

View file

@ -0,0 +1 @@
address-book-new.png

View file

@ -0,0 +1 @@
go-home.png

View file

@ -0,0 +1 @@
folder-new.png

View file

@ -0,0 +1 @@
document-import.png

View file

@ -0,0 +1 @@
folder-new.png

View file

@ -0,0 +1 @@
configure.png

View file

@ -0,0 +1 @@
edit-delete.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

View file

@ -0,0 +1 @@
align-vertical-bottom-out.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

View file

@ -0,0 +1 @@
align-horizontal-top-out.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

View file

@ -0,0 +1 @@
im-invisible-user.png

View file

@ -0,0 +1 @@
appointment-new.png

View file

@ -0,0 +1 @@
view-media-lyrics.png

View file

@ -0,0 +1 @@
view-statistics.png

View file

@ -0,0 +1 @@
view-media-playlist.png

View file

@ -0,0 +1 @@
view-refresh.png

View file

@ -0,0 +1 @@
dialog-ok-apply.png

View file

@ -0,0 +1 @@
dialog-ok-apply.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

View file

@ -0,0 +1 @@
configure.png

View file

@ -0,0 +1 @@
../places/folder-html.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

View file

@ -0,0 +1 @@
../categories/applications-internet.png

View file

@ -0,0 +1 @@
player-volume.png

View file

@ -0,0 +1 @@
bookmark-new.png

View file

@ -0,0 +1 @@
bookmark-new.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 707 B

View file

@ -0,0 +1 @@
list-remove.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

View file

@ -0,0 +1 @@
bookmark-new.png

View file

@ -0,0 +1 @@
draw-rectangle.png

View file

@ -0,0 +1 @@
list-add.png

View file

@ -0,0 +1 @@
list-add.png

View file

@ -0,0 +1 @@
go-up.png

View file

@ -0,0 +1 @@
run-build.png

View file

@ -0,0 +1 @@
edit-delete.png

View file

@ -0,0 +1 @@
edit-delete.png

View file

@ -0,0 +1 @@
go-down.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

View file

@ -0,0 +1 @@
dialog-cancel.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 654 B

View file

@ -0,0 +1 @@
dialog-ok-apply.png

View file

@ -0,0 +1 @@
draw-circle.png

View file

@ -0,0 +1 @@
chronometer.png

View file

@ -0,0 +1 @@
view-refresh.png

View file

@ -0,0 +1 @@
player-time.png

Some files were not shown because too many files have changed in this diff Show more