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. 13
      public/rss.phtml

8
public/index.php

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

2
public/index.phtml

@ -98,7 +98,7 @@ @@ -98,7 +98,7 @@
</div>
<div class="t-center px-16 pb-27">
<?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 } ?>
<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>

13
public/rss.phtml

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