2014-07-10 23:43:25 +02:00
|
|
|
<?php
|
|
|
|
|
2017-08-02 03:06:33 +02:00
|
|
|
require_once 'include/site-health.php';
|
2014-07-10 23:43:25 +02:00
|
|
|
|
2017-08-02 03:06:33 +02:00
|
|
|
use Friendica\Directory\App;
|
|
|
|
|
|
|
|
function health_content(App $a)
|
|
|
|
{
|
|
|
|
if ($a->argc > 1) {
|
2014-07-10 23:43:25 +02:00
|
|
|
return health_details($a, $a->argv[1]);
|
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
|
|
|
if (isset($_GET['s']) && $_GET['s']) {
|
2014-07-10 23:43:25 +02:00
|
|
|
return health_search($a, $_GET['s']);
|
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
return health_summary($a);
|
|
|
|
}
|
|
|
|
|
2017-08-02 03:06:33 +02:00
|
|
|
function health_search(App $a, $search)
|
2014-07-10 23:43:25 +02:00
|
|
|
{
|
2017-08-02 03:06:33 +02:00
|
|
|
if (strlen($search) < 3) {
|
2014-07-10 23:43:25 +02:00
|
|
|
$result = 'Please use at least 3 characters in your search';
|
2017-08-02 03:06:33 +02:00
|
|
|
} else {
|
2014-07-10 23:43:25 +02:00
|
|
|
$r = q("SELECT * FROM `site-health` WHERE `base_url` LIKE '%%%s%%' ORDER BY `health_score` DESC LIMIT 100", dbesc($search));
|
2017-08-02 03:06:33 +02:00
|
|
|
if (count($r)) {
|
2014-07-10 23:43:25 +02:00
|
|
|
$result = '';
|
2017-08-02 03:06:33 +02:00
|
|
|
|
|
|
|
foreach ($r as $site) {
|
2014-07-10 23:43:25 +02:00
|
|
|
//Get user count.
|
|
|
|
$site['users'] = 0;
|
|
|
|
$r = q(
|
|
|
|
"SELECT COUNT(*) as `users` FROM `profile`
|
|
|
|
WHERE `homepage` LIKE '%s%%'",
|
|
|
|
dbesc($site['base_url'])
|
|
|
|
);
|
2017-08-02 03:06:33 +02:00
|
|
|
|
|
|
|
if (count($r)) {
|
2014-07-10 23:43:25 +02:00
|
|
|
$site['users'] = $r[0]['users'];
|
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
$result .=
|
2017-08-02 03:06:33 +02:00
|
|
|
'<span class="health ' . health_score_to_name($site['health_score']) . '">♥</span> ' .
|
|
|
|
'<a href="/health/' . $site['id'] . '">' . $site['base_url'] . '</a> ' .
|
|
|
|
'(' . $site['users'] . ')' .
|
|
|
|
($site['effective_base_url'] ? ' -> <abbr title="Redirects to this domain.">' . $site['effective_base_url'] . '</abbr>' : '') .
|
2014-07-10 23:43:25 +02:00
|
|
|
"<br />\r\n";
|
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
} else {
|
2014-07-10 23:43:25 +02:00
|
|
|
$result = 'No results';
|
|
|
|
}
|
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
$tpl .= file_get_contents('view/health_search.tpl');
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
return replace_macros($tpl, array(
|
|
|
|
'$searched' => $search,
|
|
|
|
'$result' => $result
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
2017-08-02 03:06:33 +02:00
|
|
|
function health_summary(App $a)
|
|
|
|
{
|
2014-07-10 23:43:25 +02:00
|
|
|
$sites = array();
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
//Find the user count per site.
|
2015-02-02 12:28:12 +01:00
|
|
|
$r = q("SELECT `homepage` FROM `profile`");
|
2017-08-02 03:06:33 +02:00
|
|
|
if (count($r)) {
|
|
|
|
foreach ($r as $rr) {
|
2014-07-10 23:43:25 +02:00
|
|
|
$site = parse_site_from_url($rr['homepage']);
|
2017-08-02 03:06:33 +02:00
|
|
|
if ($site) {
|
|
|
|
if (!isset($sites[$site])) {
|
|
|
|
$sites[$site] = 0;
|
|
|
|
}
|
2014-07-10 23:43:25 +02:00
|
|
|
$sites[$site] ++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2015-02-02 12:28:12 +01:00
|
|
|
//See if we have a health for them AND they provide SSL.
|
2014-07-10 23:43:25 +02:00
|
|
|
$sites_with_health = array();
|
|
|
|
$site_healths = array();
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2015-02-02 12:28:12 +01:00
|
|
|
$r = q("SELECT * FROM `site-health` WHERE `reg_policy`='REGISTER_OPEN' AND `ssl_state` = 1");
|
2017-08-02 03:06:33 +02:00
|
|
|
if (count($r)) {
|
|
|
|
foreach ($r as $rr) {
|
|
|
|
if (isset($sites[$rr['base_url']])) {
|
|
|
|
$sites_with_health[$rr['base_url']] = (($sites[$rr['base_url']] / 100) + 10) * intval($rr['health_score']);
|
|
|
|
$site_healths[$rr['base_url']] = $rr;
|
|
|
|
}
|
2014-07-10 23:43:25 +02:00
|
|
|
}
|
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
arsort($sites_with_health);
|
|
|
|
$total = 0;
|
|
|
|
$public_sites = '';
|
2017-08-02 03:06:33 +02:00
|
|
|
foreach ($sites_with_health as $k => $v) {
|
2014-07-10 23:43:25 +02:00
|
|
|
//Stop at unhealthy sites.
|
|
|
|
$site = $site_healths[$k];
|
2017-08-02 03:06:33 +02:00
|
|
|
if ($site['health_score'] <= 20) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
//Skip small sites.
|
|
|
|
$users = $sites[$k];
|
2017-08-02 03:06:33 +02:00
|
|
|
if ($users < 5) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
$public_sites .=
|
2017-08-02 03:06:33 +02:00
|
|
|
'<span class="health ' . health_score_to_name($site['health_score']) . '">♥</span> ' .
|
|
|
|
'<a href="/health/' . $site['id'] . '">' . $k . '</a> ' .
|
|
|
|
'(' . $users . ')' .
|
2014-07-10 23:43:25 +02:00
|
|
|
"<br />\r\n";
|
|
|
|
$total ++;
|
|
|
|
}
|
|
|
|
$public_sites .= "<br>Total: $total<br />\r\n";
|
2017-08-02 03:06:33 +02:00
|
|
|
|
|
|
|
$tpl = file_get_contents('view/health_summary.tpl');
|
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
return replace_macros($tpl, array(
|
|
|
|
'$public_sites' => $public_sites
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
2017-08-02 03:06:33 +02:00
|
|
|
function health_details(App $a, $id)
|
2014-07-10 23:43:25 +02:00
|
|
|
{
|
2015-01-24 21:49:53 +01:00
|
|
|
//Max data age in MySQL date.
|
2017-08-02 03:06:33 +02:00
|
|
|
$maxDate = date('Y-m-d H:i:s', time() - ($a->config['stats']['maxDataAge']));
|
|
|
|
|
2015-01-24 21:49:53 +01:00
|
|
|
//Include graphael line charts.
|
2017-08-02 03:06:33 +02:00
|
|
|
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/assets/js/raphael/smoothing.js"></script>' . PHP_EOL;
|
|
|
|
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/assets/js/raphael/raphael.js"></script>' . PHP_EOL;
|
|
|
|
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/assets/js/raphael/g_raphael.js"></script>' . PHP_EOL;
|
|
|
|
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/assets/js/raphael/g_line-min.js"></script>' . PHP_EOL;
|
2015-01-24 21:49:53 +01:00
|
|
|
$a->page['htmlhead'] .= '<script type="text/javascript">
|
|
|
|
window.smoothingFactor = 0.3;
|
|
|
|
window.smoothingBracket = 2;
|
|
|
|
window.availableCharts = [];
|
|
|
|
window.drawRaw = false;
|
|
|
|
window.drawCharts = function(){
|
|
|
|
for (var i = availableCharts.length - 1; i >= 0; i--) {
|
|
|
|
availableCharts[i](jQuery);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
window.onHoverPoint = function(r){ return function(){
|
|
|
|
this.tags = r.set();
|
|
|
|
var i = this.y.length-1;
|
|
|
|
this.tags.push(r.popup(this.x, this.y[i], Math.round(this.values[i])+"ms", "right", 5).insertBefore(this));
|
|
|
|
}};
|
|
|
|
window.onUnHoverPoint = function(r){ return function(){
|
|
|
|
this.tags && this.tags.remove();
|
|
|
|
}};
|
|
|
|
jQuery(function($){
|
|
|
|
drawCharts();
|
|
|
|
$(".js-toggle-raw").click(function(e){
|
|
|
|
e.preventDefault();
|
|
|
|
drawRaw=!drawRaw;
|
|
|
|
drawCharts();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>';
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
//The overall health status.
|
|
|
|
$r = q(
|
|
|
|
"SELECT * FROM `site-health`
|
|
|
|
WHERE `id`=%u",
|
|
|
|
intval($id)
|
|
|
|
);
|
2017-08-02 03:06:33 +02:00
|
|
|
if (!count($r)) {
|
2014-07-10 23:43:25 +02:00
|
|
|
$a->error = 404;
|
|
|
|
return;
|
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
$site = $r[0];
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2015-02-02 12:28:12 +01:00
|
|
|
//Does it redirect to a known site?
|
|
|
|
$redirectStatement = '';
|
2017-08-02 03:06:33 +02:00
|
|
|
if ($site['effective_base_url']) {
|
2015-02-02 12:28:12 +01:00
|
|
|
//The effective health status.
|
|
|
|
$r = q(
|
|
|
|
"SELECT * FROM `site-health`
|
|
|
|
WHERE `base_url`= '%s'",
|
|
|
|
dbesc($site['effective_base_url'])
|
|
|
|
);
|
2017-08-02 03:06:33 +02:00
|
|
|
if (count($r)) {
|
|
|
|
$redirectStatement = '<a href="/health/' . $r[0]['id'] . '">Redirects to ' . $site['effective_base_url'] . '</a>';
|
2015-02-02 12:28:12 +01:00
|
|
|
}
|
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
//Figure out SSL state.
|
|
|
|
$urlMeta = parse_url($site['base_url']);
|
2017-08-02 03:06:33 +02:00
|
|
|
if ($urlMeta['scheme'] !== 'https') {
|
2014-07-10 23:43:25 +02:00
|
|
|
$ssl_state = 'No';
|
2017-08-02 03:06:33 +02:00
|
|
|
} else {
|
2014-07-10 23:43:25 +02:00
|
|
|
switch ($site['ssl_state']) {
|
2017-08-02 03:06:33 +02:00
|
|
|
case null: $ssl_state = 'Yes, but not yet verified.';
|
|
|
|
break;
|
|
|
|
case '0': $ssl_state = 'Certificate error!';
|
|
|
|
break;
|
|
|
|
case '1': $ssl_state = '√ Yes, verified.';
|
|
|
|
break;
|
2014-07-10 23:43:25 +02:00
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
$ssl_state .= ' <a href="https://www.ssllabs.com/ssltest/analyze.html?d=' . $urlMeta['host'] . '" target="_blank">Detailed test</a>';
|
2014-07-10 23:43:25 +02:00
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
//Get user count.
|
|
|
|
$site['users'] = 0;
|
|
|
|
$r = q(
|
|
|
|
"SELECT COUNT(*) as `users` FROM `profile`
|
|
|
|
WHERE `homepage` LIKE '%s%%'",
|
|
|
|
dbesc($site['base_url'])
|
|
|
|
);
|
2017-08-02 03:06:33 +02:00
|
|
|
if (count($r)) {
|
2014-07-10 23:43:25 +02:00
|
|
|
$site['users'] = $r[0]['users'];
|
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
//Get avg probe speed.
|
|
|
|
$r = q(
|
|
|
|
"SELECT AVG(`request_time`) as `avg_probe_time` FROM `site-probe`
|
2015-02-02 12:28:12 +01:00
|
|
|
WHERE `site_health_id` = %u
|
|
|
|
AND `dt_performed` > '%s'",
|
|
|
|
intval($site['id']),
|
|
|
|
$maxDate
|
2014-07-10 23:43:25 +02:00
|
|
|
);
|
2017-08-02 03:06:33 +02:00
|
|
|
if (count($r)) {
|
2014-07-10 23:43:25 +02:00
|
|
|
$site['avg_probe_time'] = $r[0]['avg_probe_time'];
|
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
//Get scraping / submit speeds.
|
|
|
|
$r = q(
|
|
|
|
"SELECT
|
|
|
|
AVG(`request_time`) as `avg_profile_time`,
|
|
|
|
AVG(`scrape_time`) as `avg_scrape_time`,
|
|
|
|
AVG(`photo_time`) as `avg_photo_time`,
|
|
|
|
AVG(`total_time`) as `avg_submit_time`
|
|
|
|
FROM `site-scrape`
|
2015-02-02 12:28:12 +01:00
|
|
|
WHERE `site_health_id` = %u
|
|
|
|
AND `dt_performed` > '%s'",
|
|
|
|
intval($site['id']),
|
|
|
|
$maxDate
|
2014-07-10 23:43:25 +02:00
|
|
|
);
|
2017-08-02 03:06:33 +02:00
|
|
|
if (count($r)) {
|
2014-07-10 23:43:25 +02:00
|
|
|
$site['avg_profile_time'] = $r[0]['avg_profile_time'];
|
|
|
|
$site['avg_scrape_time'] = $r[0]['avg_scrape_time'];
|
|
|
|
$site['avg_photo_time'] = $r[0]['avg_photo_time'];
|
|
|
|
$site['avg_submit_time'] = $r[0]['avg_submit_time'];
|
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
//Get probe speed data.
|
|
|
|
$r = q(
|
2015-01-24 21:49:53 +01:00
|
|
|
"SELECT AVG(`request_time`) as `avg_time`, date(`dt_performed`) as `date` FROM `site-probe`
|
|
|
|
WHERE `site_health_id` = %u
|
|
|
|
AND `dt_performed` > '%s'
|
|
|
|
GROUP BY `date`",
|
|
|
|
intval($site['id']),
|
|
|
|
$maxDate
|
2014-07-10 23:43:25 +02:00
|
|
|
);
|
2017-08-02 03:06:33 +02:00
|
|
|
if (count($r)) {
|
2014-07-10 23:43:25 +02:00
|
|
|
//Include graphael line charts.
|
2017-08-02 03:06:33 +02:00
|
|
|
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/js/raphael/raphael.js"></script>' . PHP_EOL;
|
|
|
|
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/js/raphael/g_raphael.js"></script>' . PHP_EOL;
|
|
|
|
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/js/raphael/g_line.js?v=0.51"></script>';
|
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
$speeds = array();
|
|
|
|
$times = array();
|
|
|
|
$mintime = time();
|
2017-08-02 03:06:33 +02:00
|
|
|
|
|
|
|
foreach ($r as $row) {
|
2015-01-24 21:49:53 +01:00
|
|
|
$speeds[] = $row['avg_time'];
|
|
|
|
$time = strtotime($row['date']);
|
2014-07-10 23:43:25 +02:00
|
|
|
$times[] = $time;
|
2017-08-02 03:06:33 +02:00
|
|
|
if ($mintime > $time)
|
|
|
|
$mintime = $time;
|
2014-07-10 23:43:25 +02:00
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
|
|
|
for ($i = 0; $i < count($times); $i++) {
|
2014-07-10 23:43:25 +02:00
|
|
|
$times[$i] -= $mintime;
|
2017-08-02 03:06:33 +02:00
|
|
|
$times[$i] = floor($times[$i] / (24 * 3600));
|
2014-07-10 23:43:25 +02:00
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
$a->page['htmlhead'] .=
|
|
|
|
'<script type="text/javascript">
|
2015-02-02 12:28:12 +01:00
|
|
|
(function(){
|
2017-08-02 03:06:33 +02:00
|
|
|
var x = [' . implode(',', $times) . '];
|
|
|
|
var y = [' . implode(',', $speeds) . '];
|
2015-01-24 21:49:53 +01:00
|
|
|
var smoothY = Smoothing.exponentialMovingAverage(y, smoothingFactor, smoothingBracket);
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2015-02-02 12:28:12 +01:00
|
|
|
availableCharts.push(function($){
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2015-02-02 12:28:12 +01:00
|
|
|
var id = "probe-chart";
|
|
|
|
$("#"+id+" svg").remove();
|
|
|
|
var r = Raphael(id);
|
|
|
|
var values = [smoothY];
|
|
|
|
if(drawRaw){
|
|
|
|
values.push(y);
|
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2015-02-02 12:28:12 +01:00
|
|
|
r.linechart(30, 15, 400, 295, x, values, {axis:"0 0 1 1", shade:true, width:0.8, axisxstep:6})
|
|
|
|
.hoverColumn(onHoverPoint(r), onUnHoverPoint(r));
|
|
|
|
});
|
|
|
|
})();
|
2014-07-10 23:43:25 +02:00
|
|
|
</script>';
|
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
//Get scrape speed data.
|
|
|
|
$r = q(
|
|
|
|
"SELECT AVG(`total_time`) as `avg_time`, date(`dt_performed`) as `date` FROM `site-scrape`
|
2015-01-24 21:49:53 +01:00
|
|
|
WHERE `site_health_id` = %u
|
|
|
|
AND `dt_performed` > '%s'
|
|
|
|
GROUP BY `date`",
|
|
|
|
intval($site['id']),
|
|
|
|
$maxDate
|
2014-07-10 23:43:25 +02:00
|
|
|
);
|
2017-08-02 03:06:33 +02:00
|
|
|
if ($r && count($r)) {
|
2014-07-10 23:43:25 +02:00
|
|
|
//Include graphael line charts.
|
2017-08-02 03:06:33 +02:00
|
|
|
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/js/raphael/raphael.js"></script>' . PHP_EOL;
|
|
|
|
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/js/raphael/g_raphael.js"></script>' . PHP_EOL;
|
|
|
|
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/js/raphael/g_line.js?v=0.51"></script>';
|
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
$speeds = array();
|
|
|
|
$times = array();
|
|
|
|
$mintime = time();
|
2017-08-02 03:06:33 +02:00
|
|
|
|
|
|
|
foreach ($r as $row) {
|
2014-07-10 23:43:25 +02:00
|
|
|
$speeds[] = $row['avg_time'];
|
|
|
|
$time = strtotime($row['date']);
|
|
|
|
$times[] = $time;
|
2017-08-02 03:06:33 +02:00
|
|
|
if ($mintime > $time)
|
|
|
|
$mintime = $time;
|
2014-07-10 23:43:25 +02:00
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
|
|
|
for ($i = 0; $i < count($times); $i++) {
|
2014-07-10 23:43:25 +02:00
|
|
|
$times[$i] -= $mintime;
|
2017-08-02 03:06:33 +02:00
|
|
|
$times[$i] = floor($times[$i] / (24 * 3600));
|
2014-07-10 23:43:25 +02:00
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
$a->page['htmlhead'] .=
|
|
|
|
'<script type="text/javascript">
|
2015-02-02 12:28:12 +01:00
|
|
|
(function(){
|
2017-08-02 03:06:33 +02:00
|
|
|
var x = [' . implode(',', $times) . '];
|
|
|
|
var y = [' . implode(',', $speeds) . '];
|
2015-01-24 21:49:53 +01:00
|
|
|
var smoothY = Smoothing.exponentialMovingAverage(y, smoothingFactor, smoothingBracket);
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2015-02-02 12:28:12 +01:00
|
|
|
availableCharts.push(function($){
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2015-02-02 12:28:12 +01:00
|
|
|
var id = "scrape-chart";
|
|
|
|
$("#"+id+" svg").remove();
|
|
|
|
var r = Raphael(id);
|
|
|
|
var values = [smoothY];
|
|
|
|
if(drawRaw){
|
|
|
|
values.push(y);
|
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2015-02-02 12:28:12 +01:00
|
|
|
r.linechart(30, 15, 400, 295, x, values, {shade:true, axis:"0 0 1 1", width:0.8, axisxstep:6})
|
|
|
|
.hoverColumn(onHoverPoint(r), onUnHoverPoint(r));
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2015-02-02 12:28:12 +01:00
|
|
|
});
|
|
|
|
})();
|
2014-07-10 23:43:25 +02:00
|
|
|
</script>';
|
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
2014-08-09 00:49:00 +02:00
|
|
|
//Nice name for registration policy.
|
|
|
|
switch ($site['reg_policy']) {
|
2017-08-02 03:06:33 +02:00
|
|
|
case 'REGISTER_OPEN': $policy = "Open"; break;
|
|
|
|
case 'REGISTER_APPROVE': $policy = "Admin approved"; break;
|
|
|
|
case 'REGISTER_CLOSED': $policy = "Closed"; break;
|
|
|
|
default: $policy = $site['reg_policy']; break;
|
2014-08-09 00:49:00 +02:00
|
|
|
}
|
2017-08-02 03:06:33 +02:00
|
|
|
|
|
|
|
$tpl = file_get_contents('view/health_details.tpl');
|
|
|
|
|
2014-07-10 23:43:25 +02:00
|
|
|
return replace_macros($tpl, array(
|
|
|
|
'$name' => $site['name'],
|
2015-02-02 12:28:12 +01:00
|
|
|
'$redirectStatement' => $redirectStatement,
|
2014-08-09 00:49:00 +02:00
|
|
|
'$policy' => $policy,
|
|
|
|
'$site_info' => $site['info'],
|
2014-07-10 23:43:25 +02:00
|
|
|
'$base_url' => $site['base_url'],
|
|
|
|
'$health_score' => $site['health_score'],
|
|
|
|
'$health_name' => health_score_to_name($site['health_score']),
|
|
|
|
'$no_scrape_support' => !empty($site['no_scrape_url']) ? '√ Supports noscrape' : '',
|
|
|
|
'$dt_first_noticed' => $site['dt_first_noticed'],
|
|
|
|
'$dt_last_seen' => $site['dt_last_seen'],
|
|
|
|
'$version' => $site['version'],
|
|
|
|
'$plugins' => $site['plugins'],
|
|
|
|
'$reg_policy' => $site['reg_policy'],
|
|
|
|
'$info' => $site['info'],
|
|
|
|
'$admin_name' => $site['admin_name'],
|
|
|
|
'$admin_profile' => $site['admin_profile'],
|
|
|
|
'$users' => $site['users'],
|
|
|
|
'$ssl_state' => $ssl_state,
|
|
|
|
'$avg_probe_time' => round($site['avg_probe_time']),
|
|
|
|
'$avg_profile_time' => round($site['avg_profile_time']),
|
|
|
|
'$avg_scrape_time' => round($site['avg_scrape_time']),
|
|
|
|
'$avg_photo_time' => round($site['avg_photo_time']),
|
|
|
|
'$avg_submit_time' => round($site['avg_submit_time'])
|
|
|
|
));
|
2017-08-02 03:06:33 +02:00
|
|
|
}
|