Compare commits

..

No commits in common. "1bf662c5e2a13d43eec2dd5cea5a661e31d13143" and "4ec6ceca8ed7de127110cea3d27e6abf310ad456" have entirely different histories.

24 changed files with 536 additions and 243 deletions

View file

@ -183,7 +183,7 @@ final class Account extends VKAPIRequestHandler
{ {
$this->requireUser(); $this->requireUser();
if (!OPENVK_ROOT_CONF['openvk']['preferences']['commerce']) { if (!OPENVK_ROOT_CONF['openvk']['preferences']['commerce']) {
$this->fail(-105, "Commerce is disabled on this instance"); $this->fail(105, "Commerce is disabled on this instance");
} }
return (object) ['votes' => $this->getUser()->getCoins()]; return (object) ['votes' => $this->getUser()->getCoins()];

View file

@ -14,7 +14,7 @@ use openvk\Web\Models\Entities\{Topic, Comment, User, Photo, Video};
final class Board extends VKAPIRequestHandler final class Board extends VKAPIRequestHandler
{ {
public function addTopic(int $group_id, string $title, string $text = null, bool $from_group = true) public function addTopic(int $group_id, string $title, string $text = "", bool $from_group = true)
{ {
$this->requireUser(); $this->requireUser();
$this->willExecuteWriteAction(); $this->willExecuteWriteAction();
@ -30,7 +30,6 @@ final class Board extends VKAPIRequestHandler
} }
$flags = 0; $flags = 0;
if ($from_group == true && $club->canBeModifiedBy($this->getUser())) { if ($from_group == true && $club->canBeModifiedBy($this->getUser())) {
$flags |= 0b10000000; $flags |= 0b10000000;
} }
@ -41,10 +40,8 @@ final class Board extends VKAPIRequestHandler
$topic->setTitle(ovk_proc_strtr($title, 127)); $topic->setTitle(ovk_proc_strtr($title, 127));
$topic->setCreated(time()); $topic->setCreated(time());
$topic->setFlags($flags); $topic->setFlags($flags);
$topic->save(); $topic->save();
try {
if (!empty($text)) { if (!empty($text)) {
$comment = new Comment(); $comment = new Comment();
$comment->setOwner($this->getUser()->getId()); $comment->setOwner($this->getUser()->getId());
@ -53,12 +50,8 @@ final class Board extends VKAPIRequestHandler
$comment->setContent($text); $comment->setContent($text);
$comment->setCreated(time()); $comment->setCreated(time());
$comment->setFlags($flags); $comment->setFlags($flags);
$comment->save(); $comment->save();
} }
} catch(\Throwable $e) {
return $topic->getId();
}
return $topic->getId(); return $topic->getId();
} }
@ -82,35 +75,32 @@ final class Board extends VKAPIRequestHandler
return 1; return 1;
} }
public function createComment(int $group_id, int $topic_id, string $message = "", bool $from_group = true) public function createComment(int $group_id, int $topic_id, string $message = "", string $attachments = "", bool $from_group = true)
{ {
$this->requireUser(); $this->requireUser();
$this->willExecuteWriteAction(); $this->willExecuteWriteAction();
if (empty($message)) { if (empty($message) && empty($attachments)) {
$this->fail(100, "Required parameter 'message' missing."); $this->fail(100, "Required parameter 'message' missing.");
} }
$topic = (new TopicsRepo())->getTopicById($group_id, $topic_id); $topic = (new TopicsRepo())->getTopicById($group_id, $topic_id);
if (!$topic || $topic->isDeleted() || $topic->isClosed()) { if (!$topic || $topic->isDeleted() || $topic->isClosed()) {
$this->fail(15, "Access denied"); $this->fail(15, "Access denied");
} }
$flags = 0; $flags = 0;
if ($from_group != 0 && ($topic->getClub()->canBeModifiedBy($this->user))) { if ($from_group != 0 && !is_null($topic->getClub()) && $topic->getClub()->canBeModifiedBy($this->user)) {
$flags |= 0b10000000; $flags |= 0b10000000;
} }
$comment = new Comment(); $comment = new Comment();
$comment->setOwner($this->getUser()->getId()); $comment->setOwner($this->getUser()->getId());
$comment->setModel(get_class($topic)); $comment->setModel(get_class($topic));
$comment->setTarget($topic->getId()); $comment->setTarget($topic->getId());
$comment->setContent($message); $comment->setContent($message);
$comment->setCreated(time()); $comment->setCreated(time());
$comment->setFlags($flags); $comment->setFlags($flags);
$comment->save(); $comment->save();
return $comment->getId(); return $comment->getId();
@ -123,7 +113,7 @@ final class Board extends VKAPIRequestHandler
$topic = (new TopicsRepo())->getTopicById($group_id, $topic_id); $topic = (new TopicsRepo())->getTopicById($group_id, $topic_id);
if (!$topic || $topic->isDeleted() || !$topic->getClub()->canBeModifiedBy($this->getUser())) { if (!$topic || !$topic->getClub() || $topic->isDeleted() || !$topic->getClub()->canBeModifiedBy($this->getUser())) {
return 0; return 0;
} }
@ -139,7 +129,7 @@ final class Board extends VKAPIRequestHandler
$topic = (new TopicsRepo())->getTopicById($group_id, $topic_id); $topic = (new TopicsRepo())->getTopicById($group_id, $topic_id);
if (!$topic || $topic->isDeleted() || !$topic->canBeModifiedBy($this->getUser())) { if (!$topic || !$topic->getClub() || $topic->isDeleted() || !$topic->getClub()->canBeModifiedBy($this->getUser())) {
return 0; return 0;
} }
@ -157,7 +147,7 @@ final class Board extends VKAPIRequestHandler
$topic = (new TopicsRepo())->getTopicById($group_id, $topic_id); $topic = (new TopicsRepo())->getTopicById($group_id, $topic_id);
if (!$topic || !$topic->getClub()->canBeModifiedBy($this->getUser())) { if (!$topic || !$topic->getClub() || !$topic->getClub()->canBeModifiedBy($this->getUser())) {
return 0; return 0;
} }
@ -168,92 +158,75 @@ final class Board extends VKAPIRequestHandler
return 1; return 1;
} }
public function getComments(int $group_id, int $topic_id, bool $need_likes = false, int $offset = 0, int $count = 10, bool $extended = false) public function getComments(int $group_id, int $topic_id, bool $need_likes = false, int $start_comment_id = 0, int $offset = 0, int $count = 40, bool $extended = false, string $sort = "asc")
{ {
# start_comment_id ne robit
$this->requireUser(); $this->requireUser();
if ($count < 1 || $count > 100) {
$this->fail(4, "Invalid count");
}
$topic = (new TopicsRepo())->getTopicById($group_id, $topic_id); $topic = (new TopicsRepo())->getTopicById($group_id, $topic_id);
if (!$topic || $topic->isDeleted()) { if (!$topic || !$topic->getClub() || $topic->isDeleted()) {
$this->fail(5, "Not found"); $this->fail(5, "Invalid topic");
} }
$obj = (object) [ $arr = [
"items" => [] "items" => [],
]; ];
if ($extended) { $comms = array_slice(iterator_to_array($topic->getComments(1, $count + $offset)), $offset);
$obj->profiles = []; foreach ($comms as $comm) {
$obj->groups = []; $arr["items"][] = $this->getApiBoardComment($comm, $need_likes);
}
$comments = array_slice(iterator_to_array($topic->getComments(1, $count + $offset)), $offset);
foreach ($comments as $comment) {
$obj->items[] = $comment->toVkApiStruct($this->getUser(), $need_likes);
if ($extended) { if ($extended) {
$owner = $comment->getOwner(); if ($comm->getOwner() instanceof \openvk\Web\Models\Entities\User) {
$arr["profiles"][] = $comm->getOwner()->toVkApiStruct();
if ($owner instanceof \openvk\Web\Models\Entities\User) {
$obj->profiles[] = $owner->toVkApiStruct();
} }
if ($owner instanceof \openvk\Web\Models\Entities\Club) { if ($comm->getOwner() instanceof \openvk\Web\Models\Entities\Club) {
$obj->groups[] = $owner->toVkApiStruct(); $arr["groups"][] = $comm->getOwner()->toVkApiStruct();
} }
} }
} }
return $obj; return $arr;
} }
public function getTopics(int $group_id, string $topic_ids = "", int $offset = 0, int $count = 10, bool $extended = false, int $preview = 0, int $preview_length = 90) public function getTopics(int $group_id, string $topic_ids = "", int $order = 1, int $offset = 0, int $count = 40, bool $extended = false, int $preview = 0, int $preview_length = 90)
{ {
# TODO: $extended # order и extended ничё не делают
$this->requireUser(); $this->requireUser();
if ($count < 1 || $count > 100) { $arr = [];
$this->fail(4, "Invalid count");
}
$obj = (object)[];
$club = (new ClubsRepo())->get($group_id); $club = (new ClubsRepo())->get($group_id);
if (!$club || !$club->canBeViewedBy($this->getUser())) {
$this->fail(15, "Access denied");
}
$topics = array_slice(iterator_to_array((new TopicsRepo())->getClubTopics($club, 1, $count + $offset)), $offset); $topics = array_slice(iterator_to_array((new TopicsRepo())->getClubTopics($club, 1, $count + $offset)), $offset);
$arr["count"] = (new TopicsRepo())->getClubTopicsCount($club);
$obj->count = (new TopicsRepo())->getClubTopicsCount($club); $arr["items"] = [];
$obj->items = []; $arr["default_order"] = $order;
$obj->profiles = []; $arr["can_add_topics"] = $club->canBeModifiedBy($this->getUser()) ? true : ($club->isEveryoneCanCreateTopics() ? true : false);
$obj->can_add_topics = $club->canBeModifiedBy($this->getUser()) ? true : ($club->isEveryoneCanCreateTopics() ? true : false); $arr["profiles"] = [];
if (empty($topic_ids)) { if (empty($topic_ids)) {
foreach ($topics as $topic) { foreach ($topics as $topic) {
$obj->items[] = $topic->toVkApiStruct($preview, $preview_length > 1 ? $preview_length : 90); if ($topic->isDeleted()) {
continue;
}
$arr["items"][] = $topic->toVkApiStruct($preview, $preview_length > 1 ? $preview_length : 90);
} }
} else { } else {
$topics = explode(',', $topic_ids); $topics = explode(',', $topic_ids);
foreach ($topics as $topic_id) { foreach ($topics as $topic) {
$topic = (new TopicsRepo())->getTopicById($group_id, (int) $topic_id); $id = explode("_", $topic);
$topicy = (new TopicsRepo())->getTopicById((int) $id[0], (int) $id[1]);
if ($topic && !$topic->isDeleted()) { if ($topicy && !$topicy->isDeleted()) {
$obj->items[] = $topic->toVkApiStruct($preview, $preview_length > 1 ? $preview_length : 90); $arr["items"][] = $topicy->toVkApiStruct($preview, $preview_length > 1 ? $preview_length : 90);
} }
} }
} }
return $obj; return $arr;
} }
public function openTopic(int $group_id, int $topic_id) public function openTopic(int $group_id, int $topic_id)
@ -263,7 +236,7 @@ final class Board extends VKAPIRequestHandler
$topic = (new TopicsRepo())->getTopicById($group_id, $topic_id); $topic = (new TopicsRepo())->getTopicById($group_id, $topic_id);
if (!$topic || !$topic->isDeleted() || !$topic->getClub()->canBeModifiedBy($this->getUser())) { if (!$topic || !$topic->getClub() || !$topic->isDeleted() || !$topic->getClub()->canBeModifiedBy($this->getUser())) {
return 0; return 0;
} }
@ -275,6 +248,11 @@ final class Board extends VKAPIRequestHandler
return 1; return 1;
} }
public function restoreComment(int $group_id, int $topic_id, int $comment_id)
{
$this->fail(501, "Not implemented");
}
public function unfixTopic(int $group_id, int $topic_id) public function unfixTopic(int $group_id, int $topic_id)
{ {
$this->requireUser(); $this->requireUser();
@ -282,7 +260,7 @@ final class Board extends VKAPIRequestHandler
$topic = (new TopicsRepo())->getTopicById($group_id, $topic_id); $topic = (new TopicsRepo())->getTopicById($group_id, $topic_id);
if (!$topic || !$topic->getClub()->canBeModifiedBy($this->getUser())) { if (!$topic || !$topic->getClub() || !$topic->getClub()->canBeModifiedBy($this->getUser())) {
return 0; return 0;
} }
@ -297,4 +275,33 @@ final class Board extends VKAPIRequestHandler
return 1; return 1;
} }
private function getApiBoardComment(?Comment $comment, bool $need_likes = false)
{
$res = (object) [];
$res->id = $comment->getId();
$res->from_id = $comment->getOwner()->getId();
$res->date = $comment->getPublicationTime()->timestamp();
$res->text = $comment->getText(false);
$res->attachments = [];
$res->likes = [];
if ($need_likes) {
$res->likes = [
"count" => $comment->getLikesCount(),
"user_likes" => (int) $comment->hasLikeFrom($this->getUser()),
"can_like" => 1, # а чё типо не может ахахаххахах
];
}
foreach ($comment->getChildren() as $attachment) {
if ($attachment->isDeleted()) {
continue;
}
$res->attachments[] = $attachment->toVkApiStruct();
}
return $res;
}
} }

