mirror of
https://github.com/openvk/openvk
synced 2025-03-15 14:05:36 +03:00
Merge branch 'master' into feature-reports
This commit is contained in:
commit
af5df61f73
179 changed files with 6508 additions and 1844 deletions
103
CLI/FetchToncoinTransactions.php
Executable file
103
CLI/FetchToncoinTransactions.php
Executable file
|
@ -0,0 +1,103 @@
|
||||||
|
<?php declare(strict_types=1);
|
||||||
|
namespace openvk\CLI;
|
||||||
|
use Chandler\Database\DatabaseConnection;
|
||||||
|
use openvk\Web\Models\Repositories\Users;
|
||||||
|
use openvk\Web\Models\Entities\Notifications\CoinsTransferNotification;
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Nette\Utils\ImageException;
|
||||||
|
|
||||||
|
define("NANOTON", 1000000000);
|
||||||
|
|
||||||
|
class FetchToncoinTransactions extends Command
|
||||||
|
{
|
||||||
|
private $images;
|
||||||
|
|
||||||
|
protected static $defaultName = "fetch-ton";
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->transactions = DatabaseConnection::i()->getContext()->table("cryptotransactions");
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configure(): void
|
||||||
|
{
|
||||||
|
$this->setDescription("Fetches TON transactions to top up the users' balance")
|
||||||
|
->setHelp("This command checks for new transactions on TON Wallet and then top up the balance of specified users");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
|
{
|
||||||
|
$header = $output->section();
|
||||||
|
|
||||||
|
$header->writeln([
|
||||||
|
"TONCOIN Fetcher",
|
||||||
|
"=====================",
|
||||||
|
"",
|
||||||
|
]);
|
||||||
|
|
||||||
|
if(!OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["enabled"]) {
|
||||||
|
$header->writeln("Sorry, but you handn't enabled the TON support in your config file yet.");
|
||||||
|
|
||||||
|
return Command::FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
$testnetSubdomain = OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["testnet"] ? "testnet." : "";
|
||||||
|
$url = "https://" . $testnetSubdomain . "toncenter.com/api/v2/getTransactions?";
|
||||||
|
|
||||||
|
$opts = [
|
||||||
|
"http" => [
|
||||||
|
"method" => "GET",
|
||||||
|
"header" => "Accept: application/json"
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$selection = $this->transactions->select('hash, lt')->order("id DESC")->limit(1)->fetch();
|
||||||
|
$trHash = $selection->hash ?? NULL;
|
||||||
|
$trLt = $selection->lt ?? NULL;
|
||||||
|
|
||||||
|
$data = http_build_query([
|
||||||
|
"address" => OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["address"],
|
||||||
|
"limit" => 100,
|
||||||
|
"hash" => $trHash,
|
||||||
|
"to_lt" => $trLt
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = file_get_contents($url . $data, false, stream_context_create($opts));
|
||||||
|
$response = json_decode($response, true);
|
||||||
|
|
||||||
|
$header->writeln("Gonna up the balance of users");
|
||||||
|
foreach($response["result"] as $transfer) {
|
||||||
|
$outputArray;
|
||||||
|
preg_match('/' . OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["regex"] . '/', $transfer["in_msg"]["message"], $outputArray);
|
||||||
|
$userId = ctype_digit($outputArray[1]) ? intval($outputArray[1]) : NULL;
|
||||||
|
if(is_null($userId)) {
|
||||||
|
$header->writeln("Well, that's a donation. Thanks! XD");
|
||||||
|
} else {
|
||||||
|
$user = (new Users)->get($userId);
|
||||||
|
if(!$user) {
|
||||||
|
$header->writeln("Well, that's a donation. Thanks! XD");
|
||||||
|
} else {
|
||||||
|
$value = ($transfer["in_msg"]["value"] / NANOTON) / OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["rate"];
|
||||||
|
$user->setCoins($user->getCoins() + $value);
|
||||||
|
$user->save();
|
||||||
|
(new CoinsTransferNotification($user, (new Users)->get(OPENVK_ROOT_CONF["openvk"]["preferences"]["support"]["adminAccount"]), (int) $value, "Via TON cryptocurrency"))->emit();
|
||||||
|
$header->writeln($value . " coins are added to " . $user->getId() . " user id");
|
||||||
|
$this->transactions->insert([
|
||||||
|
"id" => NULL,
|
||||||
|
"hash" => $transfer["transaction_id"]["hash"],
|
||||||
|
"lt" => $transfer["transaction_id"]["lt"]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$header->writeln("Processing finished :3");
|
||||||
|
|
||||||
|
return Command::SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,8 +17,8 @@ We will release OpenVK as soon as it's ready. As for now you can:
|
||||||
## Instances
|
## Instances
|
||||||
|
|
||||||
* **[openvk.su](https://openvk.su/)**
|
* **[openvk.su](https://openvk.su/)**
|
||||||
* **[openvk.uk](https://openvk.uk)** - official mirror of openvk.su (<https://t.me/openvkch/1609>)
|
* **[openvk.uk](https://openvk.uk)** - official mirror of openvk.su (<https://t.me/openvk/1609>)
|
||||||
* **[openvk.co](http://openvk.co)** - yet another official mirror of openvk.su without TLS (<https://t.me/openvkch/1654>)
|
* **[openvk.co](http://openvk.co)** - yet another official mirror of openvk.su without TLS (<https://t.me/openvk/1654>)
|
||||||
* [social.fetbuk.ru](http://social.fetbuk.ru/)
|
* [social.fetbuk.ru](http://social.fetbuk.ru/)
|
||||||
* [vepurovk.xyz](http://vepurovk.xyz/)
|
* [vepurovk.xyz](http://vepurovk.xyz/)
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ If you want, you can add your instance to the list above so that people can regi
|
||||||
|
|
||||||
1. Install PHP 7.4, web-server, Composer, Node.js, Yarn and [Chandler](https://github.com/openvk/chandler)
|
1. Install PHP 7.4, web-server, Composer, Node.js, Yarn and [Chandler](https://github.com/openvk/chandler)
|
||||||
|
|
||||||
* PHP 8 has **not** yet been tested, so you should not expect it to work. (edit: it does not work).
|
* PHP 8.1 is supported, but it was not tested carefully, be aware of that.
|
||||||
|
|
||||||
2. Install MySQL-compatible database.
|
2. Install MySQL-compatible database.
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ _[English](README.md)_
|
||||||
## Инстанции
|
## Инстанции
|
||||||
|
|
||||||
* **[openvk.su](https://openvk.su/)**
|
* **[openvk.su](https://openvk.su/)**
|
||||||
* **[openvk.uk](https://openvk.uk)** - официальное зеркало openvk.su (<https://t.me/openvkch/1609>)
|
* **[openvk.uk](https://openvk.uk)** - официальное зеркало openvk.su (<https://t.me/openvk/1609>)
|
||||||
* **[openvk.co](http://openvk.co)** - ещё одно официальное зеркало openvk.su без TLS (<https://t.me/openvkch/1654>)
|
* **[openvk.co](http://openvk.co)** - ещё одно официальное зеркало openvk.su без TLS (<https://t.me/openvk/1654>)
|
||||||
* [social.fetbuk.ru](http://social.fetbuk.ru/)
|
* [social.fetbuk.ru](http://social.fetbuk.ru/)
|
||||||
* [vepurovk.xyz](http://vepurovk.xyz/)
|
* [vepurovk.xyz](http://vepurovk.xyz/)
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ ln -s /path/to/chandler/extensions/available/openvk /path/to/chandler/extensions
|
||||||
|
|
||||||
* [Баг-трекер](https://github.com/openvk/openvk/projects/1)
|
* [Баг-трекер](https://github.com/openvk/openvk/projects/1)
|
||||||
* [Помощь в OVK](https://openvk.su/support?act=new)
|
* [Помощь в OVK](https://openvk.su/support?act=new)
|
||||||
* Telegram-чат: Перейдите на [наш канал](https://t.me/openvkch) и откройте обсуждение в меню нашего канала.
|
* Telegram-чат: Перейдите на [наш канал](https://t.me/openvk) и откройте обсуждение в меню нашего канала.
|
||||||
* [Reddit](https://www.reddit.com/r/openvk/)
|
* [Reddit](https://www.reddit.com/r/openvk/)
|
||||||
* [Обсуждения](https://github.com/openvk/openvk/discussions)
|
* [Обсуждения](https://github.com/openvk/openvk/discussions)
|
||||||
* Чат в Matrix: #ovk:matrix.org
|
* Чат в Matrix: #ovk:matrix.org
|
||||||
|
|
87
ServiceAPI/Apps.php
Normal file
87
ServiceAPI/Apps.php
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
<?php declare(strict_types=1);
|
||||||
|
namespace openvk\ServiceAPI;
|
||||||
|
|
||||||
|
use openvk\Web\Models\Entities\User;
|
||||||
|
use openvk\Web\Models\Repositories\Applications;
|
||||||
|
|
||||||
|
class Apps implements Handler
|
||||||
|
{
|
||||||
|
private $user;
|
||||||
|
private $apps;
|
||||||
|
|
||||||
|
public function __construct(?User $user)
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
$this->apps = new Applications;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getUserInfo(callable $resolve, callable $reject): void
|
||||||
|
{
|
||||||
|
$hexId = dechex($this->user->getId());
|
||||||
|
$sign = hash_hmac("sha512/224", $hexId, CHANDLER_ROOT_CONF["security"]["secret"], true);
|
||||||
|
$marketingId = $hexId . "_" . base64_encode($sign);
|
||||||
|
|
||||||
|
$resolve([
|
||||||
|
"id" => $this->user->getId(),
|
||||||
|
"marketing_id" => $marketingId,
|
||||||
|
"name" => [
|
||||||
|
"first" => $this->user->getFirstName(),
|
||||||
|
"last" => $this->user->getLastName(),
|
||||||
|
"full" => $this->user->getFullName(),
|
||||||
|
],
|
||||||
|
"ava" => $this->user->getAvatarUrl(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updatePermission(int $app, string $perm, string $state, callable $resolve, callable $reject): void
|
||||||
|
{
|
||||||
|
$app = $this->apps->get($app);
|
||||||
|
if(!$app || !$app->isEnabled()) {
|
||||||
|
$reject("No application with this id found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$app->setPermission($this->user, $perm, $state == "yes"))
|
||||||
|
$reject("Invalid permission $perm");
|
||||||
|
|
||||||
|
$resolve(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pay(int $appId, float $amount, callable $resolve, callable $reject): void
|
||||||
|
{
|
||||||
|
$app = $this->apps->get($appId);
|
||||||
|
if(!$app || !$app->isEnabled()) {
|
||||||
|
$reject("No application with this id found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$coinsLeft = $this->user->getCoins() - $amount;
|
||||||
|
if($coinsLeft < 0) {
|
||||||
|
$reject(41, "Not enough money");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->user->setCoins($coinsLeft);
|
||||||
|
$this->user->save();
|
||||||
|
$app->addCoins($amount);
|
||||||
|
|
||||||
|
$t = time();
|
||||||
|
$resolve($t . "," . hash_hmac("whirlpool", "$appId:$amount:$t", CHANDLER_ROOT_CONF["security"]["secret"]));
|
||||||
|
}
|
||||||
|
|
||||||
|
function withdrawFunds(int $appId, callable $resolve, callable $reject): void
|
||||||
|
{
|
||||||
|
$app = $this->apps->get($appId);
|
||||||
|
if(!$app) {
|
||||||
|
$reject("No application with this id found");
|
||||||
|
return;
|
||||||
|
} else if($app->getOwner()->getId() != $this->user->getId()) {
|
||||||
|
$reject("You don't have rights to edit this app");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$coins = $app->getBalance();
|
||||||
|
$app->withdrawCoins();
|
||||||
|
$resolve($coins);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
namespace openvk\ServiceAPI;
|
namespace openvk\ServiceAPI;
|
||||||
|
use openvk\Web\Models\Entities\Post;
|
||||||
use openvk\Web\Models\Entities\User;
|
use openvk\Web\Models\Entities\User;
|
||||||
use openvk\Web\Models\Repositories\Posts;
|
use openvk\Web\Models\Repositories\Posts;
|
||||||
|
|
||||||
|
@ -55,4 +56,19 @@ class Wall implements Handler
|
||||||
|
|
||||||
$resolve((array) $res);
|
$resolve((array) $res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function newStatus(string $text, callable $resolve, callable $reject): void
|
||||||
|
{
|
||||||
|
$post = new Post;
|
||||||
|
$post->setOwner($this->user->getId());
|
||||||
|
$post->setWall($this->user->getId());
|
||||||
|
$post->setCreated(time());
|
||||||
|
$post->setContent($text);
|
||||||
|
$post->setAnonymous(false);
|
||||||
|
$post->setFlags(0);
|
||||||
|
$post->setNsfw(false);
|
||||||
|
$post->save();
|
||||||
|
|
||||||
|
$resolve($post->getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,16 +8,16 @@ final class Account extends VKAPIRequestHandler
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
|
||||||
return (object) [
|
return (object) [
|
||||||
"first_name" => $this->getUser()->getFirstName(),
|
"first_name" => $this->getUser()->getFirstName(),
|
||||||
"id" => $this->getUser()->getId(),
|
"id" => $this->getUser()->getId(),
|
||||||
"last_name" => $this->getUser()->getLastName(),
|
"last_name" => $this->getUser()->getLastName(),
|
||||||
"home_town" => $this->getUser()->getHometown(),
|
"home_town" => $this->getUser()->getHometown(),
|
||||||
"status" => $this->getUser()->getStatus(),
|
"status" => $this->getUser()->getStatus(),
|
||||||
"bdate" => "1.1.1970", # TODO
|
"bdate" => $this->getUser()->getBirthday()->format('%e.%m.%Y'),
|
||||||
"bdate_visibility" => 0, # TODO
|
"bdate_visibility" => $this->getUser()->getBirthdayPrivacy(),
|
||||||
"phone" => "+420 ** *** 228", # TODO
|
"phone" => "+420 ** *** 228", # TODO
|
||||||
"relation" => $this->getUser()->getMaritalStatus(),
|
"relation" => $this->getUser()->getMaritalStatus(),
|
||||||
"sex" => $this->getUser()->isFemale() ? 1 : 2
|
"sex" => $this->getUser()->isFemale() ? 1 : 2
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,20 +25,18 @@ final class Account extends VKAPIRequestHandler
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
|
||||||
# Цiй метод є заглушка
|
|
||||||
|
|
||||||
return (object) [
|
return (object) [
|
||||||
"2fa_required" => 0,
|
"2fa_required" => $this->getUser()->is2faEnabled() ? 1 : 0,
|
||||||
"country" => "CZ", # TODO
|
"country" => "CZ", # TODO
|
||||||
"eu_user" => false, # TODO
|
"eu_user" => false, # TODO
|
||||||
"https_required" => 1,
|
"https_required" => 1,
|
||||||
"intro" => 0,
|
"intro" => 0,
|
||||||
"community_comments" => false,
|
"community_comments" => false,
|
||||||
"is_live_streaming_enabled" => false,
|
"is_live_streaming_enabled" => false,
|
||||||
"is_new_live_streaming_enabled" => false,
|
"is_new_live_streaming_enabled" => false,
|
||||||
"lang" => 1,
|
"lang" => 1,
|
||||||
"no_wall_replies" => 0,
|
"no_wall_replies" => 0,
|
||||||
"own_posts_default" => 0
|
"own_posts_default" => 0
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +45,8 @@ final class Account extends VKAPIRequestHandler
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
|
||||||
$this->getUser()->setOnline(time());
|
$this->getUser()->setOnline(time());
|
||||||
|
$this->getUser()->save();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,9 +67,9 @@ final class Account extends VKAPIRequestHandler
|
||||||
function getCounters(string $filter = ""): object
|
function getCounters(string $filter = ""): object
|
||||||
{
|
{
|
||||||
return (object) [
|
return (object) [
|
||||||
"friends" => $this->getUser()->getFollowersCount(),
|
"friends" => $this->getUser()->getFollowersCount(),
|
||||||
"notifications" => $this->getUser()->getNotificationsCount(),
|
"notifications" => $this->getUser()->getNotificationsCount(),
|
||||||
"messages" => $this->getUser()->getUnreadMessagesCount()
|
"messages" => $this->getUser()->getUnreadMessagesCount()
|
||||||
];
|
];
|
||||||
|
|
||||||
# TODO: Filter
|
# TODO: Filter
|
||||||
|
|
|
@ -10,12 +10,12 @@ final class Audio extends VKAPIRequestHandler
|
||||||
return (object) [
|
return (object) [
|
||||||
"count" => 1,
|
"count" => 1,
|
||||||
"items" => [(object) [
|
"items" => [(object) [
|
||||||
"id" => 1,
|
"id" => 1,
|
||||||
"owner_id" => 1,
|
"owner_id" => 1,
|
||||||
"artist" => "В ОВК ПОКА НЕТ МУЗЫКИ",
|
"artist" => "В ОВК ПОКА НЕТ МУЗЫКИ",
|
||||||
"title" => "ЖДИТЕ :)))",
|
"title" => "ЖДИТЕ :)))",
|
||||||
"duration" => 22,
|
"duration" => 22,
|
||||||
"url" => $serverUrl . "/assets/packages/static/openvk/audio/nomusic.mp3"
|
"url" => $serverUrl . "/assets/packages/static/openvk/audio/nomusic.mp3"
|
||||||
]]
|
]]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
namespace openvk\VKAPI\Handlers;
|
namespace openvk\VKAPI\Handlers;
|
||||||
use openvk\Web\Models\Entities\User;
|
|
||||||
use openvk\Web\Models\Repositories\Users as UsersRepo;
|
use openvk\Web\Models\Repositories\Users as UsersRepo;
|
||||||
|
|
||||||
final class Friends extends VKAPIRequestHandler
|
final class Friends extends VKAPIRequestHandler
|
||||||
|
@ -15,7 +14,7 @@ final class Friends extends VKAPIRequestHandler
|
||||||
|
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
|
||||||
foreach ($users->get($user_id)->getFriends($offset, $count) as $friend) {
|
foreach($users->get($user_id)->getFriends($offset, $count) as $friend) {
|
||||||
$friends[$i] = $friend->getId();
|
$friends[$i] = $friend->getId();
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
@ -24,9 +23,8 @@ final class Friends extends VKAPIRequestHandler
|
||||||
|
|
||||||
$usersApi = new Users($this->getUser());
|
$usersApi = new Users($this->getUser());
|
||||||
|
|
||||||
if (!is_null($fields)) {
|
if(!is_null($fields))
|
||||||
$response = $usersApi->get(implode(',', $friends), $fields, 0, $count); # FIXME
|
$response = $usersApi->get(implode(',', $friends), $fields, 0, $count); # FIXME
|
||||||
}
|
|
||||||
|
|
||||||
return (object) [
|
return (object) [
|
||||||
"count" => $users->get($user_id)->getFriendsCount(),
|
"count" => $users->get($user_id)->getFriendsCount(),
|
||||||
|
@ -70,33 +68,28 @@ final class Friends extends VKAPIRequestHandler
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
|
||||||
$users = new UsersRepo;
|
$users = new UsersRepo;
|
||||||
|
$user = $users->get(intval($user_id));
|
||||||
$user = $users->get(intval($user_id));
|
|
||||||
|
|
||||||
if(is_null($user)){
|
if(is_null($user)) {
|
||||||
$this->fail(177, "Cannot add this user to friends as user not found");
|
$this->fail(177, "Cannot add this user to friends as user not found");
|
||||||
} else if($user->getId() == $this->getUser()->getId()) {
|
} else if($user->getId() == $this->getUser()->getId()) {
|
||||||
$this->fail(174, "Cannot add user himself as friend");
|
$this->fail(174, "Cannot add user himself as friend");
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($user->getSubscriptionStatus($this->getUser())) {
|
switch($user->getSubscriptionStatus($this->getUser())) {
|
||||||
case 0:
|
case 0:
|
||||||
$user->toggleSubscription($this->getUser());
|
$user->toggleSubscription($this->getUser());
|
||||||
return 1;
|
return 1;
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
$user->toggleSubscription($this->getUser());
|
$user->toggleSubscription($this->getUser());
|
||||||
return 2;
|
return 2;
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
return 2;
|
return 2;
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 1;
|
return 1;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,15 +101,13 @@ final class Friends extends VKAPIRequestHandler
|
||||||
|
|
||||||
$user = $users->get(intval($user_id));
|
$user = $users->get(intval($user_id));
|
||||||
|
|
||||||
switch ($user->getSubscriptionStatus($this->getUser())) {
|
switch($user->getSubscriptionStatus($this->getUser())) {
|
||||||
case 3:
|
case 3:
|
||||||
$user->toggleSubscription($this->getUser());
|
$user->toggleSubscription($this->getUser());
|
||||||
return 1;
|
return 1;
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fail(15, "Access denied: No friend or friend request found.");
|
fail(15, "Access denied: No friend or friend request found.");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,31 +121,43 @@ final class Friends extends VKAPIRequestHandler
|
||||||
|
|
||||||
$response = [];
|
$response = [];
|
||||||
|
|
||||||
for ($i=0; $i < sizeof($friends); $i++) {
|
for($i=0; $i < sizeof($friends); $i++) {
|
||||||
$friend = $users->get(intval($friends[$i]));
|
$friend = $users->get(intval($friends[$i]));
|
||||||
|
|
||||||
$status = 0;
|
|
||||||
switch ($friend->getSubscriptionStatus($this->getUser())) {
|
|
||||||
case 3:
|
|
||||||
case 0:
|
|
||||||
$status = $friend->getSubscriptionStatus($this->getUser());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
$status = 2;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
$status = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$response[] = (object)[
|
$response[] = (object)[
|
||||||
"friend_status" => $friend->getSubscriptionStatus($this->getUser()),
|
"friend_status" => $friend->getSubscriptionStatus($this->getUser()),
|
||||||
"user_id" => $friend->getId()
|
"user_id" => $friend->getId()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
function getRequests(string $fields = "", int $offset = 0, int $count = 100): object
|
||||||
|
{
|
||||||
|
$this->requireUser();
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
$offset++;
|
||||||
|
$followers = [];
|
||||||
|
|
||||||
|
foreach($this->getUser()->getFollowers() as $follower) {
|
||||||
|
$followers[$i] = $follower->getId();
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = $followers;
|
||||||
|
$usersApi = new Users($this->getUser());
|
||||||
|
|
||||||
|
if(!is_null($fields))
|
||||||
|
$response = $usersApi->get(implode(',', $followers), $fields, 0, $count); # FIXME
|
||||||
|
|
||||||
|
foreach($response as $user)
|
||||||
|
$user->user_id = $user->id;
|
||||||
|
|
||||||
|
return (object) [
|
||||||
|
"count" => $this->getUser()->getFollowersCount(),
|
||||||
|
"items" => $response
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
namespace openvk\VKAPI\Handlers;
|
namespace openvk\VKAPI\Handlers;
|
||||||
use openvk\Web\Models\Entities\User;
|
|
||||||
use openvk\Web\Models\Entities\Clubs;
|
|
||||||
use openvk\Web\Models\Repositories\Clubs as ClubsRepo;
|
use openvk\Web\Models\Repositories\Clubs as ClubsRepo;
|
||||||
use openvk\Web\Models\Repositories\Users as UsersRepo;
|
use openvk\Web\Models\Repositories\Users as UsersRepo;
|
||||||
use openvk\Web\Models\Entities\Post;
|
|
||||||
use openvk\Web\Models\Entities\Postable;
|
|
||||||
use openvk\Web\Models\Repositories\Posts as PostsRepo;
|
|
||||||
|
|
||||||
final class Groups extends VKAPIRequestHandler
|
final class Groups extends VKAPIRequestHandler
|
||||||
{
|
{
|
||||||
|
@ -14,73 +9,91 @@ final class Groups extends VKAPIRequestHandler
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
|
||||||
if ($user_id == 0) {
|
if($user_id == 0) {
|
||||||
foreach($this->getUser()->getClubs($offset+1) as $club) {
|
foreach($this->getUser()->getClubs($offset+1) as $club)
|
||||||
$clbs[] = $club;
|
$clbs[] = $club;
|
||||||
}
|
|
||||||
$clbsCount = $this->getUser()->getClubCount();
|
$clbsCount = $this->getUser()->getClubCount();
|
||||||
} else {
|
} else {
|
||||||
$users = new UsersRepo;
|
$users = new UsersRepo;
|
||||||
$user = $users->get($user_id);
|
$user = $users->get($user_id);
|
||||||
if (is_null($user)) {
|
|
||||||
|
if(is_null($user))
|
||||||
$this->fail(15, "Access denied");
|
$this->fail(15, "Access denied");
|
||||||
}
|
|
||||||
foreach($user->getClubs($offset+1) as $club) {
|
foreach($user->getClubs($offset+1) as $club)
|
||||||
$clbs[] = $club;
|
$clbs[] = $club;
|
||||||
}
|
|
||||||
$clbsCount = $user->getClubCount();
|
$clbsCount = $user->getClubCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
$rClubs;
|
$rClubs;
|
||||||
|
|
||||||
$ic = sizeof($clbs);
|
$ic = sizeof($clbs);
|
||||||
|
if(sizeof($clbs) > $count)
|
||||||
|
$ic = $count;
|
||||||
|
|
||||||
if(sizeof($clbs) > $count) $ic = $count;
|
if(!empty($clbs)) {
|
||||||
|
$clbs = array_slice($clbs, $offset * $count);
|
||||||
|
|
||||||
$clbs = array_slice($clbs, $offset * $count);
|
for($i=0; $i < $ic; $i++) {
|
||||||
|
$usr = $clbs[$i];
|
||||||
|
if(is_null($usr)) {
|
||||||
|
$rClubs[$i] = (object)[
|
||||||
|
"id" => $clbs[$i],
|
||||||
|
"name" => "DELETED",
|
||||||
|
"deactivated" => "deleted"
|
||||||
|
];
|
||||||
|
} else if($clbs[$i] == NULL) {
|
||||||
|
|
||||||
for ($i=0; $i < $ic; $i++) {
|
} else {
|
||||||
$usr = $clbs[$i];
|
$rClubs[$i] = (object) [
|
||||||
if(is_null($usr))
|
"id" => $usr->getId(),
|
||||||
{
|
"name" => $usr->getName(),
|
||||||
$rClubs[$i] = (object)[
|
"screen_name" => $usr->getShortCode(),
|
||||||
"id" => $clbs[$i],
|
"is_closed" => false,
|
||||||
"name" => "DELETED",
|
"can_access_closed" => true,
|
||||||
"deactivated" => "deleted"
|
];
|
||||||
];
|
|
||||||
}else if($clbs[$i] == NULL){
|
|
||||||
|
|
||||||
}else{
|
$flds = explode(',', $fields);
|
||||||
$rClubs[$i] = (object)[
|
|
||||||
"id" => $usr->getId(),
|
|
||||||
"name" => $usr->getName(),
|
|
||||||
"screen_name" => $usr->getShortCode(),
|
|
||||||
"is_closed" => false,
|
|
||||||
"can_access_closed" => true,
|
|
||||||
];
|
|
||||||
|
|
||||||
$flds = explode(',', $fields);
|
foreach($flds as $field) {
|
||||||
|
switch($field) {
|
||||||
foreach($flds as $field) {
|
case "verified":
|
||||||
switch ($field) {
|
$rClubs[$i]->verified = intval($usr->isVerified());
|
||||||
case 'verified':
|
break;
|
||||||
$rClubs[$i]->verified = intval($usr->isVerified());
|
case "has_photo":
|
||||||
break;
|
$rClubs[$i]->has_photo = is_null($usr->getAvatarPhoto()) ? 0 : 1;
|
||||||
case 'has_photo':
|
break;
|
||||||
$rClubs[$i]->has_photo = is_null($usr->getAvatarPhoto()) ? 0 : 1;
|
case "photo_max_orig":
|
||||||
break;
|
$rClubs[$i]->photo_max_orig = $usr->getAvatarURL();
|
||||||
case 'photo_max_orig':
|
break;
|
||||||
$rClubs[$i]->photo_max_orig = $usr->getAvatarURL();
|
case "photo_max":
|
||||||
break;
|
$rClubs[$i]->photo_max = $usr->getAvatarURL("original"); // ORIGINAL ANDREI CHINITEL 🥵🥵🥵🥵
|
||||||
case 'photo_max':
|
break;
|
||||||
$rClubs[$i]->photo_max = $usr->getAvatarURL();
|
case "photo_50":
|
||||||
break;
|
$rClubs[$i]->photo_50 = $usr->getAvatarURL();
|
||||||
case 'members_count':
|
break;
|
||||||
$rClubs[$i]->members_count = $usr->getFollowersCount();
|
case "photo_100":
|
||||||
break;
|
$rClubs[$i]->photo_100 = $usr->getAvatarURL("tiny");
|
||||||
|
break;
|
||||||
|
case "photo_200":
|
||||||
|
$rClubs[$i]->photo_200 = $usr->getAvatarURL("normal");
|
||||||
|
break;
|
||||||
|
case "photo_200_orig":
|
||||||
|
$rClubs[$i]->photo_200_orig = $usr->getAvatarURL("normal");
|
||||||
|
break;
|
||||||
|
case "photo_400_orig":
|
||||||
|
$rClubs[$i]->photo_400_orig = $usr->getAvatarURL("normal");
|
||||||
|
break;
|
||||||
|
case "members_count":
|
||||||
|
$rClubs[$i]->members_count = $usr->getFollowersCount();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$rClubs = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return (object) [
|
return (object) [
|
||||||
|
@ -91,14 +104,12 @@ final class Groups extends VKAPIRequestHandler
|
||||||
|
|
||||||
function getById(string $group_ids = "", string $group_id = "", string $fields = ""): ?array
|
function getById(string $group_ids = "", string $group_id = "", string $fields = ""): ?array
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
|
||||||
|
|
||||||
$clubs = new ClubsRepo;
|
$clubs = new ClubsRepo;
|
||||||
|
|
||||||
if ($group_ids == NULL && $group_id != NULL)
|
if($group_ids == NULL && $group_id != NULL)
|
||||||
$group_ids = $group_id;
|
$group_ids = $group_id;
|
||||||
|
|
||||||
if ($group_ids == NULL && $group_id == NULL)
|
if($group_ids == NULL && $group_id == NULL)
|
||||||
$this->fail(100, "One of the parameters specified was missing or invalid: group_ids is undefined");
|
$this->fail(100, "One of the parameters specified was missing or invalid: group_ids is undefined");
|
||||||
|
|
||||||
$clbs = explode(',', $group_ids);
|
$clbs = explode(',', $group_ids);
|
||||||
|
@ -106,7 +117,7 @@ final class Groups extends VKAPIRequestHandler
|
||||||
|
|
||||||
$ic = sizeof($clbs);
|
$ic = sizeof($clbs);
|
||||||
|
|
||||||
for ($i=0; $i < $ic; $i++) {
|
for($i=0; $i < $ic; $i++) {
|
||||||
if($i > 500)
|
if($i > 500)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -114,68 +125,88 @@ final class Groups extends VKAPIRequestHandler
|
||||||
$this->fail(100, "ты ошибся чутка, у айди группы убери минус");
|
$this->fail(100, "ты ошибся чутка, у айди группы убери минус");
|
||||||
|
|
||||||
$clb = $clubs->get((int) $clbs[$i]);
|
$clb = $clubs->get((int) $clbs[$i]);
|
||||||
if(is_null($clb))
|
if(is_null($clb)) {
|
||||||
{
|
|
||||||
$response[$i] = (object)[
|
$response[$i] = (object)[
|
||||||
"id" => intval($clbs[$i]),
|
"id" => intval($clbs[$i]),
|
||||||
"name" => "DELETED",
|
"name" => "DELETED",
|
||||||
"screen_name" => "club".intval($clbs[$i]),
|
"screen_name" => "club".intval($clbs[$i]),
|
||||||
"type" => "group",
|
"type" => "group",
|
||||||
"description" => "This group was deleted or it doesn't exist"
|
"description" => "This group was deleted or it doesn't exist"
|
||||||
];
|
];
|
||||||
}else if($clbs[$i] == NULL){
|
} else if($clbs[$i] == NULL) {
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
$response[$i] = (object)[
|
$response[$i] = (object)[
|
||||||
"id" => $clb->getId(),
|
"id" => $clb->getId(),
|
||||||
"name" => $clb->getName(),
|
"name" => $clb->getName(),
|
||||||
"screen_name" => $clb->getShortCode() ?? "club".$clb->getId(),
|
"screen_name" => $clb->getShortCode() ?? "club".$clb->getId(),
|
||||||
"is_closed" => false,
|
"is_closed" => false,
|
||||||
"type" => "group",
|
"type" => "group",
|
||||||
"can_access_closed" => true,
|
"can_access_closed" => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
$flds = explode(',', $fields);
|
$flds = explode(',', $fields);
|
||||||
|
|
||||||
foreach($flds as $field) {
|
foreach($flds as $field) {
|
||||||
switch ($field) {
|
switch($field) {
|
||||||
case 'verified':
|
case "verified":
|
||||||
$response[$i]->verified = intval($clb->isVerified());
|
$response[$i]->verified = intval($clb->isVerified());
|
||||||
break;
|
break;
|
||||||
case 'has_photo':
|
case "has_photo":
|
||||||
$response[$i]->has_photo = is_null($clb->getAvatarPhoto()) ? 0 : 1;
|
$response[$i]->has_photo = is_null($clb->getAvatarPhoto()) ? 0 : 1;
|
||||||
break;
|
break;
|
||||||
case 'photo_max_orig':
|
case "photo_max_orig":
|
||||||
$response[$i]->photo_max_orig = $clb->getAvatarURL();
|
$response[$i]->photo_max_orig = $clb->getAvatarURL();
|
||||||
break;
|
break;
|
||||||
case 'photo_max':
|
case "photo_max":
|
||||||
$response[$i]->photo_max = $clb->getAvatarURL();
|
$response[$i]->photo_max = $clb->getAvatarURL();
|
||||||
break;
|
break;
|
||||||
case 'members_count':
|
case "photo_50":
|
||||||
|
$response[$i]->photo_50 = $clb->getAvatarURL();
|
||||||
|
break;
|
||||||
|
case "photo_100":
|
||||||
|
$response[$i]->photo_100 = $clb->getAvatarURL("tiny");
|
||||||
|
break;
|
||||||
|
case "photo_200":
|
||||||
|
$response[$i]->photo_200 = $clb->getAvatarURL("normal");
|
||||||
|
break;
|
||||||
|
case "photo_200_orig":
|
||||||
|
$response[$i]->photo_200_orig = $clb->getAvatarURL("normal");
|
||||||
|
break;
|
||||||
|
case "photo_400_orig":
|
||||||
|
$response[$i]->photo_400_orig = $clb->getAvatarURL("normal");
|
||||||
|
break;
|
||||||
|
case "members_count":
|
||||||
$response[$i]->members_count = $clb->getFollowersCount();
|
$response[$i]->members_count = $clb->getFollowersCount();
|
||||||
break;
|
break;
|
||||||
case 'site':
|
case "site":
|
||||||
$response[$i]->site = $clb->getWebsite();
|
$response[$i]->site = $clb->getWebsite();
|
||||||
break;
|
break;
|
||||||
case 'description':
|
case "description":
|
||||||
$response[$i]->desctiption = $clb->getDescription();
|
$response[$i]->desctiption = $clb->getDescription();
|
||||||
break;
|
break;
|
||||||
case 'contacts':
|
case "contacts":
|
||||||
$contacts;
|
$contacts;
|
||||||
$contactTmp = $clb->getManagers(1, true);
|
$contactTmp = $clb->getManagers(1, true);
|
||||||
foreach($contactTmp as $contact) {
|
|
||||||
|
foreach($contactTmp as $contact)
|
||||||
$contacts[] = array(
|
$contacts[] = array(
|
||||||
'user_id' => $contact->getUser()->getId(),
|
"user_id" => $contact->getUser()->getId(),
|
||||||
'desc' => $contact->getComment()
|
"desc" => $contact->getComment()
|
||||||
);
|
);
|
||||||
}
|
|
||||||
$response[$i]->contacts = $contacts;
|
$response[$i]->contacts = $contacts;
|
||||||
break;
|
break;
|
||||||
case 'can_post':
|
case "can_post":
|
||||||
if($clb->canBeModifiedBy($this->getUser()))
|
if(!is_null($this->getUser()))
|
||||||
$response[$i]->can_post = true;
|
if($clb->canBeModifiedBy($this->getUser()))
|
||||||
else
|
$response[$i]->can_post = true;
|
||||||
$response[$i]->can_post = $clb->canPost();
|
else
|
||||||
|
$response[$i]->can_post = $clb->canPost();
|
||||||
|
break;
|
||||||
|
case "is_member":
|
||||||
|
if(!is_null($this->getUser()))
|
||||||
|
$response[$i]->is_member = (int) $clb->getSubscriptionStatus($this->getUser());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,39 +9,38 @@ final class Likes extends VKAPIRequestHandler
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
|
||||||
switch ($type) {
|
switch($type) {
|
||||||
case 'post':
|
case "post":
|
||||||
$post = (new PostsRepo)->getPostById($owner_id, $item_id);
|
$post = (new PostsRepo)->getPostById($owner_id, $item_id);
|
||||||
if (is_null($post)) $this->fail(100, 'One of the parameters specified was missing or invalid: object not found');
|
if(is_null($post))
|
||||||
|
$this->fail(100, "One of the parameters specified was missing or invalid: object not found");
|
||||||
|
|
||||||
$post->setLike(true, $this->getUser());
|
$post->setLike(true, $this->getUser());
|
||||||
return (object)[
|
|
||||||
|
return (object) [
|
||||||
"likes" => $post->getLikesCount()
|
"likes" => $post->getLikesCount()
|
||||||
];
|
];
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
$this->fail(100, 'One of the parameters specified was missing or invalid: incorrect type');
|
$this->fail(100, "One of the parameters specified was missing or invalid: incorrect type");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove(string $type, int $owner_id, int $item_id): object
|
function delete(string $type, int $owner_id, int $item_id): object
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
|
||||||
switch ($type) {
|
switch($type) {
|
||||||
case 'post':
|
case "post":
|
||||||
$post = (new PostsRepo)->getPostById($owner_id, $item_id);
|
$post = (new PostsRepo)->getPostById($owner_id, $item_id);
|
||||||
if (is_null($post)) $this->fail(100, 'One of the parameters specified was missing or invalid: object not found');
|
if (is_null($post))
|
||||||
|
$this->fail(100, "One of the parameters specified was missing or invalid: object not found");
|
||||||
|
|
||||||
$post->setLike(false, $this->getUser());
|
$post->setLike(false, $this->getUser());
|
||||||
return (object)[
|
return (object) [
|
||||||
"likes" => $post->getLikesCount()
|
"likes" => $post->getLikesCount()
|
||||||
];
|
];
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
$this->fail(100, 'One of the parameters specified was missing or invalid: incorrect type');
|
$this->fail(100, "One of the parameters specified was missing or invalid: incorrect type");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,26 +48,26 @@ final class Likes extends VKAPIRequestHandler
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
|
||||||
switch ($type) {
|
switch($type) {
|
||||||
case 'post':
|
case "post":
|
||||||
$user = (new UsersRepo)->get($user_id);
|
$user = (new UsersRepo)->get($user_id);
|
||||||
if (is_null($user)) return (object)[
|
if (is_null($user))
|
||||||
"liked" => 0,
|
return (object) [
|
||||||
"copied" => 0,
|
"liked" => 0,
|
||||||
"sex" => 0
|
"copied" => 0,
|
||||||
];
|
"sex" => 0
|
||||||
|
];
|
||||||
|
|
||||||
$post = (new PostsRepo)->getPostById($owner_id, $item_id);
|
$post = (new PostsRepo)->getPostById($owner_id, $item_id);
|
||||||
if (is_null($post)) $this->fail(100, 'One of the parameters specified was missing or invalid: object not found');
|
if (is_null($post))
|
||||||
|
$this->fail(100, "One of the parameters specified was missing or invalid: object not found");
|
||||||
|
|
||||||
return (object)[
|
return (object) [
|
||||||
"liked" => (int) $post->hasLikeFrom($user),
|
"liked" => (int) $post->hasLikeFrom($user),
|
||||||
"copied" => 0 # TODO: handle this
|
"copied" => 0 # TODO: handle this
|
||||||
];
|
];
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
$this->fail(100, 'One of the parameters specified was missing or invalid: incorrect type');
|
$this->fail(100, "One of the parameters specified was missing or invalid: incorrect type");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ final class Messages extends VKAPIRequestHandler
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$author = $message->getSender()->getId() === $this->getUser()->getId() ? $message->getRecipient()->getId() : $message->getSender()->getId();
|
$author = $message->getSender()->getId() === $this->getUser()->getId() ? $message->getRecipient()->getId() : $message->getSender()->getId();
|
||||||
$rMsg = new APIMsg;
|
$rMsg = new APIMsg;
|
||||||
|
|
||||||
$rMsg->id = $message->getId();
|
$rMsg->id = $message->getId();
|
||||||
$rMsg->user_id = $author;
|
$rMsg->user_id = $author;
|
||||||
|
@ -99,7 +99,7 @@ final class Messages extends VKAPIRequestHandler
|
||||||
if(!$peer)
|
if(!$peer)
|
||||||
$this->fail(936, "There is no peer with this id");
|
$this->fail(936, "There is no peer with this id");
|
||||||
|
|
||||||
if($this->getUser()->getId() !== $peer->getId() && $peer->getSubscriptionStatus($this->getUser()) !== 3)
|
if($this->getUser()->getId() !== $peer->getId() && !$peer->getPrivacyPermission('messages.write', $this->getUser()))
|
||||||
$this->fail(945, "This chat is disabled because of privacy settings");
|
$this->fail(945, "This chat is disabled because of privacy settings");
|
||||||
|
|
||||||
# Finally we get to send a message!
|
# Finally we get to send a message!
|
||||||
|
@ -123,9 +123,8 @@ final class Messages extends VKAPIRequestHandler
|
||||||
$items = [];
|
$items = [];
|
||||||
foreach($ids as $id) {
|
foreach($ids as $id) {
|
||||||
$message = $msgs->get((int) $id);
|
$message = $msgs->get((int) $id);
|
||||||
if(!$message || $message->getSender()->getId() !== $this->getUser()->getId() && $message->getRecipient()->getId() !== $this->getUser()->getId()) {
|
if(!$message || $message->getSender()->getId() !== $this->getUser()->getId() && $message->getRecipient()->getId() !== $this->getUser()->getId())
|
||||||
$items[$id] = 0;
|
$items[$id] = 0;
|
||||||
}
|
|
||||||
|
|
||||||
$message->delete();
|
$message->delete();
|
||||||
$items[$id] = 1;
|
$items[$id] = 1;
|
||||||
|
@ -153,6 +152,7 @@ final class Messages extends VKAPIRequestHandler
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
|
||||||
$convos = (new MSGRepo)->getCorrespondencies($this->getUser(), -1, $count, $offset);
|
$convos = (new MSGRepo)->getCorrespondencies($this->getUser(), -1, $count, $offset);
|
||||||
|
$convosCount = (new MSGRepo)->getCorrespondenciesCount($this->getUser());
|
||||||
$list = [];
|
$list = [];
|
||||||
|
|
||||||
$users = [];
|
$users = [];
|
||||||
|
@ -186,7 +186,7 @@ final class Messages extends VKAPIRequestHandler
|
||||||
else
|
else
|
||||||
$author = $lastMessage->getSender()->getId();
|
$author = $lastMessage->getSender()->getId();
|
||||||
|
|
||||||
$lastMessagePreview = new APIMsg;
|
$lastMessagePreview = new APIMsg;
|
||||||
$lastMessagePreview->id = $lastMessage->getId();
|
$lastMessagePreview->id = $lastMessage->getId();
|
||||||
$lastMessagePreview->user_id = $author;
|
$lastMessagePreview->user_id = $author;
|
||||||
$lastMessagePreview->from_id = $lastMessage->getSender()->getId();
|
$lastMessagePreview->from_id = $lastMessage->getSender()->getId();
|
||||||
|
@ -196,9 +196,8 @@ final class Messages extends VKAPIRequestHandler
|
||||||
$lastMessagePreview->body = $lastMessage->getText(false);
|
$lastMessagePreview->body = $lastMessage->getText(false);
|
||||||
$lastMessagePreview->text = $lastMessage->getText(false);
|
$lastMessagePreview->text = $lastMessage->getText(false);
|
||||||
$lastMessagePreview->emoji = true;
|
$lastMessagePreview->emoji = true;
|
||||||
|
|
||||||
if($extended == 1) {
|
if($extended == 1) {
|
||||||
$users[] = $lastMessage->getSender()->getId();
|
|
||||||
$users[] = $author;
|
$users[] = $author;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,21 +210,81 @@ final class Messages extends VKAPIRequestHandler
|
||||||
|
|
||||||
if($extended == 0){
|
if($extended == 0){
|
||||||
return (object) [
|
return (object) [
|
||||||
"count" => sizeof($list),
|
"count" => $convosCount,
|
||||||
"items" => $list,
|
"items" => $list,
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
|
$users[] = $this->getUser()->getId();
|
||||||
$users = array_unique($users);
|
$users = array_unique($users);
|
||||||
|
|
||||||
return (object) [
|
return (object) [
|
||||||
"count" => sizeof($list),
|
"count" => $convosCount,
|
||||||
"items" => $list,
|
"items" => $list,
|
||||||
"profiles" => (new APIUsers)->get(implode(',', $users), $fields, $offset, $count)
|
"profiles" => (!empty($users) ? (new APIUsers)->get(implode(',', $users), $fields, 0, $count+1) : [])
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getConversationsById(string $peer_ids, int $extended = 0, string $fields = "")
|
||||||
|
{
|
||||||
|
$this->requireUser();
|
||||||
|
|
||||||
|
$peers = explode(',', $peer_ids);
|
||||||
|
|
||||||
|
$output = [
|
||||||
|
"count" => 0,
|
||||||
|
"items" => []
|
||||||
|
];
|
||||||
|
|
||||||
|
$userslist = [];
|
||||||
|
|
||||||
|
foreach($peers as $peer) {
|
||||||
|
if(key($peers) > 100)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(is_null($user_id = $this->resolvePeer((int) $peer)))
|
||||||
|
$this->fail(-151, "Chats are not implemented");
|
||||||
|
|
||||||
|
$user = (new USRRepo)->get((int) $peer);
|
||||||
|
|
||||||
|
$dialogue = new Correspondence($this->getUser(), $user);
|
||||||
|
$iterator = $dialogue->getMessages(Correspondence::CAP_BEHAVIOUR_START_MESSAGE_ID, 0, 1, 0, false);
|
||||||
|
$msg = $iterator[0]->unwrap(); // шоб удобнее было
|
||||||
|
$output['items'][] = [
|
||||||
|
"peer" => [
|
||||||
|
"id" => $user->getId(),
|
||||||
|
"type" => "user",
|
||||||
|
"local_id" => $user->getId()
|
||||||
|
],
|
||||||
|
"last_message_id" => $msg->id,
|
||||||
|
"in_read" => $msg->id,
|
||||||
|
"out_read" => $msg->id,
|
||||||
|
"sort_id" => [
|
||||||
|
"major_id" => 0,
|
||||||
|
"minor_id" => $msg->id, // КОНЕЧНО ЖЕ
|
||||||
|
],
|
||||||
|
"last_conversation_message_id" => $user->getId(),
|
||||||
|
"in_read_cmid" => $user->getId(),
|
||||||
|
"out_read_cmid" => $user->getId(),
|
||||||
|
"is_marked_unread" => $iterator[0]->isUnread(),
|
||||||
|
"important" => false, // целестора когда релиз
|
||||||
|
"can_write" => [
|
||||||
|
"allowed" => ($user->getId() === $this->getUser()->getId() || $user->getPrivacyPermission('messages.write', $this->getUser()) === true)
|
||||||
|
]
|
||||||
|
];
|
||||||
|
$userslist[] = $user->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($extended == 1) {
|
||||||
|
$userslist = array_unique($userslist);
|
||||||
|
$output['profiles'] = (!empty($userslist) ? (new APIUsers)->get(implode(',', $userslist), $fields) : []);
|
||||||
|
}
|
||||||
|
|
||||||
|
$output['count'] = sizeof($output['items']);
|
||||||
|
return (object) $output;
|
||||||
|
}
|
||||||
|
|
||||||
function getHistory(int $offset = 0, int $count = 20, int $user_id = -1, int $peer_id = -1, int $start_message_id = 0, int $rev = 0, int $extended = 0): object
|
function getHistory(int $offset = 0, int $count = 20, int $user_id = -1, int $peer_id = -1, int $start_message_id = 0, int $rev = 0, int $extended = 0, string $fields = ""): object
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
|
||||||
|
@ -257,10 +316,18 @@ final class Messages extends VKAPIRequestHandler
|
||||||
$results[] = $rMsg;
|
$results[] = $rMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (object) [
|
$output = [
|
||||||
"count" => sizeof($results),
|
"count" => sizeof($results),
|
||||||
"items" => $results,
|
"items" => $results,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if ($extended == 1) {
|
||||||
|
$users[] = $this->getUser()->getId();
|
||||||
|
$users[] = $user_id;
|
||||||
|
$output["profiles"] = (!empty($users) ? (new APIUsers($this->getUser()))->get(implode(',', $users), $fields) : []);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (object) $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLongPollHistory(int $ts = -1, int $preview_length = 0, int $events_limit = 1000, int $msgs_limit = 1000): object
|
function getLongPollHistory(int $ts = -1, int $preview_length = 0, int $events_limit = 1000, int $msgs_limit = 1000): object
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
namespace openvk\VKAPI\Handlers;
|
namespace openvk\VKAPI\Handlers;
|
||||||
use openvk\Web\Models\Entities\User;
|
|
||||||
use openvk\Web\Models\Entities\Post;
|
|
||||||
use openvk\Web\Models\Entities\Postable;
|
|
||||||
use Chandler\Database\DatabaseConnection;
|
use Chandler\Database\DatabaseConnection;
|
||||||
use openvk\Web\Models\Repositories\Posts as PostsRepo;
|
use openvk\Web\Models\Repositories\Posts as PostsRepo;
|
||||||
use openvk\VKAPI\Handlers\Wall;
|
use openvk\VKAPI\Handlers\Wall;
|
||||||
|
@ -13,8 +10,6 @@ final class Newsfeed extends VKAPIRequestHandler
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
|
||||||
if($offset != 0) $start_from = $offset;
|
|
||||||
|
|
||||||
$id = $this->getUser()->getId();
|
$id = $this->getUser()->getId();
|
||||||
$subs = DatabaseConnection::i()
|
$subs = DatabaseConnection::i()
|
||||||
->getContext()
|
->getContext()
|
||||||
|
@ -26,17 +21,20 @@ final class Newsfeed extends VKAPIRequestHandler
|
||||||
$ids[] = $this->getUser()->getId();
|
$ids[] = $this->getUser()->getId();
|
||||||
|
|
||||||
$posts = DatabaseConnection::i()
|
$posts = DatabaseConnection::i()
|
||||||
->getContext()
|
->getContext()
|
||||||
->table("posts")
|
->table("posts")
|
||||||
->select("id")
|
->select("id")
|
||||||
->where("wall IN (?)", $ids)
|
->where("wall IN (?)", $ids)
|
||||||
->where("deleted", 0)
|
->where("deleted", 0)
|
||||||
->order("created DESC");
|
->where("id < (?)", empty($start_from) ? time()+1 : $start_from)
|
||||||
|
->order("created DESC");
|
||||||
|
|
||||||
$rposts = [];
|
$rposts = [];
|
||||||
foreach($posts->page((int) ($offset + 1), $count) as $post)
|
foreach($posts->page((int) ($offset + 1), $count) as $post)
|
||||||
$rposts[] = (new PostsRepo)->get($post->id)->getPrettyId();
|
$rposts[] = (new PostsRepo)->get($post->id)->getPrettyId();
|
||||||
|
|
||||||
return (new Wall)->getById(implode(',', $rposts), $extended, $fields, $this->getUser());
|
$response = (new Wall)->getById(implode(',', $rposts), $extended, $fields, $this->getUser());
|
||||||
|
$response->next_from = end(end($posts->page((int) ($offset + 1), $count))); // ну и костыли пиздец конечно)
|
||||||
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
namespace openvk\VKAPI\Handlers;
|
namespace openvk\VKAPI\Handlers;
|
||||||
|
use openvk\Web\Models\Repositories\{Users as UsersRepo, Clubs as ClubsRepo, Posts as PostsRepo};
|
||||||
|
|
||||||
final class Ovk extends VKAPIRequestHandler
|
final class Ovk extends VKAPIRequestHandler
|
||||||
{
|
{
|
||||||
|
@ -21,4 +22,54 @@ final class Ovk extends VKAPIRequestHandler
|
||||||
{
|
{
|
||||||
return "крылышки";
|
return "крылышки";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function aboutInstance(string $fields = "statistics,administrators,popular_groups,links", string $admin_fields = "", string $group_fields = ""): object
|
||||||
|
{
|
||||||
|
$fields = explode(',', $fields);
|
||||||
|
$response = (object) [];
|
||||||
|
|
||||||
|
if(in_array("statistics", $fields)) {
|
||||||
|
$usersStats = (new UsersRepo)->getStatistics();
|
||||||
|
$clubsCount = (new ClubsRepo)->getCount();
|
||||||
|
$postsCount = (new PostsRepo)->getCount();
|
||||||
|
$response->statistics = (object) [
|
||||||
|
"users_count" => $usersStats->all,
|
||||||
|
"online_users_count" => $usersStats->online,
|
||||||
|
"active_users_count" => $usersStats->active,
|
||||||
|
"groups_count" => $clubsCount,
|
||||||
|
"wall_posts_count" => $postsCount
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(in_array("administrators", $fields)) {
|
||||||
|
$admins = iterator_to_array((new UsersRepo)->getInstanceAdmins());
|
||||||
|
$adminsResponse = (new Users($this->getUser()))->get(implode(',', array_map(function($admin) {
|
||||||
|
return $admin->getId();
|
||||||
|
}, $admins)), $admin_fields, 0, sizeof($admins));
|
||||||
|
$response->administrators = (object) [
|
||||||
|
"count" => sizeof($admins),
|
||||||
|
"items" => $adminsResponse
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(in_array("popular_groups", $fields)) {
|
||||||
|
$popularClubs = iterator_to_array((new ClubsRepo)->getPopularClubs());
|
||||||
|
$clubsResponse = (new Groups($this->getUser()))->getById(implode(',', array_map(function($entry) {
|
||||||
|
return $entry->club->getId();
|
||||||
|
}, $popularClubs)), "", "members_count, " . $group_fields);
|
||||||
|
|
||||||
|
$response->popular_groups = (object) [
|
||||||
|
"count" => sizeof($popularClubs),
|
||||||
|
"items" => $clubsResponse
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(in_array("links", $fields))
|
||||||
|
$response->links = (object) [
|
||||||
|
"count" => sizeof(OPENVK_ROOT_CONF['openvk']['preferences']['about']['links']),
|
||||||
|
"items" => is_null(OPENVK_ROOT_CONF['openvk']['preferences']['about']['links']) ? [] : OPENVK_ROOT_CONF['openvk']['preferences']['about']['links']
|
||||||
|
];
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
42
VKAPI/Handlers/Pay.php
Normal file
42
VKAPI/Handlers/Pay.php
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<?php declare(strict_types=1);
|
||||||
|
namespace openvk\VKAPI\Handlers;
|
||||||
|
use openvk\Web\Models\Repositories\Applications;
|
||||||
|
|
||||||
|
final class Pay extends VKAPIRequestHandler
|
||||||
|
{
|
||||||
|
function getIdByMarketingId(string $marketing_id): int
|
||||||
|
{
|
||||||
|
[$hexId, $signature] = explode("_", $marketing_id);
|
||||||
|
try {
|
||||||
|
$key = CHANDLER_ROOT_CONF["security"]["secret"];
|
||||||
|
if(sodium_memcmp(base64_decode($signature), hash_hmac("sha512/224", $hexId, $key, true)) == -1)
|
||||||
|
$this->fail(4, "Invalid marketing id");
|
||||||
|
} catch (\SodiumException $e) {
|
||||||
|
$this->fail(4, "Invalid marketing id");
|
||||||
|
}
|
||||||
|
|
||||||
|
return hexdec($hexId);
|
||||||
|
}
|
||||||
|
|
||||||
|
function verifyOrder(int $app_id, float $amount, string $signature): bool
|
||||||
|
{
|
||||||
|
$this->requireUser();
|
||||||
|
|
||||||
|
$app = (new Applications())->get($app_id);
|
||||||
|
if(!$app)
|
||||||
|
$this->fail(26, "No app found with this id");
|
||||||
|
else if($app->getOwner()->getId() != $this->getUser()->getId())
|
||||||
|
$this->fail(15, "Access error");
|
||||||
|
|
||||||
|
[$time, $signature] = explode(",", $signature);
|
||||||
|
try {
|
||||||
|
$key = CHANDLER_ROOT_CONF["security"]["secret"];
|
||||||
|
if(sodium_memcmp($signature, hash_hmac("whirlpool", "$app_id:$amount:$time", $key)) == -1)
|
||||||
|
$this->fail(4, "Invalid order");
|
||||||
|
} catch (\SodiumException $e) {
|
||||||
|
$this->fail(4, "Invalid order");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,8 +7,6 @@ final class Users extends VKAPIRequestHandler
|
||||||
{
|
{
|
||||||
function get(string $user_ids = "0", string $fields = "", int $offset = 0, int $count = 100, User $authuser = null /* костыль(( */): array
|
function get(string $user_ids = "0", string $fields = "", int $offset = 0, int $count = 100, User $authuser = null /* костыль(( */): array
|
||||||
{
|
{
|
||||||
# $this->requireUser();
|
|
||||||
|
|
||||||
if($authuser == NULL) $authuser = $this->getUser();
|
if($authuser == NULL) $authuser = $this->getUser();
|
||||||
|
|
||||||
$users = new UsersRepo;
|
$users = new UsersRepo;
|
||||||
|
@ -16,138 +14,137 @@ final class Users extends VKAPIRequestHandler
|
||||||
$user_ids = (string) $authuser->getId();
|
$user_ids = (string) $authuser->getId();
|
||||||
|
|
||||||
$usrs = explode(',', $user_ids);
|
$usrs = explode(',', $user_ids);
|
||||||
$response;
|
$response = array();
|
||||||
|
|
||||||
$ic = sizeof($usrs);
|
$ic = sizeof($usrs);
|
||||||
|
|
||||||
if(sizeof($usrs) > $count) $ic = $count;
|
if(sizeof($usrs) > $count)
|
||||||
|
$ic = $count;
|
||||||
|
|
||||||
$usrs = array_slice($usrs, $offset * $count);
|
$usrs = array_slice($usrs, $offset * $count);
|
||||||
|
|
||||||
for ($i=0; $i < $ic; $i++) {
|
for($i=0; $i < $ic; $i++) {
|
||||||
$usr = $users->get((int) $usrs[$i]);
|
if($usrs[$i] != 0) {
|
||||||
if(is_null($usr))
|
$usr = $users->get((int) $usrs[$i]);
|
||||||
{
|
if(is_null($usr) || $usr->isDeleted()) {
|
||||||
$response[$i] = (object)[
|
$response[$i] = (object)[
|
||||||
"id" => $usrs[$i],
|
"id" => (int) $usrs[$i],
|
||||||
"first_name" => "DELETED",
|
"first_name" => "DELETED",
|
||||||
"last_name" => "",
|
"last_name" => "",
|
||||||
"deactivated" => "deleted"
|
"deactivated" => "deleted"
|
||||||
];
|
];
|
||||||
}else if($usrs[$i] == NULL){
|
} else if($usrs[$i] == NULL) {
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
$response[$i] = (object)[
|
$response[$i] = (object)[
|
||||||
"id" => $usr->getId(),
|
"id" => $usr->getId(),
|
||||||
"first_name" => $usr->getFirstName(),
|
"first_name" => $usr->getFirstName(),
|
||||||
"last_name" => $usr->getLastName(),
|
"last_name" => $usr->getLastName(),
|
||||||
"is_closed" => false,
|
"is_closed" => false,
|
||||||
"can_access_closed" => true,
|
"can_access_closed" => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
$flds = explode(',', $fields);
|
$flds = explode(',', $fields);
|
||||||
|
|
||||||
foreach($flds as $field) {
|
foreach($flds as $field) {
|
||||||
switch ($field) {
|
switch($field) {
|
||||||
case 'verified':
|
case "verified":
|
||||||
$response[$i]->verified = intval($usr->isVerified());
|
$response[$i]->verified = intval($usr->isVerified());
|
||||||
break;
|
break;
|
||||||
case 'sex':
|
case "sex":
|
||||||
$response[$i]->sex = $usr->isFemale() ? 1 : 2;
|
$response[$i]->sex = $usr->isFemale() ? 1 : 2;
|
||||||
break;
|
break;
|
||||||
case 'has_photo':
|
case "has_photo":
|
||||||
$response[$i]->has_photo = is_null($usr->getAvatarPhoto()) ? 0 : 1;
|
$response[$i]->has_photo = is_null($usr->getAvatarPhoto()) ? 0 : 1;
|
||||||
break;
|
break;
|
||||||
case 'photo_max_orig':
|
case "photo_max_orig":
|
||||||
$response[$i]->photo_max_orig = $usr->getAvatarURL();
|
$response[$i]->photo_max_orig = $usr->getAvatarURL();
|
||||||
break;
|
break;
|
||||||
case 'photo_max':
|
case "photo_max":
|
||||||
$response[$i]->photo_max = $usr->getAvatarURL("original");
|
$response[$i]->photo_max = $usr->getAvatarURL("original");
|
||||||
break;
|
break;
|
||||||
case 'photo_50':
|
case "photo_50":
|
||||||
$response[$i]->photo_50 = $usr->getAvatarURL();
|
$response[$i]->photo_50 = $usr->getAvatarURL();
|
||||||
break;
|
break;
|
||||||
case 'photo_100':
|
case "photo_100":
|
||||||
$response[$i]->photo_50 = $usr->getAvatarURL("tiny");
|
$response[$i]->photo_100 = $usr->getAvatarURL("tiny");
|
||||||
break;
|
break;
|
||||||
case 'photo_200':
|
case "photo_200":
|
||||||
$response[$i]->photo_50 = $usr->getAvatarURL("normal");
|
$response[$i]->photo_200 = $usr->getAvatarURL("normal");
|
||||||
break;
|
break;
|
||||||
case 'photo_200_orig': # вообще не ебу к чему эта строка ну пусть будет кек
|
case "photo_200_orig": # вообще не ебу к чему эта строка ну пусть будет кек
|
||||||
$response[$i]->photo_50 = $usr->getAvatarURL("normal");
|
$response[$i]->photo_200_orig = $usr->getAvatarURL("normal");
|
||||||
break;
|
break;
|
||||||
case 'photo_400_orig':
|
case "photo_400_orig":
|
||||||
$response[$i]->photo_50 = $usr->getAvatarURL("normal");
|
$response[$i]->photo_400_orig = $usr->getAvatarURL("normal");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
# Она хочет быть выебанной видя матан
|
# Она хочет быть выебанной видя матан
|
||||||
# Покайфу когда ты Виет а вокруг лишь дискриминант
|
# Покайфу когда ты Виет а вокруг лишь дискриминант
|
||||||
case 'status':
|
|
||||||
if($usr->getStatus() != NULL)
|
|
||||||
$response[$i]->status = $usr->getStatus();
|
|
||||||
break;
|
|
||||||
case 'screen_name':
|
|
||||||
if($usr->getShortCode() != NULL)
|
|
||||||
$response[$i]->screen_name = $usr->getShortCode();
|
|
||||||
break;
|
|
||||||
case 'friend_status':
|
|
||||||
switch($usr->getSubscriptionStatus($authuser)) {
|
|
||||||
case 3:
|
|
||||||
case 0:
|
|
||||||
$response[$i]->friend_status = $usr->getSubscriptionStatus($authuser);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
$response[$i]->friend_status = 2;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
$response[$i]->friend_status = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'last_seen':
|
|
||||||
if ($usr->onlineStatus() == 0) {
|
|
||||||
$response[$i]->last_seen = (object) [
|
|
||||||
"platform" => 1,
|
|
||||||
"time" => $usr->getOnline()->timestamp()
|
|
||||||
];
|
|
||||||
}
|
|
||||||
case 'music':
|
|
||||||
$response[$i]->music = $usr->getFavoriteMusic();
|
|
||||||
break;
|
|
||||||
case 'movies':
|
|
||||||
$response[$i]->movies = $usr->getFavoriteFilms();
|
|
||||||
break;
|
|
||||||
case 'tv':
|
|
||||||
$response[$i]->tv = $usr->getFavoriteShows();
|
|
||||||
break;
|
|
||||||
case 'books':
|
|
||||||
$response[$i]->books = $usr->getFavoriteBooks();
|
|
||||||
break;
|
|
||||||
case 'city':
|
|
||||||
$response[$i]->city = $usr->getCity();
|
|
||||||
break;
|
|
||||||
case 'interests':
|
|
||||||
$response[$i]->interests = $usr->getInterests();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($usr->getOnline()->timestamp() + 300 > time()) {
|
# ору а когда я это успел написать
|
||||||
$response[$i]->online = 1;
|
# вова кстати не матерись в коде мамка же спалит азщазаззазщазазаззазазазх
|
||||||
}else{
|
case "status":
|
||||||
$response[$i]->online = 0;
|
if($usr->getStatus() != NULL)
|
||||||
|
$response[$i]->status = $usr->getStatus();
|
||||||
|
break;
|
||||||
|
case "screen_name":
|
||||||
|
if($usr->getShortCode() != NULL)
|
||||||
|
$response[$i]->screen_name = $usr->getShortCode();
|
||||||
|
break;
|
||||||
|
case "friend_status":
|
||||||
|
switch($usr->getSubscriptionStatus($authuser)) {
|
||||||
|
case 3:
|
||||||
|
# NOTICE falling through
|
||||||
|
case 0:
|
||||||
|
$response[$i]->friend_status = $usr->getSubscriptionStatus($authuser);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
$response[$i]->friend_status = 2;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$response[$i]->friend_status = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "last_seen":
|
||||||
|
if ($usr->onlineStatus() == 0)
|
||||||
|
$response[$i]->last_seen = (object) [
|
||||||
|
"platform" => 1,
|
||||||
|
"time" => $usr->getOnline()->timestamp()
|
||||||
|
];
|
||||||
|
case "music":
|
||||||
|
$response[$i]->music = $usr->getFavoriteMusic();
|
||||||
|
break;
|
||||||
|
case "movies":
|
||||||
|
$response[$i]->movies = $usr->getFavoriteFilms();
|
||||||
|
break;
|
||||||
|
case "tv":
|
||||||
|
$response[$i]->tv = $usr->getFavoriteShows();
|
||||||
|
break;
|
||||||
|
case "books":
|
||||||
|
$response[$i]->books = $usr->getFavoriteBooks();
|
||||||
|
break;
|
||||||
|
case "city":
|
||||||
|
$response[$i]->city = $usr->getCity();
|
||||||
|
break;
|
||||||
|
case "interests":
|
||||||
|
$response[$i]->interests = $usr->getInterests();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($usr->getOnline()->timestamp() + 300 > time())
|
||||||
|
$response[$i]->online = 1;
|
||||||
|
else
|
||||||
|
$response[$i]->online = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* private function getUsersById(string $user_ids, string $fields = "", int $offset = 0, int $count = PHP_INT_MAX){
|
|
||||||
|
|
||||||
} */
|
|
||||||
|
|
||||||
function getFollowers(int $user_id, string $fields = "", int $offset = 0, int $count = 100): object
|
function getFollowers(int $user_id, string $fields = "", int $offset = 0, int $count = 100): object
|
||||||
{
|
{
|
||||||
$offset++;
|
$offset++;
|
||||||
|
@ -157,15 +154,13 @@ final class Users extends VKAPIRequestHandler
|
||||||
|
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
|
||||||
foreach ($users->get($user_id)->getFollowers($offset, $count) as $follower) {
|
foreach($users->get($user_id)->getFollowers($offset, $count) as $follower)
|
||||||
$followers[] = $follower->getId();
|
$followers[] = $follower->getId();
|
||||||
}
|
|
||||||
|
|
||||||
$response = $followers;
|
$response = $followers;
|
||||||
|
|
||||||
if (!is_null($fields)) {
|
if(!is_null($fields))
|
||||||
$response = $this->get(implode(',', $followers), $fields, 0, $count);
|
$response = $this->get(implode(',', $followers), $fields, 0, $count);
|
||||||
}
|
|
||||||
|
|
||||||
return (object) [
|
return (object) [
|
||||||
"count" => $users->get($user_id)->getFollowersCount(),
|
"count" => $users->get($user_id)->getFollowersCount(),
|
||||||
|
@ -173,18 +168,17 @@ final class Users extends VKAPIRequestHandler
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function search(string $q, string $fields = '', int $offset = 0, int $count = 100)
|
function search(string $q, string $fields = "", int $offset = 0, int $count = 100)
|
||||||
{
|
{
|
||||||
$users = new UsersRepo;
|
$users = new UsersRepo;
|
||||||
|
|
||||||
$array = [];
|
$array = [];
|
||||||
$find = $users->find($q);
|
$find = $users->find($q);
|
||||||
|
|
||||||
foreach ($find as $user) {
|
foreach ($find as $user)
|
||||||
$array[] = $user->getId();
|
$array[] = $user->getId();
|
||||||
}
|
|
||||||
|
|
||||||
return (object)[
|
return (object) [
|
||||||
"count" => $find->size(),
|
"count" => $find->size(),
|
||||||
"items" => $this->get(implode(',', $array), $fields, $offset, $count)
|
"items" => $this->get(implode(',', $array), $fields, $offset, $count)
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,76 +1,98 @@
|
||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
namespace openvk\VKAPI\Handlers;
|
namespace openvk\VKAPI\Handlers;
|
||||||
use openvk\Web\Models\Entities\User;
|
use openvk\Web\Models\Entities\User;
|
||||||
use openvk\Web\Models\Entities\Notifications\{WallPostNotification};
|
use openvk\Web\Models\Entities\Notifications\{WallPostNotification, RepostNotification, CommentNotification};
|
||||||
use openvk\Web\Models\Repositories\Users as UsersRepo;
|
use openvk\Web\Models\Repositories\Users as UsersRepo;
|
||||||
use openvk\Web\Models\Entities\Club;
|
use openvk\Web\Models\Entities\Club;
|
||||||
use openvk\Web\Models\Repositories\Clubs as ClubsRepo;
|
use openvk\Web\Models\Repositories\Clubs as ClubsRepo;
|
||||||
use openvk\Web\Models\Entities\Post;
|
use openvk\Web\Models\Entities\Post;
|
||||||
use openvk\Web\Models\Entities\Postable;
|
|
||||||
use openvk\Web\Models\Repositories\Posts as PostsRepo;
|
use openvk\Web\Models\Repositories\Posts as PostsRepo;
|
||||||
|
use openvk\Web\Models\Entities\Comment;
|
||||||
|
use openvk\Web\Models\Repositories\Comments as CommentsRepo;
|
||||||
|
|
||||||
final class Wall extends VKAPIRequestHandler
|
final class Wall extends VKAPIRequestHandler
|
||||||
{
|
{
|
||||||
function get(string $owner_id, string $domain = "", int $offset = 0, int $count = 30, int $extended = 0): object
|
function get(int $owner_id, string $domain = "", int $offset = 0, int $count = 30, int $extended = 0): object
|
||||||
{
|
{
|
||||||
$posts = new PostsRepo;
|
$posts = new PostsRepo;
|
||||||
|
|
||||||
$items = [];
|
$items = [];
|
||||||
$profiles = [];
|
$profiles = [];
|
||||||
$groups = [];
|
$groups = [];
|
||||||
$count = $posts->getPostCountOnUserWall((int) $owner_id);
|
$cnt = $posts->getPostCountOnUserWall($owner_id);
|
||||||
|
|
||||||
foreach ($posts->getPostsFromUsersWall((int)$owner_id, 1, $count, $offset) as $post) {
|
$wallOnwer = (new UsersRepo)->get($owner_id);
|
||||||
|
|
||||||
|
if(!$wallOnwer || $wallOnwer->isDeleted() || $wallOnwer->isDeleted())
|
||||||
|
$this->fail(18, "User was deleted or banned");
|
||||||
|
|
||||||
|
foreach($posts->getPostsFromUsersWall($owner_id, 1, $count, $offset) as $post) {
|
||||||
$from_id = get_class($post->getOwner()) == "openvk\Web\Models\Entities\Club" ? $post->getOwner()->getId() * (-1) : $post->getOwner()->getId();
|
$from_id = get_class($post->getOwner()) == "openvk\Web\Models\Entities\Club" ? $post->getOwner()->getId() * (-1) : $post->getOwner()->getId();
|
||||||
|
|
||||||
$attachments = [];
|
$attachments = [];
|
||||||
|
$repost = [];
|
||||||
foreach($post->getChildren() as $attachment) {
|
foreach($post->getChildren() as $attachment) {
|
||||||
if($attachment instanceof \openvk\Web\Models\Entities\Photo) {
|
if($attachment instanceof \openvk\Web\Models\Entities\Photo) {
|
||||||
if($attachment->isDeleted())
|
if($attachment->isDeleted())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$attachments[] = [
|
$attachments[] = $this->getApiPhoto($attachment);
|
||||||
"type" => "photo",
|
} else if ($attachment instanceof \openvk\Web\Models\Entities\Post) {
|
||||||
"photo" => [
|
$repostAttachments = [];
|
||||||
"album_id" => $attachment->getAlbum() ? $attachment->getAlbum()->getId() : NULL,
|
|
||||||
"date" => $attachment->getPublicationTime()->timestamp(),
|
foreach($attachment->getChildren() as $repostAttachment) {
|
||||||
"id" => $attachment->getVirtualId(),
|
if($repostAttachment instanceof \openvk\Web\Models\Entities\Photo) {
|
||||||
"owner_id" => $attachment->getOwner()->getId(),
|
if($attachment->isDeleted())
|
||||||
"sizes" => array_values($attachment->getVkApiSizes()),
|
continue;
|
||||||
"text" => "",
|
|
||||||
"has_tags" => false
|
$repostAttachments[] = $this->getApiPhoto($repostAttachment);
|
||||||
]
|
/* Рекурсии, сука! Заказывали? */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$repost[] = [
|
||||||
|
"id" => $attachment->getVirtualId(),
|
||||||
|
"owner_id" => $attachment->isPostedOnBehalfOfGroup() ? $attachment->getOwner()->getId() * -1 : $attachment->getOwner()->getId(),
|
||||||
|
"from_id" => $attachment->isPostedOnBehalfOfGroup() ? $attachment->getOwner()->getId() * -1 : $attachment->getOwner()->getId(),
|
||||||
|
"date" => $attachment->getPublicationTime()->timestamp(),
|
||||||
|
"post_type" => "post",
|
||||||
|
"text" => $attachment->getText(false),
|
||||||
|
"attachments" => $repostAttachments,
|
||||||
|
"post_source" => [
|
||||||
|
"type" => "vk"
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$items[] = (object)[
|
$items[] = (object)[
|
||||||
"id" => $post->getVirtualId(),
|
"id" => $post->getVirtualId(),
|
||||||
"from_id" => $from_id,
|
"from_id" => $from_id,
|
||||||
"owner_id" => $post->getTargetWall(),
|
"owner_id" => $post->getTargetWall(),
|
||||||
"date" => $post->getPublicationTime()->timestamp(),
|
"date" => $post->getPublicationTime()->timestamp(),
|
||||||
"post_type" => "post",
|
"post_type" => "post",
|
||||||
"text" => $post->getText(),
|
"text" => $post->getText(false),
|
||||||
"can_edit" => 0, # TODO
|
"copy_history" => $repost,
|
||||||
"can_delete" => $post->canBeDeletedBy($this->getUser()),
|
"can_edit" => 0, # TODO
|
||||||
"can_pin" => $post->canBePinnedBy($this->getUser()),
|
"can_delete" => $post->canBeDeletedBy($this->getUser()),
|
||||||
"can_archive" => false, # TODO MAYBE
|
"can_pin" => $post->canBePinnedBy($this->getUser()),
|
||||||
"is_archived" => false,
|
"can_archive" => false, # TODO MAYBE
|
||||||
"is_pinned" => $post->isPinned(),
|
"is_archived" => false,
|
||||||
"attachments" => $attachments,
|
"is_pinned" => $post->isPinned(),
|
||||||
"post_source" => (object)["type" => "vk"],
|
"attachments" => $attachments,
|
||||||
"comments" => (object)[
|
"post_source" => (object)["type" => "vk"],
|
||||||
"count" => $post->getCommentsCount(),
|
"comments" => (object)[
|
||||||
|
"count" => $post->getCommentsCount(),
|
||||||
"can_post" => 1
|
"can_post" => 1
|
||||||
],
|
],
|
||||||
"likes" => (object)[
|
"likes" => (object)[
|
||||||
"count" => $post->getLikesCount(),
|
"count" => $post->getLikesCount(),
|
||||||
"user_likes" => (int) $post->hasLikeFrom($this->getUser()),
|
"user_likes" => (int) $post->hasLikeFrom($this->getUser()),
|
||||||
"can_like" => 1,
|
"can_like" => 1,
|
||||||
"can_publish" => 1,
|
"can_publish" => 1,
|
||||||
],
|
],
|
||||||
"reposts" => (object)[
|
"reposts" => (object)[
|
||||||
"count" => $post->getRepostCount(),
|
"count" => $post->getRepostCount(),
|
||||||
"user_reposted" => 0
|
"user_reposted" => 0
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
@ -78,163 +100,140 @@ final class Wall extends VKAPIRequestHandler
|
||||||
if ($from_id > 0)
|
if ($from_id > 0)
|
||||||
$profiles[] = $from_id;
|
$profiles[] = $from_id;
|
||||||
else
|
else
|
||||||
$groups[] = $from_id * -1;
|
$groups[] = $from_id * -1;
|
||||||
|
|
||||||
$attachments = NULL; # free attachments so it will not clone everythingg
|
$attachments = NULL; # free attachments so it will not clone everythingg
|
||||||
}
|
}
|
||||||
|
|
||||||
if($extended == 1)
|
if($extended == 1) {
|
||||||
{
|
|
||||||
$profiles = array_unique($profiles);
|
$profiles = array_unique($profiles);
|
||||||
$groups = array_unique($groups);
|
$groups = array_unique($groups);
|
||||||
|
|
||||||
$profilesFormatted = [];
|
$profilesFormatted = [];
|
||||||
$groupsFormatted = [];
|
$groupsFormatted = [];
|
||||||
|
|
||||||
foreach ($profiles as $prof) {
|
foreach($profiles as $prof) {
|
||||||
$user = (new UsersRepo)->get($prof);
|
$user = (new UsersRepo)->get($prof);
|
||||||
$profilesFormatted[] = (object)[
|
$profilesFormatted[] = (object)[
|
||||||
"first_name" => $user->getFirstName(),
|
"first_name" => $user->getFirstName(),
|
||||||
"id" => $user->getId(),
|
"id" => $user->getId(),
|
||||||
"last_name" => $user->getLastName(),
|
"last_name" => $user->getLastName(),
|
||||||
"can_access_closed" => false,
|
"can_access_closed" => false,
|
||||||
"is_closed" => false,
|
"is_closed" => false,
|
||||||
"sex" => $user->isFemale() ? 1 : 2,
|
"sex" => $user->isFemale() ? 1 : 2,
|
||||||
"screen_name" => $user->getShortCode(),
|
"screen_name" => $user->getShortCode(),
|
||||||
"photo_50" => $user->getAvatarUrl(),
|
"photo_50" => $user->getAvatarUrl(),
|
||||||
"photo_100" => $user->getAvatarUrl(),
|
"photo_100" => $user->getAvatarUrl(),
|
||||||
"online" => $user->isOnline()
|
"online" => $user->isOnline()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($groups as $g) {
|
foreach($groups as $g) {
|
||||||
$group = (new ClubsRepo)->get($g);
|
$group = (new ClubsRepo)->get($g);
|
||||||
$groupsFormatted[] = (object)[
|
$groupsFormatted[] = (object)[
|
||||||
"id" => $group->getId(),
|
"id" => $group->getId(),
|
||||||
"name" => $group->getName(),
|
"name" => $group->getName(),
|
||||||
"screen_name" => $group->getShortCode(),
|
"screen_name" => $group->getShortCode(),
|
||||||
"is_closed" => 0,
|
"is_closed" => 0,
|
||||||
"type" => "group",
|
"type" => "group",
|
||||||
"photo_50" => $group->getAvatarUrl(),
|
"photo_50" => $group->getAvatarUrl(),
|
||||||
"photo_100" => $group->getAvatarUrl(),
|
"photo_100" => $group->getAvatarUrl(),
|
||||||
"photo_200" => $group->getAvatarUrl(),
|
"photo_200" => $group->getAvatarUrl(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return (object)[
|
return (object) [
|
||||||
"count" => $count,
|
"count" => $cnt,
|
||||||
"items" => (array)$items,
|
"items" => $items,
|
||||||
"profiles" => (array)$profilesFormatted,
|
"profiles" => $profilesFormatted,
|
||||||
"groups" => (array)$groupsFormatted
|
"groups" => $groupsFormatted
|
||||||
];
|
];
|
||||||
}
|
} else
|
||||||
else
|
return (object) [
|
||||||
return (object)[
|
"count" => $cnt,
|
||||||
"count" => $count,
|
"items" => $items
|
||||||
"items" => (array)$items
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getById(string $posts, int $extended = 0, string $fields = "", User $user = NULL)
|
function getById(string $posts, int $extended = 0, string $fields = "", User $user = NULL)
|
||||||
{
|
{
|
||||||
if($user == NULL) $user = $this->getUser(); # костыли костыли крылышки
|
if($user == NULL) {
|
||||||
|
$this->requireUser();
|
||||||
|
$user = $this->getUser(); # костыли костыли крылышки
|
||||||
|
}
|
||||||
|
|
||||||
$items = [];
|
$items = [];
|
||||||
$profiles = [];
|
$profiles = [];
|
||||||
$groups = [];
|
$groups = [];
|
||||||
# $count = $posts->getPostCountOnUserWall((int) $owner_id);
|
|
||||||
|
|
||||||
$psts = explode(",", $posts);
|
$psts = explode(',', $posts);
|
||||||
|
|
||||||
foreach($psts as $pst)
|
foreach($psts as $pst) {
|
||||||
{
|
$id = explode("_", $pst);
|
||||||
$id = explode("_", $pst);
|
|
||||||
$post = (new PostsRepo)->getPostById(intval($id[0]), intval($id[1]));
|
$post = (new PostsRepo)->getPostById(intval($id[0]), intval($id[1]));
|
||||||
if($post) {
|
if($post) {
|
||||||
$from_id = get_class($post->getOwner()) == "openvk\Web\Models\Entities\Club" ? $post->getOwner()->getId() * (-1) : $post->getOwner()->getId();
|
$from_id = get_class($post->getOwner()) == "openvk\Web\Models\Entities\Club" ? $post->getOwner()->getId() * (-1) : $post->getOwner()->getId();
|
||||||
$attachments;
|
$attachments = [];
|
||||||
foreach($post->getChildren() as $attachment)
|
$repost = []; // чел высрал семь сигарет 😳 помянем 🕯
|
||||||
{
|
foreach($post->getChildren() as $attachment) {
|
||||||
if($attachment instanceof \openvk\Web\Models\Entities\Photo)
|
if($attachment instanceof \openvk\Web\Models\Entities\Photo) {
|
||||||
{
|
$attachments[] = $this->getApiPhoto($attachment);
|
||||||
$attachments[] = [
|
} else if ($attachment instanceof \openvk\Web\Models\Entities\Post) {
|
||||||
"type" => "photo",
|
$repostAttachments = [];
|
||||||
"photo" => [
|
|
||||||
"album_id" => $attachment->getAlbum() ? $attachment->getAlbum()->getId() : NULL,
|
foreach($attachment->getChildren() as $repostAttachment) {
|
||||||
"date" => $attachment->getPublicationTime()->timestamp(),
|
if($repostAttachment instanceof \openvk\Web\Models\Entities\Photo) {
|
||||||
"id" => $attachment->getVirtualId(),
|
if($attachment->isDeleted())
|
||||||
"owner_id" => $attachment->getOwner()->getId(),
|
continue;
|
||||||
"sizes" => array(
|
|
||||||
[
|
$repostAttachments[] = $this->getApiPhoto($repostAttachment);
|
||||||
"height" => 2560,
|
/* Рекурсии, сука! Заказывали? */
|
||||||
"url" => $attachment->getURLBySizeId("normal"),
|
}
|
||||||
"type" => "m",
|
}
|
||||||
"width" => 2560,
|
|
||||||
],
|
$repost[] = [
|
||||||
[
|
"id" => $attachment->getVirtualId(),
|
||||||
"height" => 130,
|
"owner_id" => $attachment->isPostedOnBehalfOfGroup() ? $attachment->getOwner()->getId() * -1 : $attachment->getOwner()->getId(),
|
||||||
"url" => $attachment->getURLBySizeId("tiny"),
|
"from_id" => $attachment->isPostedOnBehalfOfGroup() ? $attachment->getOwner()->getId() * -1 : $attachment->getOwner()->getId(),
|
||||||
"type" => "o",
|
"date" => $attachment->getPublicationTime()->timestamp(),
|
||||||
"width" => 130,
|
"post_type" => "post",
|
||||||
],
|
"text" => $attachment->getText(false),
|
||||||
[
|
"attachments" => $repostAttachments,
|
||||||
"height" => 604,
|
"post_source" => [
|
||||||
"url" => $attachment->getURLBySizeId("normal"),
|
"type" => "vk"
|
||||||
"type" => "p",
|
],
|
||||||
"width" => 604,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"height" => 807,
|
|
||||||
"url" => $attachment->getURLBySizeId("large"),
|
|
||||||
"type" => "q",
|
|
||||||
"width" => 807,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"height" => 1280,
|
|
||||||
"url" => $attachment->getURLBySizeId("larger"),
|
|
||||||
"type" => "r",
|
|
||||||
"width" => 1280,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"height" => 75, # Для временного компросима оставляю статическое число. Если каждый раз обращаться к файлу за количеством пикселов, то наступает пuпuська полная с производительностью, так что пока так
|
|
||||||
"url" => $attachment->getURLBySizeId("miniscule"),
|
|
||||||
"type" => "s",
|
|
||||||
"width" => 75,
|
|
||||||
]),
|
|
||||||
"text" => "",
|
|
||||||
"has_tags" => false
|
|
||||||
]
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$items[] = (object)[
|
$items[] = (object)[
|
||||||
"id" => $post->getVirtualId(),
|
"id" => $post->getVirtualId(),
|
||||||
"from_id" => $from_id,
|
"from_id" => $from_id,
|
||||||
"owner_id" => $post->getTargetWall(),
|
"owner_id" => $post->getTargetWall(),
|
||||||
"date" => $post->getPublicationTime()->timestamp(),
|
"date" => $post->getPublicationTime()->timestamp(),
|
||||||
"post_type" => "post",
|
"post_type" => "post",
|
||||||
"text" => $post->getText(),
|
"text" => $post->getText(false),
|
||||||
"can_edit" => 0, # TODO
|
"copy_history" => $repost,
|
||||||
"can_delete" => $post->canBeDeletedBy($user),
|
"can_edit" => 0, # TODO
|
||||||
"can_pin" => $post->canBePinnedBy($user),
|
"can_delete" => $post->canBeDeletedBy($user),
|
||||||
"can_archive" => false, # TODO MAYBE
|
"can_pin" => $post->canBePinnedBy($user),
|
||||||
"is_archived" => false,
|
"can_archive" => false, # TODO MAYBE
|
||||||
"is_pinned" => $post->isPinned(),
|
"is_archived" => false,
|
||||||
"post_source" => (object)["type" => "vk"],
|
"is_pinned" => $post->isPinned(),
|
||||||
"attachments" => $attachments,
|
"post_source" => (object)["type" => "vk"],
|
||||||
"comments" => (object)[
|
"attachments" => $attachments,
|
||||||
"count" => $post->getCommentsCount(),
|
"comments" => (object)[
|
||||||
|
"count" => $post->getCommentsCount(),
|
||||||
"can_post" => 1
|
"can_post" => 1
|
||||||
],
|
],
|
||||||
"likes" => (object)[
|
"likes" => (object)[
|
||||||
"count" => $post->getLikesCount(),
|
"count" => $post->getLikesCount(),
|
||||||
"user_likes" => (int) $post->hasLikeFrom($user),
|
"user_likes" => (int) $post->hasLikeFrom($user),
|
||||||
"can_like" => 1,
|
"can_like" => 1,
|
||||||
"can_publish" => 1,
|
"can_publish" => 1,
|
||||||
],
|
],
|
||||||
"reposts" => (object)[
|
"reposts" => (object)[
|
||||||
"count" => $post->getRepostCount(),
|
"count" => $post->getRepostCount(),
|
||||||
"user_reposted" => 0
|
"user_reposted" => 0
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
@ -242,58 +241,57 @@ final class Wall extends VKAPIRequestHandler
|
||||||
if ($from_id > 0)
|
if ($from_id > 0)
|
||||||
$profiles[] = $from_id;
|
$profiles[] = $from_id;
|
||||||
else
|
else
|
||||||
$groups[] = $from_id * -1;
|
$groups[] = $from_id * -1;
|
||||||
|
|
||||||
$attachments = NULL; # free attachments so it will not clone everythingg
|
$attachments = NULL; # free attachments so it will not clone everything
|
||||||
|
$repost = NULL; # same
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($extended == 1)
|
if($extended == 1) {
|
||||||
{
|
|
||||||
$profiles = array_unique($profiles);
|
$profiles = array_unique($profiles);
|
||||||
$groups = array_unique($groups);
|
$groups = array_unique($groups);
|
||||||
|
|
||||||
$profilesFormatted = [];
|
$profilesFormatted = [];
|
||||||
$groupsFormatted = [];
|
$groupsFormatted = [];
|
||||||
|
|
||||||
foreach ($profiles as $prof) {
|
foreach($profiles as $prof) {
|
||||||
$user = (new UsersRepo)->get($prof);
|
$user = (new UsersRepo)->get($prof);
|
||||||
$profilesFormatted[] = (object)[
|
$profilesFormatted[] = (object)[
|
||||||
"first_name" => $user->getFirstName(),
|
"first_name" => $user->getFirstName(),
|
||||||
"id" => $user->getId(),
|
"id" => $user->getId(),
|
||||||
"last_name" => $user->getLastName(),
|
"last_name" => $user->getLastName(),
|
||||||
"can_access_closed" => false,
|
"can_access_closed" => false,
|
||||||
"is_closed" => false,
|
"is_closed" => false,
|
||||||
"sex" => $user->isFemale() ? 1 : 2,
|
"sex" => $user->isFemale() ? 1 : 2,
|
||||||
"screen_name" => $user->getShortCode(),
|
"screen_name" => $user->getShortCode(),
|
||||||
"photo_50" => $user->getAvatarUrl(),
|
"photo_50" => $user->getAvatarUrl(),
|
||||||
"photo_100" => $user->getAvatarUrl(),
|
"photo_100" => $user->getAvatarUrl(),
|
||||||
"online" => $user->isOnline()
|
"online" => $user->isOnline()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($groups as $g) {
|
foreach($groups as $g) {
|
||||||
$group = (new ClubsRepo)->get($g);
|
$group = (new ClubsRepo)->get($g);
|
||||||
$groupsFormatted[] = (object)[
|
$groupsFormatted[] = (object)[
|
||||||
"id" => $group->getId(),
|
"id" => $group->getId(),
|
||||||
"name" => $group->getName(),
|
"name" => $group->getName(),
|
||||||
"screen_name" => $group->getShortCode(),
|
"screen_name" => $group->getShortCode(),
|
||||||
"is_closed" => 0,
|
"is_closed" => 0,
|
||||||
"type" => "group",
|
"type" => "group",
|
||||||
"photo_50" => $group->getAvatarUrl(),
|
"photo_50" => $group->getAvatarUrl(),
|
||||||
"photo_100" => $group->getAvatarUrl(),
|
"photo_100" => $group->getAvatarUrl(),
|
||||||
"photo_200" => $group->getAvatarUrl(),
|
"photo_200" => $group->getAvatarUrl(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return (object)[
|
return (object) [
|
||||||
"items" => (array)$items,
|
"items" => (array)$items,
|
||||||
"profiles" => (array)$profilesFormatted,
|
"profiles" => (array)$profilesFormatted,
|
||||||
"groups" => (array)$groupsFormatted
|
"groups" => (array)$groupsFormatted
|
||||||
];
|
];
|
||||||
}
|
} else
|
||||||
else
|
return (object) [
|
||||||
return (object)[
|
|
||||||
"items" => (array)$items
|
"items" => (array)$items
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -302,7 +300,7 @@ final class Wall extends VKAPIRequestHandler
|
||||||
{
|
{
|
||||||
$this->requireUser();
|
$this->requireUser();
|
||||||
|
|
||||||
$owner_id = intval($owner_id);
|
$owner_id = intval($owner_id);
|
||||||
|
|
||||||
$wallOwner = ($owner_id > 0 ? (new UsersRepo)->get($owner_id) : (new ClubsRepo)->get($owner_id * -1))
|
$wallOwner = ($owner_id > 0 ? (new UsersRepo)->get($owner_id) : (new ClubsRepo)->get($owner_id * -1))
|
||||||
?? $this->fail(18, "User was deleted or banned");
|
?? $this->fail(18, "User was deleted or banned");
|
||||||
|
@ -381,4 +379,201 @@ final class Wall extends VKAPIRequestHandler
|
||||||
|
|
||||||
return (object)["post_id" => $post->getVirtualId()];
|
return (object)["post_id" => $post->getVirtualId()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function repost(string $object, string $message = "") {
|
||||||
|
$this->requireUser();
|
||||||
|
|
||||||
|
$postArray;
|
||||||
|
if(preg_match('/wall((?:-?)[0-9]+)_([0-9]+)/', $object, $postArray) == 0)
|
||||||
|
$this->fail(100, "One of the parameters specified was missing or invalid: object is incorrect");
|
||||||
|
|
||||||
|
$post = (new PostsRepo)->getPostById((int) $postArray[1], (int) $postArray[2]);
|
||||||
|
if(!$post || $post->isDeleted()) $this->fail(100, "One of the parameters specified was missing or invalid");
|
||||||
|
|
||||||
|
$nPost = new Post;
|
||||||
|
$nPost->setOwner($this->user->getId());
|
||||||
|
$nPost->setWall($this->user->getId());
|
||||||
|
$nPost->setContent($message);
|
||||||
|
$nPost->save();
|
||||||
|
$nPost->attach($post);
|
||||||
|
|
||||||
|
if($post->getOwner(false)->getId() !== $this->user->getId() && !($post->getOwner() instanceof Club))
|
||||||
|
(new RepostNotification($post->getOwner(false), $post, $this->user->identity))->emit();
|
||||||
|
|
||||||
|
return (object) [
|
||||||
|
"success" => 1, // 👍
|
||||||
|
"post_id" => $nPost->getVirtualId(),
|
||||||
|
"reposts_count" => $post->getRepostCount(),
|
||||||
|
"likes_count" => $post->getLikesCount()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getComments(int $owner_id, int $post_id, bool $need_likes = true, int $offset = 0, int $count = 10, string $fields = "sex,screen_name,photo_50,photo_100,online_info,online", string $sort = "asc", bool $extended = false) {
|
||||||
|
$this->requireUser();
|
||||||
|
|
||||||
|
$post = (new PostsRepo)->getPostById($owner_id, $post_id);
|
||||||
|
if(!$post || $post->isDeleted()) $this->fail(100, "One of the parameters specified was missing or invalid");
|
||||||
|
|
||||||
|
$comments = (new CommentsRepo)->getCommentsByTarget($post, $offset+1, $count, $sort == "desc" ? "DESC" : "ASC");
|
||||||
|
|
||||||
|
$items = [];
|
||||||
|
$profiles = [];
|
||||||
|
|
||||||
|
foreach($comments as $comment) {
|
||||||
|
$item = [
|
||||||
|
"id" => $comment->getId(),
|
||||||
|
"from_id" => $comment->getOwner()->getId(),
|
||||||
|
"date" => $comment->getPublicationTime()->timestamp(),
|
||||||
|
"text" => $comment->getText(false),
|
||||||
|
"post_id" => $post->getVirtualId(),
|
||||||
|
"owner_id" => $post->isPostedOnBehalfOfGroup() ? $post->getOwner()->getId() * -1 : $post->getOwner()->getId(),
|
||||||
|
"parents_stack" => [],
|
||||||
|
"thread" => [
|
||||||
|
"count" => 0,
|
||||||
|
"items" => [],
|
||||||
|
"can_post" => false,
|
||||||
|
"show_reply_button" => true,
|
||||||
|
"groups_can_post" => false,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
if($need_likes == true)
|
||||||
|
$item['likes'] = [
|
||||||
|
"can_like" => 1,
|
||||||
|
"count" => $comment->getLikesCount(),
|
||||||
|
"user_likes" => (int) $comment->hasLikeFrom($this->getUser()),
|
||||||
|
"can_publish" => 1
|
||||||
|
];
|
||||||
|
|
||||||
|
$items[] = $item;
|
||||||
|
if($extended == true)
|
||||||
|
$profiles[] = $comment->getOwner()->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = [
|
||||||
|
"count" => (new CommentsRepo)->getCommentsCountByTarget($post),
|
||||||
|
"items" => $items,
|
||||||
|
"current_level_count" => (new CommentsRepo)->getCommentsCountByTarget($post),
|
||||||
|
"can_post" => true,
|
||||||
|
"show_reply_button" => true,
|
||||||
|
"groups_can_post" => false
|
||||||
|
];
|
||||||
|
|
||||||
|
if($extended == true) {
|
||||||
|
$profiles = array_unique($profiles);
|
||||||
|
$response['profiles'] = (!empty($profiles) ? (new Users)->get(implode(',', $profiles), $fields) : []);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (object) $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getComment(int $owner_id, int $comment_id, bool $extended = false, string $fields = "sex,screen_name,photo_50,photo_100,online_info,online") {
|
||||||
|
$this->requireUser();
|
||||||
|
|
||||||
|
$comment = (new CommentsRepo)->get($comment_id); // один хуй айди всех комментов общий
|
||||||
|
|
||||||
|
$profiles = [];
|
||||||
|
|
||||||
|
$item = [
|
||||||
|
"id" => $comment->getId(),
|
||||||
|
"from_id" => $comment->getOwner()->getId(),
|
||||||
|
"date" => $comment->getPublicationTime()->timestamp(),
|
||||||
|
"text" => $comment->getText(false),
|
||||||
|
"post_id" => $comment->getTarget()->getVirtualId(),
|
||||||
|
"owner_id" => $comment->getTarget()->isPostedOnBehalfOfGroup() ? $comment->getTarget()->getOwner()->getId() * -1 : $comment->getTarget()->getOwner()->getId(),
|
||||||
|
"parents_stack" => [],
|
||||||
|
"likes" => [
|
||||||
|
"can_like" => 1,
|
||||||
|
"count" => $comment->getLikesCount(),
|
||||||
|
"user_likes" => (int) $comment->hasLikeFrom($this->getUser()),
|
||||||
|
"can_publish" => 1
|
||||||
|
],
|
||||||
|
"thread" => [
|
||||||
|
"count" => 0,
|
||||||
|
"items" => [],
|
||||||
|
"can_post" => false,
|
||||||
|
"show_reply_button" => true,
|
||||||
|
"groups_can_post" => false,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
if($extended == true)
|
||||||
|
$profiles[] = $comment->getOwner()->getId();
|
||||||
|
|
||||||
|
$response = [
|
||||||
|
"items" => [$item],
|
||||||
|
"can_post" => true,
|
||||||
|
"show_reply_button" => true,
|
||||||
|
"groups_can_post" => false
|
||||||
|
];
|
||||||
|
|
||||||
|
if($extended == true) {
|
||||||
|
$profiles = array_unique($profiles);
|
||||||
|
$response['profiles'] = (!empty($profiles) ? (new Users)->get(implode(',', $profiles), $fields) : []);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createComment(int $owner_id, int $post_id, string $message, int $from_group = 0) {
|
||||||
|
$post = (new PostsRepo)->getPostById($owner_id, $post_id);
|
||||||
|
if(!$post || $post->isDeleted()) $this->fail(100, "One of the parameters specified was missing or invalid");
|
||||||
|
|
||||||
|
if($post->getTargetWall() < 0)
|
||||||
|
$club = (new ClubsRepo)->get(abs($post->getTargetWall()));
|
||||||
|
|
||||||
|
$flags = 0;
|
||||||
|
if($from_group != 0 && !is_null($club) && $club->canBeModifiedBy($this->user))
|
||||||
|
$flags |= 0b10000000;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$comment = new Comment;
|
||||||
|
$comment->setOwner($this->user->getId());
|
||||||
|
$comment->setModel(get_class($post));
|
||||||
|
$comment->setTarget($post->getId());
|
||||||
|
$comment->setContent($message);
|
||||||
|
$comment->setCreated(time());
|
||||||
|
$comment->setFlags($flags);
|
||||||
|
$comment->save();
|
||||||
|
} catch (\LengthException $ex) {
|
||||||
|
$this->fail(1, "ошибка про то что коммент большой слишком");
|
||||||
|
}
|
||||||
|
|
||||||
|
if($post->getOwner()->getId() !== $this->user->getId())
|
||||||
|
if(($owner = $post->getOwner()) instanceof User)
|
||||||
|
(new CommentNotification($owner, $comment, $post, $this->user))->emit();
|
||||||
|
|
||||||
|
return (object) [
|
||||||
|
"comment_id" => $comment->getId(),
|
||||||
|
"parents_stack" => []
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteComment(int $comment_id) {
|
||||||
|
$this->requireUser();
|
||||||
|
|
||||||
|
$comment = (new CommentsRepo)->get($comment_id);
|
||||||
|
if(!$comment) $this->fail(100, "One of the parameters specified was missing or invalid");;
|
||||||
|
if(!$comment->canBeDeletedBy($this->user))
|
||||||
|
$this->fail(7, "Access denied");
|
||||||
|
|
||||||
|
$comment->delete();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getApiPhoto($attachment) {
|
||||||
|
return [
|
||||||
|
"type" => "photo",
|
||||||
|
"photo" => [
|
||||||
|
"album_id" => $attachment->getAlbum() ? $attachment->getAlbum()->getId() : NULL,
|
||||||
|
"date" => $attachment->getPublicationTime()->timestamp(),
|
||||||
|
"id" => $attachment->getVirtualId(),
|
||||||
|
"owner_id" => $attachment->getOwner()->getId(),
|
||||||
|
"sizes" => array_values($attachment->getVkApiSizes()),
|
||||||
|
"text" => "",
|
||||||
|
"has_tags" => false
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
316
Web/Models/Entities/Application.php
Normal file
316
Web/Models/Entities/Application.php
Normal file
|
@ -0,0 +1,316 @@
|
||||||
|
<?php declare(strict_types=1);
|
||||||
|
namespace openvk\Web\Models\Entities;
|
||||||
|
use Chandler\Database\DatabaseConnection;
|
||||||
|
use Nette\Utils\Image;
|
||||||
|
use Nette\Utils\UnknownImageFileException;
|
||||||
|
use openvk\Web\Models\Repositories\Notes;
|
||||||
|
use openvk\Web\Models\Repositories\Users;
|
||||||
|
use openvk\Web\Models\RowModel;
|
||||||
|
|
||||||
|
class Application extends RowModel
|
||||||
|
{
|
||||||
|
protected $tableName = "apps";
|
||||||
|
|
||||||
|
const PERMS = [
|
||||||
|
"notify",
|
||||||
|
"friends",
|
||||||
|
"photos",
|
||||||
|
"audio",
|
||||||
|
"video",
|
||||||
|
"stories",
|
||||||
|
"pages",
|
||||||
|
"status",
|
||||||
|
"notes",
|
||||||
|
"messages",
|
||||||
|
"wall",
|
||||||
|
"ads",
|
||||||
|
"docs",
|
||||||
|
"groups",
|
||||||
|
"notifications",
|
||||||
|
"stats",
|
||||||
|
"email",
|
||||||
|
"market",
|
||||||
|
];
|
||||||
|
|
||||||
|
private function getAvatarsDir(): string
|
||||||
|
{
|
||||||
|
$uploadSettings = OPENVK_ROOT_CONF["openvk"]["preferences"]["uploads"];
|
||||||
|
if($uploadSettings["mode"] === "server" && $uploadSettings["server"]["kind"] === "cdn")
|
||||||
|
return $uploadSettings["server"]["directory"];
|
||||||
|
else
|
||||||
|
return OPENVK_ROOT . "/storage/";
|
||||||
|
}
|
||||||
|
|
||||||
|
function getId(): int
|
||||||
|
{
|
||||||
|
return $this->getRecord()->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOwner(): User
|
||||||
|
{
|
||||||
|
return (new Users)->get($this->getRecord()->owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getName(): string
|
||||||
|
{
|
||||||
|
return $this->getRecord()->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDescription(): string
|
||||||
|
{
|
||||||
|
return $this->getRecord()->description;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAvatarUrl(): string
|
||||||
|
{
|
||||||
|
$serverUrl = ovk_scheme(true) . $_SERVER["HTTP_HOST"];
|
||||||
|
if(is_null($this->getRecord()->avatar_hash))
|
||||||
|
return "$serverUrl/assets/packages/static/openvk/img/camera_200.png";
|
||||||
|
|
||||||
|
$hash = $this->getRecord()->avatar_hash;
|
||||||
|
switch(OPENVK_ROOT_CONF["openvk"]["preferences"]["uploads"]["mode"]) {
|
||||||
|
default:
|
||||||
|
case "default":
|
||||||
|
case "basic":
|
||||||
|
return "$serverUrl/blob_" . substr($hash, 0, 2) . "/$hash" . "_app_avatar.png";
|
||||||
|
case "accelerated":
|
||||||
|
return "$serverUrl/openvk-datastore/$hash" . "_app_avatar.png";
|
||||||
|
case "server":
|
||||||
|
$settings = (object) OPENVK_ROOT_CONF["openvk"]["preferences"]["uploads"]["server"];
|
||||||
|
return (
|
||||||
|
$settings->protocol ?? ovk_scheme() .
|
||||||
|
"://" . $settings->host .
|
||||||
|
$settings->path .
|
||||||
|
substr($hash, 0, 2) . "/$hash" . "_app_avatar.png"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNote(): ?Note
|
||||||
|
{
|
||||||
|
if(!$this->getRecord()->news)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return (new Notes)->get($this->getRecord()->news);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNoteLink(): string
|
||||||
|
{
|
||||||
|
$note = $this->getNote();
|
||||||
|
if(!$note)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
return ovk_scheme(true) . $_SERVER["HTTP_HOST"] . "/note" . $note->getPrettyId();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBalance(): float
|
||||||
|
{
|
||||||
|
return $this->getRecord()->coins;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getURL(): string
|
||||||
|
{
|
||||||
|
return $this->getRecord()->address;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOrigin(): string
|
||||||
|
{
|
||||||
|
$parsed = parse_url($this->getURL());
|
||||||
|
|
||||||
|
return (
|
||||||
|
($parsed["scheme"] ?? "https") . "://"
|
||||||
|
. ($parsed["host"] ?? "127.0.0.1") . ":"
|
||||||
|
. ($parsed["port"] ?? "443")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getUsersCount(): int
|
||||||
|
{
|
||||||
|
$cx = DatabaseConnection::i()->getContext();
|
||||||
|
return sizeof($cx->table("app_users")->where("app", $this->getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getInstallationEntry(User $user): ?array
|
||||||
|
{
|
||||||
|
$cx = DatabaseConnection::i()->getContext();
|
||||||
|
$entry = $cx->table("app_users")->where([
|
||||||
|
"app" => $this->getId(),
|
||||||
|
"user" => $user->getId(),
|
||||||
|
])->fetch();
|
||||||
|
|
||||||
|
if(!$entry)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return $entry->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPermissions(User $user): array
|
||||||
|
{
|
||||||
|
$permMask = 0;
|
||||||
|
$installInfo = $this->getInstallationEntry($user);
|
||||||
|
if(!$installInfo)
|
||||||
|
$this->install($user);
|
||||||
|
else
|
||||||
|
$permMask = $installInfo["access"];
|
||||||
|
|
||||||
|
$res = [];
|
||||||
|
for($i = 0; $i < sizeof(self::PERMS); $i++) {
|
||||||
|
$checkVal = 1 << $i;
|
||||||
|
if(($permMask & $checkVal) > 0)
|
||||||
|
$res[] = self::PERMS[$i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isInstalledBy(User $user): bool
|
||||||
|
{
|
||||||
|
return !is_null($this->getInstallationEntry($user));
|
||||||
|
}
|
||||||
|
|
||||||
|
function setNoteLink(?string $link): bool
|
||||||
|
{
|
||||||
|
if(!$link) {
|
||||||
|
$this->stateChanges("news", NULL);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
preg_match("%note([0-9]+)_([0-9]+)$%", $link, $matches);
|
||||||
|
if(sizeof($matches) != 3)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$owner = is_null($this->getRecord()) ? $this->changes["owner"] : $this->getRecord()->owner;
|
||||||
|
[, $ownerId, $vid] = $matches;
|
||||||
|
if($ownerId != $owner)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$note = (new Notes)->getNoteById((int) $ownerId, (int) $vid);
|
||||||
|
if(!$note)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$this->stateChanges("news", $note->getId());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setAvatar(array $file): int
|
||||||
|
{
|
||||||
|
if($file["error"] !== UPLOAD_ERR_OK)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$image = Image::fromFile($file["tmp_name"]);
|
||||||
|
} catch (UnknownImageFileException $e) {
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
$hash = hash_file("adler32", $file["tmp_name"]);
|
||||||
|
if(!is_dir($this->getAvatarsDir() . substr($hash, 0, 2)))
|
||||||
|
if(!mkdir($this->getAvatarsDir() . substr($hash, 0, 2)))
|
||||||
|
return -3;
|
||||||
|
|
||||||
|
$image->resize(140, 140, Image::STRETCH);
|
||||||
|
$image->save($this->getAvatarsDir() . substr($hash, 0, 2) . "/$hash" . "_app_avatar.png");
|
||||||
|
|
||||||
|
$this->stateChanges("avatar_hash", $hash);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setPermission(User $user, string $perm, bool $enabled): bool
|
||||||
|
{
|
||||||
|
$permMask = 0;
|
||||||
|
$installInfo = $this->getInstallationEntry($user);
|
||||||
|
if(!$installInfo)
|
||||||
|
$this->install($user);
|
||||||
|
else
|
||||||
|
$permMask = $installInfo["access"];
|
||||||
|
|
||||||
|
$index = array_search($perm, self::PERMS);
|
||||||
|
if($index === false)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$permVal = 1 << $index;
|
||||||
|
$permMask = $enabled ? ($permMask | $permVal) : ($permMask ^ $permVal);
|
||||||
|
|
||||||
|
$cx = DatabaseConnection::i()->getContext();
|
||||||
|
$cx->table("app_users")->where([
|
||||||
|
"app" => $this->getId(),
|
||||||
|
"user" => $user->getId(),
|
||||||
|
])->update([
|
||||||
|
"access" => $permMask,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isEnabled(): bool
|
||||||
|
{
|
||||||
|
return (bool) $this->getRecord()->enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
function enable(): void
|
||||||
|
{
|
||||||
|
$this->stateChanges("enabled", 1);
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
function disable(): void
|
||||||
|
{
|
||||||
|
$this->stateChanges("enabled", 0);
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
function install(User $user): void
|
||||||
|
{
|
||||||
|
if(!$this->getInstallationEntry($user)) {
|
||||||
|
$cx = DatabaseConnection::i()->getContext();
|
||||||
|
$cx->table("app_users")->insert([
|
||||||
|
"app" => $this->getId(),
|
||||||
|
"user" => $user->getId(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function uninstall(User $user): void
|
||||||
|
{
|
||||||
|
$cx = DatabaseConnection::i()->getContext();
|
||||||
|
$cx->table("app_users")->where([
|
||||||
|
"app" => $this->getId(),
|
||||||
|
"user" => $user->getId(),
|
||||||
|
])->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
function addCoins(float $coins): float
|
||||||
|
{
|
||||||
|
$res = $this->getBalance() + $coins;
|
||||||
|
$this->stateChanges("coins", $res);
|
||||||
|
$this->save();
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
function withdrawCoins(): void
|
||||||
|
{
|
||||||
|
$balance = $this->getBalance();
|
||||||
|
$tax = ($balance / 100) * OPENVK_ROOT_CONF["openvk"]["preferences"]["apps"]["withdrawTax"];
|
||||||
|
|
||||||
|
$owner = $this->getOwner();
|
||||||
|
$owner->setCoins($owner->getCoins() + ($balance - $tax));
|
||||||
|
$this->setCoins(0.0);
|
||||||
|
$this->save();
|
||||||
|
$owner->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete(bool $softly = true): void
|
||||||
|
{
|
||||||
|
if($softly)
|
||||||
|
throw new \UnexpectedValueException("Can't delete apps softly.");
|
||||||
|
|
||||||
|
$cx = DatabaseConnection::i()->getContext();
|
||||||
|
$cx->table("app_users")->where("app", $this->getId())->delete();
|
||||||
|
|
||||||
|
parent::delete(false);
|
||||||
|
}
|
||||||
|
}
|
49
Web/Models/Entities/BannedLink.php
Normal file
49
Web/Models/Entities/BannedLink.php
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
<?php declare(strict_types=1);
|
||||||
|
namespace openvk\Web\Models\Entities;
|
||||||
|
use openvk\Web\Models\RowModel;
|
||||||
|
use openvk\Web\Models\Entities\{User};
|
||||||
|
use openvk\Web\Models\Repositories\{Users};
|
||||||
|
use Nette\Database\Table\ActiveRow;
|
||||||
|
|
||||||
|
class BannedLink extends RowModel
|
||||||
|
{
|
||||||
|
protected $tableName = "links_banned";
|
||||||
|
private $overrideContentColumn = "reason";
|
||||||
|
|
||||||
|
function getId(): int
|
||||||
|
{
|
||||||
|
return $this->getRecord()->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDomain(): string
|
||||||
|
{
|
||||||
|
return $this->getRecord()->domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getReason(): string
|
||||||
|
{
|
||||||
|
return $this->getRecord()->reason ?? tr("url_is_banned_default_reason");
|
||||||
|
}
|
||||||
|
|
||||||
|
function getInitiator(): ?User
|
||||||
|
{
|
||||||
|
return (new Users)->get($this->getRecord()->initiator);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getComment(): string
|
||||||
|
{
|
||||||
|
return OPENVK_ROOT_CONF["openvk"]["preferences"]["susLinks"]["showReason"]
|
||||||
|
? tr("url_is_banned_comment_r", OPENVK_ROOT_CONF["openvk"]["appearance"]["name"], $this->getReason())
|
||||||
|
: tr("url_is_banned_comment", OPENVK_ROOT_CONF["openvk"]["appearance"]["name"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRegexpRule(): string
|
||||||
|
{
|
||||||
|
return addslashes("/" . $this->getDomain() . $this->getRawRegexp() . "/");
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRawRegexp(): string
|
||||||
|
{
|
||||||
|
return $this->getRecord()->regexp_rule;
|
||||||
|
}
|
||||||
|
}
|
|
@ -67,7 +67,7 @@ class Club extends RowModel
|
||||||
|
|
||||||
function getName(): string
|
function getName(): string
|
||||||
{
|
{
|
||||||
return ovk_proc_strtr($this->getRecord()->name, 32);
|
return $this->getRecord()->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCanonicalName(): string
|
function getCanonicalName(): string
|
||||||
|
|
|
@ -60,6 +60,17 @@ class Message extends RowModel
|
||||||
{
|
{
|
||||||
return new DateTime($this->getRecord()->created);
|
return new DateTime($this->getRecord()->created);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSendTimeHumanized(): string
|
||||||
|
{
|
||||||
|
$dateTime = new DateTime($this->getRecord()->created);
|
||||||
|
|
||||||
|
if($dateTime->format("%d.%m.%y") == ovk_strftime_safe("%d.%m.%y", time())) {
|
||||||
|
return $dateTime->format("%T %p");
|
||||||
|
} else {
|
||||||
|
return $dateTime->format("%d.%m.%y");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get date of last edit, if any edits were made, otherwise null.
|
* Get date of last edit, if any edits were made, otherwise null.
|
||||||
|
@ -125,7 +136,7 @@ class Message extends RowModel
|
||||||
"name" => $author->getFirstName().$unreadmsg,
|
"name" => $author->getFirstName().$unreadmsg,
|
||||||
],
|
],
|
||||||
"timing" => [
|
"timing" => [
|
||||||
"sent" => (string) $this->getSendTime()->format("%e %B %G" . tr("time_at_sp") . "%X"),
|
"sent" => (string) $this->getSendTimeHumanized(),
|
||||||
"edited" => is_null($this->getEditTime()) ? NULL : (string) $this->getEditTime(),
|
"edited" => is_null($this->getEditTime()) ? NULL : (string) $this->getEditTime(),
|
||||||
],
|
],
|
||||||
"text" => $this->getText(),
|
"text" => $this->getText(),
|
||||||
|
|
|
@ -74,9 +74,19 @@ class Note extends Postable
|
||||||
$config->set("Attr.AllowedClasses", [
|
$config->set("Attr.AllowedClasses", [
|
||||||
"underline",
|
"underline",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$source = NULL;
|
||||||
|
if(is_null($this->getRecord())) {
|
||||||
|
if(isset($this->changes["source"]))
|
||||||
|
$source = $this->changes["source"];
|
||||||
|
else
|
||||||
|
throw new \LogicException("Can't render note without content set.");
|
||||||
|
} else {
|
||||||
|
$source = $this->getRecord()->source;
|
||||||
|
}
|
||||||
|
|
||||||
$purifier = new HTMLPurifier($config);
|
$purifier = new HTMLPurifier($config);
|
||||||
return $purifier->purify($this->getRecord()->source);
|
return $purifier->purify($source);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getName(): string
|
function getName(): string
|
||||||
|
@ -91,6 +101,9 @@ class Note extends Postable
|
||||||
|
|
||||||
function getText(): string
|
function getText(): string
|
||||||
{
|
{
|
||||||
|
if(is_null($this->getRecord()))
|
||||||
|
return $this->renderHTML();
|
||||||
|
|
||||||
$cached = $this->getRecord()->cached_content;
|
$cached = $this->getRecord()->cached_content;
|
||||||
if(!$cached) {
|
if(!$cached) {
|
||||||
$cached = $this->renderHTML();
|
$cached = $this->renderHTML();
|
||||||
|
|
|
@ -243,8 +243,11 @@ class Photo extends Media
|
||||||
$photo->setFile($file);
|
$photo->setFile($file);
|
||||||
$photo->save();
|
$photo->save();
|
||||||
|
|
||||||
if(!is_null($album))
|
if(!is_null($album)) {
|
||||||
$album->addPhoto($photo);
|
$album->addPhoto($photo);
|
||||||
|
$album->setEdited(time());
|
||||||
|
$album->save();
|
||||||
|
}
|
||||||
|
|
||||||
return $photo;
|
return $photo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,11 @@ class Post extends Postable
|
||||||
{
|
{
|
||||||
return ($this->getRecord()->flags & 0b01000000) > 0;
|
return ($this->getRecord()->flags & 0b01000000) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isDeactivationMessage(): bool
|
||||||
|
{
|
||||||
|
return ($this->getRecord()->flags & 0b00100000) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
function isExplicit(): bool
|
function isExplicit(): bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,12 +35,12 @@ trait TRichText
|
||||||
"%(([A-z]++):\/\/(\S*?\.\S*?))([\s)\[\]{},\"\'<]|\.\s|$)%",
|
"%(([A-z]++):\/\/(\S*?\.\S*?))([\s)\[\]{},\"\'<]|\.\s|$)%",
|
||||||
(function (array $matches): string {
|
(function (array $matches): string {
|
||||||
$href = str_replace("#", "#", $matches[1]);
|
$href = str_replace("#", "#", $matches[1]);
|
||||||
$href = str_replace(";", ";", $matches[1]);
|
$href = rawurlencode(str_replace(";", ";", $matches[1]));
|
||||||
$link = str_replace("#", "#", $matches[3]);
|
$link = str_replace("#", "#", $matches[3]);
|
||||||
$link = str_replace(";", ";", $matches[3]);
|
$link = str_replace(";", ";", $matches[3]);
|
||||||
$rel = $this->isAd() ? "sponsored" : "ugc";
|
$rel = $this->isAd() ? "sponsored" : "ugc";
|
||||||
|
|
||||||
return "<a href='$href' rel='$rel' target='_blank'>$link</a>" . htmlentities($matches[4]);
|
return "<a href='/away.php?to=$href' rel='$rel' target='_blank'>$link</a>" . htmlentities($matches[4]);
|
||||||
}),
|
}),
|
||||||
$text
|
$text
|
||||||
);
|
);
|
||||||
|
@ -75,6 +75,8 @@ trait TRichText
|
||||||
|
|
||||||
$text = $this->removeZalgo($text);
|
$text = $this->removeZalgo($text);
|
||||||
$text = nl2br($text);
|
$text = nl2br($text);
|
||||||
|
} else {
|
||||||
|
$text = str_replace("\r\n","\n", $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["christian"])
|
if(OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["christian"])
|
||||||
|
|
|
@ -145,24 +145,32 @@ class User extends RowModel
|
||||||
return iterator_to_array($avPhotos)[0] ?? NULL;
|
return iterator_to_array($avPhotos)[0] ?? NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFirstName(): string
|
function getFirstName(bool $pristine = false): string
|
||||||
{
|
{
|
||||||
return $this->getRecord()->deleted ? "DELETED" : mb_convert_case($this->getRecord()->first_name, MB_CASE_TITLE);
|
$name = ($this->isDeleted() && !$this->isDeactivated() ? "DELETED" : mb_convert_case($this->getRecord()->first_name, MB_CASE_TITLE));
|
||||||
|
if((($ts = tr("__transNames")) !== "@__transNames") && !$pristine)
|
||||||
|
return mb_convert_case(transliterator_transliterate($ts, $name), MB_CASE_TITLE);
|
||||||
|
else
|
||||||
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLastName(): string
|
function getLastName(bool $pristine = false): string
|
||||||
{
|
{
|
||||||
return $this->getRecord()->deleted ? "DELETED" : mb_convert_case($this->getRecord()->last_name, MB_CASE_TITLE);
|
$name = ($this->isDeleted() && !$this->isDeactivated() ? "DELETED" : mb_convert_case($this->getRecord()->last_name, MB_CASE_TITLE));
|
||||||
|
if((($ts = tr("__transNames")) !== "@__transNames") && !$pristine)
|
||||||
|
return mb_convert_case(transliterator_transliterate($ts, $name), MB_CASE_TITLE);
|
||||||
|
else
|
||||||
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPseudo(): ?string
|
function getPseudo(): ?string
|
||||||
{
|
{
|
||||||
return $this->getRecord()->deleted ? "DELETED" : $this->getRecord()->pseudo;
|
return ($this->isDeleted() && !$this->isDeactivated() ? "DELETED" : $this->getRecord()->pseudo);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFullName(): string
|
function getFullName(): string
|
||||||
{
|
{
|
||||||
if($this->getRecord()->deleted)
|
if($this->isDeleted() && !$this->isDeactivated())
|
||||||
return "DELETED";
|
return "DELETED";
|
||||||
|
|
||||||
$pseudo = $this->getPseudo();
|
$pseudo = $this->getPseudo();
|
||||||
|
@ -187,7 +195,7 @@ class User extends RowModel
|
||||||
|
|
||||||
function getCanonicalName(): string
|
function getCanonicalName(): string
|
||||||
{
|
{
|
||||||
if($this->getRecord()->deleted)
|
if($this->isDeleted() && !$this->isDeactivated())
|
||||||
return "DELETED";
|
return "DELETED";
|
||||||
else
|
else
|
||||||
return $this->getFirstName() . " " . $this->getLastName();
|
return $this->getFirstName() . " " . $this->getLastName();
|
||||||
|
@ -285,6 +293,19 @@ class User extends RowModel
|
||||||
{
|
{
|
||||||
return $this->getRecord()->marital_status;
|
return $this->getRecord()->marital_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getLocalizedMaritalStatus(): string
|
||||||
|
{
|
||||||
|
$status = $this->getMaritalStatus();
|
||||||
|
$string = "relationship_$status";
|
||||||
|
if($this->isFemale()) {
|
||||||
|
$res = tr($string . "_fem");
|
||||||
|
if($res != ("@" . $string . "_fem"))
|
||||||
|
return $res; # If fem version exists, return
|
||||||
|
}
|
||||||
|
|
||||||
|
return tr($string);
|
||||||
|
}
|
||||||
|
|
||||||
function getContactEmail(): ?string
|
function getContactEmail(): ?string
|
||||||
{
|
{
|
||||||
|
@ -343,7 +364,15 @@ class User extends RowModel
|
||||||
|
|
||||||
function getBirthday(): ?DateTime
|
function getBirthday(): ?DateTime
|
||||||
{
|
{
|
||||||
return new DateTime($this->getRecord()->birthday);
|
if(is_null($this->getRecord()->birthday))
|
||||||
|
return NULL;
|
||||||
|
else
|
||||||
|
return new DateTime($this->getRecord()->birthday);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBirthdayPrivacy(): int
|
||||||
|
{
|
||||||
|
return $this->getRecord()->birthday_privacy;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAge(): ?int
|
function getAge(): ?int
|
||||||
|
@ -471,6 +500,16 @@ class User extends RowModel
|
||||||
return $this->_abstractRelationCount("get-friends");
|
return $this->_abstractRelationCount("get-friends");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getFriendsOnline(int $page = 1, int $limit = 6): \Traversable
|
||||||
|
{
|
||||||
|
return $this->_abstractRelationGenerator("get-online-friends", $page, $limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFriendsOnlineCount(): int
|
||||||
|
{
|
||||||
|
return $this->_abstractRelationCount("get-online-friends");
|
||||||
|
}
|
||||||
|
|
||||||
function getFollowers(int $page = 1, int $limit = 6): \Traversable
|
function getFollowers(int $page = 1, int $limit = 6): \Traversable
|
||||||
{
|
{
|
||||||
return $this->_abstractRelationGenerator("get-followers", $page, $limit);
|
return $this->_abstractRelationGenerator("get-followers", $page, $limit);
|
||||||
|
@ -729,7 +768,7 @@ class User extends RowModel
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ban(string $reason, bool $deleteSubscriptions = true): void
|
function ban(string $reason, bool $deleteSubscriptions = true, ?int $unban_time = NULL): void
|
||||||
{
|
{
|
||||||
if($deleteSubscriptions) {
|
if($deleteSubscriptions) {
|
||||||
$subs = DatabaseConnection::i()->getContext()->table("subscriptions");
|
$subs = DatabaseConnection::i()->getContext()->table("subscriptions");
|
||||||
|
@ -743,9 +782,31 @@ class User extends RowModel
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setBlock_Reason($reason);
|
$this->setBlock_Reason($reason);
|
||||||
|
$this->setUnblock_time($unban_time);
|
||||||
$this->save();
|
$this->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deactivate(?string $reason): void
|
||||||
|
{
|
||||||
|
$this->setDeleted(1);
|
||||||
|
$this->setDeact_Date(time() + (MONTH * 7));
|
||||||
|
$this->setDeact_Reason($reason);
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
function reactivate(): void
|
||||||
|
{
|
||||||
|
$this->setDeleted(0);
|
||||||
|
$this->setDeact_Date(0);
|
||||||
|
$this->setDeact_Reason("");
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDeactivationDate(): DateTime
|
||||||
|
{
|
||||||
|
return new DateTime($this->getRecord()->deact_date);
|
||||||
|
}
|
||||||
|
|
||||||
function verifyNumber(string $code): bool
|
function verifyNumber(string $code): bool
|
||||||
{
|
{
|
||||||
$ver = $this->getPendingPhoneVerification();
|
$ver = $this->getPendingPhoneVerification();
|
||||||
|
@ -911,7 +972,15 @@ class User extends RowModel
|
||||||
|
|
||||||
function isDeleted(): bool
|
function isDeleted(): bool
|
||||||
{
|
{
|
||||||
if ($this->getRecord()->deleted == 1)
|
if($this->getRecord()->deleted == 1)
|
||||||
|
return TRUE;
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isDeactivated(): bool
|
||||||
|
{
|
||||||
|
if($this->getDeactivationDate()->timestamp() > time())
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -949,6 +1018,22 @@ class User extends RowModel
|
||||||
{
|
{
|
||||||
return (bool) $this->getRecord()->activated;
|
return (bool) $this->getRecord()->activated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getUnbanTime(): ?string
|
||||||
|
{
|
||||||
|
return !is_null($this->getRecord()->unblock_time) ? date('d.m.Y', $this->getRecord()->unblock_time) : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
function canUnbanThemself(): bool
|
||||||
|
{
|
||||||
|
if (!$this->isBanned())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ($this->getRecord()->unblock_time > time() || $this->getRecord()->unblock_time == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
use Traits\TSubscribable;
|
use Traits\TSubscribable;
|
||||||
}
|
}
|
||||||
|
|
69
Web/Models/Repositories/Applications.php
Normal file
69
Web/Models/Repositories/Applications.php
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
<?php declare(strict_types=1);
|
||||||
|
namespace openvk\Web\Models\Repositories;
|
||||||
|
use Chandler\Database\DatabaseConnection;
|
||||||
|
use Nette\Database\Table\ActiveRow;
|
||||||
|
use openvk\Web\Models\Entities\Application;
|
||||||
|
use openvk\Web\Models\Entities\User;
|
||||||
|
|
||||||
|
class Applications
|
||||||
|
{
|
||||||
|
private $context;
|
||||||
|
private $apps;
|
||||||
|
private $appRels;
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->context = DatabaseConnection::i()->getContext();
|
||||||
|
$this->apps = $this->context->table("apps");
|
||||||
|
$this->appRels = $this->context->table("app_users");
|
||||||
|
}
|
||||||
|
|
||||||
|
private function toApp(?ActiveRow $ar): ?Application
|
||||||
|
{
|
||||||
|
return is_null($ar) ? NULL : new Application($ar);
|
||||||
|
}
|
||||||
|
|
||||||
|
function get(int $id): ?Application
|
||||||
|
{
|
||||||
|
return $this->toApp($this->apps->get($id));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getList(int $page = 1, ?int $perPage = NULL): \Traversable
|
||||||
|
{
|
||||||
|
$perPage = $perPage ?? OPENVK_DEFAULT_PER_PAGE;
|
||||||
|
$apps = $this->apps->where("enabled", 1)->page($page, $perPage);
|
||||||
|
foreach($apps as $app)
|
||||||
|
yield new Application($app);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getListCount(): int
|
||||||
|
{
|
||||||
|
return sizeof($this->apps->where("enabled", 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getByOwner(User $owner, int $page = 1, ?int $perPage = NULL): \Traversable
|
||||||
|
{
|
||||||
|
$perPage = $perPage ?? OPENVK_DEFAULT_PER_PAGE;
|
||||||
|
$apps = $this->apps->where("owner", $owner->getId())->page($page, $perPage);
|
||||||
|
foreach($apps as $app)
|
||||||
|
yield new Application($app);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOwnCount(User $owner): int
|
||||||
|
{
|
||||||
|
return sizeof($this->apps->where("owner", $owner->getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getInstalled(User $user, int $page = 1, ?int $perPage = NULL): \Traversable
|
||||||
|
{
|
||||||
|
$perPage = $perPage ?? OPENVK_DEFAULT_PER_PAGE;
|
||||||
|
$apps = $this->appRels->where("user", $user->getId())->page($page, $perPage);
|
||||||
|
foreach($apps as $appRel)
|
||||||
|
yield $this->get($appRel->app);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getInstalledCount(User $user): int
|
||||||
|
{
|
||||||
|
return sizeof($this->appRels->where("user", $user->getId()));
|
||||||
|
}
|
||||||
|
}
|
73
Web/Models/Repositories/BannedLinks.php
Normal file
73
Web/Models/Repositories/BannedLinks.php
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
<?php declare(strict_types=1);
|
||||||
|
namespace openvk\Web\Models\Repositories;
|
||||||
|
use Chandler\Database\DatabaseConnection as DB;
|
||||||
|
use Nette\Database\Table\{ActiveRow, Selection};
|
||||||
|
use openvk\Web\Models\Entities\BannedLink;
|
||||||
|
|
||||||
|
class BannedLinks
|
||||||
|
{
|
||||||
|
private $context;
|
||||||
|
private $bannedLinks;
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->context = DB::i()->getContext();
|
||||||
|
$this->bannedLinks = $this->context->table("links_banned");
|
||||||
|
}
|
||||||
|
|
||||||
|
function toBannedLink(?ActiveRow $ar): ?BannedLink
|
||||||
|
{
|
||||||
|
return is_null($ar) ? NULL : new BannedLink($ar);
|
||||||
|
}
|
||||||
|
|
||||||
|
function get(int $id): ?BannedLink
|
||||||
|
{
|
||||||
|
return $this->toBannedLink($this->bannedLinks->get($id));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getList(?int $page = 1): \Traversable
|
||||||
|
{
|
||||||
|
foreach($this->bannedLinks->order("id DESC")->page($page, OPENVK_DEFAULT_PER_PAGE) as $link)
|
||||||
|
yield new BannedLink($link);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCount(int $page = 1): int
|
||||||
|
{
|
||||||
|
return sizeof($this->bannedLinks->fetch());
|
||||||
|
}
|
||||||
|
|
||||||
|
function getByDomain(string $domain): ?Selection
|
||||||
|
{
|
||||||
|
return $this->bannedLinks->where("domain", $domain);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isDomainBanned(string $domain): bool
|
||||||
|
{
|
||||||
|
return sizeof($this->bannedLinks->where(["link" => $domain, "regexp_rule" => ""])) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function genLinks($rules): \Traversable
|
||||||
|
{
|
||||||
|
foreach ($rules as $rule)
|
||||||
|
yield $this->get($rule->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function genEntries($links, $uri): \Traversable
|
||||||
|
{
|
||||||
|
foreach($links as $link)
|
||||||
|
if (preg_match($link->getRegexpRule(), $uri))
|
||||||
|
yield $link->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
function check(string $url): ?array
|
||||||
|
{
|
||||||
|
$uri = strstr(str_replace(["https://", "http://"], "", $url), "/", true);
|
||||||
|
$domain = str_replace("www.", "", $uri);
|
||||||
|
$rules = $this->getByDomain($domain);
|
||||||
|
|
||||||
|
if (is_null($rules))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return iterator_to_array($this->genEntries($this->genLinks($rules), $uri));
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,13 +26,13 @@ class Comments
|
||||||
return $this->toComment($this->comments->get($id));
|
return $this->toComment($this->comments->get($id));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCommentsByTarget(Postable $target, int $page, ?int $perPage = NULL): \Traversable
|
function getCommentsByTarget(Postable $target, int $page, ?int $perPage = NULL, ?string $sort = "ASC"): \Traversable
|
||||||
{
|
{
|
||||||
$comments = $this->comments->where([
|
$comments = $this->comments->where([
|
||||||
"model" => get_class($target),
|
"model" => get_class($target),
|
||||||
"target" => $target->getId(),
|
"target" => $target->getId(),
|
||||||
"deleted" => false,
|
"deleted" => false,
|
||||||
])->page($page, $perPage ?? OPENVK_DEFAULT_PER_PAGE);
|
])->page($page, $perPage ?? OPENVK_DEFAULT_PER_PAGE)->order("created ".$sort);;
|
||||||
|
|
||||||
foreach($comments as $comment)
|
foreach($comments as $comment)
|
||||||
yield $this->toComment($comment);
|
yield $this->toComment($comment);
|
||||||
|
|
|
@ -44,4 +44,15 @@ class Messages
|
||||||
yield new Correspondence($correspondent, $anotherCorrespondent);
|
yield new Correspondence($correspondent, $anotherCorrespondent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCorrespondenciesCount(RowModel $correspondent): ?int
|
||||||
|
{
|
||||||
|
$id = $correspondent->getId();
|
||||||
|
$class = get_class($correspondent);
|
||||||
|
$query = file_get_contents(__DIR__ . "/../sql/get-correspondencies-count.tsql");
|
||||||
|
DatabaseConnection::i()->getConnection()->query(file_get_contents(__DIR__ . "/../sql/mysql-msg-fix.tsql"));
|
||||||
|
$count = DatabaseConnection::i()->getConnection()->query($query, $id, $class, $id, $class)->fetch()->cnt;
|
||||||
|
bdump($count);
|
||||||
|
return $count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ class Posts
|
||||||
{
|
{
|
||||||
$hashtag = "#$hashtag";
|
$hashtag = "#$hashtag";
|
||||||
$sel = $this->posts
|
$sel = $this->posts
|
||||||
->where("content LIKE ?", "%$hashtag%")
|
->where("MATCH (content) AGAINST (? IN BOOLEAN MODE)", "+$hashtag")
|
||||||
->where("deleted", 0)
|
->where("deleted", 0)
|
||||||
->order("created DESC")
|
->order("created DESC")
|
||||||
->page($page, $perPage ?? OPENVK_DEFAULT_PER_PAGE);
|
->page($page, $perPage ?? OPENVK_DEFAULT_PER_PAGE);
|
||||||
|
|
20
Web/Models/sql/get-correspondencies-count.tsql
Normal file
20
Web/Models/sql/get-correspondencies-count.tsql
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
SELECT COUNT(id) AS cnt FROM
|
||||||
|
(
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
recipient_id AS id
|
||||||
|
FROM messages
|
||||||
|
WHERE
|
||||||
|
sender_id = ?
|
||||||
|
AND
|
||||||
|
sender_type = ?
|
||||||
|
) UNION (
|
||||||
|
SELECT
|
||||||
|
sender_id AS id
|
||||||
|
FROM messages
|
||||||
|
WHERE
|
||||||
|
recipient_id = ?
|
||||||
|
AND
|
||||||
|
recipient_type = ?
|
||||||
|
)
|
||||||
|
) dt
|
6
Web/Models/sql/get-online-friends.tsql
Executable file
6
Web/Models/sql/get-online-friends.tsql
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
(SELECT follower AS __id FROM
|
||||||
|
(SELECT follower FROM subscriptions WHERE target=? AND model="openvk\\Web\\Models\\Entities\\User") u0
|
||||||
|
INNER JOIN
|
||||||
|
(SELECT target FROM subscriptions WHERE follower=? AND model="openvk\\Web\\Models\\Entities\\User") u1
|
||||||
|
ON u0.follower = u1.target) u2
|
||||||
|
INNER JOIN profiles ON profiles.id = u2.__id WHERE online > (UNIX_TIMESTAMP() - 300)
|
|
@ -9,24 +9,19 @@ final class AboutPresenter extends OpenVKPresenter
|
||||||
{
|
{
|
||||||
protected $banTolerant = true;
|
protected $banTolerant = true;
|
||||||
protected $activationTolerant = true;
|
protected $activationTolerant = true;
|
||||||
|
protected $deactivationTolerant = true;
|
||||||
|
|
||||||
function renderIndex(): void
|
function renderIndex(): void
|
||||||
{
|
{
|
||||||
if(!is_null($this->user)) {
|
if(!is_null($this->user)) {
|
||||||
header("HTTP/1.1 302 Found");
|
|
||||||
|
|
||||||
if($this->user->identity->getMainPage())
|
if($this->user->identity->getMainPage())
|
||||||
header("Location: /feed");
|
$this->redirect("/feed");
|
||||||
else
|
else
|
||||||
header("Location: /id" . $this->user->id);
|
$this->redirect($this->user->identity->getURL());
|
||||||
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_SERVER['REQUEST_URI'] == "/id0") {
|
if($_SERVER['REQUEST_URI'] == "/id0") {
|
||||||
header("HTTP/1.1 302 Found");
|
$this->redirect("/");
|
||||||
header("Location: /");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->template->stats = (new Users)->getStatistics();
|
$this->template->stats = (new Users)->getStatistics();
|
||||||
|
@ -107,6 +102,15 @@ final class AboutPresenter extends OpenVKPresenter
|
||||||
. "# covered from unauthorized persons (for example, due to\n"
|
. "# covered from unauthorized persons (for example, due to\n"
|
||||||
. "# lack of rights to access the admin panel)\n\n"
|
. "# lack of rights to access the admin panel)\n\n"
|
||||||
. "User-Agent: *\n"
|
. "User-Agent: *\n"
|
||||||
|
. "Disallow: /albums/create\n"
|
||||||
|
. "Disallow: /videos/upload\n"
|
||||||
|
. "Disallow: /invite\n"
|
||||||
|
. "Disallow: /groups_create\n"
|
||||||
|
. "Disallow: /notifications\n"
|
||||||
|
. "Disallow: /settings\n"
|
||||||
|
. "Disallow: /edit\n"
|
||||||
|
. "Disallow: /gifts\n"
|
||||||
|
. "Disallow: /support\n"
|
||||||
. "Disallow: /rpc\n"
|
. "Disallow: /rpc\n"
|
||||||
. "Disallow: /language\n"
|
. "Disallow: /language\n"
|
||||||
. "Disallow: /badbrowser.php\n"
|
. "Disallow: /badbrowser.php\n"
|
||||||
|
@ -126,16 +130,11 @@ final class AboutPresenter extends OpenVKPresenter
|
||||||
function renderHumansTxt(): void
|
function renderHumansTxt(): void
|
||||||
{
|
{
|
||||||
# :D
|
# :D
|
||||||
|
$this->redirect("https://github.com/openvk/openvk#readme");
|
||||||
header("HTTP/1.1 302 Found");
|
|
||||||
header("Location: https://github.com/openvk/openvk#readme");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderDev(): void
|
function renderDev(): void
|
||||||
{
|
{
|
||||||
header("HTTP/1.1 302 Found");
|
$this->redirect("https://docs.openvk.su/");
|
||||||
header("Location: https://docs.openvk.su/");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
namespace openvk\Web\Presenters;
|
namespace openvk\Web\Presenters;
|
||||||
use openvk\Web\Models\Entities\{Voucher, Gift, GiftCategory, User};
|
use openvk\Web\Models\Entities\{Voucher, Gift, GiftCategory, User, BannedLink};
|
||||||
use openvk\Web\Models\Repositories\{Users, Clubs, Vouchers, Gifts};
|
use openvk\Web\Models\Repositories\{Users, Clubs, Vouchers, Gifts, BannedLinks};
|
||||||
|
use Chandler\Database\DatabaseConnection;
|
||||||
|
|
||||||
final class AdminPresenter extends OpenVKPresenter
|
final class AdminPresenter extends OpenVKPresenter
|
||||||
{
|
{
|
||||||
|
@ -9,13 +10,15 @@ final class AdminPresenter extends OpenVKPresenter
|
||||||
private $clubs;
|
private $clubs;
|
||||||
private $vouchers;
|
private $vouchers;
|
||||||
private $gifts;
|
private $gifts;
|
||||||
|
private $bannedLinks;
|
||||||
|
|
||||||
function __construct(Users $users, Clubs $clubs, Vouchers $vouchers, Gifts $gifts)
|
function __construct(Users $users, Clubs $clubs, Vouchers $vouchers, Gifts $gifts, BannedLinks $bannedLinks)
|
||||||
{
|
{
|
||||||
$this->users = $users;
|
$this->users = $users;
|
||||||
$this->clubs = $clubs;
|
$this->clubs = $clubs;
|
||||||
$this->vouchers = $vouchers;
|
$this->vouchers = $vouchers;
|
||||||
$this->gifts = $gifts;
|
$this->gifts = $gifts;
|
||||||
|
$this->bannedLinks = $bannedLinks;
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -170,8 +173,7 @@ final class AdminPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
$voucher->save();
|
$voucher->save();
|
||||||
|
|
||||||
$this->redirect("/admin/vouchers/id" . $voucher->getId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/admin/vouchers/id" . $voucher->getId());
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderGiftCategories(): void
|
function renderGiftCategories(): void
|
||||||
|
@ -193,7 +195,7 @@ final class AdminPresenter extends OpenVKPresenter
|
||||||
if(!$cat)
|
if(!$cat)
|
||||||
$this->notFound();
|
$this->notFound();
|
||||||
else if($cat->getSlug() !== $slug)
|
else if($cat->getSlug() !== $slug)
|
||||||
$this->redirect("/admin/gifts/" . $cat->getSlug() . "." . $id . ".meta", static::REDIRECT_TEMPORARY);
|
$this->redirect("/admin/gifts/" . $cat->getSlug() . "." . $id . ".meta");
|
||||||
} else {
|
} else {
|
||||||
$gen = true;
|
$gen = true;
|
||||||
$cat = new GiftCategory;
|
$cat = new GiftCategory;
|
||||||
|
@ -234,7 +236,7 @@ final class AdminPresenter extends OpenVKPresenter
|
||||||
$cat->setDescription($code, $this->postParam("description_$code"));
|
$cat->setDescription($code, $this->postParam("description_$code"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->redirect("/admin/gifts/" . $cat->getSlug() . "." . $cat->getId() . ".meta", static::REDIRECT_TEMPORARY);
|
$this->redirect("/admin/gifts/" . $cat->getSlug() . "." . $cat->getId() . ".meta");
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderGifts(string $catSlug, int $catId): void
|
function renderGifts(string $catSlug, int $catId): void
|
||||||
|
@ -245,7 +247,7 @@ final class AdminPresenter extends OpenVKPresenter
|
||||||
if(!$cat)
|
if(!$cat)
|
||||||
$this->notFound();
|
$this->notFound();
|
||||||
else if($cat->getSlug() !== $catSlug)
|
else if($cat->getSlug() !== $catSlug)
|
||||||
$this->redirect("/admin/gifts/" . $cat->getSlug() . "." . $catId . "/", static::REDIRECT_TEMPORARY);
|
$this->redirect("/admin/gifts/" . $cat->getSlug() . "." . $catId . "/");
|
||||||
|
|
||||||
$this->template->cat = $cat;
|
$this->template->cat = $cat;
|
||||||
$this->template->gifts = iterator_to_array($cat->getGifts((int) ($this->queryParam("p") ?? 1), NULL, $this->template->count));
|
$this->template->gifts = iterator_to_array($cat->getGifts((int) ($this->queryParam("p") ?? 1), NULL, $this->template->count));
|
||||||
|
@ -284,7 +286,7 @@ final class AdminPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
$name = $catTo->getName();
|
$name = $catTo->getName();
|
||||||
$this->flash("succ", "Gift moved successfully", "This gift will now be in <b>$name</b>.");
|
$this->flash("succ", "Gift moved successfully", "This gift will now be in <b>$name</b>.");
|
||||||
$this->redirect("/admin/gifts/" . $catTo->getSlug() . "." . $catTo->getId() . "/", static::REDIRECT_TEMPORARY);
|
$this->redirect("/admin/gifts/" . $catTo->getSlug() . "." . $catTo->getId() . "/");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case "edit":
|
case "edit":
|
||||||
|
@ -328,7 +330,7 @@ final class AdminPresenter extends OpenVKPresenter
|
||||||
$cat->addGift($gift);
|
$cat->addGift($gift);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->redirect("/admin/gifts/id" . $gift->getId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/admin/gifts/id" . $gift->getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,12 +342,14 @@ final class AdminPresenter extends OpenVKPresenter
|
||||||
function renderQuickBan(int $id): void
|
function renderQuickBan(int $id): void
|
||||||
{
|
{
|
||||||
$this->assertNoCSRF();
|
$this->assertNoCSRF();
|
||||||
|
|
||||||
|
$unban_time = strtotime($this->queryParam("date")) ?: NULL;
|
||||||
|
|
||||||
$user = $this->users->get($id);
|
$user = $this->users->get($id);
|
||||||
if(!$user)
|
if(!$user)
|
||||||
exit(json_encode([ "error" => "User does not exist" ]));
|
exit(json_encode([ "error" => "User does not exist" ]));
|
||||||
|
|
||||||
$user->ban($this->queryParam("reason"));
|
$user->ban($this->queryParam("reason"), true, $unban_time);
|
||||||
exit(json_encode([ "success" => true, "reason" => $this->queryParam("reason") ]));
|
exit(json_encode([ "success" => true, "reason" => $this->queryParam("reason") ]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +361,8 @@ final class AdminPresenter extends OpenVKPresenter
|
||||||
if(!$user)
|
if(!$user)
|
||||||
exit(json_encode([ "error" => "User does not exist" ]));
|
exit(json_encode([ "error" => "User does not exist" ]));
|
||||||
|
|
||||||
$user->setBlock_Reason(null);
|
$user->setBlock_Reason(NULL);
|
||||||
|
$user->setUnblock_time(NULL);
|
||||||
$user->save();
|
$user->save();
|
||||||
exit(json_encode([ "success" => true ]));
|
exit(json_encode([ "success" => true ]));
|
||||||
}
|
}
|
||||||
|
@ -373,4 +378,73 @@ final class AdminPresenter extends OpenVKPresenter
|
||||||
$user->adminNotify("⚠️ " . $this->queryParam("message"));
|
$user->adminNotify("⚠️ " . $this->queryParam("message"));
|
||||||
exit(json_encode([ "message" => $this->queryParam("message") ]));
|
exit(json_encode([ "message" => $this->queryParam("message") ]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renderBannedLinks(): void
|
||||||
|
{
|
||||||
|
$this->template->links = $this->bannedLinks->getList((int) $this->queryParam("p") ?: 1);
|
||||||
|
$this->template->users = new Users;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderBannedLink(int $id): void
|
||||||
|
{
|
||||||
|
$this->template->form = (object) [];
|
||||||
|
|
||||||
|
if($id === 0) {
|
||||||
|
$this->template->form->id = 0;
|
||||||
|
$this->template->form->link = NULL;
|
||||||
|
$this->template->form->reason = NULL;
|
||||||
|
} else {
|
||||||
|
$link = (new BannedLinks)->get($id);
|
||||||
|
if(!$link)
|
||||||
|
$this->notFound();
|
||||||
|
|
||||||
|
$this->template->form->id = $link->getId();
|
||||||
|
$this->template->form->link = $link->getDomain();
|
||||||
|
$this->template->form->reason = $link->getReason();
|
||||||
|
$this->template->form->regexp = $link->getRawRegexp();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($_SERVER["REQUEST_METHOD"] !== "POST")
|
||||||
|
return;
|
||||||
|
|
||||||
|
$link = (new BannedLinks)->get($id);
|
||||||
|
|
||||||
|
$new_domain = parse_url($this->postParam("link"))["host"];
|
||||||
|
$new_reason = $this->postParam("reason") ?: NULL;
|
||||||
|
|
||||||
|
$lid = $id;
|
||||||
|
|
||||||
|
if ($link) {
|
||||||
|
$link->setDomain($new_domain ?? $this->postParam("link"));
|
||||||
|
$link->setReason($new_reason);
|
||||||
|
$link->setRegexp_rule($this->postParam("regexp"));
|
||||||
|
$link->save();
|
||||||
|
} else {
|
||||||
|
if (!$new_domain)
|
||||||
|
$this->flashFail("err", tr("error"), tr("admin_banned_link_not_specified"));
|
||||||
|
|
||||||
|
$link = new BannedLink;
|
||||||
|
$link->setDomain($new_domain);
|
||||||
|
$link->setReason($new_reason);
|
||||||
|
$link->setRegexp_rule($this->postParam("regexp"));
|
||||||
|
$link->setInitiator($this->user->identity->getId());
|
||||||
|
$link->save();
|
||||||
|
|
||||||
|
$lid = $link->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->redirect("/admin/bannedLink/id" . $lid);
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderUnbanLink(int $id): void
|
||||||
|
{
|
||||||
|
$link = (new BannedLinks)->get($id);
|
||||||
|
|
||||||
|
if (!$link)
|
||||||
|
$this->flashFail("err", tr("error"), tr("admin_banned_link_not_found"));
|
||||||
|
|
||||||
|
$link->delete(false);
|
||||||
|
|
||||||
|
$this->redirect("/admin/bannedLinks");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
138
Web/Presenters/AppsPresenter.php
Normal file
138
Web/Presenters/AppsPresenter.php
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
<?php declare(strict_types=1);
|
||||||
|
namespace openvk\Web\Presenters;
|
||||||
|
use openvk\Web\Models\Entities\Application;
|
||||||
|
use openvk\Web\Models\Repositories\Applications;
|
||||||
|
|
||||||
|
final class AppsPresenter extends OpenVKPresenter
|
||||||
|
{
|
||||||
|
private $apps;
|
||||||
|
|
||||||
|
function __construct(Applications $apps)
|
||||||
|
{
|
||||||
|
$this->apps = $apps;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderPlay(int $app): void
|
||||||
|
{
|
||||||
|
$this->assertUserLoggedIn();
|
||||||
|
|
||||||
|
$app = $this->apps->get($app);
|
||||||
|
if(!$app || !$app->isEnabled())
|
||||||
|
$this->notFound();
|
||||||
|
|
||||||
|
$this->template->id = $app->getId();
|
||||||
|
$this->template->name = $app->getName();
|
||||||
|
$this->template->desc = $app->getDescription();
|
||||||
|
$this->template->origin = $app->getOrigin();
|
||||||
|
$this->template->url = $app->getURL();
|
||||||
|
$this->template->owner = $app->getOwner();
|
||||||
|
$this->template->news = $app->getNote();
|
||||||
|
$this->template->perms = $app->getPermissions($this->user->identity);
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderUnInstall(): void
|
||||||
|
{
|
||||||
|
$this->assertUserLoggedIn();
|
||||||
|
$this->assertNoCSRF();
|
||||||
|
|
||||||
|
$app = $this->apps->get((int) $this->queryParam("app"));
|
||||||
|
if(!$app)
|
||||||
|
$this->flashFail("err", tr("app_err_not_found"), tr("app_err_not_found_desc"));
|
||||||
|
|
||||||
|
$app->uninstall($this->user->identity);
|
||||||
|
$this->flashFail("succ", tr("app_uninstalled"), tr("app_uninstalled_desc"));
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderEdit(): void
|
||||||
|
{
|
||||||
|
$this->assertUserLoggedIn();
|
||||||
|
|
||||||
|
$app = NULL;
|
||||||
|
if($this->queryParam("act") !== "create") {
|
||||||
|
if(empty($this->queryParam("app")))
|
||||||
|
$this->flashFail("err", tr("app_err_not_found"), tr("app_err_not_found_desc"));
|
||||||
|
|
||||||
|
$app = $this->apps->get((int) $this->queryParam("app"));
|
||||||
|
if(!$app)
|
||||||
|
$this->flashFail("err", tr("app_err_not_found"), tr("app_err_not_found_desc"));
|
||||||
|
|
||||||
|
if($app->getOwner()->getId() != $this->user->identity->getId())
|
||||||
|
$this->flashFail("err", tr("forbidden"), tr("app_err_forbidden_desc"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
if(!$app) {
|
||||||
|
$app = new Application;
|
||||||
|
$app->setOwner($this->user->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!filter_var($this->postParam("url"), FILTER_VALIDATE_URL))
|
||||||
|
$this->flashFail("err", tr("app_err_url"), tr("app_err_url_desc"));
|
||||||
|
|
||||||
|
if(isset($_FILES["ava"]) && $_FILES["ava"]["size"] > 0) {
|
||||||
|
if(($res = $app->setAvatar($_FILES["ava"])) !== 0)
|
||||||
|
$this->flashFail("err", tr("app_err_ava"), tr("app_err_ava_desc", $res));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($this->postParam("note"))) {
|
||||||
|
$app->setNoteLink(NULL);
|
||||||
|
} else {
|
||||||
|
if(!$app->setNoteLink($this->postParam("note")))
|
||||||
|
$this->flashFail("err", tr("app_err_note"), tr("app_err_note_desc"));
|
||||||
|
}
|
||||||
|
|
||||||
|
$app->setName($this->postParam("name"));
|
||||||
|
$app->setDescription($this->postParam("desc"));
|
||||||
|
$app->setAddress($this->postParam("url"));
|
||||||
|
if($this->postParam("enable") === "on")
|
||||||
|
$app->enable();
|
||||||
|
else
|
||||||
|
$app->disable(); # no need to save since enable/disable will call save() internally
|
||||||
|
|
||||||
|
$this->redirect("/editapp?act=edit&app=" . $app->getId()); # will exit here
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_null($app)) {
|
||||||
|
$this->template->create = false;
|
||||||
|
$this->template->id = $app->getId();
|
||||||
|
$this->template->name = $app->getName();
|
||||||
|
$this->template->desc = $app->getDescription();
|
||||||
|
$this->template->coins = $app->getBalance();
|
||||||
|
$this->template->origin = $app->getOrigin();
|
||||||
|
$this->template->url = $app->getURL();
|
||||||
|
$this->template->note = $app->getNoteLink();
|
||||||
|
$this->template->users = $app->getUsersCount();
|
||||||
|
$this->template->on = $app->isEnabled();
|
||||||
|
} else {
|
||||||
|
$this->template->create = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderList(): void
|
||||||
|
{
|
||||||
|
$this->assertUserLoggedIn();
|
||||||
|
|
||||||
|
$act = $this->queryParam("act");
|
||||||
|
if(!in_array($act, ["list", "installed", "dev"]))
|
||||||
|
$act = "installed";
|
||||||
|
|
||||||
|
$page = (int) ($this->queryParam("p") ?? 1);
|
||||||
|
if($act == "list") {
|
||||||
|
$apps = $this->apps->getList($page);
|
||||||
|
$count = $this->apps->getListCount();
|
||||||
|
} else if($act == "installed") {
|
||||||
|
$apps = $this->apps->getInstalled($this->user->identity, $page);
|
||||||
|
$count = $this->apps->getInstalledCount($this->user->identity);
|
||||||
|
} else if($act == "dev") {
|
||||||
|
$apps = $this->apps->getByOwner($this->user->identity, $page);
|
||||||
|
$count = $this->apps->getOwnCount($this->user->identity);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->template->act = $act;
|
||||||
|
$this->template->iterator = $apps;
|
||||||
|
$this->template->count = $count;
|
||||||
|
$this->template->page = $page;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,14 +1,8 @@
|
||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
namespace openvk\Web\Presenters;
|
namespace openvk\Web\Presenters;
|
||||||
use openvk\Web\Models\Entities\IP;
|
use openvk\Web\Models\Entities\{IP, User, PasswordReset, EmailVerification};
|
||||||
use openvk\Web\Models\Entities\User;
|
use openvk\Web\Models\Repositories\{IPs, Users, Restores, Verifications};
|
||||||
use openvk\Web\Models\Entities\PasswordReset;
|
|
||||||
use openvk\Web\Models\Entities\EmailVerification;
|
|
||||||
use openvk\Web\Models\Exceptions\InvalidUserNameException;
|
use openvk\Web\Models\Exceptions\InvalidUserNameException;
|
||||||
use openvk\Web\Models\Repositories\IPs;
|
|
||||||
use openvk\Web\Models\Repositories\Users;
|
|
||||||
use openvk\Web\Models\Repositories\Restores;
|
|
||||||
use openvk\Web\Models\Repositories\Verifications;
|
|
||||||
use openvk\Web\Util\Validator;
|
use openvk\Web\Util\Validator;
|
||||||
use Chandler\Session\Session;
|
use Chandler\Session\Session;
|
||||||
use Chandler\Security\User as ChandlerUser;
|
use Chandler\Security\User as ChandlerUser;
|
||||||
|
@ -20,6 +14,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
{
|
{
|
||||||
protected $banTolerant = true;
|
protected $banTolerant = true;
|
||||||
protected $activationTolerant = true;
|
protected $activationTolerant = true;
|
||||||
|
protected $deactivationTolerant = true;
|
||||||
|
|
||||||
private $authenticator;
|
private $authenticator;
|
||||||
private $db;
|
private $db;
|
||||||
|
@ -50,7 +45,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
function renderRegister(): void
|
function renderRegister(): void
|
||||||
{
|
{
|
||||||
if(!is_null($this->user))
|
if(!is_null($this->user))
|
||||||
$this->redirect("/id" . $this->user->id, static::REDIRECT_TEMPORARY);
|
$this->redirect($this->user->identity->getURL());
|
||||||
|
|
||||||
if(!$this->hasPermission("user", "register", -1)) exit("Вас забанили");
|
if(!$this->hasPermission("user", "register", -1)) exit("Вас забанили");
|
||||||
|
|
||||||
|
@ -97,7 +92,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
$user->setEmail($this->postParam("email"));
|
$user->setEmail($this->postParam("email"));
|
||||||
$user->setSince(date("Y-m-d H:i:s"));
|
$user->setSince(date("Y-m-d H:i:s"));
|
||||||
$user->setRegistering_Ip(CONNECTING_IP);
|
$user->setRegistering_Ip(CONNECTING_IP);
|
||||||
$user->setBirthday(strtotime($this->postParam("birthday")));
|
$user->setBirthday(empty($this->postParam("birthday")) ? NULL : strtotime($this->postParam("birthday")));
|
||||||
$user->setActivated((int)!OPENVK_ROOT_CONF['openvk']['preferences']['security']['requireEmail']);
|
$user->setActivated((int)!OPENVK_ROOT_CONF['openvk']['preferences']['security']['requireEmail']);
|
||||||
} catch(InvalidUserNameException $ex) {
|
} catch(InvalidUserNameException $ex) {
|
||||||
$this->flashFail("err", tr("error"), tr("invalid_real_name"));
|
$this->flashFail("err", tr("error"), tr("invalid_real_name"));
|
||||||
|
@ -128,7 +123,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->authenticator->authenticate($chUser->getId());
|
$this->authenticator->authenticate($chUser->getId());
|
||||||
$this->redirect("/id" . $user->getId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/id" . $user->getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,12 +132,11 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
$redirUrl = $this->requestParam("jReturnTo");
|
$redirUrl = $this->requestParam("jReturnTo");
|
||||||
|
|
||||||
if(!is_null($this->user))
|
if(!is_null($this->user))
|
||||||
$this->redirect($redirUrl ?? "/id" . $this->user->id, static::REDIRECT_TEMPORARY);
|
$this->redirect($redirUrl ?? $this->user->identity->getURL());
|
||||||
|
|
||||||
if(!$this->hasPermission("user", "login", -1)) exit("Вас забанили");
|
if(!$this->hasPermission("user", "login", -1)) exit("Вас забанили");
|
||||||
|
|
||||||
if($_SERVER["REQUEST_METHOD"] === "POST") {
|
if($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
|
||||||
$user = $this->db->table("ChandlerUsers")->where("login", $this->postParam("login"))->fetch();
|
$user = $this->db->table("ChandlerUsers")->where("login", $this->postParam("login"))->fetch();
|
||||||
if(!$user)
|
if(!$user)
|
||||||
$this->flashFail("err", tr("login_failed"), tr("invalid_username_or_password"));
|
$this->flashFail("err", tr("login_failed"), tr("invalid_username_or_password"));
|
||||||
|
@ -151,7 +145,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
$this->flashFail("err", tr("login_failed"), tr("invalid_username_or_password"));
|
$this->flashFail("err", tr("login_failed"), tr("invalid_username_or_password"));
|
||||||
|
|
||||||
$ovkUser = new User($user->related("profiles.user")->fetch());
|
$ovkUser = new User($user->related("profiles.user")->fetch());
|
||||||
if($ovkUser->isDeleted())
|
if($ovkUser->isDeleted() && !$ovkUser->isDeactivated())
|
||||||
$this->flashFail("err", tr("login_failed"), tr("invalid_username_or_password"));
|
$this->flashFail("err", tr("login_failed"), tr("invalid_username_or_password"));
|
||||||
|
|
||||||
$secret = $user->related("profiles.user")->fetch()["2fa_secret"];
|
$secret = $user->related("profiles.user")->fetch()["2fa_secret"];
|
||||||
|
@ -171,8 +165,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->authenticator->authenticate($user->id);
|
$this->authenticator->authenticate($user->id);
|
||||||
$this->redirect($redirUrl ?? "/id" . $user->related("profiles.user")->fetch()->id, static::REDIRECT_TEMPORARY);
|
$this->redirect($redirUrl ?? $ovkUser->getURL());
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +176,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
if($uuid === "unset") {
|
if($uuid === "unset") {
|
||||||
Session::i()->set("_su", NULL);
|
Session::i()->set("_su", NULL);
|
||||||
$this->redirect("/", static::REDIRECT_TEMPORARY);
|
$this->redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->db->table("ChandlerUsers")->where("id", $uuid))
|
if(!$this->db->table("ChandlerUsers")->where("id", $uuid))
|
||||||
|
@ -192,8 +185,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
$this->assertPermission('openvk\Web\Models\Entities\User', 'substitute', 0);
|
$this->assertPermission('openvk\Web\Models\Entities\User', 'substitute', 0);
|
||||||
Session::i()->set("_su", $uuid);
|
Session::i()->set("_su", $uuid);
|
||||||
$this->flash("succ", tr("profile_changed"), tr("profile_changed_comment"));
|
$this->flash("succ", tr("profile_changed"), tr("profile_changed_comment"));
|
||||||
$this->redirect("/", static::REDIRECT_TEMPORARY);
|
$this->redirect("/");
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderLogout(): void
|
function renderLogout(): void
|
||||||
|
@ -203,7 +195,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
$this->authenticator->logout();
|
$this->authenticator->logout();
|
||||||
Session::i()->set("_su", NULL);
|
Session::i()->set("_su", NULL);
|
||||||
|
|
||||||
$this->redirect("/", static::REDIRECT_TEMPORARY_PRESISTENT);
|
$this->redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderFinishRestoringPassword(): void
|
function renderFinishRestoringPassword(): void
|
||||||
|
@ -243,7 +235,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
function renderRestore(): void
|
function renderRestore(): void
|
||||||
{
|
{
|
||||||
if(!is_null($this->user))
|
if(!is_null($this->user))
|
||||||
$this->redirect("/id" . $this->user->id, static::REDIRECT_TEMPORARY);
|
$this->redirect($this->user->identity->getURL());
|
||||||
|
|
||||||
if(($this->queryParam("act") ?? "default") === "finish")
|
if(($this->queryParam("act") ?? "default") === "finish")
|
||||||
$this->pass("openvk!Auth->finishRestoringPassword");
|
$this->pass("openvk!Auth->finishRestoringPassword");
|
||||||
|
@ -273,7 +265,6 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
];
|
];
|
||||||
$this->sendmail($uRow->login, "password-reset", $params); #Vulnerability possible
|
$this->sendmail($uRow->login, "password-reset", $params); #Vulnerability possible
|
||||||
|
|
||||||
|
|
||||||
$this->flashFail("succ", tr("information_-1"), tr("password_reset_email_sent"));
|
$this->flashFail("succ", tr("information_-1"), tr("password_reset_email_sent"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -281,7 +272,7 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
function renderResendEmail(): void
|
function renderResendEmail(): void
|
||||||
{
|
{
|
||||||
if(!is_null($this->user) && $this->user->identity->isActivated())
|
if(!is_null($this->user) && $this->user->identity->isActivated())
|
||||||
$this->redirect("/id" . $this->user->id, static::REDIRECT_TEMPORARY);
|
$this->redirect($this->user->identity->getURL());
|
||||||
|
|
||||||
if($_SERVER["REQUEST_METHOD"] === "POST") {
|
if($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
$user = $this->user->identity;
|
$user = $this->user->identity;
|
||||||
|
@ -321,4 +312,49 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
$this->redirect("/");
|
$this->redirect("/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renderReactivatePage(): void
|
||||||
|
{
|
||||||
|
$this->assertUserLoggedIn();
|
||||||
|
$this->willExecuteWriteAction();
|
||||||
|
|
||||||
|
$this->user->identity->reactivate();
|
||||||
|
|
||||||
|
$this->redirect("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderUnbanThemself(): void
|
||||||
|
{
|
||||||
|
$this->assertUserLoggedIn();
|
||||||
|
$this->willExecuteWriteAction();
|
||||||
|
|
||||||
|
if(!$this->user->identity->canUnbanThemself())
|
||||||
|
$this->flashFail("err", tr("error"), tr("forbidden"));
|
||||||
|
|
||||||
|
$user = $this->users->get($this->user->id);
|
||||||
|
|
||||||
|
$user->setBlock_Reason(NULL);
|
||||||
|
$user->setUnblock_Time(NULL);
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
$this->flashFail("succ", tr("banned_unban_title"), tr("banned_unban_description"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function will revoke all tokens, including API and Web tokens and except active one
|
||||||
|
*
|
||||||
|
* OF COURSE it requires CSRF
|
||||||
|
*/
|
||||||
|
function renderRevokeAllTokens(): void
|
||||||
|
{
|
||||||
|
$this->assertUserLoggedIn();
|
||||||
|
$this->willExecuteWriteAction();
|
||||||
|
$this->assertNoCSRF();
|
||||||
|
|
||||||
|
// API tokens
|
||||||
|
$this->db->table("api_tokens")->where("user", $this->user->identity->getId())->delete();
|
||||||
|
// Web tokens
|
||||||
|
$this->db->table("ChandlerTokens")->where("user", $this->user->identity->getChandlerGUID())->where("token != ?", Session::i()->get("tok"))->delete();
|
||||||
|
$this->flashFail("succ", tr("information_-1"), tr("end_all_sessions_done"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,29 @@
|
||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
namespace openvk\Web\Presenters;
|
namespace openvk\Web\Presenters;
|
||||||
|
use openvk\Web\Models\Repositories\BannedLinks;
|
||||||
|
use openvk\Web\Models\Entities\BannedLink;
|
||||||
|
|
||||||
final class AwayPresenter extends OpenVKPresenter
|
final class AwayPresenter extends OpenVKPresenter
|
||||||
{
|
{
|
||||||
function renderAway(): void
|
function renderAway(): void
|
||||||
{
|
{
|
||||||
|
$checkBanEntries = (new BannedLinks)->check($this->queryParam("to") . "/");
|
||||||
|
if (OPENVK_ROOT_CONF["openvk"]["preferences"]["susLinks"]["warnings"])
|
||||||
|
if (sizeof($checkBanEntries) > 0)
|
||||||
|
$this->pass("openvk!Away->view", $checkBanEntries[0]);
|
||||||
|
|
||||||
header("HTTP/1.0 302 Found");
|
header("HTTP/1.0 302 Found");
|
||||||
header("X-Robots-Tag: noindex, nofollow, noarchive");
|
header("X-Robots-Tag: noindex, nofollow, noarchive");
|
||||||
header("Location: " . $this->queryParam("to"));
|
header("Location: " . $this->queryParam("to"));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renderView(int $lid) {
|
||||||
|
$this->template->link = (new BannedLinks)->get($lid);
|
||||||
|
|
||||||
|
if (!$this->template->link)
|
||||||
|
$this->notFound();
|
||||||
|
|
||||||
|
$this->template->to = $this->queryParam("to");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
13
Web/Presenters/BannedLinkPresenter.php
Normal file
13
Web/Presenters/BannedLinkPresenter.php
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?php declare(strict_types=1);
|
||||||
|
namespace openvk\Web\Presenters;
|
||||||
|
|
||||||
|
use openvk\Web\Models\Entities\BannedLink;
|
||||||
|
use openvk\Web\Models\Repositories\BannedLinks;
|
||||||
|
|
||||||
|
final class BannedLinkPresenter extends OpenVKPresenter
|
||||||
|
{
|
||||||
|
function renderView(int $lid) {
|
||||||
|
$this->template->link = (new BannedLinks)->get($lid);
|
||||||
|
$this->template->to = $this->queryParam("to");
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,15 +25,15 @@ final class BlobPresenter extends OpenVKPresenter
|
||||||
$this->notFound();
|
$this->notFound();
|
||||||
|
|
||||||
if(isset($_SERVER["HTTP_IF_NONE_MATCH"]))
|
if(isset($_SERVER["HTTP_IF_NONE_MATCH"]))
|
||||||
exit(header("HTTP/1.1 304 Not Modified"));
|
exit(header("HTTP/1.1 304 Not Modified"));
|
||||||
|
|
||||||
header("Content-Type: " . mime_content_type($path));
|
header("Content-Type: " . mime_content_type($path));
|
||||||
header("Content-Size: " . filesize($path));
|
header("Content-Size: " . filesize($path));
|
||||||
header("Cache-Control: public, max-age=1210000");
|
header("Cache-Control: public, max-age=1210000");
|
||||||
header("X-Accel-Expires: 1210000");
|
header("X-Accel-Expires: 1210000");
|
||||||
header("ETag: W/\"" . hash_file("snefru", $path) . "\"");
|
header("ETag: W/\"" . hash_file("snefru", $path) . "\"");
|
||||||
|
|
||||||
readfile($path);
|
readfile($path);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ final class CommentPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
if(!is_null($this->user)) $comment->toggleLike($this->user->identity);
|
if(!is_null($this->user)) $comment->toggleLike($this->user->identity);
|
||||||
|
|
||||||
$this->redirect($_SERVER["HTTP_REFERER"], static::REDIRECT_TEMPORARY);
|
$this->redirect($_SERVER["HTTP_REFERER"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderMakeComment(string $repo, int $eId): void
|
function renderMakeComment(string $repo, int $eId): void
|
||||||
|
|
|
@ -91,7 +91,7 @@ final class GiftsPresenter extends OpenVKPresenter
|
||||||
$gift->used();
|
$gift->used();
|
||||||
|
|
||||||
$this->flash("succ", "Подарок отправлен", "Вы отправили подарок <b>" . $user->getFirstName() . "</b> за " . $gift->getPrice() . " голосов.");
|
$this->flash("succ", "Подарок отправлен", "Вы отправили подарок <b>" . $user->getFirstName() . "</b> за " . $gift->getPrice() . " голосов.");
|
||||||
$this->redirect($user->getURL(), static::REDIRECT_TEMPORARY);
|
$this->redirect($user->getURL());
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderStub(): void
|
function renderStub(): void
|
||||||
|
|
|
@ -22,15 +22,12 @@ final class GroupPresenter extends OpenVKPresenter
|
||||||
if(!$club) {
|
if(!$club) {
|
||||||
$this->notFound();
|
$this->notFound();
|
||||||
} else {
|
} else {
|
||||||
if($club->getShortCode())
|
|
||||||
if(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH) !== "/" . $club->getShortCode())
|
|
||||||
$this->redirect("/" . $club->getShortCode(), static::REDIRECT_TEMPORARY_PRESISTENT);
|
|
||||||
|
|
||||||
$this->template->club = $club;
|
|
||||||
$this->template->albums = (new Albums)->getClubAlbums($club, 1, 3);
|
$this->template->albums = (new Albums)->getClubAlbums($club, 1, 3);
|
||||||
$this->template->albumsCount = (new Albums)->getClubAlbumsCount($club);
|
$this->template->albumsCount = (new Albums)->getClubAlbumsCount($club);
|
||||||
$this->template->topics = (new Topics)->getLastTopics($club, 3);
|
$this->template->topics = (new Topics)->getLastTopics($club, 3);
|
||||||
$this->template->topicsCount = (new Topics)->getClubTopicsCount($club);
|
$this->template->topicsCount = (new Topics)->getClubTopicsCount($club);
|
||||||
|
|
||||||
|
$this->template->club = $club;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,8 +54,7 @@ final class GroupPresenter extends OpenVKPresenter
|
||||||
}
|
}
|
||||||
|
|
||||||
$club->toggleSubscription($this->user->identity);
|
$club->toggleSubscription($this->user->identity);
|
||||||
header("HTTP/1.1 302 Found");
|
$this->redirect("/club" . $club->getId());
|
||||||
header("Location: /club" . $club->getId());
|
|
||||||
}else{
|
}else{
|
||||||
$this->flashFail("err", "Ошибка", "Вы не ввели название группы.");
|
$this->flashFail("err", "Ошибка", "Вы не ввели название группы.");
|
||||||
}
|
}
|
||||||
|
@ -77,9 +73,7 @@ final class GroupPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
$club->toggleSubscription($this->user->identity);
|
$club->toggleSubscription($this->user->identity);
|
||||||
|
|
||||||
header("HTTP/1.1 302 Found");
|
$this->redirect($club->getURL());
|
||||||
header("Location: /club" . $club->getId());
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderFollowers(int $id): void
|
function renderFollowers(int $id): void
|
||||||
|
@ -202,10 +196,12 @@ final class GroupPresenter extends OpenVKPresenter
|
||||||
$this->template->club = $club;
|
$this->template->club = $club;
|
||||||
|
|
||||||
if($_SERVER["REQUEST_METHOD"] === "POST") {
|
if($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
if(!$club->setShortcode( empty($this->postParam("shortcode")) ? NULL : $this->postParam("shortcode") ))
|
||||||
|
$this->flashFail("err", tr("error"), tr("error_shorturl_incorrect"));
|
||||||
|
|
||||||
$club->setName(empty($this->postParam("name")) ? $club->getName() : $this->postParam("name"));
|
$club->setName(empty($this->postParam("name")) ? $club->getName() : $this->postParam("name"));
|
||||||
$club->setAbout(empty($this->postParam("about")) ? NULL : $this->postParam("about"));
|
$club->setAbout(empty($this->postParam("about")) ? NULL : $this->postParam("about"));
|
||||||
$club->setShortcode(empty($this->postParam("shortcode")) ? NULL : $this->postParam("shortcode"));
|
$club->setWall(empty($this->postParam("wall")) ? 0 : 1);
|
||||||
$club->setWall(empty($this->postParam("wall")) ? 0 : 1);
|
|
||||||
$club->setAdministrators_List_Display(empty($this->postParam("administrators_list_display")) ? 0 : $this->postParam("administrators_list_display"));
|
$club->setAdministrators_List_Display(empty($this->postParam("administrators_list_display")) ? 0 : $this->postParam("administrators_list_display"));
|
||||||
$club->setEveryone_Can_Create_Topics(empty($this->postParam("everyone_can_create_topics")) ? 0 : 1);
|
$club->setEveryone_Can_Create_Topics(empty($this->postParam("everyone_can_create_topics")) ? 0 : 1);
|
||||||
$club->setDisplay_Topics_Above_Wall(empty($this->postParam("display_topics_above_wall")) ? 0 : 1);
|
$club->setDisplay_Topics_Above_Wall(empty($this->postParam("display_topics_above_wall")) ? 0 : 1);
|
||||||
|
|
|
@ -29,9 +29,10 @@ final class InternalAPIPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
function renderRoute(): void
|
function renderRoute(): void
|
||||||
{
|
{
|
||||||
if($_SERVER["REQUEST_METHOD"] !== "POST")
|
if($_SERVER["REQUEST_METHOD"] !== "POST") {
|
||||||
|
header("HTTP/1.1 405 Method Not Allowed");
|
||||||
exit("ты дебил это точка апи");
|
exit("ты дебил это точка апи");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
$input = (object) MessagePack::unpack(file_get_contents("php://input"));
|
$input = (object) MessagePack::unpack(file_get_contents("php://input"));
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
|
@ -71,9 +72,10 @@ final class InternalAPIPresenter extends OpenVKPresenter
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderTimezone() {
|
function renderTimezone() {
|
||||||
if($_SERVER["REQUEST_METHOD"] !== "POST")
|
if($_SERVER["REQUEST_METHOD"] !== "POST") {
|
||||||
|
header("HTTP/1.1 405 Method Not Allowed");
|
||||||
exit("ты дебил это метод апи");
|
exit("ты дебил это метод апи");
|
||||||
|
}
|
||||||
$sessionOffset = Session::i()->get("_timezoneOffset");
|
$sessionOffset = Session::i()->get("_timezoneOffset");
|
||||||
if(is_numeric($this->postParam("timezone", false))) {
|
if(is_numeric($this->postParam("timezone", false))) {
|
||||||
$postTZ = intval($this->postParam("timezone", false));
|
$postTZ = intval($this->postParam("timezone", false));
|
||||||
|
|
|
@ -34,10 +34,18 @@ final class MessengerPresenter extends OpenVKPresenter
|
||||||
if(isset($_GET["sel"]))
|
if(isset($_GET["sel"]))
|
||||||
$this->pass("openvk!Messenger->app", $_GET["sel"]);
|
$this->pass("openvk!Messenger->app", $_GET["sel"]);
|
||||||
|
|
||||||
$page = $_GET["p"] ?? 1;
|
$page = (int) ($_GET["p"] ?? 1);
|
||||||
$correspondences = iterator_to_array($this->messages->getCorrespondencies($this->user->identity, $page));
|
$correspondences = iterator_to_array($this->messages->getCorrespondencies($this->user->identity, $page));
|
||||||
|
|
||||||
|
// #КакаоПрокакалось
|
||||||
|
|
||||||
$this->template->corresps = $correspondences;
|
$this->template->corresps = $correspondences;
|
||||||
|
$this->template->paginatorConf = (object) [
|
||||||
|
"count" => $this->messages->getCorrespondenciesCount($this->user->identity),
|
||||||
|
"page" => (int) ($_GET["p"] ?? 1),
|
||||||
|
"amount" => sizeof($this->template->corresps),
|
||||||
|
"perPage" => OPENVK_DEFAULT_PER_PAGE,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderApp(int $sel): void
|
function renderApp(int $sel): void
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
namespace openvk\Web\Presenters;
|
namespace openvk\Web\Presenters;
|
||||||
use openvk\Web\Models\Repositories\Users;
|
use openvk\Web\Models\Repositories\{Users, Notes};
|
||||||
use openvk\Web\Models\Repositories\Notes;
|
|
||||||
use openvk\Web\Models\Entities\Note;
|
use openvk\Web\Models\Entities\Note;
|
||||||
|
|
||||||
final class NotesPresenter extends OpenVKPresenter
|
final class NotesPresenter extends OpenVKPresenter
|
||||||
|
@ -47,6 +46,29 @@ final class NotesPresenter extends OpenVKPresenter
|
||||||
$this->template->note = $note;
|
$this->template->note = $note;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renderPreView(): void
|
||||||
|
{
|
||||||
|
$this->assertUserLoggedIn();
|
||||||
|
$this->willExecuteWriteAction();
|
||||||
|
|
||||||
|
if($_SERVER["REQUEST_METHOD"] !== "POST") {
|
||||||
|
header("HTTP/1.1 400 Bad Request");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($this->postParam("html")) || empty($this->postParam("title"))) {
|
||||||
|
header("HTTP/1.1 400 Bad Request");
|
||||||
|
exit(tr("note_preview_empty_err"));
|
||||||
|
}
|
||||||
|
|
||||||
|
$note = new Note;
|
||||||
|
$note->setSource($this->postParam("html"));
|
||||||
|
|
||||||
|
$this->flash("info", tr("note_preview_warn"), tr("note_preview_warn_details"));
|
||||||
|
$this->template->title = $this->postParam("title");
|
||||||
|
$this->template->html = $note->getText();
|
||||||
|
}
|
||||||
|
|
||||||
function renderCreate(): void
|
function renderCreate(): void
|
||||||
{
|
{
|
||||||
$this->assertUserLoggedIn();
|
$this->assertUserLoggedIn();
|
||||||
|
|
|
@ -6,12 +6,21 @@ final class NotificationPresenter extends OpenVKPresenter
|
||||||
function renderFeed(): void
|
function renderFeed(): void
|
||||||
{
|
{
|
||||||
$this->assertUserLoggedIn();
|
$this->assertUserLoggedIn();
|
||||||
|
|
||||||
$archive = $this->queryParam("act") === "archived";
|
$archive = $this->queryParam("act") === "archived";
|
||||||
$this->template->mode = $archive ? "archived" : "new";
|
$count = $this->user->identity->getNotificationsCount($archive);
|
||||||
|
|
||||||
|
if($count == 0 && $this->queryParam("act") == NULL) {
|
||||||
|
$mode = "archived";
|
||||||
|
$archive = true;
|
||||||
|
} else {
|
||||||
|
$mode = $archive ? "archived" : "new";
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->template->mode = $mode;
|
||||||
$this->template->page = (int) ($this->queryParam("p") ?? 1);
|
$this->template->page = (int) ($this->queryParam("p") ?? 1);
|
||||||
$this->template->iterator = iterator_to_array($this->user->identity->getNotifications($this->template->page, $archive));
|
$this->template->iterator = iterator_to_array($this->user->identity->getNotifications($this->template->page, $archive));
|
||||||
$this->template->count = $this->user->identity->getNotificationsCount($archive);
|
$this->template->count = $count;
|
||||||
|
|
||||||
$this->user->identity->updateNotificationOffset();
|
$this->user->identity->updateNotificationOffset();
|
||||||
$this->user->identity->save();
|
$this->user->identity->save();
|
||||||
|
|
|
@ -14,6 +14,7 @@ abstract class OpenVKPresenter extends SimplePresenter
|
||||||
{
|
{
|
||||||
protected $banTolerant = false;
|
protected $banTolerant = false;
|
||||||
protected $activationTolerant = false;
|
protected $activationTolerant = false;
|
||||||
|
protected $deactivationTolerant = false;
|
||||||
protected $errorTemplate = "@error";
|
protected $errorTemplate = "@error";
|
||||||
protected $user = NULL;
|
protected $user = NULL;
|
||||||
|
|
||||||
|
@ -60,9 +61,7 @@ abstract class OpenVKPresenter extends SimplePresenter
|
||||||
$this->flash($type, $title, $message, $code);
|
$this->flash($type, $title, $message, $code);
|
||||||
$referer = $_SERVER["HTTP_REFERER"] ?? "/";
|
$referer = $_SERVER["HTTP_REFERER"] ?? "/";
|
||||||
|
|
||||||
header("HTTP/1.1 302 Found");
|
$this->redirect($referer);
|
||||||
header("Location: $referer");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,9 +97,8 @@ abstract class OpenVKPresenter extends SimplePresenter
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->flash("err", tr("login_required_error"), tr("login_required_error_comment"));
|
$this->flash("err", tr("login_required_error"), tr("login_required_error_comment"));
|
||||||
header("HTTP/1.1 302 Found");
|
|
||||||
header("Location: $loginUrl");
|
$this->redirect($loginUrl);
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,9 +108,7 @@ abstract class OpenVKPresenter extends SimplePresenter
|
||||||
if($model !== "user") {
|
if($model !== "user") {
|
||||||
$this->flash("info", tr("login_required_error"), tr("login_required_error_comment"));
|
$this->flash("info", tr("login_required_error"), tr("login_required_error_comment"));
|
||||||
|
|
||||||
header("HTTP/1.1 302 Found");
|
$this->redirect("/login");
|
||||||
header("Location: /login");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ($action === "register" || $action === "login");
|
return ($action === "register" || $action === "login");
|
||||||
|
@ -214,39 +210,28 @@ abstract class OpenVKPresenter extends SimplePresenter
|
||||||
$this->template->thisUser = $this->user->identity;
|
$this->template->thisUser = $this->user->identity;
|
||||||
$this->template->userTainted = $user->isTainted();
|
$this->template->userTainted = $user->isTainted();
|
||||||
|
|
||||||
if($this->user->identity->isDeleted()) {
|
if($this->user->identity->isDeleted() && !$this->deactivationTolerant) {
|
||||||
/*
|
if($this->user->identity->isDeactivated()) {
|
||||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣴⠶⠶⣶⠶⠶⠶⠶⠶⠶⠶⠶⠶⢶⠶⠶⠶⠤⠤⠤⠤⣄⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
header("HTTP/1.1 403 Forbidden");
|
||||||
⠀⠀⠀⠀⠀⠀⠀⠀⣠⡾⠋⠀⠀⠊⠀⠀⠀⠀⠀⠀⠀⠀⠒⠒⠒⠀⠀⠀⠀⠤⢤⣤⣄⠉⠉⠛⠛⠷⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
$this->getTemplatingEngine()->render(__DIR__ . "/templates/@deactivated.xml", [
|
||||||
⠀⠀⠀⠀⠀⠀⠀⣰⠟⠀⠀⠀⠀⠀⠐⠋⢑⣤⣶⣶⣤⡢⡀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣄⡂⠀⠀⠶⢄⠙⢷⣤⠀⠀⠀⠀⠀⠀⠀⠀
|
"thisUser" => $this->user->identity,
|
||||||
⠀⠀⠀⠀⠀⠀⣸⡿⠚⠉⡀⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⢢⠀⠀⡀⣰⣿⣿⣿⣿⣦⡀⠀⠀⠡⡀⢹⡆⠀⠀⠀⠀⠀⠀⠀
|
"csrfToken" => $GLOBALS["csrfToken"],
|
||||||
⠀⠀⠀⠀⢀⣴⠏⠀⣀⣀⣀⡤⢤⣄⣠⣿⣿⣿⣿⣻⣿⣿⣷⠀⢋⣾⠈⠙⣶⠒⢿⣿⣿⣿⣿⡿⠟⠃⠀⡀⠡⠼⣧⡀⠀⠀⠀⠀⠀⠀
|
"isTimezoned" => Session::i()->get("_timezoneOffset"),
|
||||||
⠀⠀⢀⣴⣿⢃⡴⢊⢽⣶⣤⣀⠀⠊⠉⠉⡛⢿⣿⣿⣿⠿⠋⢀⡀⠁⠀⠀⢸⣁⣀⣉⣉⣉⡉⠀⠩⡡⠀⣩⣦⠀⠈⠻⣦⡀⠀⠀⠀⠀
|
]);
|
||||||
⠀⢠⡟⢡⠇⡞⢀⠆⠀⢻⣿⣿⣷⣄⠀⢀⠈⠂⠈⢁⡤⠚⡟⠉⠀⣀⣀⠀⠈⠳⣍⠓⢆⢀⡠⢀⣨⣴⣿⣿⡏⢀⡆⠀⢸⡇⠀⠀⠀⠀
|
} else {
|
||||||
⠀⣾⠁⢸⠀⠀⢸⠀⠀⠀⠹⣿⣿⣿⣿⣶⣬⣦⣤⡈⠀⠀⠇⠀⠛⠉⣩⣤⣤⣤⣿⣤⣤⣴⣾⣿⣿⣿⣿⣿⣧⠞⠀⠀⢸⡇⠀⠀⠀⠀
|
Authenticator::i()->logout();
|
||||||
⠀⢹⣆⠸⠀⠀⢸⠀⠀⠀⠀⠘⢿⣿⣿⣿⣿⣿⣿⣟⣛⠛⠛⣛⡛⠛⠛⣛⣋⡉⠉⣡⠶⢾⣿⣿⣿⣿⣿⣿⡇⠀⠀⢀⣾⠃⠀⠀⠀⠀
|
Session::i()->set("_su", NULL);
|
||||||
⠀⠀⠻⣆⡀⠀⠈⢂⠀⠀⠀⠠⡈⢻⣿⣿⣿⣿⡟⠁⠈⢧⡼⠉⠙⣆⡞⠁⠈⢹⣴⠃⠀⢸⣿⣿⣿⣿⣿⣿⠃⠀⡆⣾⠃⠀⠀⠀⠀⠀
|
$this->flashFail("err", tr("error"), tr("profile_not_found"));
|
||||||
⠀⠀⠀⠈⢻⣇⠀⠀⠀⠀⠀⠀⢡⠀⠹⣿⣿⣿⣷⡀⠀⣸⡇⠀⠀⣿⠁⠀⠀⠘⣿⠀⠀⠘⣿⣿⣿⣿⣿⣿⠀⠀⣿⡇⠀⠀⠀⠀⠀⠀
|
$this->redirect("/");
|
||||||
⠀⠀⠀⠀⠀⠹⣇⠀⠠⠀⠀⠀⠀⠡⠐⢬⡻⣿⣿⣿⣿⣿⣷⣶⣶⣿⣦⣤⣤⣤⣿⣦⣶⣿⣿⣿⣿⣿⣿⣿⠀⠀⣿⡇⠀⠀⠀⠀⠀⠀
|
}
|
||||||
⠀⠀⠀⠀⠀⠀⠹⣧⡀⠡⡀⠀⠀⠀⠑⠄⠙⢎⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠀⢿⡇⠀⠀⠀⠀⠀⠀
|
exit;
|
||||||
⠀⠀⠀⠀⠀⠀⠀⠈⠳⣤⡐⡄⠀⠀⠀⠈⠂⠀⠱⣌⠻⣿⣿⣿⣿⣿⣿⣿⠿⣿⠟⢻⡏⢻⣿⣿⣿⣿⣿⣿⣿⠀⢸⡇⠀⠀⠀⠀⠀⠀
|
|
||||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⢮⣦⡀⠂⠀⢀⠀⠀⠈⠳⣈⠻⣿⣿⣿⡇⠘⡄⢸⠀⠀⣇⠀⣻⣿⣿⣿⣿⣿⡏⠀⠸⡇⠀⠀⠀⠀⠀⠀
|
|
||||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢶⣤⣄⡑⠄⠀⠀⠈⠑⠢⠙⠻⢷⣶⣵⣞⣑⣒⣋⣉⣁⣻⣿⠿⠟⠱⠃⡸⠀⣧⠀⠀⠀⠀⠀⠀
|
|
||||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠻⣷⣄⡀⠐⠢⣄⣀⡀⠀⠉⠉⠉⠉⠛⠙⠭⠭⠄⠒⠈⠀⠐⠁⢀⣿⠀⠀⠀⠀⠀⠀
|
|
||||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠷⢦⣤⣤⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣒⡠⠄⣠⡾⠃⠀⠀⠀⠀⠀⠀
|
|
||||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⠛⠷⠶⣦⣤⣭⣤⣬⣭⣭⣴⠶⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀
|
|
||||||
*/
|
|
||||||
Authenticator::i()->logout();
|
|
||||||
Session::i()->set("_su", NULL);
|
|
||||||
$this->flashFail("err", tr("error"), tr("profile_not_found"));
|
|
||||||
$this->redirect("/", static::REDIRECT_TEMPORARY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->user->identity->isBanned() && !$this->banTolerant) {
|
if($this->user->identity->isBanned() && !$this->banTolerant) {
|
||||||
header("HTTP/1.1 403 Forbidden");
|
header("HTTP/1.1 403 Forbidden");
|
||||||
$this->getTemplatingEngine()->render(__DIR__ . "/templates/@banned.xml", [
|
$this->getTemplatingEngine()->render(__DIR__ . "/templates/@banned.xml", [
|
||||||
"thisUser" => $this->user->identity,
|
"thisUser" => $this->user->identity,
|
||||||
"csrfToken" => $GLOBALS["csrfToken"],
|
"csrfToken" => $GLOBALS["csrfToken"],
|
||||||
"isTimezoned" => Session::i()->get("_timezoneOffset"),
|
"isTimezoned" => Session::i()->get("_timezoneOffset"),
|
||||||
]);
|
]);
|
||||||
exit;
|
exit;
|
||||||
|
@ -256,8 +241,8 @@ abstract class OpenVKPresenter extends SimplePresenter
|
||||||
if(!$this->user->identity->isActivated() && !$this->activationTolerant) {
|
if(!$this->user->identity->isActivated() && !$this->activationTolerant) {
|
||||||
header("HTTP/1.1 403 Forbidden");
|
header("HTTP/1.1 403 Forbidden");
|
||||||
$this->getTemplatingEngine()->render(__DIR__ . "/templates/@email.xml", [
|
$this->getTemplatingEngine()->render(__DIR__ . "/templates/@email.xml", [
|
||||||
"thisUser" => $this->user->identity,
|
"thisUser" => $this->user->identity,
|
||||||
"csrfToken" => $GLOBALS["csrfToken"],
|
"csrfToken" => $GLOBALS["csrfToken"],
|
||||||
"isTimezoned" => Session::i()->get("_timezoneOffset"),
|
"isTimezoned" => Session::i()->get("_timezoneOffset"),
|
||||||
]);
|
]);
|
||||||
exit;
|
exit;
|
||||||
|
@ -265,7 +250,7 @@ abstract class OpenVKPresenter extends SimplePresenter
|
||||||
|
|
||||||
$userValidated = 1;
|
$userValidated = 1;
|
||||||
$cacheTime = 0; # Force no cache
|
$cacheTime = 0; # Force no cache
|
||||||
if ($this->user->identity->onlineStatus() == 0) {
|
if($this->user->identity->onlineStatus() == 0 && !($this->user->identity->isDeleted() || $this->user->identity->isBanned())) {
|
||||||
$this->user->identity->setOnline(time());
|
$this->user->identity->setOnline(time());
|
||||||
$this->user->identity->save();
|
$this->user->identity->save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
namespace openvk\Web\Presenters;
|
namespace openvk\Web\Presenters;
|
||||||
use openvk\Web\Models\Entities\Club;
|
use openvk\Web\Models\Entities\{Club, Photo, Album};
|
||||||
use openvk\Web\Models\Entities\Photo;
|
use openvk\Web\Models\Repositories\{Photos, Albums, Users, Clubs};
|
||||||
use openvk\Web\Models\Entities\Album;
|
|
||||||
use openvk\Web\Models\Repositories\Photos;
|
|
||||||
use openvk\Web\Models\Repositories\Albums;
|
|
||||||
use openvk\Web\Models\Repositories\Users;
|
|
||||||
use openvk\Web\Models\Repositories\Clubs;
|
|
||||||
use Nette\InvalidStateException as ISE;
|
use Nette\InvalidStateException as ISE;
|
||||||
|
|
||||||
final class PhotosPresenter extends OpenVKPresenter
|
final class PhotosPresenter extends OpenVKPresenter
|
||||||
|
@ -83,9 +78,9 @@ final class PhotosPresenter extends OpenVKPresenter
|
||||||
$album->save();
|
$album->save();
|
||||||
|
|
||||||
if(isset($club))
|
if(isset($club))
|
||||||
$this->redirect("/album-" . $album->getOwner()->getId() . "_" . $album->getId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/album-" . $album->getOwner()->getId() . "_" . $album->getId());
|
||||||
else
|
else
|
||||||
$this->redirect("/album" . $album->getOwner()->getId() . "_" . $album->getId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/album" . $album->getOwner()->getId() . "_" . $album->getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,6 +124,7 @@ final class PhotosPresenter extends OpenVKPresenter
|
||||||
$name = $album->getName();
|
$name = $album->getName();
|
||||||
$owner = $album->getOwner();
|
$owner = $album->getOwner();
|
||||||
$album->delete();
|
$album->delete();
|
||||||
|
|
||||||
$this->flash("succ", "Альбом удалён", "Альбом $name был успешно удалён.");
|
$this->flash("succ", "Альбом удалён", "Альбом $name был успешно удалён.");
|
||||||
$this->redirect("/albums" . ($owner instanceof Club ? "-" : "") . $owner->getId());
|
$this->redirect("/albums" . ($owner instanceof Club ? "-" : "") . $owner->getId());
|
||||||
}
|
}
|
||||||
|
@ -203,7 +199,7 @@ final class PhotosPresenter extends OpenVKPresenter
|
||||||
$photo->save();
|
$photo->save();
|
||||||
|
|
||||||
$this->flash("succ", "Изменения сохранены", "Обновлённое описание появится на странице с фоткой.");
|
$this->flash("succ", "Изменения сохранены", "Обновлённое описание появится на странице с фоткой.");
|
||||||
$this->redirect("/photo" . $photo->getPrettyId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/photo" . $photo->getPrettyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->template->photo = $photo;
|
$this->template->photo = $photo;
|
||||||
|
@ -241,7 +237,10 @@ final class PhotosPresenter extends OpenVKPresenter
|
||||||
}
|
}
|
||||||
|
|
||||||
$album->addPhoto($photo);
|
$album->addPhoto($photo);
|
||||||
$this->redirect("/photo" . $photo->getPrettyId(), static::REDIRECT_TEMPORARY);
|
$album->setEdited(time());
|
||||||
|
$album->save();
|
||||||
|
|
||||||
|
$this->redirect("/photo" . $photo->getPrettyId() . "?from=album" . $album->getId());
|
||||||
} else {
|
} else {
|
||||||
$this->template->album = $album;
|
$this->template->album = $album;
|
||||||
}
|
}
|
||||||
|
@ -262,9 +261,11 @@ final class PhotosPresenter extends OpenVKPresenter
|
||||||
if($_SERVER["REQUEST_METHOD"] === "POST") {
|
if($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
$this->assertNoCSRF();
|
$this->assertNoCSRF();
|
||||||
$album->removePhoto($photo);
|
$album->removePhoto($photo);
|
||||||
|
$album->setEdited(time());
|
||||||
|
$album->save();
|
||||||
|
|
||||||
$this->flash("succ", "Фотография удалена", "Эта фотография была успешно удалена.");
|
$this->flash("succ", "Фотография удалена", "Эта фотография была успешно удалена.");
|
||||||
$this->redirect("/album" . $album->getPrettyId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/album" . $album->getPrettyId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,6 +284,6 @@ final class PhotosPresenter extends OpenVKPresenter
|
||||||
$photo->delete();
|
$photo->delete();
|
||||||
|
|
||||||
$this->flash("succ", "Фотография удалена", "Эта фотография была успешно удалена.");
|
$this->flash("succ", "Фотография удалена", "Эта фотография была успешно удалена.");
|
||||||
$this->redirect("/id0", static::REDIRECT_TEMPORARY);
|
$this->redirect("/id0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
namespace openvk\Web\Presenters;
|
namespace openvk\Web\Presenters;
|
||||||
use openvk\Web\Models\Repositories\Users;
|
use openvk\Web\Models\Entities\{User, Club};
|
||||||
use openvk\Web\Models\Entities\User;
|
use openvk\Web\Models\Repositories\{Users, Clubs};
|
||||||
use openvk\Web\Models\Repositories\Clubs;
|
|
||||||
use openvk\Web\Models\Entities\Club;
|
|
||||||
use Chandler\Database\DatabaseConnection;
|
use Chandler\Database\DatabaseConnection;
|
||||||
|
|
||||||
final class SearchPresenter extends OpenVKPresenter
|
final class SearchPresenter extends OpenVKPresenter
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
namespace openvk\Web\Presenters;
|
namespace openvk\Web\Presenters;
|
||||||
use openvk\Web\Models\Entities\Ticket;
|
use openvk\Web\Models\Entities\{Ticket, TicketComment};
|
||||||
use openvk\Web\Models\Repositories\{Tickets, Users};
|
use openvk\Web\Models\Repositories\{Tickets, Users, TicketComments};
|
||||||
use openvk\Web\Models\Entities\TicketComment;
|
|
||||||
use openvk\Web\Models\Repositories\TicketComments;
|
|
||||||
use openvk\Web\Util\Telegram;
|
use openvk\Web\Util\Telegram;
|
||||||
use Chandler\Session\Session;
|
use Chandler\Session\Session;
|
||||||
|
use Chandler\Database\DatabaseConnection;
|
||||||
use Parsedown;
|
use Parsedown;
|
||||||
|
|
||||||
final class SupportPresenter extends OpenVKPresenter
|
final class SupportPresenter extends OpenVKPresenter
|
||||||
{
|
{
|
||||||
protected $banTolerant = true;
|
protected $banTolerant = true;
|
||||||
|
protected $deactivationTolerant = true;
|
||||||
|
|
||||||
private $tickets;
|
private $tickets;
|
||||||
private $comments;
|
private $comments;
|
||||||
|
@ -98,8 +98,7 @@ final class SupportPresenter extends OpenVKPresenter
|
||||||
Telegram::send($helpdeskChat, $telegramText);
|
Telegram::send($helpdeskChat, $telegramText);
|
||||||
}
|
}
|
||||||
|
|
||||||
header("HTTP/1.1 302 Found");
|
$this->redirect("/support/view/" . $ticket->getId());
|
||||||
header("Location: /support/view/" . $ticket->getId());
|
|
||||||
} else {
|
} else {
|
||||||
$this->flashFail("err", tr("error"), tr("you_have_not_entered_name_or_text"));
|
$this->flashFail("err", tr("error"), tr("you_have_not_entered_name_or_text"));
|
||||||
}
|
}
|
||||||
|
@ -190,8 +189,7 @@ final class SupportPresenter extends OpenVKPresenter
|
||||||
$comment->setCreated(time());
|
$comment->setCreated(time());
|
||||||
$comment->save();
|
$comment->save();
|
||||||
|
|
||||||
header("HTTP/1.1 302 Found");
|
$this->redirect("/support/view/" . $id);
|
||||||
header("Location: /support/view/" . $id);
|
|
||||||
} else {
|
} else {
|
||||||
$this->flashFail("err", tr("error"), tr("you_have_not_entered_text"));
|
$this->flashFail("err", tr("error"), tr("you_have_not_entered_text"));
|
||||||
}
|
}
|
||||||
|
@ -322,6 +320,10 @@ final class SupportPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
$user->setBlock_In_Support_Reason($this->queryParam("reason"));
|
$user->setBlock_In_Support_Reason($this->queryParam("reason"));
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
|
if($this->queryParam("close_tickets"))
|
||||||
|
DatabaseConnection::i()->getConnection()->query("UPDATE tickets SET type = 2 WHERE user_id = ".$id);
|
||||||
|
|
||||||
$this->returnJson([ "success" => true, "reason" => $this->queryParam("reason") ]);
|
$this->returnJson([ "success" => true, "reason" => $this->queryParam("reason") ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ final class TopicsPresenter extends OpenVKPresenter
|
||||||
}
|
}
|
||||||
} catch(ISE $ex) {
|
} catch(ISE $ex) {
|
||||||
$this->flash("err", "Не удалось опубликовать комментарий", "Файл медиаконтента повреждён или слишком велик.");
|
$this->flash("err", "Не удалось опубликовать комментарий", "Файл медиаконтента повреждён или слишком велик.");
|
||||||
$this->redirect("/topic" . $topic->getPrettyId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/topic" . $topic->getPrettyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($this->postParam("text")) || $photo || $video) {
|
if(!empty($this->postParam("text")) || $photo || $video) {
|
||||||
|
@ -123,7 +123,7 @@ final class TopicsPresenter extends OpenVKPresenter
|
||||||
$comment->save();
|
$comment->save();
|
||||||
} catch (\LengthException $ex) {
|
} catch (\LengthException $ex) {
|
||||||
$this->flash("err", "Не удалось опубликовать комментарий", "Комментарий слишком большой.");
|
$this->flash("err", "Не удалось опубликовать комментарий", "Комментарий слишком большой.");
|
||||||
$this->redirect("/topic" . $topic->getPrettyId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/topic" . $topic->getPrettyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_null($photo))
|
if(!is_null($photo))
|
||||||
|
@ -133,7 +133,7 @@ final class TopicsPresenter extends OpenVKPresenter
|
||||||
$comment->attach($video);
|
$comment->attach($video);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->redirect("/topic" . $topic->getPrettyId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/topic" . $topic->getPrettyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->template->club = $club;
|
$this->template->club = $club;
|
||||||
|
@ -167,7 +167,7 @@ final class TopicsPresenter extends OpenVKPresenter
|
||||||
$topic->save();
|
$topic->save();
|
||||||
|
|
||||||
$this->flash("succ", tr("changes_saved"), tr("topic_changes_saved_comment"));
|
$this->flash("succ", tr("changes_saved"), tr("topic_changes_saved_comment"));
|
||||||
$this->redirect("/topic" . $topic->getPrettyId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/topic" . $topic->getPrettyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->template->topic = $topic;
|
$this->template->topic = $topic;
|
||||||
|
@ -189,6 +189,6 @@ final class TopicsPresenter extends OpenVKPresenter
|
||||||
$this->willExecuteWriteAction();
|
$this->willExecuteWriteAction();
|
||||||
$topic->deleteTopic();
|
$topic->deleteTopic();
|
||||||
|
|
||||||
$this->redirect("/board" . $topic->getClub()->getId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/board" . $topic->getClub()->getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
namespace openvk\Web\Presenters;
|
namespace openvk\Web\Presenters;
|
||||||
use openvk\Web\Models\Repositories\Users;
|
use openvk\Web\Models\Repositories\{Users, Clubs};
|
||||||
use openvk\Web\Models\Repositories\Clubs;
|
|
||||||
|
|
||||||
final class UnknownTextRouteStrategyPresenter extends OpenVKPresenter
|
final class UnknownTextRouteStrategyPresenter extends OpenVKPresenter
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,18 +2,11 @@
|
||||||
namespace openvk\Web\Presenters;
|
namespace openvk\Web\Presenters;
|
||||||
use openvk\Web\Util\Sms;
|
use openvk\Web\Util\Sms;
|
||||||
use openvk\Web\Themes\Themepacks;
|
use openvk\Web\Themes\Themepacks;
|
||||||
use openvk\Web\Models\Entities\Photo;
|
use openvk\Web\Models\Entities\{Photo, Post, EmailChangeVerification};
|
||||||
use openvk\Web\Models\Repositories\Users;
|
use openvk\Web\Models\Entities\Notifications\{CoinsTransferNotification, RatingUpNotification};
|
||||||
use openvk\Web\Models\Repositories\Clubs;
|
use openvk\Web\Models\Repositories\{Users, Clubs, Albums, Videos, Notes, Vouchers, EmailChangeVerifications};
|
||||||
use openvk\Web\Models\Repositories\Albums;
|
|
||||||
use openvk\Web\Models\Repositories\Videos;
|
|
||||||
use openvk\Web\Models\Repositories\Notes;
|
|
||||||
use openvk\Web\Models\Repositories\Vouchers;
|
|
||||||
use openvk\Web\Models\Repositories\EmailChangeVerifications;
|
|
||||||
use openvk\Web\Models\Exceptions\InvalidUserNameException;
|
use openvk\Web\Models\Exceptions\InvalidUserNameException;
|
||||||
use openvk\Web\Util\Validator;
|
use openvk\Web\Util\Validator;
|
||||||
use openvk\Web\Models\Entities\Notifications\{CoinsTransferNotification, RatingUpNotification};
|
|
||||||
use openvk\Web\Models\Entities\EmailChangeVerification;
|
|
||||||
use Chandler\Security\Authenticator;
|
use Chandler\Security\Authenticator;
|
||||||
use lfkeitel\phptotp\{Base32, Totp};
|
use lfkeitel\phptotp\{Base32, Totp};
|
||||||
use chillerlan\QRCode\{QRCode, QROptions};
|
use chillerlan\QRCode\{QRCode, QROptions};
|
||||||
|
@ -22,7 +15,8 @@ use Nette\Database\UniqueConstraintViolationException;
|
||||||
final class UserPresenter extends OpenVKPresenter
|
final class UserPresenter extends OpenVKPresenter
|
||||||
{
|
{
|
||||||
private $users;
|
private $users;
|
||||||
|
|
||||||
|
public $deactivationTolerant = false;
|
||||||
function __construct(Users $users)
|
function __construct(Users $users)
|
||||||
{
|
{
|
||||||
$this->users = $users;
|
$this->users = $users;
|
||||||
|
@ -33,13 +27,15 @@ final class UserPresenter extends OpenVKPresenter
|
||||||
function renderView(int $id): void
|
function renderView(int $id): void
|
||||||
{
|
{
|
||||||
$user = $this->users->get($id);
|
$user = $this->users->get($id);
|
||||||
if(!$user || $user->isDeleted())
|
if(!$user || $user->isDeleted()) {
|
||||||
$this->template->_template = "User/deleted.xml";
|
if($user->isDeactivated()) {
|
||||||
else {
|
$this->template->_template = "User/deactivated.xml";
|
||||||
if($user->getShortCode())
|
|
||||||
if(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH) !== "/" . $user->getShortCode())
|
$this->template->user = $user;
|
||||||
$this->redirect("/" . $user->getShortCode(), static::REDIRECT_TEMPORARY_PRESISTENT);
|
} else {
|
||||||
|
$this->template->_template = "User/deleted.xml";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$this->template->albums = (new Albums)->getUserAlbums($user);
|
$this->template->albums = (new Albums)->getUserAlbums($user);
|
||||||
$this->template->albumsCount = (new Albums)->getUserAlbumsCount($user);
|
$this->template->albumsCount = (new Albums)->getUserAlbumsCount($user);
|
||||||
$this->template->videos = (new Videos)->getByUser($user, 1, 2);
|
$this->template->videos = (new Videos)->getByUser($user, 1, 2);
|
||||||
|
@ -75,7 +71,7 @@ final class UserPresenter extends OpenVKPresenter
|
||||||
$name = $user->getFullName();
|
$name = $user->getFullName();
|
||||||
$this->flash("err", "Ошибка доступа", "Вы не можете просматривать полный список подписок $name.");
|
$this->flash("err", "Ошибка доступа", "Вы не можете просматривать полный список подписок $name.");
|
||||||
|
|
||||||
$this->redirect("/id$id", static::REDIRECT_TEMPORARY_PRESISTENT);
|
$this->redirect($user->getURL());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,6 +86,9 @@ final class UserPresenter extends OpenVKPresenter
|
||||||
elseif (!$user->getPrivacyPermission('groups.read', $this->user->identity ?? NULL))
|
elseif (!$user->getPrivacyPermission('groups.read', $this->user->identity ?? NULL))
|
||||||
$this->flashFail("err", tr("forbidden"), tr("forbidden_comment"));
|
$this->flashFail("err", tr("forbidden"), tr("forbidden_comment"));
|
||||||
else {
|
else {
|
||||||
|
if($this->queryParam("act") === "managed" && $this->user->id !== $user->getId())
|
||||||
|
$this->flashFail("err", tr("forbidden"), tr("forbidden_comment"));
|
||||||
|
|
||||||
$this->template->user = $user;
|
$this->template->user = $user;
|
||||||
$this->template->page = (int) ($this->queryParam("p") ?? 1);
|
$this->template->page = (int) ($this->queryParam("p") ?? 1);
|
||||||
$this->template->admin = $this->queryParam("act") == "managed";
|
$this->template->admin = $this->queryParam("act") == "managed";
|
||||||
|
@ -154,7 +153,10 @@ final class UserPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
|
|
||||||
if (strtotime($this->postParam("birthday")) < time())
|
if (strtotime($this->postParam("birthday")) < time())
|
||||||
$user->setBirthday(strtotime($this->postParam("birthday")));
|
$user->setBirthday(empty($this->postParam("birthday")) ? NULL : strtotime($this->postParam("birthday")));
|
||||||
|
|
||||||
|
if ($this->postParam("birthday_privacy") <= 1 && $this->postParam("birthday_privacy") >= 0)
|
||||||
|
$user->setBirthday_Privacy($this->postParam("birthday_privacy"));
|
||||||
|
|
||||||
if ($this->postParam("marialstatus") <= 8 && $this->postParam("marialstatus") >= 0)
|
if ($this->postParam("marialstatus") <= 8 && $this->postParam("marialstatus") >= 0)
|
||||||
$user->setMarital_Status($this->postParam("marialstatus"));
|
$user->setMarital_Status($this->postParam("marialstatus"));
|
||||||
|
@ -270,9 +272,7 @@ final class UserPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
$user->toggleSubscription($this->user->identity);
|
$user->toggleSubscription($this->user->identity);
|
||||||
|
|
||||||
header("HTTP/1.1 302 Found");
|
$this->redirect($user->getURL());
|
||||||
header("Location: /id" . $user->getId());
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderSetAvatar(): void
|
function renderSetAvatar(): void
|
||||||
|
@ -291,7 +291,11 @@ final class UserPresenter extends OpenVKPresenter
|
||||||
$this->flashFail("err", tr("error"), tr("error_upload_failed"));
|
$this->flashFail("err", tr("error"), tr("error_upload_failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
(new Albums)->getUserAvatarAlbum($this->user->identity)->addPhoto($photo);
|
$album = (new Albums)->getUserAvatarAlbum($this->user->identity);
|
||||||
|
$album->addPhoto($photo);
|
||||||
|
$album->setEdited(time());
|
||||||
|
$album->save();
|
||||||
|
|
||||||
$this->flashFail("succ", tr("photo_saved"), tr("photo_saved_comment"));
|
$this->flashFail("succ", tr("photo_saved"), tr("photo_saved_comment"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,13 +453,51 @@ final class UserPresenter extends OpenVKPresenter
|
||||||
$this->flash("succ", tr("changes_saved"), tr("changes_saved_comment"));
|
$this->flash("succ", tr("changes_saved"), tr("changes_saved_comment"));
|
||||||
}
|
}
|
||||||
$this->template->mode = in_array($this->queryParam("act"), [
|
$this->template->mode = in_array($this->queryParam("act"), [
|
||||||
"main", "privacy", "finance", "finance.top-up", "interface"
|
"main", "security", "privacy", "finance", "finance.top-up", "interface"
|
||||||
]) ? $this->queryParam("act")
|
]) ? $this->queryParam("act")
|
||||||
: "main";
|
: "main";
|
||||||
|
|
||||||
|
if($this->template->mode == "finance") {
|
||||||
|
$address = OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["address"];
|
||||||
|
$text = str_replace("$1", (string) $this->user->identity->getId(), OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["hint"]);
|
||||||
|
$qrCode = explode("base64,", (new QRCode(new QROptions([
|
||||||
|
"imageTransparent" => false
|
||||||
|
])))->render("ton://transfer/$address?text=$text"));
|
||||||
|
|
||||||
|
$this->template->qrCodeType = substr($qrCode[0], 5);
|
||||||
|
$this->template->qrCodeData = $qrCode[1];
|
||||||
|
}
|
||||||
|
|
||||||
$this->template->user = $user;
|
$this->template->user = $user;
|
||||||
$this->template->themes = Themepacks::i()->getThemeList();
|
$this->template->themes = Themepacks::i()->getThemeList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renderDeactivate(): void
|
||||||
|
{
|
||||||
|
$this->assertUserLoggedIn();
|
||||||
|
$this->willExecuteWriteAction();
|
||||||
|
|
||||||
|
$flags = 0;
|
||||||
|
$reason = $this->postParam("deactivate_reason");
|
||||||
|
$share = $this->postParam("deactivate_share");
|
||||||
|
|
||||||
|
if($share) {
|
||||||
|
$flags |= 0b00100000;
|
||||||
|
|
||||||
|
$post = new Post;
|
||||||
|
$post->setOwner($this->user->id);
|
||||||
|
$post->setWall($this->user->id);
|
||||||
|
$post->setCreated(time());
|
||||||
|
$post->setContent($reason);
|
||||||
|
$post->setFlags($flags);
|
||||||
|
$post->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->user->identity->deactivate($reason);
|
||||||
|
|
||||||
|
$this->redirect("/");
|
||||||
|
}
|
||||||
|
|
||||||
function renderTwoFactorAuthSettings(): void
|
function renderTwoFactorAuthSettings(): void
|
||||||
{
|
{
|
||||||
$this->assertUserLoggedIn();
|
$this->assertUserLoggedIn();
|
||||||
|
@ -536,7 +578,7 @@ final class UserPresenter extends OpenVKPresenter
|
||||||
$this->user->identity->save();
|
$this->user->identity->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->redirect("/", static::REDIRECT_TEMPORARY_PRESISTENT);
|
$this->redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderCoinsTransfer(): void
|
function renderCoinsTransfer(): void
|
||||||
|
|
|
@ -42,6 +42,24 @@ final class VKAPIPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
exit(json_encode($payload));
|
exit(json_encode($payload));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function twofaFail(int $userId): void
|
||||||
|
{
|
||||||
|
header("HTTP/1.1 401 Unauthorized");
|
||||||
|
header("Content-Type: application/json");
|
||||||
|
|
||||||
|
$payload = [
|
||||||
|
"error" => "need_validation",
|
||||||
|
"error_description" => "use app code",
|
||||||
|
"validation_type" => "2fa_app",
|
||||||
|
"validation_sid" => "2fa_".$userId."_2839041_randommessdontread",
|
||||||
|
"phone_mask" => "+374 ** *** 420",
|
||||||
|
"redirect_url" => "https://http.cat/418", // Not implemented yet :( So there is a photo of cat :3
|
||||||
|
"validation_resend" => "nowhere"
|
||||||
|
];
|
||||||
|
|
||||||
|
exit(json_encode($payload));
|
||||||
|
}
|
||||||
|
|
||||||
private function badMethod(string $object, string $method): void
|
private function badMethod(string $object, string $method): void
|
||||||
{
|
{
|
||||||
|
@ -249,8 +267,12 @@ final class VKAPIPresenter extends OpenVKPresenter
|
||||||
$user = (new Users)->get($uId);
|
$user = (new Users)->get($uId);
|
||||||
|
|
||||||
$code = $this->requestParam("code");
|
$code = $this->requestParam("code");
|
||||||
if($user->is2faEnabled() && !($code === (new Totp)->GenerateToken(Base32::decode($user->get2faSecret())) || $user->use2faBackupCode((int) $code)))
|
if($user->is2faEnabled() && !($code === (new Totp)->GenerateToken(Base32::decode($user->get2faSecret())) || $user->use2faBackupCode((int) $code))) {
|
||||||
$this->fail(28, "Invalid 2FA code", "internal", "acquireToken");
|
if($this->requestParam("2fa_supported") == "1")
|
||||||
|
$this->twofaFail($user->getId());
|
||||||
|
else
|
||||||
|
$this->fail(28, "Invalid 2FA code", "internal", "acquireToken");
|
||||||
|
}
|
||||||
|
|
||||||
$token = new APIToken;
|
$token = new APIToken;
|
||||||
$token->setUser($user);
|
$token->setUser($user);
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
namespace openvk\Web\Presenters;
|
namespace openvk\Web\Presenters;
|
||||||
use openvk\Web\Models\Entities\Video;
|
use openvk\Web\Models\Entities\Video;
|
||||||
use openvk\Web\Models\Repositories\Users;
|
use openvk\Web\Models\Repositories\{Users, Videos};
|
||||||
use openvk\Web\Models\Repositories\Videos;
|
|
||||||
use Nette\InvalidStateException as ISE;
|
use Nette\InvalidStateException as ISE;
|
||||||
|
|
||||||
final class VideosPresenter extends OpenVKPresenter
|
final class VideosPresenter extends OpenVKPresenter
|
||||||
|
@ -80,7 +79,7 @@ final class VideosPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
$video->save();
|
$video->save();
|
||||||
|
|
||||||
$this->redirect("/video" . $video->getPrettyId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/video" . $video->getPrettyId());
|
||||||
} else {
|
} else {
|
||||||
$this->flashFail("err", "Произошла ошибка", "Видео не может быть опубликовано без названия.");
|
$this->flashFail("err", "Произошла ошибка", "Видео не может быть опубликовано без названия.");
|
||||||
}
|
}
|
||||||
|
@ -104,7 +103,7 @@ final class VideosPresenter extends OpenVKPresenter
|
||||||
$video->save();
|
$video->save();
|
||||||
|
|
||||||
$this->flash("succ", "Изменения сохранены", "Обновлённое описание появится на странице с видосиком.");
|
$this->flash("succ", "Изменения сохранены", "Обновлённое описание появится на странице с видосиком.");
|
||||||
$this->redirect("/video" . $video->getPrettyId(), static::REDIRECT_TEMPORARY);
|
$this->redirect("/video" . $video->getPrettyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->template->video = $video;
|
$this->template->video = $video;
|
||||||
|
@ -128,7 +127,6 @@ final class VideosPresenter extends OpenVKPresenter
|
||||||
$this->flashFail("err", "Не удалось удалить пост", "Вы не вошли в аккаунт.");
|
$this->flashFail("err", "Не удалось удалить пост", "Вы не вошли в аккаунт.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->redirect("/videos".$owner, static::REDIRECT_TEMPORARY);
|
$this->redirect("/videos" . $owner);
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,14 +113,14 @@ final class WallPresenter extends OpenVKPresenter
|
||||||
$feed = new Feed();
|
$feed = new Feed();
|
||||||
|
|
||||||
$channel = new Channel();
|
$channel = new Channel();
|
||||||
$channel->title(OPENVK_ROOT_CONF['openvk']['appearance']['name'])->url(ovk_scheme(true) . $_SERVER["SERVER_NAME"])->appendTo($feed);
|
$channel->title($owner->getCanonicalName() . " — " . OPENVK_ROOT_CONF['openvk']['appearance']['name'])->url(ovk_scheme(true) . $_SERVER["HTTP_HOST"])->appendTo($feed);
|
||||||
|
|
||||||
foreach($posts as $post) {
|
foreach($posts as $post) {
|
||||||
$item = new Item();
|
$item = new Item();
|
||||||
$item
|
$item
|
||||||
->title($post->getOwner()->getCanonicalName())
|
->title($post->getOwner()->getCanonicalName())
|
||||||
->description($post->getText())
|
->description($post->getText())
|
||||||
->url(ovk_scheme(true).$_SERVER["SERVER_NAME"]."/wall{$post->getPrettyId()}")
|
->url(ovk_scheme(true).$_SERVER["HTTP_HOST"]."/wall{$post->getPrettyId()}")
|
||||||
->pubDate($post->getPublicationTime()->timestamp())
|
->pubDate($post->getPublicationTime()->timestamp())
|
||||||
->appendTo($channel);
|
->appendTo($channel);
|
||||||
}
|
}
|
||||||
|
@ -294,11 +294,7 @@ final class WallPresenter extends OpenVKPresenter
|
||||||
if($wall > 0 && $wall !== $this->user->identity->getId())
|
if($wall > 0 && $wall !== $this->user->identity->getId())
|
||||||
(new WallPostNotification($wallOwner, $post, $this->user->identity))->emit();
|
(new WallPostNotification($wallOwner, $post, $this->user->identity))->emit();
|
||||||
|
|
||||||
if($wall > 0)
|
$this->redirect($wallOwner->getURL());
|
||||||
$this->redirect("/id$wall", 2); #Will exit
|
|
||||||
|
|
||||||
$wall = $wall * -1;
|
|
||||||
$this->redirect("/club$wall", 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderPost(int $wall, int $post_id): void
|
function renderPost(int $wall, int $post_id): void
|
||||||
|
@ -337,10 +333,7 @@ final class WallPresenter extends OpenVKPresenter
|
||||||
$post->toggleLike($this->user->identity);
|
$post->toggleLike($this->user->identity);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->redirect(
|
$this->redirect("$_SERVER[HTTP_REFERER]#postGarter=" . $post->getId());
|
||||||
"$_SERVER[HTTP_REFERER]#postGarter=" . $post->getId(),
|
|
||||||
static::REDIRECT_TEMPORARY
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderShare(int $wall, int $post_id): void
|
function renderShare(int $wall, int $post_id): void
|
||||||
|
@ -392,8 +385,7 @@ final class WallPresenter extends OpenVKPresenter
|
||||||
$this->flashFail("err", tr("failed_to_delete_post"), tr("login_required_error_comment"));
|
$this->flashFail("err", tr("failed_to_delete_post"), tr("login_required_error_comment"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->redirect($wall < 0 ? "/club".($wall*-1) : "/id".$wall, static::REDIRECT_TEMPORARY);
|
$this->redirect($wall < 0 ? "/club" . ($wall*-1) : "/id" . $wall);
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderPin(int $wall, int $post_id): void
|
function renderPin(int $wall, int $post_id): void
|
||||||
|
|
|
@ -52,9 +52,9 @@
|
||||||
{include actions}
|
{include actions}
|
||||||
<hr/>
|
<hr/>
|
||||||
<div n:if="$sorting ?? true" class="tile">
|
<div n:if="$sorting ?? true" class="tile">
|
||||||
<a href="?C=I;O=R" class="profile_link">{_"sort_randomly"}</a>
|
<a href="?C=I;O=R" class="profile_link">{_sort_randomly}</a>
|
||||||
<a href="?C=M;O=D" class="profile_link">{_"sort_up"}</a>
|
<a href="?C=M;O=D" class="profile_link">{_sort_up}</a>
|
||||||
<a href="?C=M;O=A" class="profile_link">{_"sort_down"}</a>
|
<a href="?C=M;O=A" class="profile_link">{_sort_down}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,17 +1,27 @@
|
||||||
{extends "@layout.xml"}
|
{extends "@layout.xml"}
|
||||||
{block title}{_"banned_title"}{/block}
|
{block title}{_banned_title}{/block}
|
||||||
|
|
||||||
{block header}
|
{block header}
|
||||||
{_"banned_header"}
|
{_banned_header}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block content}
|
{block content}
|
||||||
<center>
|
<center>
|
||||||
<img src="/assets/packages/static/openvk/img/oof.apng" alt="{_'banned_alt'}" style="width: 20%;" />
|
<img src="/assets/packages/static/openvk/img/oof.apng" alt="{_banned_alt}" style="width: 20%;" />
|
||||||
</center>
|
</center>
|
||||||
<p>
|
<p>
|
||||||
{tr("banned_1", htmlentities($thisUser->getCanonicalName()))|noescape}<br/>
|
{tr("banned_1", htmlentities($thisUser->getCanonicalName()))|noescape}<br/>
|
||||||
{tr("banned_2", htmlentities($thisUser->getBanReason()))|noescape}
|
{tr("banned_2", htmlentities($thisUser->getBanReason()))|noescape}
|
||||||
|
|
||||||
|
{if !$thisUser->getUnbanTime()}
|
||||||
|
{_banned_perm}
|
||||||
|
{else}
|
||||||
|
{tr("banned_until_time", $thisUser->getUnbanTime())|noescape}
|
||||||
|
{/if}
|
||||||
|
</p>
|
||||||
|
<p n:if="$thisUser->canUnbanThemself()">
|
||||||
|
<hr/>
|
||||||
|
<center><a class="button" href="/unban.php">{_banned_unban_myself}</a></center>
|
||||||
</p>
|
</p>
|
||||||
<hr/>
|
<hr/>
|
||||||
<p>
|
<p>
|
||||||
|
|
34
Web/Presenters/templates/@deactivated.xml
Normal file
34
Web/Presenters/templates/@deactivated.xml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{extends "@layout.xml"}
|
||||||
|
{block title}{$thisUser->getCanonicalName()}{/block}
|
||||||
|
|
||||||
|
{block header}
|
||||||
|
{$thisUser->getCanonicalName()}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block content}
|
||||||
|
<div class="container_gray bottom" style="margin: -10px -10px 10px;">
|
||||||
|
{tr("profile_deactivated_msg", $thisUser->getDeactivationDate()->format("%e %B %G" . tr("time_at_sp") . "%R"))|noescape}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="left_small_block">
|
||||||
|
<div>
|
||||||
|
<img src="{$thisUser->getAvatarUrl('normal')}"
|
||||||
|
alt="{$thisUser->getCanonicalName()}"
|
||||||
|
style="width: 100%; image-rendering: -webkit-optimize-contrast;" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="right_big_block">
|
||||||
|
<div class="page_info">
|
||||||
|
<div class="accountInfo clearFix">
|
||||||
|
<div class="profileName">
|
||||||
|
<h2>{$thisUser->getFullName()}</h2>
|
||||||
|
<div class="page_status" style="color: #AAA;">{_profile_deactivated_status}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<center style="color: #AAA; margin: 40px 0; font-size: 13px;">
|
||||||
|
{_profile_deactivated_info|noescape}
|
||||||
|
</center>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
|
@ -102,29 +102,35 @@
|
||||||
<a href="/" class="home_button{if $instance_name != OPENVK_DEFAULT_INSTANCE_NAME} home_button_custom{/if}" title="{$instance_name}">{if $instance_name != OPENVK_DEFAULT_INSTANCE_NAME}{$instance_name}{/if}</a>
|
<a href="/" class="home_button{if $instance_name != OPENVK_DEFAULT_INSTANCE_NAME} home_button_custom{/if}" title="{$instance_name}">{if $instance_name != OPENVK_DEFAULT_INSTANCE_NAME}{$instance_name}{/if}</a>
|
||||||
<div n:if="isset($thisUser) ? (!$thisUser->isBanned() XOR !$thisUser->isActivated()) : true" class="header_navigation">
|
<div n:if="isset($thisUser) ? (!$thisUser->isBanned() XOR !$thisUser->isActivated()) : true" class="header_navigation">
|
||||||
{ifset $thisUser}
|
{ifset $thisUser}
|
||||||
<div class="link">
|
{if $thisUser->isDeactivated()}
|
||||||
<a href="/">{_header_home}</a>
|
<div class="link">
|
||||||
</div>
|
<a href="/logout?hash={urlencode($csrfToken)}">{_header_log_out}</a>
|
||||||
<div class="link">
|
</div>
|
||||||
<a href="/search?type=groups">{_header_groups}</a>
|
{else}
|
||||||
</div>
|
<div class="link">
|
||||||
<div class="link">
|
<a href="/">{_header_home}</a>
|
||||||
<a href="/search">{_header_search}</a>
|
</div>
|
||||||
</div>
|
<div class="link">
|
||||||
<div class="link">
|
<a href="/search?type=groups">{_header_groups}</a>
|
||||||
<a href="/invite">{_header_invite}</a>
|
</div>
|
||||||
</div>
|
<div class="link">
|
||||||
<div class="link">
|
<a href="/search">{_header_search}</a>
|
||||||
<a href="/support">{_header_help} <b n:if="$ticketAnsweredCount > 0">({$ticketAnsweredCount})</b></a>
|
</div>
|
||||||
</div>
|
<div class="link">
|
||||||
<div class="link">
|
<a href="/invite">{_header_invite}</a>
|
||||||
<a href="/logout?hash={urlencode($csrfToken)}">{_header_log_out}</a>
|
</div>
|
||||||
</div>
|
<div class="link">
|
||||||
<div class="link">
|
<a href="/support">{_header_help} <b n:if="$ticketAnsweredCount > 0">({$ticketAnsweredCount})</b></a>
|
||||||
<form action="/search" method="get">
|
</div>
|
||||||
<input type="search" name="query" placeholder="{_header_search}" style="height: 20px;background: url('/assets/packages/static/openvk/img/search_icon.png') no-repeat 3px 4px; background-color: #fff; padding-left: 18px;width: 120px;" title="{_header_search} [Alt+Shift+F]" accesskey="f" />
|
<div class="link">
|
||||||
</form>
|
<a href="/logout?hash={urlencode($csrfToken)}">{_header_log_out}</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="link">
|
||||||
|
<form action="/search" method="get">
|
||||||
|
<input type="search" name="query" placeholder="{_header_search}" style="height: 20px;background: url('/assets/packages/static/openvk/img/search_icon.png') no-repeat 3px 4px; background-color: #fff; padding-left: 18px;width: 120px;" title="{_header_search} [Alt+Shift+F]" accesskey="f" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
{else}
|
{else}
|
||||||
<div class="link">
|
<div class="link">
|
||||||
<a href="/login">{_header_login}</a>
|
<a href="/login">{_header_login}</a>
|
||||||
|
@ -142,7 +148,7 @@
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<div class="navigation">
|
<div class="navigation">
|
||||||
{ifset $thisUser}
|
{ifset $thisUser}
|
||||||
{if !$thisUser->isBanned() XOR !$thisUser->isActivated()}
|
{if !$thisUser->isBanned() XOR !$thisUser->isActivated() XOR $thisUser->isDeactivated()}
|
||||||
<a href="/edit" class="link edit-button">{_edit_button}</a>
|
<a href="/edit" class="link edit-button">{_edit_button}</a>
|
||||||
<a href="{$thisUser->getURL()}" class="link" title="{_my_page} [Alt+Shift+.]" accesskey=".">{_my_page}</a>
|
<a href="{$thisUser->getURL()}" class="link" title="{_my_page} [Alt+Shift+.]" accesskey=".">{_my_page}</a>
|
||||||
<a href="/friends{$thisUser->getId()}" class="link">{_my_friends}
|
<a href="/friends{$thisUser->getId()}" class="link">{_my_friends}
|
||||||
|
@ -167,6 +173,7 @@
|
||||||
(<b>{$thisUser->getNotificationsCount()}</b>)
|
(<b>{$thisUser->getNotificationsCount()}</b>)
|
||||||
{/if}
|
{/if}
|
||||||
</a>
|
</a>
|
||||||
|
<a href="/apps?act=installed" class="link">{_my_apps}</a>
|
||||||
<a href="/settings" class="link">{_my_settings}</a>
|
<a href="/settings" class="link">{_my_settings}</a>
|
||||||
|
|
||||||
{var $canAccessAdminPanel = $thisUser->getChandlerUser()->can("access")->model("admin")->whichBelongsTo(NULL)}
|
{var $canAccessAdminPanel = $thisUser->getChandlerUser()->can("access")->model("admin")->whichBelongsTo(NULL)}
|
||||||
|
@ -200,8 +207,41 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a n:if="OPENVK_ROOT_CONF['openvk']['preferences']['adPoster']['enable'] && $thisUser->getLeftMenuItemStatus('poster')" href="{php echo OPENVK_ROOT_CONF['openvk']['preferences']['adPoster']['link']}" >
|
<a n:if="OPENVK_ROOT_CONF['openvk']['preferences']['adPoster']['enable'] && $thisUser->getLeftMenuItemStatus('poster')" href="{php echo OPENVK_ROOT_CONF['openvk']['preferences']['adPoster']['link']}" >
|
||||||
<img src="{php echo OPENVK_ROOT_CONF['openvk']['preferences']['adPoster']['src']}" alt="{php echo OPENVK_ROOT_CONF['openvk']['preferences']['adPoster']['caption']}" class="psa-poster" style="max-width: 100%; margin-top: 50px;" />
|
<img src="{php echo OPENVK_ROOT_CONF['openvk']['preferences']['adPoster']['src']}" alt="{php echo OPENVK_ROOT_CONF['openvk']['preferences']['adPoster']['caption']}" class="psa-poster" style="max-width: 100%; margin-top: 10px;" />
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
<div class="floating_sidebar">
|
||||||
|
<a class="minilink" href="/friends{$thisUser->getId()}">
|
||||||
|
<object type="internal/link" n:if="$thisUser->getFollowersCount() > 0">
|
||||||
|
<div class="counter">
|
||||||
|
+{$thisUser->getFollowersCount()}
|
||||||
|
</div>
|
||||||
|
</object>
|
||||||
|
<img src="/assets/packages/static/openvk/img/friends.svg">
|
||||||
|
</a>
|
||||||
|
<a class="minilink" href="/albums{$thisUser->getId()}">
|
||||||
|
<img src="/assets/packages/static/openvk/img/photos.svg">
|
||||||
|
</a>
|
||||||
|
<a class="minilink" href="/im">
|
||||||
|
<object type="internal/link" n:if="$thisUser->getUnreadMessagesCount() > 0">
|
||||||
|
<div class="counter">
|
||||||
|
+{$thisUser->getUnreadMessagesCount()}
|
||||||
|
</div>
|
||||||
|
</object>
|
||||||
|
<img src="/assets/packages/static/openvk/img/messages.svg">
|
||||||
|
</a>
|
||||||
|
<a class="minilink" href="/groups{$thisUser->getId()}">
|
||||||
|
<img src="/assets/packages/static/openvk/img/groups.svg">
|
||||||
|
</a>
|
||||||
|
<a class="minilink" href="/notifications">
|
||||||
|
<object type="internal/link" n:if="$thisUser->getNotificationsCount() > 0">
|
||||||
|
<div class="counter">
|
||||||
|
+{$thisUser->getNotificationsCount()}
|
||||||
|
</div>
|
||||||
|
</object>
|
||||||
|
<img src="/assets/packages/static/openvk/img/feedback.svg">
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
{elseif !$thisUser->isActivated()}
|
{elseif !$thisUser->isActivated()}
|
||||||
<a href="/logout?hash={urlencode($csrfToken)}" class="link">{_menu_logout}</a>
|
<a href="/logout?hash={urlencode($csrfToken)}" class="link">{_menu_logout}</a>
|
||||||
{else}
|
{else}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<div class="wrap2">
|
<div class="wrap2">
|
||||||
<div class="wrap1">
|
<div class="wrap1">
|
||||||
<div class="page_wrap padding_top">
|
<div class="page_wrap padding_top">
|
||||||
<div n:ifset="tabs" class="tabs">
|
<div n:ifset="tabs" n:ifcontent class="tabs stupid-fix">
|
||||||
{include tabs}
|
{include tabs}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
{include description, x => $dat}
|
{include description, x => $dat}
|
||||||
{/ifset}
|
{/ifset}
|
||||||
</td>
|
</td>
|
||||||
<td n:ifset="actions" valign="top" class="action_links" style="width: 150px; text-transform: lowercase;">
|
<td n:ifset="actions" valign="top" class="action_links" style="width: 150px;">
|
||||||
{include actions, x => $dat}
|
{include actions, x => $dat}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
{extends "../@layout.xml"}
|
{extends "../@layout.xml"}
|
||||||
{block title}{_"welcome"}{/block}
|
{block title}{_welcome}{/block}
|
||||||
|
|
||||||
{block header}
|
{block header}
|
||||||
{_"welcome"}
|
{_welcome}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block content}
|
{block content}
|
||||||
{presenter "openvk!Support->knowledgeBaseArticle", "about"}
|
{presenter "openvk!Support->knowledgeBaseArticle", "about"}
|
||||||
<center>
|
<center>
|
||||||
<a class="button" style="margin-right: 5px;cursor: pointer;" href="/login">{_"log_in"}</a>
|
<a class="button" style="margin-right: 5px;cursor: pointer;" href="/login">{_log_in}</a>
|
||||||
<a class="button" style="cursor: pointer;" href="/reg">{_"registration"}</a>
|
<a class="button" style="cursor: pointer;" href="/reg">{_registration}</a>
|
||||||
</center>
|
</center>
|
||||||
{* TO-DO: Add statistics about this instance as on mastodon.social *}
|
{* TO-DO: Add statistics about this instance as on mastodon.social *}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block content}
|
{block content}
|
||||||
{_"you_can_invite"}<br><br>
|
{_you_can_invite}<br><br>
|
||||||
<center>
|
<center>
|
||||||
<input type="text" readonly value="https://{$_SERVER["HTTP_HOST"]}/reg?ref={rawurlencode($thisUser->getRefLinkId())}" size="50" />
|
<input type="text" readonly value="https://{$_SERVER["HTTP_HOST"]}/reg?ref={rawurlencode($thisUser->getRefLinkId())}" size="50" />
|
||||||
</center>
|
</center>
|
||||||
<p>{_"you_can_invite_2"}</p>
|
<p>{_you_can_invite_2}</p>
|
||||||
{/block}
|
{/block}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{extends "../@layout.xml"}
|
{extends "../@layout.xml"}
|
||||||
{block title}{_"select_language"}{/block}
|
{block title}{_select_language}{/block}
|
||||||
|
|
||||||
{block header}
|
{block header}
|
||||||
{_"select_language"}
|
{_select_language}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block content}
|
{block content}
|
||||||
|
|
|
@ -396,8 +396,8 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td class="e">
|
<td class="e">
|
||||||
Vladimir Barinov (veselcraft), Celestora, Konstantin Kichulkin (kosfurler),
|
Vladimir Barinov (veselcraft), Celestora, Konstantin Kichulkin (kosfurler),
|
||||||
Nikita Volkov (sup_ban), Daniel Myslivets, Alexander Kotov (l-lacker),
|
Nikita Volkov (sup_ban), Daniel Myslivets, Maxim Leshchenko (maksales / maksalees)
|
||||||
Alexey Assemblerov (BiosNod), Ilya Prokopenko (dsrev) and Maxim Leshchenko (maksales / maksalees)
|
and n1rwana
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -474,7 +474,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="e">Best barmaid</td>
|
<td class="e">Best barmaid</td>
|
||||||
<td class="v">Jill</td> {* I can agree ~~ dsrev *}
|
<td class="v">Jill</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="e">Initial Helpdesk implementation</td>
|
<td class="e">Initial Helpdesk implementation</td>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<div class="aui-header-inner">
|
<div class="aui-header-inner">
|
||||||
<div class="aui-header-primary">
|
<div class="aui-header-primary">
|
||||||
<h1 id="logo" class="aui-header-logo aui-header-logo-textonly">
|
<h1 id="logo" class="aui-header-logo aui-header-logo-textonly">
|
||||||
<a href="/admin">
|
<a href="/">
|
||||||
<span class="aui-header-logo-device">{$instance_name}</span>
|
<span class="aui-header-logo-device">{$instance_name}</span>
|
||||||
</a>
|
</a>
|
||||||
</h1>
|
</h1>
|
||||||
|
@ -56,6 +56,9 @@
|
||||||
<li>
|
<li>
|
||||||
<a href="/admin/clubs">{_groups}</a>
|
<a href="/admin/clubs">{_groups}</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/admin/bannedLinks">{_admin_banned_links}</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="aui-nav-heading">
|
<div class="aui-nav-heading">
|
||||||
<strong>{_admin_services}</strong>
|
<strong>{_admin_services}</strong>
|
||||||
|
|
48
Web/Presenters/templates/Admin/BannedLink.xml
Normal file
48
Web/Presenters/templates/Admin/BannedLink.xml
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
{extends "@layout.xml"}
|
||||||
|
|
||||||
|
{block title}
|
||||||
|
{_edit}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block heading}
|
||||||
|
{_edit} #{$form->id ?? "undefined"}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block content}
|
||||||
|
<div style="margin: 8px -8px;" class="aui-tabs horizontal-tabs">
|
||||||
|
<ul class="tabs-menu">
|
||||||
|
<li class="menu-item active-tab">
|
||||||
|
<a href="#info">{_admin_banned_link}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="tabs-pane active-pane" id="info">
|
||||||
|
<form class="aui" method="POST">
|
||||||
|
<div class="field-group">
|
||||||
|
<label for="id">ID</label>
|
||||||
|
<input class="text long-field" type="number" id="id" name="id" disabled value="{$form->id}" />
|
||||||
|
</div>
|
||||||
|
<div class="field-group">
|
||||||
|
<label for="token">{_admin_banned_domain}</label>
|
||||||
|
<input class="text long-field" type="text" id="link" name="link" value="{$form->link}" />
|
||||||
|
<div class="description">{_admin_banned_link_description}</div>
|
||||||
|
</div>
|
||||||
|
<div class="field-group">
|
||||||
|
<label for="token">{_admin_banned_link_regexp}</label>
|
||||||
|
<input class="text long-field" type="text" id="regexp" name="regexp" value="{$form->regexp}" />
|
||||||
|
<div class="description">{_admin_banned_link_regexp_description}</div>
|
||||||
|
</div>
|
||||||
|
<div class="field-group">
|
||||||
|
<label for="coins">{_admin_banned_link_reason}</label>
|
||||||
|
<input class="text long-field" type="text" id="reason" name="reason" value="{$form->reason}" />
|
||||||
|
</div>
|
||||||
|
<div class="buttons-container">
|
||||||
|
<div class="buttons">
|
||||||
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
|
<input class="aui-button aui-button-primary submit" type="submit" value="{_save}">
|
||||||
|
<a class="aui-button aui-button-secondary" href="/admin/bannedLink/id{$form->id}/unban">{_delete}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
46
Web/Presenters/templates/Admin/BannedLinks.xml
Normal file
46
Web/Presenters/templates/Admin/BannedLinks.xml
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
{extends "@layout.xml"}
|
||||||
|
|
||||||
|
{block title}
|
||||||
|
{_admin_banned_links}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block heading}
|
||||||
|
<a style="float: right;" class="aui-button aui-button-primary" href="/admin/bannedLink/id0">
|
||||||
|
{_create}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
{_admin_banned_links}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block content}
|
||||||
|
<table class="aui aui-table-list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>{_admin_banned_domain}</th>
|
||||||
|
<th>REGEXP</th>
|
||||||
|
<th>{_admin_banned_link_reason}</th>
|
||||||
|
<th>{_admin_banned_link_initiator}</th>
|
||||||
|
<th>{_admin_actions}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr n:foreach="$links as $link">
|
||||||
|
<td>{$link->getId()}</td>
|
||||||
|
<td>{$link->getDomain()}</td>
|
||||||
|
<td>{$link->getRegexpRule()}</td>
|
||||||
|
<td>{$link->getReason() ?? "-"}</td>
|
||||||
|
<td>{$link->getInitiator()->getCanonicalName()}</td>
|
||||||
|
<td>
|
||||||
|
<a class="aui-button aui-button-primary" href="/admin/bannedLink/id{$link->getId()}">
|
||||||
|
<span class="aui-icon aui-icon-small aui-iconfont-new-edit">{_edit}</span>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div align="right">
|
||||||
|
<a n:if="($_GET['p'] ?? 1) > 1" class="aui-button" href="?p={($_GET['p'] ?? 1) - 1}">«</a>
|
||||||
|
<a class="aui-button" href="?p={($_GET['p'] ?? 1) + 1}">»</a>
|
||||||
|
</div>
|
||||||
|
{/block}
|
112
Web/Presenters/templates/Apps/Edit.xml
Normal file
112
Web/Presenters/templates/Apps/Edit.xml
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
{extends "../@layout.xml"}
|
||||||
|
|
||||||
|
{block title}
|
||||||
|
{if $create}
|
||||||
|
{_create_app}
|
||||||
|
{else}
|
||||||
|
{_edit_app}
|
||||||
|
{/if}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block header}
|
||||||
|
{if $create}
|
||||||
|
{_new_app}
|
||||||
|
{else}
|
||||||
|
<a href="/apps?act=dev">{_own_apps_alternate}</a> »
|
||||||
|
<a href="/app{$id}">{$name}</a> »
|
||||||
|
{_edit}
|
||||||
|
{/if}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block content}
|
||||||
|
<div class="container_gray">
|
||||||
|
<h4>{_main_information}</h4>
|
||||||
|
<form method="POST" enctype="multipart/form-data">
|
||||||
|
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td width="120" valign="top">
|
||||||
|
<span class="nobold">{_name}: </span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="name" value="{$name ?? ''}" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="120" valign="top">
|
||||||
|
<span class="nobold">{_description}: </span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="desc" value="{$desc ?? ''}" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="120" valign="top">
|
||||||
|
<span class="nobold">{_avatar}: </span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="file" name="ava" accept="image/*" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="120" valign="top">
|
||||||
|
<span class="nobold">{_app_news}: </span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="note" placeholder="{ovk_scheme(true) . $_SERVER['HTTP_HOST']}/note{$thisUser->getId()}_10" value="{$note ?? ''}" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="120" valign="top">
|
||||||
|
<span class="nobold">URL: </span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="url" value="{$url ?? ''}" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="120" valign="top">
|
||||||
|
<span class="nobold">{_app_state}: </span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="checkbox" name="enable" n:attr="checked => ($on ?? false)" /> {_app_enabled}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
|
<input type="submit" value="{_save}" class="button" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<h4>{_additional_information}</h4>
|
||||||
|
<div>
|
||||||
|
<ul style="color: unset;">
|
||||||
|
{if $create}
|
||||||
|
<li>{_app_creation_hint_url}</li>
|
||||||
|
<li>{_app_creation_hint_iframe}</li>
|
||||||
|
{else}
|
||||||
|
<li>{tr("app_balance", $coins)|noescape} (<a href="javascript:withdraw({$id})">{_app_withdrawal_q}</a>)</li>
|
||||||
|
<li>{tr("app_users", $users)|noescape}</li>
|
||||||
|
{/if}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
async function withdraw(id) {
|
||||||
|
let coins = await API.Apps.withdrawFunds(id);
|
||||||
|
if(coins == 0)
|
||||||
|
MessageBox({_app_withdrawal}, {_app_withdrawal_empty}, ["OK"], [Function.noop]);
|
||||||
|
else
|
||||||
|
MessageBox({_app_withdrawal}, {tr("app_withdrawal_created", $coins)}, ["OK"], [Function.noop]);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{/block}
|
53
Web/Presenters/templates/Apps/List.xml
Normal file
53
Web/Presenters/templates/Apps/List.xml
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
{extends "../@listView.xml"}
|
||||||
|
|
||||||
|
{block title}
|
||||||
|
{_apps}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block header}
|
||||||
|
{_apps}
|
||||||
|
|
||||||
|
<div n:if="$act === 'dev'" style="float: right;">
|
||||||
|
<span><b>
|
||||||
|
<a href="/editapp?act=create">{_create}</a>
|
||||||
|
</b></span>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block tabs}
|
||||||
|
<div n:attr="id => ($act === 'list' ? 'activetabs' : 'ki')" class="tab">
|
||||||
|
<a n:attr="id => ($act === 'list' ? 'act_tab_a' : 'ki')" href="?act=list">{_all_apps}</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div n:attr="id => ($act === 'installed' ? 'activetabs' : 'ki')" class="tab">
|
||||||
|
<a n:attr="id => ($act === 'installed' ? 'act_tab_a' : 'ki')" href="?act=installed">{_installed_apps}</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div n:attr="id => ($act === 'dev' ? 'activetabs' : 'ki')" class="tab">
|
||||||
|
<a n:attr="id => ($act === 'dev' ? 'act_tab_a' : 'ki')" href="?act=dev">{_own_apps}</a>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{* BEGIN ELEMENTS DESCRIPTION *}
|
||||||
|
|
||||||
|
{block link|strip|stripHtml}
|
||||||
|
/app{$x->getId()}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block preview}
|
||||||
|
<img style="max-width: 75px;" src="{$x->getAvatarUrl()}" />
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name}
|
||||||
|
{$x->getName()}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block description}
|
||||||
|
{$x->getDescription()}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block actions}
|
||||||
|
<a href="/app{$x->getId()}" class="profile_link">{_app_play}</a>
|
||||||
|
<a n:if="$x->isInstalledBy($thisUser)" href="/apps/uninstall?hash={rawurlencode($csrfToken)}&app={$x->getId()}" class="profile_link">{_app_uninstall}</a>
|
||||||
|
<a n:if="$thisUser->getId() == $x->getOwner()->getId()" href="/editapp?app={$x->getId()}" class="profile_link">{_app_edit}</a>
|
||||||
|
{/block}
|
37
Web/Presenters/templates/Apps/Play.xml
Normal file
37
Web/Presenters/templates/Apps/Play.xml
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{extends "../@layout.xml"}
|
||||||
|
|
||||||
|
{block title}
|
||||||
|
{$name}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block header}
|
||||||
|
{$name}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block content}
|
||||||
|
<center>
|
||||||
|
<iframe id="appFrame" referrerpolicy="unsafe-url" sandbox="allow-scripts" frameBorder="0" src="{$url}" height="600" width="600"></iframe>
|
||||||
|
</center>
|
||||||
|
|
||||||
|
<div n:if="!is_null($news)" id="news">
|
||||||
|
<h4>{$news->getName()}</h4>
|
||||||
|
<div id="app_news_container">
|
||||||
|
{$news->getText()|noescape}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<center>
|
||||||
|
<p>
|
||||||
|
{_app_dev}: <a href="{$owner->getURL()}">{$owner->getFullName()}</a>
|
||||||
|
</p>
|
||||||
|
</center>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
window.appId = {$id};
|
||||||
|
window.appTitle = {$name};
|
||||||
|
window.appPerms = {$perms};
|
||||||
|
window.appOrigin = {$origin};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{script "js/al_games.js"}
|
||||||
|
{/block}
|
|
@ -1,20 +1,20 @@
|
||||||
{extends "../@layout.xml"}
|
{extends "../@layout.xml"}
|
||||||
|
|
||||||
{block title}
|
{block title}
|
||||||
{_"access_recovery"}
|
{_access_recovery}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block header}
|
{block header}
|
||||||
{_"page_access_recovery"}
|
{_page_access_recovery}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block content}
|
{block content}
|
||||||
<p>
|
<p>
|
||||||
{_"access_recovery_info_2"}
|
{_access_recovery_info_2}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<form method="POST" enctype="multipart/form-data">
|
<form method="POST" enctype="multipart/form-data">
|
||||||
<label for="password">{_"new_password"}: </label>
|
<label for="password">{_new_password}: </label>
|
||||||
<input id="password" type="password" name="password" required />
|
<input id="password" type="password" name="password" required />
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
{if $is2faEnabled}
|
{if $is2faEnabled}
|
||||||
|
@ -24,6 +24,6 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" value="{_'reset_password'}" class="button" style="float: right;" />
|
<input type="submit" value="{_reset_password}" class="button" style="float: right;" />
|
||||||
</form>
|
</form>
|
||||||
{/block}
|
{/block}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{extends "../@layout.xml"}
|
{extends "../@layout.xml"}
|
||||||
{block title}{_"log_in"}{/block}
|
{block title}{_log_in}{/block}
|
||||||
|
|
||||||
{block header}
|
{block header}
|
||||||
{_"log_in"}
|
{_log_in}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block content}
|
{block content}
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<span>{_"email"}: </span>
|
<span>{_email}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="login" required />
|
<input type="text" name="login" required />
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<span>{_"password"}: </span>
|
<span>{_password}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="password" name="password" required />
|
<input type="password" name="password" required />
|
||||||
|
@ -31,8 +31,8 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" value="{_'log_in'}" class="button" />
|
<input type="submit" value="{_log_in}" class="button" />
|
||||||
<a href="/reg">{_"registration"}</a>
|
<a href="/reg">{_registration}</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
{extends "../@layout.xml"}
|
{extends "../@layout.xml"}
|
||||||
{block title}{_"log_in"}{/block}
|
{block title}{_log_in}{/block}
|
||||||
|
|
||||||
{block header}
|
{block header}
|
||||||
{_"log_in"}
|
{_log_in}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block content}
|
{block content}
|
||||||
<p>
|
<p>
|
||||||
{_"two_factor_authentication_login"}
|
{_two_factor_authentication_login}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<form method="POST" enctype="multipart/form-data">
|
<form method="POST" enctype="multipart/form-data">
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
<input type="hidden" name="login" value="{$login}" />
|
<input type="hidden" name="login" value="{$login}" />
|
||||||
<input type="hidden" name="password" value="{$password}" />
|
<input type="hidden" name="password" value="{$password}" />
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" value="{_'log_in'}" class="button" />
|
<input type="submit" value="{_log_in}" class="button" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{extends "../@layout.xml"}
|
{extends "../@layout.xml"}
|
||||||
{block title}{_"registration"}{/block}
|
{block title}{_registration}{/block}
|
||||||
|
|
||||||
{block header}
|
{block header}
|
||||||
{_"registration"}
|
{_registration}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block headIncludes}
|
{block headIncludes}
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<span>{_"name"}: </span>
|
<span>{_name}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="first_name" required />
|
<input type="text" name="first_name" required />
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<span>{_"surname"}: </span>
|
<span>{_surname}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="last_name" />
|
<input type="text" name="last_name" />
|
||||||
|
@ -44,19 +44,19 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<span>{_"gender"}: </span>
|
<span>{_gender}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{var $femalePreferred = OPENVK_ROOT_CONF["openvk"]["preferences"]["femaleGenderPriority"]}
|
{var $femalePreferred = OPENVK_ROOT_CONF["openvk"]["preferences"]["femaleGenderPriority"]}
|
||||||
<select name="sex" required>
|
<select name="sex" required>
|
||||||
<option n:attr="selected => !$femalePreferred" value="male">{_"male"}</option>
|
<option n:attr="selected => !$femalePreferred" value="male">{_male}</option>
|
||||||
<option n:attr="selected => $femalePreferred" value="female">{_"female"}</option>
|
<option n:attr="selected => $femalePreferred" value="female">{_female}</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<span>{_"birth_date"}: </span>
|
<span>{_birth_date}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input max={date('Y-m-d')} name="birthday" type="date"/>
|
<input max={date('Y-m-d')} name="birthday" type="date"/>
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
<tr></tr>
|
<tr></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<span>{_"email"}: </span>
|
<span>{_email}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="email" name="email" required />
|
<input type="email" name="email" required />
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<span>{_"password"}: </span>
|
<span>{_password}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="password" name="password" required />
|
<input type="password" name="password" required />
|
||||||
|
@ -93,8 +93,8 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" value="{_'registration'}" class="button" />
|
<input type="submit" value="{_registration}" class="button" />
|
||||||
<a href="/login">{_"log_in"}</a>
|
<a href="/login">{_log_in}</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -102,9 +102,9 @@
|
||||||
</form>
|
</form>
|
||||||
{else}
|
{else}
|
||||||
<center>
|
<center>
|
||||||
<img src="/assets/packages/static/openvk/img/oof.apng" alt="{_'registration_closed'}" style="width: 20%;" />
|
<img src="/assets/packages/static/openvk/img/oof.apng" alt="{_registration_closed}" style="width: 20%;" />
|
||||||
<p>
|
<p>
|
||||||
{_"registration_disabled_info"}
|
{_registration_disabled_info}
|
||||||
{if OPENVK_ROOT_CONF['openvk']['preferences']['registration']['reason']}
|
{if OPENVK_ROOT_CONF['openvk']['preferences']['registration']['reason']}
|
||||||
<br/><br/><b>{php echo OPENVK_ROOT_CONF['openvk']['preferences']['registration']['reason']}</b>
|
<br/><br/><b>{php echo OPENVK_ROOT_CONF['openvk']['preferences']['registration']['reason']}</b>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
{extends "../@layout.xml"}
|
{extends "../@layout.xml"}
|
||||||
|
|
||||||
{block title}
|
{block title}
|
||||||
{_"access_recovery"}
|
{_access_recovery}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block header}
|
{block header}
|
||||||
{_"page_access_recovery"}
|
{_page_access_recovery}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block content}
|
{block content}
|
||||||
<p>
|
<p>
|
||||||
{_"access_recovery_info"}
|
{_access_recovery_info}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<form method="POST" enctype="multipart/form-data">
|
<form method="POST" enctype="multipart/form-data">
|
||||||
<label for="login">{_"log_in"}: </label>
|
<label for="login">{_log_in}: </label>
|
||||||
<input id="login" type="text" name="login" required />
|
<input id="login" type="text" name="login" required />
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" value="{_'reset_password'}" class="button" style="float: right;" />
|
<input type="submit" value="{_reset_password}" class="button" style="float: right;" />
|
||||||
</form>
|
</form>
|
||||||
{/block}
|
{/block}
|
||||||
|
|
22
Web/Presenters/templates/Away/View.xml
Normal file
22
Web/Presenters/templates/Away/View.xml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{extends "../@layout.xml"}
|
||||||
|
|
||||||
|
{block title}Переход по ссылке заблокирован{/block}
|
||||||
|
|
||||||
|
{block header}
|
||||||
|
Предупреждение
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block content}
|
||||||
|
<div style="min-height: 120px;">
|
||||||
|
<img src="/assets/packages/static/openvk/img/oof.apng" width="110" height="110" style="margin-left: 20px;">
|
||||||
|
|
||||||
|
<div style="padding-left: 150px; margin-top: -100px;">
|
||||||
|
<h4 style="font-size: 14px; margin-bottom: 8px;">{_url_is_banned_title}</h4>
|
||||||
|
<span>
|
||||||
|
{$link->getComment()|noescape}
|
||||||
|
</span>
|
||||||
|
<br><br>
|
||||||
|
<a href="{$to}" class="button" target="_blank">{_url_is_banned_proceed}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
|
@ -12,13 +12,13 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"comment"}: </span>
|
<span class="nobold">{_comment}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="comment" value="{$manager->getComment()}" />
|
<input type="text" name="comment" value="{$manager->getComment()}" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold"></span>
|
<span class="nobold"></span>
|
||||||
</td>
|
</td>
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" name="user" value="{$manager->getUser()->getId()}">
|
<input type="hidden" name="user" value="{$manager->getUser()->getId()}">
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" value="{_'save'}" class="button" />
|
<input type="submit" value="{_save}" class="button" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
{extends "../@layout.xml"}
|
{extends "../@layout.xml"}
|
||||||
{block title}{_"create_group"}{/block}
|
{block title}{_create_group}{/block}
|
||||||
|
|
||||||
{block header}
|
{block header}
|
||||||
{_"create_group"}
|
{_create_group}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block content}
|
{block content}
|
||||||
<div class="container_gray">
|
<div class="container_gray">
|
||||||
<h4>{_"create_group"}</h4>
|
<h4>{_create_group}</h4>
|
||||||
<form method="POST" enctype="multipart/form-data">
|
<form method="POST" enctype="multipart/form-data">
|
||||||
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
|
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"name"}: </span>
|
<span class="nobold">{_name}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="name" value="" />
|
<input type="text" name="name" value="" />
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"description"}: </span>
|
<span class="nobold">{_description}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea type="text" name="about"></textarea>
|
<textarea type="text" name="about"></textarea>
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" value="{_'create'}" class="button" />
|
<input type="submit" value="{_create}" class="button" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"name"}: </span>
|
<span class="nobold">{_name}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="name" value="{$club->getName()}" />
|
<input type="text" name="name" value="{$club->getName()}" />
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"description"}: </span>
|
<span class="nobold">{_description}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea type="text" name="about" style="resize:vertical;">{$club->getDescription()}</textarea>
|
<textarea type="text" name="about" style="resize:vertical;">{$club->getDescription()}</textarea>
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" value="{_'save'}" class="button" />
|
<input type="submit" value="{_save}" class="button" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -54,11 +54,11 @@
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top"><span class="nobold">{_"gender"}: </span></td>
|
<td width="120" valign="top"><span class="nobold">{_gender}: </span></td>
|
||||||
<td>{$user->isFemale() ? "женский" : "мужской"}</td>
|
<td>{$user->isFemale() ? "женский" : "мужской"}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top"><span class="nobold">{_"registration_date"}: </span></td>
|
<td width="120" valign="top"><span class="nobold">{_registration_date}: </span></td>
|
||||||
<td>{$user->getRegistrationTime()}</td>
|
<td>{$user->getRegistrationTime()}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -17,22 +17,22 @@
|
||||||
<div n:if="!is_null($alert = $club->getAlert())" class="group-alert">{strpos($alert, "@") === 0 ? tr(substr($alert, 1)) : $alert}</div>
|
<div n:if="!is_null($alert = $club->getAlert())" class="group-alert">{strpos($alert, "@") === 0 ? tr(substr($alert, 1)) : $alert}</div>
|
||||||
|
|
||||||
<div class="content_title_expanded" onclick="hidePanel(this);">
|
<div class="content_title_expanded" onclick="hidePanel(this);">
|
||||||
{_"information"}
|
{_information}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page_info">
|
<div class="page_info">
|
||||||
<table class="ugc-table">
|
<table class="ugc-table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class="nobold">{_"name_group"}:</span></td>
|
<td><span class="nobold">{_name_group}:</span></td>
|
||||||
<td><b>{$club->getName()}</b></td>
|
<td><b>{$club->getName()}</b></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class="nobold">{_"description"}:</span></td>
|
<td><span class="nobold">{_description}:</span></td>
|
||||||
<td>{$club->getDescriptionHtml()|noescape}</td>
|
<td>{$club->getDescriptionHtml()|noescape}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr n:if="!is_null($club->getWebsite())">
|
<tr n:if="!is_null($club->getWebsite())">
|
||||||
<td><span class="nobold">{_"website"}: </span></td>
|
<td><span class="nobold">{_website}: </span></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{$club->getWebsite()}" rel="ugc" target="_blank">
|
<a href="{$club->getWebsite()}" rel="ugc" target="_blank">
|
||||||
{$club->getWebsite()}
|
{$club->getWebsite()}
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
<div class="content_subtitle">
|
<div class="content_subtitle">
|
||||||
{tr("topics", $topicsCount)}
|
{tr("topics", $topicsCount)}
|
||||||
<div style="float: right;">
|
<div style="float: right;">
|
||||||
<a href="/board{$club->getId()}">{_"all_title"}</a>
|
<a href="/board{$club->getId()}">{_all_title}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -100,38 +100,38 @@
|
||||||
</a>
|
</a>
|
||||||
<div n:ifset="$thisUser" id="profile_links">
|
<div n:ifset="$thisUser" id="profile_links">
|
||||||
{if $club->canBeModifiedBy($thisUser)}
|
{if $club->canBeModifiedBy($thisUser)}
|
||||||
<a href="/club{$club->getId()}/edit" id="profile_link">{_"edit_group"}</a>
|
<a href="/club{$club->getId()}/edit" id="profile_link">{_edit_group}</a>
|
||||||
{/if}
|
{/if}
|
||||||
{if $thisUser->getChandlerUser()->can("access")->model("admin")->whichBelongsTo(NULL)}
|
{if $thisUser->getChandlerUser()->can("access")->model("admin")->whichBelongsTo(NULL)}
|
||||||
<a href="/admin/clubs/id{$club->getId()}" id="profile_link">{_"manage_group_action"}</a>
|
<a href="/admin/clubs/id{$club->getId()}" id="profile_link">{_manage_group_action}</a>
|
||||||
{/if}
|
{/if}
|
||||||
{if $club->getSubscriptionStatus($thisUser) == false}
|
{if $club->getSubscriptionStatus($thisUser) == false}
|
||||||
<form action="/setSub/club" method="post">
|
<form action="/setSub/club" method="post">
|
||||||
<input type="hidden" name="act" value="add" />
|
<input type="hidden" name="act" value="add" />
|
||||||
<input type="hidden" name="id" value="{$club->getId()}" />
|
<input type="hidden" name="id" value="{$club->getId()}" />
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" id="profile_link" value="{_"join_community"}" />
|
<input type="submit" id="profile_link" value="{_join_community}" />
|
||||||
</form>
|
</form>
|
||||||
{else}
|
{else}
|
||||||
<form action="/setSub/club" method="post">
|
<form action="/setSub/club" method="post">
|
||||||
<input type="hidden" name="act" value="rem" />
|
<input type="hidden" name="act" value="rem" />
|
||||||
<input type="hidden" name="id" value="{$club->getId()}" />
|
<input type="hidden" name="id" value="{$club->getId()}" />
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" id="profile_link" value="{_"leave_community"}" />
|
<input type="submit" id="profile_link" value="{_leave_community}" />
|
||||||
</form>
|
</form>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="content_title_expanded" onclick="hidePanel(this);">
|
<div class="content_title_expanded" onclick="hidePanel(this);">
|
||||||
{_"group_type"}
|
{_group_type}
|
||||||
</div>
|
</div>
|
||||||
<div style="padding:4px">
|
<div style="padding:4px">
|
||||||
{_"group_type_open"}
|
{_group_type_open}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div n:if="$club->getAdministratorsListDisplay() == 0">
|
<div n:if="$club->getAdministratorsListDisplay() == 0">
|
||||||
<div class="content_title_expanded" onclick="hidePanel(this);">
|
<div class="content_title_expanded" onclick="hidePanel(this);">
|
||||||
{_"creator"}
|
{_creator}
|
||||||
</div>
|
</div>
|
||||||
<div class="avatar-list-item" style="padding: 8px;">
|
<div class="avatar-list-item" style="padding: 8px;">
|
||||||
{var $author = $club->getOwner()}
|
{var $author = $club->getOwner()}
|
||||||
|
@ -154,13 +154,13 @@
|
||||||
{var $managersCount = $club->getManagersCount(true)}
|
{var $managersCount = $club->getManagersCount(true)}
|
||||||
|
|
||||||
<div class="content_title_expanded" onclick="hidePanel(this, {$managersCount});">
|
<div class="content_title_expanded" onclick="hidePanel(this, {$managersCount});">
|
||||||
{_"administrators"}
|
{_administrators}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="content_subtitle">
|
<div class="content_subtitle">
|
||||||
{tr("administrators", $managersCount)}
|
{tr("administrators", $managersCount)}
|
||||||
<div style="float: right;">
|
<div style="float: right;">
|
||||||
<a href="/club{$club->getId()}/followers?onlyAdmins=1">{_"all_title"}</a>
|
<a href="/club{$club->getId()}/followers?onlyAdmins=1">{_all_title}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="avatar-list">
|
<div class="avatar-list">
|
||||||
|
@ -193,13 +193,13 @@
|
||||||
</div>
|
</div>
|
||||||
<div n:if="$albumsCount > 0 || ($thisUser && $club->canBeModifiedBy($thisUser))">
|
<div n:if="$albumsCount > 0 || ($thisUser && $club->canBeModifiedBy($thisUser))">
|
||||||
<div class="content_title_expanded" onclick="hidePanel(this, {$albumsCount});">
|
<div class="content_title_expanded" onclick="hidePanel(this, {$albumsCount});">
|
||||||
{_"albums"}
|
{_albums}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="content_subtitle">
|
<div class="content_subtitle">
|
||||||
{tr("albums", $albumsCount)}
|
{tr("albums", $albumsCount)}
|
||||||
<div style="float:right;">
|
<div style="float:right;">
|
||||||
<a href="/albums{$club->getId() * -1}">{_"all_title"}</a>
|
<a href="/albums{$club->getId() * -1}">{_all_title}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="padding: 5px;">
|
<div style="padding: 5px;">
|
||||||
|
@ -227,7 +227,7 @@
|
||||||
<div class="content_subtitle">
|
<div class="content_subtitle">
|
||||||
{tr("topics", $topicsCount)}
|
{tr("topics", $topicsCount)}
|
||||||
<div style="float: right;">
|
<div style="float: right;">
|
||||||
<a href="/board{$club->getId()}">{_"all_title"}</a>
|
<a href="/board{$club->getId()}">{_all_title}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
{if 5 >= $diff->i}
|
{if 5 >= $diff->i}
|
||||||
<span><b>{_online}</b></span>
|
<span><b>{_online}</b></span>
|
||||||
{else}
|
{else}
|
||||||
<span>{$correspondent->isFemale() ? "заходила" : "заходил"} {$correspondent->getOnline()}</span>
|
<span>{$correspondent->isFemale() ? tr("was_online_f") : tr("was_online_m")} {$correspondent->getOnline()}</span>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/block}
|
{/block}
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="time" align="right">
|
<div class="time" align="right">
|
||||||
<span data-bind="text: timing.sent"></span>
|
<span data-bind="html: timing.sent"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -49,17 +49,17 @@
|
||||||
<textarea
|
<textarea
|
||||||
data-bind="value: messageContent, event: { keydown: onTextareaKeyPress }"
|
data-bind="value: messageContent, event: { keydown: onTextareaKeyPress }"
|
||||||
name="message"
|
name="message"
|
||||||
placeholder="Введите сообщение"></textarea>
|
placeholder="{_enter_message}"></textarea>
|
||||||
<button class="button" data-bind="click: sendMessage">Отправить</button>
|
<button class="button" data-bind="click: sendMessage">{_send}</button>
|
||||||
</div>
|
</div>
|
||||||
<img class="ava" src="{$correspondent->getAvatarUrl('miniscule')}" alt="{$correspondent->getCanonicalName()}" />
|
<img class="ava" src="{$correspondent->getAvatarUrl('miniscule')}" alt="{$correspondent->getCanonicalName()}" />
|
||||||
{else}
|
{else}
|
||||||
<div class="blocked" data-localized-text="Вы не можете писать сообщения {$correspondent->getCanonicalName()} из-за его настроек приватности."></div>
|
<div class="blocked" data-localized-text="{_messages_blocked}"></div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://knockoutjs.com/downloads/knockout-3.5.1.js"></script>
|
{script "js/node_modules/knockout/build/output/knockout-latest.js"}
|
||||||
<script>
|
<script>
|
||||||
function MessengerViewModel(initialMessages = []) {
|
function MessengerViewModel(initialMessages = []) {
|
||||||
window.messages = ko.observableArray(initialMessages);
|
window.messages = ko.observableArray(initialMessages);
|
||||||
|
@ -181,7 +181,7 @@
|
||||||
"sender": {
|
"sender": {
|
||||||
"link": {$thisUser->getURL()},
|
"link": {$thisUser->getURL()},
|
||||||
"avatar": {$thisUser->getAvatarUrl()},
|
"avatar": {$thisUser->getAvatarUrl()},
|
||||||
"name": {$thisUser->getFullName()}
|
"name": {$thisUser->getFirstName()}
|
||||||
},
|
},
|
||||||
"timing": {
|
"timing": {
|
||||||
"sent": window.API.Service.getTime(),
|
"sent": window.API.Service.getTime(),
|
||||||
|
@ -199,7 +199,7 @@
|
||||||
"sender": {
|
"sender": {
|
||||||
"link": {$correspondent->getURL()},
|
"link": {$correspondent->getURL()},
|
||||||
"avatar": {$correspondent->getAvatarUrl()},
|
"avatar": {$correspondent->getAvatarUrl()},
|
||||||
"name": {$correspondent->getFullName()}
|
"name": {$correspondent->getFirstName()}
|
||||||
},
|
},
|
||||||
"timing": {
|
"timing": {
|
||||||
"sent": window.API.Service.getTime(),
|
"sent": window.API.Service.getTime(),
|
||||||
|
@ -213,6 +213,7 @@
|
||||||
|
|
||||||
newMessage(content) {
|
newMessage(content) {
|
||||||
let msg = this._newSelfMessage(content);
|
let msg = this._newSelfMessage(content);
|
||||||
|
msg.timing.sent = "<img src=\"/assets/packages/static/openvk/img/loading_mini.gif\">";
|
||||||
this.addMessage(msg);
|
this.addMessage(msg);
|
||||||
|
|
||||||
return msg._tuid;
|
return msg._tuid;
|
||||||
|
@ -250,9 +251,9 @@
|
||||||
avatar: "/assets/packages/static/openvk/img/oof.apng",
|
avatar: "/assets/packages/static/openvk/img/oof.apng",
|
||||||
id: -1,
|
id: -1,
|
||||||
link: "/support/manpages/messages/not-delivered.html",
|
link: "/support/manpages/messages/not-delivered.html",
|
||||||
name: "Сообщение не доставлено"
|
name: tr("messages_error_1")
|
||||||
},
|
},
|
||||||
text: "При отправке этого сообщения произошла ошибка общего характера...",
|
text: tr("messages_error_1_description"),
|
||||||
timing: {
|
timing: {
|
||||||
edited: null,
|
edited: null,
|
||||||
sent: "???"
|
sent: "???"
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
{block content}
|
{block content}
|
||||||
<div class="tabs">
|
<div class="tabs">
|
||||||
<div id="activetabs" class="tab">
|
<div id="activetabs" class="tab">
|
||||||
<a id="act_tab_a" href="javascript:false">Все сообщения</a>
|
<a id="act_tab_a" href="javascript:false">{_all_messages}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container_gray">
|
<div class="container_gray">
|
||||||
<form action="/im/search" method="POST" style="margin: 0;">
|
<form action="/im/search" method="POST" style="margin: 0;">
|
||||||
<input type="text" name="pattern" placeholder="Поиск сообщений" required />
|
<input type="text" name="pattern" placeholder="{_search_messages}" required />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="crp-entry--info">
|
<div class="crp-entry--info">
|
||||||
<a href="{$recipient->getURL()}">{$recipient->getCanonicalName()}</a><br/>
|
<a href="{$recipient->getURL()}">{$recipient->getCanonicalName()}</a><br/>
|
||||||
<span>{$lastMsg->getSendTime()->format("%e %B %G" . tr("time_at_sp") . "%X")}</span>
|
<span>{$lastMsg->getSendTimeHumanized()}</span>
|
||||||
</div>
|
</div>
|
||||||
<div n:class="crp-entry--message, $lastMsg->getUnreadState() ? unread">
|
<div n:class="crp-entry--message, $lastMsg->getUnreadState() ? unread">
|
||||||
{var $_author = $lastMsg->getSender()}
|
{var $_author = $lastMsg->getSender()}
|
||||||
|
@ -45,9 +45,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="margin-top: 3px;">
|
||||||
|
{include "../components/paginator.xml", conf => $paginatorConf}
|
||||||
|
</div>
|
||||||
{else}
|
{else}
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<center>Вам никто не писал. Пока что.</center>
|
<center>{_no_messages}</center>
|
||||||
{/if}
|
{/if}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<button class="button">{_save}</button>
|
<button class="button">{_save}</button>
|
||||||
|
<a href="javascript:openPreviewWindow()" style="float: right;">{_note_preview}</a>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{script "js/node_modules/monaco-editor/min/vs/loader.js"}
|
{script "js/node_modules/monaco-editor/min/vs/loader.js"}
|
||||||
|
@ -38,5 +39,20 @@
|
||||||
document.querySelector("#noteFactory").addEventListener("submit", function() {
|
document.querySelector("#noteFactory").addEventListener("submit", function() {
|
||||||
document.querySelector("textarea").value = window._editor.getValue();
|
document.querySelector("textarea").value = window._editor.getValue();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window._preview = undefined;
|
||||||
|
function openPreviewWindow() {
|
||||||
|
if(typeof window._preview != "undefined") {
|
||||||
|
window._preview.close();
|
||||||
|
window._preview = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
window._preview = window.open("data:text/html,", "_blank", { popup: true });
|
||||||
|
window._preview.document.write(`<style>form { display: none; }</style><form action="${ location.origin }/notes/prerender" method="POST" enctype="multipart/form-data"><input name="title" /><input name="html" /><input name="hash" /></form>`);
|
||||||
|
window._preview.document.querySelector("input[name=title]").value = document.querySelector("input[name=name]").value;
|
||||||
|
window._preview.document.querySelector("input[name=html]").value = window._editor.getValue();
|
||||||
|
window._preview.document.querySelector("input[name=hash]").value = document.querySelector("meta[name=csrf]").attributes.value.value;
|
||||||
|
window._preview.document.querySelector("form").submit();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
{/block}
|
{/block}
|
||||||
|
|
37
Web/Presenters/templates/Notes/PreView.xml
Normal file
37
Web/Presenters/templates/Notes/PreView.xml
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{extends "../@layout.xml"}
|
||||||
|
|
||||||
|
{block title}
|
||||||
|
{$title}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block header}
|
||||||
|
{$title}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block content}
|
||||||
|
<style>
|
||||||
|
.sidebar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page_header {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page_content {
|
||||||
|
display: unset;
|
||||||
|
width: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page_body {
|
||||||
|
width: unset;
|
||||||
|
float: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page_footer {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
{$html|noescape}
|
||||||
|
{/block}
|
|
@ -1,4 +1,4 @@
|
||||||
{extends "../@listView.xml"}
|
{extends "../@layout.xml"}
|
||||||
{var $sorting = false}
|
{var $sorting = false}
|
||||||
|
|
||||||
{block title}
|
{block title}
|
||||||
|
@ -10,29 +10,47 @@
|
||||||
{_feedback}
|
{_feedback}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block tabs}
|
{block content}
|
||||||
|
<div n:ifcontent class="tabs">
|
||||||
<div n:attr="id => ($mode === 'new' ? 'activetabs' : 'ki')" class="tab">
|
<div n:attr="id => ($mode === 'new' ? 'activetabs' : 'ki')" class="tab">
|
||||||
<a n:attr="id => ($mode === 'new' ? 'act_tab_a' : 'ki')" href="?">{_unread}</a>
|
<a n:attr="id => ($mode === 'new' ? 'act_tab_a' : 'ki')" href="?act=new">{_unread}</a>
|
||||||
</div>
|
</div>
|
||||||
<div n:attr="id => ($mode === 'archived' ? 'activetabs' : 'ki')" class="tab">
|
<div n:attr="id => ($mode === 'archived' ? 'activetabs' : 'ki')" class="tab">
|
||||||
<a n:attr="id => ($mode === 'archived' ? 'act_tab_a' : 'ki')" href="?act=archived">{_archive}</a>
|
<a n:attr="id => ($mode === 'archived' ? 'act_tab_a' : 'ki')" href="?act=archived">{_archive}</a>
|
||||||
</div>
|
</div>
|
||||||
{/block}
|
</div>
|
||||||
|
{var $data = is_array($iterator) ? $iterator : iterator_to_array($iterator)}
|
||||||
{* BEGIN ELEMENTS DESCRIPTION *}
|
{if sizeof($data) > 0}
|
||||||
|
<table class="post post-divider" border="0" style="font-size: 11px;" n:foreach="$data as $dat">
|
||||||
{block link|strip|stripHtml}
|
<tbody>
|
||||||
javascript:void(0)
|
<tr>
|
||||||
{/block}
|
<td width="54" valign="top">
|
||||||
|
<a href="/sysop">
|
||||||
{block preview}
|
<img src="{$dat->getModel(1)->getAvatarUrl('miniscule')}" width=50 />
|
||||||
<img src="{$x->getModel(1)->getAvatarUrl('miniscule')}" width=64 />
|
</a>
|
||||||
{/block}
|
</td>
|
||||||
|
<td width="100%" valign="top">
|
||||||
{block name}
|
<div class="post-content">
|
||||||
<span style="color: #000; font-weight: 100;"></span>
|
<div class="text" style="line-height: 12pt;">
|
||||||
{/block}
|
{include $dat->getTemplatePath(), notification => $dat}
|
||||||
|
</div>
|
||||||
{block description}
|
</div>
|
||||||
{include $x->getTemplatePath(), notification => $x}
|
</td>
|
||||||
{/block}
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{include "../components/paginator.xml", conf => (object) [
|
||||||
|
"page" => $page,
|
||||||
|
"count" => $count,
|
||||||
|
"amount" => sizeof($data),
|
||||||
|
"perPage" => $perPage ?? OPENVK_DEFAULT_PER_PAGE,
|
||||||
|
"atBottom" => true,
|
||||||
|
]}
|
||||||
|
{else}
|
||||||
|
{ifset customErrorMessage}
|
||||||
|
{include customErrorMessage}
|
||||||
|
{else}
|
||||||
|
{include "../components/nothing.xml"}
|
||||||
|
{/ifset}
|
||||||
|
{/if}
|
||||||
|
{/block}
|
|
@ -9,9 +9,9 @@
|
||||||
{$album->getOwner()->getCanonicalName()}
|
{$album->getOwner()->getCanonicalName()}
|
||||||
</a>
|
</a>
|
||||||
{if $isClub}
|
{if $isClub}
|
||||||
» <a href="/albums{$album->getOwner()->getId() * -1}">{_"albums"}</a>
|
» <a href="/albums{$album->getOwner()->getId() * -1}">{_albums}</a>
|
||||||
{else}
|
{else}
|
||||||
» <a href="/albums{$album->getOwner()->getId()}">{_"albums"}</a>
|
» <a href="/albums{$album->getOwner()->getId()}">{_albums}</a>
|
||||||
{/if}
|
{/if}
|
||||||
» {$album->getName()}
|
» {$album->getName()}
|
||||||
{/block}
|
{/block}
|
||||||
|
@ -23,9 +23,9 @@
|
||||||
|
|
||||||
{if !is_null($thisUser) && $album->canBeModifiedBy($thisUser) && !$album->isCreatedBySystem()}
|
{if !is_null($thisUser) && $album->canBeModifiedBy($thisUser) && !$album->isCreatedBySystem()}
|
||||||
|
|
|
|
||||||
<a href="/photos/upload?album={$album->getPrettyId()}">{_"upload_photo"}</a>
|
<a href="/photos/upload?album={$album->getPrettyId()}">{_upload_photo}</a>
|
||||||
|
|
|
|
||||||
<a href="/album{$album->getPrettyId()}/edit">{_"edit_album"}</a>
|
<a href="/album{$album->getPrettyId()}/edit">{_edit_album}</a>
|
||||||
{/if}
|
{/if}
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
{if $album->getPhotosCount() > 0}
|
{if $album->getPhotosCount() > 0}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{var $iterator = iterator_to_array($albums)}
|
{var $iterator = iterator_to_array($albums)}
|
||||||
{var $page = $paginatorConf->page}
|
{var $page = $paginatorConf->page}
|
||||||
|
|
||||||
{block title}{_"albums"} {$owner->getCanonicalName()}{/block}
|
{block title}{_albums} {$owner->getCanonicalName()}{/block}
|
||||||
|
|
||||||
{block header}
|
{block header}
|
||||||
{if isset($thisUser) && $thisUser->getId() == $owner->getId()}
|
{if isset($thisUser) && $thisUser->getId() == $owner->getId()}
|
||||||
|
@ -59,6 +59,6 @@
|
||||||
{block description}
|
{block description}
|
||||||
<span>{$x->getDescription() ?? $x->getName()}</span><br />
|
<span>{$x->getDescription() ?? $x->getName()}</span><br />
|
||||||
<span style="color: grey;">{$x->getPhotosCount()} фотографий</span><br />
|
<span style="color: grey;">{$x->getPhotosCount()} фотографий</span><br />
|
||||||
<span style="color: grey;">Обновлен {$x->getEditTime() ?? $x->getCreationTime()}</span><br />
|
<span style="color: grey;">{tr("updated_at", $x->getEditTime() ?? $x->getCreationTime())}</span><br />
|
||||||
<span style="color: grey;">Создан {$x->getCreationTime()}</span><br />
|
<span style="color: grey;">{_created} {$x->getCreationTime()}</span><br />
|
||||||
{/block}
|
{/block}
|
||||||
|
|
|
@ -1,39 +1,39 @@
|
||||||
{extends "../@layout.xml"}
|
{extends "../@layout.xml"}
|
||||||
{block title}{_"creating_album"}{/block}
|
{block title}{_creating_album}{/block}
|
||||||
|
|
||||||
{block header}
|
{block header}
|
||||||
{ifset $club}
|
{ifset $club}
|
||||||
<a href="{$club->getURL()}">{$club->getName()}</a>
|
<a href="{$club->getURL()}">{$club->getName()}</a>
|
||||||
»
|
»
|
||||||
<a href="/albums{$club->getId() * -1}">{_"albums"}</a>
|
<a href="/albums{$club->getId() * -1}">{_albums}</a>
|
||||||
{else}
|
{else}
|
||||||
<a href="{$thisUser->getURL()}">{$thisUser->getCanonicalName()}</a>
|
<a href="{$thisUser->getURL()}">{$thisUser->getCanonicalName()}</a>
|
||||||
»
|
»
|
||||||
<a href="/albums{$thisUser->getId()}">{_"albums"}</a>
|
<a href="/albums{$thisUser->getId()}">{_albums}</a>
|
||||||
{/ifset}
|
{/ifset}
|
||||||
»
|
»
|
||||||
{_"creating_album"}
|
{_creating_album}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block content}
|
{block content}
|
||||||
<div class="container_gray">
|
<div class="container_gray">
|
||||||
<h4>{_"creating_album"}</h4>
|
<h4>{_creating_album}</h4>
|
||||||
<form method="post" enctype="multipart/form-data">
|
<form method="post" enctype="multipart/form-data">
|
||||||
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
|
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top"><span class="nobold">{_"name"}:</span></td>
|
<td width="120" valign="top"><span class="nobold">{_name}:</span></td>
|
||||||
<td><input type="text" name="name" /></td>
|
<td><input type="text" name="name" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top"><span class="nobold">{_"description"}:</span></td>
|
<td width="120" valign="top"><span class="nobold">{_description}:</span></td>
|
||||||
<td><textarea name="desc"></textarea></td>
|
<td><textarea name="desc"></textarea></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top"></td>
|
<td width="120" valign="top"></td>
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" class="button" name="submit" value="{_'create'}" />
|
<input type="submit" class="button" name="submit" value="{_create}" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
<a href="{$album->getOwner()->getURL()}">{$album->getOwner()->getCanonicalName()}</a>
|
<a href="{$album->getOwner()->getURL()}">{$album->getOwner()->getCanonicalName()}</a>
|
||||||
»
|
»
|
||||||
{if $album->getOwner() instanceof openvk\Web\Models\Entities\Club}
|
{if $album->getOwner() instanceof openvk\Web\Models\Entities\Club}
|
||||||
<a href="/albums{$album->getOwner()->getId() * -1}">{_"albums"}</a>
|
<a href="/albums{$album->getOwner()->getId() * -1}">{_albums}</a>
|
||||||
{else}
|
{else}
|
||||||
<a href="/albums{$album->getOwner()->getId()}">{_"albums"}</a>
|
<a href="/albums{$album->getOwner()->getId()}">{_albums}</a>
|
||||||
{/if}
|
{/if}
|
||||||
»
|
»
|
||||||
{$album->getName()}
|
{$album->getName()}
|
||||||
|
@ -18,11 +18,11 @@
|
||||||
<table cellspacing="6">
|
<table cellspacing="6">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top"><span class="nobold">{_"name"}:</span></td>
|
<td width="120" valign="top"><span class="nobold">{_name}:</span></td>
|
||||||
<td><input type="text" name="name" value="{$album->getName()}" /></td>
|
<td><input type="text" name="name" value="{$album->getName()}" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top"><span class="nobold">{_"description"}:</span></td>
|
<td width="120" valign="top"><span class="nobold">{_description}:</span></td>
|
||||||
<td>
|
<td>
|
||||||
<textarea style="margin: 0px; height: 50px; width: 159px; resize: none;" name="desc">{$album->getDescription()}</textarea>
|
<textarea style="margin: 0px; height: 50px; width: 159px; resize: none;" name="desc">{$album->getDescription()}</textarea>
|
||||||
</td>
|
</td>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
<td width="120" valign="top"></td>
|
<td width="120" valign="top"></td>
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" class="button" name="submit" value="{_'save'}" />
|
<input type="submit" class="button" name="submit" value="{_save}" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -39,6 +39,6 @@
|
||||||
</form>
|
</form>
|
||||||
<hr/>
|
<hr/>
|
||||||
<center>
|
<center>
|
||||||
{_"you_can_also"} <a href="/album{$album->getOwner() instanceof openvk\Web\Models\Entities\Club ? '-' : ''}{$album->getOwner()->getId()}_{$album->getId()}/delete?hash={rawurlencode($csrfToken)}">{_"delete_album"}</a>.
|
{_you_can_also} <a href="/album{$album->getOwner() instanceof openvk\Web\Models\Entities\Club ? '-' : ''}{$album->getOwner()->getId()}_{$album->getId()}/delete?hash={rawurlencode($csrfToken)}">{_delete_album}</a>.
|
||||||
</center>
|
</center>
|
||||||
{/block}
|
{/block}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
{block header}
|
{block header}
|
||||||
<a href="{$thisUser->getURL()}">{$thisUser->getCanonicalName()}</a>
|
<a href="{$thisUser->getURL()}">{$thisUser->getCanonicalName()}</a>
|
||||||
»
|
»
|
||||||
{_"photo"}
|
{_photo}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block content}
|
{block content}
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<table cellspacing="6">
|
<table cellspacing="6">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top"><span class="nobold">{_"description"}:</span></td>
|
<td width="120" valign="top"><span class="nobold">{_description}:</span></td>
|
||||||
<td>
|
<td>
|
||||||
<textarea style="margin: 0px; height: 50px; width: 159px; resize: none;" name="desc">{$photo->getDescription()}</textarea>
|
<textarea style="margin: 0px; height: 50px; width: 159px; resize: none;" name="desc">{$photo->getDescription()}</textarea>
|
||||||
</td>
|
</td>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<td width="120" valign="top"></td>
|
<td width="120" valign="top"></td>
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" class="button" name="submit" value="{_'save'}" />
|
<input type="submit" class="button" name="submit" value="{_save}" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{extends "../@layout.xml"}
|
{extends "../@layout.xml"}
|
||||||
|
|
||||||
{block title}{_"photo"}{/block}
|
{block title}{_photo}{/block}
|
||||||
|
|
||||||
{block header}
|
{block header}
|
||||||
{ifset $album}
|
{ifset $album}
|
||||||
|
@ -8,15 +8,15 @@
|
||||||
{$album->getOwner()->getCanonicalName()}
|
{$album->getOwner()->getCanonicalName()}
|
||||||
</a>
|
</a>
|
||||||
{if ($album->getOwner() instanceof openvk\Web\Models\Entities\Club)}
|
{if ($album->getOwner() instanceof openvk\Web\Models\Entities\Club)}
|
||||||
» <a href="/albums{$album->getOwner()->getId() * -1}">{_"albums"}</a>
|
» <a href="/albums{$album->getOwner()->getId() * -1}">{_albums}</a>
|
||||||
{else}
|
{else}
|
||||||
» <a href="/albums{$album->getOwner()->getId()}">{_"albums"}</a>
|
» <a href="/albums{$album->getOwner()->getId()}">{_albums}</a>
|
||||||
{/if}
|
{/if}
|
||||||
» <a href="/album{$album->getPrettyId()}">{$album->getName()}</a>
|
» <a href="/album{$album->getPrettyId()}">{$album->getName()}</a>
|
||||||
{else}
|
{else}
|
||||||
<a href="{$photo->getOwner()->getURL()}">{$photo->getOwner()->getCanonicalName()}</a>
|
<a href="{$photo->getOwner()->getURL()}">{$photo->getOwner()->getCanonicalName()}</a>
|
||||||
{/ifset}
|
{/ifset}
|
||||||
» {_"photo"}
|
» {_photo}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block content}
|
{block content}
|
||||||
|
@ -32,21 +32,21 @@
|
||||||
</div>
|
</div>
|
||||||
<div style="float: left; min-height: 100px; width: 30%;">
|
<div style="float: left; min-height: 100px; width: 30%;">
|
||||||
<div>
|
<div>
|
||||||
<h4>{_"information"}</h4>
|
<h4>{_information}</h4>
|
||||||
<span style="color: grey;">{_"info_description"}:</span>
|
<span style="color: grey;">{_info_description}:</span>
|
||||||
{$photo->getDescription() ?? "(отсутствует)"}<br/>
|
{$photo->getDescription() ?? "(" . tr("none") . ")"}<br/>
|
||||||
<span style="color: grey;">{_"info_uploaded_by"}:</span>
|
<span style="color: grey;">{_info_uploaded_by}:</span>
|
||||||
<a href="{$photo->getOwner()->getURL()}">{$photo->getOwner()->getFullName()}</a><br/>
|
<a href="{$photo->getOwner()->getURL()}">{$photo->getOwner()->getFullName()}</a><br/>
|
||||||
<span style="color: grey;">{_"info_upload_date"}:</span>
|
<span style="color: grey;">{_info_upload_date}:</span>
|
||||||
{$photo->getPublicationTime()}
|
{$photo->getPublicationTime()}
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
<h4>{_actions}</h4>
|
<h4>{_actions}</h4>
|
||||||
<div n:if="isset($thisUser) && $thisUser->getId() === $photo->getOwner()->getId()">
|
<div n:if="isset($thisUser) && $thisUser->getId() === $photo->getOwner()->getId()">
|
||||||
<a href="/photo{$photo->getPrettyId()}/edit" class="profile_link" style="display:block;width:96%;">{_"edit"}</a>
|
<a href="/photo{$photo->getPrettyId()}/edit" class="profile_link" style="display:block;width:96%;">{_edit}</a>
|
||||||
<a id="_photoDelete" href="/photo{$photo->getPrettyId()}/delete" class="profile_link" style="display:block;width:96%;">{_"delete"}</a>
|
<a id="_photoDelete" href="/photo{$photo->getPrettyId()}/delete" class="profile_link" style="display:block;width:96%;">{_delete}</a>
|
||||||
</div>
|
</div>
|
||||||
<a href="{$photo->getURL()}" class="profile_link" target="_blank" style="display:block;width:96%;">{_"open_original"}</a>
|
<a href="{$photo->getURL()}" class="profile_link" target="_blank" style="display:block;width:96%;">{_open_original}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/block}
|
{/block}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
{extends "../@layout.xml"}
|
{extends "../@layout.xml"}
|
||||||
{block title}{_"upload_photo"}{/block}
|
{block title}{_upload_photo}{/block}
|
||||||
|
|
||||||
{block header}
|
{block header}
|
||||||
<a href="{$thisUser->getURL()}">{$thisUser->getCanonicalName()}</a>
|
<a href="{$thisUser->getURL()}">{$thisUser->getCanonicalName()}</a>
|
||||||
»
|
»
|
||||||
<a href="/albums{$thisUser->getId()}">{_"albums"}</a>
|
<a href="/albums{$thisUser->getId()}">{_albums}</a>
|
||||||
»
|
»
|
||||||
<a href="/album{$album->getPrettyId()}">{$album->getName()}</a>
|
<a href="/album{$album->getPrettyId()}">{$album->getName()}</a>
|
||||||
»
|
»
|
||||||
{_"upload_photo"}
|
{_upload_photo}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block content}
|
{block content}
|
||||||
|
@ -16,11 +16,11 @@
|
||||||
<table cellspacing="6">
|
<table cellspacing="6">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top"><span class="nobold">{_"description"}:</span></td>
|
<td width="120" valign="top"><span class="nobold">{_description}:</span></td>
|
||||||
<td><textarea style="margin: 0px; height: 50px; width: 159px; resize: none;" name="desc"></textarea></td>
|
<td><textarea style="margin: 0px; height: 50px; width: 159px; resize: none;" name="desc"></textarea></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top"><span class="nobold">{_"photo"}:</span></td>
|
<td width="120" valign="top"><span class="nobold">{_photo}:</span></td>
|
||||||
<td><input type="file" name="blob" accept="image/*" /></td>
|
<td><input type="file" name="blob" accept="image/*" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -33,16 +33,17 @@
|
||||||
{_groups}
|
{_groups}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<form class="header_search_inputbt">
|
||||||
|
<input name="type" type="hidden" value="{$type ?? 'users'}" />
|
||||||
|
<input name="query" class="header_search_input" placeholder="{_search_placeholder}" value="{$_GET['query'] ?? ''}" />
|
||||||
|
<button class="button_search">{_search_button}</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
<form class="header_search_inputbt">
|
<p style="margin-left: 15px; margin-top: 0;">
|
||||||
<input name="type" type="hidden" value="{$type ?? 'users'}" />
|
<b>{tr("results", $count)}</b>
|
||||||
<input name="query" class="header_search_input" placeholder="{_search_placeholder}" value="{$_GET['query'] ?? ''}" />
|
</p>
|
||||||
<button class="button_search">{_search_button}</button>
|
<div>
|
||||||
</form>
|
|
||||||
|
|
||||||
<p style="margin-left: 15px; margin-top: 0;">
|
|
||||||
<b>{tr("results", $count)}</b>
|
|
||||||
</p>
|
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block link|strip|stripHtml}
|
{block link|strip|stripHtml}
|
||||||
|
@ -50,11 +51,15 @@
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block preview}
|
{block preview}
|
||||||
<img src="{$x->getAvatarUrl('miniscule')}" width="75" alt="{_"photo"}" />
|
<img src="{$x->getAvatarUrl('miniscule')}" width="75" alt="{_photo}" />
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block name}
|
{block name}
|
||||||
<text style="overflow: hidden;"> {$x->getCanonicalName()}</text>
|
<text style="overflow: hidden;"> {$x->getCanonicalName()}</text>
|
||||||
|
<img n:if="$x->isVerified()"
|
||||||
|
class="name-checkmark"
|
||||||
|
src="/assets/packages/static/openvk/img/checkmark.png"
|
||||||
|
/>
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block description}
|
{block description}
|
||||||
|
@ -62,21 +67,21 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
{if $type === "users"}
|
{if $type === "users"}
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class="nobold">{_"gender"}: </span></td>
|
<td><span class="nobold">{_gender}: </span></td>
|
||||||
<td>{$x->isFemale() ? tr("female") : tr("male")}</td>
|
<td>{$x->isFemale() ? tr("female") : tr("male")}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class="nobold">{_"relationship"}:</span></td>
|
<td><span class="nobold">{_relationship}:</span></td>
|
||||||
<td>{var $marialStatus = $x->getMaritalStatus()}{_"relationship_$marialStatus"}</td>
|
<td>{$x->getLocalizedMaritalStatus()}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class="nobold">{_"registration_date"}: </span></td>
|
<td><span class="nobold">{_registration_date}: </span></td>
|
||||||
<td>{$x->getRegistrationTime()}</td>
|
<td>{$x->getRegistrationTime()}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{/if}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<span class="nobold">{_"description"}:</span>
|
<span class="nobold">{_description}:</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{$x->getDescription() ?? '(' . tr("none") . ')'}
|
{$x->getDescription() ?? '(' . tr("none") . ')'}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
{if $isNew}
|
{if $isNew}
|
||||||
{if !is_null($banReason)}
|
{if !is_null($banReason)}
|
||||||
<center>
|
<center>
|
||||||
<img src="/assets/packages/static/openvk/img/oof.apng" alt="{_'banned_alt'}" style="width: 20%;" />
|
<img src="/assets/packages/static/openvk/img/oof.apng" alt="{_banned_alt}" style="width: 20%;" />
|
||||||
</center>
|
</center>
|
||||||
<p>
|
<p>
|
||||||
{tr("banned_in_support_1", htmlentities($thisUser->getCanonicalName()))|noescape}<br/>
|
{tr("banned_in_support_1", htmlentities($thisUser->getCanonicalName()))|noescape}<br/>
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
{block tabs}
|
{block tabs}
|
||||||
<form style="margin-left: 12px;">
|
<form style="margin-left: 12px;">
|
||||||
<input name="query" class="header_search_input" placeholder="{_"header_search"}" value="{$_GET['query'] ?? ''}" style="width: 86%" />
|
<input name="query" class="header_search_input" placeholder="{_header_search}" value="{$_GET['query'] ?? ''}" style="width: 86%" />
|
||||||
<input type="submit" class="button" value="{_"search_button"}" style="width: 7.5%" />
|
<input type="submit" class="button" value="{_search_button}" style="width: 7.5%" />
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<p style="margin-left: 15px;">
|
<p style="margin-left: 15px;">
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{extends "../@layout.xml"}
|
{extends "../@layout.xml"}
|
||||||
{block title}{_"edit_page"}{/block}
|
{block title}{_edit_page}{/block}
|
||||||
|
|
||||||
{block header}
|
{block header}
|
||||||
{_"edit_page"}
|
{_edit_page}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block content}
|
{block content}
|
||||||
|
@ -18,45 +18,45 @@
|
||||||
|
|
||||||
<div class="tabs">
|
<div class="tabs">
|
||||||
<div n:attr="id => ($isMain ? 'activetabs' : 'ki')" class="tab">
|
<div n:attr="id => ($isMain ? 'activetabs' : 'ki')" class="tab">
|
||||||
<a n:attr="id => ($isMain ? 'act_tab_a' : 'ki')" href="/edit">{_"main"}</a>
|
<a n:attr="id => ($isMain ? 'act_tab_a' : 'ki')" href="/edit">{_main}</a>
|
||||||
</div>
|
</div>
|
||||||
<div n:attr="id => ($isContacts ? 'activetabs' : 'ki')" class="tab">
|
<div n:attr="id => ($isContacts ? 'activetabs' : 'ki')" class="tab">
|
||||||
<a n:attr="id => ($isContacts ? 'act_tab_a' : 'ki')" href="/edit?act=contacts">{_"contacts"}</a>
|
<a n:attr="id => ($isContacts ? 'act_tab_a' : 'ki')" href="/edit?act=contacts">{_contacts}</a>
|
||||||
</div>
|
</div>
|
||||||
<div n:attr="id => ($isInterests ? 'activetabs' : 'ki')" class="tab">
|
<div n:attr="id => ($isInterests ? 'activetabs' : 'ki')" class="tab">
|
||||||
<a n:attr="id => ($isInterests ? 'act_tab_a' : 'ki')" href="/edit?act=interests">{_"interests"}</a>
|
<a n:attr="id => ($isInterests ? 'act_tab_a' : 'ki')" href="/edit?act=interests">{_interests}</a>
|
||||||
</div>
|
</div>
|
||||||
<div n:attr="id => ($isAvatar ? 'activetabs' : 'ki')" class="tab">
|
<div n:attr="id => ($isAvatar ? 'activetabs' : 'ki')" class="tab">
|
||||||
<a n:attr="id => ($isAvatar ? 'act_tab_a' : 'ki')" href="/edit?act=avatar">{_"avatar"}</a>
|
<a n:attr="id => ($isAvatar ? 'act_tab_a' : 'ki')" href="/edit?act=avatar">{_avatar}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container_gray">
|
<div class="container_gray">
|
||||||
{if $isMain}
|
{if $isMain}
|
||||||
|
|
||||||
<h4>{_"main_information"}</h4>
|
<h4>{_main_information}</h4>
|
||||||
<form action="/edit?act=main" method="POST" enctype="multipart/form-data">
|
<form action="/edit?act=main" method="POST" enctype="multipart/form-data">
|
||||||
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
|
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"name"}: </span>
|
<span class="nobold">{_name}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="first_name" value="{$user->getFirstName()}" />
|
<input type="text" name="first_name" value="{$user->getFirstName(true)}" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"surname"}: </span>
|
<span class="nobold">{_surname}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="last_name" value="{$user->getLastName()}" />
|
<input type="text" name="last_name" value="{$user->getLastName(true)}" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"nickname"}: </span>
|
<span class="nobold">{_nickname}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="pseudo" value="{$user->getPseudo()}" />
|
<input type="text" name="pseudo" value="{$user->getPseudo()}" />
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
{if OPENVK_ROOT_CONF['openvk']['credentials']['zadarma']['enable']}
|
{if OPENVK_ROOT_CONF['openvk']['credentials']['zadarma']['enable']}
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"phone"}: </span>
|
<span class="nobold">{_phone}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="phone" name="phone" value="{$user->getPhone()}" />
|
<input type="phone" name="phone" value="{$user->getPhone()}" />
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"status"}: </span>
|
<span class="nobold">{_status}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="status" value="{$user->getStatus()}" />
|
<input type="text" name="status" value="{$user->getStatus()}" />
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"hometown"}: </span>
|
<span class="nobold">{_hometown}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="hometown" value="{$user->getHometown()}" />
|
<input type="text" name="hometown" value="{$user->getHometown()}" />
|
||||||
|
@ -90,60 +90,66 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"relationship"}: </span>
|
<span class="nobold">{_relationship}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select name="marialstatus">
|
<select name="marialstatus">
|
||||||
<option value="0" {if $user->getMaritalStatus() == 0}selected{/if}>{_"relationship_0"}</option>
|
<option n:foreach="range(0, 8) as $i" n:attr="selected: ($user->getMaritalStatus() == $i)" value="{$i}">
|
||||||
<option value="1" {if $user->getMaritalStatus() == 1}selected{/if}>{_"relationship_1"}</option>
|
{if $user->isFemale()}
|
||||||
<option value="2" {if $user->getMaritalStatus() == 2}selected{/if}>{_"relationship_2"}</option>
|
{var $str = "relationship_$i"}
|
||||||
<option value="3" {if $user->getMaritalStatus() == 3}selected{/if}>{_"relationship_3"}</option>
|
{if tr($str . "_fem") == ("@$str" . "_fem")}
|
||||||
<option value="4" {if $user->getMaritalStatus() == 4}selected{/if}>{_"relationship_4"}</option>
|
{_$str}
|
||||||
<option value="5" {if $user->getMaritalStatus() == 5}selected{/if}>{_"relationship_5"}</option>
|
{else}
|
||||||
<option value="6" {if $user->getMaritalStatus() == 6}selected{/if}>{_"relationship_6"}</option>
|
{tr($str . "_fem")}
|
||||||
<option value="7" {if $user->getMaritalStatus() == 7}selected{/if}>{_"relationship_7"}</option>
|
{/if}
|
||||||
<option value="8" {if $user->getMaritalStatus() == 8}selected{/if}>{_"relationship_8"}</option>
|
{else}
|
||||||
|
{_"relationship_$i"}
|
||||||
|
{/if}
|
||||||
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"politViews"}: </span>
|
<span class="nobold">{_politViews}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select name="politViews">
|
<select name="politViews">
|
||||||
<option value="0" {if $user->getPoliticalViews() == 0}selected{/if}>{_"politViews_0"}</option>
|
<option value="0" {if $user->getPoliticalViews() == 0}selected{/if}>{_politViews_0}</option>
|
||||||
<option value="1" {if $user->getPoliticalViews() == 1}selected{/if}>{_"politViews_1"}</option>
|
<option value="1" {if $user->getPoliticalViews() == 1}selected{/if}>{_politViews_1}</option>
|
||||||
<option value="2" {if $user->getPoliticalViews() == 2}selected{/if}>{_"politViews_2"}</option>
|
<option value="2" {if $user->getPoliticalViews() == 2}selected{/if}>{_politViews_2}</option>
|
||||||
<option value="3" {if $user->getPoliticalViews() == 3}selected{/if}>{_"politViews_3"}</option>
|
<option value="3" {if $user->getPoliticalViews() == 3}selected{/if}>{_politViews_3}</option>
|
||||||
<option value="4" {if $user->getPoliticalViews() == 4}selected{/if}>{_"politViews_4"}</option>
|
<option value="4" {if $user->getPoliticalViews() == 4}selected{/if}>{_politViews_4}</option>
|
||||||
<option value="5" {if $user->getPoliticalViews() == 5}selected{/if}>{_"politViews_5"}</option>
|
<option value="5" {if $user->getPoliticalViews() == 5}selected{/if}>{_politViews_5}</option>
|
||||||
<option value="6" {if $user->getPoliticalViews() == 6}selected{/if}>{_"politViews_6"}</option>
|
<option value="6" {if $user->getPoliticalViews() == 6}selected{/if}>{_politViews_6}</option>
|
||||||
<option value="7" {if $user->getPoliticalViews() == 7}selected{/if}>{_"politViews_7"}</option>
|
<option value="7" {if $user->getPoliticalViews() == 7}selected{/if}>{_politViews_7}</option>
|
||||||
<option value="8" {if $user->getPoliticalViews() == 8}selected{/if}>{_"politViews_8"}</option>
|
<option value="8" {if $user->getPoliticalViews() == 8}selected{/if}>{_politViews_8}</option>
|
||||||
<option value="9" {if $user->getPoliticalViews() == 9}selected{/if}>{_"politViews_9"}</option>
|
<option value="9" {if $user->getPoliticalViews() == 9}selected{/if}>{_politViews_9}</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"gender"}: </span>
|
<span class="nobold">{_gender}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select name="gender">
|
<select name="gender">
|
||||||
<option value="1" {if $user->isFemale() == true}selected{/if}>{_"female"}</option>
|
<option value="1" {if $user->isFemale() == true}selected{/if}>{_female}</option>
|
||||||
<option value="0" {if $user->isFemale() == false}selected{/if}>{_"male"}</option>
|
<option value="0" {if $user->isFemale() == false}selected{/if}>{_male}</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"birth_date"}: </span>
|
<span class="nobold">{_birth_date}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input max={date('Y-m-d')} name="birthday" value={$user->getBirthday()->format('%Y-%m-%d')} type="date"/>
|
<input max={date('Y-m-d')} name="birthday" value={is_null($user->getBirthday()) ? NULL : $user->getBirthday()->format('%Y-%m-%d')} type="date" style="margin-bottom: 7px;" />
|
||||||
|
<select name="birthday_privacy">
|
||||||
|
<option value="0" {if $user->getBirthdayPrivacy() == 0}selected{/if}>{_show_my_birthday}</option>
|
||||||
|
<option value="1" {if $user->getBirthdayPrivacy() == 1}selected{/if}>{_show_only_month_and_day}</option>
|
||||||
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -152,7 +158,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" value="{_'save'}" class="button" />
|
<input type="submit" value="{_save}" class="button" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -161,13 +167,13 @@
|
||||||
|
|
||||||
{elseif $isContacts}
|
{elseif $isContacts}
|
||||||
|
|
||||||
<h4>{_"contact_information"}</h4>
|
<h4>{_contact_information}</h4>
|
||||||
<form action="/edit?act=contacts" method="POST" enctype="multipart/form-data">
|
<form action="/edit?act=contacts" method="POST" enctype="multipart/form-data">
|
||||||
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
|
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"email"}: </span>
|
<span class="nobold">{_email}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="email" name="email_contact" value="{$user->getContactEmail()}" />
|
<input type="email" name="email_contact" value="{$user->getContactEmail()}" />
|
||||||
|
@ -175,7 +181,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"telegram"}: </span>
|
<span class="nobold">{_telegram}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="telegram" value="{$user->getTelegram()}" />
|
<input type="text" name="telegram" value="{$user->getTelegram()}" />
|
||||||
|
@ -183,7 +189,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"personal_website"}: </span>
|
<span class="nobold">{_personal_website}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="website" value="{$user->getWebsite()}" />
|
<input type="text" name="website" value="{$user->getWebsite()}" />
|
||||||
|
@ -191,7 +197,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"city"}: </span>
|
<span class="nobold">{_city}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="city" value="{$user->getCity()}" />
|
<input type="text" name="city" value="{$user->getCity()}" />
|
||||||
|
@ -199,7 +205,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"address"}: </span>
|
<span class="nobold">{_address}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="address" value="{$user->getPhysicalAddress()}" />
|
<input type="text" name="address" value="{$user->getPhysicalAddress()}" />
|
||||||
|
@ -211,7 +217,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" value="{_'save'}" class="button" />
|
<input type="submit" value="{_save}" class="button" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -220,13 +226,13 @@
|
||||||
|
|
||||||
{elseif $isInterests}
|
{elseif $isInterests}
|
||||||
|
|
||||||
<h4>{_"personal_information"}</h4>
|
<h4>{_personal_information}</h4>
|
||||||
<form action="/edit?act=interests" method="POST" enctype="multipart/form-data">
|
<form action="/edit?act=interests" method="POST" enctype="multipart/form-data">
|
||||||
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
|
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"interests"}: </span>
|
<span class="nobold">{_interests}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea type="text" name="interests">{$user->getInterests()}</textarea>
|
<textarea type="text" name="interests">{$user->getInterests()}</textarea>
|
||||||
|
@ -234,7 +240,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"favorite_music"}: </span>
|
<span class="nobold">{_favorite_music}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea type="text" name="fav_music">{$user->getFavoriteMusic()}</textarea>
|
<textarea type="text" name="fav_music">{$user->getFavoriteMusic()}</textarea>
|
||||||
|
@ -242,7 +248,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"favorite_films"}: </span>
|
<span class="nobold">{_favorite_films}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea type="text" name="fav_films">{$user->getFavoriteFilms()}</textarea>
|
<textarea type="text" name="fav_films">{$user->getFavoriteFilms()}</textarea>
|
||||||
|
@ -250,7 +256,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"favorite_shows"}: </span>
|
<span class="nobold">{_favorite_shows}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea type="text" name="fav_shows">{$user->getFavoriteShows()}</textarea>
|
<textarea type="text" name="fav_shows">{$user->getFavoriteShows()}</textarea>
|
||||||
|
@ -258,7 +264,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"favorite_books"}: </span>
|
<span class="nobold">{_favorite_books}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea type="text" name="fav_books">{$user->getFavoriteBooks()}</textarea>
|
<textarea type="text" name="fav_books">{$user->getFavoriteBooks()}</textarea>
|
||||||
|
@ -266,7 +272,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"favorite_quotes"}: </span>
|
<span class="nobold">{_favorite_quotes}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea type="text" name="fav_quote">{$user->getFavoriteQuote()}</textarea>
|
<textarea type="text" name="fav_quote">{$user->getFavoriteQuote()}</textarea>
|
||||||
|
@ -274,7 +280,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"information_about"}: </span>
|
<span class="nobold">{_information_about}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea type="text" name="about">{$user->getDescription()}</textarea>
|
<textarea type="text" name="about">{$user->getDescription()}</textarea>
|
||||||
|
@ -286,7 +292,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" value="{_'save'}" class="button" />
|
<input type="submit" value="{_save}" class="button" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -295,13 +301,13 @@
|
||||||
|
|
||||||
{elseif $isAvatar}
|
{elseif $isAvatar}
|
||||||
|
|
||||||
<h4>{_"profile_picture"}</h4>
|
<h4>{_profile_picture}</h4>
|
||||||
<form action="/al_avatars" method="POST" enctype="multipart/form-data">
|
<form action="/al_avatars" method="POST" enctype="multipart/form-data">
|
||||||
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
|
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top">
|
<td width="120" valign="top">
|
||||||
<span class="nobold">{_"picture"}: </span>
|
<span class="nobold">{_picture}: </span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="file" name="blob" accept="image/*" />
|
<input type="file" name="blob" accept="image/*" />
|
||||||
|
@ -313,7 +319,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" value="{_'save'}" class="button" />
|
<input type="submit" value="{_save}" class="button" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
{elseif $act == "outcoming"}
|
{elseif $act == "outcoming"}
|
||||||
{var $iterator = iterator_to_array($user->getSubscriptions($page))}
|
{var $iterator = iterator_to_array($user->getSubscriptions($page))}
|
||||||
{var $count = $user->getSubscriptionsCount()}
|
{var $count = $user->getSubscriptionsCount()}
|
||||||
|
{elseif $act == "online"}
|
||||||
|
{var $iterator = iterator_to_array($user->getFriendsOnline($page))}
|
||||||
|
{var $count = $user->getFriendsOnlineCount()}
|
||||||
{else}
|
{else}
|
||||||
{var $iterator = iterator_to_array($user->getFriends($page))}
|
{var $iterator = iterator_to_array($user->getFriends($page))}
|
||||||
{var $count = $user->getFriendsCount()}
|
{var $count = $user->getFriendsCount()}
|
||||||
|
@ -16,11 +19,13 @@
|
||||||
|
|
||||||
{block title}
|
{block title}
|
||||||
{if $act == "incoming"}
|
{if $act == "incoming"}
|
||||||
{_"incoming_req"}
|
{_incoming_req}
|
||||||
{elseif $act == "outcoming"}
|
{elseif $act == "outcoming"}
|
||||||
{_"outcoming_req"}
|
{_outcoming_req}
|
||||||
|
{elseif $act == "online"}
|
||||||
|
{_friends_online}
|
||||||
{else}
|
{else}
|
||||||
{_"friends"}
|
{_friends}
|
||||||
{/if}
|
{/if}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
|
@ -30,18 +35,23 @@
|
||||||
{else}
|
{else}
|
||||||
<a href="{$user->getURL()}">{$user->getCanonicalName()}</a> »
|
<a href="{$user->getURL()}">{$user->getCanonicalName()}</a> »
|
||||||
{if $act == "incoming"}
|
{if $act == "incoming"}
|
||||||
{_"incoming_req"}
|
{_incoming_req}
|
||||||
{elseif $act == "outcoming"}
|
{elseif $act == "outcoming"}
|
||||||
{_"outcoming_req"}
|
{_outcoming_req}
|
||||||
|
{elseif $act == "online"}
|
||||||
|
{_friends_online}
|
||||||
{else}
|
{else}
|
||||||
{_"friends"}
|
{_friends}
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block tabs}
|
{block tabs}
|
||||||
<div n:attr="id => ($act === 'friends' ? 'activetabs' : 'ki')" class="tab">
|
<div n:attr="id => ($act === 'friends' ? 'activetabs' : 'ki')" class="tab">
|
||||||
<a n:attr="id => ($act === 'friends' ? 'act_tab_a' : 'ki')" href="?">{_friends}</a>
|
<a n:attr="id => ($act === 'friends' ? 'act_tab_a' : 'ki')" href="?">{_all_friends}</a>
|
||||||
|
</div>
|
||||||
|
<div n:attr="id => ($act === 'online' ? 'activetabs' : 'ki')" class="tab">
|
||||||
|
<a n:attr="id => ($act === 'online' ? 'act_tab_a' : 'ki')" href="?act=online">{_online}</a>
|
||||||
</div>
|
</div>
|
||||||
<div n:attr="id => ($act === 'incoming' || $act === 'outcoming' ? 'activetabs' : 'ki')" class="tab">
|
<div n:attr="id => ($act === 'incoming' || $act === 'outcoming' ? 'activetabs' : 'ki')" class="tab">
|
||||||
<a n:attr="id => ($act === 'incoming' || $act === 'outcoming' ? 'act_tab_a' : 'ki')" href="?act=incoming">{_req}</a>
|
<a n:attr="id => ($act === 'incoming' || $act === 'outcoming' ? 'act_tab_a' : 'ki')" href="?act=incoming">{_req}</a>
|
||||||
|
@ -68,6 +78,8 @@
|
||||||
{tr("req", $count)}
|
{tr("req", $count)}
|
||||||
{elseif $act == "outcoming"}
|
{elseif $act == "outcoming"}
|
||||||
{tr("req", $count)}
|
{tr("req", $count)}
|
||||||
|
{elseif $act == "online"}
|
||||||
|
{tr("friends_list_online", $count)}
|
||||||
{else}
|
{else}
|
||||||
{tr("friends_list", $count)}
|
{tr("friends_list", $count)}
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -90,21 +102,25 @@
|
||||||
|
|
||||||
{block name}
|
{block name}
|
||||||
{$x->getCanonicalName()}
|
{$x->getCanonicalName()}
|
||||||
|
<img n:if="$x->isVerified()"
|
||||||
|
class="name-checkmark"
|
||||||
|
src="/assets/packages/static/openvk/img/checkmark.png"
|
||||||
|
/>
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block description}
|
{block description}
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top"><span class="nobold">{_"gender"}: </span></td>
|
<td width="120" valign="top"><span class="nobold">{_gender}: </span></td>
|
||||||
<td>{$x->isFemale() ? tr("female") : tr("male")}</td>
|
<td>{$x->isFemale() ? tr("female") : tr("male")}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top"><span class="nobold">{_"relationship"}:</span></td>
|
<td width="120" valign="top"><span class="nobold">{_relationship}:</span></td>
|
||||||
<td>{var $marialStatus = $x->getMaritalStatus()}{_"relationship_$marialStatus"}</td>
|
<td>{$x->getLocalizedMaritalStatus()}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="120" valign="top"><span class="nobold">{_"registration_date"}: </span></td>
|
<td width="120" valign="top"><span class="nobold">{_registration_date}: </span></td>
|
||||||
<td>{$x->getRegistrationTime()}</td>
|
<td>{$x->getRegistrationTime()}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -112,36 +128,36 @@
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block actions}
|
{block actions}
|
||||||
{if $x->getId() !== $thisUser->getId()}
|
{if ($x->getId() !== $thisUser->getId()) && ($thisUser->getId() === $user->getId())}
|
||||||
{var $subStatus = $x->getSubscriptionStatus($thisUser)}
|
{var $subStatus = $x->getSubscriptionStatus($thisUser)}
|
||||||
{if $subStatus === 0}
|
{if $subStatus === 0}
|
||||||
<form action="/setSub/user" method="post" class="profile_link_form">
|
<form action="/setSub/user" method="post" class="profile_link_form">
|
||||||
<input type="hidden" name="act" value="add" />
|
<input type="hidden" name="act" value="add" />
|
||||||
<input type="hidden" name="id" value="{$x->getId()}" />
|
<input type="hidden" name="id" value="{$x->getId()}" />
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" class="profile_link" value="{_"friends_add"}" />
|
<input type="submit" class="profile_link" value="{_friends_add}" />
|
||||||
</form>
|
</form>
|
||||||
{elseif $subStatus === 1}
|
{elseif $subStatus === 1}
|
||||||
<form action="/setSub/user" method="post" class="profile_link_form">
|
<form action="/setSub/user" method="post" class="profile_link_form">
|
||||||
<input type="hidden" name="act" value="add" />
|
<input type="hidden" name="act" value="add" />
|
||||||
<input type="hidden" name="id" value="{$x->getId()}" />
|
<input type="hidden" name="id" value="{$x->getId()}" />
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" class="profile_link" value="{_"friends_accept"}" />
|
<input type="submit" class="profile_link" value="{_friends_accept}" />
|
||||||
</form>
|
</form>
|
||||||
{elseif $subStatus === 2}
|
{elseif $subStatus === 2}
|
||||||
<form action="/setSub/user" method="post" class="profile_link_form">
|
<form action="/setSub/user" method="post" class="profile_link_form">
|
||||||
<input type="hidden" name="act" value="rem" />
|
<input type="hidden" name="act" value="rem" />
|
||||||
<input type="hidden" name="id" value="{$x->getId()}" />
|
<input type="hidden" name="id" value="{$x->getId()}" />
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" class="profile_link" value="{_"friends_reject"}" />
|
<input type="submit" class="profile_link" value="{_friends_reject}" />
|
||||||
</form>
|
</form>
|
||||||
{elseif $subStatus === 3}
|
{elseif $subStatus === 3}
|
||||||
<a href="/im?sel={$x->getId()}" class="profile_link">{_"send_message"}</a>
|
<a href="/im?sel={$x->getId()}" class="profile_link">{_send_message}</a>
|
||||||
<form action="/setSub/user" method="post" class="profile_link_form">
|
<form action="/setSub/user" method="post" class="profile_link_form">
|
||||||
<input type="hidden" name="act" value="rem" />
|
<input type="hidden" name="act" value="rem" />
|
||||||
<input type="hidden" name="id" value="{$x->getId()}" />
|
<input type="hidden" name="id" value="{$x->getId()}" />
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input type="submit" class="profile_link" value="{_"friends_delete"}" />
|
<input type="submit" class="profile_link" value="{_friends_delete}" />
|
||||||
</form>
|
</form>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block size}
|
{block size}
|
||||||
<div style="padding-bottom: 0px;" class="summaryBar">
|
<div style="padding-bottom: 0px; {if is_null($thisUser) || $user->getId() !== $thisUser->getId()}padding-top: 0px;{/if}" class="summaryBar">
|
||||||
<div class="summary">
|
<div class="summary">
|
||||||
{if !is_null($thisUser) && $user->getId() === $thisUser->getId()}
|
{if !is_null($thisUser) && $user->getId() === $thisUser->getId()}
|
||||||
{tr("groups_list", $thisUser->getClubCount())}
|
{tr("groups_list", $thisUser->getClubCount())}
|
||||||
|
@ -58,7 +58,13 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="label"><span class="nobold">{_name}: </span></td>
|
<td class="label"><span class="nobold">{_name}: </span></td>
|
||||||
<td class="data"><a href="{$x->getURL()}">{$x->getName()}</a></td>
|
<td class="data">
|
||||||
|
<a href="{$x->getURL()}">{$x->getName()}</a>
|
||||||
|
<img n:if="$x->isVerified()"
|
||||||
|
class="name-checkmark"
|
||||||
|
src="/assets/packages/static/openvk/img/checkmark.png"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="label"><span class="nobold">{_size}:</span></td>
|
<td class="label"><span class="nobold">{_size}:</span></td>
|
||||||
|
@ -73,35 +79,38 @@
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block actions}
|
{block actions}
|
||||||
{var $clubPinned = $thisUser->isClubPinned($x)}
|
|
||||||
{if $x->canBeModifiedBy($thisUser ?? NULL)}
|
{if $x->canBeModifiedBy($thisUser ?? NULL)}
|
||||||
<div class="navigation" style="width: 140px;">
|
{var $clubPinned = $thisUser->isClubPinned($x)}
|
||||||
<a class="link" href="{$x->getURL()}">
|
<a href="{$x->getURL()}" class="profile_link">{_check_community}</a>
|
||||||
{_check_community}
|
<a href="/groups_pin?club={$x->getId()}&hash={rawurlencode($csrfToken)}" class="profile_link" n:if="$clubPinned || $thisUser->getPinnedClubCount() <= 10" id="_pinGroup" data-group-name="{$x->getName()}" data-group-url="{$x->getUrl()}">
|
||||||
</a>
|
{if $clubPinned}
|
||||||
{if ($clubPinned || $thisUser->getPinnedClubCount() <= 10)}
|
{_remove_from_left_menu}
|
||||||
<a class="link" href="/groups_pin?club={$x->getId()}&hash={rawurlencode($csrfToken)}" id="_pinGroup" data-group-name="{$x->getName()}" data-group-url="{$x->getUrl()}">
|
{else}
|
||||||
{if $clubPinned}
|
{_add_to_left_menu}
|
||||||
{_remove_from_left_menu}
|
|
||||||
{else}
|
|
||||||
{_add_to_left_menu}
|
|
||||||
{/if}
|
|
||||||
</a>
|
|
||||||
{/if}
|
{/if}
|
||||||
<form action="/setSub/club" method="post">
|
</a>
|
||||||
<input type="hidden" name="act" value="rem" />
|
{if $x->getSubscriptionStatus($thisUser) == false}
|
||||||
<input type="hidden" name="id" value="{$x->getId()}" />
|
<form class="profile_link_form" action="/setSub/club" method="post">
|
||||||
|
<input type="hidden" name="act" value="add" />
|
||||||
|
<input type="hidden" name="id" value="{$x->getId()}" />
|
||||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
<input style="text-transform: lowercase; width: 100%;" class="link" type="submit" value="{_"leave_community"}" />
|
<input type="submit" class="profile_link" value="{_join_community}" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
{else}
|
||||||
|
<form class="profile_link_form" action="/setSub/club" method="post">
|
||||||
|
<input type="hidden" name="act" value="rem" />
|
||||||
|
<input type="hidden" name="id" value="{$x->getId()}" />
|
||||||
|
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||||
|
<input type="submit" class="profile_link" value="{_leave_community}" />
|
||||||
|
</form>
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block bottom}
|
{block bottom}
|
||||||
{if !is_null($thisUser) && $user->getId() === $thisUser->getId()}
|
{if !is_null($thisUser) && $user->getId() === $thisUser->getId()}
|
||||||
<div class="groups_options">
|
<div class="groups_options">
|
||||||
<div id="gp_container" style="width: 200px; margin-right: 40px;">
|
<div id="gp_container" style="width: 200px; margin-right: 39px;">
|
||||||
<h4>{_open_new_group}</h4>
|
<h4>{_open_new_group}</h4>
|
||||||
<span>{_open_group_desc}</span>
|
<span>{_open_group_desc}</span>
|
||||||
<form action="/groups_create">
|
<form action="/groups_create">
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue