Fix health page not working #27
9 changed files with 183 additions and 143 deletions
2
boot.php
2
boot.php
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once 'include/session.php';
|
||||
|
||||
require_once 'vendor/autoload.php';
|
||||
|
||||
set_time_limit(0);
|
||||
|
|
|
@ -70,7 +70,7 @@ class dba
|
|||
|
||||
$r = array();
|
||||
if ($result->num_rows) {
|
||||
while ($x = $result->fetch_array(MYSQL_ASSOC)) {
|
||||
while ($x = $result->fetch_array(MYSQLI_ASSOC)) {
|
||||
$r[] = $x;
|
||||
}
|
||||
$result->free_result();
|
||||
|
|
|
@ -15,7 +15,6 @@ $db = new dba($db_host, $db_user, $db_pass, $db_data);
|
|||
|
||||
unset($db_host, $db_user, $db_pass, $db_data);
|
||||
|
||||
require_once 'session.php';
|
||||
require_once 'datetime.php';
|
||||
|
||||
if ($argc < 3) {
|
||||
|
|
|
@ -15,7 +15,6 @@ $db = new dba($db_host, $db_user, $db_pass, $db_data);
|
|||
|
||||
unset($db_host, $db_user, $db_pass, $db_data);
|
||||
|
||||
require_once 'session.php';
|
||||
require_once 'datetime.php';
|
||||
require_once 'simplepie/simplepie.inc';
|
||||
require_once 'include/items.php';
|
||||
|
|
|
@ -14,7 +14,6 @@ $db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
|
|||
|
||||
unset($db_host, $db_user, $db_pass, $db_data);
|
||||
|
||||
require_once 'session.php';
|
||||
require_once 'datetime.php';
|
||||
|
||||
$a->set_baseurl(get_config('system', 'url'));
|
||||
|
|
|
@ -30,10 +30,14 @@ function ref_session_write($id, $data)
|
|||
{
|
||||
global $session_exists, $session_expire;
|
||||
|
||||
if (!$id || !$data) {
|
||||
if (!$id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$data) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$expire = time() + $session_expire;
|
||||
$default_expire = time() + 300;
|
||||
|
||||
|
@ -65,7 +69,7 @@ function ref_session_gc($expire)
|
|||
{
|
||||
q("DELETE FROM `session` WHERE `expire` < %d", dbesc(time()));
|
||||
q("OPTIMIZE TABLE `sess_data`");
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,6 @@ unset($db_host, $db_user, $db_pass, $db_data);
|
|||
$a->init_pagehead();
|
||||
$a->page['aside'] = '<div id="logo"><img src="images/friendica-32.png" alt="friendica logo" /> <a href="http://friendica.com">Friendica</a></div><div id="slogan">Your friends. Your web.</div>';
|
||||
|
||||
require_once 'session.php';
|
||||
|
||||
session_start();
|
||||
|
||||
if ((x($_SESSION, 'authenticated')) || (x($_POST, 'auth-params')) || ($a->module === 'login')) {
|
||||
|
@ -75,8 +73,6 @@ if ($a->module_loaded) {
|
|||
if ((!$a->error) && (function_exists($a->module . '_content'))) {
|
||||
$func = $a->module . '_content';
|
||||
$a->page['content'] = $func($a);
|
||||
|
||||
killme();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
38
maintenance.html
Normal file
38
maintenance.html
Normal file
|
@ -0,0 +1,38 @@
|
|||
|
||||
<!DOCTYPE html >
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width,minimum-scale=1,maximum-scale=1">
|
||||
<link rel="search" type="application/opensearchdescription+xml" title="Friendica Directory" href="/opensearch" />
|
||||
|
||||
<title>Friendica Directory</title>
|
||||
<link rel="shortcut icon" href="/images/friendica-32.png" />
|
||||
<link rel="apple-touch-icon" href="/images/friendica-128.png"/>
|
||||
|
||||
<link href="/assets/css/style.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/assets/css/awesome/font-awesome.min.css?v=4.3.0" rel="stylesheet" type="text/css">
|
||||
|
||||
<script type="text/javascript" src="/assets/js/jquery/jquery.min.js?v=1.11.2"></script>
|
||||
<script type="text/javascript" src="/assets/js/main.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a class="hamburger mobile"><i class="fa fa-bars"></i></a>
|
||||
<nav id="links">
|
||||
<div class="viewport">
|
||||
</div>
|
||||
</nav>
|
||||
<div class="homepage-wrapper">
|
||||
<h1 class="header">
|
||||
Friendica <br> Directory
|
||||
</h1>
|
||||
<h2>
|
||||
Directory under maintenance
|
||||
</h2>
|
||||
|
||||
<p class="about">
|
||||
The Friendica Directory is unavailable at this time, please connect with <a href="https://friendica.mrpetovan.com/profile/hypolite">hypolite@friendica.mrpetovan.com</a> for updates about its status.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
269
mod/health.php
269
mod/health.php
|
@ -1,35 +1,32 @@
|
|||
<?php
|
||||
|
||||
require_once('include/site-health.php');
|
||||
require_once 'include/site-health.php';
|
||||
|
||||
function health_content(&$a) {
|
||||
|
||||
if($a->argc > 1){
|
||||
use Friendica\Directory\App;
|
||||
|
||||
function health_content(App $a)
|
||||
{
|
||||
if ($a->argc > 1) {
|
||||
return health_details($a, $a->argv[1]);
|
||||
}
|
||||
|
||||
if($_GET['s']){
|
||||
|
||||
if (isset($_GET['s']) && $_GET['s']) {
|
||||
return health_search($a, $_GET['s']);
|
||||
}
|
||||
|
||||
|
||||
return health_summary($a);
|
||||
|
||||
}
|
||||
|
||||
function health_search(&$a, $search)
|
||||
function health_search(App $a, $search)
|
||||
{
|
||||
|
||||
if(strlen($search) < 3){
|
||||
if (strlen($search) < 3) {
|
||||
$result = 'Please use at least 3 characters in your search';
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
} else {
|
||||
$r = q("SELECT * FROM `site-health` WHERE `base_url` LIKE '%%%s%%' ORDER BY `health_score` DESC LIMIT 100", dbesc($search));
|
||||
if(count($r)){
|
||||
if (count($r)) {
|
||||
$result = '';
|
||||
foreach($r as $site){
|
||||
|
||||
|
||||
foreach ($r as $site) {
|
||||
//Get user count.
|
||||
$site['users'] = 0;
|
||||
$r = q(
|
||||
|
@ -37,107 +34,105 @@ function health_search(&$a, $search)
|
|||
WHERE `homepage` LIKE '%s%%'",
|
||||
dbesc($site['base_url'])
|
||||
);
|
||||
if(count($r)){
|
||||
|
||||
if (count($r)) {
|
||||
$site['users'] = $r[0]['users'];
|
||||
}
|
||||
|
||||
|
||||
$result .=
|
||||
'<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>' : '').
|
||||
'<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>' : '') .
|
||||
"<br />\r\n";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
} else {
|
||||
$result = 'No results';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$tpl .= file_get_contents('view/health_search.tpl');
|
||||
|
||||
return replace_macros($tpl, array(
|
||||
'$searched' => $search,
|
||||
'$result' => $result
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
function health_summary(&$a){
|
||||
|
||||
function health_summary(App $a)
|
||||
{
|
||||
$sites = array();
|
||||
|
||||
|
||||
//Find the user count per site.
|
||||
$r = q("SELECT `homepage` FROM `profile`");
|
||||
if(count($r)) {
|
||||
foreach($r as $rr) {
|
||||
if (count($r)) {
|
||||
foreach ($r as $rr) {
|
||||
$site = parse_site_from_url($rr['homepage']);
|
||||
if($site) {
|
||||
if(!isset($sites[$site]))
|
||||
$sites[$site] = 0;
|
||||
if ($site) {
|
||||
if (!isset($sites[$site])) {
|
||||
$sites[$site] = 0;
|
||||
}
|
||||
$sites[$site] ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//See if we have a health for them AND they provide SSL.
|
||||
$sites_with_health = array();
|
||||
$site_healths = array();
|
||||
|
||||
|
||||
$r = q("SELECT * FROM `site-health` WHERE `reg_policy`='REGISTER_OPEN' AND `ssl_state` = 1");
|
||||
if(count($r)) {
|
||||
foreach($r as $rr) {
|
||||
$sites_with_health[$rr['base_url']] = (($sites[$rr['base_url']] / 100) + 10) * intval($rr['health_score']);
|
||||
$site_healths[$rr['base_url']] = $rr;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
arsort($sites_with_health);
|
||||
$total = 0;
|
||||
$public_sites = '';
|
||||
foreach($sites_with_health as $k => $v)
|
||||
{
|
||||
|
||||
foreach ($sites_with_health as $k => $v) {
|
||||
//Stop at unhealthy sites.
|
||||
$site = $site_healths[$k];
|
||||
if($site['health_score'] <= 20) break;
|
||||
|
||||
if ($site['health_score'] <= 20) {
|
||||
break;
|
||||
}
|
||||
|
||||
//Skip small sites.
|
||||
$users = $sites[$k];
|
||||
if($users < 5) continue;
|
||||
|
||||
if ($users < 5) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$public_sites .=
|
||||
'<span class="health '.health_score_to_name($site['health_score']).'">♥</span> '.
|
||||
'<a href="/health/'.$site['id'].'">' . $k . '</a> '.
|
||||
'(' . $users . ')'.
|
||||
'<span class="health ' . health_score_to_name($site['health_score']) . '">♥</span> ' .
|
||||
'<a href="/health/' . $site['id'] . '">' . $k . '</a> ' .
|
||||
'(' . $users . ')' .
|
||||
"<br />\r\n";
|
||||
$total ++;
|
||||
|
||||
}
|
||||
$public_sites .= "<br>Total: $total<br />\r\n";
|
||||
|
||||
$tpl .= file_get_contents('view/health_summary.tpl');
|
||||
|
||||
$tpl = file_get_contents('view/health_summary.tpl');
|
||||
|
||||
return replace_macros($tpl, array(
|
||||
'$versions' => $versions,
|
||||
'$public_sites' => $public_sites
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
function health_details($a, $id)
|
||||
function health_details(App $a, $id)
|
||||
{
|
||||
|
||||
//Max data age in MySQL date.
|
||||
$maxDate = date('Y-m-d H:i:s', time()-($a->config['stats']['maxDataAge']));
|
||||
|
||||
$maxDate = date('Y-m-d H:i:s', time() - ($a->config['stats']['maxDataAge']));
|
||||
|
||||
//Include graphael line charts.
|
||||
$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;
|
||||
$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;
|
||||
$a->page['htmlhead'] .= '<script type="text/javascript">
|
||||
window.smoothingFactor = 0.3;
|
||||
window.smoothingBracket = 2;
|
||||
|
@ -165,49 +160,50 @@ function health_details($a, $id)
|
|||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
//The overall health status.
|
||||
$r = q(
|
||||
"SELECT * FROM `site-health`
|
||||
WHERE `id`=%u",
|
||||
intval($id)
|
||||
);
|
||||
if(!count($r)){
|
||||
if (!count($r)) {
|
||||
$a->error = 404;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$site = $r[0];
|
||||
|
||||
|
||||
//Does it redirect to a known site?
|
||||
$redirectStatement = '';
|
||||
if($site['effective_base_url']){
|
||||
|
||||
if ($site['effective_base_url']) {
|
||||
//The effective health status.
|
||||
$r = q(
|
||||
"SELECT * FROM `site-health`
|
||||
![]() Why is "versions" vanished? Why is "versions" vanished?
![]() I have no idea, the variable didn't exist in the controller nor in the template. I have no idea, the variable didn't exist in the controller nor in the template.
![]() Okay. When you had checked that, then It's fine for me. Okay. When you had checked that, then It's fine for me.
|
||||
WHERE `base_url`= '%s'",
|
||||
dbesc($site['effective_base_url'])
|
||||
);
|
||||
if(count($r)){
|
||||
$redirectStatement = '<a href="/health/'.$r[0]['id'].'">Redirects to '.$site['effective_base_url'].'</a>';
|
||||
if (count($r)) {
|
||||
$redirectStatement = '<a href="/health/' . $r[0]['id'] . '">Redirects to ' . $site['effective_base_url'] . '</a>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Figure out SSL state.
|
||||
$urlMeta = parse_url($site['base_url']);
|
||||
if($urlMeta['scheme'] !== 'https'){
|
||||
if ($urlMeta['scheme'] !== 'https') {
|
||||
$ssl_state = 'No';
|
||||
}else{
|
||||
} else {
|
||||
switch ($site['ssl_state']) {
|
||||
case null: $ssl_state = 'Yes, but not yet verified.'; break;
|
||||
case '0': $ssl_state = 'Certificate error!'; break;
|
||||
case '1': $ssl_state = '√ Yes, verified.'; break;
|
||||
case null: $ssl_state = 'Yes, but not yet verified.';
|
||||
break;
|
||||
case '0': $ssl_state = 'Certificate error!';
|
||||
break;
|
||||
case '1': $ssl_state = '√ Yes, verified.';
|
||||
break;
|
||||
}
|
||||
$ssl_state .= ' <a href="https://www.ssllabs.com/ssltest/analyze.html?d='.$urlMeta['host'].'" target="_blank">Detailed test</a>';
|
||||
$ssl_state .= ' <a href="https://www.ssllabs.com/ssltest/analyze.html?d=' . $urlMeta['host'] . '" target="_blank">Detailed test</a>';
|
||||
}
|
||||
|
||||
|
||||
//Get user count.
|
||||
$site['users'] = 0;
|
||||
$r = q(
|
||||
|
@ -215,10 +211,10 @@ function health_details($a, $id)
|
|||
WHERE `homepage` LIKE '%s%%'",
|
||||
dbesc($site['base_url'])
|
||||
);
|
||||
if(count($r)){
|
||||
if (count($r)) {
|
||||
$site['users'] = $r[0]['users'];
|
||||
}
|
||||
|
||||
|
||||
//Get avg probe speed.
|
||||
$r = q(
|
||||
"SELECT AVG(`request_time`) as `avg_probe_time` FROM `site-probe`
|
||||
|
@ -227,10 +223,10 @@ function health_details($a, $id)
|
|||
intval($site['id']),
|
||||
$maxDate
|
||||
);
|
||||
if(count($r)){
|
||||
if (count($r)) {
|
||||
$site['avg_probe_time'] = $r[0]['avg_probe_time'];
|
||||
}
|
||||
|
||||
|
||||
//Get scraping / submit speeds.
|
||||
$r = q(
|
||||
"SELECT
|
||||
|
@ -244,13 +240,13 @@ function health_details($a, $id)
|
|||
intval($site['id']),
|
||||
$maxDate
|
||||
);
|
||||
if(count($r)){
|
||||
if (count($r)) {
|
||||
$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'];
|
||||
}
|
||||
|
||||
|
||||
//Get probe speed data.
|
||||
$r = q(
|
||||
"SELECT AVG(`request_time`) as `avg_time`, date(`dt_performed`) as `date` FROM `site-probe`
|
||||
|
@ -260,34 +256,38 @@ function health_details($a, $id)
|
|||
intval($site['id']),
|
||||
$maxDate
|
||||
);
|
||||
if(count($r)){
|
||||
if (count($r)) {
|
||||
//Include graphael line charts.
|
||||
$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>';
|
||||
$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>';
|
||||
|
||||
$speeds = array();
|
||||
$times = array();
|
||||
$mintime = time();
|
||||
foreach($r as $row){
|
||||
|
||||
foreach ($r as $row) {
|
||||
$speeds[] = $row['avg_time'];
|
||||
$time = strtotime($row['date']);
|
||||
$times[] = $time;
|
||||
if($mintime > $time) $mintime = $time;
|
||||
if ($mintime > $time)
|
||||
$mintime = $time;
|
||||
}
|
||||
for($i=0; $i < count($times); $i++){
|
||||
|
||||
for ($i = 0; $i < count($times); $i++) {
|
||||
$times[$i] -= $mintime;
|
||||
$times[$i] = floor($times[$i] / (24*3600));
|
||||
$times[$i] = floor($times[$i] / (24 * 3600));
|
||||
}
|
||||
|
||||
$a->page['htmlhead'] .=
|
||||
'<script type="text/javascript">
|
||||
(function(){
|
||||
|
||||
var x = ['.implode(',', $times).'];
|
||||
var y = ['.implode(',', $speeds).'];
|
||||
var x = [' . implode(',', $times) . '];
|
||||
var y = [' . implode(',', $speeds) . '];
|
||||
var smoothY = Smoothing.exponentialMovingAverage(y, smoothingFactor, smoothingBracket);
|
||||
|
||||
|
||||
availableCharts.push(function($){
|
||||
|
||||
|
||||
var id = "probe-chart";
|
||||
$("#"+id+" svg").remove();
|
||||
var r = Raphael(id);
|
||||
|
@ -295,16 +295,14 @@ function health_details($a, $id)
|
|||
if(drawRaw){
|
||||
values.push(y);
|
||||
}
|
||||
|
||||
|
||||
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));
|
||||
|
||||
});
|
||||
|
||||
})();
|
||||
</script>';
|
||||
}
|
||||
|
||||
|
||||
//Get scrape speed data.
|
||||
$r = q(
|
||||
"SELECT AVG(`total_time`) as `avg_time`, date(`dt_performed`) as `date` FROM `site-scrape`
|
||||
|
@ -314,34 +312,38 @@ function health_details($a, $id)
|
|||
intval($site['id']),
|
||||
$maxDate
|
||||
);
|
||||
if($r && count($r)){
|
||||
if ($r && count($r)) {
|
||||
//Include graphael line charts.
|
||||
$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>';
|
||||
$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>';
|
||||
|
||||
$speeds = array();
|
||||
$times = array();
|
||||
$mintime = time();
|
||||
foreach($r as $row){
|
||||
|
||||
foreach ($r as $row) {
|
||||
$speeds[] = $row['avg_time'];
|
||||
$time = strtotime($row['date']);
|
||||
$times[] = $time;
|
||||
if($mintime > $time) $mintime = $time;
|
||||
if ($mintime > $time)
|
||||
$mintime = $time;
|
||||
}
|
||||
for($i=0; $i < count($times); $i++){
|
||||
|
||||
for ($i = 0; $i < count($times); $i++) {
|
||||
$times[$i] -= $mintime;
|
||||
$times[$i] = floor($times[$i] / (24*3600));
|
||||
$times[$i] = floor($times[$i] / (24 * 3600));
|
||||
}
|
||||
|
||||
$a->page['htmlhead'] .=
|
||||
'<script type="text/javascript">
|
||||
(function(){
|
||||
|
||||
var x = ['.implode(',', $times).'];
|
||||
var y = ['.implode(',', $speeds).'];
|
||||
var x = [' . implode(',', $times) . '];
|
||||
var y = [' . implode(',', $speeds) . '];
|
||||
var smoothY = Smoothing.exponentialMovingAverage(y, smoothingFactor, smoothingBracket);
|
||||
|
||||
|
||||
availableCharts.push(function($){
|
||||
|
||||
|
||||
var id = "scrape-chart";
|
||||
$("#"+id+" svg").remove();
|
||||
var r = Raphael(id);
|
||||
|
@ -349,25 +351,25 @@ function health_details($a, $id)
|
|||
if(drawRaw){
|
||||
values.push(y);
|
||||
}
|
||||
|
||||
|
||||
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));
|
||||
|
||||
|
||||
});
|
||||
|
||||
})();
|
||||
</script>';
|
||||
}
|
||||
|
||||
|
||||
//Nice name for registration policy.
|
||||
switch ($site['reg_policy']) {
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
$tpl .= file_get_contents('view/health_details.tpl');
|
||||
|
||||
$tpl = file_get_contents('view/health_details.tpl');
|
||||
|
||||
return replace_macros($tpl, array(
|
||||
'$name' => $site['name'],
|
||||
'$redirectStatement' => $redirectStatement,
|
||||
|
@ -393,3 +395,4 @@ function health_details($a, $id)
|
|||
'$avg_photo_time' => round($site['avg_photo_time']),
|
||||
'$avg_submit_time' => round($site['avg_submit_time'])
|
||||
));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue
I'm confused: Hadn't you added this here with the other PR as well?