Browse Source

fix rss links

pull/8/head
d47081 2 years ago
parent
commit
d97e4f0c4c
  1. 8
      public/index.php
  2. 2
      public/index.phtml
  3. 31
      public/rss.phtml

8
public/index.php

@ -15,7 +15,9 @@ if (SEF_MODE && isset($_SERVER['QUERY_STRING'])) {
$q = explode('/', $_SERVER['QUERY_STRING']); $q = explode('/', $_SERVER['QUERY_STRING']);
if (isset($q[1])) { if (isset($q[1])) {
if (strlen($q[1]) == 34) { if ($q[1] == 'rss') {
$rss = true;
} else if (strlen($q[1]) == 34) {
$ns = preg_replace('/[^a-zA-Z0-9]+/', '', $q[1]); $ns = preg_replace('/[^a-zA-Z0-9]+/', '', $q[1]);
} else if (strlen($q[1]) > 34) { } else if (strlen($q[1]) > 34) {
$tx = preg_replace('/[^a-zA-Z0-9]+/', '', $q[1]); $tx = preg_replace('/[^a-zA-Z0-9]+/', '', $q[1]);
@ -25,7 +27,9 @@ if (SEF_MODE && isset($_SERVER['QUERY_STRING'])) {
} }
if (isset($q[2])) { if (isset($q[2])) {
if (strlen($q[2]) == 34) { if ($q[2] == 'rss') {
$rss = true;
} else if (strlen($q[2]) == 34) {
$ns = preg_replace('/[^a-zA-Z0-9]+/', '', $q[2]); $ns = preg_replace('/[^a-zA-Z0-9]+/', '', $q[2]);
} else { } else {
$page = (int) $q[2]; $page = (int) $q[2];

2
public/index.phtml

@ -98,7 +98,7 @@
</div> </div>
<div class="t-center px-16 pb-27"> <div class="t-center px-16 pb-27">
<?php if (!$tx && !$page) { ?> <?php if (!$tx && !$page) { ?>
<div class="pb-16 f-s-12"><a href="<?php echo $query ? '?q=' . $query . '&rss' : '?rss'; ?>" rel="nofollow">RSS</a></div> <div class="pb-16 f-s-12"><a href="<?php echo BASE_URL; ?><?php echo ($query ? '?q=' . $query . '&rss' : ($ns ? $ns . '/rss' : 'rss')); ?>" rel="nofollow">RSS</a></div>
<?php } ?> <?php } ?>
<div class="pb-16 f-s-12 c-1"><a href="https://github.com/kvazar-network/webapp">KVAZAR Webapp</a> is the content exploring platform for <a href="https://kevacoin.org">Kevacoin Blockchain</a>.</div> <div class="pb-16 f-s-12 c-1"><a href="https://github.com/kvazar-network/webapp">KVAZAR Webapp</a> is the content exploring platform for <a href="https://kevacoin.org">Kevacoin Blockchain</a>.</div>
<div class="f-s-12 c-1">Sources distributed under the MIT License. Ownership of all content belongs to the authors.</div> <div class="f-s-12 c-1">Sources distributed under the MIT License. Ownership of all content belongs to the authors.</div>

31
public/rss.phtml

@ -1,16 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<atom:link href="<?php echo BASE_URL; ?>?rss" rel="self" type="application/rss+xml" /> <atom:link href="<?php echo BASE_URL; ?><?php echo ($ns ? $ns . '/rss' :
<title><?php echo $namespaceValue ? $namespaceValue : 'KVAZAR'; ?></title> ($query ? '?q=' . $query . '&amp;rss' : 'rss')); ?>" rel="self" type="application/rss+xml"></atom:link>
<description>Observe Kevacoin Universe</description> <title><?php echo ($namespaceValue ? $namespaceValue :
<?php foreach ($data as $item) { ?> ($namespaceHash ? $namespaceHash :
<item> ($query ? $query : 'KVAZAR'))); ?></title>
<title><?php echo $item['key']; ?></title> <description>Observe Kevacoin Universe</description>
<guid><?php echo BASE_URL; ?><?php echo $item['txid']; ?></guid> <link><?php echo BASE_URL; ?><?php echo ($ns ? $ns : ($query ? '?q=' . $query : false)); ?></link>
<pubDate><?php echo $item['time']; ?></pubDate> <?php foreach ($data as $item) { ?>
<description><?php echo $item['value']; ?></description> <item>
</item> <title><?php echo $item['key']; ?></title>
<?php } ?> <guid><?php echo BASE_URL; ?><?php echo $item['txid']; ?></guid>
</channel> <pubDate><?php echo $item['time']; ?></pubDate>
<description><?php echo $item['value']; ?></description>
<link><?php echo BASE_URL; ?><?php echo $item['txid']; ?></link>
</item>
<?php } ?>
</channel>
</rss> </rss>
Loading…
Cancel
Save