Commit ce0dc6d6 authored by Franco Fichtner's avatar Franco Fichtner

widgets: consolidate code path

parent e60769ef
......@@ -40,14 +40,14 @@ if ($_POST['action'] == 'pkg_update') {
configd_run('firmware pkgstatus');
}
$file_pkg_status="/tmp/pkg_status.json";
if (file_exists($file_pkg_status)) {
if ($_REQUEST['getupdatestatus']) {
$file_pkg_status="/tmp/pkg_status.json";
if (file_exists($file_pkg_status)) {
$json = file_get_contents($file_pkg_status);
$pkg_status = json_decode($json, true);
unlink($file_pkg_status);
}
}
if ($_REQUEST['getupdatestatus']) {
if (isset($pkg_status)) {
if ($pkg_status["connection"]=="error") {
echo "<span class='text-danger'>".gettext("Connection Error")."</span><br/><span class='btn-link' onclick='checkupdate()'>".gettext("Click to retry")."</span>";
......@@ -59,7 +59,7 @@ if ($_REQUEST['getupdatestatus']) {
echo "<span class='text-danger'>".gettext("There are ").$pkg_status["updates"].gettext(" update(s) available.")."<br/><span class='text-info'><small>(When last checked at: ".$pkg_status["last_check"]." )</small></span>"."</span><br/><a href='/ui/core/firmware/'>".gettext("Click to upgrade")."</a> | <span class='btn-link' onclick='checkupdate()'>Re-check now</span>";
}
} else {
echo "</span><br/><span class='btn-link' onclick='checkupdate()'>".gettext("Click to check for updates")."</span>";
echo "<span class='btn-link' onclick='checkupdate()'>".gettext("Click to check for updates")."</span>";
}
exit;
}
......
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