Browse Source

add network totals

main
ghost 3 years ago
parent
commit
4ee4b1f065
  1. 3
      src/application/controller/common/footer.php
  2. 15
      src/application/model/block.php
  3. 17
      src/application/model/user.php
  4. 1
      src/application/view/common/footer.phtml
  5. 2
      src/bootstrap.php

3
src/application/controller/common/footer.php

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

15
src/application/model/block.php

@ -2,6 +2,21 @@ @@ -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 {

17
src/application/model/user.php

@ -2,6 +2,21 @@ @@ -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 { @@ -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) {

1
src/application/view/common/footer.phtml

@ -1,6 +1,7 @@ @@ -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>

2
src/bootstrap.php

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

Loading…
Cancel
Save