Merge branch 'OpenVK:master' into update-uk-locale

This commit is contained in:
Малушік 2024-11-26 04:21:12 +01:00 committed by GitHub
commit 9da30a07bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 134 additions and 39 deletions

View file

@ -301,7 +301,7 @@ class Post extends Postable
{ {
$liked = parent::toggleLike($user); $liked = parent::toggleLike($user);
if($this->getOwner(false)->getId() !== $user->getId() && !($this->getOwner() instanceof Club) && !$this instanceof Comment) if(!$user->isPrivateLikes() && $this->getOwner(false)->getId() !== $user->getId() && !($this->getOwner() instanceof Club) && !$this instanceof Comment)
(new LikeNotification($this->getOwner(false), $this, $user))->emit(); (new LikeNotification($this->getOwner(false), $this, $user))->emit();
foreach($this->getChildren() as $attachment) foreach($this->getChildren() as $attachment)
@ -383,34 +383,70 @@ class Post extends Postable
{ {
$domain = ovk_scheme(true).$_SERVER["HTTP_HOST"]; $domain = ovk_scheme(true).$_SERVER["HTTP_HOST"];
$description = $this->getText(false); $description = $this->getText(false);
$title = str_replace("\n", "", ovk_proc_strtr($description, 79));
$description_html = $description; $description_html = $description;
$url = $domain."/wall".$this->getPrettyId(); $url = $domain."/wall".$this->getPrettyId();
if($this->isUpdateAvatarMessage())
$title = tr('upd_in_general');
if($this->isDeactivationMessage())
$title = tr('post_deact_in_general');
$author = $this->getOwner(); $author = $this->getOwner();
$author_name = htmlspecialchars($author->getCanonicalName(), ENT_DISALLOWED | ENT_XHTML); $target_wall = $this->getWallOwner();
$author_name = escape_html($author->getCanonicalName());
if($this->isExplicit()) if($this->isExplicit())
$description_html .= "<br /><b>".tr('contains_nsfw').".</b><br />"; $title = 'NSFW: ' . $title;
foreach($this->getChildren() as $child) { foreach($this->getChildren() as $child) {
if($child instanceof Photo) { if($child instanceof Photo) {
$child_page = $domain.$child->getPageURL(); $child_page = $domain.$child->getPageURL();
$child_url = $child->getURLBySizeId('large'); $child_url = $child->getURL();
$description_html .= "<br /><a href='$child_page'><img src='$child_url'></a>"; $description_html .= "<br /><a href='$child_page'><img src='$child_url'></a><br />";
} elseif($child instanceof Video) { } elseif($child instanceof Video) {
$child_page = $domain.'/video'.$child->getPrettyId(); $child_page = $domain.'/video'.$child->getPrettyId();
$description_html .= "<br /><a href='$child_page'>Video</a>";
if($child->getType() != 1) {
$description_html .= "".
"<br />".
"<video width=\"320\" height=\"240\" controls><source src=\"".$child->getURL()."\" type=\"video/mp4\"></video><br />".
"<b>".escape_html($child->getName())."</b><br />";
} else {
$description_html .= "".
"<br />".
"<a href=\"".$child->getVideoDriver()->getURL()."\"><b>".escape_html($child->getName())."</b></a><br />";
}
} elseif($child instanceof Audio) { } elseif($child instanceof Audio) {
$description_html .= "<br />Audio"; if(!$child->isWithdrawn()) {
$description_html .= "<br />"
."<b>".escape_html($child->getName())."</b>:"
."<br />"
."<audio controls>"
."<source src=\"".$child->getOriginalURL()."\" type=\"audio/mpeg\"></audio>"
."<br />";
}
} elseif($child instanceof Poll) {
$description_html .= "<br />".tr('poll').": ".escape_html($child->getTitle());
} elseif($child instanceof Note) {
$description_html .= "<br />".tr('note').": ".escape_html($child->getName());
} }
} }
$description_html .= "<br />".tr('author').": <img width='15px' src='".$author->getAvatarURL()."'><a href='".$author->getURL()."'>" . $author_name . "</a>"; $description_html .= "<br />".tr('author').": <img width='15px' src='".$author->getAvatarURL()."'><a href='".$author->getURL()."'>" . $author_name . "</a>";
if($this->hasSource()) {
$description_html .= "<br />".tr('source').": ".htmlspecialchars($this->getSource(), ENT_DISALLOWED | ENT_XHTML); if($target_wall->getRealId() != $author->getRealId())
$description_html .= "<br />".tr('on_wall').": <img width='15px' src='".$target_wall->getAvatarURL()."'><a href='".$target_wall->getURL()."'>" . escape_html($target_wall->getCanonicalName()) . "</a>";
if($this->isSigned()) {
$signer = $this->getOwner(false);
$description_html .= "<br />".tr('sign_short').": <img width='15px' src='".$signer->getAvatarURL()."'><a href='".$signer->getURL()."'>" . escape_html($signer->getCanonicalName()) . "</a>";
} }
if($this->hasSource())
$description_html .= "<br />".tr('source').": ".escape_html($this->getSource());
$item = new \Bhaktaraz\RSSGenerator\Item(); $item = new \Bhaktaraz\RSSGenerator\Item();
$item->title(str_replace("\n", "", ovk_proc_strtr($description, 79))) $item->title($title)
->url($url) ->url($url)
->guid($url) ->guid($url)
->creator($author_name) ->creator($author_name)

View file

@ -97,8 +97,14 @@ abstract class Postable extends Attachable
"target" => $this->getRecord()->id, "target" => $this->getRecord()->id,
])->page($page, $perPage); ])->page($page, $perPage);
foreach($sel as $like) foreach($sel as $like) {
yield (new Users)->get($like->origin); $user = (new Users)->get($like->origin);
if($user->isPrivateLikes() && OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["anonymousPosting"]["enable"]) {
$user = (new Users)->get((int) OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["anonymousPosting"]["account"]);
}
yield $user;
}
} }
function isAnonymous(): bool function isAnonymous(): bool

