[UPDATE] Adding missing files
@ -33,8 +33,18 @@ if ($price = $tools->getPrice()) {
|
||||
if (!$setting->setValue('price', $price))
|
||||
$log->logError("unable to update value in settings table");
|
||||
} else {
|
||||
$log->logFatal("failed to fetch API data: " . $tools->getError());
|
||||
$log->logError("failed to fetch API data: " . $tools->getError());
|
||||
}
|
||||
|
||||
if ($setting->getValue('monitoring_uptimerobot_private_key')) {
|
||||
$monitoring->setTools($tools);
|
||||
if (!$monitoring->storeUptimeRobotStatus()) {
|
||||
$log->logError('Failed to update Uptime Robot Status: ' . $monitoring->getError());
|
||||
}
|
||||
} else {
|
||||
$log->logDebug('Skipped Uptime Robot API update, missing private key');
|
||||
}
|
||||
|
||||
|
||||
require_once('cron_end.inc.php');
|
||||
?>
|
||||
|
||||
@ -41,6 +41,9 @@ class Base {
|
||||
public function setSetting($setting) {
|
||||
$this->setting = $setting;
|
||||
}
|
||||
public function setTools($tools) {
|
||||
$this->tools = $tools;
|
||||
}
|
||||
public function setBitcoin($bitcoin) {
|
||||
$this->bitcoin = $bitcoin;
|
||||
}
|
||||
|
||||
@ -4,13 +4,32 @@
|
||||
if (!defined('SECURITY'))
|
||||
die('Hacking attempt');
|
||||
|
||||
class Monitoring {
|
||||
public function __construct($debug, $mysqli) {
|
||||
$this->debug = $debug;
|
||||
$this->mysqli = $mysqli;
|
||||
class Monitoring extends Base {
|
||||
public function __construct() {
|
||||
$this->table = 'monitoring';
|
||||
}
|
||||
|
||||
public function storeUptimeRobotStatus() {
|
||||
if ($api_key = $this->setting->getValue('monitoring_uptimerobot_private_key')) {
|
||||
$url = 'http://api.uptimerobot.com';
|
||||
$target = '/getMonitors?apiKey=' . $api_key . '&format=json&noJsonCallback=1&customUptimeRatio=1&logs=1';
|
||||
if (!$json = json_encode($this->tools->getApi($url, $target))) {
|
||||
$this->setErrorMessage('Failed to run API call: ' . $this->tools->getError());
|
||||
return false;
|
||||
}
|
||||
if (!$this->setting->setValue('monitoring_uptimerobot_status', $json)) {
|
||||
$this->setErrorMessage('Failed to store uptime status: ' . $setting->getError());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getUptimeRobotStatus() {
|
||||
if ($json = $this->setting->getValue('monitoring_uptimerobot_status'))
|
||||
return json_decode($json, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a value from our table
|
||||
* @param name string Setting name
|
||||
@ -46,4 +65,8 @@ class Monitoring {
|
||||
}
|
||||
}
|
||||
|
||||
$monitoring = new Monitoring($debug, $mysqli);
|
||||
$monitoring = new Monitoring();
|
||||
$monitoring->setConfig($config);
|
||||
$monitoring->setDebug($debug);
|
||||
$monitoring->setMysql($mysqli);
|
||||
$monitoring->setSetting($setting);
|
||||
|
||||
@ -1,15 +1,10 @@
|
||||
<?php
|
||||
|
||||
// Make sure we are called from index.php
|
||||
if (!defined('SECURITY'))
|
||||
die('Hacking attempt');
|
||||
if (!defined('SECURITY')) die('Hacking attempt');
|
||||
|
||||
class Setting {
|
||||
public function __construct($debug, $mysqli) {
|
||||
$this->debug = $debug;
|
||||
$this->mysqli = $mysqli;
|
||||
$this->table = 'settings';
|
||||
}
|
||||
class Setting extends Base {
|
||||
protected $table = 'settings';
|
||||
|
||||
/**
|
||||
* Fetch a value from our table
|
||||
@ -51,3 +46,5 @@ class Setting {
|
||||
}
|
||||
|
||||
$setting = new Setting($debug, $mysqli);
|
||||
$setting->setDebug($debug);
|
||||
$setting->setMysql($mysqli);
|
||||
|
||||
@ -17,7 +17,7 @@ class Tools extends Base {
|
||||
* @param auth array Optional authentication data to be sent with
|
||||
* @return dec array JSON decoded PHP array
|
||||
**/
|
||||
private function getApi($url, $target, $auth=NULL) {
|
||||
public function getApi($url, $target, $auth=NULL) {
|
||||
static $ch = null;
|
||||
static $ch = null;
|
||||
if (is_null($ch)) {
|
||||
|
||||
@ -172,6 +172,13 @@ $aSettings['acl'][] = array(
|
||||
'name' => 'acl_round_statistics', 'value' => $setting->getValue('acl_round_statistics'),
|
||||
'tooltip' => 'Make the round statistics page private (users only) or public.'
|
||||
);
|
||||
$aSettings['acl'][] = array(
|
||||
'display' => 'Uptime Statistics', 'type' => 'select',
|
||||
'options' => array( 0 => 'Private', 1 => 'Public'),
|
||||
'default' => 1,
|
||||
'name' => 'acl_uptime_statistics', 'value' => $setting->getValue('acl_uptime_statistics'),
|
||||
'tooltip' => 'Make the uptime statistics page private (users only) or public.'
|
||||
);
|
||||
$aSettings['system'][] = array(
|
||||
'display' => 'Disable e-mail confirmations', 'type' => 'select',
|
||||
'options' => array( 0 => 'No', 1 => 'Yes' ),
|
||||
@ -249,5 +256,12 @@ $aSettings['recaptcha'][] = array(
|
||||
'name' => 'recaptcha_public_key', 'value' => $setting->getValue('recaptcha_public_key'),
|
||||
'tooltip' => 'Your public key as given by your re-Captcha account.'
|
||||
);
|
||||
$aSettings['monitoring'][] = array(
|
||||
'display' => 'Uptime Robot Private API Key', 'type' => 'text',
|
||||
'size' => 25,
|
||||
'default' => 'MAIN_API_KEY',
|
||||
'name' => 'monitoring_uptimerobot_private_key', 'value' => $setting->getValue('monitoring_uptimerobot_private_key'),
|
||||
'tooltip' => 'Your private key. You can find it in your account as the Main API Key.'
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
28
public/include/pages/statistics/uptime.inc.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
// Make sure we are called from index.php
|
||||
if (!defined('SECURITY')) die('Hacking attempt');
|
||||
|
||||
if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
|
||||
$debug->append('No cached version available, fetching from backend', 3);
|
||||
if ($setting->getValue('monitoring_uptimerobot_private_key')) {
|
||||
if ($aStatus = $monitoring->getUptimeRobotStatus()) {
|
||||
$smarty->assign("STATUS", $aStatus);
|
||||
$smarty->assign("CODES", array(
|
||||
0 => 'Paused',
|
||||
1 => 'Unchecked',
|
||||
2 => 'Up',
|
||||
8 => 'Down',
|
||||
9 => 'Down'
|
||||
));
|
||||
}
|
||||
$smarty->assign("CONTENT", "default.tpl");
|
||||
} else {
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'UptimeRobot API Key not configured.', 'TYPE' => 'info');
|
||||
$smarty->assign("CONTENT", "");
|
||||
}
|
||||
} else {
|
||||
$debug->append('Using cached page', 3);
|
||||
}
|
||||
|
||||
?>
|
||||
@ -96,6 +96,7 @@ $setting->getValue('website_chaininfo_url') ? $aGlobal['website']['chaininfo']['
|
||||
$aGlobal['acl']['pool']['statistics'] = $setting->getValue('acl_pool_statistics');
|
||||
$aGlobal['acl']['block']['statistics'] = $setting->getValue('acl_block_statistics');
|
||||
$aGlobal['acl']['round']['statistics'] = $setting->getValue('acl_round_statistics');
|
||||
$aGlobal['acl']['uptime']['statistics'] = $setting->getValue('acl_uptime_statistics');
|
||||
|
||||
// We don't want these session infos cached
|
||||
if (@$_SESSION['USERDATA']['id']) {
|
||||
@ -165,5 +166,6 @@ $smarty->assign('DEBUG', DEBUG);
|
||||
|
||||
// Make it available in Smarty
|
||||
$smarty->assign('PATH', 'site_assets/' . THEME);
|
||||
$smarty->assign('GLOBALASSETS', 'site_assets/global');
|
||||
$smarty->assign('GLOBAL', $aGlobal);
|
||||
?>
|
||||
|
||||
BIN
public/site_assets/global/images/flags/ad.png
Executable file
|
After Width: | Height: | Size: 643 B |
BIN
public/site_assets/global/images/flags/ae.png
Executable file
|
After Width: | Height: | Size: 408 B |
BIN
public/site_assets/global/images/flags/af.png
Executable file
|
After Width: | Height: | Size: 604 B |
BIN
public/site_assets/global/images/flags/ag.png
Executable file
|
After Width: | Height: | Size: 591 B |
BIN
public/site_assets/global/images/flags/ai.png
Executable file
|
After Width: | Height: | Size: 643 B |
BIN
public/site_assets/global/images/flags/al.png
Executable file
|
After Width: | Height: | Size: 600 B |
BIN
public/site_assets/global/images/flags/am.png
Executable file
|
After Width: | Height: | Size: 497 B |
BIN
public/site_assets/global/images/flags/an.png
Executable file
|
After Width: | Height: | Size: 488 B |
BIN
public/site_assets/global/images/flags/ao.png
Normal file
|
After Width: | Height: | Size: 428 B |
BIN
public/site_assets/global/images/flags/ar.png
Executable file
|
After Width: | Height: | Size: 506 B |
BIN
public/site_assets/global/images/flags/as.png
Executable file
|
After Width: | Height: | Size: 647 B |
BIN
public/site_assets/global/images/flags/at.png
Executable file
|
After Width: | Height: | Size: 403 B |
BIN
public/site_assets/global/images/flags/au.png
Executable file
|
After Width: | Height: | Size: 673 B |
BIN
public/site_assets/global/images/flags/aw.png
Executable file
|
After Width: | Height: | Size: 524 B |
BIN
public/site_assets/global/images/flags/ax.png
Executable file
|
After Width: | Height: | Size: 663 B |
BIN
public/site_assets/global/images/flags/az.png
Executable file
|
After Width: | Height: | Size: 589 B |
BIN
public/site_assets/global/images/flags/ba.png
Executable file
|
After Width: | Height: | Size: 593 B |
BIN
public/site_assets/global/images/flags/bb.png
Executable file
|
After Width: | Height: | Size: 585 B |
BIN
public/site_assets/global/images/flags/bd.png
Executable file
|
After Width: | Height: | Size: 504 B |
BIN
public/site_assets/global/images/flags/be.png
Executable file
|
After Width: | Height: | Size: 449 B |
BIN
public/site_assets/global/images/flags/bf.png
Executable file
|
After Width: | Height: | Size: 497 B |
BIN
public/site_assets/global/images/flags/bg.png
Executable file
|
After Width: | Height: | Size: 462 B |
BIN
public/site_assets/global/images/flags/bh.png
Executable file
|
After Width: | Height: | Size: 457 B |
BIN
public/site_assets/global/images/flags/bi.png
Executable file
|
After Width: | Height: | Size: 675 B |
BIN
public/site_assets/global/images/flags/bj.png
Executable file
|
After Width: | Height: | Size: 486 B |
BIN
public/site_assets/global/images/flags/bm.png
Executable file
|
After Width: | Height: | Size: 611 B |
BIN
public/site_assets/global/images/flags/bn.png
Executable file
|
After Width: | Height: | Size: 639 B |
BIN
public/site_assets/global/images/flags/bo.png
Executable file
|
After Width: | Height: | Size: 500 B |
BIN
public/site_assets/global/images/flags/br.png
Executable file
|
After Width: | Height: | Size: 593 B |
BIN
public/site_assets/global/images/flags/bs.png
Executable file
|
After Width: | Height: | Size: 526 B |
BIN
public/site_assets/global/images/flags/bt.png
Executable file
|
After Width: | Height: | Size: 631 B |
BIN
public/site_assets/global/images/flags/bv.png
Executable file
|
After Width: | Height: | Size: 512 B |
BIN
public/site_assets/global/images/flags/bw.png
Executable file
|
After Width: | Height: | Size: 443 B |
BIN
public/site_assets/global/images/flags/by.png
Executable file
|
After Width: | Height: | Size: 514 B |
BIN
public/site_assets/global/images/flags/bz.png
Executable file
|
After Width: | Height: | Size: 600 B |
BIN
public/site_assets/global/images/flags/ca.png
Executable file
|
After Width: | Height: | Size: 628 B |
BIN
public/site_assets/global/images/flags/catalonia.png
Normal file
|
After Width: | Height: | Size: 398 B |
BIN
public/site_assets/global/images/flags/cc.png
Executable file
|
After Width: | Height: | Size: 625 B |
BIN
public/site_assets/global/images/flags/cd.png
Normal file
|
After Width: | Height: | Size: 528 B |
BIN
public/site_assets/global/images/flags/cf.png
Executable file
|
After Width: | Height: | Size: 614 B |
BIN
public/site_assets/global/images/flags/cg.png
Executable file
|
After Width: | Height: | Size: 521 B |
BIN
public/site_assets/global/images/flags/ch.png
Executable file
|
After Width: | Height: | Size: 367 B |
BIN
public/site_assets/global/images/flags/ci.png
Executable file
|
After Width: | Height: | Size: 453 B |
BIN
public/site_assets/global/images/flags/ck.png
Executable file
|
After Width: | Height: | Size: 586 B |
BIN
public/site_assets/global/images/flags/cl.png
Executable file
|
After Width: | Height: | Size: 450 B |
BIN
public/site_assets/global/images/flags/cm.png
Executable file
|
After Width: | Height: | Size: 525 B |
BIN
public/site_assets/global/images/flags/cn.png
Executable file
|
After Width: | Height: | Size: 472 B |
BIN
public/site_assets/global/images/flags/co.png
Executable file
|
After Width: | Height: | Size: 483 B |
BIN
public/site_assets/global/images/flags/cr.png
Executable file
|
After Width: | Height: | Size: 477 B |
BIN
public/site_assets/global/images/flags/cs.png
Executable file
|
After Width: | Height: | Size: 439 B |
BIN
public/site_assets/global/images/flags/cu.png
Executable file
|
After Width: | Height: | Size: 563 B |
BIN
public/site_assets/global/images/flags/cv.png
Executable file
|
After Width: | Height: | Size: 529 B |
BIN
public/site_assets/global/images/flags/cx.png
Executable file
|
After Width: | Height: | Size: 608 B |
BIN
public/site_assets/global/images/flags/cy.png
Executable file
|
After Width: | Height: | Size: 428 B |
BIN
public/site_assets/global/images/flags/cz.png
Executable file
|
After Width: | Height: | Size: 476 B |
BIN
public/site_assets/global/images/flags/de.png
Executable file
|
After Width: | Height: | Size: 545 B |
BIN
public/site_assets/global/images/flags/dj.png
Executable file
|
After Width: | Height: | Size: 572 B |
BIN
public/site_assets/global/images/flags/dk.png
Executable file
|
After Width: | Height: | Size: 495 B |
BIN
public/site_assets/global/images/flags/dm.png
Executable file
|
After Width: | Height: | Size: 620 B |
BIN
public/site_assets/global/images/flags/do.png
Executable file
|
After Width: | Height: | Size: 508 B |
BIN
public/site_assets/global/images/flags/dz.png
Executable file
|
After Width: | Height: | Size: 582 B |
BIN
public/site_assets/global/images/flags/ec.png
Executable file
|
After Width: | Height: | Size: 500 B |
BIN
public/site_assets/global/images/flags/ee.png
Executable file
|
After Width: | Height: | Size: 429 B |
BIN
public/site_assets/global/images/flags/eg.png
Executable file
|
After Width: | Height: | Size: 465 B |
BIN
public/site_assets/global/images/flags/eh.png
Executable file
|
After Width: | Height: | Size: 508 B |
BIN
public/site_assets/global/images/flags/england.png
Executable file
|
After Width: | Height: | Size: 496 B |
BIN
public/site_assets/global/images/flags/er.png
Executable file
|
After Width: | Height: | Size: 653 B |
BIN
public/site_assets/global/images/flags/es.png
Executable file
|
After Width: | Height: | Size: 469 B |
BIN
public/site_assets/global/images/flags/et.png
Executable file
|
After Width: | Height: | Size: 592 B |
BIN
public/site_assets/global/images/flags/europeanunion.png
Normal file
|
After Width: | Height: | Size: 479 B |
BIN
public/site_assets/global/images/flags/fam.png
Executable file
|
After Width: | Height: | Size: 532 B |
BIN
public/site_assets/global/images/flags/fi.png
Executable file
|
After Width: | Height: | Size: 489 B |
BIN
public/site_assets/global/images/flags/fj.png
Executable file
|
After Width: | Height: | Size: 610 B |
BIN
public/site_assets/global/images/flags/fk.png
Executable file
|
After Width: | Height: | Size: 648 B |
BIN
public/site_assets/global/images/flags/fm.png
Executable file
|
After Width: | Height: | Size: 552 B |
BIN
public/site_assets/global/images/flags/fo.png
Executable file
|
After Width: | Height: | Size: 474 B |
BIN
public/site_assets/global/images/flags/fr.png
Executable file
|
After Width: | Height: | Size: 545 B |
BIN
public/site_assets/global/images/flags/ga.png
Executable file
|
After Width: | Height: | Size: 489 B |
BIN
public/site_assets/global/images/flags/gb.png
Normal file
|
After Width: | Height: | Size: 599 B |
BIN
public/site_assets/global/images/flags/gd.png
Executable file
|
After Width: | Height: | Size: 637 B |
BIN
public/site_assets/global/images/flags/ge.png
Executable file
|
After Width: | Height: | Size: 594 B |
BIN
public/site_assets/global/images/flags/gf.png
Executable file
|
After Width: | Height: | Size: 545 B |
BIN
public/site_assets/global/images/flags/gh.png
Executable file
|
After Width: | Height: | Size: 490 B |
BIN
public/site_assets/global/images/flags/gi.png
Executable file
|
After Width: | Height: | Size: 463 B |
BIN
public/site_assets/global/images/flags/gl.png
Executable file
|
After Width: | Height: | Size: 470 B |
BIN
public/site_assets/global/images/flags/gm.png
Executable file
|
After Width: | Height: | Size: 493 B |
BIN
public/site_assets/global/images/flags/gn.png
Executable file
|
After Width: | Height: | Size: 480 B |
BIN
public/site_assets/global/images/flags/gp.png
Executable file
|
After Width: | Height: | Size: 488 B |
BIN
public/site_assets/global/images/flags/gq.png
Executable file
|
After Width: | Height: | Size: 537 B |
BIN
public/site_assets/global/images/flags/gr.png
Executable file
|
After Width: | Height: | Size: 487 B |
BIN
public/site_assets/global/images/flags/gs.png
Executable file
|
After Width: | Height: | Size: 630 B |
BIN
public/site_assets/global/images/flags/gt.png
Executable file
|
After Width: | Height: | Size: 493 B |