Basic code style prettiness.

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