diff --git a/Web/Models/Entities/Post.php b/Web/Models/Entities/Post.php
index dacced18..30c6eac3 100644
--- a/Web/Models/Entities/Post.php
+++ b/Web/Models/Entities/Post.php
@@ -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 .= "
".tr('contains_nsfw').".
";
+ $title = 'NSFW: ' . $title;
foreach($this->getChildren() as $child) {
if($child instanceof Photo) {
$child_page = $domain.$child->getPageURL();
- $child_url = $child->getURLBySizeId('large');
- $description_html .= "
";
+ $child_url = $child->getURL();
+ $description_html .= "
";
} elseif($child instanceof Video) {
$child_page = $domain.'/video'.$child->getPrettyId();
- $description_html .= "
Video";
+
+ if($child->getType() != 1) {
+ $description_html .= "".
+ "
".
+ "
".
+ "".escape_html($child->getName())."
";
+ } else {
+ $description_html .= "".
+ "
".
+ "getVideoDriver()->getURL()."\">".escape_html($child->getName())."
";
+ }
} elseif($child instanceof Audio) {
- $description_html .= "
Audio";
+ if(!$child->isWithdrawn()) {
+ $description_html .= "
"
+ ."".escape_html($child->getName()).":"
+ ."
"
+ .""
+ ."
";
+ }
+ } elseif($child instanceof Poll) {
+ $description_html .= "
".tr('poll').": ".escape_html($child->getTitle());
+ } elseif($child instanceof Note) {
+ $description_html .= "
".tr('note').": ".escape_html($child->getName());
}
}
$description_html .= "
".tr('author').": " . $author_name . "";
- if($this->hasSource()) {
- $description_html .= "
".tr('source').": ".htmlspecialchars($this->getSource(), ENT_DISALLOWED | ENT_XHTML);
+
+ if($target_wall->getRealId() != $author->getRealId())
+ $description_html .= "
".tr('on_wall').": " . escape_html($target_wall->getCanonicalName()) . "";
+
+ if($this->isSigned()) {
+ $signer = $this->getOwner(false);
+ $description_html .= "
".tr('sign_short').": " . escape_html($signer->getCanonicalName()) . "";
}
+ if($this->hasSource())
+ $description_html .= "
".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)
diff --git a/Web/Models/Entities/Postable.php b/Web/Models/Entities/Postable.php
index 55e1adf7..fc6cb8ca 100644
--- a/Web/Models/Entities/Postable.php
+++ b/Web/Models/Entities/Postable.php
@@ -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
diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php
index 1e17dd82..a0574f3d 100644
--- a/Web/Models/Entities/User.php
+++ b/Web/Models/Entities/User.php
@@ -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) [];
diff --git a/Web/Models/Repositories/Posts.php b/Web/Models/Repositories/Posts.php
index da1f9c8d..f5fef282 100644
--- a/Web/Models/Repositories/Posts.php
+++ b/Web/Models/Repositories/Posts.php
@@ -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,
diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php
index b64823fb..4c6bb0dd 100644
--- a/Web/Presenters/UserPresenter.php
+++ b/Web/Presenters/UserPresenter.php
@@ -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));
diff --git a/Web/Presenters/templates/User/Settings.xml b/Web/Presenters/templates/User/Settings.xml
index d34993e8..244c52c4 100644
--- a/Web/Presenters/templates/User/Settings.xml
+++ b/Web/Presenters/templates/User/Settings.xml
@@ -395,6 +395,17 @@
+