View file

@ -10,32 +10,47 @@ use openvk\Web\Models\Entities\Notifications\GiftNotification;
final class Gifts extends VKAPIRequestHandler final class Gifts extends VKAPIRequestHandler
{ {
public function get(int $user_id = 0, int $count = 10, int $offset = 0) public function get(int $user_id = null, int $count = 10, int $offset = 0)
{ {
# There is no extended :)
$this->requireUser(); $this->requireUser();
$i = 0;
$i += $offset;
$server_url = ovk_scheme(true) . $_SERVER["HTTP_HOST"]; $server_url = ovk_scheme(true) . $_SERVER["HTTP_HOST"];
if ($user_id < 1) { if ($user_id) {
$user_id = $this->getUser()->getId(); $user = (new UsersRepo())->get($user_id);
} else {
$user = $this->getUser();
} }
$user = (new UsersRepo())->get($user_id);
if (!$user || $user->isDeleted()) { if (!$user || $user->isDeleted()) {
$this->fail(15, "Access denied"); $this->fail(177, "Invalid user");
} }
if (!$user->canBeViewedBy($this->getUser())) { if (!$user->canBeViewedBy($this->getUser())) {
$this->fail(15, "Access denied"); $this->fail(15, "Access denied");
} }
$gift_item = []; /*
$user_gifts = array_slice(iterator_to_array($user->getGifts(1, $count)), $offset, $count); if(!$user->getPrivacyPermission('gifts.read', $this->getUser()))
$this->fail(15, "Access denied: this user chose to hide his gifts");*/
foreach ($user_gifts as $gift) {
if (!$user->canBeViewedBy($this->getUser())) {
$this->fail(15, "Access denied");
}
$gift_item = [];
$userGifts = array_slice(iterator_to_array($user->getGifts(1, $count, false)), $offset);
if (sizeof($userGifts) < 0) {
return null;
}
foreach ($userGifts as $gift) {
if ($i < $count) {
$gift_item[] = [ $gift_item[] = [
"id" => $i, "id" => $i,
"from_id" => $gift->anon == true ? 0 : $gift->sender->getId(), "from_id" => $gift->anon == true ? 0 : $gift->sender->getId(),
@ -47,8 +62,11 @@ final class Gifts extends VKAPIRequestHandler
"thumb_96" => $server_url . $gift->gift->getImage(2), "thumb_96" => $server_url . $gift->gift->getImage(2),
"thumb_48" => $server_url . $gift->gift->getImage(2), "thumb_48" => $server_url . $gift->gift->getImage(2),
], ],
"privacy" => 0,
]; ];
} }
$i += 1;
}
return $gift_item; return $gift_item;
} }
@ -58,14 +76,14 @@ final class Gifts extends VKAPIRequestHandler
$this->requireUser(); $this->requireUser();
$this->willExecuteWriteAction(); $this->willExecuteWriteAction();
$user = (new UsersRepo())->get((int) $user_ids);
if (!OPENVK_ROOT_CONF['openvk']['preferences']['commerce']) { if (!OPENVK_ROOT_CONF['openvk']['preferences']['commerce']) {
$this->fail(-105, "Commerce is disabled on this instance"); $this->fail(105, "Commerce is disabled on this instance");
} }
$user = (new UsersRepo())->get((int) $user_ids); # FAKE прогноз погоды (в данном случае user_ids)
if (!$user || $user->isDeleted()) { if (!$user || $user->isDeleted()) {
$this->fail(15, "Access denied"); $this->fail(177, "Invalid user");
} }
if (!$user->canBeViewedBy($this->getUser())) { if (!$user->canBeViewedBy($this->getUser())) {
@ -75,7 +93,7 @@ final class Gifts extends VKAPIRequestHandler
$gift = (new GiftsRepo())->get($gift_id); $gift = (new GiftsRepo())->get($gift_id);
if (!$gift) { if (!$gift) {
$this->fail(15, "Invalid gift"); $this->fail(165, "Invalid gift");
} }
$price = $gift->getPrice(); $price = $gift->getPrice();
@ -116,17 +134,24 @@ final class Gifts extends VKAPIRequestHandler
]; ];
} }
public function getCategories(bool $extended = false, int $page = 1) public function delete()
{ {
$this->requireUser(); $this->requireUser();
$this->willExecuteWriteAction();
$this->fail(501, "Not implemented");
}
# в vk кстати называется gifts.getCatalog
public function getCategories(bool $extended = false, int $page = 1)
{
$cats = (new GiftsRepo())->getCategories($page); $cats = (new GiftsRepo())->getCategories($page);
$categ = []; $categ = [];
$i = 0; $i = 0;
$server_url = ovk_scheme(true) . $_SERVER["HTTP_HOST"]; $server_url = ovk_scheme(true) . $_SERVER["HTTP_HOST"];
if (!OPENVK_ROOT_CONF['openvk']['preferences']['commerce']) { if (!OPENVK_ROOT_CONF['openvk']['preferences']['commerce']) {
$this->fail(-105, "Commerce is disabled on this instance"); $this->fail(105, "Commerce is disabled on this instance");
} }
foreach ($cats as $cat) { foreach ($cats as $cat) {
@ -159,19 +184,17 @@ final class Gifts extends VKAPIRequestHandler
$this->requireUser(); $this->requireUser();
if (!OPENVK_ROOT_CONF['openvk']['preferences']['commerce']) { if (!OPENVK_ROOT_CONF['openvk']['preferences']['commerce']) {
$this->fail(-105, "Commerce is disabled on this instance"); $this->fail(105, "Commerce is disabled on this instance");
} }
$gift_category = (new GiftsRepo())->getCat($id); if (!(new GiftsRepo())->getCat($id)) {
$this->fail(177, "Category not found");
if (!$gift_category) {
$this->fail(15, "Category not found");
} }
$gifts_list = $gift_category->getGifts($page); $giftz = ((new GiftsRepo())->getCat($id))->getGifts($page);
$gifts = []; $gifts = [];
foreach ($gifts_list as $gift) { foreach ($giftz as $gift) {
$gifts[] = [ $gifts[] = [
"name" => $gift->getName(), "name" => $gift->getName(),
"image" => $gift->getImage(2), "image" => $gift->getImage(2),

View file

@ -107,6 +107,7 @@ final class Groups extends VKAPIRequestHandler
$backgrounds = $usr->getBackDropPictureURLs(); $backgrounds = $usr->getBackDropPictureURLs();
$rClubs[$i]->background = $backgrounds; $rClubs[$i]->background = $backgrounds;
break; break;
# unstandard feild
case "suggested_count": case "suggested_count":
if ($usr->getWallType() != 2) { if ($usr->getWallType() != 2) {
$rClubs[$i]->suggested_count = null; $rClubs[$i]->suggested_count = null;
@ -334,6 +335,23 @@ final class Groups extends VKAPIRequestHandler
return 1; return 1;
} }
public function create(string $title, string $description = "", string $type = "group", int $public_category = 1, int $public_subcategory = 1, int $subtype = 1)
{
$this->requireUser();
$this->willExecuteWriteAction();
$club = new Club();
$club->setName($title);
$club->setAbout($description);
$club->setOwner($this->getUser()->getId());
$club->save();
$club->toggleSubscription($this->getUser());
return $this->getById((string) $club->getId());
}
public function edit( public function edit(
int $group_id, int $group_id,
string $title = null, string $title = null,
@ -353,15 +371,13 @@ final class Groups extends VKAPIRequestHandler
$club = (new ClubsRepo())->get($group_id); $club = (new ClubsRepo())->get($group_id);
if (!$club) { if (!$club) {
$this->fail(15, "Access denied"); $this->fail(203, "Club not found");
} }
if (!$club || !$club->canBeModifiedBy($this->getUser())) { if (!$club || !$club->canBeModifiedBy($this->getUser())) {
$this->fail(15, "Access denied"); $this->fail(15, "You can't modify this group.");
} }
if (!empty($screen_name) && !$club->setShortcode($screen_name)) { if (!empty($screen_name) && !$club->setShortcode($screen_name)) {
$this->fail(103, "Invalid screen_name"); $this->fail(103, "Invalid shortcode.");
} }
!empty($title) ? $club->setName($title) : null; !empty($title) ? $club->setName($title) : null;
@ -388,86 +404,260 @@ final class Groups extends VKAPIRequestHandler
try { try {
$club->save(); $club->save();
} catch (\TypeError $e) { } catch (\TypeError $e) {
return 1; $this->fail(15, "Nothing changed");
} catch (\Exception $e) { } catch (\Exception $e) {
return 0; $this->fail(18, "An unknown error occurred: maybe you set an incorrect value?");
} }
return 1; return 1;
} }
public function getMembers(int $group_id, int $offset = 0, int $count = 10, string $fields = "") public function getMembers(string $group_id, string $sort = "id_asc", int $offset = 0, int $count = 100, string $fields = "", string $filter = "any")
{ {
$this->requireUser(); # bdate,can_post,can_see_all_posts,can_see_audio,can_write_private_message,city,common_count,connections,contacts,country,domain,education,has_mobile,last_seen,lists,online,online_mobile,photo_100,photo_200,photo_200_orig,photo_400_orig,photo_50,photo_max,photo_max_orig,relation,relatives,schools,sex,site,status,universities
$club = (new ClubsRepo())->get((int) $group_id);
$club = (new ClubsRepo())->get($group_id); if (!$club) {
$this->fail(125, "Invalid group id");
if (!$club || !$club->canBeViewedBy($this->getUser())) {
$this->fail(15, "Access denied");
} }
$sort_string = "follower ASC"; $sorter = "follower ASC";
$members = array_slice(iterator_to_array($club->getFollowers(1, $count, $sort_string)), $offset, $count);
$obj = (object) [ switch ($sort) {
"count" => sizeof($members), default:
"items" => [] case "time_asc":
case "id_asc":
$sorter = "follower ASC";
break;
case "time_desc":
case "id_desc":
$sorter = "follower DESC";
break;
}
$members = array_slice(iterator_to_array($club->getFollowers(1, $count, $sorter)), $offset);
$arr = (object) [
"count" => count($members),
"items" => []];
$filds = explode(",", $fields);
$i = 0;
foreach ($members as $member) {
if ($i > $count) {
break;
}
$arr->items[] = (object) [
"id" => $member->getId(),
"first_name" => $member->getFirstName(),
"last_name" => $member->getLastName(),
]; ];
foreach ($members as $member) { foreach ($filds as $fild) {
$obj->items[] = $member->toVkApiStruct($this->getUser(), $fields); $canView = $member->canBeViewedBy($this->getUser());
switch ($fild) {
case "bdate":
if (!$canView) {
$arr->items[$i]->bdate = "01.01.1970";
break;
} }
return $obj; $arr->items[$i]->bdate = $member->getBirthday() ? $member->getBirthday()->format('%e.%m.%Y') : null;
break;
case "can_post":
$arr->items[$i]->can_post = $club->canBeModifiedBy($member);
break;
case "can_see_all_posts":
$arr->items[$i]->can_see_all_posts = 1;
break;
case "can_see_audio":
$arr->items[$i]->can_see_audio = 1;
break;
case "can_write_private_message":
$arr->items[$i]->can_write_private_message = 0;
break;
case "common_count":
$arr->items[$i]->common_count = 420;
break;
case "connections":
$arr->items[$i]->connections = 1;
break;
case "contacts":
if (!$canView) {
$arr->items[$i]->contacts = "secret@gmail.com";
break;
}
$arr->items[$i]->contacts = $member->getContactEmail();
break;
case "country":
$arr->items[$i]->country = 1;
break;
case "domain":
$arr->items[$i]->domain = "";
break;
case "education":
$arr->items[$i]->education = "";
break;
case "has_mobile":
$arr->items[$i]->has_mobile = false;
break;
case "last_seen":
if (!$canView) {
$arr->items[$i]->last_seen = 0;
break;
}
$arr->items[$i]->last_seen = $member->getOnline()->timestamp();
break;
case "lists":
$arr->items[$i]->lists = "";
break;
case "online":
if (!$canView) {
$arr->items[$i]->online = false;
break;
}
$arr->items[$i]->online = $member->isOnline();
break;
case "online_mobile":
if (!$canView) {
$arr->items[$i]->online_mobile = false;
break;
}
$arr->items[$i]->online_mobile = $member->getOnlinePlatform() == "android" || $member->getOnlinePlatform() == "iphone" || $member->getOnlinePlatform() == "mobile";
break;
case "photo_100":
$arr->items[$i]->photo_100 = $member->getAvatarURL("tiny");
break;
case "photo_200":
$arr->items[$i]->photo_200 = $member->getAvatarURL("normal");
break;
case "photo_200_orig":
$arr->items[$i]->photo_200_orig = $member->getAvatarURL("normal");
break;
case "photo_400_orig":
$arr->items[$i]->photo_400_orig = $member->getAvatarURL("normal");
break;
case "photo_max":
$arr->items[$i]->photo_max = $member->getAvatarURL("original");
break;
case "photo_max_orig":
$arr->items[$i]->photo_max_orig = $member->getAvatarURL();
break;
case "relation":
$arr->items[$i]->relation = $member->getMaritalStatus();
break;
case "relatives":
$arr->items[$i]->relatives = 0;
break;
case "schools":
$arr->items[$i]->schools = 0;
break;
case "sex":
if (!$canView) {
$arr->items[$i]->sex = -1;
break;
}
$arr->items[$i]->sex = $member->isFemale() ? 1 : 2;
break;
case "site":
if (!$canView) {
$arr->items[$i]->site = null;
break;
}
$arr->items[$i]->site = $member->getWebsite();
break;
case "status":
if (!$canView) {
$arr->items[$i]->status = "r";
break;
}
$arr->items[$i]->status = $member->getStatus();
break;
case "universities":
$arr->items[$i]->universities = 0;
break;
}
}
$i++;
}
return $arr;
} }
public function getSettings(string $group_id) public function getSettings(string $group_id)
{ {
$this->requireUser(); $this->requireUser();
$club = (new ClubsRepo())->get((int) $group_id); $club = (new ClubsRepo())->get((int) $group_id);
if (!$club || !$club->canBeModifiedBy($this->getUser())) { if (!$club || !$club->canBeModifiedBy($this->getUser())) {
$this->fail(15, "Access denied"); $this->fail(15, "You can't get settings of this group.");
} }
$arr = (object) [ $arr = (object) [
"title" => $club->getName(), "title" => $club->getName(),
"description" => $club->getDescription(), "description" => $club->getDescription() != null ? $club->getDescription() : "",
"address" => $club->getShortcode(), "address" => $club->getShortcode(),
"wall" => $club->getWallType(), # is different from vk values "wall" => $club->getWallType(), # отличается от вкшных но да ладно
"photos" => 1, "photos" => 1,
"video" => 0, "video" => 0,
"audio" => $club->isEveryoneCanUploadAudios() ? 1 : 0, "audio" => $club->isEveryoneCanUploadAudios() ? 1 : 0,
"docs" => 1, "docs" => 0,
"topics" => $club->isEveryoneCanCreateTopics() == true ? 1 : 0, "topics" => $club->isEveryoneCanCreateTopics() == true ? 1 : 0,
"wiki" => 0,
"messages" => 0,
"obscene_filter" => 0,
"obscene_stopwords" => 0,
"obscene_words" => "",
"access" => 1,
"subject" => 1,
"subject_list" => [
0 => "в",
1 => "опенвк",
2 => "нет",
3 => "категорий",
4 => "групп",
],
"rss" => "/club" . $club->getId() . "/rss",
"website" => $club->getWebsite(), "website" => $club->getWebsite(),
"age_limits" => 0,
"market" => [],
]; ];
return $arr; return $arr;
} }
public function isMember(string $group_id, int $user_id, int $extended = 0) public function isMember(string $group_id, int $user_id, string $user_ids = "", bool $extended = false)
{ {
$this->requireUser(); $this->requireUser();
$id = $user_id != null ? $user_id : explode(",", $user_ids);
$input_club = (new ClubsRepo())->get(abs((int) $group_id)); if ($group_id < 0) {
$input_user = (new UsersRepo())->get(abs((int) $user_id)); $this->fail(228, "Remove the minus from group_id");
if (!$input_club || !$input_club->canBeViewedBy($this->getUser())) {
$this->fail(15, "Access denied");
} }
if (!$input_user || $input_user->isDeleted()) { $club = (new ClubsRepo())->get((int) $group_id);
$this->fail(15, "Not found"); $usver = (new UsersRepo())->get((int) $id);
if (!$club || $group_id == 0) {
$this->fail(203, "Invalid club");
} }
if ($extended == 0) { if (!$usver || $usver->isDeleted() || $user_id == 0) {
return $input_club->getSubscriptionStatus($input_user) ? 1 : 0; $this->fail(30, "Invalid user");
}
if ($extended == false) {
return $club->getSubscriptionStatus($usver) ? 1 : 0;
} else { } else {
return (object) return (object)
[ [
"member" => $input_club->getSubscriptionStatus($input_user) ? 1 : 0, "member" => $club->getSubscriptionStatus($usver) ? 1 : 0,
"request" => 0, "request" => 0,
"invitation" => 0, "invitation" => 0,
"can_invite" => 0, "can_invite" => 0,
@ -475,4 +665,11 @@ final class Groups extends VKAPIRequestHandler
]; ];
} }
} }
public function remove(int $group_id, int $user_id)
{
$this->requireUser();
$this->fail(501, "Not implemented");
}
} }

View file

@ -118,14 +118,7 @@ final class Likes extends VKAPIRequestHandler
} }
if (!$user->canBeViewedBy($this->getUser())) { if (!$user->canBeViewedBy($this->getUser())) {
$this->fail(15, "Access denied"); $this->fail(1984, "Access denied: you can't see this user");
}
if ($user->isPrivateLikes()) {
return (object) [
"liked" => 1,
"copied" => 1,
];
} }
$postable = null; $postable = null;

View file

@ -13,49 +13,38 @@ use openvk\Web\Models\Entities\{Note, Comment};
final class Notes extends VKAPIRequestHandler final class Notes extends VKAPIRequestHandler
{ {
public function add(string $title, string $text) public function add(string $title, string $text, int $privacy = 0, int $comment_privacy = 0, string $privacy_view = "", string $privacy_comment = "")
{ {
$this->requireUser(); $this->requireUser();
$this->willExecuteWriteAction(); $this->willExecuteWriteAction();
if (empty($title)) {
$this->fail(100, "Required parameter 'title' missing.");
}
$note = new Note(); $note = new Note();
$note->setOwner($this->getUser()->getId()); $note->setOwner($this->getUser()->getId());
$note->setCreated(time()); $note->setCreated(time());
$note->setName($title); $note->setName($title);
$note->setSource($text); $note->setSource($text);
$note->setEdited(time()); $note->setEdited(time());
$note->save(); $note->save();
return $note->getVirtualId(); return $note->getVirtualId();
} }
public function createComment(int $note_id, int $owner_id, string $message, string $attachments = "") public function createComment(string $note_id, int $owner_id, string $message, int $reply_to = 0, string $attachments = "")
{ {
$this->requireUser(); $this->requireUser();
$this->willExecuteWriteAction(); $this->willExecuteWriteAction();
$note = (new NotesRepo())->getNoteById((int) $owner_id, (int) $note_id);
if (empty($message)) {
$this->fail(100, "Required parameter 'message' missing.");
}
$note = (new NotesRepo())->getNoteById($owner_id, $note_id);
if (!$note) { if (!$note) {
$this->fail(15, "Access denied"); $this->fail(180, "Note not found");
} }
if ($note->isDeleted()) { if ($note->isDeleted()) {
$this->fail(15, "Access denied"); $this->fail(189, "Note is deleted");
} }
if ($note->getOwner()->isDeleted()) { if ($note->getOwner()->isDeleted()) {
$this->fail(15, "Access denied"); $this->fail(403, "Owner is deleted");
} }
if (!$note->canBeViewedBy($this->getUser())) { if (!$note->canBeViewedBy($this->getUser())) {
@ -63,7 +52,11 @@ final class Notes extends VKAPIRequestHandler
} }
if (!$note->getOwner()->getPrivacyPermission('notes.read', $this->getUser())) { if (!$note->getOwner()->getPrivacyPermission('notes.read', $this->getUser())) {
$this->fail(15, "Access denied"); $this->fail(43, "No access");
}
if (empty($message) && empty($attachments)) {
$this->fail(100, "Required parameter 'message' missing.");
} }
$comment = new Comment(); $comment = new Comment();
@ -74,9 +67,78 @@ final class Notes extends VKAPIRequestHandler
$comment->setCreated(time()); $comment->setCreated(time());
$comment->save(); $comment->save();
if (!empty($attachments)) {
$attachmentsArr = explode(",", $attachments);
if (sizeof($attachmentsArr) > 10) {
$this->fail(50, "Error: too many attachments");
}
foreach ($attachmentsArr as $attac) {
$attachmentType = null;
if (str_contains($attac, "photo")) {
$attachmentType = "photo";
} elseif (str_contains($attac, "video")) {
$attachmentType = "video";
} else {
$this->fail(205, "Unknown attachment type");
}
$attachment = str_replace($attachmentType, "", $attac);
$attachmentOwner = (int) explode("_", $attachment)[0];
$attachmentId = (int) end(explode("_", $attachment));
$attacc = null;
if ($attachmentType == "photo") {
$attacc = (new PhotosRepo())->getByOwnerAndVID($attachmentOwner, $attachmentId);
if (!$attacc || $attacc->isDeleted()) {
$this->fail(100, "Photo does not exists");
}
if ($attacc->getOwner()->getId() != $this->getUser()->getId()) {
$this->fail(43, "You do not have access to this photo");
}
$comment->attach($attacc);
} elseif ($attachmentType == "video") {
$attacc = (new VideosRepo())->getByOwnerAndVID($attachmentOwner, $attachmentId);
if (!$attacc || $attacc->isDeleted()) {
$this->fail(100, "Video does not exists");
}
if ($attacc->getOwner()->getId() != $this->getUser()->getId()) {
$this->fail(43, "You do not have access to this video");
}
$comment->attach($attacc);
}
}
}
return $comment->getId(); return $comment->getId();
} }
public function delete(string $note_id)
{
$this->requireUser();
$this->willExecuteWriteAction();
$note = (new NotesRepo())->get((int) $note_id);
if (!$note) {
$this->fail(180, "Note not found");
}
if (!$note->canBeModifiedBy($this->getUser())) {
$this->fail(15, "Access to note denied");
}
$note->delete();
return 1;
}
public function edit(string $note_id, string $title = "", string $text = "", int $privacy = 0, int $comment_privacy = 0, string $privacy_view = "", string $privacy_comment = "") public function edit(string $note_id, string $title = "", string $text = "", int $privacy = 0, int $comment_privacy = 0, string $privacy_view = "", string $privacy_comment = "")
{ {
$this->requireUser(); $this->requireUser();
@ -85,15 +147,15 @@ final class Notes extends VKAPIRequestHandler
$note = (new NotesRepo())->getNoteById($this->getUser()->getId(), (int) $note_id); $note = (new NotesRepo())->getNoteById($this->getUser()->getId(), (int) $note_id);
if (!$note) { if (!$note) {
$this->fail(15, "Access denied"); $this->fail(180, "Note not found");
} }
if ($note->isDeleted()) { if ($note->isDeleted()) {
$this->fail(15, "Access denied"); $this->fail(189, "Note is deleted");
} }
if (!$note->canBeModifiedBy($this->getUser())) { if (!$note->canBeModifiedBy($this->getUser())) {
$this->fail(15, "Access denied"); $this->fail(403, "No access");
} }
!empty($title) ? $note->setName($title) : null; !empty($title) ? $note->setName($title) : null;
@ -106,31 +168,29 @@ final class Notes extends VKAPIRequestHandler
return 1; return 1;
} }
public function get(int $user_id, string $note_ids = "", int $offset = 0, int $count = 10) public function get(int $user_id, string $note_ids = "", int $offset = 0, int $count = 10, int $sort = 0)
{ {
$this->requireUser(); $this->requireUser();
$user = (new UsersRepo())->get($user_id); $user = (new UsersRepo())->get($user_id);
if (!$user || $user->isDeleted()) { if (!$user || $user->isDeleted()) {
$this->fail(15, "Access denied"); $this->fail(15, "Invalid user");
} }
if (!$user->getPrivacyPermission('notes.read', $this->getUser())) { if (!$user->getPrivacyPermission('notes.read', $this->getUser())) {
$this->fail(15, "Access denied"); $this->fail(15, "Access denied: this user chose to hide his notes");
} }
if (!$user->canBeViewedBy($this->getUser())) { if (!$user->canBeViewedBy($this->getUser())) {
$this->fail(15, "Access denied"); $this->fail(15, "Access denied");
} }
$notes_return_object = (object) [ $nodez = (object) [
"count" => 0, "count" => 0,
"items" => [], "notes" => [],
]; ];
if (empty($note_ids)) { if (empty($note_ids)) {
$notes_return_object->count = (new NotesRepo())->getUserNotesCount($user); $nodez->count = (new NotesRepo())->getUserNotesCount($user);
$notes = array_slice(iterator_to_array((new NotesRepo())->getUserNotes($user, 1, $count + $offset, $sort == 0 ? "ASC" : "DESC")), $offset); $notes = array_slice(iterator_to_array((new NotesRepo())->getUserNotes($user, 1, $count + $offset, $sort == 0 ? "ASC" : "DESC")), $offset);
@ -139,21 +199,25 @@ final class Notes extends VKAPIRequestHandler
continue; continue;
} }
$notes_return_object->items[] = $note->toVkApiStruct(); $nodez->notes[] = $note->toVkApiStruct();
} }
} else { } else {
$notes_splitted = explode(',', $note_ids); $notes = explode(',', $note_ids);
foreach ($notes_splitted as $note_id) { foreach ($notes as $note) {
$note = (new NotesRepo())->getNoteById($user_id, $note_id); $id = explode("_", $note);
$items = [];
$note = (new NotesRepo())->getNoteById((int) $id[0], (int) $id[1]);
if ($note && !$note->isDeleted()) { if ($note && !$note->isDeleted()) {
$notes_return_object->items[] = $note->toVkApiStruct(); $nodez->notes[] = $note->toVkApiStruct();
$nodez->count++;
} }
} }
} }
return $notes_return_object; return $nodez;
} }
public function getById(int $note_id, int $owner_id, bool $need_wiki = false) public function getById(int $note_id, int $owner_id, bool $need_wiki = false)
@ -163,23 +227,23 @@ final class Notes extends VKAPIRequestHandler
$note = (new NotesRepo())->getNoteById($owner_id, $note_id); $note = (new NotesRepo())->getNoteById($owner_id, $note_id);
if (!$note) { if (!$note) {
$this->fail(15, "Access denied"); $this->fail(180, "Note not found");
} }
if ($note->isDeleted()) { if ($note->isDeleted()) {
$this->fail(15, "Access denied"); $this->fail(189, "Note is deleted");
} }
if (!$note->getOwner() || $note->getOwner()->isDeleted()) { if (!$note->getOwner() || $note->getOwner()->isDeleted()) {
$this->fail(15, "Access denied"); $this->fail(177, "Owner does not exists");
} }
if (!$note->getOwner()->getPrivacyPermission('notes.read', $this->getUser())) { if (!$note->getOwner()->getPrivacyPermission('notes.read', $this->getUser())) {
$this->fail(15, "Access denied"); $this->fail(40, "Access denied: this user chose to hide his notes");
} }
if (!$note->canBeViewedBy($this->getUser())) { if (!$note->canBeViewedBy($this->getUser())) {
$this->fail(15, "Access denied"); $this->fail(15, "Access to note denied");
} }
return $note->toVkApiStruct(); return $note->toVkApiStruct();
@ -192,23 +256,23 @@ final class Notes extends VKAPIRequestHandler
$note = (new NotesRepo())->getNoteById($owner_id, $note_id); $note = (new NotesRepo())->getNoteById($owner_id, $note_id);
if (!$note) { if (!$note) {
$this->fail(15, "Access denied"); $this->fail(180, "Note not found");
} }
if ($note->isDeleted()) { if ($note->isDeleted()) {
$this->fail(15, "Access denied"); $this->fail(189, "Note is deleted");
} }
if (!$note->getOwner()) { if (!$note->getOwner()) {
$this->fail(15, "Access denied"); $this->fail(177, "Owner does not exists");
} }
if (!$note->getOwner()->getPrivacyPermission('notes.read', $this->getUser())) { if (!$note->getOwner()->getPrivacyPermission('notes.read', $this->getUser())) {
$this->fail(15, "Access denied"); $this->fail(14, "No access");
} }
if (!$note->canBeViewedBy($this->getUser())) { if (!$note->canBeViewedBy($this->getUser())) {
$this->fail(15, "Access denied"); $this->fail(15, "Access to note denied");
} }
$arr = (object) [ $arr = (object) [
@ -222,4 +286,14 @@ final class Notes extends VKAPIRequestHandler
return $arr; return $arr;
} }
public function getFriendsNotes(int $offset = 0, int $count = 0)
{
$this->fail(501, "Not implemented");
}
public function restoreComment(int $comment_id = 0, int $owner_id = 0)
{
$this->fail(501, "Not implemented");
}
} }

