Merge pull request #418 from bergware/master

GUI enhancements
This commit is contained in:
tom mortensen
2018-12-26 14:22:19 -08:00
committed by GitHub
156 changed files with 2321 additions and 1566 deletions

View File

@@ -1,10 +1,10 @@
Menu="UPSsettings"
Title="UPS Details"
Tag="battery-0"
Tag="battery-3"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
* Copyright 2015, Dan Landon.
*
* This program is free software; you can redistribute it and/or

View File

@@ -1,7 +1,7 @@
Menu="OtherSettings"
Type="xmenu"
Title="UPS Settings"
Icon="dynamix.apcupsd.png"
Icon="icon-ups"
Tag="battery-3"
---
<?PHP

View File

@@ -1,10 +1,11 @@
Menu="Dashboard:2"
Title="UPS Summary"
Tag="battery-3"
Cond="file_exists('/var/run/apcupsd.pid')"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
* Copyright 2015, Dan Landon.
*
* This program is free software; you can redistribute it and/or

View File

@@ -1,5 +1,5 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
/* Copyright 2005-2018, Lime Technology
* Copyright 2015, Dan Landon.
* Copyright 2015, Bergware International.
*

View File

@@ -1,5 +1,5 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
/* Copyright 2005-2018, Lime Technology
* Copyright 2015, Dan Landon.
* Copyright 2015, Bergware International.
*

View File

@@ -3,8 +3,8 @@ Cond="(pgrep('dockerd')!==false)"
Markdown="false"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2014-2017, Guilherme Jardim, Eric Schultz, Jon Panozzo.
/* Copyright 2005-2018, Lime Technology
* Copyright 2014-2018, Guilherme Jardim, Eric Schultz, Jon Panozzo.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,6 +1,6 @@
Menu="Tasks:60"
Type="xmenu"
Code="f100"
Code="e90b"
Cond="exec(\"grep -o '^DOCKER_ENABLED=.yes' /boot/config/docker.cfg 2>/dev/null\")"
----
<?PHP

View File

@@ -4,8 +4,8 @@ Tag="clone"
Cond="(pgrep('dockerd')!==false)"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2014-2017, Guilherme Jardim, Eric Schultz, Jon Panozzo.
/* Copyright 2005-2018, Lime Technology
* Copyright 2014-2018, Guilherme Jardim, Eric Schultz, Jon Panozzo.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,7 +1,7 @@
Menu="OtherSettings"
Title="Docker"
Icon="dynamix.docker.manager.png"
Tag="docker"
Icon="icon-docker"
Tag="icon-docker"
---
<?PHP
/* Copyright 2005-2018, Lime Technology

View File

@@ -3,8 +3,8 @@ Cond="(pgrep('dockerd')!==false)"
Markdown="false"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2014-2017, Guilherme Jardim, Eric Schultz, Jon Panozzo.
/* Copyright 2005-2018, Lime Technology
* Copyright 2014-2018, Guilherme Jardim, Eric Schultz, Jon Panozzo.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -42,7 +42,7 @@ pre{font-family:bitstream;font-size:1.3rem}
<script type="text/javascript" src="<?autov('/webGui/javascript/dynamix.js')?>"></script>
<script>
$(function(){
$('div.spinner').html('<?=file_get_contents("$docroot/webGui/images/animated-logo.svg")?>');
$('div.spinner').html('<?readfile("$docroot/webGui/images/animated-logo.svg")?>');
$.get('/plugins/dynamix.docker.manager/include/GetContainerSize.php',function(data){
$('div.spinner').hide();
$('#data').text(data);

View File

@@ -1,7 +1,7 @@
#!/usr/bin/php
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2014-2017, Guilherme Jardim, Eric Schultz, Jon Panozzo.
/* Copyright 2005-2018, Lime Technology
* Copyright 2014-2018, Guilherme Jardim, Eric Schultz, Jon Panozzo.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -3,8 +3,8 @@ Title="Install Plugin"
Tag="download"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,9 +1,9 @@
Menu="Tasks:50"
Type="xmenu"
Title="Installed Plugins"
Tag="puzzle-piece"
Tag="icon-plugins"
Tabs="true"
Code="f1e6"
Code="e944"
---
<?PHP
/* Copyright 2005-2018, Lime Technology
@@ -64,7 +64,7 @@ function loadlist(id) {
<?endif;?>
$('#plugin_table').tablesorter({sortList:[[4,0],[1,0]],sortAppend:[[1,0]],headers:{0:{sorter:false},5:{sorter:false}},textAttribute:'data'});
$('.desc_readmore').readmore({maxHeight:66,moreLink:"<a href='#'><i class='fa fa-chevron-down'></i></a>",lessLink:"<a href='#'><i class='fa fa-chevron-up'></i></a>"});
if (data[1]>0) $('#updateall').show(); else $('#updateall').hide();
if (data[1]>1) $('#updateall').show(); else $('#updateall').hide();
<?if ($check):?>
$('#checkall').find('input').prop('disabled',false).show();
<?endif;?>

View File

@@ -4,8 +4,8 @@ Tag="puzzle-piece"
Cond="glob('/boot/config/plugins-error/*.plg')"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -4,8 +4,8 @@ Tag="puzzle-piece"
Cond="glob('/boot/config/plugins-stale/*.plg')"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,6 +1,7 @@
Menu="About"
Title="Update OS"
Tag="thumbs-up"
Icon="icon-update"
Tag="upload"
---
<?PHP
/* Copyright 2005-2018, Lime Technology

View File

@@ -44,19 +44,15 @@ function make_link($method, $arg, $extra='') {
// trying our best to find an icon
function icon($name) {
// this should be the default location and name
$icon = "plugins/{$name}/images/{$name}.png";
$icon = "plugins/$name/images/$name.png";
if (file_exists($icon)) return $icon;
// try alternatives if default is not present
$plugin = strtok($name, '.');
$icon = "plugins/{$plugin}/images/{$plugin}.png";
$icon = "plugins/$name/$name.png";
if (file_exists($icon)) return $icon;
$icon = "plugins/{$plugin}/images/{$name}.png";
$image = preg_split('/[\._- ]/',$name)[0];
$icon = "plugins/$name/images/$image.png";
if (file_exists($icon)) return $icon;
$icon = "plugins/{$plugin}/{$plugin}.png";
if (file_exists($icon)) return $icon;
$icon = "plugins/{$plugin}/{$name}.png";
if (file_exists($icon)) return $icon;
$icon = "plugins/{$name}.png";
$icon = "plugins/$name/$image.png";
if (file_exists($icon)) return $icon;
// last resort - plugin manager icon
return "plugins/dynamix.plugin.manager/images/dynamix.plugin.manager.png";

View File

@@ -1,6 +1,6 @@
#!/usr/bin/php -q
<?PHP
// Copyright 2005-2017, Lime Technology
// Copyright 2005-2018, Lime Technology
// License: GPLv2 only
//
// Program updates made by Bergware International (April 2016)

View File

@@ -1,7 +1,7 @@
#!/usr/bin/php -q
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -4,8 +4,8 @@ Cond="(pgrep('libvirtd')!==false)"
Markdown="false"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2015-2017, Derek Macias, Eric Schultz, Jon Panozzo.
/* Copyright 2005-2018, Lime Technology
* Copyright 2015-2018, Derek Macias, Eric Schultz, Jon Panozzo.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -4,7 +4,7 @@ Cond="(pgrep('libvirtd')!==false)"
Markdown="false"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
/* Copyright 2005-2018, Lime Technology
* Copyright 2015-2017, Derek Macias, Eric Schultz, Jon Panozzo.
*
* This program is free software; you can redistribute it and/or

View File

@@ -1,6 +1,6 @@
Menu="OtherSettings"
Title="VM Manager"
Icon="dynamix.vm.manager.png"
Icon="icon-virtualization"
Tag="columns"
---
<?PHP

View File

@@ -4,7 +4,7 @@ Cond="(pgrep('libvirtd')!==false)"
Markdown="false"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
/* Copyright 2005-2018, Lime Technology
* Copyright 2015-2017, Derek Macias, Eric Schultz, Jon Panozzo.
*
* This program is free software; you can redistribute it and/or

View File

@@ -1,6 +1,6 @@
Menu="Tasks:70"
Type="xmenu"
Code="f108"
Code="e918"
Cond="exec(\"grep -o '^SERVICE=.enable' /boot/config/domain.cfg 2>/dev/null\")"
---
<?PHP

View File

@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2015-2017, Derek Macias, Eric Schultz, Jon Panozzo.
/* Copyright 2005-2018, Lime Technology
* Copyright 2015-2018, Derek Macias, Eric Schultz, Jon Panozzo.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,6 +1,6 @@
Menu="NetworkServices:1"
Title="AFP"
Icon="apple-logo.png"
Icon="icon-apple"
Tag="apple"
---
<?PHP

View File

@@ -3,8 +3,8 @@ Title="Array Devices"
Tag="database"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -80,17 +80,17 @@ if ($display['total']) echo "<tr class='tr_last'><td colspan='11'>&nbsp;</td></t
> **Colored Status Indicator** the significance of the color indicator at the beginning of each line in *Array Devices* is as follows:
>
> <img src='/webGui/images/green-on.png' class='icon'>Normal operation, device is active.
> <i class='fa fa-circle orb green-orb'></i>Normal operation, device is active.
>
> <img src='/webGui/images/green-blink.png' class='icon'>Device is in standby mode (spun-down).
> <i class='fa fa-circle orb grey-orb'></i>Device is in standby mode (spun-down).
>
> <img src='/webGui/images/yellow-on.png' class='icon'>Device contents emulated.
> <i class='fa fa-warning orb yellow-orb'></i>Device contents emulated.
>
> <img src='/webGui/images/red-on.png' class='icon'>Device is disabled, contents emulated.
> <i class='fa fa-times orb red-orb'></i>Device is disabled, contents emulated.
>
> <img src='/webGui/images/blue-on.png' class='icon'>New device.
> <i class='fa fa-square orb blue-orb'></i>New device.
>
> <img src='/webGui/images/grey-off.png' class='icon'>No device present, position is empty.
> <i class='fa fa-square orb grey-orb'></i>No device present, position is empty.
>
> **Identification** is the *signature* that uniquely identifies a storage device. The signature
> includes the device model number, serial number, linux device id, and the device size.

View File

@@ -58,12 +58,12 @@ function maintenance_mode() {
function status_indicator() {
global $var;
switch ($var['mdColor']) {
case 'green-on': $help = 'Started, array protected'; break;
case 'green-blink': $help = 'Stopped'; break;
case 'yellow-on': $help = 'Started, array unprotected'; break;
case 'yellow-blink': $help = 'Stopped'; break;
case 'green-on': $orb = 'circle'; $color = 'green'; $help = 'Started, array protected'; break;
case 'green-blink': $orb = 'circle'; $color = 'grey'; $help = 'Stopped'; break;
case 'yellow-on': $orb = 'warning'; $color = 'yellow'; $help = 'Started, array unprotected'; break;
case 'yellow-blink': $orb = 'warning'; $color = 'grey'; $help = 'Stopped'; break;
}
echo "<a class='info nohand' onclick='return false'><img src='/webGui/images/{$var['mdColor']}.png' class='icon'><span>$help</span></a>";
echo "<a class='info nohand' onclick='return false'><i class='fa fa-$orb orb $color-orb'></i><span>$help</span></a>";
}
function missing_cache() {
global $disks;
@@ -235,7 +235,7 @@ $(function(){
$btrfs = exec('pgrep -cf /sbin/btrfs') ? '<br><small>Disabled -- BTRFS operation is running</small>' : '';
switch ($var['fsState']):
case "Started":?>
<tr><td><?status_indicator()?><span class="strong big">Started<?=(($var['startMode']=='Maintenance')?' - Maintenance Mode':'')?></span></td>
<tr><td><?status_indicator()?><span class="strong">Started<?=(($var['startMode']=='Maintenance')?' - Maintenance Mode':'')?></span></td>
<td><input type="button" value="Stop" onclick="stopArray(this.form)"<?if ($parity||$mover||$btrfs):?> disabled<?endif;?>></td>
<td id="stop"><strong>Stop</strong> will take the array off-line.<?=$parity?:$mover?:$btrfs?:''?></td></tr>
<? if ($var['fsNumUnmountable']>0):?>
@@ -245,7 +245,7 @@ $(function(){
</td><td><input type="submit" id="btnFormat" name="cmdFormat" value="Format" disabled><input type="hidden" name="unmountable_mask" value="<?=$var['fsUnmountableMask']?>"></td>
<td><strong>Format</strong> will create a file system in all <strong>Unmountable</strong> disks, discarding all data currently on those disks.<br>
<a class="info none img nohand"><input type="checkbox" name="confirmFormat" value="OFF" onclick="$('#btnFormat').prop('disabled',!arrayOps.confirmFormat.checked)">
<small>Yes I want to do this&nbsp;<i class="fa fa-asterisk red-text" ></i><span><b>All data is permanently lost !!!<br>This is not used to recover data</b></span></small></a>
<small>Yes I want to do this&nbsp;<i class="fa fa-asterisk red-text" ></i></small><span><b>All data is permanently lost !!!<br>This is not used to recover data</b><br><i>Format is never part of a rebuild</i></span></a>
</td></tr>
<? endif;
if (!$parity):
@@ -360,7 +360,7 @@ $(function(){
<td><strong>Start</strong> will bring the array on-line and start <strong>Parity-Check</strong>.
<br><input type="checkbox" name="optionCorrect" value="correct" checked><small>Write corrections to parity</small></td></tr>
<? elseif (missing_cache()):?>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Missing Cache disk.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)"></td>
<tr><td><?status_indicator()?><span class="strong big">Stopped</span>. Missing Cache disk.</td><td><input type="button" id="cmdStart" value="Start" onclick="prepareInput(this.form)" disabled></td>
<td><strong>Start</strong> will remove the missing cache disk and then bring the array on-line.
<br><input type="checkbox" name="confirmStart" value="OFF" onclick="$('#cmdStart').prop('disabled',!arrayOps.confirmStart.checked)"><small>Yes I want to do this</small></td></tr>
<? else:?>
@@ -499,13 +499,13 @@ enable_stop();
> **Colored Status Indicator** the significance of the color indicator of the *Array* is as follows:
>
> <img src='/webGui/images/green-on.png' class='icon'>Array is Started and Parity is valid.
> <i class='fa fa-circle orb green-orb'></i>Array is Started and Parity is valid.
>
> <img src='/webGui/images/green-blink.png' class='icon'>Array is Stopped, Parity is valid.
> <i class='fa fa-circle orb grey-orb'></i>Array is Stopped, Parity is valid.
>
> <img src='/webGui/images/yellow-on.png' class='icon'>Array is Started, but Parity is invalid.
> <i class='fa fa-warning orb yellow-orb'></i>Array is Started, but Parity is invalid.
>
> <img src='/webGui/images/yellow-blink.png' class='icon'>Array is Stopped, Parity is invalid.
> <i class='fa fa-warning orb grey-orb'></i>Array is Stopped, Parity is invalid.
>
<?if ($var['fsState'] == "Stopped"):?>

View File

@@ -3,8 +3,8 @@ Title="Boot Device"
Tag="paw"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,6 +1,6 @@
Menu="CPUset:3"
Title="CPU Isolation"
Tag="leaf"
Tag="icon-cpu"
---
<?PHP
/* Copyright 2005-2018, Lime Technology

View File

@@ -1,6 +1,6 @@
Menu="CPUset:2"
Title="CPU Pinning Docker"
Tag="map-marker"
Tag="icon-cpu"
---
<?PHP
/* Copyright 2005-2018, Lime Technology

View File

@@ -1,4 +1,4 @@
Menu="OtherSettings"
Title="CPU Pinning"
Type="xmenu"
Icon="grid.png"
Icon="icon-cpu-pinning"

View File

@@ -1,6 +1,6 @@
Menu="CPUset:1"
Title="CPU Pinning VM"
Tag="map-marker"
Tag="icon-cpu"
---
<?PHP
/* Copyright 2005-2018, Lime Technology

View File

@@ -4,8 +4,8 @@ Tag="bullseye"
Cond="($var['fsState']=='Stopped' || $var['cacheSbNumDisks'])"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -44,13 +44,13 @@ endforeach;
> **Colored Status Indicator** the significance of the color indicator at the beginning of each line in *Cache Devices* is as follows:
>
> <img src='/webGui/images/green-on.png' class='icon'>Normal operation, device is active.
> <i class='fa fa-circle orb green-orb'></i>Normal operation, device is active.
>
> <img src='/webGui/images/green-blink.png' class='icon'>Device is in standby mode (spun-down).
> <i class='fa fa-circle orb grey-orb'></i>Device is in standby mode (spun-down).
>
> <img src='/webGui/images/blue-on.png' class='icon'>New device.
> <i class='fa fa-square orb blue-orb'></i>New device.
>
> <img src='/webGui/images/grey-off.png' class='icon'>No device present, position is empty.
> <i class='fa fa-square orb grey-orb'></i>No device present, position is empty.
>
> **Cache** is a device, or device pool, *outside* the Unraid array. It may be exported for network access just
> like an Array device. Being outside the Unraid array results in significantly faster write access.

View File

@@ -1,6 +1,6 @@
Menu="UserPreferences"
Title="Confirmations"
Icon="confirmations.png"
Icon="icon-confirmations"
Tag="check-square"
---
<?PHP

View File

@@ -1,6 +1,7 @@
Menu="About"
Title="Credits"
Tag="diamond"
Icon="icon-credits"
Tag="trophy"
---
**Unraid webGUI** Copyright &copy; 2005-2018, [Lime Technology, Inc.](http://lime-technology.com).
@@ -12,14 +13,16 @@ Tag="diamond"
**APC UPS Configuration Page** Copyright &copy; 2015, Dan Landon.
**Simple Features** Copyright &copy; 2012, Andrew Hamer-Adams.
**Simple Features** Copyright &copy; 2012, Andrew Hamer-Adams.
<br><br><br>
The Software comprising the Unraid webGui, which is all files within this repository except for
files listed below, is licensed under GPL version 2.
* The Lime Technology logo file(s) `webGui/images/limetech-*.*` are property of Lime Technology, Inc.
and may not be used in any other project without written permission from Lime Technology, Inc.
* Settings, Tools and Case icons. Copyright &copy; 2018, [Magnus Engø](http://www.magnusengo.net/). Used with permission.
**Unraid**&reg; is a registered trademark of [Lime Technology, Inc.](http://lime-technology.com).
This file shall be included in all copies or substantial portions of the Software.

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
Menu="Tasks:1"
Type="xmenu"
Tabs="false"
Code="f0e4"
Code="e943"

View File

@@ -1,6 +1,6 @@
Menu="OtherSettings"
Title="Date and Time"
Icon="date-time.png"
Icon="icon-clock"
Tag="clock-o"
---
<?PHP

View File

@@ -1,10 +1,11 @@
Menu="UNRAID-OS"
Title="Diagnostics"
Tag="address-card-o"
Icon="icon-diagnostics"
Tag="tv"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -33,7 +33,7 @@ $(function() {
});
</script>
<table class="share_status share wide">
<table class="share_status share">
<thead><tr><td style="width:15%">Name</td><td style="width:33%">Comment</td><td>SMB</td><td>NFS</td><td>AFP</td><td>Size</td><td>Free</td><td>View</td></tr></thead>
<tbody id="disk_list"></tbody>
</table>
@@ -41,9 +41,9 @@ $(function() {
> **Colored Status Indicator** -- the significance of the color indicator at the beginning of each line in *Disk Shares* is as follows:
>
> <img src='/webGui/images/green-on.png' class='icon'>Mounted, underlying device has redundancy/protection.
> <i class='fa fa-circle orb green-orb'></i>Mounted, underlying device has redundancy/protection.
>
> <img src='/webGui/images/yellow-on.png' class='icon'>Mounted, underlying device does not have redundancy/protection.
> <i class='fa fa-warning orb yellow-orb'></i>Mounted, underlying device does not have redundancy/protection.
>
> **Security modes:**

View File

@@ -1,7 +1,7 @@
Menu="OtherSettings"
Title="Disk Settings"
Icon="disk-settings.png"
Tag="database"
Icon="icon-disks"
Tag="icon-disk"
---
<?PHP
/* Copyright 2005-2018, Lime Technology

View File

@@ -1,6 +1,6 @@
Menu="UserPreferences"
Title="Display Settings"
Icon="display-settings.png"
Icon="icon-display"
Tag="desktop"
---
<?PHP
@@ -50,9 +50,6 @@ function presetTime(form) {
if (system) form.time.selectedIndex = 0;
form.time.disabled = system;
}
function presetHeader(form) {
if (form.header.value) $('#background').show(); else $('#background').hide();
}
function presetBanner(form) {
if (form.banner.selectedIndex == 0) $('#custom').hide(); else $('#custom').show();
}
@@ -113,7 +110,6 @@ $(function() {
if ($('#dropbox').triggerHandler({type:'drop',dataTransfer:{files:files}})==false) e.stopImmediatePropagation();
});
presetTime(document.display_settings);
presetHeader(document.display_settings);
presetBanner(document.display_settings);
});
</script>
@@ -220,13 +216,11 @@ Header custom text color:
> Overrule the default text color in the header. This can be used to match the text color with a background image.
<div id="background" markdown="1" style="display:none">
Header custom background color:
: <input type="text" class="narrow" name="background" value="<?=$display['background']?>" maxlength="6" pattern="[0-9a-fA-F]{3,6}" title="HTML color code of 3 or 6 hexadecimal digits">
> Overrule the default background color in the header. This can be used to match the background color with a custom text color.
</div>
Show banner:
: <select name="banner" size="1" onchange="presetBanner(this.form)">
<?=mk_option($display['banner'], "", "No")?>

View File

@@ -1,6 +1,6 @@
Menu="NetworkSettings:100"
Title="Interface eth0"
Tag="tag"
Tag="icon-ethernet"
---
<?PHP
/* Copyright 2005-2018, Lime Technology

View File

@@ -1,6 +1,6 @@
Menu="parentname:nnn"
Title="Interface ethX"
Tag="tag"
Tag="icon-ethernet"
---
<?PHP
/* Copyright 2005-2018, Lime Technology

View File

@@ -1,6 +1,6 @@
Menu="NetworkServices:999"
Title="FTP Server"
Icon="ftp-server.png"
Icon="icon-ftp"
Tag="globe"
---
<?PHP

View File

@@ -1,12 +1,12 @@
Menu="Buttons"
Title="Feedback"
Icon="comment-o"
Tag="commenting"
Code="f075"
Icon="icon-u-chat"
Tag="icon-u-chat"
Code="e93e"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,8 +1,8 @@
Type="xmenu"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -3,8 +3,8 @@ Title="Flash Device Settings"
Tag="usb"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,10 +1,11 @@
Menu="UNRAID-OS"
Title="Hardware Profile"
Tag="address-card-o"
Icon="icon-profile"
Tag="wrench"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,11 +1,11 @@
Menu="Buttons"
Title="Help"
Icon="question-circle-o"
Code="f059"
Icon="icon-u-help"
Code="e934"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,8 +1,8 @@
Menu="OtherSettings"
Type="xmenu"
Title="Identification"
Icon="ident.png"
Tag="id-badge"
Icon="icon-home"
Tag="home"
---
<?PHP
/* Copyright 2005-2018, Lime Technology

View File

@@ -1,11 +1,11 @@
Menu="Buttons"
Title="Info"
Icon="tv"
Code="f05a"
Icon="icon-u-display"
Code="e930"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -4,7 +4,7 @@ Tag="flag"
Cond="($var['regTy']!='Pro')"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
/* Copyright 2005-2018, Lime Technology
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,11 +1,11 @@
Menu="Buttons"
Title="Log"
Icon="file-text-o"
Code="f14b"
Icon="icon-u-log"
Code="e936"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,12 +1,12 @@
Cond="file_exists('/etc/nginx/htpasswd')"
Menu="Buttons:1"
Title="Logout"
Icon="sign-out"
Code="f08b"
Icon="icon-u-logout"
Code="e937"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,3 +1,3 @@
Menu="Tasks:1"
Type="xmenu"
Code="f015"
Code="e908"

View File

@@ -1,6 +1,6 @@
Menu="NetworkServices:2"
Title="NFS"
Icon="linux-logo.png"
Icon="icon-linux"
Tag="linux"
---
<?PHP

View File

@@ -1,6 +1,6 @@
Menu="NetworkSettings"
Title="Interface Rules"
Tag="tags"
Tag="icon-network"
Cond="file_exists('/boot/config/network-rules.cfg')"
---
<?PHP

View File

@@ -1,4 +1,4 @@
Menu="OtherSettings"
Type="xmenu"
Title="Network Settings"
Icon="network-settings.png"
Icon="icon-network"

View File

@@ -1,10 +1,11 @@
Menu="UNRAID-OS"
Title="New Config"
Tag="hand-paper-o"
Icon="icon-config"
Tag="cog"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,10 +1,11 @@
Menu="UNRAID-OS"
Title="New Permissions"
Tag="hand-paper-o"
Icon="icon-permissions"
Tag="folder-o"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,7 +1,7 @@
Menu="UserPreferences"
Type="xmenu"
Title="Notification Settings"
Icon="notifications.png"
Icon="icon-notifications"
Tag="phone-square"
---
<?PHP

View File

@@ -1,6 +1,7 @@
Menu="UNRAID-OS"
Title="Archived Notifications"
Tag="list"
Icon="icon-archive"
Tag="archive"
---
<?PHP
/* Copyright 2005-2018, Lime Technology

View File

@@ -4,8 +4,8 @@ Tag="unlink"
Cond="((count($devs)>0)&&($var['fsState']=='Started'))"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,10 +1,11 @@
Menu="WebGui"
Title="Page Map"
Tag="list"
Icon="icon-pagemap"
Tag="map-o"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,10 +1,11 @@
Menu="UNRAID-OS"
Title="Processes"
Tag="list"
Icon="icon-processes"
Tag="cogs"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,10 +1,11 @@
Menu="About"
Type="xmenu"
Title="Registration"
Tag="flag"
Icon="icon-registration"
Tag="pencil"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
/* Copyright 2005-2018, Lime Technology
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,10 +1,10 @@
Menu="NetworkSettings"
Title="Routing Table"
Tag="share-alt"
Tag="icon-share"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,4 +1,4 @@
Menu="NetworkServices:3"
Type="xmenu"
Title="SMB"
Icon="windows-logo.png"
Icon="icon-windows"

View File

@@ -1,4 +1,4 @@
Menu="UserPreferences"
Type="xmenu"
Title="Scheduler"
Icon="scheduler.png"
Icon="icon-scheduler"

View File

@@ -1,4 +1,4 @@
Menu="Tasks:4"
Type="xmenu"
Tabs="false"
Code="f085"
Code="e924"

View File

@@ -33,7 +33,7 @@ $(function() {
});
</script>
<table class="share_status share wide">
<table class="share_status share">
<thead><tr><td style="width:15%">Name</td><td style="width:33%">Comment</td><td>SMB</td><td>NFS</td><td>AFP</td><td>Size</td><td>Free</td><td>View</td></tr></thead>
<tbody id="shareslist"></tbody>
</table>
@@ -48,9 +48,9 @@ $(function() {
> **Colored Status Indicator** -- the significance of the color indicator at the beginning of each line in *User Shares* is as follows:
>
> <img src="/webGui/images/green-on.png" class="icon">All files are on protected storage.
> <i class='fa fa-circle orb green-orb'></i>All files are on protected storage.
>
> <img src="/webGui/images/yellow-on.png" class="icon">Some or all files are on unprotected storage.
> <i class='fa fa-warning orb yellow-orb'></i>Some or all files are on unprotected storage.
>
> **Security modes:**

View File

@@ -1,8 +1,8 @@
Menu="OtherSettings"
Type="xmenu"
Title="Global Share Settings"
Icon="share-settings.png"
Tag="share-alt-square"
Icon="icon-share"
Tag="share-alt"
---
<?PHP
/* Copyright 2005-2018, Lime Technology

View File

@@ -1,6 +1,6 @@
Menu="Tasks:2"
Type="xmenu"
Code="f07b"
Code="e92a"
----
<?PHP
if ($var['fsState']=="Stopped") {

View File

@@ -1,6 +1,7 @@
Menu="UNRAID-OS"
Title="System Devices"
Tag="list"
Icon="icon-hardware"
Tag="server"
---
<?PHP
/* Copyright 2005-2018, Lime Technology
@@ -15,7 +16,7 @@ Tag="list"
*/
?>
<style>
table.pre{margin-top:0}
table.pre{margin-top:0;background:transparent}
table.pre td:first-child{width:144px}
table tr td{padding:0 0 3px 0;margin:0}
table tr td.thin{line-height:8px;height:8px}

