From fb6c9d396341c67806bd201390520429c30baac2 Mon Sep 17 00:00:00 2001 From: veselcraft Date: Mon, 23 May 2022 15:36:19 +0300 Subject: [PATCH] Coin: Clear up the code --- CLI/FetchToncoinTransactions.php | 14 +++++++------- Web/Presenters/WallPresenter.php | 1 + Web/Presenters/templates/User/Settings.xml | 4 ++-- .../templates/components/post/microblogpost.xml | 2 +- Web/static/css/style.css | 2 +- Web/static/js/al_wall.js | 2 +- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CLI/FetchToncoinTransactions.php b/CLI/FetchToncoinTransactions.php index 1bcdb7e7..11bfa417 100755 --- a/CLI/FetchToncoinTransactions.php +++ b/CLI/FetchToncoinTransactions.php @@ -46,8 +46,8 @@ class FetchToncoinTransactions extends Command return Command::FAILURE; } - $testnet_subdomain = OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["testnet"] ? "testnet." : ""; - $url = "https://" . $testnet_subdomain . "toncenter.com/api/v2/getTransactions?"; + $testnetSubdomain = OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["testnet"] ? "testnet." : ""; + $url = "https://" . $testnetSubdomain . "toncenter.com/api/v2/getTransactions?"; $opts = [ "http" => [ @@ -57,14 +57,14 @@ class FetchToncoinTransactions extends Command ]; $selection = $this->transactions->select('hash, lt')->order("id DESC")->limit(1)->fetch(); - $tr_hash = $selection->hash ?? NULL; - $tr_lt = $selection->lt ?? NULL; + $trHash = $selection->hash ?? NULL; + $trLt = $selection->lt ?? NULL; $data = http_build_query([ "address" => OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["address"], "limit" => 100, - "hash" => $tr_hash, - "to_lt" => $tr_lt + "hash" => $trHash, + "to_lt" => $trLt ]); $response = file_get_contents($url . $data, false, stream_context_create($opts)); @@ -75,7 +75,7 @@ class FetchToncoinTransactions extends Command $output_array; preg_match('/' . OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["regex"] . '/', $transfer["in_msg"]["message"], $output_array); $userid = ctype_digit($output_array[1]) ? intval($output_array[1]) : NULL; - if($userid === NULL) { + if(is_null($userid)) { $header->writeln("Well, that's a donation. Thanks! XD"); } else { $user = (new Users)->get($userid); diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php index 8706f82f..ee3cc651 100644 --- a/Web/Presenters/WallPresenter.php +++ b/Web/Presenters/WallPresenter.php @@ -273,6 +273,7 @@ final class WallPresenter extends OpenVKPresenter try { $post = new Post; + $post->setOwner($this->user->id); $post->setWall($wall); $post->setCreated(time()); diff --git a/Web/Presenters/templates/User/Settings.xml b/Web/Presenters/templates/User/Settings.xml index 31433a91..424e08c6 100644 --- a/Web/Presenters/templates/User/Settings.xml +++ b/Web/Presenters/templates/User/Settings.xml @@ -399,13 +399,13 @@ function convertCurrency(coin) { var currencyTON = {php echo OPENVK_ROOT_CONF['openvk']['preferences']['ton']['rate']}; - u('.coins_dialog_conv').nodes[0].innerHTML = tr("transfer_ton_currency_per_ton", coin * currencyTON); + u(".coins_dialog_conv").nodes[0].innerHTML = tr("transfer_ton_currency_per_ton", coin * currencyTON); } function showCoinsTopUpTroughTon() { MessageBox(tr("transfer_trough_ton"), `
- ${ tr("transfer_ton_contents") } + ${tr("transfer_ton_contents")}
` + {tr("transfer_ton_address", OPENVK_ROOT_CONF['openvk']['preferences']['ton']['address'], str_replace("$1", $thisUser->getId(), OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["hint"]))} + diff --git a/Web/Presenters/templates/components/post/microblogpost.xml b/Web/Presenters/templates/components/post/microblogpost.xml index 352d9684..37dfb5da 100644 --- a/Web/Presenters/templates/components/post/microblogpost.xml +++ b/Web/Presenters/templates/components/post/microblogpost.xml @@ -7,7 +7,7 @@ -
+ {_online} diff --git a/Web/static/css/style.css b/Web/static/css/style.css index 2d257e89..9db53696 100644 --- a/Web/static/css/style.css +++ b/Web/static/css/style.css @@ -629,7 +629,7 @@ h4 { } .post-content .attachments_b { - margin-top: 8px; + margin-top: 8px; } .attachment .post { diff --git a/Web/static/js/al_wall.js b/Web/static/js/al_wall.js index 4457b7c1..4a8ab4e9 100644 --- a/Web/static/js/al_wall.js +++ b/Web/static/js/al_wall.js @@ -100,7 +100,7 @@ function setupWallPostInputHandlers(id) { if(e.clipboardData.files.length === 1) { var input = u("#post-buttons" + id + " input[name=_pic_attachment]").nodes[0]; input.files = e.clipboardData.files; - + u(input).trigger("change"); } });