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

This commit is contained in:
veselcraft 2021-11-04 00:23:42 +03:00
commit c049d5c0f3
19 changed files with 198 additions and 110 deletions

View file

@ -65,3 +65,8 @@ You may reach out to us via:
*Attention*: bug tracker and telegram chat are public places. And ticketing system is being served by volunteers. If you need to report something, that shouldn't be immediately disclosed to general public (for instance, vulnerability report), *please use contact us directly*:
* *Head of OpenVK Security Commitee*: stingray@jill.pl or "@id155":https://t.me/id155
* *Backend developer*: "@saddyteirusu":https://t.me/saddyteirusu
Codeberg repository clone:
<a href="https://codeberg.org/OpenVK/openvk">
<img alt="Get it on Codeberg" src="https://codeberg.org/Codeberg/GetItOnCodeberg/media/branch/main/get-it-on-blue-on-white.png" height="60">
</a>

View file

@ -204,6 +204,11 @@ class User extends RowModel
return $this->getRecord()->shortcode;
}
function getAlert(): ?string
{
return $this->getRecord()->alert;
}
function getBanReason(): ?string
{
return $this->getRecord()->block_reason;
@ -214,10 +219,10 @@ class User extends RowModel
return $this->getRecord()->type;
}
function getCoins(): int
function getCoins(): float
{
if(!OPENVK_ROOT_CONF["openvk"]["preferences"]["commerce"])
return 0;
return 0.0;
return $this->getRecord()->coins;
}
@ -563,6 +568,11 @@ class User extends RowModel
return !is_null($this->getBanReason());
}
function isOnline(): bool
{
return time() - $this->getRecord()->online <= 300;
}
function prefersNotToSeeRating(): bool
{
return !((bool) $this->getRecord()->show_rating);

View file

@ -30,18 +30,14 @@ final class UserPresenter extends OpenVKPresenter
if(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH) !== "/" . $user->getShortCode())
$this->redirect("/" . $user->getShortCode(), static::REDIRECT_TEMPORARY_PRESISTENT);
$then = date_create("@" . $user->getOnline()->timestamp());
$now = date_create();
$diff = date_diff($now, $then);
$this->template->albums = (new Albums)->getUserAlbums($user);
$this->template->albumsCount = (new Albums)->getUserAlbumsCount($user);
$this->template->videos = (new Videos)->getByUser($user, 1, 2);
$this->template->videosCount = (new Videos)->getUserVideosCount($user);
$this->template->notes = (new Notes)->getUserNotes($user, 1, 4);
$this->template->notesCount = (new Notes)->getUserNotesCount($user);
$this->template->user = $user;
$this->template->diff = $diff;
}
}

View file

