Skip to content
Permalink
Browse files

Colorize based on day's color

  • Loading branch information...
NEMS Linux
NEMS Linux committed Feb 25, 2019
1 parent 5f2ab96 commit 4fbc796b4a77320effc2ce70070d531f49d62b0a
Showing with 33 additions and 16 deletions.
  1. +0 −5 config/index.php
  2. +0 −8 config/services.php
  3. +28 −0 inc/bgcolor.php
  4. +3 −3 inc/header.php
  5. +2 −0 init.php
@@ -718,11 +718,6 @@ function sanitize($string) {
if (checkConfEnabled('monitorix') == true) $checked = 'CHECKED="CHECKED"'; else $checked = '';
echo '<label class="toggle text-right"><input ' . $checked . ' name="monitorix" type="checkbox" class="services reboot"><i></i>Monitorix</label>';
if (ver('nems') >= 1.4) {
if (checkConfEnabled('cockpit') == true) $checked = 'CHECKED="CHECKED"'; else $checked = '';
echo '<label class="toggle text-right"><input ' . $checked . ' name="cockpit" type="checkbox" class="services reboot"><i></i>Cockpit</label>';
}
if (ver('nems') >= 1.4) {
if (checkConfEnabled('tvpw') == true) $checked = 'CHECKED="CHECKED"'; else $checked = '';
echo '<label class="toggle text-right"><input ' . $checked . ' name="tvpw" type="checkbox" class="services"><i></i>Allow TV Dashboard Without Password</label>';
@@ -37,14 +37,6 @@
}
break;
case 'cockpit':
if ($_POST['value'] == 'off') {
$config['service.' . $name] = 0;
} elseif ($_POST['value'] == 'on') {
$config['service.' . $name] = 1;
}
break;
case 'rpi-monitor':
if ($_POST['value'] == 'off') {
$config['service.' . $name] = 0;
@@ -0,0 +1,28 @@
<?php
$defaultbgcolor = '040111';
$key = strtotime('today');
// caches the response each day
$cachefile = '/tmp/bgcolor-' . $key;
if (file_exists($cachefile)) {
$result = trim(file_get_contents($cachefile));
} else {
$json_url = 'https://cloud.nemslinux.com/bgcolor/' . $key . '.json';
$ch = curl_init( $json_url );
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
);
curl_setopt_array( $ch, $options );
$result = curl_exec($ch);
file_put_contents($cachefile,$result);
}
$resultobj = json_decode($result);
if (isset($resultobj->$key)) {
$bgcolor = $resultobj->$key;
} else {
$bgcolor = $defaultbgcolor;
}
?>
@@ -1,5 +1,5 @@
<?php
$bgcolor = '040111';
require_once('bgcolor.php');
?><!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
@@ -116,7 +116,7 @@ function resizeIframe(obj) {
<?php if (ver('nems') >= 1.4) echo '<li><a href="/mobile/" target="_blank">NEMS Mobile UI</a></li>'; ?>
<?php if (ver('nems') >= 1.4) echo '<li><a href="/tv/" target="_blank">NEMS TV Dashboard</a></li>'; ?>

<li><h4 style="padding: 0 0 4px 4px; margin-bottom: 0;">Legacy</h4></li>
<li><h4 style="padding: 0 0 4px 4px; margin: 0;">Legacy</h4></li>
<?php
if (ver('nems') >= 1.4) {
echo '<li><a href="/nagios/" target="_blank">Nagios Core</a></li>';
@@ -138,7 +138,7 @@ function resizeIframe(obj) {

<ul class="dropdown-menu">
<?php if (checkConfEnabled('monitorix')) { echo '<li><a href="/monitorix/">Monitorix</a></li>'; } ?>
<?php if (ver('nems') >= 1.4 && checkConfEnabled('cockpit')) echo '<li><a href="https://' . $self->host . ':9090" target="_blank">Cockpit</a></li>'; ?>
<?php if (ver('nems') >= 1.4) echo '<li><a href="https://' . $self->host . ':9090" target="_blank">Cockpit</a></li>'; ?>
<?php if ((ver('platform')->num < 10) && checkConfEnabled('rpi-monitor')) { echo '<li><a href="http://' . $self->host . ':8888" target="_blank">RPi-Monitor</a></li>'; } ?>
<?php if (ver('nems') <= 1.4 && checkConfEnabled('webmin')) { echo '<li><a href="https://' . $self->host . ':10000" target="_blank">Webmin</a></li>'; } ?>
<?php if (ver('nems') >= 1.3) echo '<li><a href="https://' . $self->host . ':2812" target="_blank"><em>monit</em> Service Monitor</a></li>'; ?>
@@ -2,6 +2,7 @@
if (isset($functions_loaded) && $functions_loaded == 1) {
$ip = trim(shell_exec('/usr/local/bin/nems-info ip'));
$platform = ver('platform');
require_once('inc/bgcolor.php');
?><!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
@@ -17,6 +18,7 @@

<!-- Favicon -->
<link rel="shortcut icon" href="/favicon.ico">
<meta name="theme-color" content="#<?= $bgcolor ?>">

<!-- Web Fonts -->
<link rel='stylesheet' type='text/css' href='//fonts.googleapis.com/css?family=Open+Sans:400,300,600&amp;subset=cyrillic,latin'>

0 comments on commit 4fbc796

Please sign in to comment.
You can’t perform that action at this time.