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. 32
      public/index.phtml

26
library/mysql.php

@ -16,7 +16,7 @@ class MySQL { @@ -16,7 +16,7 @@ class MySQL {
}
}
public function getNamespaceName($namehash) {
public function getNamespaceValueByNS($ns) {
try {
@ -33,7 +33,7 @@ class MySQL { @@ -33,7 +33,7 @@ class MySQL {
LIMIT 1');
$query->execute([$namehash]);
$query->execute([$ns]);
return $query->rowCount() ? $query->fetch()['value'] : [];
@ -44,6 +44,28 @@ class MySQL { @@ -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) {
try {

12
public/index.php

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

32
public/index.phtml

@ -5,23 +5,25 @@ @@ -5,23 +5,25 @@
<meta charset="UTF-8" />
<meta name="description" content="Open Source Content Exploring Platform for Kevacoin Blockchain" />
<base href="<?php echo BASE_URL; ?>" />
<?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) { ?>
<title><?php echo $namespaceValue ? $namespaceValue : $ns; ?> | PART <?php echo $page; ?> | KVAZAR</title>
<meta name="robots" content="noindex,follow" />
<?php } else { ?>
<title><?php echo $namespaceValue ? $namespaceValue : $ns; ?> | KVAZAR</title>
<?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 ($page) { ?>
<title><?php echo $namespaceValue ? $namespaceValue : $ns; ?> | PART <?php echo $page; ?> | KVAZAR</title>
<meta name="robots" content="noindex,follow" />
<?php } else { ?>
<title><?php echo $namespaceValue ? $namespaceValue : $ns; ?> | KVAZAR</title>
<?php } ?>
<?php } else { ?>
<?php if ($page) { ?>
<title>KVAZAR | PART <?php echo $page; ?></title>
<meta name="robots" content="noindex,follow" />
<?php } else if ($tx) { ?>
<title><?php echo $tx && isset($data[0]['key']) ? $data[0]['key'] : $tx; ?> | KVAZAR</title>
<?php } else { ?>
<title>KVAZAR | Observe Kevacoin Universe</title>
<?php } ?>
<?php if ($page) { ?>
<title>KVAZAR | PART <?php echo $page; ?></title>
<meta name="robots" content="noindex,follow" />
<?php } else if ($tx) { ?>
<title><?php echo $tx && isset($data[0]['key']) ? $data[0]['key'] : $tx; ?> | <?php echo ($namespaceValue ? $namespaceValue : ($namespaceHash ? $namespaceHash : false)); ?> | KVAZAR</title>
<?php } else { ?>
<title>KVAZAR | Observe Kevacoin Universe</title>
<?php } ?>
<?php } ?>
</head>
<body>

Loading…
Cancel
Save