$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Secure.php";
function addLog($line) {echo "";}
readfile("$docroot/logging.htm");
$var = parse_ini_file('state/var.ini');
$url = unscript($_GET['url']??'');
$parsed_url = parse_url($url);
if (isset($parsed_url['host']) && ($parsed_url['host']=="keys.lime-technology.com" || $parsed_url['host']=="lime-technology.com")) {
addLog("Downloading $url ... ");
$key_file = basename($url);
exec("/usr/bin/wget -q -O ".escapeshellarg("/boot/config/$key_file")." ".escapeshellarg($url), $output, $return_var);
if ($return_var === 0) {
if ($var['mdState'] == "STARTED")
addLog("
Installing ... Please Stop array to complete key installation.
");
else
addLog("
Installed ...
");
}
else {
addLog("ERROR ($return_var)
");
}
}
else
addLog("ERROR, bad or missing key file URL: $url
");
?>