View file

@ -498,6 +498,7 @@ class User extends RowModel
"wall.write", "wall.write",
"messages.write", "messages.write",
"audios.read", "audios.read",
"likes.read",
], ],
])->get($id); ])->get($id);
} }
@ -1062,6 +1063,7 @@ class User extends RowModel
"wall.write", "wall.write",
"messages.write", "messages.write",
"audios.read", "audios.read",
"likes.read",
], ],
])->set($id, $status)->toInteger()); ])->set($id, $status)->toInteger());
} }
@ -1338,6 +1340,11 @@ class User extends RowModel
return $this->getId(); return $this->getId();
} }
function isPrivateLikes(): bool
{
return $this->getPrivacySetting("likes.read") == User::PRIVACY_NO_ONE;
}
function toVkApiStruct(?User $user = NULL, string $fields = ''): object function toVkApiStruct(?User $user = NULL, string $fields = ''): object
{ {
$res = (object) []; $res = (object) [];

View file

@ -53,9 +53,9 @@ class Posts
$offset--; $offset--;
} }
} }
} /*else if(!is_null($offset)) { } else if(!is_null($offset) && $pinPost) {
$offset--; $offset--;
}*/ }
$sel = $this->posts->where([ $sel = $this->posts->where([
"wall" => $user, "wall" => $user,

View file

@ -503,6 +503,7 @@ final class UserPresenter extends OpenVKPresenter
"wall.write", "wall.write",
"messages.write", "messages.write",
"audios.read", "audios.read",
"likes.read",
]; ];
foreach($settings as $setting) { foreach($settings as $setting) {
$input = $this->postParam(str_replace(".", "_", $setting)); $input = $this->postParam(str_replace(".", "_", $setting));

View file

@ -395,6 +395,17 @@
</select> </select>
</td> </td>
</tr> </tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_privacy_setting_see_likes}</span>
</td>
<td>
<select name="likes.read", style="width: 164px;">
<option value="2" {if $user->getPrivacySetting('likes.read') == 2}selected{/if}>{_privacy_value_anybody}</option>
<option value="0" {if $user->getPrivacySetting('likes.read') == 0}selected{/if}>{_privacy_value_only_me_dative}</option>
</select>
</td>
</tr>
<tr> <tr>
<td width="120" valign="top"> <td width="120" valign="top">
<span class="nobold">{_profile_type}</span> <span class="nobold">{_profile_type}</span>

View file

@ -3784,12 +3784,16 @@ hr {
overflow-x: hidden; overflow-x: hidden;
} }
.like_tooltip_wrapper {
box-shadow: 0px 2px 6px -5px rgba(0, 0, 0, 0.8);
}
.like_tooltip_wrapper .like_tooltip_head { .like_tooltip_wrapper .like_tooltip_head {
background: linear-gradient(180deg, #595959, #515151); background: linear-gradient(180deg, #595959, #515151);
box-shadow: 0px 1px 0px 0px rgba(255, 255, 255, 0.18) inset; box-shadow: 0px 1px 0px 0px rgba(255, 255, 255, 0.18) inset;
border: solid 1px #575757; border: solid 1px #575757;
padding: 4px 10px; padding: 4px 10px;
width: 200px; width: 180px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;

View file

@ -886,7 +886,7 @@ async function __uploadToTextarea(file, textareaNode) {
if(filetype == 'photo') { if(filetype == 'photo') {
const temp_url = URL.createObjectURL(file) const temp_url = URL.createObjectURL(file)
const rand = random_int(0, 1000) const rand = random_int(0, 1000)
textareaNode.find('.post-horizontal').append(`<a id='temp_filler${rand}' class="upload-item"><img src='${temp_url}'></a>`) textareaNode.find('.post-horizontal').append(`<a id='temp_filler${rand}' class="upload-item lagged"><img src='${temp_url}'></a>`)
const res = await fetch(`/photos/upload`, { const res = await fetch(`/photos/upload`, {
method: 'POST', method: 'POST',

View file

@ -366,6 +366,11 @@ function check_copyright_link(string $link = ''): bool
return true; return true;
} }
function escape_html(string $unsafe): string
{
return htmlspecialchars($unsafe, ENT_DISALLOWED | ENT_XHTML);
}
return (function() { return (function() {
_ovk_check_environment(); _ovk_check_environment();
require __DIR__ . "/vendor/autoload.php"; require __DIR__ . "/vendor/autoload.php";

View file

@ -698,6 +698,7 @@
"privacy_setting_write_wall" = "Who can publish posts on my wall"; "privacy_setting_write_wall" = "Who can publish posts on my wall";
"privacy_setting_write_messages" = "Who can write messages to me"; "privacy_setting_write_messages" = "Who can write messages to me";
"privacy_setting_view_audio" = "Who can see my audios"; "privacy_setting_view_audio" = "Who can see my audios";
"privacy_setting_see_likes" = "Who can see my likes";
"privacy_value_anybody" = "Anybody"; "privacy_value_anybody" = "Anybody";
"privacy_value_anybody_dative" = "Anybody"; "privacy_value_anybody_dative" = "Anybody";
"privacy_value_users" = "OpenVK users"; "privacy_value_users" = "OpenVK users";
@ -2236,3 +2237,10 @@
"roll_back" = "rollback"; "roll_back" = "rollback";
"roll_backed" = "rollbacked"; "roll_backed" = "rollbacked";
/* RSS */
"post_deact_in_general" = "Page deletion";
"upd_in_general" = "Avatar update";
"on_wall" = "On wall";
"sign_short" = "Sign";

View file

@ -671,6 +671,7 @@
"privacy_setting_write_wall" = "Кто может писать у меня на стене"; "privacy_setting_write_wall" = "Кто может писать у меня на стене";
"privacy_setting_write_messages" = "Кто может писать мне сообщения"; "privacy_setting_write_messages" = "Кто может писать мне сообщения";
"privacy_setting_view_audio" = "Кому видно мои аудиозаписи"; "privacy_setting_view_audio" = "Кому видно мои аудиозаписи";
"privacy_setting_see_likes" = "Кому видны мои лайки";
"privacy_value_anybody" = "Все желающие"; "privacy_value_anybody" = "Все желающие";
"privacy_value_anybody_dative" = "Всем желающим"; "privacy_value_anybody_dative" = "Всем желающим";
"privacy_value_users" = "Пользователям OpenVK"; "privacy_value_users" = "Пользователям OpenVK";
@ -2127,3 +2128,9 @@
"roll_back" = "откатить"; "roll_back" = "откатить";
"roll_backed" = "откачено"; "roll_backed" = "откачено";
/* RSS */
"post_deact_in_general" = "Удаление страницы";
"upd_in_general" = "Обновление фотографии страницы";
"on_wall" = "На стене";
"sign_short" = "Подпись";

View file

@ -1,7 +1,7 @@
.page_header { .page_header {
background-image: url('/themepack/midnight/0.0.3.1/resource/xheader.png') !important; background-image: url('/themepack/midnight/0.0.3.3/resource/xheader.png') !important;
} }
.page_custom_header { .page_custom_header {
background-image: url('/themepack/midnight/0.0.3.1/resource/xheader_custom.png') !important; background-image: url('/themepack/midnight/0.0.3.3/resource/xheader_custom.png') !important;
} }

View file

@ -135,10 +135,18 @@ th,
.ovk-photo-view, .ovk-photo-view,
.page_wrap_content_main .def_row_content, .page_wrap_content_main .def_row_content,
.topGrayBlock, .topGrayBlock,
.bigPlayer { .bigPlayer,
input[type="number"],
.like_tooltip_wrapper .like_tooltip_body,
.like_tooltip_wrapper .like_tooltip_head {
border-color: #2c2640 !important; border-color: #2c2640 !important;
} }
.like_tooltip_wrapper .like_tooltip_head {
background: linear-gradient(180deg, #383052, #231e33) !important;
box-shadow: unset !important;
}
.post-upload, .post-upload,
.post-has-poll, .post-has-poll,
.post-has-note { .post-has-note {
@ -187,10 +195,8 @@ hr {
.ovk-diag-action, .ovk-diag-action,
.minilink .counter, .minilink .counter,
.topGrayBlock, .topGrayBlock,
.showMore, #show_more,
.showMoreAudiosPlaylist, .information {
#showMorePhotos,
#showMoreVideos {
background-color: #2c2640 !important; background-color: #2c2640 !important;
} }
@ -232,7 +238,8 @@ a,
.paginator a:hover, .paginator a:hover,
.post-share-button:hover, .post-share-button:hover,
.post-like-button:hover, .post-like-button:hover,
#search_box_button:active { #search_box_button:active,
.mb_tab:hover {
background-color: #272138 !important; background-color: #272138 !important;
} }
@ -288,7 +295,8 @@ td.e,
tr.e, tr.e,
.playlistListView:hover, .playlistListView:hover,
.playlistListView .playlistCover, .playlistListView .playlistCover,
.photosInsert > div { .photosInsert > div,
.attachment_selector #attachment_insert #attachment_insert_count {
background-color: #231e33 !important; background-color: #231e33 !important;
} }
@ -307,7 +315,8 @@ tr.v,
.expand_button, .expand_button,
#userContent blockquote, #userContent blockquote,
.tippy-box[data-theme~="vk"], .tippy-box[data-theme~="vk"],
.searchOptions { .searchOptions,
.like_tooltip_wrapper .like_tooltip_body {
background-color: #1e1a2b !important; background-color: #1e1a2b !important;
} }
@ -317,11 +326,11 @@ tr.v,
} }
.content_title_expanded { .content_title_expanded {
background-image: url("/themepack/midnight/0.0.3.1/resource/flex_arrow_open.png") !important; background-image: url("/themepack/midnight/0.0.3.3/resource/flex_arrow_open.png") !important;
} }
.content_title_unexpanded { .content_title_unexpanded {
background-image: url("/themepack/midnight/0.0.3.1/resource/flex_arrow_shut.gif") !important; background-image: url("/themepack/midnight/0.0.3.3/resource/flex_arrow_shut.gif") !important;
} }
.ovk-video>.preview, .ovk-video>.preview,
@ -348,17 +357,17 @@ tr.h {
.page_yellowheader { .page_yellowheader {
color: #c6d2e8; color: #c6d2e8;
background-image: url("/themepack/midnight/0.0.3.1/resource/header_purple.png") !important; background-image: url("/themepack/midnight/0.0.3.3/resource/header_purple.png") !important;
background-color: #231f34; background-color: #231f34;
border-color: #231f34; border-color: #231f34;
} }
.page_header { .page_header {
background-image: url("/themepack/midnight/0.0.3.1/resource/header.png") !important; background-image: url("/themepack/midnight/0.0.3.3/resource/header.png") !important;
} }
.page_custom_header { .page_custom_header {
background-image: url("/themepack/midnight/0.0.3.1/resource/header_custom.png") !important; background-image: url("/themepack/midnight/0.0.3.3/resource/header_custom.png") !important;
} }
.page_yellowheader span, .page_yellowheader span,
@ -390,17 +399,18 @@ input[type~="phone"],
input[type="search"], input[type="search"],
input[type~="search"], input[type~="search"],
input[type~="date"], input[type~="date"],
input[type="number"],
select, select,
.crp-entry--message.unread { .crp-entry--message.unread {
background-color: #181826 !important; background-color: #181826 !important;
} }
input[type="checkbox"] { input[type="checkbox"] {
background-image: url("/themepack/midnight/0.0.3.1/resource/checkbox.png") !important; background-image: url("/themepack/midnight/0.0.3.3/resource/checkbox.png") !important;
} }
input[type="radio"] { input[type="radio"] {
background-image: url("/themepack/midnight/0.0.3.1/resource/radio.png") !important; background-image: url("/themepack/midnight/0.0.3.3/resource/radio.png") !important;
} }
.header_navigation .link, .header_navigation .header_divider_stick { .header_navigation .link, .header_navigation .header_divider_stick {
@ -408,20 +418,20 @@ input[type="radio"] {
} }
.heart { .heart {
background-image: url("/themepack/midnight/0.0.3.1/resource/like.gif") !important; background-image: url("/themepack/midnight/0.0.3.3/resource/like.gif") !important;
} }
.pinned-mark, .pinned-mark,
.post-author .pin { .post-author .pin {
background-image: url("/themepack/midnight/0.0.3.1/resource/pin.png") !important; background-image: url("/themepack/midnight/0.0.3.3/resource/pin.png") !important;
} }
.repost-icon { .repost-icon {
background-image: url("/themepack/midnight/0.0.3.1/resource/published.gif") !important; background-image: url("/themepack/midnight/0.0.3.3/resource/published.gif") !important;
} }
.post-author .delete { .post-author .delete {
background-image: url("/themepack/midnight/0.0.3.1/resource/input_clear.gif") !important; background-image: url("/themepack/midnight/0.0.3.3/resource/input_clear.gif") !important;
} }
.user-alert { .user-alert {
@ -454,7 +464,7 @@ input[type="radio"] {
} }
#backdropEditor { #backdropEditor {
background-image: url("/themepack/midnight/0.0.3.1/resource/backdrop-editor.gif") !important; background-image: url("/themepack/midnight/0.0.3.3/resource/backdrop-editor.gif") !important;
border-color: #473e66 !important; border-color: #473e66 !important;
} }

View file

@ -1,5 +1,5 @@
id: midnight id: midnight
version: "0.0.3.1" version: "0.0.3.3"
openvk_version: 0 openvk_version: 0
enabled: 1 enabled: 1
metadata: metadata: