Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
10729d8
Wall: add early suggestions
Jul 30, 2023
eff2b2b
Fix br
Jul 31, 2023
213f1e2
Fix empty posts
Jul 31, 2023
3809b82
fck
Jul 31, 2023
cd54662
Add offset for api
Jul 31, 2023
61205f6
Add notifications of new suggestion posts
Jul 31, 2023
9a20682
Fix mentions in suggested posts
Aug 1, 2023
1fcc372
🤮🤢
Aug 2, 2023
4ee9a0d
Change regex
Aug 4, 2023
9543fb6
Add da koroche pohuy
Aug 4, 2023
cb8dd4d
Эдд апи метходс
Aug 4, 2023
c3ac279
Pon
Aug 6, 2023
5e67163
Add skloneniyia
Aug 6, 2023
c7e76cc
newlines
Aug 6, 2023
9ff4ff4
int
Aug 6, 2023
be85edf
Update loaders and add avtopodgruzka postov
Aug 6, 2023
c4c476e
Update JOERGK.strings
Aug 6, 2023
2226013
Blin
Aug 7, 2023
ccf618a
Remove repeated code, fix loaded buttons on chr...
Aug 9, 2023
7065465
Merge branch 'master' into suggests
Aug 9, 2023
499bec2
Fix polls
Aug 9, 2023
e9a0b5a
Merge branch 'suggests' of https://github.com/lalka2016/openvkuh into…
Aug 9, 2023
f1fdb15
Fihes
Aug 10, 2023
793a87c
Merge branch 'master' into suggests
Aug 11, 2023
adef21d
Remove ability to delete your accepted psto
Aug 12, 2023
f585183
oi blin
Aug 13, 2023
c8ef5cc
Improvements 2 api
Aug 15, 2023
5f51881
g
Aug 17, 2023
6bd475a
openvk.uk
Aug 19, 2023
77fe2fb
aiaks
Aug 20, 2023
ba77162
al_wall.js -> al_suggestions.js
Aug 21, 2023
2ddd454
👨‍💻 Add 👨‍💻 fading 👨‍💻
Aug 27, 2023
e1f1035
Add "owner's posts' and "other's posts"
Aug 28, 2023
500107f
planshet openvk
Sep 2, 2023
a0e8958
Merge branch 'master' into suggests
Oct 8, 2023
029d21c
Simplefai ze kod
Oct 10, 2023
12775d0
Merge branch 'master' into suggests
Nov 15, 2023
029ce27
PHP 8 FIX WATAFAK
Nov 15, 2023
2cc1b03
Add indesk
Nov 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions ServiceAPI/Wall.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ function getPost(int $id, callable $resolve, callable $reject): void
{
$post = $this->posts->get($id);
if(!$post || $post->isDeleted())
$reject("No post with id=$id");
$reject(53, "No post with id=$id");

if($post->getSuggestionType() != 0)
$reject(25, "Can't get suggested post");

$res = (object) [];
$res->id = $post->getId();
Expand Down Expand Up @@ -96,7 +99,7 @@ function getMyNotes(callable $resolve, callable $reject)

$resolve($arr);
}

