1
0

selftest on admin page (WIP)

This commit is contained in:
2020-01-19 01:22:06 +01:00
parent 86648149e5
commit 335fc764e8
16 changed files with 540 additions and 58 deletions

View File

@@ -245,4 +245,34 @@ function formatException($e)
}
return 'object';
}
}
function array_key_map_unique(array $array, string $key)
{
$r = [];
foreach ($array as $d) if (!in_array($d[$key], $r)) $r []= $d[$key];
return $r;
}
function array_key_map(array $array, string $key)
{
$r = [];
foreach ($array as $d) $r []= $d[$key];
return $r;
}
function curl_http_request($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$output = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$redirect = curl_getinfo($ch, CURLINFO_REDIRECT_URL);
curl_close($ch);
return [ 'output'=>$output, 'statuscode'=>$httpcode, 'redirect'=>$redirect ];
}