View file

@ -120,11 +120,11 @@ final class Polls extends VKAPIRequestHandler
$poll = (new PollsRepo())->get($poll_id); $poll = (new PollsRepo())->get($poll_id);
if (!$poll) { if (!$poll) {
$this->fail(15, "Access denied"); $this->fail(251, "Invalid poll");
} }
if ($poll->isAnonymous()) { if ($poll->isAnonymous()) {
$this->fail(15, "Access denied"); $this->fail(251, "Access denied: poll is anonymous.");
} }
$voters = array_slice($poll->getVoters($answer_ids, 1, $offset + $count), $offset); $voters = array_slice($poll->getVoters($answer_ids, 1, $offset + $count), $offset);
@ -175,4 +175,10 @@ final class Polls extends VKAPIRequestHandler
return $this->getById($poll->getId()); return $this->getById($poll->getId());
} }
public function edit()
{
#todo
return 1;
}
} }

View file

@ -138,13 +138,18 @@ class Note extends Postable
{ {
$res = (object) []; $res = (object) [];
$res->type = "note";
$res->id = $this->getVirtualId(); $res->id = $this->getVirtualId();
$res->owner_id = $this->getOwner()->getId(); $res->owner_id = $this->getOwner()->getId();
$res->title = $this->getName(); $res->title = $this->getName();
$res->text = $this->getText(); $res->text = $this->getText();
$res->date = $this->getPublicationTime()->timestamp(); $res->date = $this->getPublicationTime()->timestamp();
$res->comments = $this->getCommentsCount(); $res->comments = $this->getCommentsCount();
$res->read_comments = $this->getCommentsCount();
$res->view_url = "/note" . $this->getOwner()->getId() . "_" . $this->getVirtualId(); $res->view_url = "/note" . $this->getOwner()->getId() . "_" . $this->getVirtualId();
$res->privacy_view = 1;
$res->can_comment = 1;
$res->text_wiki = "r";
return $res; return $res;
} }

