Permalink
Browse files

Continued improvement of wallpaper system

  • Loading branch information...
NEMS Linux
NEMS Linux committed Dec 29, 2018
1 parent 05e4515 commit 2bf1b4f3e450dda8e535a915abb751d55a47f1b6
Showing with 5 additions and 4 deletions.
  1. +1 −0 inc/functions.php
  2. +4 −4 inc/wallpaper.php
@@ -4,6 +4,7 @@
$alias = shell_exec('/usr/local/bin/nems-info alias');
function ver($product='nems') {
$platform = new stdClass();
$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
@@ -31,8 +31,9 @@
case 6:
$key = strtotime('today');
// caches the response each day
if (file_exists('/tmp/wallpaper-' . $key)) {
$result = trim(file_get_contents('/tmp/wallpaper-' . $key));
$cachefile = '/tmp/wallpaper-' . $key;
if (file_exists($cachefile)) {
$result = trim(file_get_contents($cachefile));
} else {
$json_url = 'https://cloud.nemslinux.com/wallpaper/' . $key . '.json';
$ch = curl_init( $json_url );
@@ -42,7 +43,7 @@
);
curl_setopt_array( $ch, $options );
$result = curl_exec($ch);
file_put_contents('/tmp/wallpaper-' . $key,$result);
file_put_contents($cachefile,$result);
}
$resultobj = json_decode($result);
if (isset($resultobj->$key)) {
@@ -51,7 +52,6 @@
$img = $defaultimg;
}
$output = "<script>jQuery(document).ready(function() {
$('" . $backgroundElem . "').backstretch([
'" . $img . "',

0 comments on commit 2bf1b4f

Please sign in to comment.