add network totals

This commit is contained in:
ghost 2021-12-28 23:47:00 +02:00
parent a432a78acf
commit 4ee4b1f065
5 changed files with 35 additions and 3 deletions

View File

@ -1,3 +1,6 @@
<?php
$usersTotal = $_modelUser->getTotal();
$blocksTotal = $_modelBlock->getTotal();
require(PROJECT_DIR . '/application/view/common/footer.phtml');

View File

@ -2,6 +2,21 @@
class ModelBlock extends Model {
public function getTotal() {
try {
$query = $this->_db->query("SELECT COUNT(*) AS `total` from `block`");
return $query->fetch()['total'];
} catch (PDOException $e) {
trigger_error($e->getMessage());
return false;
}
}
public function getNextBlock() {
try {

View File

@ -2,6 +2,21 @@
class ModelUser extends Model {
public function getTotal() {
try {
$query = $this->_db->query("SELECT COUNT(*) AS `total` from `user`");
return $query->fetch()['total'];
} catch (PDOException $e) {
trigger_error($e->getMessage());
return false;
}
}
public function userNameExists(string $userName) {
try {
@ -10,7 +25,7 @@ class ModelUser extends Model {
$query->execute([$userName]);
return $query->rowCount() ? $query->fetch()['total'] : 0;
return $query->fetch()['total'];
} catch (PDOException $e) {

View File

@ -1,6 +1,7 @@
<div class="t-center c-2">
<p><small><?php echo sprintf(_('Twisterarmy Cloud is the <a class="c-0" href="%s">Open Source</a> web interface to interact <a class="c-0" href="%s">Twister Network</a> remotely.'), 'https://github.com/twisterarmy/cloud-server', 'http://twister.net.co') ?></small></p>
<p><small><?php echo _('* software under development. Import existing wallets on your own risk.') ?></small></p>
<p><small><?php echo sprintf(_('%s users in %s blocks'), $usersTotal, $blocksTotal) ?></small></p>
<p class="mt-20"><small><?php echo sprintf(_('version %s'), SERVER_VERSION) ?> <i class="bi bi-suit-heart"></i></small></p>
<p class="mt-10 f-size-16"></p>
</div>

View File

@ -33,7 +33,6 @@ $_modelUser = new ModelUser(
DB_PASSWORD
);
/*
$_modelBlock = new ModelBlock(
DB_DATABASE,
DB_HOST,
@ -41,7 +40,6 @@ $_modelBlock = new ModelBlock(
DB_USER,
DB_PASSWORD
);
*/
// Route
if (isset($_GET['_route_'])) {