View file

@ -1497,7 +1497,7 @@ class User extends RowModel
return $this->getPrivacySetting("likes.read") == User::PRIVACY_NO_ONE; return $this->getPrivacySetting("likes.read") == User::PRIVACY_NO_ONE;
} }
public function toVkApiStruct(?User $relation_user = null, string $fields = ''): object public function toVkApiStruct(?User $user = null, string $fields = ''): object
{ {
$res = (object) []; $res = (object) [];
@ -1507,8 +1507,8 @@ class User extends RowModel
$res->deactivated = $this->isDeactivated(); $res->deactivated = $this->isDeactivated();
$res->is_closed = $this->isClosed(); $res->is_closed = $this->isClosed();
if (!is_null($relation_user)) { if (!is_null($user)) {
$res->can_access_closed = (bool) $this->canBeViewedBy($relation_user); $res->can_access_closed = (bool) $this->canBeViewedBy($user);
} }
if (!is_array($fields)) { if (!is_array($fields)) {
@ -1564,18 +1564,18 @@ class User extends RowModel
$res->real_id = $this->getRealId(); $res->real_id = $this->getRealId();
break; break;
case "blacklisted_by_me": case "blacklisted_by_me":
if (!$relation_user) { if (!$user) {
break; break;
} }
$res->blacklisted_by_me = (int) $this->isBlacklistedBy($relation_user); $res->blacklisted_by_me = (int) $this->isBlacklistedBy($user);
break; break;
case "blacklisted": case "blacklisted":
if (!$relation_user) { if (!$user) {
break; break;
} }
$res->blacklisted = (int) $relation_user->isBlacklistedBy($this); $res->blacklisted = (int) $user->isBlacklistedBy($this);
break; break;
case "games": case "games":
$res->games = $this->getFavoriteGames(); $res->games = $this->getFavoriteGames();

View file

@ -13,7 +13,7 @@
<textarea name="html" style="display:none;"></textarea> <textarea name="html" style="display:none;"></textarea>
<div id="editor" style="width:600px;height:300px;border:1px solid grey"></div> <div id="editor" style="width:600px;height:300px;border:1px solid grey"></div>
<p><i>{_something_is_supported_from_xhtml|noescape}</i></p> <p><i><a href="/kb/notes">{_something}</a> {_supports_xhtml}</i></p>
<input type="hidden" name="hash" value="{$csrfToken}" /> <input type="hidden" name="hash" value="{$csrfToken}" />
<button class="button">{_save}</button> <button class="button">{_save}</button>

View file

@ -18,7 +18,7 @@
<textarea name="html" style="display:none;"></textarea> <textarea name="html" style="display:none;"></textarea>
<div id="editor" style="width:600px;height:300px;border:1px solid grey"></div> <div id="editor" style="width:600px;height:300px;border:1px solid grey"></div>
<p><i>{_something_is_supported_from_xhtml|noescape}</i></p> <p><i><a href="/kb/notes">{_something}</a> {_supports_xhtml}</i></p>
<input type="hidden" name="hash" value="{$csrfToken}" /> <input type="hidden" name="hash" value="{$csrfToken}" />
<button class="button">{_save}</button> <button class="button">{_save}</button>

View file

@ -409,7 +409,7 @@
</td> </td>
<td> <td>
<select name="likes.read", style="width: 164px;"> <select name="likes.read", style="width: 164px;">
<option value="2" {if $user->getPrivacySetting('likes.read') == 2}selected{/if}>{_privacy_value_anybody_dative}</option> <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> <option value="0" {if $user->getPrivacySetting('likes.read') == 0}selected{/if}>{_privacy_value_only_me_dative}</option>
</select> </select>
</td> </td>

View file

@ -419,7 +419,7 @@
{else} {else}
<div class="page_status" style="display: flex;"> <div class="page_status" style="display: flex;">
<div n:class="audioStatus, $thatIsThisUser ? page_status_edit_button" id="page_status_text"> <div n:class="audioStatus, $thatIsThisUser ? page_status_edit_button" id="page_status_text">
<a {if !$thatIsThisUser}href="/audio0_{$audioStatus->getId()}"{/if}>{$audioStatus->getName()}</a> {$audioStatus->getName()}
</div> </div>
</div> </div>
{/if} {/if}
@ -458,8 +458,8 @@
</tr> </tr>
<tr n:if="!is_null($user->getBirthday())"> <tr n:if="!is_null($user->getBirthday())">
<td class="label"><span class="nobold">{_birth_date}:</span></td> <td class="label"><span class="nobold">{_birth_date}:</span></td>
<td n:if="$user->getBirthdayPrivacy() == 0" class="data">{$user->getBirthday()->format('%e %B %Y')}{if $user->onlineStatus() != 2}, <td n:if="$user->getBirthdayPrivacy() == 0" class="data">{$user->getBirthday()->format('%e %B %Y')},
{tr("years", $user->getAge())}{/if}</td> {tr("years", $user->getAge())}</td>
<td n:if="$user->getBirthdayPrivacy() == 1" class="data">{$user->getBirthday()->format('%e %B')}</td> <td n:if="$user->getBirthdayPrivacy() == 1" class="data">{$user->getBirthday()->format('%e %B')}</td>
</tr> </tr>
</tbody> </tbody>

View file

@ -17,9 +17,7 @@
{/if} {/if}
{/if} {/if}
{* remove the "n:if" if you having issues with your theme *} <link rel="stylesheet" href="/themepack/{$theme->getId()}/{$theme->getVersion()}/stylesheet/styles.css" />
<link n:if="!$theme->overridesTemplates()" rel="stylesheet" href="/themepack/{$theme->getId()}/{$theme->getVersion()}/stylesheet/styles.css" />
{if $isXmas} {if $isXmas}
<link rel="stylesheet" href="/themepack/{$theme->getId()}/{$theme->getVersion()}/resource/xmas.css" /> <link rel="stylesheet" href="/themepack/{$theme->getId()}/{$theme->getVersion()}/resource/xmas.css" />

View file

@ -33,15 +33,15 @@
</script> </script>
<label> <label>
<input type="checkbox" name="as_group" onchange="onWallAsGroupClick(this)" checked /> {_post_as_group} <input type="checkbox" name="as_group" onchange="onWallAsGroupClick(this)" /> {_post_as_group}
</label> </label>
<label id="forceSignOpt" style="display: block;"> <label id="forceSignOpt" style="display: none;">
<input type="checkbox" name="force_sign" /> {_add_signature} <input type="checkbox" name="force_sign" /> {_add_signature}
</label> </label>
{/if} {/if}
{/if} {/if}
<label n:if="$anonEnabled" id="octoberAnonOpt" style="display: none;"> <label n:if="$anonEnabled" id="octoberAnonOpt">
<input type="checkbox" name="anon" /> {_as_anonymous} <input type="checkbox" name="anon" /> {_as_anonymous}
</label> </label>

View file

@ -763,9 +763,8 @@
fill-opacity: .7; fill-opacity: .7;
} }
.audioStatus a { .audioStatus span {
color: #2B587A; color: #2B587A;
font-weight: bold;
} }
.audioStatus span:hover { .audioStatus span:hover {

View file

@ -3921,11 +3921,6 @@ hr {
height: 25px; height: 25px;
} }
.object_fit_ava {
object-fit: cover;
object-position: top;
}
.like_tooltip_wrapper .like_tooltip_body a { .like_tooltip_wrapper .like_tooltip_body a {
height: 25px; height: 25px;
} }

View file

@ -176,7 +176,7 @@ window.player = new class {
} }
} }
if(window.player.listen_coef > 5) { if(window.player.listen_coef > 10) {
this.__countListen() this.__countListen()
window.player.listen_coef = -10 window.player.listen_coef = -10
} }

