Browse Source

add NS subtitles

pull/7/head
ghost 3 years ago
parent
commit
61d0facb5c
  1. 26
      library/mysql.php
  2. 12
      public/index.php
  3. 6
      public/index.phtml

26
library/mysql.php

@ -16,7 +16,7 @@ class MySQL {
} }
} }
public function getNamespaceName($namehash) { public function getNamespaceValueByNS($ns) {
try { try {
@ -33,7 +33,7 @@ class MySQL {
LIMIT 1'); LIMIT 1');
$query->execute([$namehash]); $query->execute([$ns]);
return $query->rowCount() ? $query->fetch()['value'] : []; return $query->rowCount() ? $query->fetch()['value'] : [];
@ -44,6 +44,28 @@ class MySQL {
} }
} }
public function getNamespaceHashByTX($txid) {
try {
$query = $this->_db->prepare('SELECT `namespace`.`hash`
FROM `namespace`
JOIN `data` ON (`data`.`nameSpaceId` = `namespace`.`nameSpaceId`)
WHERE `data`.`txid` = ?');
$query->execute([$txid]);
return $query->rowCount() ? $query->fetch()['hash'] : [];
} catch(PDOException $e) {
trigger_error($e->getMessage());
return false;
}
}
public function getData($namehash = false, $txid = false, $search = false, $start = 0, $limit = 10) { public function getData($namehash = false, $txid = false, $search = false, $start = 0, $limit = 10) {
try { try {

12
public/index.php

@ -41,8 +41,18 @@ if ($page > 0) {
$db = new MySQL(); $db = new MySQL();
if ($ns) { if ($ns) {
$namespaceValue = $db->getNamespaceName($ns);
$namespaceHash = $ns;
$namespaceValue = $db->getNamespaceValueByNS($ns);
} else if ($tx) {
$namespaceHash = $db->getNamespaceHashByTX($tx);
$namespaceValue = $db->getNamespaceValueByNS($namespaceHash);
} else { } else {
$namespaceHash = false;
$namespaceValue = false; $namespaceValue = false;
} }

6
public/index.phtml

@ -5,8 +5,10 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="description" content="Open Source Content Exploring Platform for Kevacoin Blockchain" /> <meta name="description" content="Open Source Content Exploring Platform for Kevacoin Blockchain" />
<base href="<?php echo BASE_URL; ?>" /> <base href="<?php echo BASE_URL; ?>" />
<?php if ($namespaceHash) { ?>
<link rel="icon" type="image/png" href="image.php?hash=<?php echo $namespaceHash; ?>&width=32&height=32&radius=16" />
<?php } ?>
<?php if ($ns) { ?> <?php if ($ns) { ?>
<link rel="icon" type="image/png" href="image.php?hash=<?php echo $ns; ?>&width=32&height=32&radius=16" />
<?php if ($page) { ?> <?php if ($page) { ?>
<title><?php echo $namespaceValue ? $namespaceValue : $ns; ?> | PART <?php echo $page; ?> | KVAZAR</title> <title><?php echo $namespaceValue ? $namespaceValue : $ns; ?> | PART <?php echo $page; ?> | KVAZAR</title>
<meta name="robots" content="noindex,follow" /> <meta name="robots" content="noindex,follow" />
@ -18,7 +20,7 @@
<title>KVAZAR | PART <?php echo $page; ?></title> <title>KVAZAR | PART <?php echo $page; ?></title>
<meta name="robots" content="noindex,follow" /> <meta name="robots" content="noindex,follow" />
<?php } else if ($tx) { ?> <?php } else if ($tx) { ?>
<title><?php echo $tx && isset($data[0]['key']) ? $data[0]['key'] : $tx; ?> | KVAZAR</title> <title><?php echo $tx && isset($data[0]['key']) ? $data[0]['key'] : $tx; ?> | <?php echo ($namespaceValue ? $namespaceValue : ($namespaceHash ? $namespaceHash : false)); ?> | KVAZAR</title>
<?php } else { ?> <?php } else { ?>
<title>KVAZAR | Observe Kevacoin Universe</title> <title>KVAZAR | Observe Kevacoin Universe</title>
<?php } ?> <?php } ?>

Loading…
Cancel
Save