From 66daec2285e8c7b626d9c68c299e1f49976e6247 Mon Sep 17 00:00:00 2001 From: denis-skripnik Date: Thu, 18 May 2023 14:03:49 +0700 Subject: [PATCH] Error correction --- blockchains/golos/apps/profiles/donate.php | 40 ----------------- blockchains/golos/apps/profiles/index.php | 44 +++++++++++++++++-- blockchains/golos/apps/profiles/page/feed.php | 16 +++---- blockchains/hive/apps/profiles/page/feed.php | 6 +-- blockchains/serey/apps/profiles/page/feed.php | 6 +-- blockchains/steem/apps/profiles/page/feed.php | 8 +--- functions.php | 10 +++-- 7 files changed, 60 insertions(+), 70 deletions(-) delete mode 100644 blockchains/golos/apps/profiles/donate.php diff --git a/blockchains/golos/apps/profiles/donate.php b/blockchains/golos/apps/profiles/donate.php deleted file mode 100644 index df441c28..00000000 --- a/blockchains/golos/apps/profiles/donate.php +++ /dev/null @@ -1,40 +0,0 @@ - \ No newline at end of file diff --git a/blockchains/golos/apps/profiles/index.php b/blockchains/golos/apps/profiles/index.php index d0ae0837..8bab8ef5 100644 --- a/blockchains/golos/apps/profiles/index.php +++ b/blockchains/golos/apps/profiles/index.php @@ -39,10 +39,48 @@ function generateAppPages($blockchain_snippet) {

Донат

-'; -$pages .= file_get_contents($conf['siteUrl'].'blockchains/golos/apps/profiles/donate.php'); +'; if (!isset(pageUrl()[3])) { -$data['title'] .= ' - основное'; + $data['title'] .= ' - основное'; $data['description'] .= ' - основное'; $data['content'] = $blockchain_snippet; $data['content'] .= $pages; diff --git a/blockchains/golos/apps/profiles/page/feed.php b/blockchains/golos/apps/profiles/page/feed.php index 60fce885..fdcfcbff 100644 --- a/blockchains/golos/apps/profiles/page/feed.php +++ b/blockchains/golos/apps/profiles/page/feed.php @@ -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) { @@ -159,15 +155,15 @@ function transliteration($tag_en, $mode = 'torus') '.$curation_procent.'% '; $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 .= '' . $taging . ', '; - } + $tags_str .= '' . $taging . ', '; + } $tags_str = substr($tags_str,0,-2); - $result['content'] .= $tags_str.''; } - } + $result['content'] .= $tags_str.''; } // Конец цикла $result['nextIsExists'] = (isset($newStartAuthor) && !is_null($newStartAuthor) ? true : false); if (isset($result['nextIsExists']) && $result['nextIsExists']) { diff --git a/blockchains/hive/apps/profiles/page/feed.php b/blockchains/hive/apps/profiles/page/feed.php index 2f1357b2..51864c3c 100644 --- a/blockchains/hive/apps/profiles/page/feed.php +++ b/blockchains/hive/apps/profiles/page/feed.php @@ -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) { @@ -155,16 +152,17 @@ function transliteration($tag_en, $mode = 'torus') '; 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 .= '' . $taging . ', '; } $tags_str = substr($tags_str,0,-2); + } $result['content'] .= $tags_str; } $result['content'] .= ''; -} } // Конец цикла $result['nextIsExists'] = (isset($newStartAuthor) && !is_null($newStartAuthor) ? true : false); if (isset($result['nextIsExists']) && $result['nextIsExists']) { diff --git a/blockchains/serey/apps/profiles/page/feed.php b/blockchains/serey/apps/profiles/page/feed.php index f96a6f22..f0374604 100644 --- a/blockchains/serey/apps/profiles/page/feed.php +++ b/blockchains/serey/apps/profiles/page/feed.php @@ -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) { @@ -154,16 +151,17 @@ function transliteration($tag_en, $mode = 'torus') '; 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 .= '' . $taging . ', '; } $tags_str = substr($tags_str,0,-2); + } $result['content'] .= $tags_str; } $result['content'] .= ''; -} } // Конец цикла if (!isset($newStartAuthor)) $newStartAuthor = null; $result['nextIsExists'] = (isset($newStartAuthor) && !is_null($newStartAuthor) ? true : false); diff --git a/blockchains/steem/apps/profiles/page/feed.php b/blockchains/steem/apps/profiles/page/feed.php index 4baeb977..16bf84f9 100644 --- a/blockchains/steem/apps/profiles/page/feed.php +++ b/blockchains/steem/apps/profiles/page/feed.php @@ -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) { @@ -155,15 +151,15 @@ function transliteration($tag_en, $mode = 'torus') ' . $content['author'] . ' '; $tags_str = ''; +if (isset($tegi) && count($tegi) > 0 && is_array($tegi)) { foreach ($tegi as $teg) { $taging = transliteration($teg, 'torus'); $tags_str .= '' . $taging . ', '; } $tags_str = substr($tags_str,0,-2); - $result['content'] .= $tags_str.''; } - } + $result['content'] .= $tags_str.''; } // Конец цикла $result['nextIsExists'] = (isset($newStartAuthor) && !is_null($newStartAuthor) ? true : false); if (isset($result['nextIsExists']) && $result['nextIsExists']) { diff --git a/functions.php b/functions.php index 80a491c3..1cea5156 100644 --- a/functions.php +++ b/functions.php @@ -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';