Basic code style prettiness.

parent c805aaa8
......@@ -14,8 +14,8 @@ if (!in_array(PHP_SAPI, ['cgi-fcgi', 'cli'])) {
}
}
use DetectLanguage\DetectLanguage;
use GeoIp2\Database\Reader;
use \DetectLanguage\DetectLanguage;
use Poduptime\PodStatus;
use RedBeanPHP\R;
......@@ -36,7 +36,7 @@ $sqldebug && R::fancyDebug(true);
DetectLanguage::setApiKey(c('dlkey'));
$hour = date("H");
$hour = date('H');
try {
// Setup GeoIP Database
......@@ -100,7 +100,7 @@ foreach ($pods as $pod) {
$link = "https://{$domain}/nodeinfo/1.0";
extract(_curl("https://{$domain}/.well-known/nodeinfo"));
$outputwellknown = $curl_body;
$outputwellknown = $curl_body;
if ($outputwellknown !== false) {
$info = json_decode($outputwellknown, true);
......@@ -128,7 +128,7 @@ foreach ($pods as $pod) {
$jsonssl = ($outputssl ? json_decode($outputssl) : null);
if ($jsonssl !== null) {
$version = $jsonssl->software->version ?? 0;
$version = $jsonssl->software->version ?? 0;
preg_match_all('((?:\d(.|-)?)+(\.)\d+\.*)', $version, $sversion);
$shortversion = $sversion[0][0] ?? '0.0.0.0';
$signup = ($jsonssl->openRegistrations ?? false) === true;
......@@ -254,15 +254,13 @@ foreach ($pods as $pod) {
$d = new DOMDocument;
libxml_use_internal_errors(true);
extract(_curl("https://{$domain}/"));
$outputbody = $curl_body;
$outputbody = $curl_body;
($outputbody ? $d->loadHTML($outputbody) : $d->loadHTML('<html></html>'));
$hs = '';
for($type=1; $type<6; $type++)
{
$h_es = $d->getElementsByTagName('h'.$type);
foreach($h_es as $h)
{
for ($type = 1; $type < 6; $type++) {
$h_es = $d->getElementsByTagName('h' . $type);
foreach ($h_es as $h) {
if (strpos($h->textContent, 'JavaScript') === false) {
$hs .= $h->textContent . ' ';
}
......@@ -274,7 +272,7 @@ foreach ($pods as $pod) {
} elseif ($hs) {
$detectedlanguage = $language;
} else {
$score -= 1;
$score -= 1;
$detectedlanguage = null;
}
......@@ -373,7 +371,7 @@ foreach ($pods as $pod) {
if ($score > 100) {
$score = 100;
} elseif ($score < 0) {
$score = 0;
$score = 0;
$status = PodStatus::SYSTEM_DELETED;
}
$weightedscore = ($uptime + $score - (10 - $weight)) / 2;
......@@ -478,7 +476,7 @@ function _curl($url)
'curl_error' => curl_error($chss),
'curl_info' => curl_getinfo($chss, CURLINFO_CERTINFO),
'curl_conntime' => curl_getinfo($chss, CURLINFO_CONNECT_TIME),
'curl_nstime' => curl_getinfo($chss, CURLINFO_NAMELOOKUP_TIME)
'curl_nstime' => curl_getinfo($chss, CURLINFO_NAMELOOKUP_TIME),
];
curl_close($chss);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment