mirror of
https://github.com/openvk/openvk
synced 2024-12-23 09:01:15 +03:00
Merge branch 'OpenVK:master' into update-uk-locale
This commit is contained in:
commit
9da30a07bb
14 changed files with 134 additions and 39 deletions
|
@ -301,7 +301,7 @@ class Post extends Postable
|
|||
{
|
||||
$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();
|
||||
|
||||
foreach($this->getChildren() as $attachment)
|
||||
|
@ -383,34 +383,70 @@ class Post extends Postable
|
|||
{
|
||||
$domain = ovk_scheme(true).$_SERVER["HTTP_HOST"];
|
||||
$description = $this->getText(false);
|
||||
$title = str_replace("\n", "", ovk_proc_strtr($description, 79));
|
||||
$description_html = $description;
|
||||
$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_name = htmlspecialchars($author->getCanonicalName(), ENT_DISALLOWED | ENT_XHTML);
|
||||
$target_wall = $this->getWallOwner();
|
||||
$author_name = escape_html($author->getCanonicalName());
|
||||
if($this->isExplicit())
|
||||
$description_html .= "<br /><b>".tr('contains_nsfw').".</b><br />";
|
||||
$title = 'NSFW: ' . $title;
|
||||
|
||||
foreach($this->getChildren() as $child) {
|
||||
if($child instanceof Photo) {
|
||||
$child_page = $domain.$child->getPageURL();
|
||||
$child_url = $child->getURLBySizeId('large');
|
||||
$description_html .= "<br /><a href='$child_page'><img src='$child_url'></a>";
|
||||
$child_url = $child->getURL();
|
||||
$description_html .= "<br /><a href='$child_page'><img src='$child_url'></a><br />";
|
||||
} elseif($child instanceof Video) {
|
||||
$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) {
|
||||
$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>";
|
||||
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->title(str_replace("\n", "", ovk_proc_strtr($description, 79)))
|
||||
$item->title($title)
|
||||
->url($url)
|
||||
->guid($url)
|
||||
->creator($author_name)
|
||||
|
|
|
@ -97,8 +97,14 @@ abstract class Postable extends Attachable
|
|||
"target" => $this->getRecord()->id,
|
||||
])->page($page, $perPage);
|
||||
|
||||
foreach($sel as $like)
|
||||
yield (new Users)->get($like->origin);
|
||||
foreach($sel as $like) {
|
||||
$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
|
||||
|
|
|
@ -498,6 +498,7 @@ class User extends RowModel
|
|||
"wall.write",
|
||||
"messages.write",
|
||||
"audios.read",
|
||||
"likes.read",
|
||||
],
|
||||
])->get($id);
|
||||
}
|
||||
|
@ -1062,6 +1063,7 @@ class User extends RowModel
|
|||
"wall.write",
|
||||
"messages.write",
|
||||
"audios.read",
|
||||
"likes.read",
|
||||
],
|
||||
])->set($id, $status)->toInteger());
|
||||
}
|
||||
|
@ -1338,6 +1340,11 @@ class User extends RowModel
|
|||
return $this->getId();
|
||||
}
|
||||
|
||||
function isPrivateLikes(): bool
|
||||
{
|
||||
return $this->getPrivacySetting("likes.read") == User::PRIVACY_NO_ONE;
|
||||
}
|
||||
|
||||
function toVkApiStruct(?User $user = NULL, string $fields = ''): object
|
||||
{
|
||||
$res = (object) [];
|
||||
|
|
|
@ -53,9 +53,9 @@ class Posts
|
|||
$offset--;
|
||||
}
|
||||
}
|
||||
} /*else if(!is_null($offset)) {
|
||||
} else if(!is_null($offset) && $pinPost) {
|
||||
$offset--;
|
||||
}*/
|
||||
}
|
||||
|
||||
$sel = $this->posts->where([
|
||||
"wall" => $user,
|
||||
|
|
|
@ -503,6 +503,7 @@ final class UserPresenter extends OpenVKPresenter
|
|||
"wall.write",
|
||||
"messages.write",
|
||||
"audios.read",
|
||||
"likes.read",
|
||||
];
|
||||
foreach($settings as $setting) {
|
||||
$input = $this->postParam(str_replace(".", "_", $setting));
|
||||
|
|
|
@ -395,6 +395,17 @@
|
|||
</select>
|
||||
</td>
|
||||
</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>
|
||||
<td width="120" valign="top">
|
||||
<span class="nobold">{_profile_type}</span>
|
||||
|
|
|
@ -3784,12 +3784,16 @@ hr {
|
|||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.like_tooltip_wrapper {
|
||||
box-shadow: 0px 2px 6px -5px rgba(0, 0, 0, 0.8);
|
||||
}
|
||||
|
||||
.like_tooltip_wrapper .like_tooltip_head {
|
||||
background: linear-gradient(180deg, #595959, #515151);
|
||||
box-shadow: 0px 1px 0px 0px rgba(255, 255, 255, 0.18) inset;
|
||||
border: solid 1px #575757;
|
||||
padding: 4px 10px;
|
||||
width: 200px;
|
||||
width: 180px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
|
|
@ -886,7 +886,7 @@ async function __uploadToTextarea(file, textareaNode) {
|
|||
if(filetype == 'photo') {
|
||||
const temp_url = URL.createObjectURL(file)
|
||||
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`, {
|
||||
method: 'POST',
|
||||
|
|
|
@ -366,6 +366,11 @@ function check_copyright_link(string $link = ''): bool
|
|||
return true;
|
||||
}
|
||||
|
||||
function escape_html(string $unsafe): string
|
||||
{
|
||||
return htmlspecialchars($unsafe, ENT_DISALLOWED | ENT_XHTML);
|
||||
}
|
||||
|
||||
return (function() {
|
||||
_ovk_check_environment();
|
||||
require __DIR__ . "/vendor/autoload.php";
|
||||
|
|
|
@ -698,6 +698,7 @@
|
|||
"privacy_setting_write_wall" = "Who can publish posts on my wall";
|
||||
"privacy_setting_write_messages" = "Who can write messages to me";
|
||||
"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_dative" = "Anybody";
|
||||
"privacy_value_users" = "OpenVK users";
|
||||
|
@ -2236,3 +2237,10 @@
|
|||
|
||||
"roll_back" = "rollback";
|
||||
"roll_backed" = "rollbacked";
|
||||
|
||||
/* RSS */
|
||||
|
||||
"post_deact_in_general" = "Page deletion";
|
||||
"upd_in_general" = "Avatar update";
|
||||
"on_wall" = "On wall";
|
||||
"sign_short" = "Sign";
|
||||
|
|
|
@ -671,6 +671,7 @@
|
|||
"privacy_setting_write_wall" = "Кто может писать у меня на стене";
|
||||
"privacy_setting_write_messages" = "Кто может писать мне сообщения";
|
||||
"privacy_setting_view_audio" = "Кому видно мои аудиозаписи";
|
||||
"privacy_setting_see_likes" = "Кому видны мои лайки";
|
||||
"privacy_value_anybody" = "Все желающие";
|
||||
"privacy_value_anybody_dative" = "Всем желающим";
|
||||
"privacy_value_users" = "Пользователям OpenVK";
|
||||
|
@ -2127,3 +2128,9 @@
|
|||
"roll_back" = "откатить";
|
||||
"roll_backed" = "откачено";
|
||||
|
||||
/* RSS */
|
||||
|
||||
"post_deact_in_general" = "Удаление страницы";
|
||||
"upd_in_general" = "Обновление фотографии страницы";
|
||||
"on_wall" = "На стене";
|
||||
"sign_short" = "Подпись";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.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 {
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -135,10 +135,18 @@ th,
|
|||
.ovk-photo-view,
|
||||
.page_wrap_content_main .def_row_content,
|
||||
.topGrayBlock,
|
||||
.bigPlayer {
|
||||
.bigPlayer,
|
||||
input[type="number"],
|
||||
.like_tooltip_wrapper .like_tooltip_body,
|
||||
.like_tooltip_wrapper .like_tooltip_head {
|
||||
border-color: #2c2640 !important;
|
||||
}
|
||||
|
||||
.like_tooltip_wrapper .like_tooltip_head {
|
||||
background: linear-gradient(180deg, #383052, #231e33) !important;
|
||||
box-shadow: unset !important;
|
||||
}
|
||||
|
||||
.post-upload,
|
||||
.post-has-poll,
|
||||
.post-has-note {
|
||||
|
@ -187,10 +195,8 @@ hr {
|
|||
.ovk-diag-action,
|
||||
.minilink .counter,
|
||||
.topGrayBlock,
|
||||
.showMore,
|
||||
.showMoreAudiosPlaylist,
|
||||
#showMorePhotos,
|
||||
#showMoreVideos {
|
||||
#show_more,
|
||||
.information {
|
||||
background-color: #2c2640 !important;
|
||||
}
|
||||
|
||||
|
@ -232,7 +238,8 @@ a,
|
|||
.paginator a:hover,
|
||||
.post-share-button:hover,
|
||||
.post-like-button:hover,
|
||||
#search_box_button:active {
|
||||
#search_box_button:active,
|
||||
.mb_tab:hover {
|
||||
background-color: #272138 !important;
|
||||
}
|
||||
|
||||
|
@ -288,7 +295,8 @@ td.e,
|
|||
tr.e,
|
||||
.playlistListView:hover,
|
||||
.playlistListView .playlistCover,
|
||||
.photosInsert > div {
|
||||
.photosInsert > div,
|
||||
.attachment_selector #attachment_insert #attachment_insert_count {
|
||||
background-color: #231e33 !important;
|
||||
}
|
||||
|
||||
|
@ -307,7 +315,8 @@ tr.v,
|
|||
.expand_button,
|
||||
#userContent blockquote,
|
||||
.tippy-box[data-theme~="vk"],
|
||||
.searchOptions {
|
||||
.searchOptions,
|
||||
.like_tooltip_wrapper .like_tooltip_body {
|
||||
background-color: #1e1a2b !important;
|
||||
}
|
||||
|
||||
|
@ -317,11 +326,11 @@ tr.v,
|
|||
}
|
||||
|
||||
.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 {
|
||||
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,
|
||||
|
@ -348,17 +357,17 @@ tr.h {
|
|||
|
||||
.page_yellowheader {
|
||||
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;
|
||||
border-color: #231f34;
|
||||
}
|
||||
|
||||
.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 {
|
||||
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,
|
||||
|
@ -390,17 +399,18 @@ input[type~="phone"],
|
|||
input[type="search"],
|
||||
input[type~="search"],
|
||||
input[type~="date"],
|
||||
input[type="number"],
|
||||
select,
|
||||
.crp-entry--message.unread {
|
||||
background-color: #181826 !important;
|
||||
}
|
||||
|
||||
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"] {
|
||||
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 {
|
||||
|
@ -408,20 +418,20 @@ input[type="radio"] {
|
|||
}
|
||||
|
||||
.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,
|
||||
.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 {
|
||||
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 {
|
||||
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 {
|
||||
|
@ -454,7 +464,7 @@ input[type="radio"] {
|
|||
}
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
id: midnight
|
||||
version: "0.0.3.1"
|
||||
version: "0.0.3.3"
|
||||
openvk_version: 0
|
||||
enabled: 1
|
||||
metadata:
|
||||
|
|
Loading…
Reference in a new issue