diff --git a/Web/Models/Entities/Post.php b/Web/Models/Entities/Post.php index dacced18..0b210fb0 100644 --- a/Web/Models/Entities/Post.php +++ b/Web/Models/Entities/Post.php @@ -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/bootstrap.php b/bootstrap.php index f4d8958e..e964af81 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -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"; diff --git a/locales/en.strings b/locales/en.strings index 527323da..0056c076 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -2236,3 +2236,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"; diff --git a/locales/ru.strings b/locales/ru.strings index 4385b6cd..cd1c4ddf 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -2127,3 +2127,9 @@ "roll_back" = "откатить"; "roll_backed" = "откачено"; +/* RSS */ + +"post_deact_in_general" = "Удаление страницы"; +"upd_in_general" = "Обновление фотографии страницы"; +"on_wall" = "На стене"; +"sign_short" = "Подпись";