Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Web/Models/Repositories/Audios.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public function find(string $query, array $params = [], array $order = ['type' =
$order_str = (in_array($order['type'], ['id', 'length', 'listens']) ? $order['type'] : 'id') . ' ' . ($order['invert'] ? 'ASC' : 'DESC');
;

if ($params["only_performers"] == "1") {
if ($params["only_performers"] ?? null == "1") {
$result->where("performer LIKE ?", $query);
} else {
$result->where("CONCAT_WS(' ', performer, name) LIKE ?", $query);
Expand Down
2 changes: 1 addition & 1 deletion Web/Presenters/OpenVKPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public function onStartup(): void
}
}

if ($_SERVER['HTTP_X_OPENVK_AJAX_QUERY'] == '1' && $this->user->identity) {
if (!empty($_SERVER['HTTP_X_OPENVK_AJAX_QUERY']) && $_SERVER['HTTP_X_OPENVK_AJAX_QUERY'] == '1' && $this->user->identity) {
error_reporting(0);
header('Content-Type: text/plain; charset=UTF-8');
}
Expand Down
36 changes: 18 additions & 18 deletions Web/Presenters/templates/@layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@

<div class="layout">
<div id="xhead" class="dm"></div>
<div class="page_header{if $instance_name != OPENVK_DEFAULT_INSTANCE_NAME} page_custom_header{/if}{if $atSearch} search_expanded search_expanded_at_all{/if}">
<div class="page_header{if $instance_name != OPENVK_DEFAULT_INSTANCE_NAME} page_custom_header{/if}{if $atSearch ?? false} search_expanded search_expanded_at_all{/if}">
<a href="/" class="home_button{if $instance_name != OPENVK_DEFAULT_INSTANCE_NAME} home_button_custom{/if}" title="{$instance_name}">{if $instance_name != OPENVK_DEFAULT_INSTANCE_NAME}{$instance_name}{/if}</a>
<div n:if="isset($thisUser) ? (!$thisUser->isBanned() XOR !$thisUser->isActivated()) : true" class="header_navigation">
{ifset $thisUser}
Expand Down Expand Up @@ -133,16 +133,16 @@
<div id="search_box_fr">
<form id='search_form' action="/search" method="get">
<div id='search_and_one_more_wrapper'>
<input n:attr="value => $_REQUEST['q'] ? $_REQUEST['q'] : NULL" autocomplete="off" type="search" maxlength="79" name="q" placeholder="{_header_search}" title="{_header_search} [Alt+Shift+F]" accesskey="f" />
<input n:attr="value => $_REQUEST['q'] ?? NULL" autocomplete="off" type="search" maxlength="79" name="q" placeholder="{_header_search}" title="{_header_search} [Alt+Shift+F]" accesskey="f" />
<select name="section">
<option n:attr="selected => $_REQUEST['section'] == 'users'" value="users">{_s_by_people}</option>
<option n:attr="selected => $_REQUEST['section'] == 'groups'" value="groups">{_s_by_groups}</option>
<option n:attr="selected => $_REQUEST['section'] == 'posts'" value="posts">{_s_by_posts}</option>
<option n:attr="selected => $_REQUEST['section'] == 'videos'" value="videos">{_s_by_videos}</option>
<option n:attr="selected => $_REQUEST['section'] == 'apps'" value="apps">{_s_by_apps}</option>
<option n:attr="selected => $_REQUEST['section'] == 'audios'" value="audios">{_s_by_audios}</option>
<option n:attr="selected => $_REQUEST['section'] == 'audios_playlists'" value="audios_playlists">{_s_by_audios_playlists}</option>
<option n:attr="selected => $_REQUEST['section'] == 'docs'" value="docs">{_s_by_documents}</option>
<option n:attr="selected => ($_REQUEST['section'] ?? NULL) == 'users'" value="users">{_s_by_people}</option>
<option n:attr="selected => ($_REQUEST['section'] ?? NULL) == 'groups'" value="groups">{_s_by_groups}</option>
<option n:attr="selected => ($_REQUEST['section'] ?? NULL) == 'posts'" value="posts">{_s_by_posts}</option>
<option n:attr="selected => ($_REQUEST['section'] ?? NULL) == 'videos'" value="videos">{_s_by_videos}</option>
<option n:attr="selected => ($_REQUEST['section'] ?? NULL) == 'apps'" value="apps">{_s_by_apps}</option>
<option n:attr="selected => ($_REQUEST['section'] ?? NULL) == 'audios'" value="audios">{_s_by_audios}</option>
<option n:attr="selected => ($_REQUEST['section'] ?? NULL) == 'audios_playlists'" value="audios_playlists">{_s_by_audios_playlists}</option>
<option n:attr="selected => ($_REQUEST['section'] ?? NULL) == 'docs'" value="docs">{_s_by_documents}</option>
</select>
</div>
<button class="search_box_button">
Expand Down Expand Up @@ -234,12 +234,12 @@
<div id="_groupListPinnedGroups">
<div n:if="$thisUser->getPinnedClubCount() > 0" class="menu_divider"></div>

<a n:foreach="$thisUser->getPinnedClubs() as $club" href="{$club->getURL()}" class="link group_link">
{ovk_proc_strtr($club->getName(), 14)}
<a n:foreach="$thisUser->getPinnedClubs() as $pinned_club" href="{$pinned_club->getURL()}" class="link group_link">
{ovk_proc_strtr($pinned_club->getName(), 14)}

<object type="internal/link" style="white-space: normal;" id="sug{$club->getId()}" n:if="$club->getSuggestedPostsCount($thisUser) > 0 && $club->getWallType() == 2">
<a href="/club{$club->getId()}/suggested" class="linkunderline">
(<b>{$club->getSuggestedPostsCount($thisUser)}</b>)
<object type="internal/link" style="white-space: normal;" id="sug{$pinned_club->getId()}" n:if="$pinned_club->getSuggestedPostsCount($thisUser) > 0 && $pinned_club->getWallType() == 2">
<a href="/club{$pinned_club->getId()}/suggested" class="linkunderline">
(<b>{$pinned_club->getSuggestedPostsCount($thisUser)}</b>)
</a>
</object>
</a>
Expand All @@ -253,7 +253,7 @@
<a href="{$newsLink}">{_news_more}</a>
</div>

<div id="bday" n:if="$showBday">
<div id="bday" n:if="$showBday ?? false">
<b>{_bday_reminder}</b>
<hr size="1">
<text>
Expand Down Expand Up @@ -480,8 +480,8 @@
"at_search": {$atSearch ?? false},
"max_attachments": {\OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["postSizes"]["maxAttachments"] ?? 10},
"max_filesize_mb": 100,
"current_id": {$thisUser ? $thisUser->getId() : 0},
"disable_ajax": {$disable_ajax ? $disable_ajax : 0},
"current_id": {($thisUser ?? false) ? $thisUser->getId() : 0},
"disable_ajax": {$disable_ajax ?? 0 },
"max_add_fields": {ovkGetQuirk("users.max-fields")},
"docs_max": {\OPENVK_ROOT_CONF["openvk"]["preferences"]["docs"]["maxSize"]},
"docs_allowed": {\OPENVK_ROOT_CONF["openvk"]["preferences"]["docs"]["allowedFormats"]},
Expand Down
22 changes: 11 additions & 11 deletions Web/Presenters/templates/Admin/Logs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@
<form class="aui">
<div>
<select class="select medium-field" type="number" id="type" name="type" placeholder="{_logs_change_type}">
<option value="any" n:attr="selected => !$type">{_logs_anything}</option>
<option value="0" n:attr="selected => $type === 0">{_logs_adding}</option>
<option value="1" n:attr="selected => $type === 1">{_logs_editing}</option>
<option value="2" n:attr="selected => $type === 2">{_logs_removing}</option>
<option value="3" n:attr="selected => $type === 3">{_logs_restoring}</option>
<option value="any" n:attr="selected => !($type ?? NULL)">{_logs_anything}</option>
<option value="0" n:attr="selected => ($type ?? NULL) === 0">{_logs_adding}</option>
<option value="1" n:attr="selected => ($type ?? NULL) === 1">{_logs_editing}</option>
<option value="2" n:attr="selected => ($type ?? NULL) === 2">{_logs_removing}</option>
<option value="3" n:attr="selected => ($type ?? NULL) === 3">{_logs_restoring}</option>
</select>
<input class="text medium-field" type="number" id="id" name="id" placeholder="{_logs_id_post}" n:attr="value => $id"/>
<input class="text medium-field" type="text" id="uid" name="uid" placeholder="{_logs_uuid_user}" n:attr="value => $user"/>
<input class="text medium-field" type="number" id="id" name="id" placeholder="{_logs_id_post}" n:attr="value => $id ?? NULL"/>
<input class="text medium-field" type="text" id="uid" name="uid" placeholder="{_logs_uuid_user}" n:attr="value => $user ?? NULL"/>
</div>
<div style="margin: 8px 0;" />
<div>
<select class="select medium-field" id="obj_type" name="obj_type" placeholder="{_logs_change_object}">
<option value="any" n:attr="selected => !$obj_type">{_logs_anything}</option>
<option n:foreach="$object_types as $type" n:attr="selected => $obj_type === $type">{$type}</option>
<option value="any" n:attr="selected => !($obj_type ?? NULL)">{_logs_anything}</option>
<option n:foreach="$object_types as $type" n:attr="selected => ($obj_type ?? NULL) === $type">{$type}</option>
</select>
<input class="text medium-field" type="number" id="obj_id" name="obj_id" placeholder="{_logs_id_object}" n:attr="value => $obj_id"/>
<input class="text medium-field" type="number" id="obj_id" name="obj_id" placeholder="{_logs_id_object}" n:attr="value => $obj_id ?? NULL"/>
<input type="submit" class="aui-button aui-button-primary medium-field" value="Поиск" style="width: 165px;"/>
</div>
</form>
Expand Down Expand Up @@ -84,7 +84,7 @@
</table>
<br/>
<div align="right">
{var $isLast = ((20 * (($_GET['p'] ?? 1) - 1)) + $amount) < $count}
{var $isLast = ((20 * (($_GET['p'] ?? 1) - 1)) + $amount) < ($count ?? NULL)}

<a n:if="($_GET['p'] ?? 1) > 1" class="aui-button" href="?p={($_GET['p'] ?? 1) - 1}">&laquo;</a>
<a n:if="$isLast" class="aui-button" href="?p={($_GET['p'] ?? 1) + 1}">&raquo;</a>
Expand Down
2 changes: 1 addition & 1 deletion Web/Presenters/templates/Audio/bigplayer.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div n:class="bigPlayer, ctx_place, $tidy ? tidy">
<div n:class="bigPlayer, ctx_place, $tidy ?? NULL ? tidy">
<div class="bigPlayerWrapper">
<div class="playButtons">
<div class="playButton musicIcon" data-tip='simple' data-title="{_play_tip} [Space]"></div>
Expand Down
8 changes: 4 additions & 4 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,15 +392,15 @@ function ovk_scheme(bool $with_slashes = false): string

function check_copyright_link(string $link = ''): bool
{
if (!str_contains($link, "https://") && !str_contains($link, "http://")) {
$link = "https://" . $link;
}

# Existability
if (is_null($link) || empty($link)) {
throw new \InvalidArgumentException("Empty link");
}

if (!str_contains($link, "https://") && !str_contains($link, "http://")) {
$link = "https://" . $link;
}

# Length
if (iconv_strlen($link) < 2 || iconv_strlen($link) > 400) {
throw new \LengthException("Link is too long");
Expand Down
2 changes: 2 additions & 0 deletions install/automated/docker/openvk.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ openvk:
notification: false
support: false
topics: false
audios: false
documents: false
ton:
enabled: false
address: "🅿"
Expand Down
2 changes: 2 additions & 0 deletions openvk-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ openvk:
notification: false
support: false
topics: false
audios: false
documents: false
ton:
enabled: false
address: "🅿"
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
level: 0
level: 1
paths:
- CLI
- ServiceAPI
Expand Down
Loading