From 102574da13894dcb0d24605c03edfbbdea6fc462 Mon Sep 17 00:00:00 2001 From: denis-skripnik Date: Sat, 20 Aug 2022 20:03:09 +0700 Subject: [PATCH] Error correction, update functional --- .htaccess | 43 +++++++++++++++ blockchains/cyber/apps/explorer/content.php | 7 +-- .../apps/explorer/pages/block/content.php | 2 +- .../cyber/apps/explorer/pages/tx/content.php | 2 +- blockchains/cyber/node.php | 2 +- blockchains/minter/content.html | 2 +- content.html | 5 +- functions.php | 54 ++++++++++++++++++- helpers.php | 1 + index.php | 16 ++++-- menu.json | 2 +- template/main.php | 23 ++++---- .../Http/VizHttpJsonRpcConnector.php | 2 +- viz-manual/textolite/conf.ini | 6 +-- 14 files changed, 135 insertions(+), 32 deletions(-) diff --git a/.htaccess b/.htaccess index 4b9e098e..6099094a 100644 --- a/.htaccess +++ b/.htaccess @@ -1,3 +1,17 @@ +php_flag display_startup_errors off +php_flag display_errors off +php_flag html_errors off +php_flag log_errors on +php_flag ignore_repeated_errors off +php_flag ignore_repeated_source off +php_flag report_memleaks on +php_flag track_errors on +php_value docref_root 0 +php_value docref_ext 0 +php_value error_log /home/s/scadens/dpos.space/public_html/PHP_errors.log +php_value error_reporting 2047 +php_value log_errors_max_len 0 + Require all denied @@ -8,6 +22,16 @@ #php_flag html_errors off #php_value max_execution_time 120000 +#редирект для поддомена api +RewriteCond %{HTTP_HOST} ^(www\.)?api\.dpos\.space$ [NC] +RewriteCond %{REQUEST_URI} !^/api/ +RewriteRule ^(.*)$ api/$1 [L] + +#редрект для поддомена viz +RewriteCond %{HTTP_HOST} ^(www\.)?viz\.dpos\.space$ [NC] +RewriteCond %{REQUEST_URI} !^/viz-manual/ +RewriteRule ^(.*)$ viz-manual/$1 [L] + #Редирект на https RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule (.*) https://%{HTTP_HOST}/$1 [L,R=301] @@ -30,6 +54,25 @@ RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] + +Options +FollowSymLinks +RedirectPermanent /golos-top https://dpos.space/golos/top +RedirectPermanent /golos-donates https://dpos.space/golos/donates +RedirectPermanent /viz/buy https://dpos.space/viz/exchanges +RedirectPermanent /viz-top https://dpos.space/viz/top +RedirectPermanent /golos-polls https://dpos.space/golos/polls +RedirectPermanent /randomblockchain https://dpos.space/viz/randomblockchain +RedirectPermanent /dev https://dpos.space +RedirectMatch 301 ^/calc/(.*) https://dpos.space/$1/calc +RedirectMatch 301 ^/post/(.*) https://dpos.space/$1/post +RedirectMatch 301 ^/backup/(.*) https://dpos.space/$1/backup +RedirectMatch 301 ^/profiles/(.*)/(.*) https://dpos.space/$2/profiles/$1/ + +RewriteCond %{QUERY_STRING} chain=(.*) [NC] +RewriteCond %{QUERY_STRING} block1=(.*) [NC] +RewriteCond %{QUERY_STRING} block2=(.*) [NC] +RewriteCond %{QUERY_STRING} participants=(.*) [NC] +RewriteRule ^(.*)$ /(.*)/? [R=301,L] diff --git a/blockchains/cyber/apps/explorer/content.php b/blockchains/cyber/apps/explorer/content.php index 74f27d2d..7e039aae 100644 --- a/blockchains/cyber/apps/explorer/content.php +++ b/blockchains/cyber/apps/explorer/content.php @@ -1,6 +1,6 @@ Номер последнего блока: '.$status['sync_info']['latest_block_height'].'
  • Дата и время последнего блока: '.$status['sync_info']['latest_block_time'].'
  • Адрес валидатора: '.$status['validator_info']['address'].'
  • -
  • тип публичного ключа: '.$status['validator_info']['pub_key']['type'].', ключ: '.$status['validator_info']['pub_key']['value'].'
  • '; -$index_stats = node('index_stats?'); -$content .= '
  • Число ссылок: '.$index_stats['linksCount'].'
  • -
  • Число аккаунтов: '.$index_stats['accountsCount'].'
  • +
  • тип публичного ключа: '.$status['validator_info']['pub_key']['type'].', ключ: '.$status['validator_info']['pub_key']['value'].'
  • К оглавлению

    '; return $content; diff --git a/blockchains/cyber/apps/explorer/pages/block/content.php b/blockchains/cyber/apps/explorer/pages/block/content.php index 41cfaadd..4e29c583 100644 --- a/blockchains/cyber/apps/explorer/pages/block/content.php +++ b/blockchains/cyber/apps/explorer/pages/block/content.php @@ -26,7 +26,7 @@ function convert_operation_data($arr, $site_url) { } function node($params) { - $html = file_get_contents('https://deimos.cybernode.ai/'.$params); + $html = file_get_contents('https://rpc.cyber.posthuman.digital/'.$params); $data = json_decode($html, true); return $data['result']; } diff --git a/blockchains/cyber/apps/explorer/pages/tx/content.php b/blockchains/cyber/apps/explorer/pages/tx/content.php index 0a070e1f..1218a763 100644 --- a/blockchains/cyber/apps/explorer/pages/tx/content.php +++ b/blockchains/cyber/apps/explorer/pages/tx/content.php @@ -25,7 +25,7 @@ function convert_operation_data($arr, $site_url) { return $result; } -$html = file_get_contents('https://lcd.cyber.cybernode.ai/txs/'.$datas); +$html = file_get_contents('https://rpc.cyber.posthuman.digital/txs/'.$datas); $tx = json_decode($html, true); date_default_timezone_set('UTC'); diff --git a/blockchains/cyber/node.php b/blockchains/cyber/node.php index 24e9608e..54f8d17e 100644 --- a/blockchains/cyber/node.php +++ b/blockchains/cyber/node.php @@ -1,6 +1,6 @@ diff --git a/blockchains/minter/content.html b/blockchains/minter/content.html index 0016e604..26fecd10 100644 --- a/blockchains/minter/content.html +++ b/blockchains/minter/content.html @@ -1,4 +1,4 @@

    Сервисы смотрите в меню.

    -

    Minter - блокчейн, в котором можно создать токен с обеспечением в BIP или без обеспечения. Где можно обменивать их через пулы ликвидности, добавлять лликвидность и создавать новые пулы.
    +

    Minter - блокчейн, в котором можно создать токен с обеспечением в BIP или без обеспечения. Где можно обменивать их через пулы ликвидности, добавлять ликвидность и создавать новые пулы.
    Также можно конвертировать любые монеты с резервом между собой.

    p>

    BIP - основной токен Минтера.

    \ No newline at end of file diff --git a/content.html b/content.html index 5c66fe2e..ac74c54e 100644 --- a/content.html +++ b/content.html @@ -1,9 +1,8 @@ - -

    Opensource проект для приложений, работающих с блокчейнами.

    -

    Здесь представлены блокчейны, а также приложения для них. Список БЧ смотрите в меню.

    +

    Opensource проект для приложений, работающих с блокчейнами. + Список блокчейнов и приложений к ним представлен в меню.

    diff --git a/functions.php b/functions.php index ff7028b6..3167e118 100644 --- a/functions.php +++ b/functions.php @@ -8,7 +8,8 @@ function pageUrl() { в противном случае - выдать ошибку 404 */ setlocale(LC_ALL, "ru_RU.UTF-8"); - if (preg_match ("/([^a-zA-Z0-9а-яА-Я\.\/\-\_\?\&\=\#]u)/", $chpu)) { +setlocale(LC_NUMERIC, 'en_US.UTF8'); +if (preg_match ("/([^a-zA-Z0-9а-яА-Я\.\/\-\_\?\&\=\#]u)/", $chpu)) { header("HTTP/1.0 404 Not Found"); echo "Недопустимые символы в URL"; @@ -269,4 +270,55 @@ function get404Page() { require_once 'template/404.php'; return $data; } + +function getPage($url) { + $cache_url = 'caches/'.urlencode(basename($url)); + if (strpos($url, 'coingecko') !== false && strpos($url, '/markets') !== false) { + $parameters = explode('?', $url)[1]; + $param = explode('&', $parameters); + $vs_currency = explode('=', $param[0])[1]; + $symbol = explode('=', $param[1])[1]; + $cache_url = 'caches/markets-'.$vs_currency.'-'.$symbol; + } else if (strpos($url, 'coingecko') !== false && strpos($url, '/ohlc') !== false) { + $coin = explode('/', $url)[6]; + $vs_currency_with = explode('?vs_currency=', $url)[1]; + $vs_currency = explode('&days=', $vs_currency_with)[0]; + $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); + $cache_url = 'caches/'.$name.'-'.$params; + } + + $cache_file = $cache_url.'.cache'; + if(file_exists($cache_file)) { + if (strpos($url, 'cbr.ru') !== false && time() - filemtime($cache_file) > 43200) { + $cache = file_get_contents($url); + $t=explode("", $cache); + $t=explode("", $t[1]); + $count = count($t); + if (isset($t) && $t[0]<>0 || $count > 14) { + return; + } else { + file_put_contents($cache_file, $cache); + } + } else if (strpos($url, 'golos-api?service=top') !== false && time() - filemtime($cache_file) > 1800) { + $cache = file_get_contents($url); + file_put_contents($cache_file, $cache); + } else if(time() - filemtime($cache_file) > 60) { + // too old , re-fetch + $cache = file_get_contents($url); + file_put_contents($cache_file, $cache); + } else { + $cache = file_get_contents($cache_url.'.cache'); + } + } else { + // no cache, create one + $cache = file_get_contents($url); + file_put_contents($cache_file, $cache); + } +return $cache; +} ?> \ No newline at end of file diff --git a/helpers.php b/helpers.php index 045e1606..bf46ee5a 100644 --- a/helpers.php +++ b/helpers.php @@ -33,6 +33,7 @@ function getWord($number, $suffix) $keys = array(2, 0, 1, 1, 1, 2); $mod = $number % 100; $suffix_key = ($mod > 7 && $mod < 20) ? 2 : $keys[min($mod % 10, 5)]; + if ($suffix_key < 0) $suffix_key = 0; return $suffix[$suffix_key]; } diff --git a/index.php b/index.php index 7e55074d..056346e9 100644 --- a/index.php +++ b/index.php @@ -1,7 +1,18 @@ + - <?= $data['title']; ?> | <?= $conf['siteName']; ?> + <?= $title_text; ?> | <?= $conf['siteName']; ?> - - - - diff --git a/vendor/t3ran13/php-graphene-node-client/Connectors/Http/VizHttpJsonRpcConnector.php b/vendor/t3ran13/php-graphene-node-client/Connectors/Http/VizHttpJsonRpcConnector.php index f52dff29..dee864f4 100644 --- a/vendor/t3ran13/php-graphene-node-client/Connectors/Http/VizHttpJsonRpcConnector.php +++ b/vendor/t3ran13/php-graphene-node-client/Connectors/Http/VizHttpJsonRpcConnector.php @@ -19,5 +19,5 @@ class VizHttpJsonRpcConnector extends HttpJsonRpcConnectorAbstract * * @var string */ - protected static $nodeURL = ['https://viz-node.dpos.space', 'https://solox.world']; + protected static $nodeURL = ['https://viz.lexai.host']; } \ No newline at end of file diff --git a/viz-manual/textolite/conf.ini b/viz-manual/textolite/conf.ini index 124ea895..8b98268d 100644 --- a/viz-manual/textolite/conf.ini +++ b/viz-manual/textolite/conf.ini @@ -2,13 +2,13 @@ lang = en,ru password = b8f5854767559b3d7fa4b610f6ccb457c3d5c138 -session = 8af46dc418ee5ea4b97bd8826a29704b040b4777 +session = 43a51e05e68eb6250b13201265eb5df3e641a395 pass_complexity = 500000 -pass_complexity_js = 14941 +pass_complexity_js = 14940 -auth_time = 1624466770 +auth_time = 1639057789 auth_error_time = 1600191185