View File

@@ -1,10 +1,11 @@
Menu="UNRAID-OS"
Title="System Log"
Icon="icon-log"
Tag="list"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,12 +1,12 @@
Menu="Buttons:2"
Title="Terminal"
Icon="terminal"
Icon="icon-u-terminal"
Href="/webterminal/"
Code="f120"
Code="e93f"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,4 +1,4 @@
Menu="Tasks:90"
Type="xmenu"
Tabs="false"
Code="f0ad"
Code="e909"

View File

@@ -3,8 +3,8 @@ Title="Users"
Tag="users"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,5 +1,5 @@
Menu="$display['users'] Tasks:3"
Type="xmenu"
Title="Users"
Icon="users.png"
Code="f0c0"
Icon="icon-users"
Code="e945"

View File

@@ -1,10 +1,11 @@
Menu="WebGui"
Title="Vars"
Tag="list"
Icon="icon-vars"
Tag="code"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -12,55 +12,14 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Wrappers.php";
require_once "$docroot/webGui/include/Helpers.php";
function normalize($type,$count) {
$words = explode('_',$type);
foreach ($words as &$word) $word = $word==strtoupper($word) ? $word : preg_replace(['/^(ct|cnt)$/','/^blk$/'],['count','block'],strtolower($word));
return ucfirst(implode(' ',$words)).": ".str_replace('_',' ',strtolower($count))."\n";
}
function my_insert(&$source,$string) {
$source = substr_replace($source,$string,4,0);
}
function my_smart(&$source,$name,$page) {
global $var,$disks,$path,$failed,$numbers,$saved;
$disk = &$disks[$name];
$select = get_value($disk,'smSelect',0);
$level = get_value($disk,'smLevel',1);
$events = explode('|',get_value($disk,'smEvents',$numbers));
$title = '';
$thumb = 'good';
$smart = "state/smart/$name";
if (file_exists("$smart.ssa") && in_array(file_get_contents("$smart.ssa"),$failed)) {
$title = "S.M.A.R.T health-check failed\n"; $thumb = 'bad';
} else {
if (empty($saved["smart"]["$name.ack"])) {
exec("awk 'NR>7{print $1,$2,$4,$6,$9,$10}' ".escapeshellarg($smart)." 2>/dev/null", $codes);
foreach ($codes as $code) {
if (!$code || !is_numeric($code[0])) continue;
list($id,$class,$value,$thres,$when,$raw) = explode(' ',$code);
$fail = strpos($when,'FAILING_NOW')!==false;
if (!$fail && !in_array($id,$events)) continue;
if ($fail || ($select ? $thres>0 && $value<=$thres*$level : $raw>0)) $title .= normalize($class,$fail?$when:$raw);
}
if ($title) $thumb = 'alert'; else $title = "No errors reported\n";
}
}
$title .= "Click for context menu";
my_insert($source, "<span id='smart-$name' name='$page' class='$thumb'><img src=\"$path/$thumb.png\" onmouseover=\"this.style.cursor='pointer'\" title=\"$title\"></span>");
}
function my_usage(&$source,$used,&$disk) {
if ($used && ($_POST['text']==2 || $_POST['text']==21)) {
$load = substr($used,0,-1);
$critical = $disk['critical'] ?? $_POST['critical'];
$warning = $disk['warning'] ?? $_POST['warning'];
if ($load >= $critical) $class = 'redbar';
elseif ($load >= $warning) $class = 'orangebar';
else $class = 'greenbar';
} else $class = false;
my_insert($source, $used ? ($_POST['text']%10==0 ? $used : "<div class='usage-disk all'><span style='width:$used'".($class?" class='$class'":"").">$used</span></div>") : "-");
}
function my_temp($value,$unit) {
function my_unit($value,$unit) {
return ($unit=='F' ? round(9/5*$value+32) : $value)." $unit";
}
function my_clock($time) {
@@ -70,11 +29,11 @@ function my_clock($time) {
$mins = $time%60;
return plus($days,'day',($hour|$mins)==0).plus($hour,'hour',$mins==0).plus($mins,'minute',true);
}
function plus($val,$word,$last) {
return $val>0?(($val||$last)?($val.' '.$word.($val!=1?'s':'').($last ?'':', ')):''):'';
function parity_disks($disk) {
return $disk['type']=='Parity';
}
function active_disks($disk) {
return substr($disk['status'],0,7)!='DISK_NP' && preg_match('/^(Parity|Data|Cache)$/',$disk['type']);
return substr($disk['status'],0,7)!='DISK_NP' && in_array($disk['type'],['Parity','Data','Cache']);
}
function find_day($D) {
global $days;
@@ -154,161 +113,265 @@ function stage($i) {
}
return $t;
}
$path = '/webGui/images';
$failed = ['FAILED','NOK'];
function device_name(&$disk, $array) {
if ($array) {
switch ($disk['type']) {
case 'Flash' : $type = 'usb'; break;
case 'Parity': $type = $disk['rotational'] ? 'disk' : 'nvme'; break;
case 'Data' :
case 'Cache' : $type = $disk['rotational'] ? ($disk['luksState'] ? 'disk-encrypted' : 'disk') : 'nvme'; break;
}
return "<i class='icon-$type'></i> ".my_disk($disk['name']);
} else {
return "<i class='icon-disk'></i> {$disk['device']}";
}
}
function device_status(&$disk, &$error, &$warning) {
global $var;
if ($var['fsState']=='Stopped') {
$color = 'green'; $text = 'off-line';
} else switch ($disk['color']) {
case 'green-on' : $color = 'green'; $text = 'active'; break;
case 'green-blink' : $color = 'grey'; $text = 'standby'; break;
case 'blue-on' : $color = 'blue'; $text = 'unassigned'; break;
case 'blue-blink' : $color = 'grey'; $text = 'unassigned'; break;
case 'yellow-on' : $color = 'yellow'; $text = 'emulated'; $warning++; break;
case 'yellow-blink': $color = 'grey'; $text = 'emulated'; $warning++; break;
case 'red-on' : $color = 'red'; $text = 'disabled'; $error++; break;
case 'red-blink' : $color = 'grey'; $text = 'disabled'; $error++; break;
case 'red-off' : $color = 'red'; $text = 'faulty'; $error++; break;
case 'grey-off' : $color = 'grey'; $text = 'no device'; break;
}
return "<i class='fa fa-circle orb $color-orb middle'></i>$text";
}
function device_temp(&$disk, &$red, &$orange) {
$spin = strpos($disk['color'],'blink')===false;
$temp = $disk['temp'];
$hot = $disk['hotTemp'] ?? $_POST['hot'];
$max = $disk['maxTemp'] ?? $_POST['max'];
$top = $_POST['top'] ?? 120;
$heat = false; $color = 'green';
if (exceed($temp,$max,$top)) {
$heat = 'fire'; $color = 'red'; $red++;
} elseif (exceed($temp,$hot,$top)) {
$heat = 'fire'; $color = 'orange'; $orange++;
}
return ($spin && $temp>0) ? "<span class='$color-text'>".my_unit($temp,$_POST['unit'])."</span>".($heat ? "<i class='fa fa-$heat $color-text heat'></i>" : "") : "*";
}
function device_smart(&$disk, $name, &$fail, &$smart) {
global $numbers,$saved;
if (!$disk['device'] || strpos($disk['color'],'blink')) return "-";
$failed = ['FAILED','NOK'];
$page = $name ? 'New' : 'Device';
$name = $name ?: $disk['name'];
$select = get_value($name,'smSelect',0);
$level = get_value($name,'smLevel',1);
$events = explode('|',get_value($disk,'smEvents',$numbers));
$title = '';
$thumb = 'thumbs-o-up';
$text = 'healthy';
$color = 'green';
$file = "state/smart/$name";
if (file_exists("$file.ssa") && in_array(file_get_contents("$file.ssa"),$failed)) {
$title = "S.M.A.R.T health-check failed\n"; $thumb = 'thumbs-o-down'; $color = 'red'; $text = 'fail'; $fail++;
} else {
if (empty($saved["smart"]["$name.ack"])) {
exec("awk 'NR>7{print $1,$2,$4,$6,$9,$10}' ".escapeshellarg($file)." 2>/dev/null", $codes);
foreach ($codes as $code) {
if (!$code || !is_numeric($code[0])) continue;
list($id,$class,$value,$thres,$when,$raw) = explode(' ',$code);
$failing = strpos($when,'FAILING_NOW')!==false;
if (!$failing && !in_array($id,$events)) continue;
if ($failing || ($select ? $thres>0 && $value<=$thres*$level : $raw>0)) $title .= normalize($class,$failing?$when:$raw);
}
if ($title) {$thumb = 'thumbs-o-down'; $color = 'orange'; $text = 'error'; $smart++;} else $title = "No errors reported\n";
}
}
$title .= "Click for context menu";
return "<span id='smart-$name' name='$page' class='fa fa-$thumb $color-text' style='margin-right:8px' onmouseover='this.style.cursor=\"pointer\"' title='$title'></span>$text";
}
function device_usage(&$disk, $array, &$full, &$high) {
if ($array) {
$text = $_POST['text'];
$used = ($disk['type']!='Parity' && $disk['fsStatus']=='Mounted') ? (($disk['fsSize'] ? round((1-$disk['fsFree']/$disk['fsSize'])*100):0).'%') : false;
if ($used && ($text==2 || $text==21)) {
$load = substr($used,0,-1);
$critical = $disk['critical'] ?? $_POST['critical'];
$warning = $disk['warning'] ?? $_POST['warning'];
if ($load >= $critical) {$class = 'redbar'; $full++;}
elseif ($load >= $warning) {$class = 'orangebar'; $high++;}
else $class = 'greenbar';
} else $class = false;
} else $used = false;
if ($used) {
return $text%10==0 ? $used : "<span class='load'>$used</span><div class='usage-disk sys'><span style='width:$used'".($class?" class='$class'":"")."></span></div>";
} else {
return $text%10==0 ? "-" : "<span class='load'>-</span><div class='usage-disk sys none'></div>";
}
}
function array_group($type) {
global $disks,$error,$warning,$red,$orange,$fail,$smart,$full,$high;
foreach ($disks as $disk) if ($disk['type']==$type && strpos($disk['status'],'DISK_NP')===false) {
echo "<tr><td></td>";
echo "<td>".device_name($disk,true)."</td>";
echo "<td>".device_status($disk,$error,$warning)."</td>";
echo "<td>".device_temp($disk,$red,$orange)."</td>";
echo "<td>".device_smart($disk,false,$fail,$smart)."</td>";
echo "<td>".device_usage($disk,true,$full,$high)."</td>";
echo "<td></td></tr>";
}
}
function extra_group(&$disks) {
global $disks,$error,$warning,$red,$orange,$fail,$smart,$full,$high;
foreach ($disks as $disk) {
$name = $disk['device'];
$port = port_name($name);
$smart = "state/smart/$name";
$disk['color'] = exec("hdparm -C /dev/$port|grep -Po 'active|unknown'") ? 'blue-on' : 'blue-blink';
$disk['temp'] = file_exists($smart) ? exec("awk 'BEGIN{s=t=\"*\"}\$1==190{s=\$10};\$1==194{t=\$10;exit};\$1==\"Temperature:\"{t=\$2;exit};/^Current Drive Temperature:/{t=\$4;exit} END{if(t!=\"*\")print t; else print s}' $smart") : '*';
echo "<tr><td></td>";
echo "<td>".device_name($disk,false)."</td>";
echo "<td>".device_status($disk,$error,$warning)."</td>";
echo "<td>".device_temp($disk,$red,$orange)."</td>";
echo "<td>".device_smart($disk,$name,$fail,$smart)."</td>";
echo "<td>".device_usage($disk,false,$full,$high)."</td>";
echo "<td></td></tr>";
}
}
switch ($_POST['cmd']) {
case 'disk':
$i = 1;
case 'array':
$var = parse_ini_file('state/var.ini');
$disks = array_filter(parse_ini_file('state/disks.ini',true),'active_disks');
$saved = @parse_ini_file('state/monitor.ini',true) ?: [];
require_once "$docroot/webGui/include/CustomMerge.php";
require_once "$docroot/webGui/include/Preselect.php";
$error = $warning = $red = $orange = $fail = $smart = $full = $high = 0;
array_group('Parity');
array_group('Data');
echo "\0".($error+$warning)."\0".($red+$orange)."\0".($fail+$smart)."\0".($full+$high);
break;
case 'cache':
$var = parse_ini_file('state/var.ini');
$disks = array_filter(parse_ini_file('state/disks.ini',true),'active_disks');
$saved = @parse_ini_file('state/monitor.ini',true) ?: [];
require_once "$docroot/webGui/include/CustomMerge.php";
require_once "$docroot/webGui/include/Preselect.php";
$error = $warning = $red = $orange = $fail = $smart = $full = $high = 0;
array_group('Cache');
echo "\0".($error+$warning)."\0".($red+$orange)."\0".($fail+$smart)."\0".($full+$high);
break;
case 'extra':
$var = parse_ini_file('state/var.ini');
$devs = parse_ini_file('state/devs.ini',true);
$saved = @parse_ini_file('state/monitor.ini',true) ?: [];
require_once "$docroot/webGui/include/CustomMerge.php";
require_once "$docroot/webGui/include/Preselect.php";
$slots = $_POST['slots'];
$row1 = array_fill(0,31,'<td></td>'); my_insert($row1[0],'Encrypted');
$row2 = array_fill(0,31,'<td></td>'); my_insert($row2[0],'Active');
$row3 = array_fill(0,31,'<td></td>'); my_insert($row3[0],'Inactive');
$row4 = array_fill(0,31,'<td></td>'); my_insert($row4[0],'Unassigned');
$row5 = array_fill(0,31,'<td></td>'); my_insert($row5[0],'Faulty');
$row6 = array_fill(0,31,'<td></td>'); my_insert($row6[0],'Heat alarm');
$row7 = array_fill(0,31,'<td></td>'); my_insert($row7[0],'SMART status');
$row8 = array_fill(0,31,'<td></td>'); my_insert($row8[0],'Utilization');
$diskRow = function($n,$disk) use (&$row1,&$row2,&$row3,&$row4,&$row5,&$row6,&$row7,&$row8,$path,$var) {
if ($n>0) {
if (isset($disk['luksState'])) {
switch ($disk['luksState']) {
case 0: $luks = strpos($disk['fsType'],'luks:')===false ? "" : "<i class='fa fa-unlock orange-text'></i>"; break;
case 1: if ($var['fsState']!='Stopped') {$luks = "<i class='fa fa-unlock-alt green-text'></i>"; break;}
case 2: $luks = "<i class='fa fa-lock green-text'></i>"; break;
case 3: $luks = "<i class='fa fa-lock red-text'></i>"; break;
default: $luks = "<i class='fa fa-lock red-text'></i>"; break;
}
} else $luks = "";
my_insert($row1[$n],$luks);
$state = $disk['color'];
switch ($state) {
case 'grey-off':
break; //ignore
case 'green-on':
my_insert($row2[$n],"<img src=$path/$state.png>");
break;
case 'green-blink':
my_insert($row3[$n],"<img src=$path/$state.png>");
break;
case 'blue-on':
case 'blue-blink':
my_insert($row4[$n],"<img src=$path/$state.png>");
break;
default:
my_insert($row5[$n],"<img src=$path/$state.png>");
break;}
$temp = $disk['temp'];
$hot = $disk['hotTemp'] ?? $_POST['hot'];
$max = $disk['maxTemp'] ?? $_POST['max'];
$top = $_POST['top'] ?? 120;
$heat = exceed($temp,$max,$top) ? 'max' : (exceed($temp,$hot,$top) ? 'hot' : '');
if ($heat)
my_insert($row6[$n],"<span class='heat-img'><img src='$path/$heat.png'></span><span class='heat-text' style='display:none'>".my_temp($temp,$_POST['unit'])."</span>");
else
if (!strpos($state,'blink') && $temp>0) my_insert($row6[$n],"<span class='temp-text'>".my_temp($temp,$_POST['unit'])."</span>");
if ($disk['device'] && !strpos($state,'blink')) my_smart($row7[$n],$disk['name'],'Device');
my_usage($row8[$n],($disk['type']!='Parity' && $disk['fsStatus']=='Mounted')?(($disk['fsSize'] ? round((1-$disk['fsFree']/$disk['fsSize'])*100):0).'%'):'',$disk);
}
};
$devRow = function($n,$disk) use (&$row4,&$row6,&$row7,$path) {
$hot = $_POST['hot'];
$max = $_POST['max'];
$top = $_POST['top'] ?? 120;
$name = $disk['device'];
$port = substr($name,-2)!='n1' ? $name : substr($name,0,-2);
$smart = "state/smart/$name";
$state = exec("hdparm -C ".escapeshellarg("/dev/$port")."|grep -Po 'active|unknown'") ? 'blue-on' : 'blue-blink';
if ($state=='blue-on') my_smart($row7[$n],$name,'New');
$temp = file_exists($smart) ? exec("awk 'BEGIN{s=t=\"*\"}\$1==190{s=\$10};\$1==194{t=\$10;exit};\$1==\"Temperature:\"{t=\$2;exit};/^Current Drive Temperature:/{t=\$4;exit} END{if(t!=\"*\")print t; else print s}' ".escapeshellarg($smart)) : '*';
$heat = exceed($temp,$max,$top) ? 'max' : (exceed($temp,$hot,$top) ? 'hot' : '');
if ($heat)
my_insert($row6[$n],"<span class='heat-img'><img src='$path/$heat.png'></span><span class='heat-text' style='display:none'>".my_temp($temp,$_POST['unit'])."</span>");
else
if ($state=='blue-on' && $temp>0) my_insert($row6[$n],"<span class='temp-text'>".my_temp($temp,$_POST['unit'])."</span>");
my_insert($row4[$n],"<img src=$path/$state.png>");
};
foreach ($disks as $disk) if ($disk['type']=='Parity') $diskRow($i++,$disk);
foreach ($disks as $disk) if ($disk['type']=='Data') $diskRow($i++,$disk);
if ($slots <= 30) {
foreach ($disks as $disk) if ($disk['type']=='Cache') $diskRow($i++,$disk);
foreach ($devs as $dev) $devRow($i++,$dev);
}
echo "<tr>".implode('',$row1)."</tr>";
echo "<tr>".implode('',$row2)."</tr>";
echo "<tr>".implode('',$row3)."</tr>";
echo "<tr>".implode('',$row4)."</tr>";
echo "<tr>".implode('',$row5)."</tr>";
echo "<tr>".implode('',$row6)."</tr>";
echo "<tr>".implode('',$row7)."</tr>";
echo "<tr>".implode('',$row8)."</tr>";
if ($slots > 30) {
echo '#'; $i = 1;
$row1 = array_fill(0,31,'<td></td>'); my_insert($row1[0],'Encrypted');
$row2 = array_fill(0,31,'<td></td>'); my_insert($row2[0],'Active');
$row3 = array_fill(0,31,'<td></td>'); my_insert($row3[0],'Inactive');
$row4 = array_fill(0,31,'<td></td>'); my_insert($row4[0],'Unassigned');
$row5 = array_fill(0,31,'<td></td>'); my_insert($row5[0],'Faulty');
$row6 = array_fill(0,31,'<td></td>'); my_insert($row6[0],'Heat alarm');
$row7 = array_fill(0,31,'<td></td>'); my_insert($row7[0],'SMART status');
$row8 = array_fill(0,31,'<td></td>'); my_insert($row8[0],'Utilization');
foreach ($disks as $disk) if ($disk['type']=='Cache') $diskRow($i++,$disk);
foreach ($devs as $dev) $devRow($i++,$dev);
echo "<tr>".implode('',$row1)."</tr>";
echo "<tr>".implode('',$row2)."</tr>";
echo "<tr>".implode('',$row3)."</tr>";
echo "<tr>".implode('',$row4)."</tr>";
echo "<tr>".implode('',$row5)."</tr>";
echo "<tr>".implode('',$row6)."</tr>";
echo "<tr>".implode('',$row7)."</tr>";
echo "<tr>".implode('',$row8)."</tr>";
}
break;
$error = $warning = $red = $orange = $fail = $smart = $full = $high = 0;
extra_group($devs);
echo "\0".($error+$warning)."\0".($red+$orange)."\0".($fail+$smart)."\0".($full+$high);
break;
case 'sys':
exec("grep -Po '^Mem(Total|Available):\s+\K\d+' /proc/meminfo",$memory);
exec("df /boot /var/log /var/lib/docker|grep -Po '\d+%'",$sys);
$mem = max(round((1-$memory[1]/$memory[0])*100),0);
echo "{$mem}%#".implode('#',$sys);
break;
echo "{$mem}%\0".implode("\0",$sys);
break;
case 'fan':
exec("sensors -uA 2>/dev/null|grep -Po 'fan\d_input: \K\d+'",$rpms);
if ($rpms) echo implode(' RPM#',$rpms).' RPM';
break;
if ($rpms) echo implode(" RPM\0",$rpms).' RPM';
break;
case 'port':
$i = 0;
$ports = explode(',',$_POST['ports']);
switch ($_POST['view']) {
case 'main':
$ports = explode(',',$_POST['ports']); $i = 0;
foreach ($ports as $port) {
$mtu = file_get_contents("/sys/class/net/$port/mtu");
$int = "/sys/class/net/$port";
$mtu = file_get_contents("$int/mtu");
$link = file_get_contents("$int/carrier")==1;
if (substr($port,0,4)=='bond') {
$ports[$i++] = exec("grep -Pom1 '^Bonding Mode: \K.+' ".escapeshellarg("/proc/net/bonding/$port")).", mtu $mtu";
if ($link) {
$bond_mode = str_replace('Bonding Mode: ','',file("/proc/net/bonding/$port",FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES)[1]);
$ports[$i++] = "$bond_mode, mtu $mtu";
} else $ports[$i++] = "bond down";
} elseif ($port=='lo') {
$ports[$i++] = str_replace('yes','loopback',exec("ethtool lo|grep -Pom1 '^\s+Link detected: \K.+'"));
$ports[$i++] = $link ? "loopback" : "not set";
} else {
unset($info);
exec("ethtool ".escapeshellarg($port)."|grep -Po '^\s+(Speed|Duplex|Link\sdetected): \K[^U\\n]+'",$info);
$ports[$i++] = (array_pop($info)=='yes' && $info[0]) ? str_replace(['M','G'],[' M',' G'],$info[0]).", ".strtolower($info[1])." duplex, mtu $mtu" : "not connected";
if ($link) {
$speed = file_get_contents("$int/speed");
$duplex = file_get_contents("$int/duplex");
$ports[$i++] = "$speed Mbps, $duplex duplex, mtu $mtu";
} else $ports[$i++] = "interface down";
}
}
break;
case 'port':
foreach ($ports as $port) {
$int = "/sys/class/net/$port";
$rx_bytes = file_get_contents("$int/statistics/rx_bytes");
$tx_bytes = file_get_contents("$int/statistics/tx_bytes");
$ports[$i++] = "{$rx_bytes}\0{$tx_bytes}";
}
break;
case 'link':
foreach ($ports as $port) {
$int = "/sys/class/net/$port";
$rx_errors = file_get_contents("$int/statistics/rx_errors");
$rx_drops = file_get_contents("$int/statistics/rx_dropped");
$rx_fifo = file_get_contents("$int/statistics/rx_fifo_errors");
$tx_errors = file_get_contents("$int/statistics/tx_errors");
$tx_drops = file_get_contents("$int/statistics/tx_dropped");
$tx_fifo = file_get_contents("$int/statistics/tx_fifo_errors");
$ports[$i++] = "Errors: {$rx_errors}<br>Drops: {$rx_drops}<br>Overruns: {$rx_fifo}\0Errors: {$tx_errors}<br>Drops: {$tx_drops}<br>Overruns: {$tx_fifo}";
}
break;
}
echo implode("\0",$ports);
break;
case 'port': exec("ifconfig -a -s|awk '/^(bond|eth|lo)[0-9]*\s/{print $3\"#\"$7}'",$ports); break;
case 'link': exec("ifconfig -a -s|awk '/^(bond|eth|lo)[0-9]*\s/{print \"Errors: \"$4\"<br>Drops: \"$5\"<br>Overruns: \"$6\"#Errors: \"$8\"<br>Drops: \"$9\"<br>Overruns: \"$10}'",$ports); break;
default: $ports = [];}
echo implode('#',$ports);
break;
case 'parity':
$var = parse_ini_file("state/var.ini");
if ($var['mdResync']>0) {
case 'speed':
$int = "/sys/class/net/{$_POST['port']}";
$rx_new = (float)file_get_contents("$int/statistics/rx_bytes");
$tx_new = (float)file_get_contents("$int/statistics/tx_bytes");
$time_new = microtime(true);
$time_old = (float)$_POST['timestamp'];
$rx_old = (float)$_POST['rx_bytes'];
$tx_old = (float)$_POST['tx_bytes'];
if ($time_old) {
$rx_speed = my_scale(($rx_new-$rx_old)/($time_new-$time_old)*8,$unit,1,-1).' '.str_replace('B','b',$unit).'ps';
$tx_speed = my_scale(($tx_new-$tx_old)/($time_new-$time_old)*8,$unit,1,-1).' '.str_replace('B','b',$unit).'ps';
} else $rx_speed = $tx_speed = '---';
echo "$rx_speed\0$tx_speed\0$time_new\0$rx_new\0$tx_new";
break;
case 'status':
$var = parse_ini_file("state/var.ini");
$disks = array_filter(parse_ini_file('state/disks.ini',true),'parity_disks');
$parity_slots = count($disks);
$parity_disabled = $parity_invalid = 0;
foreach ($disks as $disk) {
if (strpos($disk['status'],"DISK_NP")===0) $parity_disabled++;
elseif (strpos($disk['status'],"DISK_INVALID")===0) $parity_invalid++;
}
if ($var['mdResync']==0) {
if ($parity_slots==$parity_disabled) {
echo "<span class='red'>Parity disk".($parity_slots==1?'':'s')." not present</span>";
} elseif ($parity_slots > $parity_invalid) {
if ($parity_invalid==0) {
echo "<span class='green'>Parity is valid</span>";
} else {
echo "<span class='orange'>Parity is degraded: $parity_invalid invalid device".($parity_invalid==1?'':'s')."</span>";
}
} else {
if (empty($var['mdInvalidDisk'])) {
echo "<span class='red strong'>Parity is invalid</span>";
} else {
echo "<span class='red strong'>Data is invalid</span>";
}
}
} else {
$mode = '';
$number = $_POST['number'] ?? '.,';
if (strstr($var['mdResyncAction'],"recon")) {
$mode = 'Parity-Sync / Data-Rebuild';
$mode = 'Parity-Sync/Data-Rebuild';
} elseif (strstr($var['mdResyncAction'],"clear")) {
$mode = 'Clearing';
} elseif ($var['mdResyncAction']=="check") {
@@ -316,9 +379,49 @@ case 'parity':
} elseif (strstr($var['mdResyncAction'],"check")) {
$mode = 'Parity-Check';
}
echo "<span class='orange p0'><strong>".$mode." in progress... Completed: ".number_format(($var['mdResyncPos']/($var['mdResync']/100+1)),0)." %.</strong></span>";
echo "<br><i class='fa fa-clock-o'></i> <em>Elapsed time: ".my_clock(floor((time()-$var['sbUpdated'])/60)).". Estimated finish: ".my_clock(round(((($var['mdResyncDt']*(($var['mdResync']-$var['mdResyncPos'])/($var['mdResyncDb']/100+1)))/100)/60),0))."</em>";
echo "<span class='orange'>$mode in progress... Completed: ".number_format(($var['mdResyncPos']/($var['mdResync']/100+1)),1,$number[0],$number[1])." %.</span>";
}
break;
case 'parity':
$var = parse_ini_file("state/var.ini");
$time = $_POST['time'];
$idle = $var['mdResync']==0;
if ($var['sbSyncExit']!=0) {
echo "Last check incomplete on <strong>".my_time($var['sbSynced2'],$time).day_count($var['sbSynced2'])."</strong>, finding <strong>{$var['sbSyncErrs']}</strong> error".($var['sbSyncErrs']==1?'.':'s.');
echo "<br><i class='fa fa-dot-circle-o'></i> Error code: ".my_error($var['sbSyncExit']);
} elseif ($var['sbSynced']==0) {
list($date,$duration,$speed,$status,$error) = last_parity_log();
if (!$date) {
echo "Parity has not been checked yet.";
} elseif ($status==0) {
echo "Last checked on <strong>".my_time($date).day_count($date,$time)."</strong>, finding <strong>$error</strong> error".($error==1?'.':'s.');
echo "<br><i class='fa fa-clock-o'></i> Duration: ".my_check($duration,$speed);
} else {
echo "Last check incomplete on <strong>".my_time($date,$time).day_count($date)."</strong>, finding <strong>$error</strong> error".($error==1?'.':'s.');
echo "<br><i class='fa fa-dot-circle-o'></i> Error code: ".my_error($status);
}
} elseif ($var['sbSynced2']==0) {
if ($idle) {
list($entry,$duration,$speed,$status,$error) = explode('|', read_parity_log($var['sbSynced'],!$idle));
if ($status==0) {
echo "Last checked on <strong>".my_time($var['sbSynced'],$time).day_count($var['sbSynced'])."</strong>, finding <strong>$error</strong> error".($error==1?'.':'s.');
echo "<br><i class='fa fa-clock-o'></i> Duration: ".my_check($duration,$speed);
} else {
echo "Last check incomplete on <strong>".my_time($var['sbSynced'],$time).day_count($var['sbSynced'])."</strong>, finding <strong>$error</strong> error".($error==1?'.':'s.');
echo "<br><i class='fa fa-dot-circle-o'></i> Error code: ".my_error($status);
}
} else {
echo "Activity started on <strong>".my_time($var['sbSynced'],$time).day_count($var['sbSynced'])."</strong>, finding <span id='errors'><strong>{$var['sbSyncErrs']}</strong> error".($var['sbSyncErrs']==1?'.':'s.')."</span>";
echo "<br><i class='fa fa-clock-o'></i> Elapsed time: ".my_clock(floor((time()-$var['sbUpdated'])/60))."<span class='finish'><i class='fa fa-flag-checkered'></i> Estimated finish: ".my_clock(round(((($var['mdResyncDt']*(($var['mdResync']-$var['mdResyncPos'])/($var['mdResyncDb']/100+1)))/100)/60),0))."</span>";
}
} else {
$status = 0;
$duration = $var['sbSynced2']-$var['sbSynced'];
$speed = $duration?my_scale($var['mdResyncSize']*1024/$duration,$unit,1)." $unit/sec":'';
echo "Last checked on <strong>".my_time($var['sbSynced2'],$time).day_count($var['sbSynced2'])."</strong>, finding <strong>{$var['sbSyncErrs']}</strong> error".($var['sbSyncErrs']==1?'.':'s.');
echo "<br><i class='fa fa-clock-o'></i> Duration: ".my_check($duration,$speed);
}
if ($idle) {
extract(parse_plugin_cfg('dynamix', true));
list($m,$h) = explode(' ', $parity['hour']);
$time = time();
@@ -381,24 +484,24 @@ case 'parity':
case 'WL': $t = stage(0); break;}
break;
}
echo "\0";
echo "Next check scheduled on <strong>";
echo strftime($_POST['time'],$time+$t);
echo "</strong><br><i class='fa fa-clock-o'></i> <em>Due in: ";
echo "</strong><br><i class='fa fa-clock-o'></i> Due in: ";
echo my_clock(floor($t/60));
echo "</em>";
} else {
echo "\0";
}
break;
break;
case 'shares':
$names = explode(',',$_POST['names']);
switch ($_POST['com']) {
case 'smb':
exec("lsof /mnt/user /mnt/disk* 2>/dev/null|awk '/^smbd/ && $0!~/\.AppleD(B|ouble)/ && $5==\"REG\"'|awk -F/ '{print $4}'",$lsof);
$counts = array_count_values($lsof); $count = [];
foreach ($names as $name) $count[] = $counts[$name] ?? 0;
echo implode('#',$count);
break;
case 'afp':
case 'nfs':
// not available
break;}
break;}
$names = explode(',',$_POST['names']);
switch ($_POST['com']) {
case 'smb':
exec("LANG='en_US.UTF8' lsof -Owl /mnt/disk[0-9]* 2>/dev/null|awk '/^shfs/ && \$0!~/\.AppleD(B|ouble)/ && \$5==\"REG\"'|awk -F/ '{print \$4}'",$lsof);
$counts = array_count_values($lsof); $count = [];
foreach ($names as $name) $count[] = $counts[$name] ?? 0;
echo implode("\0",$count);
break;
}
break;
}