@ -48,7 +48,10 @@ final class WallPresenter extends OpenVKPresenter
if(is_null($this->user))
$canPost = false;
else if($user > 0)
$canPost = $owner->getPrivacyPermission("wall.write", $this->user->identity);
if(!$owner->isBanned())
$canPost = $owner->getPrivacyPermission("wall.write", $this->user->identity);
else
$this->flashFail("err", tr("error"), "Ошибка доступа");
else if($user < 0)
if($owner->canBeModifiedBy($this->user->identity))
$canPost = true;
@ -165,7 +168,10 @@ final class WallPresenter extends OpenVKPresenter
$wallOwner = ($wall > 0 ? (new Users)->get($wall) : (new Clubs)->get($wall * -1))
?? $this->flashFail("err", "Не удалось опубликовать пост", "Такого пользователя не существует.");
if($wall > 0)
$canPost = $wallOwner->getPrivacyPermission("wall.write", $this->user->identity);
if(!$wallOwner->isBanned())
$canPost = $wallOwner->getPrivacyPermission("wall.write", $this->user->identity);
else
$this->flashFail("err", "Ошибка доступа", "Вам нельзя писать на эту стену.");
else if($wall < 0)
if($wallOwner->canBeModifiedBy($this->user->identity))
$canPost = true;
@ -245,10 +251,11 @@ final class WallPresenter extends OpenVKPresenter
$this->logPostView($post, $wall);
$this->template->post = $post;
if ($post->getTargetWall() > 0)
{
if ($post->getTargetWall() > 0) {
$this->template->wallOwner = (new Users)->get($post->getTargetWall());
$this->template->isWallOfGroup = false;
if($this->template->wallOwner->isBanned())
$this->flashFail("err", tr("error"), "Ошибка доступа");
} else {
$this->template->wallOwner = (new Clubs)->get(abs($post->getTargetWall()));
$this->template->isWallOfGroup = true;

View file

@ -251,7 +251,7 @@
<a href="/language" class="link">{_footer_choose_language}</a>
<a href="/privacy" class="link">{_footer_privacy}</a>
</div>
<p>OpenVK <a href="/about:openvk2">{php echo OPENVK_VERSION}</a> | PHP: {phpversion()} | DB: {$dbVersion}</p>
<p>OpenVK <a href="/about:openvk">{php echo OPENVK_VERSION}</a> | PHP: {phpversion()} | DB: {$dbVersion}</p>
<p n:ifcontent="ifcontent">
{php echo OPENVK_ROOT_CONF["openvk"]["appearance"]["motd"]}
</p>

View file

@ -79,7 +79,7 @@
#ovkLogo {
float: right;
border: 0;
width: 30px;
height: 30px;
padding-top: 6px;
position: relative;
}
@ -97,7 +97,7 @@
<tr class="h">
<td>
<h1 class="p" style="float: left;">OpenVK {=OPENVK_VERSION}</h1>
<img id="ovkLogo" src="/assets/packages/static/openvk/img/logo.svg" alt="OpenVK Logo" />
<img id="ovkLogo" src="/assets/packages/static/openvk/img/logo_full.svg" alt="OpenVK Logo" />
</td>
</tr>
</tbody>

View file

@ -34,10 +34,10 @@
<!-- DEBUG: ONLINE REPORT: static {$user->getOnline()->timestamp()}s adjusted {$user->getOnline()->timestamp() + 2505600}s real {time()}s -->
<div n:if="$user->getOnline()->timestamp() + 2505600 > time()" style="float:right;">
{if $diff->i <= 5}
<span><b>{_online}</b></span>
{if $user->isOnline()}
<span><b>{_online}</b></span>
{else}
<span>{_was_online} {$user->getOnline()}</span>
<span>{_was_online} {$user->getOnline()}</span>
{/if}
</div>
<div n:if="$user->onlineStatus() == 2" style="float:right;">
@ -76,6 +76,9 @@
{/if}
{if $thisUser->getChandlerUser()->can("access")->model("admin")->whichBelongsTo(NULL)}
<a href="/admin/users/id{$user->getId()}" class="profile_link">
{_manage_user_action}
</a>
<a href="javascript:banUser()" class="profile_link">
{_ban_user_action}
</a>
@ -349,7 +352,7 @@
<div class="right_big_block">
<div class="page_info">
<div n:if="!is_null($alert = $user->getAlert())" class="user-alert">{$alert}</div>
<div class="accountInfo clearFix">
<div class="profileName">
<h2>{$user->getFullName()}</h2>

View file

@ -7,12 +7,10 @@
<img
src="{$author->getAvatarURL()}"
width="{ifset $compact}25{else}50{/ifset}" />
{if !$post->isPostedOnBehalfOfGroup() && !$compact}
<span n:if="$author->getOnline()->timestamp() + 2505600 > time()" class="post-online">
{if $diff->i <= 5}
{_online}
{/if}
</span>
{if !$post->isPostedOnBehalfOfGroup() && !$compact}
<span n:if="$author->isOnline()" class="post-online">
{_online}
</span>
{/if}
</td>
<td width="100%" valign="top">

View file

@ -7,13 +7,11 @@
<img
src="{$author->getAvatarURL()}"
width="50" />
{if !$post->isPostedOnBehalfOfGroup() && !$compact}
<span n:if="$author->getOnline()->timestamp() + 2505600 > time()" class="post-online">
{if $diff->i <= 5}
{_online}
{if !$post->isPostedOnBehalfOfGroup() && !$compact}
<span n:if="$author->isOnline()" class="post-online">
{_online}
</span>
{/if}
</span>
{/if}
</td>
<td width="100%" valign="top">
<div class="post-author">

View file

@ -1433,3 +1433,13 @@ body.scrolled .toTop:hover {
#ovkDraw .literally .lc-picker .toolbar-button:hover:not(.disabled), #ovkDraw .literally .horz-toolbar .square-toolbar-button:hover:not(.disabled) {
border-color: #cdcdcd;
}
.user-alert {
margin-left: 8px;
margin-bottom: 8px;
padding: 4px;
border: 1px solid #c3a476;
font-weight: 900;
background-color: #f3ddbd;
color: #58462a;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -125,9 +125,16 @@ isomorphic-fetch@^2.1.1:
whatwg-fetch ">=0.10.0"
jquery-ui@^1.12.1:
version "1.12.1"
resolved "https://registry.yarnpkg.com/jquery-ui/-/jquery-ui-1.12.1.tgz#bcb4045c8dd0539c134bc1488cdd3e768a7a9e51"
integrity sha1-vLQEXI3QU5wTS8FIjN0+dop6nlE=
version "1.13.0"
resolved "https://registry.yarnpkg.com/jquery-ui/-/jquery-ui-1.13.0.tgz#ab5ac65f37ca093c51b3478c4097f55bbc008f36"
integrity sha512-Osf7ECXNTYHtKBkn9xzbIf9kifNrBhfywFEKxOeB/OVctVmLlouV9mfc2qXCp6uyO4Pn72PXKOnj09qXetopCw==
dependencies:
jquery ">=1.8.0 <4.0.0"
"jquery@>=1.8.0 <4.0.0":
version "3.6.0"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.6.0.tgz#c72a09f15c1bdce142f49dbf1170bdf8adac2470"
integrity sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==
jquery@^2.1.0:
version "2.2.4"
@ -280,9 +287,9 @@ umbrellajs@^3.1.0:
integrity sha512-3qichMg1Q6EetLweBAT0L55O2W6CJe9qyiSt1RBnf+bcOqwJ4R7e2PDcoIUrCsg+uRo3DXOvurWdklBu0ia7fg==
underscore@>=1.8.3, underscore@^1.9.1:
version "1.10.2"
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.10.2.tgz#73d6aa3668f3188e4adb0f1943bd12cfd7efaaaf"
integrity sha512-N4P+Q/BuyuEKFJ43B9gYuOj4TQUHXX+j2FqguVOpjkssLUUrnJofCcBccJSCoeturDoZU6GorDTHSvUDlSQbTg==
version "1.13.1"
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.1.tgz#0c1c6bd2df54b6b69f2314066d65b6cde6fcf9d1"
integrity sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g==
whatwg-fetch@>=0.10.0:
version "3.6.2"

View file

@ -4,7 +4,7 @@
# OpenVK AutoInstallation Script for FreeBSD 12 # /( )` #
# ------------------------------------------------------------- # \ \___ / | #
# # /- _ `-/ ' #
# This script installs OpenVK 2 on an empty FreeBSD 12 box. # (/\/ \ \ /\ #
# This script installs OpenVK on an empty FreeBSD 12 box. # (/\/ \ \ /\ #
# Copyright (c) 2020 OpenVK contributors # / / | ` \ #
# ------------------------------------------------------------- # O O ) / | #
# # `-^--'`< ' #

View file

@ -0,0 +1 @@
ALTER TABLE `profiles` ADD `alert` TEXT NULL DEFAULT NULL AFTER `since`;

View file

@ -0,0 +1 @@
ALTER TABLE `profiles` CHANGE `coins` `coins` REAL(20) UNSIGNED NOT NULL DEFAULT '0';

@ -1 +1 @@
Subproject commit 0c50ecdd77ac6643c7e5a29dcfff8ad84706ec3f
Subproject commit 12998df6df2a28489ba2e65a9f255af115eb83de

View file

@ -1,6 +1,6 @@
name: "OpenVK 2 Electric Boogalo"
description: "Yet another OpenVK social network"
author: "OpenVK contributors"
version: "2.0"
name: "OpenVK"
description: "Not-yet-federated open source social network inspired by VK"
author: "OpenVK Team"
version: "0.1.0-tp3"
init: "bootstrap.php"