View file

@ -902,7 +902,7 @@ tippy.delegate('body', {
that._likesList.items.forEach(item => { that._likesList.items.forEach(item => {
final_template.find('.like_tooltip_body .like_tooltip_body_grid').append(` final_template.find('.like_tooltip_body .like_tooltip_body_grid').append(`
<a title="${escapeHtml(item.first_name + " " + item.last_name)}" href='/id${item.id}'><img class="object_fit_ava" src='${item.photo_50}' alt='.'></a> <a title="${escapeHtml(item.first_name + " " + item.last_name)}" href='/id${item.id}'><img src='${item.photo_50}' alt='.'></a>
`) `)
}) })
that.setContent(final_template.nodes[0].outerHTML) that.setContent(final_template.nodes[0].outerHTML)
@ -1434,7 +1434,7 @@ u(document).on("click", "#__photoAttachment", async (e) => {
window.openvk.photoalbums = await window.OVKAPI.call('photos.getAlbums', {'owner_id': club != 0 ? Math.abs(club) * -1 : window.openvk.current_id}) window.openvk.photoalbums = await window.OVKAPI.call('photos.getAlbums', {'owner_id': club != 0 ? Math.abs(club) * -1 : window.openvk.current_id})
} }
window.openvk.photoalbums.items.forEach(item => { window.openvk.photoalbums.items.forEach(item => {
u('.ovk-diag-body #albumSelect').append(`<option value="${item.id}">${ovk_proc_strtr(escapeHtml(item.title), 20)}</option>`) u('.ovk-diag-body #albumSelect').append(`<option value="${item.vid}">${ovk_proc_strtr(escapeHtml(item.title), 20)}</option>`)
}) })
}) })