View File

@@ -29,6 +29,7 @@ $themes2 = in_array($theme,['gray','azure']);
<meta name="robots" content="noindex, nofollow">
<link type="image/png" rel="shortcut icon" href="/webGui/images/<?=$var['mdColor']?>.png">
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/default-fonts.css")?>">
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/default-cases.css")?>">
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/font-awesome.css")?>">
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/context.standalone.css")?>">
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/jquery.sweetalert.css")?>">
@@ -45,14 +46,14 @@ html{font-size:<?=$font?>}
<?endif;?>
<?if ($backgnd):?>
#header{background-color:#<?=$backgnd?>}
<?if ($header && $themes1):?>
<?if ($themes1):?>
#menu{background-color:#<?=$backgnd?>}
#nav-block #nav-item a{color:#<?=$header?>}
#nav-block #nav-item.active:after{background-color:#<?=$header?>}
<?endif;?>
<?endif;?>
.inline_help{display:none}
.upgrade_notice{position:fixed;top:1px;left:0;width:100%;height:40px;line-height:40px;color:#E68A00;background:#FEEFB3;border-bottom:#E68A00 1px solid;text-align:center;font-size:1.4rem;z-index:999}
.upgrade_notice{position:fixed;top:1px;left:0;width:100%;height:40px;line-height:40px;color:#e68a00;background:#feefb3;border-bottom:#e68a00 1px solid;text-align:center;font-size:1.4rem;z-index:999}
.upgrade_notice i{margin:14px;float:right;cursor:pointer}
.back_to_top{display:none;position:fixed;bottom:30px;right:12px;color:#e22828;font-size:2.5rem}
<?
@@ -64,8 +65,8 @@ echo "#header.image{background-image:url(";
echo file_exists($banner) ? autov($banner) : '/webGui/images/banner.png';
echo ")}\n";
if ($themes2) {
foreach ($tasks as $page) if ($page['Code']) echo "#nav-item a[href='/{$page['name']}']:before{content:'\\{$page['Code']}'}\n";
foreach ($buttons as $page) if ($page['Code']) echo "#nav-item.{$page['name']} a:before{content:'\\{$page['Code']}'}\n";
foreach ($tasks as $button) if ($button['Code']) echo "#nav-item a[href='/{$button['name']}']:before{content:'\\{$button['Code']}'}\n";
foreach ($buttons as $button) if ($button['Code']) echo "#nav-item.{$button['name']} a:before{content:'\\{$button['Code']}'}\n";
}
$notes = '/var/tmp/unRAIDServer.txt';
if (!file_exists($notes)) file_put_contents($notes,shell_exec("$docroot/plugins/dynamix.plugin.manager/scripts/plugin changes $docroot/plugins/unRAIDServer/unRAIDServer.plg"));
@@ -105,7 +106,7 @@ function updateTime() {
var days = parseInt(uptime/86400);
var hour = parseInt(uptime/3600%24);
var mins = parseInt(uptime/60%60);
$('#uptime').html(((days|hour|mins)?plus(days,'day',(hour|mins)==0)+plus(hour,'hour',mins==0)+plus(mins,'minute',true):'less than a minute'));
$('span.uptime').html(((days|hour|mins)?plus(days,'day',(hour|mins)==0)+plus(hour,'hour',mins==0)+plus(mins,'minute',true):'less than a minute'));
uptime += Math.round((now.getTime() - before.getTime())/1000);
before = now;
if (expiretime > 0) {
@@ -323,44 +324,53 @@ $.ajaxPrefilter(function(s, orig, xhr){
});
</script>
</head>
<body class="<?='page_'.strtolower($myPage['name'])?>">
<body>
<div id="template">
<div class="upgrade_notice" style="display:none"></div>
<div id="header" class="<?=$display['banner']?>">
<div class="logo">
<a href="https://unraid.net"><?=file_get_contents("$docroot/webGui/images/UN-logotype-gradient.svg")?></a>
<a href="https://unraid.net"><?readfile("$docroot/webGui/images/UN-logotype-gradient.svg")?></a>
Version: <?=$var['version']?><?=$notes?>
</div>
<div class="block">
<span class="text-left">Server<br/>Description<br/>Registration<br/>Uptime</span>
<span class="text-right"><?=$var['NAME']." &bullet; ".$eth0['IPADDR:0']?><br/><?=$var['COMMENT']?><br/>
<a href="/Tools/Registration" title="Go to Registration page">Unraid OS <span id="licensetype"><?=$var['regTy']?></span><span id="licenseexpire"></span></a><br/>
<span id="uptime"></span></span>
<span class="uptime"></span></span>
</div>
</div>
<a href="#" class="back_to_top" title="Back To Top"><i class="fa fa-arrow-circle-up"></i></a>
<?
// Build page menus
echo "<div id='menu'><div id='nav-block'><div id='nav-left'>";
foreach ($tasks as $page) {
$pagename = $page['name'];
foreach ($tasks as $button) {
$page = $button['name'];
echo "<div id='nav-item'";
echo $pagename==$task ? " class='active'>" : ">";
echo "<a href='/$pagename' onclick='initab()'>$pagename</a></div>";
echo $task==$page ? " class='active'>" : ">";
echo "<a href='/$page' onclick='initab()'>$page</a></div>";
}
unset($tasks);
if ($display['usage']) my_usage();
echo "</div>";
echo "<div id='nav-right'>";
foreach ($buttons as $page) {
eval("?>{$page['text']}");
if (empty($page['Link'])) {
$icon = substr($page['Icon'],-4)=='.png' ? "<img src='/{$page['root']}/icons/{$page['Icon']}' class='system'>" : "<i class='system fa fa-{$page['Icon']}'></i>";
echo "<div id='nav-item' class='{$page['name']}'><a href='".($page['Href'] ?? '#')."' onclick='{$page['name']}();return false;' title='{$page['Title']}'>$icon<span>{$page['Title']}</span></a></div>";
foreach ($buttons as $button) {
eval("?>{$button['text']}");
if (empty($button['Link'])) {
$icon = $button['Icon'];
if (substr($icon,-4)=='.png') {
$icon = "<img src='/{$button['root']}/icons/$icon' class='system'>";
} elseif (substr($icon,0,5)=='icon-') {
$icon = "<i class='$icon system'></i>";
} else {
if (substr($icon,0,3)!='fa-') $icon = "fa-$icon";
$icon = "<i class='fa $icon system'></i>";
}
$title = $themes2 ? "" : " title='{$button['Title']}'";
echo "<div id='nav-item' class='{$button['name']} util'><a href='".($button['Href'] ?? '#')."' onclick='{$button['name']}();return false;'{$title}>$icon<span>{$button['Title']}</span></a></div>";
} else
echo "<div id='{$page['Link']}'></div>";
echo "<div id='{$button['Link']}'></div>";
}
unset($buttons);
unset($buttons,$button);
if ($notify['display']) {
echo "<span id='nav-tub1' class='tub'><i id='box-tub1' class='fa fa-square grey-text'></i><span id='txt-tub1' class='score one'>0</span></span>";
echo "<span id='nav-tub2' class='tub'><i id='box-tub2' class='fa fa-square grey-text'></i><span id='txt-tub2' class='score one'>0</span></span>";
@@ -400,17 +410,21 @@ foreach ($pages as $page) {
foreach ($pgs as $pg) {
@eval("\$title=\"".htmlspecialchars($pg['Title'])."\";");
$link = "$path/{$pg['name']}";
$icon = $pg['Icon'] ?? false;
if ($icon) {
if (substr($icon,-4)=='.png') {
$icon = "{$pg['root']}/images/$icon";
if (!file_exists($icon)) {$icon = "{$pg['root']}/$icon"; if (!file_exists($icon)) $icon = '/webGui/images/default.png';}
$icon = "<img class=\"PanelImg\" src=\"$icon\">";
$icon = $pg['Icon'] ?? "<i class='icon-app PanelIcon'></i>";
if (substr($icon,-4)=='.png') {
$root = $pg['root'];
if (file_exists("$docroot/$root/images/$icon")) {
$icon = "<img src='/$root/images/$icon' class='PanelImg'>";
} elseif (file_exists("$docroot/$root/$icon")) {
$icon = "<img src='/$root/$icon' class='PanelImg'>";
} else {
$icon = "<i class='PanelIcon fa fa-$icon'></i>";
$icon = "<i class='icon-app PanelIcon'></i>";
}
} else {
$icon = "<img class=\"PanelImg\" src=\"/webGui/images/default.png\">";
} elseif (substr($icon,0,5)=='icon-') {
$icon = "<i class='$icon PanelIcon'></i>";
} elseif ($icon[0]!='<') {
if (substr($icon,0,3)!='fa-') $icon = "fa-$icon";
$icon = "<i class='fa $icon PanelIcon'></i>";
}
echo "<div class=\"Panel\"><a href=\"$link\" onclick=\"$.cookie('one','tab1',{path:'/'})\">$icon<div class=\"PanelText\">$title</div></a></div>";
}
@@ -418,10 +432,10 @@ foreach ($pages as $page) {
empty($page['Markdown']) || $page['Markdown']=='true' ? eval('?>'.Markdown($page['text'])) : eval('?>'.$page['text']);
if ($close) echo "</div></div>";
}
unset($pages);
unset($pages,$page,$pgs,$pg,$icon);
?>
</div></div>
<iframe id="progressFrame" name="progressFrame" frameborder="0"></iframe>
</div></div>
<iframe id="progressFrame" name="progressFrame" frameborder="0"></iframe>
<?
// Build footer
echo '<div id="footer"><span id="statusraid"><span id="statusbar">';
@@ -475,7 +489,7 @@ function parseINI(data){
return value;
}
// unraid animated logo
var unraid_logo = '<?=file_get_contents("$docroot/webGui/images/animated-logo.svg")?>';
var unraid_logo = '<?readfile("$docroot/webGui/images/animated-logo.svg")?>';
var watchdog = new NchanSubscriber('/sub/var', /^((?!chrome|android).)*safari/i.test(navigator.userAgent) ? {subscriber:'longpoll'} : {});
watchdog.on('message', function(data) {
@@ -529,17 +543,6 @@ $(function() {
<?elseif (!in_array($regTy,['trial','basic','plus','pro'])):?>
$('#licensetype').addClass('red-text');
<?endif;?>
if ($("div#nav-right").css('float').toLowerCase() == 'right') {
var origNavRightWidth = $('div#nav-right').width();
var adjustMenuSize = function() {
if ($('div#nav-block').width() - $('div#nav-left').width() <= origNavRightWidth+6) {
$('div#nav-right div#nav-item a').css('min-width', 0).find('span').hide();
} else {
$('div#nav-right div#nav-item a').css('min-width', '').find('span').show();
}
};
$(window).resize(adjustMenuSize).load(adjustMenuSize);
}
<?if ($notify['entity'] & 1 == 1):?>
$.post('/webGui/include/Notify.php',{cmd:'init'},function(){timers.notifier = setTimeout(notifier,0);});
<?endif;?>

View File

@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -52,17 +52,17 @@ function device_info(&$disk,$online) {
} else
$ctrl = '';
switch ($disk['color']) {
case 'green-on': $help = 'Normal operation, device is active'; break;
case 'green-blink': $help = 'Device is in standby mode (spun-down)'; break;
case 'blue-on': $help = 'New device'; break;
case 'blue-blink': $help = 'New device, in standby mode (spun-down)'; break;
case 'yellow-on': $help = $disk['type']=='Parity' ? 'Parity is invalid' : 'Device contents emulated'; break;
case 'yellow-blink': $help = $disk['type']=='Parity' ? 'Parity is invalid, in standby mode (spun-down)' : 'Device contents emulated, in standby mode (spun-down)'; break;
case 'red-on': case 'red-blink': $help = $disk['type']=='Parity' ? 'Parity device is disabled' : 'Device is disabled, contents emulated'; break;
case 'red-off': $help = $disk['type']=='Parity' ? 'Parity device is missing' : 'Device is missing (disabled), contents emulated'; break;
case 'grey-off': $help = 'Device not present'; break;
case 'green-on': $orb = 'circle'; $color = 'green'; $help = 'Normal operation, device is active'; break;
case 'green-blink': $orb = 'circle'; $color = 'grey'; $help = 'Device is in standby mode (spun-down)'; break;
case 'blue-on': $orb = 'square'; $color = 'blue'; $help = 'New device'; break;
case 'blue-blink': $orb = 'square'; $color = 'grey'; $help = 'New device, in standby mode (spun-down)'; break;
case 'yellow-on': $orb = 'warning'; $color = 'yellow'; $help = $disk['type']=='Parity' ? 'Parity is invalid' : 'Device contents emulated'; break;
case 'yellow-blink': $orb = 'warning'; $color = 'grey'; $help = $disk['type']=='Parity' ? 'Parity is invalid, in standby mode (spun-down)' : 'Device contents emulated, in standby mode (spun-down)'; break;
case 'red-on': case 'red-blink': $orb = 'times'; $color = 'red'; $help = $disk['type']=='Parity' ? 'Parity device is disabled' : 'Device is disabled, contents emulated'; break;
case 'red-off': $orb = 'times'; $color = 'red'; $help = $disk['type']=='Parity' ? 'Parity device is missing' : 'Device is missing (disabled), contents emulated'; break;
case 'grey-off': $orb = 'square'; $color = 'grey'; $help = 'Device not present'; break;
}
$status = "$ctrl<a class='info nohand' onclick='return false'><img src='/webGui/images/{$disk['color']}.png' class='icon'><span>$help</span></a>";
$status = "$ctrl<a class='info nohand' onclick='return false'><i class='fa fa-$orb orb $color-orb'></i><span>$help</span></a>";
$link = ($disk['type']=='Parity' && strpos($disk['status'],'_NP')===false) ||
($disk['type']=='Data' && $disk['status']!='DISK_NP') ||
($disk['type']=='Cache' && $disk['status']!='DISK_NP') ||
@@ -101,7 +101,13 @@ function device_browse(&$disk) {
function device_desc(&$disk) {
global $var;
$size = my_scale($disk['size'] ? $disk['size']*1024 : $disk['sectors']*$disk['sector_size'],$unit,-1);
$log = $var['fsState']=='Started' ? "<a href=\"#\" title=\"Disk Log Information\" onclick=\"openBox('/webGui/scripts/disk_log&arg1={$disk['device']}','Disk Log Information',600,900,false);return false\"><i class=\"fa fa-hdd-o icon\"></i></a>" : "";
switch ($disk['type']) {
case 'Flash' : $type = 'usb'; break;
case 'Parity': $type = $disk['rotational'] ? 'disk' : 'nvme'; break;
case 'Data' :
case 'Cache' : $type = $disk['rotational'] ? ($disk['luksState'] ? 'disk-encrypted' : 'disk') : 'nvme'; break;
}
$log = $var['fsState']=='Started' ? "<a href=\"#\" title=\"Disk Log Information\" style=\"text-decoration:none\" onclick=\"openBox('/webGui/scripts/disk_log&arg1={$disk['device']}','Disk Log Information',600,900,false);return false\"><i class=\"icon-$type icon\"></i></a>" : "";
return $log.my_id($disk['id'])." - $size $unit ({$disk['device']})";
}
function assignment(&$disk) {
@@ -137,13 +143,13 @@ function fs_info(&$disk) {
echo "<td>".my_scale($disk['fsUsed']*1024,$unit)." $unit</td>";
} else {
$used = isset($disk['fsSize']) && $disk['fsSize']>0 ? 100-round(100*$disk['fsFree']/$disk['fsSize']) : 0;
echo "<td><div class='usage-disk'><span style='margin:0;width:$used%' class='".usage_color($disk,$used,false)."'><span>".my_scale($disk['fsUsed']*1024,$unit)." $unit</span></span></div></td>";
echo "<td><div class='usage-disk'><span style='width:$used%' class='".usage_color($disk,$used,false)."'></span>".my_scale($disk['fsUsed']*1024,$unit)." $unit</div></td>";
}
if ($display['text']<10 ? $display['text']%10==0 : $display['text']%10!=0) {
echo "<td>".my_scale($disk['fsFree']*1024,$unit)." $unit</td>";
} else {
$free = isset($disk['fsSize']) && $disk['fsSize']>0 ? round(100*$disk['fsFree']/$disk['fsSize']) : 0;
echo "<td><div class='usage-disk'><span style='margin:0;width:$free%' class='".usage_color($disk,$free,true)."'><span>".my_scale($disk['fsFree']*1024,$unit)." $unit</span></span></div></td>";
echo "<td><div class='usage-disk'><span style='width:$free%' class='".usage_color($disk,$free,true)."'></span>".my_scale($disk['fsFree']*1024,$unit)." $unit</div></td>";
}
echo "<td>".device_browse($disk)."</td>";
} else
@@ -193,9 +199,10 @@ function array_offline(&$disk) {
case 'DISK_INVALID':
case 'DISK_DSBL_NEW':
case 'DISK_NEW':
$spin = strpos($disk['color'],'blink')===false;
echo "<td>".device_info($disk,false)."</td>";
echo "<td>".assignment($disk)."</td>";
echo "<td>".my_temp($disk['temp'])."</td>";
echo "<td>".($spin ? my_temp($disk['temp']) : '*')."</td>";
echo "<td colspan='8'>$warning</td>";
break;
case 'DISK_WRONG':
@@ -246,9 +253,10 @@ function array_online(&$disk) {
break;
case 'DISK_DSBL':
default:
$spin = strpos($disk['color'],'blink')===false;
echo "<td>".device_info($disk,true)."</td>";
echo "<td>".device_desc($disk)."</td>";
echo "<td>".my_temp($disk['temp'])."</td>";
echo "<td>".($spin ? my_temp($disk['temp']) : '*')."</td>";
echo "<td><span class='diskio'>".my_diskio($data[0])."</span><span class='number'>".my_number($disk['numReads'])."</span></td>";
echo "<td><span class='diskio'>".my_diskio($data[1])."</span><span class='number'>".my_number($disk['numWrites'])."</span></td>";
echo "<td>".my_number($disk['numErrors'])."</td>";
@@ -293,13 +301,13 @@ function show_totals($text) {
echo "<td>".my_scale($sum['fsUsed']*1024,$unit)." $unit</td>";
} else {
$used = $sum['fsSize'] ? 100-round(100*$sum['fsFree']/$sum['fsSize']) : 0;
echo "<td><div class='usage-disk'><span style='margin:0;width:$used%' class='".usage_color($display,$used,false)."'><span>".my_scale($sum['fsUsed']*1024,$unit)." $unit</span></span></div></td>";
echo "<td><div class='usage-disk'><span style='width:$used%' class='".usage_color($display,$used,false)."'></span>".my_scale($sum['fsUsed']*1024,$unit)." $unit</div></td>";
}
if ($display['text']<10 ? $display['text']%10==0 : $display['text']%10!=0) {
echo "<td>".my_scale($sum['fsFree']*1024,$unit)." $unit</td>";
} else {
$free = $sum['fsSize'] ? round(100*$sum['fsFree']/$sum['fsSize']) : 0;
echo "<td><div class='usage-disk'><span style='margin:0;width:$free%' class='".usage_color($display,$free,true)."'><span>".my_scale($sum['fsFree']*1024,$unit)." $unit</span></span></div></td>";
echo "<td><div class='usage-disk'><span style='width:$free%' class='".usage_color($display,$free,true)."'></span>".my_scale($sum['fsFree']*1024,$unit)." $unit</div></td>";
}
echo "<td></td>";
} else
@@ -348,7 +356,7 @@ case 'array':
foreach ($parity as $disk) array_offline($disk);
echo "<tr class='tr_last'><td style='height:12px' colspan='11'></td></tr>";
foreach ($data as $disk) array_offline($disk);
echo "<tr class='tr_last'><td><img src='/webGui/images/sum.png' class='icon'>Slots:</td><td colspan='9'>".array_slots()."</td><td></td></tr>";
echo "<tr class='tr_last'><td>Slots:</td><td colspan='9'>".array_slots()."</td><td></td></tr>";
} else {
foreach ($parity as $disk) if ($disk['status']!='DISK_NP_DSBL') array_online($disk);
foreach ($data as $disk) array_online($disk);
@@ -361,7 +369,7 @@ case 'flash':
$disk['fsUsed'] = $disk['fsSize']-$disk['fsFree'];
$flash = &$sec['flash']; $share = "";
if ($var['shareSMBEnabled']=='yes' && $flash['export']=='e' && $flash['security']=='public')
$share = "<a class='info nohand' onclick='return false'><i class='fa fa-warning fa-fw orange-text'></i><span>Flash device is set as public share<br>Please change share SMB security</span></a>";
$share = "<a class='info nohand' onclick='return false'><i class='fa fa-warning fa-fw orange-text'></i><span>Flash device is set as public share<br>Please change share SMB security<br>Click on <b>FLASH</b> above this message</span></a>";
echo "<tr>";
echo "<td>".$share.device_info($disk,true)."</td>";
echo "<td>".device_desc($disk)."</td>";
@@ -385,7 +393,7 @@ case 'cache':
}
$data = []; foreach ($log as $key => $value) $data[] = "$key=\"$value\"";
file_put_contents($tmp,implode("\n",$data));
echo "<tr class='tr_last'><td><img src='/webGui/images/sum.png' class='icon'>Slots:</td><td colspan='9'>".cache_slots($off)."</td><td></td></tr>";
echo "<tr class='tr_last'><td>Slots:</td><td colspan='9'>".cache_slots($off)."</td><td></td></tr>";
} else {
foreach ($cache as $disk) array_online($disk);
@unlink($tmp);

View File

@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -74,10 +74,9 @@ $row = 0;
foreach ($disks as $name => $disk) {
$color = $disk['fsColor'];
$row++;
$ball = "/webGui/images/$color.png";
switch ($color) {
case 'green-on': $help = 'All files protected'; break;
case 'yellow-on': $help = 'All files unprotected'; break;
case 'green-on' : $orb = 'circle'; $color = 'green'; $help = 'All files protected'; break;
case 'yellow-on': $orb = 'warning'; $color = 'yellow'; $help = 'All files unprotected'; break;
}
if ($crypto) switch ($disk['luksState']) {
case 0: $luks = "<i class='nolock fa fa-lock'></i>"; break;
@@ -86,7 +85,7 @@ foreach ($disks as $name => $disk) {
default: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-lock red-text'></i><span>Unknown encryption state'</span></a>"; break;
} else $luks = "";
echo "<tr>";
echo "<td><a class='info nohand' onclick='return false'><img src='$ball' class='icon'><span style='left:18px'>$help</span></a>$luks<a href='$path/Disk?name=$name' onclick=\"$.cookie('one','tab1',{path:'/'})\">$name</a></td>";
echo "<td><a class='info nohand' onclick='return false'><i class='fa fa-$orb orb $color-orb'></i><span style='left:18px'>$help</span></a>$luks<a href='$path/Disk?name=$name' onclick=\"$.cookie('one','tab1',{path:'/'})\">$name</a></td>";
echo "<td>{$disk['comment']}</td>";
echo "<td>".disk_share_settings($var['shareSMBEnabled'], $sec[$name])."</td>";
echo "<td>".disk_share_settings($var['shareNFSEnabled'], $sec_nfs[$name])."</td>";

View File

@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,5 +1,5 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
/* Copyright 2005-2018, Lime Technology
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

View File

@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -15,24 +15,24 @@ $docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Wrappers.php";
// Helper functions
function my_scale($value, &$unit, $decimals=NULL, $scale=NULL) {
function my_scale($value, &$unit, $decimals=NULL, $scale=NULL, $kilo=1000) {
global $display;
$scale = $scale ?? $display['scale'];
$number = $display['number'];
$number = $display['number'] ?? '.,';
$units = ['B','KB','MB','GB','TB','PB','EB','ZB','YB'];
$size = count($units);
if ($scale==0 && ($decimals===NULL || $decimals<0)) {
$decimals = 0;
$unit = '';
} else {
$base = $value ? floor(log($value, 1000)) : 0;
$base = $value ? floor(log($value, $kilo)) : 0;
if ($scale>0 && $base>$scale) $base = $scale;
if ($base>$size) $base = $size-1;
$value /= pow(1000, $base);
$value /= pow($kilo, $base);
if ($decimals===NULL) $decimals = $value>=100 ? 0 : ($value>=10 ? 1 : (round($value*100)%100===0 ? 0 : 2));
elseif ($decimals<0) $decimals = $value>=100||round($value*10)%10===0 ? 0 : abs($decimals);
if ($scale<0 && round($value,-1)==1000) {$value = 1; $base++;}
$unit = $units[$base];
$unit = $kilo!=1024 ? $units[$base] : preg_replace('/^(.)B$/','$1iB',$units[$base]);
}
return number_format($value, $decimals, $number[0], $value>9999 ? $number[1] : '');
}
@@ -80,7 +80,7 @@ function my_usage() {
}
if ($var['fsNumMounted']>0) {
$used = $arraysize ? 100-round(100*$arrayfree/$arraysize) : 0;
echo "<div class='usage-bar'><span style='width:{$used}%' class='".usage_color($display,$used,false)."'><span>{$used}%</span></span></div>";
echo "<div class='usage-bar'><span style='width:{$used}%' class='".usage_color($display,$used,false)."'>{$used}%</span></div>";
} else {
echo "<div class='usage-bar'><span style='text-align:center'>".($var['fsState']=='Started'?'Maintenance':'off-line')."</span></div>";
}

View File

@@ -1,5 +1,5 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
/* Copyright 2005-2018, Lime Technology
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,

Some files were not shown because too many files have changed in this diff Show More