Skip to content

Commit

Permalink
Error correction
Browse files Browse the repository at this point in the history
  • Loading branch information
denis-skripnik committed May 18, 2023
1 parent 84a841a commit 66daec2
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 70 deletions.
40 changes: 0 additions & 40 deletions blockchains/golos/apps/profiles/donate.php

This file was deleted.

44 changes: 41 additions & 3 deletions blockchains/golos/apps/profiles/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,48 @@ function generateAppPages($blockchain_snippet) {
<p><input type="submit" value="Открыть"></p>
</form>
<p align="center"><strong><a data-fancybox data-src="#donate_modal_content" href="javascript:;">Донат</a></strong></p>
';
$pages .= file_get_contents($conf['siteUrl'].'blockchains/golos/apps/profiles/donate.php');
<div style="display: none;" id="donate_modal_content">
<div>Ваш TIP-баланс: <span class="tip_balance_for_donate"></span></div>
<form class="form">
<p><label for="tip_donate_amount">Сумма доната (<span id="action_donate_tip">Перевести все <span class="tip_balance_for_donate"></span></span>):<br>
<input type="text" name="tip_donate_amount" value="" placeholder="Сумма доната"></label></p>
<p><strong><input type="button" value="Наградить" name="send_donate_button"></strong></p>
</form>
<script>
golos.api.getAccounts([golos_login], function(err, res) {
if (!err) {
$(".tip_balance_for_donate").html(res[0].tip_balance);
$("#action_donate_tip").click(function() {
let tip_balance = parseFloat(res[0].tip_balance);
$("input[name=tip_donate_amount]").val(tip_balance);
});
} else {
console.log(JSON.stringify(err));
}
});
var url = document.location.pathname;
var donate_to = url.split("/")[3];
$("input[name=send_donate_button]").click(function() {
let tip_balance = $("input[name=tip_donate_amount]").val();
tip_balance = parseFloat(tip_balance);
let donate_amount = tip_balance.toFixed(3) + " GOLOS";
let donate_memo = "Донат со страницы просмотра профилей https://dpos.space" + url + ".";
golos.broadcast.donate(posting_key, golos_login, donate_to, donate_amount, {app: "dpos-space", version: 1, comment: donate_memo, target: {type: "personal_donate"}}, [], function(err, result) {
if (!err) {
window.alert("Донат пользователю " + donate_to + " отправлен.");
location.reload();
} else {
window.alert("Ошибка: " + err);
}
});
});
</script>
</div>';
if (!isset(pageUrl()[3])) {
$data['title'] .= ' - основное';
$data['title'] .= ' - основное';
$data['description'] .= ' - основное';
$data['content'] = $blockchain_snippet;
$data['content'] .= $pages;
Expand Down
16 changes: 6 additions & 10 deletions blockchains/golos/apps/profiles/page/feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,6 @@ function transliteration($tag_en, $mode = 'torus')
if (isset($metadata['tags'])) {
$tegi = $metadata['tags'];
}
$filter_teg = array();

if ($content['author'] !== 'now') {
if (!count(array_intersect($tegi, $filter_teg))) {
$rowCount++;

if ($rowCount === FEED_LIMIT + 1) {
Expand All @@ -159,15 +155,15 @@ function transliteration($tag_en, $mode = 'torus')
<td>'.$curation_procent.'%</td>
<td>';
$tags_str = '';
foreach ($tegi as $teg) {
$taging = transliteration($teg, 'torus');
if (isset($tegi) && count($tegi) > 0 && is_array($tegi)) {
foreach ($tegi as $teg) {
$taging = transliteration($teg, 'torus');

$tags_str .= '<a href="https://golos.id/created/' . $teg . '" target="_blank">' . $taging . '</a>, ';
}
$tags_str .= '<a href="https://golos.id/created/' . $teg . '" target="_blank">' . $taging . '</a>, ';
}
$tags_str = substr($tags_str,0,-2);
$result['content'] .= $tags_str.'</td></tr>';
}
}
$result['content'] .= $tags_str.'</td></tr>';
} // Конец цикла
$result['nextIsExists'] = (isset($newStartAuthor) && !is_null($newStartAuthor) ? true : false);
if (isset($result['nextIsExists']) && $result['nextIsExists']) {
Expand Down
6 changes: 2 additions & 4 deletions blockchains/hive/apps/profiles/page/feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,9 @@ function transliteration($tag_en, $mode = 'torus')
$created = date('j', $created2).' '.$month[$month2].' '.date('Y г. H:i:s', $created2);
$metadata = json_decode($content['json_metadata'], true);
$tegi = [];
$filter_teg = array();
if (isset($metadata) && isset($metadata['tags'])) {
$tegi = $metadata['tags'];
}

if ($content['author'] !== 'now') {
$rowCount++;

if ($rowCount === FEED_LIMIT + 1) {
Expand All @@ -155,16 +152,17 @@ function transliteration($tag_en, $mode = 'torus')
<td>';
if (isset($metadata['tags'])) {
$tags_str = '';
if (isset($tegi) && count($tegi) > 0 && is_array($tegi)) {
foreach ($tegi as $teg) {
$taging = transliteration($teg, 'torus');

$tags_str .= '<a href="https://hive.blog/created/' . $teg . '" target="_blank">' . $taging . '</a>, ';
}
$tags_str = substr($tags_str,0,-2);
}
$result['content'] .= $tags_str;
}
$result['content'] .= '</td></tr>';
}
} // Конец цикла
$result['nextIsExists'] = (isset($newStartAuthor) && !is_null($newStartAuthor) ? true : false);
if (isset($result['nextIsExists']) && $result['nextIsExists']) {
Expand Down
6 changes: 2 additions & 4 deletions blockchains/serey/apps/profiles/page/feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,7 @@ function transliteration($tag_en, $mode = 'torus')
$metadata = json_decode($content['json_metadata'], true);
if (isset($metadata['tags'])) {
$tegi = $metadata['tags'];
$filter_teg = array();
}

if ($content['author'] !== 'now') {
$rowCount++;

if ($rowCount === FEED_LIMIT + 1) {
Expand All @@ -154,16 +151,17 @@ function transliteration($tag_en, $mode = 'torus')
<td>';
if (isset($metadata['tags'])) {
$tags_str = '';
if (isset($tegi) && count($tegi) > 0 && is_array($tegi)) {
foreach ($tegi as $teg) {
$taging = transliteration($teg, 'torus');

$tags_str .= '<a href="https://serey.io/categories/' . $teg . '" target="_blank">' . $taging . '</a>, ';
}
$tags_str = substr($tags_str,0,-2);
}
$result['content'] .= $tags_str;
}
$result['content'] .= '</td></tr>';
}
} // Конец цикла
if (!isset($newStartAuthor)) $newStartAuthor = null;
$result['nextIsExists'] = (isset($newStartAuthor) && !is_null($newStartAuthor) ? true : false);
Expand Down
8 changes: 2 additions & 6 deletions blockchains/steem/apps/profiles/page/feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,9 @@ function transliteration($tag_en, $mode = 'torus')
$created = date('j', $created2).' '.$month[$month2].' '.date('Y г. H:i:s', $created2);
$metadata = json_decode($content['json_metadata'], true);
$tegi = [];
$filter_teg = array();
if (isset($metadata) && isset($metadata['tags'])) {
$tegi = $metadata['tags'];
}

if ($content['author'] !== 'now') {
if (!count(array_intersect($tegi, $filter_teg))) {
$rowCount++;

if ($rowCount === FEED_LIMIT + 1) {
Expand All @@ -155,15 +151,15 @@ function transliteration($tag_en, $mode = 'torus')
<td><a href="'.$site_url.'steem/profiles/' . $content['author'] . '" target="_blank">' . $content['author'] . '</a></td>
<td>';
$tags_str = '';
if (isset($tegi) && count($tegi) > 0 && is_array($tegi)) {
foreach ($tegi as $teg) {
$taging = transliteration($teg, 'torus');

$tags_str .= '<a href="https://steemit.com/created/' . $teg . '" target="_blank">' . $taging . '</a>, ';
}
$tags_str = substr($tags_str,0,-2);
$result['content'] .= $tags_str.'</td></tr>';
}
}
$result['content'] .= $tags_str.'</td></tr>';
} // Конец цикла
$result['nextIsExists'] = (isset($newStartAuthor) && !is_null($newStartAuthor) ? true : false);
if (isset($result['nextIsExists']) && $result['nextIsExists']) {
Expand Down
10 changes: 7 additions & 3 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,14 @@ function getPage($url) {
$cache_url = 'caches/ohlc-'.$coin.'_'.$vs_currency;
} else if (substr_count($url, '.') === 3) {
$service = explode('/', $url)[3];
[$name, $params] = explode('?', $service);
$params = str_replace('&', '-', $params);
$params = str_replace('=', '', $params);
if (strpos('?', $service) !== false) {
[$name, $params] = explode('?', $service);
$params = str_replace('&', '-', $params);
$params = str_replace('=', '', $params);
$cache_url = 'caches/'.$name.'-'.$params;
} else {
$cache_url = 'caches/'.$service;
}
}

$cache_file = $cache_url.'.cache';
Expand Down

0 comments on commit 66daec2

Please sign in to comment.