diff --git a/VKAPI/Handlers/Account.php b/VKAPI/Handlers/Account.php
index dd6cfa7b..a20c42be 100644
--- a/VKAPI/Handlers/Account.php
+++ b/VKAPI/Handlers/Account.php
@@ -66,6 +66,8 @@ final class Account extends VKAPIRequestHandler
function getCounters(string $filter = ""): object
{
+ $this->requireUser();
+
return (object) [
"friends" => $this->getUser()->getFollowersCount(),
"notifications" => $this->getUser()->getNotificationsCount(),
diff --git a/VKAPI/Handlers/Likes.php b/VKAPI/Handlers/Likes.php
index 644646e5..9501b433 100644
--- a/VKAPI/Handlers/Likes.php
+++ b/VKAPI/Handlers/Likes.php
@@ -54,11 +54,7 @@ final class Likes extends VKAPIRequestHandler
case "post":
$user = (new UsersRepo)->get($user_id);
if (is_null($user))
- return (object) [
- "liked" => 0,
- "copied" => 0,
- "sex" => 0
- ];
+ $this->fail(100, "One of the parameters specified was missing or invalid: user not found");
$post = (new PostsRepo)->getPostById($owner_id, $item_id);
if (is_null($post))
diff --git a/VKAPI/Handlers/Newsfeed.php b/VKAPI/Handlers/Newsfeed.php
index 16bd3123..d9992430 100644
--- a/VKAPI/Handlers/Newsfeed.php
+++ b/VKAPI/Handlers/Newsfeed.php
@@ -7,7 +7,7 @@ use openvk\VKAPI\Handlers\Wall;
final class Newsfeed extends VKAPIRequestHandler
{
- function get(string $fields = "", int $start_from = 0, int $offset = 0, int $count = 30, int $extended = 0, int $forGodSakePleaseDoNotReportAboutMyOnlineActivity = 0)
+ function get(string $fields = "", int $start_from = 0, int $start_time = 0, int $end_time = 0, int $offset = 0, int $count = 30, int $extended = 0, int $forGodSakePleaseDoNotReportAboutMyOnlineActivity = 0)
{
$this->requireUser();
@@ -33,6 +33,8 @@ final class Newsfeed extends VKAPIRequestHandler
->where("wall IN (?)", $ids)
->where("deleted", 0)
->where("id < (?)", empty($start_from) ? PHP_INT_MAX : $start_from)
+ ->where("? <= created", empty($start_time) ? 0 : $start_time)
+ ->where("? >= created", empty($end_time) ? PHP_INT_MAX : $end_time)
->order("created DESC");
$rposts = [];
@@ -45,7 +47,7 @@ final class Newsfeed extends VKAPIRequestHandler
return $response;
}
- function getGlobal(string $fields = "", int $start_from = 0, int $offset = 0, int $count = 30, int $extended = 0)
+ function getGlobal(string $fields = "", int $start_from = 0, int $start_time = 0, int $end_time = 0, int $offset = 0, int $count = 30, int $extended = 0)
{
$this->requireUser();
@@ -55,7 +57,9 @@ final class Newsfeed extends VKAPIRequestHandler
$queryBase .= " AND `nsfw` = 0";
$start_from = empty($start_from) ? PHP_INT_MAX : $start_from;
- $posts = DatabaseConnection::i()->getConnection()->query("SELECT `posts`.`id` " . $queryBase . " AND `posts`.`id` < " . $start_from . " ORDER BY `created` DESC LIMIT " . $count . " OFFSET " . $offset);
+ $start_time = empty($start_time) ? 0 : $start_time;
+ $end_time = empty($end_time) ? PHP_INT_MAX : $end_time;
+ $posts = DatabaseConnection::i()->getConnection()->query("SELECT `posts`.`id` " . $queryBase . " AND `posts`.`id` <= " . $start_from . " AND " . $start_time . " <= `posts`.`created` AND `posts`.`created` <= " . $end_time . " ORDER BY `created` DESC LIMIT " . $count . " OFFSET " . $offset);
$rposts = [];
$ids = [];
diff --git a/VKAPI/Handlers/Polls.php b/VKAPI/Handlers/Polls.php
index 9036a02c..be947a44 100755
--- a/VKAPI/Handlers/Polls.php
+++ b/VKAPI/Handlers/Polls.php
@@ -75,7 +75,7 @@ final class Polls extends VKAPIRequestHandler
try {
$poll->vote($this->getUser(), explode(",", $answers_ids));
- return 0;
+ return 1;
} catch(AlreadyVotedException $ex) {
return 0;
} catch(PollLockedException $ex) {
@@ -97,7 +97,7 @@ final class Polls extends VKAPIRequestHandler
try {
$poll->revokeVote($this->getUser());
- return 0;
+ return 1;
} catch(PollLockedException $ex) {
$this->fail(15, "Access denied: Poll is locked or isn't revotable");
} catch(InvalidOptionException $ex) {
diff --git a/Web/Models/Entities/Video.php b/Web/Models/Entities/Video.php
index bddb00a4..45320efc 100644
--- a/Web/Models/Entities/Video.php
+++ b/Web/Models/Entities/Video.php
@@ -197,6 +197,9 @@ class Video extends Media
static function fastMake(int $owner, string $name = "Unnamed Video.ogv", string $description = "", array $file, bool $unlisted = true, bool $anon = false): Video
{
+ if(OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading'])
+ exit(VIDEOS_FRIENDLY_ERROR);
+
$video = new Video;
$video->setOwner($owner);
$video->setName(ovk_proc_strtr($name, 61));
diff --git a/Web/Presenters/AuthPresenter.php b/Web/Presenters/AuthPresenter.php
index bbb45d28..2f178900 100644
--- a/Web/Presenters/AuthPresenter.php
+++ b/Web/Presenters/AuthPresenter.php
@@ -207,6 +207,9 @@ final class AuthPresenter extends OpenVKPresenter
function renderFinishRestoringPassword(): void
{
+ if(OPENVK_ROOT_CONF['openvk']['preferences']['security']['disablePasswordRestoring'])
+ $this->notFound();
+
$request = $this->restores->getByToken(str_replace(" ", "+", $this->queryParam("key")));
if(!$request || !$request->isStillValid()) {
$this->flash("err", tr("token_manipulation_error"), tr("token_manipulation_error_comment"));
@@ -241,6 +244,9 @@ final class AuthPresenter extends OpenVKPresenter
function renderRestore(): void
{
+ if(OPENVK_ROOT_CONF['openvk']['preferences']['security']['disablePasswordRestoring'])
+ $this->notFound();
+
if(!is_null($this->user))
$this->redirect($this->user->identity->getURL());
diff --git a/Web/Presenters/CommentPresenter.php b/Web/Presenters/CommentPresenter.php
index 93d2a816..dad79ac4 100644
--- a/Web/Presenters/CommentPresenter.php
+++ b/Web/Presenters/CommentPresenter.php
@@ -47,6 +47,9 @@ final class CommentPresenter extends OpenVKPresenter
$club = (new Clubs)->get(abs($entity->getTargetWall()));
else if($entity instanceof Topic)
$club = $entity->getClub();
+
+ if($_FILES["_vid_attachment"] && OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading'])
+ $this->flashFail("err", tr("error"), "Video uploads are disabled by the system administrator.");
$flags = 0;
if($this->postParam("as_group") === "on" && !is_null($club) && $club->canBeModifiedBy($this->user->identity))
diff --git a/Web/Presenters/TopicsPresenter.php b/Web/Presenters/TopicsPresenter.php
index e081382a..e7b08ac3 100644
--- a/Web/Presenters/TopicsPresenter.php
+++ b/Web/Presenters/TopicsPresenter.php
@@ -84,6 +84,9 @@ final class TopicsPresenter extends OpenVKPresenter
if($this->postParam("as_group") === "on" && $club->canBeModifiedBy($this->user->identity))
$flags |= 0b10000000;
+ if($_FILES["_vid_attachment"] && OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading'])
+ $this->flashFail("err", tr("error"), "Video uploads are disabled by the system administrator.");
+
$topic = new Topic;
$topic->setGroup($club->getId());
$topic->setOwner($this->user->id);
diff --git a/Web/Presenters/VideosPresenter.php b/Web/Presenters/VideosPresenter.php
index 6db7771d..4e4d484a 100644
--- a/Web/Presenters/VideosPresenter.php
+++ b/Web/Presenters/VideosPresenter.php
@@ -56,6 +56,9 @@ final class VideosPresenter extends OpenVKPresenter
{
$this->assertUserLoggedIn();
$this->willExecuteWriteAction();
+
+ if(OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading'])
+ $this->flashFail("err", tr("error"), "Video uploads are disabled by the system administrator.");
if($_SERVER["REQUEST_METHOD"] === "POST") {
if(!empty($this->postParam("name"))) {
diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php
index 5c9326db..6b9ec183 100644
--- a/Web/Presenters/WallPresenter.php
+++ b/Web/Presenters/WallPresenter.php
@@ -229,6 +229,9 @@ final class WallPresenter extends OpenVKPresenter
if(!$canPost)
$this->flashFail("err", tr("not_enough_permissions"), tr("not_enough_permissions_comment"));
+ if($_FILES["_vid_attachment"] && OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading'])
+ $this->flashFail("err", tr("error"), "Video uploads are disabled by the system administrator.");
+
$anon = OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["anonymousPosting"]["enable"];
if($wallOwner instanceof Club && $this->postParam("as_group") === "on" && $this->postParam("force_sign") !== "on" && $anon) {
$manager = $wallOwner->getManager($this->user->identity);
diff --git a/Web/Presenters/templates/@layout.xml b/Web/Presenters/templates/@layout.xml
index 48c2b839..fcbf4f63 100644
--- a/Web/Presenters/templates/@layout.xml
+++ b/Web/Presenters/templates/@layout.xml
@@ -252,7 +252,7 @@
- {_forgot_password}
+ {if !OPENVK_ROOT_CONF['openvk']['preferences']['security']['disablePasswordRestoring']}{_forgot_password}{/if}
{/ifset}
diff --git a/Web/Presenters/templates/Auth/LoginSecondFactor.xml b/Web/Presenters/templates/Auth/LoginSecondFactor.xml
index a1ba1ede..0db2a2a0 100644
--- a/Web/Presenters/templates/Auth/LoginSecondFactor.xml
+++ b/Web/Presenters/templates/Auth/LoginSecondFactor.xml
@@ -11,7 +11,7 @@
- |
{_registration_disabled_info}
{if OPENVK_ROOT_CONF['openvk']['preferences']['registration']['disablingReason']}
- - - {_admin_banned_link_reason}: - - {php echo OPENVK_ROOT_CONF['openvk']['preferences']['registration']['disablingReason']} + {_admin_banned_link_reason}: + {php echo OPENVK_ROOT_CONF['openvk']['preferences']['registration']['disablingReason']} {/if} |