Permalink
Browse files

Add background blur

  • Loading branch information...
NEMS Linux
NEMS Linux committed Dec 28, 2018
1 parent f594568 commit c363ae3ee6a692df929905d14d33428f9769cdac
Showing with 20 additions and 3 deletions.
  1. +9 −0 config/index.php
  2. +11 −3 inc/wallpaper.php
@@ -112,6 +112,7 @@
$nemsconf['alias'] = preg_replace("/&#?[a-z0-9]{2,8};/i","",sanitize($_POST['alias']));
$nemsconf['allowupdate'] = intval($_POST['allowupdate']) ?: 5;
$nemsconf['background'] = intval($_POST['background']) ?: 5;
$nemsconf['backgroundBlur'] = intval($_POST['backgroundBlur']) ?: 2;
$nemsconf['checkin.enabled'] = intval($_POST['checkin_enabled']) ?: 0;
$nemsconf['checkin.email'] = filter_var(trim($_POST['checkin_email']), FILTER_VALIDATE_EMAIL) ?: '';
$nemsconf['checkin.interval'] = intval($_POST['checkin_interval']) ?: 8; // how many 15 minute cycles before notifying. Default 8 (2 hours).
@@ -246,6 +247,14 @@ function sanitize($string) {
</select>
<i></i>
</label>
<label class="label">Blur Background</label>
<label class="select">
<select name="backgroundBlur">
<option value="2"<?php if (!isset($nemsconf['backgroundBlur']) || $nemsconf['backgroundBlur'] == 2) echo ' SELECTED'; ?>>Disabled</option>
<option value="1"<?php if (isset($nemsconf['backgroundBlur']) && $nemsconf['backgroundBlur'] == 1) echo ' SELECTED'; ?>>Enabled</option>
</select>
<i></i>
</label>
</section>
<?php } ?>
<?php
@@ -5,15 +5,19 @@
7 = color picker
8 = user uploaded
*/
// defaults
$background=5;
$backgroundBlur=2; // 2 = disabled, 1 = enabled
$conftmp = file('/usr/local/share/nems/nems.conf');
if (is_array($conftmp) && count($conftmp) > 0) {
foreach ($conftmp as $line) {
$tmp = explode('=',$line);
if (trim($tmp[0]) == 'background') {
$background=trim($tmp[1]);
break;
} else {
$background=5;
} elseif (trim($tmp[0]) == 'backgroundBlur') {
$backgroundBlur=trim($tmp[1]);
}
}
}
@@ -65,4 +69,8 @@
}
echo $output;
if ($backgroundBlur == 1) {
$bluramt = 15;
echo "<style>div.backstretch { -webkit-filter: blur(" . $bluramt . "px); -moz-filter: blur(" . $bluramt . "px); -o-filter: blur(" . $bluramt . "px); -ms-filter: blur(" . $bluramt . "px); filter: blur(" . $bluramt . "px); margin: -" . ($bluramt*2) . "px; }</style>";
}
?>

0 comments on commit c363ae3

Please sign in to comment.