function getVideos(int $page = 1, callable $resolve, callable $reject)
{
$videos = $this->videos->getByUser($this->user, $page, 8);
Expand Down Expand Up @@ -129,7 +132,7 @@ function searchVideos(int $page = 1, string $query, callable $resolve, callable
];

foreach($videos as $video) {
$res = json_decode(json_encode($video->toVkApiStruct()), true);
$res = json_decode(json_encode($video->toVkApiStruct($this->user)), true);
$res["video"]["author_name"] = $video->getOwner()->getCanonicalName();

$arr["items"][] = $res;
Expand Down
45 changes: 40 additions & 5 deletions VKAPI/Handlers/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace openvk\VKAPI\Handlers;
use openvk\Web\Models\Repositories\Clubs as ClubsRepo;
use openvk\Web\Models\Repositories\Users as UsersRepo;
use openvk\Web\Models\Repositories\Posts as PostsRepo;
use openvk\Web\Models\Entities\Club;

final class Groups extends VKAPIRequestHandler
Expand Down Expand Up @@ -80,6 +81,19 @@ function get(int $user_id = 0, string $fields = "", int $offset = 0, int $count
break;
case "members_count":
$rClubs[$i]->members_count = $usr->getFollowersCount();
break;
case "can_suggest":
$rClubs[$i]->can_suggest = !$usr->canBeModifiedBy($this->getUser()) && $usr->getWallType() == 2;
break;
# unstandard feild
case "suggested_count":
if($usr->getWallType() != 2) {
$rClubs[$i]->suggested_count = NULL;
break;
}

$rClubs[$i]->suggested_count = $usr->getSuggestedPostsCount($this->getUser());

break;
}
}
Expand Down Expand Up @@ -188,7 +202,19 @@ function getById(string $group_ids = "", string $group_id = "", string $fields =
case "description":
$response[$i]->description = $clb->getDescription();
break;
case "contacts":
case "can_suggest":
$response[$i]->can_suggest = !$clb->canBeModifiedBy($this->getUser()) && $clb->getWallType() == 2;
break;
# unstandard feild
case "suggested_count":
if($clb->getWallType() != 2) {
$response[$i]->suggested_count = NULL;
break;
}

$response[$i]->suggested_count = $clb->getSuggestedPostsCount($this->getUser());
break;
case "contacts":
$contacts;
$contactTmp = $clb->getManagers(1, true);

Expand Down Expand Up @@ -288,7 +314,7 @@ function edit(
string $description = NULL,
string $screen_name = NULL,
string $website = NULL,
int $wall = NULL,
int $wall = -1,
int $topics = NULL,
int $adminlist = NULL,
int $topicsAboveWall = NULL,
Expand All @@ -308,17 +334,26 @@ function edit(
!empty($description) ? $club->setAbout($description) : NULL;
!empty($screen_name) ? $club->setShortcode($screen_name) : NULL;
!empty($website) ? $club->setWebsite((!parse_url($website, PHP_URL_SCHEME) ? "https://" : "") . $website) : NULL;
!empty($wall) ? $club->setWall($wall) : NULL;

try {
$wall != -1 ? $club->setWall($wall) : NULL;
} catch(\Exception $e) {
$this->fail(50, "Invalid wall value");
}

!empty($topics) ? $club->setEveryone_Can_Create_Topics($topics) : NULL;
!empty($adminlist) ? $club->setAdministrators_List_Display($adminlist) : NULL;
!empty($topicsAboveWall) ? $club->setDisplay_Topics_Above_Wall($topicsAboveWall) : NULL;
!empty($hideFromGlobalFeed) ? $club->setHide_From_Global_Feed($hideFromGlobalFeed) : NULL;

in_array($audio, [0, 1]) ? $club->setEveryone_can_upload_audios($audio) : NULL;

try {
$club->save();
} catch(\TypeError $e) {
$this->fail(8, "Nothing changed");
$this->fail(15, "Nothing changed");
} catch(\Exception $e) {
$this->fail(18, "An unknown error occurred: maybe you set an incorrect value?");
}

return 1;
Expand Down Expand Up @@ -472,7 +507,7 @@ function getSettings(string $group_id)
"title" => $club->getName(),
"description" => $club->getDescription() != NULL ? $club->getDescription() : "",
"address" => $club->getShortcode(),
"wall" => $club->canPost() == true ? 1 : 0,
"wall" => $club->getWallType(), # отличается от вкшных но да ладно
"photos" => 1,
"video" => 0,
"audio" => $club->isEveryoneCanUploadAudios() ? 1 : 0,
Expand Down
2 changes: 1 addition & 1 deletion VKAPI/Handlers/Newsfeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function getGlobal(string $fields = "", int $start_from = 0, int $start_time = 0
{
$this->requireUser();

$queryBase = "FROM `posts` LEFT JOIN `groups` ON GREATEST(`posts`.`wall`, 0) = 0 AND `groups`.`id` = ABS(`posts`.`wall`) WHERE (`groups`.`hide_from_global_feed` = 0 OR `groups`.`name` IS NULL) AND `posts`.`deleted` = 0";
$queryBase = "FROM `posts` LEFT JOIN `groups` ON GREATEST(`posts`.`wall`, 0) = 0 AND `groups`.`id` = ABS(`posts`.`wall`) WHERE (`groups`.`hide_from_global_feed` = 0 OR `groups`.`name` IS NULL) AND `posts`.`deleted` = 0 AND `posts`.`suggested` = 0";

if($this->getUser()->getNsfwTolerance() === User::NSFW_INTOLERANT)
$queryBase .= " AND `nsfw` = 0";
Expand Down
Loading