php-mpos/public/include/pages/admin/dashboard.inc.php
Sebastian Grewe 2568ced4d4 [INITIAL] Working version checks
* Check DB structure version, config file version and MPOS core version
* Added new Admin Dashboard to show this core information
* Cronjobs will be disabled if SQL files are not imported
 * SQL files must re-set the db_upgrade_required setting
* Cronjobs will disabled if config files are not updated
 * Simple config file update and version string update will fix this
* Added MPOS status overview
 * Cronjobs and Wallet information for now, others may be added later
* Added new navigation link for Admin Panel Dashboard
* Added new version file
 * Will require updates whenever DB or configs are updated
* Update SQL file that adds the DB_VERSION setting

This will address #1242 and already includes a huge chunk of changes
required to make this work.
2014-01-05 11:19:09 +01:00

46 lines
1.5 KiB
PHP

<?php
// Make sure we are called from index.php
if (!defined('SECURITY')) die('Hacking attempt');
// Check user to ensure they are admin
if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
header("HTTP/1.1 404 Page not found");
die("404 Page not found");
}
if ($bitcoin->can_connect() === true){
$aGetInfo = $bitcoin->query('getinfo');
} else {
$aGetInfo = array('errors' => 'Unable to connect');
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to wallet RPC service: ' . $bitcoin->can_connect(), 'TYPE' => 'errormsg');
}
// Fetch version information
$version['CURRENT'] = array('DB' => DB_VERSION, 'CONFIG' => CONFIG_VERSION, 'CORE' => MPOS_VERSION);
$version['INSTALLED'] = array('DB' => $setting->getValue('DB_VERSION'), 'CONFIG' => $config['version'], 'CORE' => MPOS_VERSION);
// Fetch cron information
$aCrons = array('statistics','payouts','token_cleanup','archive_cleanup','blockupdate','findblock','notifications','tickerupdate');
// Data array for template
$cron_errors = 0;
$cron_disabled = 0;
foreach ($aCrons as $strCron) {
$status = $monitoring->getStatus($strCron . '_status');
$disabled = $monitoring->isDisabled($strCron);
if ($status['value'] != 0)
$cron_errors++;
if ($disabled['value'] == 1)
$cron_disabled++;
}
$smarty->assign('CRON_ERROR', $cron_errors);
$smarty->assign('CRON_DISABLED', $cron_disabled);
// Wallet status
$smarty->assign('WALLET_ERROR', $aGetInfo['errors']);
// Tempalte specifics
$smarty->assign('VERSION', $version);
$smarty->assign("CONTENT", "default.tpl");
?>