View file

@ -619,7 +619,6 @@
"notes_closed" = "You can't attach a note to the post because only you can see them.<br> You can change this in <a href=\"/settings?act=privacy\">settings</a>."; "notes_closed" = "You can't attach a note to the post because only you can see them.<br> You can change this in <a href=\"/settings?act=privacy\">settings</a>.";
"do_not_attach_note" = "Do not attach a note"; "do_not_attach_note" = "Do not attach a note";
"something_is_supported_from_xhtml" = "<a href='/kb/notes'>Something</a> from (X)HTML supported.";
"something" = "Something"; "something" = "Something";
"supports_xhtml" = "from (X)HTML supported."; "supports_xhtml" = "from (X)HTML supported.";

View file

@ -603,7 +603,6 @@
"notes_closed" = "Вы не можете прикрепить заметку к записи, так как ваши заметки видны только вам.<br><br> Вы можете поменять это в <a href=\"/settings?act=privacy\">настройках</a>."; "notes_closed" = "Вы не можете прикрепить заметку к записи, так как ваши заметки видны только вам.<br><br> Вы можете поменять это в <a href=\"/settings?act=privacy\">настройках</a>.";
"do_not_attach_note" = "Не прикреплять заметку"; "do_not_attach_note" = "Не прикреплять заметку";
"something_is_supported_from_xhtml" = "<a href='/kb/notes'>Кое-что</a> из (X)HTML поддерживается.";
"something" = "Кое-что"; "something" = "Кое-что";
"supports_xhtml" = "из (X)HTML поддерживается."; "supports_xhtml" = "из (X)HTML поддерживается.";

