mirror of
https://github.com/openvk/openvk
synced 2025-07-07 16:29:50 +03:00
Compare commits
No commits in common. "c38c12ffd1aa8c9b57523c90e518f93343d9fed2" and "ddefa148818b73b504bcb0025d4dffeeb495be99" have entirely different histories.
c38c12ffd1
...
ddefa14881
20 changed files with 18 additions and 479 deletions
|
@ -17,16 +17,14 @@ define("NANOTON", 1000000000);
|
||||||
|
|
||||||
class FetchToncoinTransactions extends Command
|
class FetchToncoinTransactions extends Command
|
||||||
{
|
{
|
||||||
|
private $images;
|
||||||
private $transactions;
|
private $transactions;
|
||||||
|
|
||||||
protected static $defaultName = "fetch-ton";
|
protected static $defaultName = "fetch-ton";
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$ctx = DatabaseConnection::i()->getContext();
|
$this->transactions = DatabaseConnection::i()->getContext()->table("cryptotransactions");
|
||||||
if (in_array("cryptotransactions", $ctx->getStructure()->getTables())) {
|
|
||||||
$this->transactions = $ctx->table("cryptotransactions");
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -79,6 +77,7 @@ class FetchToncoinTransactions extends Command
|
||||||
|
|
||||||
$header->writeln("Gonna up the balance of users");
|
$header->writeln("Gonna up the balance of users");
|
||||||
foreach ($response["result"] as $transfer) {
|
foreach ($response["result"] as $transfer) {
|
||||||
|
$outputArray;
|
||||||
preg_match('/' . OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["regex"] . '/', $transfer["in_msg"]["message"], $outputArray);
|
preg_match('/' . OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["regex"] . '/', $transfer["in_msg"]["message"], $outputArray);
|
||||||
$userId = ctype_digit($outputArray[1]) ? intval($outputArray[1]) : null;
|
$userId = ctype_digit($outputArray[1]) ? intval($outputArray[1]) : null;
|
||||||
if (is_null($userId)) {
|
if (is_null($userId)) {
|
||||||
|
|
|
@ -20,10 +20,7 @@ class RebuildImagesCommand extends Command
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$ctx = DatabaseConnection::i()->getContext();
|
$this->images = DatabaseConnection::i()->getContext()->table("photos");
|
||||||
if (in_array("photos", $ctx->getStructure()->getTables())) {
|
|
||||||
$this->images = $ctx->table("photos");
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,364 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace openvk\CLI;
|
|
||||||
|
|
||||||
use Nette\Database\Connection;
|
|
||||||
use Chandler\Database\DatabaseConnection;
|
|
||||||
use Symfony\Component\Console\Command\Command;
|
|
||||||
use Symfony\Component\Console\Helper\ProgressBar;
|
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
|
||||||
|
|
||||||
class UpgradeCommand extends Command
|
|
||||||
{
|
|
||||||
protected static $defaultName = "upgrade";
|
|
||||||
|
|
||||||
private Connection $db;
|
|
||||||
private Connection $eventDb;
|
|
||||||
|
|
||||||
private array $chandlerTables = [
|
|
||||||
"CHANDLERACLPERMISSIONALIASES",
|
|
||||||
"CHANDLERACLGROUPSPERMISSIONS",
|
|
||||||
"CHANDLERACLUSERSPERMISSIONS",
|
|
||||||
"CHANDLERACLRELATIONS",
|
|
||||||
"CHANDLERGROUPS",
|
|
||||||
"CHANDLERTOKENS",
|
|
||||||
"CHANDLERUSERS",
|
|
||||||
];
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->db = DatabaseConnection::i()->getConnection();
|
|
||||||
$this->eventDb = eventdb()->getConnection();
|
|
||||||
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function configure(): void
|
|
||||||
{
|
|
||||||
$this->setDescription("Upgrade OpenVK installation")
|
|
||||||
->setHelp("This command upgrades database schema after OpenVK was updated")
|
|
||||||
->addOption(
|
|
||||||
"quick",
|
|
||||||
"Q",
|
|
||||||
InputOption::VALUE_NEGATABLE,
|
|
||||||
"Don't display warning before migrating database",
|
|
||||||
false
|
|
||||||
)
|
|
||||||
->addOption(
|
|
||||||
"repair",
|
|
||||||
"R",
|
|
||||||
InputOption::VALUE_NEGATABLE,
|
|
||||||
"Attempt to repair database schema if tables are missing",
|
|
||||||
false
|
|
||||||
)
|
|
||||||
->addOption(
|
|
||||||
"oneshot",
|
|
||||||
"O",
|
|
||||||
InputOption::VALUE_NONE,
|
|
||||||
"Only execute one operation"
|
|
||||||
)
|
|
||||||
->addArgument(
|
|
||||||
"chandler",
|
|
||||||
InputArgument::OPTIONAL,
|
|
||||||
"Location of Chandler installation"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function checkDatabaseReadiness(bool &$chandlerOk, bool &$ovkOk, bool &$eventOk, bool &$migrationsOk): void
|
|
||||||
{
|
|
||||||
$tables = $this->db->query("SHOW TABLES")->fetchAll();
|
|
||||||
$tables = array_map(fn($x) => strtoupper($x->offsetGet(0)), $tables);
|
|
||||||
|
|
||||||
$missingTables = array_diff($this->chandlerTables, $tables);
|
|
||||||
if (sizeof($missingTables) == 0) {
|
|
||||||
$chandlerOk = true;
|
|
||||||
} elseif (sizeof($missingTables) == sizeof($this->chandlerTables)) {
|
|
||||||
$chandlerOk = null;
|
|
||||||
} else {
|
|
||||||
$chandlerOk = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_null($this->eventDb)) {
|
|
||||||
$eventOk = false;
|
|
||||||
} elseif (is_null($this->eventDb->query("SHOW TABLES LIKE \"notifications\"")->fetch())) {
|
|
||||||
$eventOk = null;
|
|
||||||
} else {
|
|
||||||
$eventOk = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$ovkOk = in_array("PROFILES", $tables);
|
|
||||||
$migrationsOk = in_array("OVK_UPGRADE_HISTORY", $tables);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function executeSqlScript(
|
|
||||||
int $errCode,
|
|
||||||
string $script,
|
|
||||||
SymfonyStyle $io,
|
|
||||||
bool $transaction = false,
|
|
||||||
bool $eventDb = false
|
|
||||||
): int {
|
|
||||||
$pdo = ($eventDb ? $this->eventDb : $this->db)->getPdo();
|
|
||||||
|
|
||||||
$res = false;
|
|
||||||
try {
|
|
||||||
if ($transaction) {
|
|
||||||
$res = $pdo->beginTransaction();
|
|
||||||
}
|
|
||||||
|
|
||||||
$res = $pdo->exec($script);
|
|
||||||
|
|
||||||
if ($transaction) {
|
|
||||||
$res = $pdo->commit();
|
|
||||||
}
|
|
||||||
} catch (\PDOException $e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($res === false) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
error:
|
|
||||||
$io->getErrorStyle()->error([
|
|
||||||
"Failed to execute SQL statement:",
|
|
||||||
implode("\t", $pdo->errorInfo()),
|
|
||||||
]);
|
|
||||||
|
|
||||||
return $errCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getNextLevel(bool $eventDb = false): int
|
|
||||||
{
|
|
||||||
$db = $eventDb ? $this->eventDb : $this->db;
|
|
||||||
$tbl = $eventDb ? "ovk_events_upgrade_history" : "ovk_upgrade_history";
|
|
||||||
$record = $db->query("SELECT level FROM $tbl ORDER BY level DESC LIMIT 1");
|
|
||||||
if (!$record->getRowCount()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $record->fetchField() + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getMigrationFiles(bool $eventDb = false): array
|
|
||||||
{
|
|
||||||
$files = [];
|
|
||||||
$root = dirname(__DIR__ . "/../install/init-static-db.sql");
|
|
||||||
$dir = $eventDb ? "sqls/eventdb" : "sqls";
|
|
||||||
|
|
||||||
foreach (glob("$root/$dir/*.sql") as $file) {
|
|
||||||
$files[(int) basename($file)] = basename($file);
|
|
||||||
}
|
|
||||||
|
|
||||||
ksort($files);
|
|
||||||
|
|
||||||
return $files;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function installChandler(InputInterface $input, SymfonyStyle $io, bool $drop = false): int
|
|
||||||
{
|
|
||||||
$chandlerLocation = $input->getArgument("chandler") ?? (__DIR__ . "/../../../../");
|
|
||||||
$chandlerConfigLocation = "$chandlerLocation/chandler.yml";
|
|
||||||
|
|
||||||
if (!file_exists($chandlerConfigLocation)) {
|
|
||||||
$err = ["Could not find chandler location. Perhaps your config is too unique?"];
|
|
||||||
if (!$input->getOption("chandler")) {
|
|
||||||
$err[] = "Specify absolute path to your chandler installation using the --chandler option.";
|
|
||||||
}
|
|
||||||
|
|
||||||
$io->getErrorStyle()->error($err);
|
|
||||||
|
|
||||||
return 21;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($drop) {
|
|
||||||
$bar = new ProgressBar($io, sizeof($this->chandlerTables));
|
|
||||||
$io->writeln("Dropping chandler tables...");
|
|
||||||
|
|
||||||
foreach ($bar->iterate($this->chandlerTables) as $table) {
|
|
||||||
$this->db->query("DROP TABLE IF EXISTS $table;");
|
|
||||||
}
|
|
||||||
|
|
||||||
$io->newLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
$installFile = file_get_contents("$chandlerLocation/install/init-db.sql");
|
|
||||||
|
|
||||||
return $this->executeSqlScript(22, $installFile, $io);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function initSchema(SymfonyStyle $io): int
|
|
||||||
{
|
|
||||||
$installFile = file_get_contents(__DIR__ . "/../install/init-static-db.sql");
|
|
||||||
|
|
||||||
return $this->executeSqlScript(31, $installFile, $io);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function initEventSchema(SymfonyStyle $io): int
|
|
||||||
{
|
|
||||||
$installFile = file_get_contents(__DIR__ . "/../install/init-event-db.sql");
|
|
||||||
|
|
||||||
return $this->executeSqlScript(31, $installFile, $io, true, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function initUpgradeLog(SymfonyStyle $io): int
|
|
||||||
{
|
|
||||||
$installFile = file_get_contents(__DIR__ . "/../install/init-migration-table.sql");
|
|
||||||
$rc = $this->executeSqlScript(31, $installFile, $io);
|
|
||||||
if ($rc) {
|
|
||||||
var_dump($rc);
|
|
||||||
return $rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
$installFile = file_get_contents(__DIR__ . "/../install/init-migration-table-event.sql");
|
|
||||||
|
|
||||||
return $this->executeSqlScript(32, $installFile, $io, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function runMigrations(SymfonyStyle $io, bool $eventDb, bool $oneshot): int
|
|
||||||
{
|
|
||||||
$dir = $eventDb ? "sqls/eventdb" : "sqls";
|
|
||||||
$tbl = $eventDb ? "ovk_events_upgrade_history" : "ovk_upgrade_history";
|
|
||||||
$db = $eventDb ? $this->eventDb : $this->db;
|
|
||||||
$nextLevel = $this->getNextLevel($eventDb);
|
|
||||||
$migrations = array_filter(
|
|
||||||
$this->getMigrationFiles($eventDb),
|
|
||||||
fn($id) => $id >= $nextLevel,
|
|
||||||
ARRAY_FILTER_USE_KEY
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!sizeof($migrations)) {
|
|
||||||
return 24;
|
|
||||||
}
|
|
||||||
|
|
||||||
$uname = addslashes(`whoami`);
|
|
||||||
$bar = new ProgressBar($io, sizeof($migrations));
|
|
||||||
$bar->setFormat("very_verbose");
|
|
||||||
|
|
||||||
foreach ($bar->iterate($migrations) as $num => $migration) {
|
|
||||||
$script = file_get_contents(__DIR__ . "/../install/$dir/$migration");
|
|
||||||
$res = $this->executeSqlScript(100 + $num, $script, $io, true, $eventDb);
|
|
||||||
if ($res != 0) {
|
|
||||||
$io->getErrorStyle()->error("Error while executing migration №$num");
|
|
||||||
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
$t = time();
|
|
||||||
$db->query("INSERT INTO $tbl VALUES ($num, $t, \"$uname\");");
|
|
||||||
|
|
||||||
if ($oneshot) {
|
|
||||||
return 5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$io->newLine();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
|
||||||
{
|
|
||||||
$oneShotMode = $input->getOption("oneshot");
|
|
||||||
$io = new SymfonyStyle($input, $output);
|
|
||||||
|
|
||||||
if (!$input->getOption("quick")) {
|
|
||||||
$io->writeln("Do full backup of the database before executing this command!");
|
|
||||||
$io->writeln("Command will resume execution after 5 seconds.");
|
|
||||||
$io->writeln("You can skip this warning with --quick option.");
|
|
||||||
sleep(5);
|
|
||||||
}
|
|
||||||
|
|
||||||
$migrationsOk = false;
|
|
||||||
$chandlerOk = false;
|
|
||||||
$eventOk = false;
|
|
||||||
$ovkOk = false;
|
|
||||||
|
|
||||||
$this->checkDatabaseReadiness($chandlerOk, $ovkOk, $eventOk, $migrationsOk);
|
|
||||||
|
|
||||||
$res = -1;
|
|
||||||
if ($chandlerOk === null) {
|
|
||||||
$io->writeln("Chandler schema not detected, attempting to install...");
|
|
||||||
|
|
||||||
$res = $this->installChandler($input, $io);
|
|
||||||
} elseif ($chandlerOk === false) {
|
|
||||||
if ($input->getOption("repair")) {
|
|
||||||
$io->warning("Chandler schema detected but is broken, attempting to repair...");
|
|
||||||
|
|
||||||
$res = $this->installChandler($input, $io, true);
|
|
||||||
} else {
|
|
||||||
$io->writeln("Chandler schema detected but is broken");
|
|
||||||
$io->writeln("Run command with --repair to repair (PERMISSIONS WILL BE LOST)");
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($res > 0) {
|
|
||||||
return $res;
|
|
||||||
} elseif ($res == 0 && $oneShotMode) {
|
|
||||||
return 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$ovkOk) {
|
|
||||||
$io->writeln("Initializing OpenVK schema...");
|
|
||||||
$res = $this->initSchema($io);
|
|
||||||
if ($res > 0) {
|
|
||||||
return $res;
|
|
||||||
} elseif ($oneShotMode) {
|
|
||||||
return 5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$migrationsOk) {
|
|
||||||
$io->writeln("Initializing upgrade log...");
|
|
||||||
$res = $this->initUpgradeLog($io);
|
|
||||||
if ($res > 0) {
|
|
||||||
return $res;
|
|
||||||
} elseif ($oneShotMode) {
|
|
||||||
return 5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($eventOk !== false) {
|
|
||||||
if ($eventOk === null) {
|
|
||||||
$io->writeln("Initializing event database...");
|
|
||||||
$res = $this->initEventSchema($io);
|
|
||||||
if ($res > 0) {
|
|
||||||
return $res;
|
|
||||||
} elseif ($oneShotMode) {
|
|
||||||
return 5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$io->writeln("Upgrading event database...");
|
|
||||||
$res = $this->runMigrations($io, true, $oneShotMode);
|
|
||||||
if ($res == 24) {
|
|
||||||
$output->writeln("Event database already up to date.");
|
|
||||||
} elseif ($res > 0) {
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$io->writeln("Upgrading database...");
|
|
||||||
$res = $this->runMigrations($io, false, $oneShotMode);
|
|
||||||
|
|
||||||
if (!$res) {
|
|
||||||
$io->success("Database has been upgraded!");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
} elseif ($res != 24) {
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
$io->writeln("Database up to date. Nothing left to do.");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -113,6 +113,7 @@ final class WallPresenter extends OpenVKPresenter
|
||||||
"amount" => sizeof($this->template->posts),
|
"amount" => sizeof($this->template->posts),
|
||||||
"perPage" => OPENVK_DEFAULT_PER_PAGE,
|
"perPage" => OPENVK_DEFAULT_PER_PAGE,
|
||||||
];
|
];
|
||||||
|
$this->template->ignore_status = $owner->isIgnoredBy($this->user->identity);
|
||||||
|
|
||||||
|
|
||||||
$this->logPostsViewed($this->template->posts, $user);
|
$this->logPostsViewed($this->template->posts, $user);
|
||||||
|
@ -200,7 +201,6 @@ final class WallPresenter extends OpenVKPresenter
|
||||||
foreach ($posts->page((int) ($_GET["p"] ?? 1), $perPage) as $post) {
|
foreach ($posts->page((int) ($_GET["p"] ?? 1), $perPage) as $post) {
|
||||||
$this->template->posts[] = $this->posts->get($post->id);
|
$this->template->posts[] = $this->posts->get($post->id);
|
||||||
}
|
}
|
||||||
$this->template->feedIgnoreButton = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderGlobalFeed(): void
|
public function renderGlobalFeed(): void
|
||||||
|
@ -241,7 +241,6 @@ final class WallPresenter extends OpenVKPresenter
|
||||||
foreach ($posts as $post) {
|
foreach ($posts as $post) {
|
||||||
$this->template->posts[] = $this->posts->get($post->id);
|
$this->template->posts[] = $this->posts->get($post->id);
|
||||||
}
|
}
|
||||||
$this->template->feedIgnoreButton = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderHashtagFeed(string $hashtag): void
|
public function renderHashtagFeed(string $hashtag): void
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
<span n:if="$post->isPinned()" class="nobold">{_pinned}</span>
|
<span n:if="$post->isPinned()" class="nobold">{_pinned}</span>
|
||||||
|
|
||||||
<a n:if="$canBeDeleted && !($forceNoDeleteLink ?? false) && $compact == false" class="delete" href="/wall{$post->getPrettyId()}/delete"></a>
|
<a n:if="$canBeDeleted && !($forceNoDeleteLink ?? false) && $compact == false" class="delete" href="/wall{$post->getPrettyId()}/delete"></a>
|
||||||
<a n:if="$feedIgnoreButton && !$canBeDeleted" class="ignore" id="__ignoreSomeoneFeed" title="{_feed_ignore}" data-val='1' data-id="{$wallOwner->getRealId()}"></a>
|
<a n:if="!$canBeDeleted" class="ignore" id="__ignoreSomeone" title="{if !$ignore_status}{_ignore_user}{else}{_unignore_user}{/if}" data-val='{!$ignore_status ? 1 : 0}' data-id="{$wallOwner->getId()}"></a>
|
||||||
|
|
||||||
{if $canBePinned && !($forceNoPinLink ?? false) && $compact == false}
|
{if $canBePinned && !($forceNoPinLink ?? false) && $compact == false}
|
||||||
{if $post->isPinned()}
|
{if $post->isPinned()}
|
||||||
|
|
|
@ -135,8 +135,8 @@
|
||||||
<a href="/wall{$post->getPrettyId()}/delete">{_delete}</a> |
|
<a href="/wall{$post->getPrettyId()}/delete">{_delete}</a> |
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{if $feedIgnoreButton && !$canBeDeleted}
|
{if !$canBeDeleted}
|
||||||
<a id="__ignoreSomeoneFeed" data-val='1' data-id="{$wallOwner->getRealId()}">{_feed_ignore}</a> |
|
<a class="delete" id="__ignoreSomeone" data-val='{!$ignore_status ? 1 : 0}' data-id="{$wallOwner->getId()}">{if !$ignore_status}{_ignore_user}{else}{_unignore_user}{/if}</a> |
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{if !($forceNoPinLink ?? false) && $canBePinned}
|
{if !($forceNoPinLink ?? false) && $canBePinned}
|
||||||
|
|
|
@ -914,15 +914,6 @@ h4 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ignore-message {
|
|
||||||
padding: 5px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.small-textarea {
|
.small-textarea {
|
||||||
height: 24px;
|
height: 24px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,8 @@
|
||||||
height: 16px;
|
height: 16px;
|
||||||
width: 16px;
|
width: 16px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
background: url("/assets/packages/static/openvk/img/ignore.png") no-repeat 0 0;
|
background: url("/assets/packages/static/openvk/img/audios_controls.png") no-repeat 0 0;
|
||||||
|
background-position: -51px -67px;
|
||||||
opacity: 0.1;
|
opacity: 0.1;
|
||||||
transition-duration: 0.3s;
|
transition-duration: 0.3s;
|
||||||
}
|
}
|
||||||
|
@ -100,15 +101,6 @@
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ignore-message {
|
|
||||||
padding: 5px 0;
|
|
||||||
border-bottom: 1px #ddd solid;
|
|
||||||
}
|
|
||||||
|
|
||||||
.post-author .delete {
|
.post-author .delete {
|
||||||
float: right;
|
float: right;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 295 B |
|
@ -43,53 +43,6 @@ u(document).on("click", "#__ignoreSomeone", async (e) => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
u(document).on("click", "#__ignoreSomeoneFeed", async (e) => {
|
|
||||||
e.preventDefault()
|
|
||||||
|
|
||||||
const TARGET = u(e.target)
|
|
||||||
const ENTITY_ID = Number(e.target.dataset.id)
|
|
||||||
const VAL = Number(e.target.dataset.val)
|
|
||||||
const ACT = VAL == 1 ? 'ignore' : 'unignore'
|
|
||||||
const METHOD_NAME = ACT == 'ignore' ? 'addBan' : 'deleteBan'
|
|
||||||
const PARAM_NAME = ENTITY_ID < 0 ? 'group_ids' : 'user_ids'
|
|
||||||
const ENTITY_NAME = ENTITY_ID < 0 ? 'club' : 'user'
|
|
||||||
const URL = `/method/newsfeed.${METHOD_NAME}?auth_mechanism=roaming&${PARAM_NAME}=${Math.abs(ENTITY_ID)}`
|
|
||||||
|
|
||||||
TARGET.closest('.post').addClass('lagged')
|
|
||||||
const REQ = await fetch(URL)
|
|
||||||
const RES = await REQ.json()
|
|
||||||
TARGET.closest('.post').removeClass('lagged')
|
|
||||||
|
|
||||||
if(RES.error_code) {
|
|
||||||
switch(RES.error_code) {
|
|
||||||
case -10:
|
|
||||||
fastError(';/')
|
|
||||||
break
|
|
||||||
case -50:
|
|
||||||
fastError(tr('ignored_sources_limit'))
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
fastError(res.error_msg)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if(RES.response == 1) {
|
|
||||||
if(ACT == 'unignore') {
|
|
||||||
TARGET.closest('.scroll_node').find('.post').removeClass('post-hidden');
|
|
||||||
TARGET.closest('.ignore-message').remove()
|
|
||||||
} else {
|
|
||||||
TARGET.closest('.post').addClass('post-hidden');
|
|
||||||
TARGET.closest('.scroll_node').append(`
|
|
||||||
<div class="ignore-message" width="100%">
|
|
||||||
${tr(`feed_${ENTITY_NAME}_ignored`)} <a id="__ignoreSomeoneFeed" data-val='0' data-id='${ENTITY_ID}' href="#">${tr('feed_unignore')}</a>
|
|
||||||
</div>
|
|
||||||
`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
u(document).on('click', '#__feed_settings_link', (e) => {
|
u(document).on('click', '#__feed_settings_link', (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
|
|
|
@ -443,10 +443,7 @@ function downloadable_name(string $text): string
|
||||||
}
|
}
|
||||||
|
|
||||||
return (function () {
|
return (function () {
|
||||||
if (php_sapi_name() != "cli") {
|
|
||||||
_ovk_check_environment();
|
_ovk_check_environment();
|
||||||
}
|
|
||||||
|
|
||||||
require __DIR__ . "/vendor/autoload.php";
|
require __DIR__ . "/vendor/autoload.php";
|
||||||
|
|
||||||
setlocale(LC_TIME, "POSIX");
|
setlocale(LC_TIME, "POSIX");
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
CREATE TABLE `ovk_events_upgrade_history` (
|
|
||||||
`level` smallint UNSIGNED NOT NULL,
|
|
||||||
`timestamp` bigint(20) UNSIGNED NOT NULL,
|
|
||||||
`operator` varchar(256) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT "Maintenance Script"
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
|
|
|
@ -1,5 +0,0 @@
|
||||||
CREATE TABLE `ovk_upgrade_history` (
|
|
||||||
`level` smallint UNSIGNED NOT NULL,
|
|
||||||
`timestamp` bigint(20) UNSIGNED NOT NULL,
|
|
||||||
`operator` varchar(256) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT "Maintenance Script"
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
|
|
|
@ -10,10 +10,13 @@ CREATE TABLE IF NOT EXISTS `coin_vouchers` (
|
||||||
`deleted` tinyint(1) NOT NULL DEFAULT '0'
|
`deleted` tinyint(1) NOT NULL DEFAULT '0'
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
CREATE TRIGGER `coinVoucherTokenAutoGen` BEFORE INSERT ON `coin_vouchers`
|
CREATE TRIGGER `coinVoucherTokenAutoGen` BEFORE INSERT ON `coin_vouchers`
|
||||||
FOR EACH ROW IF NEW.token IS NULL THEN
|
FOR EACH ROW IF NEW.token IS NULL THEN
|
||||||
SET NEW.token = SUBSTRING(UPPER(REPLACE(UUID(), "-", "")), 1, 24);
|
SET NEW.token = SUBSTRING(UPPER(REPLACE(UUID(), "-", "")), 1, 24);
|
||||||
END IF;
|
END IF
|
||||||
|
$$
|
||||||
|
DELIMITER ;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `gifts` (
|
CREATE TABLE IF NOT EXISTS `gifts` (
|
||||||
`id` bigint(20) unsigned NOT NULL,
|
`id` bigint(20) unsigned NOT NULL,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
CREATE TABLE `cryptotransactions` (
|
CREATE TABLE `cryptotransactions` (
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||||
`hash` varchar(45) COLLATE utf8mb4_unicode_520_ci NOT NULL,
|
`hash` varchar(45) COLLATE utf8mb4_general_nopad_ci NOT NULL,
|
||||||
`lt` bigint(20) NOT NULL,
|
`lt` bigint(20) NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_nopad_ci;
|
||||||
|
|
|
@ -359,11 +359,6 @@
|
||||||
"subscriptions_one" = "$1 subscription";
|
"subscriptions_one" = "$1 subscription";
|
||||||
"subscriptions_other" = "$1 subscriptions";
|
"subscriptions_other" = "$1 subscriptions";
|
||||||
|
|
||||||
"feed_user_ignored" = "User will no longer appear in the feed.";
|
|
||||||
"feed_club_ignored" = "Club will no longer appear in the feed.";
|
|
||||||
"feed_unignore" = "Restore.";
|
|
||||||
"feed_ignore" = "Not interested";
|
|
||||||
|
|
||||||
/* Group */
|
/* Group */
|
||||||
|
|
||||||
"group" = "Group";
|
"group" = "Group";
|
||||||
|
|
|
@ -290,11 +290,6 @@
|
||||||
"change_geo_name" = "Изменить название точки";
|
"change_geo_name" = "Изменить название точки";
|
||||||
"change_geo_name_new" = "Новое название";
|
"change_geo_name_new" = "Новое название";
|
||||||
|
|
||||||
"feed_user_ignored" = "Пользователь больше не будет появляться в ленте.";
|
|
||||||
"feed_club_ignored" = "Группа больше не будет появляться в ленте.";
|
|
||||||
"feed_unignore" = "Вернуть.";
|
|
||||||
"feed_ignore" = "Не интересно";
|
|
||||||
|
|
||||||
/* Friends */
|
/* Friends */
|
||||||
|
|
||||||
"friends" = "Друзья";
|
"friends" = "Друзья";
|
||||||
|
|
|
@ -280,11 +280,6 @@
|
||||||
"change_geo_name" = "Змінити назву розташування";
|
"change_geo_name" = "Змінити назву розташування";
|
||||||
"change_geo_name_new" = "Нова назва";
|
"change_geo_name_new" = "Нова назва";
|
||||||
|
|
||||||
"feed_user_ignored" = "Користувач більше не з'являтиметься у стрічці.";
|
|
||||||
"feed_club_ignored" = "Спiльнота більше не з'являтиметься у стрічці.";
|
|
||||||
"feed_unignore" = "Повернути.";
|
|
||||||
"feed_ignore" = "Не цікаво";
|
|
||||||
|
|
||||||
/* Friends */
|
/* Friends */
|
||||||
|
|
||||||
"friends" = "Друзі";
|
"friends" = "Друзі";
|
||||||
|
|
|
@ -10,7 +10,6 @@ use Symfony\Component\Console\Application;
|
||||||
require(__DIR__ . "/chandler_loader.php");
|
require(__DIR__ . "/chandler_loader.php");
|
||||||
|
|
||||||
$application = new Application();
|
$application = new Application();
|
||||||
$application->add(new CLI\UpgradeCommand());
|
|
||||||
$application->add(new CLI\RebuildImagesCommand());
|
$application->add(new CLI\RebuildImagesCommand());
|
||||||
$application->add(new CLI\FetchToncoinTransactions());
|
$application->add(new CLI\FetchToncoinTransactions());
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
@echo off
|
|
||||||
php openvkctl %*
|
|
Loading…
Reference in a new issue