Coin: Clear up the code

This commit is contained in:
veselcraft 2022-05-23 15:36:19 +03:00
parent fd9107749d
commit fb6c9d3963
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E
6 changed files with 13 additions and 12 deletions

View file

@ -46,8 +46,8 @@ class FetchToncoinTransactions extends Command
return Command::FAILURE; return Command::FAILURE;
} }
$testnet_subdomain = OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["testnet"] ? "testnet." : ""; $testnetSubdomain = OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["testnet"] ? "testnet." : "";
$url = "https://" . $testnet_subdomain . "toncenter.com/api/v2/getTransactions?"; $url = "https://" . $testnetSubdomain . "toncenter.com/api/v2/getTransactions?";
$opts = [ $opts = [
"http" => [ "http" => [
@ -57,14 +57,14 @@ class FetchToncoinTransactions extends Command
]; ];
$selection = $this->transactions->select('hash, lt')->order("id DESC")->limit(1)->fetch(); $selection = $this->transactions->select('hash, lt')->order("id DESC")->limit(1)->fetch();
$tr_hash = $selection->hash ?? NULL; $trHash = $selection->hash ?? NULL;
$tr_lt = $selection->lt ?? NULL; $trLt = $selection->lt ?? NULL;
$data = http_build_query([ $data = http_build_query([
"address" => OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["address"], "address" => OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["address"],
"limit" => 100, "limit" => 100,
"hash" => $tr_hash, "hash" => $trHash,
"to_lt" => $tr_lt "to_lt" => $trLt
]); ]);
$response = file_get_contents($url . $data, false, stream_context_create($opts)); $response = file_get_contents($url . $data, false, stream_context_create($opts));
@ -75,7 +75,7 @@ class FetchToncoinTransactions extends Command
$output_array; $output_array;
preg_match('/' . OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["regex"] . '/', $transfer["in_msg"]["message"], $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; $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"); $header->writeln("Well, that's a donation. Thanks! XD");
} else { } else {
$user = (new Users)->get($userid); $user = (new Users)->get($userid);

View file

@ -273,6 +273,7 @@ final class WallPresenter extends OpenVKPresenter
try { try {
$post = new Post; $post = new Post;
$post->setOwner($this->user->id); $post->setOwner($this->user->id);
$post->setWall($wall); $post->setWall($wall);
$post->setCreated(time()); $post->setCreated(time());

View file

@ -399,13 +399,13 @@
function convertCurrency(coin) { function convertCurrency(coin) {
var currencyTON = {php echo OPENVK_ROOT_CONF['openvk']['preferences']['ton']['rate']}; 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() { function showCoinsTopUpTroughTon() {
MessageBox(tr("transfer_trough_ton"), ` MessageBox(tr("transfer_trough_ton"), `
<div class="messagebox-content-header"> <div class="messagebox-content-header">
${ tr("transfer_ton_contents") } ${tr("transfer_ton_contents")}
</div> </div>
<div style="margin-top: 30px">` + <div style="margin-top: 30px">` +
{tr("transfer_ton_address", OPENVK_ROOT_CONF['openvk']['preferences']['ton']['address'], str_replace("$1", $thisUser->getId(), OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["hint"]))} + {tr("transfer_ton_address", OPENVK_ROOT_CONF['openvk']['preferences']['ton']['address'], str_replace("$1", $thisUser->getId(), OPENVK_ROOT_CONF["openvk"]["preferences"]["ton"]["hint"]))} +

View file

@ -7,7 +7,7 @@
<table border="0" style="font-size: 11px;" n:class="post, !$compact ? post-divider, $post->isExplicit() ? post-nsfw"> <table border="0" style="font-size: 11px;" n:class="post, !$compact ? post-divider, $post->isExplicit() ? post-nsfw">
<tbody> <tbody>
<tr> <tr>
<td width="54" style="{ifset $compact}display: block;{/ifset}" valign="top"> <td width="54" valign="top">
<a href="{$author->getURL()}"> <a href="{$author->getURL()}">
<img src="{$author->getAvatarURL('miniscule')}" width="{ifset $compact}25{else}50{/ifset}" {ifset $compact}class="cCompactAvatars"{/ifset} /> <img src="{$author->getAvatarURL('miniscule')}" width="{ifset $compact}25{else}50{/ifset}" {ifset $compact}class="cCompactAvatars"{/ifset} />
<span n:if="!$post->isPostedOnBehalfOfGroup() && !$compact && $author->isOnline()" class="post-online">{_online}</span> <span n:if="!$post->isPostedOnBehalfOfGroup() && !$compact && $author->isOnline()" class="post-online">{_online}</span>