View file

@ -448,7 +448,6 @@
"notes_closed" = "Vy ne možete prikrepití zametku k zapisi, tak kak vaši zametki vidny tolíko vam.<br><br> Vy možete pomenjatí eto v <a href=\"/settings?act=privacy\">nastrojkah</a>."; "notes_closed" = "Vy ne možete prikrepití zametku k zapisi, tak kak vaši zametki vidny tolíko vam.<br><br> Vy možete pomenjatí eto v <a href=\"/settings?act=privacy\">nastrojkah</a>.";
"do_not_attach_note" = "Ne prikrepljatí zametku"; "do_not_attach_note" = "Ne prikrepljatí zametku";
"something_is_supported_from_xhtml" = "<a href='/kb/notes'>Koe-čto</a> iz (X)HTML podderživaetsja.";
"something" = "Koe-čto"; "something" = "Koe-čto";
"supports_xhtml" = "iz (X)HTML podderživaetsja."; "supports_xhtml" = "iz (X)HTML podderživaetsja.";

View file

@ -579,7 +579,6 @@
"notes_closed" = "Ви не можете прикріпити нотатку до запису, оскільки Ваші нотатки видно тільки Вам.<br><br> Ви можете змінити це в <a href=\"/settings?act=privacy\">налаштуваннях</a>."; "notes_closed" = "Ви не можете прикріпити нотатку до запису, оскільки Ваші нотатки видно тільки Вам.<br><br> Ви можете змінити це в <a href=\"/settings?act=privacy\">налаштуваннях</a>.";
"do_not_attach_note" = "Не прикріплювати нотатку"; "do_not_attach_note" = "Не прикріплювати нотатку";
"something_is_supported_from_xhtml" = "<a href='/kb/notes'>Певні</a> теги з (X)HTML підтримується.";
"something" = "Певні"; "something" = "Певні";
"supports_xhtml" = "теги з (X)HTML підтримується."; "supports_xhtml" = "теги з (X)HTML підтримується.";