Browse Source

remove optional sef mode

pull/8/head
d47081 2 years ago
parent
commit
0e394fcc26
  1. 1
      config-default.php
  2. 25
      public/index.php
  3. 14
      public/index.phtml

1
config-default.php

@ -8,7 +8,6 @@ error_reporting(E_ALL); @@ -8,7 +8,6 @@ error_reporting(E_ALL);
// Application
define('BASE_URL', 'https://kvazar.today/');
define('PAGE_LIMIT', 10);
define('SEF_MODE', true);
define('CACHE_ENABLED', false);
// Database

25
public/index.php

@ -10,7 +10,7 @@ $tx = isset($_GET['tx']) ? preg_replace('/[^a-zA-Z0-9]+/', '', $_GET['tx']) : @@ -10,7 +10,7 @@ $tx = isset($_GET['tx']) ? preg_replace('/[^a-zA-Z0-9]+/', '', $_GET['tx']) :
$page = (int) isset($_GET['page']) ? $_GET['page'] : 0;
$rss = isset($_GET['rss']) ? true : false;
if (SEF_MODE && isset($_SERVER['QUERY_STRING'])) {
if (isset($_SERVER['QUERY_STRING'])) {
$q = explode('/', $_SERVER['QUERY_STRING']);
@ -73,7 +73,7 @@ foreach ($db->getData($ns, $tx, $query, $limit, PAGE_LIMIT) as $value) { @@ -73,7 +73,7 @@ foreach ($db->getData($ns, $tx, $query, $limit, PAGE_LIMIT) as $value) {
];
}
if (SEF_MODE && !$query) {
if (!$query) {
if (in_array($page, [0, 1])) {
$newer = false;
@ -95,27 +95,6 @@ if (SEF_MODE && !$query) { @@ -95,27 +95,6 @@ if (SEF_MODE && !$query) {
$older = false;
}
} else {
if (in_array($page, [0, 1])) {
$newer = false;
} else {
if ($page == 2) {
$newer = ($ns ? '?ns=' . $ns : ($query ? '?q=' . $query : ''));
} else {
$newer = ($ns ? '?ns=' . $ns . '&page=' . ($page - 1) : '?page=' . ($page - 1) . ($query ? '&q=' . $query : ''));
}
}
if ($data) {
if (in_array($page, [0, 1])) {
$older = ($ns ? '?ns=' . $ns . '&page=2' : '?page=2' . ($query ? '&q=' . $query : ''));
} else {
$older = ($ns ? '?ns=' . $ns . '&page=' . ($page + 1) : '?page=' . ($page + 1) . ($query ? '&q=' . $query : ''));
}
} else {
$older = false;
}
}
if ($ns) {

14
public/index.phtml

@ -47,19 +47,13 @@ @@ -47,19 +47,13 @@
<div class="mx-a mw-560 px-16">
<?php if (!$ns) { ?>
<div class="mx-a mw-560 mb-16">
<?php if (SEF_MODE) { ?>
<a href="<?php echo BASE_URL; ?><?php echo $item['namehash']; ?>">
<img class="br-50" src="/image.php?hash=<?php echo $item['namehash']; ?>" alt="<?php echo $item['namehash']; ?>" />
</a>
<?php } else { ?>
<a href="<?php echo BASE_URL; ?>?ns=<?php echo $item['namehash']; ?>">
<img class="br-50" src="/image.php?hash=<?php echo $item['namehash']; ?>" alt="<?php echo $item['namehash']; ?>" />
</a>
<?php } ?>
<a href="<?php echo BASE_URL; ?><?php echo $item['namehash']; ?>">
<img class="br-50" src="/image.php?hash=<?php echo $item['namehash']; ?>" alt="<?php echo $item['namehash']; ?>" />
</a>
</div>
<?php } ?>
<?php if (!$tx) { ?>
<a class="d-block" href="<?php echo BASE_URL; ?><?php echo (SEF_MODE ? $item['txid'] : '?tx=' . $item['txid']); ?>">
<a class="d-block" href="<?php echo BASE_URL; ?><?php echo $item['txid']; ?>">
<?php } ?>
<div class="f-s-16 mb-16 of-a">
<?php echo $item['key']; ?>

Loading…
Cancel
Save