Multi-language support

This commit is contained in:
bergware
2020-03-04 17:33:46 +01:00
parent 5712ec6282
commit c8148442d2
163 changed files with 3886 additions and 2838 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+11 -7
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -12,6 +12,10 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = '';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
$var = parse_ini_file("/var/local/emhttp/var.ini");
@@ -39,27 +43,27 @@ function timer() {
}
function reboot_online() {
$.ajax({url:'/webGui/include/ProcessStatus.php',type:'POST',data:{name:'emhttpd',update:true},timeout:5000})
.done(function(){$('div.notice').html('<span class="title">Reboot</span>System is going down... '+timer()); setTimeout(reboot_online,5000);})
.done(function(){$('div.notice').html('<span class="title"><?=_("Reboot")?></span><?=_("System is going down")?>... '+timer()); setTimeout(reboot_online,5000);})
.fail(function(){start=new Date(); setTimeout(reboot_offline,5000);});
}
function reboot_offline() {
$.ajax({url:'/webGui/include/ProcessStatus.php',type:'POST',data:{name:'emhttpd',update:true},timeout:5000})
.done(function(){location = '/Main';})
.fail(function(){$('div.notice').html('<span class="title">Reboot</span>System is rebooting... '+timer()); setTimeout(reboot_offline,1000);});
.fail(function(){$('div.notice').html('<span class="title"><?=_("Reboot")?></span><?=_("System is rebooting")?>... '+timer()); setTimeout(reboot_offline,1000);});
}
function shutdown_online() {
$.ajax({url:'/webGui/include/ProcessStatus.php',type:'POST',data:{name:'emhttpd',update:true},timeout:5000})
.done(function(){$('div.notice').html('<span class="title">Shutdown</span>System is going down... '+timer()); setTimeout(shutdown_online,5000);})
.done(function(){$('div.notice').html('<span class="title"><?=_("Shutdown")?></span><?=_("System is going down")?>... '+timer()); setTimeout(shutdown_online,5000);})
.fail(function(){start=new Date(); setTimeout(shutdown_offline,5000);});
}
function shutdown_offline() {
var time = timer();
if (time < 30) {
$('div.notice').html('<span class="title">Shutdown</span>System is offline... '+time);
$('div.notice').html('<span class="title"><?=_("Shutdown")?></span><?=_("System is offline")?>... '+time);
setTimeout(shutdown_offline,5000);
} else {
$('div.notice').html('<span class="title">Shutdown</span>System is powered off...');
$('div.notice').html('<span class="title"><?=_("Shutdown")?></span><?=_("System is powered off")?>...');
}
}
$(document).ajaxSend(function(elm, xhr, s){
+18 -15
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -12,6 +12,10 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = '';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
function parent_link() {
@@ -23,7 +27,9 @@ function trim_slash($url){
return preg_replace('/\/\/+/','/',$url);
}
function my_name($name) {
return implode(', ',array_map('my_disk',explode(',',$name)));
$names = [];
foreach (array_map('my_disk',explode(',',$name)) as $fancy) $names[] = my_lang($fancy,3);
return implode(', ',$names);
}
extract(parse_plugin_cfg('dynamix',true));
$disks = parse_ini_file('state/disks.ini',true);
@@ -40,7 +46,7 @@ if ($user) {
$set = explode("\n",str_replace(",\n",",",preg_replace("/(cache|disk)/","\n$1",$set[0]))); $i = 0;
}
echo "<thead><tr><th>Type</th><th class='sorter-text'>Name</th><th>Size</th><th>Last Modified</th><th>Location</th></tr></thead>";
echo "<thead><tr><th>"._('Type')."</th><th class='sorter-text'>"._('Name')."</th><th>"._('Size')."</th><th>"._('Last Modified')."</th><th>"._('Location')."</th></tr></thead>";
if ($link = parent_link()) echo "<tbody class='tablesorter-infoOnly'><tr><td><div><img src='/webGui/icons/folderup.png'></div></td><td>$link</td><td colspan='3'></td></tr></tbody>";
foreach ($file as $row) {
@@ -54,11 +60,11 @@ foreach ($file as $row) {
foreach ($rows as $row) $show |= strpos($disks[$tag.str_replace($tag,'',$row)]['fsType'],'luks:')!==false;
if ($show) foreach ($rows as $row) {
switch ($disks[$tag.str_replace($tag,'',$row)]['luksState']) {
case 0: $luks .= "<a class='info' onclick='return false'><i class='lock fa fa-unlock grey-text'></i><span>Not encrypted</span></a>"; break;
case 1: $luks .= "<a class='info' onclick='return false'><i class='lock fa fa-unlock-alt green-text'></i><span>Encrypted and unlocked</span></a>"; break;
case 2: $luks .= "<a class='info' onclick='return false'><i class='lock fa fa-lock red-text'></i><span>Locked: missing encryption key</span></a>"; break;
case 3: $luks .= "<a class='info' onclick='return false'><i class='lock fa fa-lock red-text'></i><span>Locked: wrong encryption key</span></a>"; break;
default: $luks .= "<a class='info' onclick='return false'><i class='lock fa fa-lock red-text'></i><span>Locked: unknown error</span></a>"; break;}
case 0: $luks .= "<a class='info' onclick='return false'><i class='lock fa fa-unlock grey-text'></i><span>"._('Not encrypted')."</span></a>"; break;
case 1: $luks .= "<a class='info' onclick='return false'><i class='lock fa fa-unlock-alt green-text'></i><span>"._('Encrypted and unlocked')."</span></a>"; break;
case 2: $luks .= "<a class='info' onclick='return false'><i class='lock fa fa-lock red-text'></i><span>"._('Locked: missing encryption key')."</span></a>"; break;
case 3: $luks .= "<a class='info' onclick='return false'><i class='lock fa fa-lock red-text'></i><span>"._('Locked: wrong encryption key')."</span></a>"; break;
default: $luks .= "<a class='info' onclick='return false'><i class='lock fa fa-lock red-text'></i><span>"._('Locked: unknown error')."</span></a>"; break;}
}
$list[] = [
'type' => $attr[0],
@@ -78,7 +84,7 @@ foreach ($list as $row) {
echo "<tr>";
echo "<td data=''><div class='icon-dir'></div></td>";
echo "<td><a href=\"/$path?dir=".htmlspecialchars(urlencode_path(trim_slash($dir.'/'.$row['name'])))."\">".htmlspecialchars($row['name'])."</a></td>";
echo "<td data='0'>&lt;DIR&gt;</td>";
echo "<td data='0'>&lt;"._('FOLDER')."&gt;</td>";
echo "<td data='{$row['time']}'>".my_time($row['time'],"%F {$display['time']}")."</td>";
echo "<td class='loc'>{$row['disk']}</td>";
echo "</tr>";
@@ -99,8 +105,5 @@ foreach ($list as $row) {
}
echo "</tbody>";
$objs = $dirs+$files;
$objtext = "$objs object".($objs==1?'':'s');
$dirtext = "$dirs director".($dirs==1?'y':'ies');
$filetext = "$files file".($files==1?'':'s');
$totaltext = $files==0 ? '':'('.my_scale($total,$unit).' '.$unit.' total)';
echo "<tfoot><tr><td></td><td colspan='4'>$objtext: $dirtext, $filetext $totaltext</td></tr></tfoot>";
$totaltext = $files==0 ? '' : '('.my_scale($total,$unit).' '.$unit.' '._('total').')';
echo "<tfoot><tr><td></td><td colspan='4'>$objs "._('object'.($objs==1?'':'s')).": $dirs "._('director'.($dirs==1?'y':'ies')).", $files "._('file'.($files==1?'':'s'))." $totaltext</td></tr></tfoot>";
+8 -4
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -12,6 +12,10 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = 'settings';
require_once "$docroot/webGui/include/Translations.php";
$cpus = explode(';',$_POST['cpus']);
function scan($area, $text) {
@@ -26,7 +30,7 @@ function create($id, $name, $vcpu) {
$text = [];
$unit = str_replace([' ','(',')','[',']'],'',$name);
$name = urlencode($name);
echo "<td><span id='$id-$unit' style='color:#267CA8;display:none'><i class='fa fa-refresh fa-spin'></i> updating</span></td>";
echo "<td><span id='$id-$unit' style='color:#267CA8;display:none'><i class='fa fa-refresh fa-spin'></i> "._('updating')."</span></td>";
for ($c = 0; $c < $loop; $c++) {
$max = ($c == $loop-1 ? ($total%32?:32) : 32);
for ($n = 0; $n < $max; $n++) {
@@ -118,7 +122,7 @@ case 'is':
sort($isolcpus,SORT_NUMERIC);
$isolcpus = array_unique($isolcpus,SORT_NUMERIC);
}
echo "<tr><td>Isolated CPUs</td>";
echo "<tr><td>"._('Isolated CPUs')."</td>";
create('is', 'isolcpus', $isolcpus);
echo "</tr>";
break;
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+8 -3
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -11,8 +11,13 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = 'settings';
require_once "$docroot/webGui/include/Translations.php";
$port = $_POST['port'] ?: 'eth0';
if (exec("ip link show ".escapeshellarg($port)."|grep -om1 'NO-CARRIER'")) {
echo "<b>Interface ".str_replace('eth', 'Ethernet Port ', $port)." is down. Check cable!</b>";
echo "<b>"._('Interface')." ".str_replace('eth', _('Ethernet Port')." ", $port)." "._('is down').". "._('Check cable')."!</b>";
}
?>
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+39 -34
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -12,6 +12,10 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = 'dashboard';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
function normalize($type,$count) {
@@ -23,7 +27,7 @@ function my_unit($value,$unit) {
return ($unit=='F' ? round(9/5*$value+32) : $value)." $unit";
}
function my_clock($time) {
if (!$time) return 'less than a minute';
if (!$time) return _('less than a minute');
$days = floor($time/1440);
$hour = $time/60%24;
$mins = $time%60;
@@ -122,6 +126,8 @@ function device_name(&$disk, $array) {
case 'Cache' : $type = $disk['rotational'] ? ($disk['luksState'] ? 'disk-encrypted' : 'disk') : 'nvme'; break;
}
$name = my_disk($disk['name']);
[$p1,$p2] = explode(' ',$name);
$name = _($p1).($p2?" $p2":"");
return "<i class='icon-$type'></i> <a href=\"".htmlspecialchars("$path/Device?name={$disk['name']}")."\" title=\"$name settings\">$name</a>";
} else {
$name = $disk['device'];
@@ -144,7 +150,7 @@ function device_status(&$disk, $array, &$error, &$warning) {
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";
return "<i class='fa fa-circle orb $color-orb middle'></i>"._($text);
}
function device_temp(&$disk, &$red, &$orange) {
$spin = strpos($disk['color'],'blink')===false;
@@ -171,7 +177,7 @@ function device_smart(&$disk, $name, &$fail, &$smart) {
$events = explode('|',get_value($disk,'smEvents',$numbers));
$title = '';
$thumb = 'thumbs-o-up';
$text = 'healthy';
$text = _('healthy');
$color = 'green';
$file = "state/smart/$name";
if (file_exists("$file.ssa") && in_array(file_get_contents("$file.ssa"),$failed)) {
@@ -186,10 +192,10 @@ function device_smart(&$disk, $name, &$fail, &$smart) {
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";
if ($title) {$thumb = 'thumbs-o-down'; $color = 'orange'; $text = _('error'); $smart++;} else $title = _('No errors reported')."\n";
}
}
$title .= "Click for context menu";
$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) {
@@ -358,18 +364,18 @@ case 'status':
}
if ($var['mdResync']==0) {
if ($parity_slots==$parity_disabled) {
echo "<span class='red'>Parity disk".($parity_slots==1?'':'s')." not present</span>";
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>";
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>";
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>";
echo "<span class='red strong'>"._('Parity is invalid')."</span>";
} else {
echo "<span class='red strong'>Data is invalid</span>";
echo "<span class='red strong'>"._('Data is invalid')."</span>";
}
}
} else {
@@ -384,56 +390,57 @@ case 'status':
} elseif (strstr($var['mdResyncAction'],"check")) {
$mode = 'Parity-Check';
}
echo "<span class='orange'>$mode in progress... Completed: ".number_format(($var['mdResyncPos']/($var['mdResync']/100+1)),1,$number[0],$number[1])." %.</span>";
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':
extract(parse_plugin_cfg('dynamix', true));
$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']);
echo sprintf(_('Last check incomplete on **%s**'),my_lang(my_time($var['sbSynced2']).my_lang(day_count($var['sbSynced2']),1))).'<br>'.sprintf(_('Finding **%s** error'.($var['sbSyncErrs']==1?'':'s')),$var['sbSyncErrs']?:'0');
echo " <i class='fa fa-fw 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.";
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);
echo sprintf(_('Last checked on **%s**'),my_lang(my_time($date).my_lang(day_count($date),1))).'<br> '.sprintf(_('Finding **%s** error'.($error==1?'':'s')),$error?:'0');
echo " <i class='fa fa-fw fa-clock-o'></i> "._('Duration').": ".my_lang(my_check($duration,$speed),2);
} 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);
echo sprintf(_('Last check incomplete on **%s**'),my_lang(my_time($date).my_lang(day_count($date),1))).'<br>'.sprintf(_('Finding **%s** error'.($error==1?'':'s')),$error?:'0');
echo " <i class='fa fa-fw 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);
echo sprintf(_('Last checked on **%s**'),my_lang(my_time($var['sbSynced']).my_lang(day_count($var['sbSynced']),1))).'<br>'.sprintf(_('Finding **%s** error'.($error==1?'':'s')),$error?:'0');
echo " <i class='fa fa-fw fa-clock-o'></i> "._('Duration').": ".my_lang(my_check($duration,$speed),2);
} 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);
echo sprintf(_('Last check incomplete on **%s**'),my_lang(my_time($var['sbSynced']).my_lang(day_count($var['sbSynced']),1))).'<br>'.sprintf(_('Finding **%s** error'.($error==1?'':'s')),$error?:'0');
echo " <i class='fa fa-fw 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>";
echo sprintf(_('Current operation %s on **%s**'),($var['mdResync']?_('started'):_('paused')),my_lang(my_time($var['sbUpdated']).my_lang(day_count($var['sbSynced']),1))).'<br>'.sprintf(_('Finding **%s** error'.($var['sbSyncErrs']==1?'':'s')),$var['sbSyncErrs']?:'0');
echo "<br><i class='fa fa-fw fa-clock-o'></i> "._('Elapsed time').": ".my_lang(my_clock(floor((time()-$var['sbUpdated'])/60)),2);
echo "<br><i class='fa fa-fw fa-flag-checkered'></i> "._('Estimated finish').': '.my_lang(my_clock(round(((($var['mdResyncDt']*(($var['mdResync']-$var['mdResyncPos'])/($var['mdResyncDb']/100+1)))/100)/60),0)),2);
}
} 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);
echo sprintf(_('Last check completed on **%s**'),my_lang(my_time($var['sbSynced2']).my_lang(day_count($var['sbSynced2']),1))).'<br>'.sprintf(_('Finding **%s** error'.($var['sbSyncErrs']==1?'':'s')),$var['sbSyncErrs']?:'0');
echo " <i class='fa fa-fw fa-clock-o'></i> "._('Duration').': '.my_lang(my_check($duration,$speed),2);
}
if ($idle) {
extract(parse_plugin_cfg('dynamix', true));
list($m,$h) = explode(' ', $parity['hour']);
$time = time();
switch ($parity['mode']) {
case 0: // check disabled
echo "\0";
echo "<i class='fa fa-warning'></i> Scheduled parity check is disabled";
echo "<i class='fa fa-warning'></i> "._('Scheduled parity check is disabled');
return;
case 1: // daily check
$t = mktime($h,$m,0)-$time;
@@ -491,10 +498,8 @@ case 'parity':
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> Due in: ";
echo my_clock(floor($t/60));
echo sprintf(_('Next check scheduled on **%s**'),my_lang(strftime($_POST['time'],$time+$t)));
echo "<br><i class='fa fa-fw fa-clock-o'></i> "._('Due in').": ".my_lang(my_clock(floor($t/60)),2);
} else {
echo "\0";
}
+13 -9
View File
@@ -1,7 +1,7 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2014-2018, Guilherme Jardim, Eric Schultz, Jon Panozzo.
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2014-2020, Guilherme Jardim, Eric Schultz, Jon Panozzo.
* Copyright 2012-2020, 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,
@@ -13,6 +13,10 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = 'dashboard';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
require_once "$docroot/plugins/dynamix.vm.manager/include/libvirt_helpers.php";
@@ -38,7 +42,7 @@ if ($_POST['docker'] && ($display=='icons' || $display=='docker')) {
$running = $info['running'] ? 1:0;
$paused = $info['paused'] ? 1:0;
$is_autostart = $info['autostart'] ? 'true':'false';
$updateStatus = $info['updated']=='true'||$info['updated']=='undef' ? 'true':'false';
$updateStatus = substr($ct['NetworkMode'],-4)==':???' ? 2 : ($info['updated']=='true' ? 0 : ($info['updated']=='false' ? 1 : 3));
$template = $info['template'];
$shell = $info['shell'];
$webGui = html_entity_decode($info['url']);
@@ -49,12 +53,12 @@ if ($_POST['docker'] && ($display=='icons' || $display=='docker')) {
$shape = $running ? ($paused ? 'pause' : 'play') : 'square';
$status = $running ? ($paused ? 'paused' : 'started') : 'stopped';
$color = $status=='started' ? 'green-text' : ($status=='paused' ? 'orange-text' : 'red-text');
$update = $updateStatus=='false' ? 'blue-text' : '';
$update = $updateStatus==1 ? 'blue-text' : '';
$icon = $info['icon'] ?: '/plugins/dynamix.docker.manager/images/question.png';
$image = substr($icon,-4)=='.png' ? "<img src='$icon?".filemtime("$docroot{$info['icon']}")."' class='img'>" : (substr($icon,0,5)=='icon-' ? "<i class='$icon img'></i>" : "<i class='fa fa-$icon img'></i>");
echo "<span class='outer solid apps $status'><span id='$id' class='hand'>$image</span><span class='inner'><span class='$update'>$name</span><br><i class='fa fa-$shape $status $color'></i><span class='state'>$status</span></span></span>";
echo "<span class='outer solid apps $status'><span id='$id' class='hand'>$image</span><span class='inner'><span class='$update'>$name</span><br><i class='fa fa-$shape $status $color'></i><span class='state'>"._($status)."</span></span></span>";
}
$none = count($containers) ? "No running docker containers" : "No docker containers defined";
$none = count($containers) ? _('No running docker containers') : _('No docker containers defined');
echo "<span id='no_apps' style='display:none'>$none<br><br></span>";
echo "</td><td></td></tr>";
}
@@ -108,9 +112,9 @@ if ($_POST['vms'] && ($display=='icons' || $display=='vms')) {
break;
}
$image = substr($icon,-4)=='.png' ? "<img src='$icon' class='img'>" : (substr($icon,0,5)=='icon-' ? "<i class='$icon img'></i>" : "<i class='fa fa-$icon img'></i>");
echo "<span class='outer solid vms $status'><span id='vm-$uuid' class='hand'>$image</span><span class='inner'>$vm<br><i class='fa fa-$shape $status $color'></i><span class='state'>$status</span></span></span>";
echo "<span class='outer solid vms $status'><span id='vm-$uuid' class='hand'>$image</span><span class='inner'>$vm<br><i class='fa fa-$shape $status $color'></i><span class='state'>"._($status)."</span></span></span>";
}
$none = count($vms) ? "No running virtual machines" : "No virtual machines defined";
$none = count($vms) ? _('No running virtual machines') : _('No virtual machines defined');
echo "<span id='no_vms' style='display:none'>$none<br><br></span>";
echo "</td><td></td></tr>";
}
+64 -70
View File
@@ -73,7 +73,7 @@ if ($themes2) {
}
$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"));
$notes = "&nbsp;<a href='#' title='View Release Notes' onclick=\"openBox('/plugins/dynamix.plugin.manager/include/ShowChanges.php?tmp=1&file=$notes','Release Notes',600,900);return false\"><span class='fa fa-info-circle fa-fw'></span></a>"
$notes = "&nbsp;<a href='#' title='"._('View Release Notes')."' onclick=\"openBox('/plugins/dynamix.plugin.manager/include/ShowChanges.php?tmp=1&file=$notes','"._('Release Notes')."',600,900);return false\"><span class='fa fa-info-circle fa-fw'></span></a>"
?>
</style>
@@ -101,15 +101,15 @@ function resumeEvents(id,delay) {
startDelay += 50;
});
}
function plus(value,label,last) {
return value>0 ? (value+' '+label+(value!=1?'s':'')+(last?'':', ')) : '';
function plus(value,single,plural,last) {
return value>0 ? (value+' '+(value==1?single:plural)+(last?'':', ')) : '';
}
function updateTime() {
var now = new Date();
var days = parseInt(uptime/86400);
var hour = parseInt(uptime/3600%24);
var mins = parseInt(uptime/60%60);
$('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'));
$('span.uptime').html(((days|hour|mins)?plus(days,"<?=_('day')?>","<?=_('days')?>",(hour|mins)==0)+plus(hour,"<?=_('hour')?>","<?=_('hours')?>",mins==0)+plus(mins,"<?=_('minute')?>","<?=_('minutes')?>",true):"<?=_('less than a minute')?>"));
uptime += Math.round((now.getTime() - before.getTime())/1000);
before = now;
if (expiretime > 0) {
@@ -119,13 +119,13 @@ function updateTime() {
hour = parseInt(remainingtime/3600%24);
mins = parseInt(remainingtime/60%60);
if (days) {
$('#licenseexpire').html(plus(days,'day',true)+' remaining');
$('#licenseexpire').html(plus(days,"<?=_('day')?>","<?=_('days')?>",true)+" <?=_('remaining')?>");
} else if (hour) {
$('#licenseexpire').html(plus(hour,'hour',true)+' remaining').addClass('orange-text');
$('#licenseexpire').html(plus(hour,"<?=_('hour')?>","<?=_('hours')?>",true)+" <?=_('remaining')?>").addClass('orange-text');
} else if (mins) {
$('#licenseexpire').html(plus(mins,'minute',true)+' remaining').addClass('red-text');
$('#licenseexpire').html(plus(mins,"<?=_('minute')?>","<?=_('minutes')?>",true)+" <?=_('remaining')?>").addClass('red-text');
} else {
$('#licenseexpire').html('less than a minute remaining').addClass('red-text');
$('#licenseexpire').html("<?=_('less than a minute remaining')?>").addClass('red-text');
}
} else {
$('#licenseexpire').addClass('red-text');
@@ -170,7 +170,7 @@ function done(key) {
location.replace(path);
}
function chkDelete(form, button) {
button.value = form.confirmDelete.checked ? 'Delete' : 'Apply';
button.value = form.confirmDelete.checked ? '<?=_('Delete')?>' : '<?=_('Apply')?>';
button.disabled = false;
}
function openBox(cmd,title,height,width,load,func,id) {
@@ -182,15 +182,12 @@ function openBox(cmd,title,height,width,load,func,id) {
function openWindow(cmd,title,height,width) {
// open regular window (run in background)
var window_name = title.replace(/ /g,"_");
var form_html =
'<form action="/logging.htm" method="post" target="' + window_name + '">' +
'<input type="hidden" name="csrf_token" value="<?=$var['csrf_token']?>" />' +
'<input type="hidden" name="title" value="' + title + '" />';
var form_html = '<form action="/logging.htm" method="post" target="'+window_name+'">'+'<input type="hidden" name="csrf_token" value="<?=$var["csrf_token"]?>" />'+'<input type="hidden" name="title" value="'+title+'" />';
var vars = cmd.split('&');
form_html += '<input type="hidden" name="cmd" value="' + vars[0] + '" />';
form_html += '<input type="hidden" name="cmd" value="'+vars[0]+'">';
for (var i = 1; i < vars.length; i++) {
var pair = vars[i].split('=');
form_html += '<input type="hidden" name="' + pair[0] + '" value="' + pair[1] + '" />';
form_html += '<input type="hidden" name="'+pair[0]+'" value="'+pair[1]+'">';
}
form_html += '</form>';
var form = $(form_html);
@@ -269,12 +266,12 @@ function showBannerWarnings() {
currentBannerWarning++;
}
function addRebootNotice(message="You must reboot for changes to take effect") {
function addRebootNotice(message="<?=_('You must reboot for changes to take effect')?>") {
addBannerWarning("<i class='fa fa-warning' style='float:initial;'></i> "+message,false,true);
$.post("/plugins/dynamix.plugin.manager/scripts/PluginAPI.php",{action:'addRebootNotice',message:message});
}
function removeRebootNotice(message="You must reboot for changes to take effect") {
function removeRebootNotice(message="<?=_('You must reboot for changes to take effect')?>") {
var bannerIndex = bannerWarnings.indexOf("<i class='fa fa-warning' style='float:initial;'></i> "+message);
if ( bannerIndex < 0 ) {
return;
@@ -298,8 +295,8 @@ function hideUpgrade(set) {
}
function openUpgrade() {
hideUpgrade();
swal({title:'Update Unraid OS',text:'Do you want to update to the new version?',type:'warning',showCancelButton:true},function(){
openBox('/plugins/dynamix.plugin.manager/scripts/plugin&arg1=update&arg2=unRAIDServer.plg','Update Unraid OS',600,900,true);
swal({title:'<?=_("Update")?> Unraid OS',text:'<?=_("Do you want to update to the new version")?>?',type:'warning',showCancelButton:true},function(){
openBox('/plugins/dynamix.plugin.manager/scripts/plugin&arg1=update&arg2=unRAIDServer.plg','<?=_("Update")?> Unraid OS',600,900,true);
});
}
function notifier() {
@@ -376,7 +373,7 @@ $(function() {
$('#'+tab).attr('checked', true);
updateTime();
$.jGrowl.defaults.closeTemplate = '<i class="fa fa-close"></i>';
$.jGrowl.defaults.closerTemplate = '<?=$notify['position'][0]=='b' ? '<div>':'<div class="top">'?>[ close all notifications ]</div>';
$.jGrowl.defaults.closerTemplate = '<?=$notify['position'][0]=='b' ? '<div>':'<div class="top">'?>[ <?=_("close all notifications")?> ]</div>';
$.jGrowl.defaults.sticky = true;
$.jGrowl.defaults.check = 100;
$.jGrowl.defaults.position = '<?=$notify['position']?>';
@@ -398,17 +395,13 @@ $.ajaxPrefilter(function(s, orig, xhr){
// add any pre-existing reboot notices
$(function() {
<?
$rebootNotice = @file("/tmp/reboot_notifications") ?: array();
foreach ($rebootNotice as $notice):
?>
var rebootMessage = "<?=trim($notice)?>";
if ( rebootMessage ) {
addBannerWarning("<i class='fa fa-warning' style='float:initial;'></i> "+rebootMessage,false,true);
}
<?
endforeach;
?>
<?$rebootNotice = @file("/tmp/reboot_notifications") ?: [];?>
<?foreach ($rebootNotice as $notice):?>
var rebootMessage = "<?=trim($notice)?>";
if ( rebootMessage ) {
addBannerWarning("<i class='fa fa-warning' style='float:initial;'></i> "+rebootMessage,false,true);
}
<?endforeach;?>
});
</script>
</head>
@@ -418,12 +411,12 @@ $(function() {
<div id="header" class="<?=$display['banner']?>">
<div class="logo">
<a href="https://unraid.net" target="_blank"><?readfile("$docroot/webGui/images/UN-logotype-gradient.svg")?></a>
Version: <?=$var['version']?><?=$notes?>
<?=_('Version')?>: <?=$var['version']?><?=$notes?>
</div>
<div class="block">
<span class="text-left">Server<br/>Description<br/>Registration<br/>Uptime</span>
<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/>
<a href="/Tools/Registration" title="<?=_('Go to Registration page')?>">Unraid OS <span id="licensetype"><?=$var['regTy']?></span><span id="licenseexpire"></span></a><br/>
<span class="uptime"></span></span>
</div>
</div>
@@ -435,14 +428,14 @@ foreach ($tasks as $button) {
$page = $button['name'];
echo "<div id='nav-item'";
echo $task==$page ? " class='active'>" : ">";
echo "<a href='/$page' onclick='initab()'>$page</a></div>";
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 $button) {
eval("?>{$button['text']}");
eval('?>'.rewrite($button['text']));
if (empty($button['Link'])) {
$icon = $button['Icon'];
if (substr($icon,-4)=='.png') {
@@ -453,8 +446,8 @@ foreach ($buttons as $button) {
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>";
$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='{$button['Link']}'></div>";
}
@@ -514,10 +507,10 @@ foreach ($pages as $page) {
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:'/'})\"><span>$icon</span><div class=\"PanelText\">$title</div></a></div>";
echo "<div class=\"Panel\"><a href=\"$link\" onclick=\"$.cookie('one','tab1',{path:'/'})\"><span>$icon</span><div class=\"PanelText\">"._($title)."</div></a></div>";
}
}
empty($page['Markdown']) || $page['Markdown']=='true' ? eval('?>'.Markdown($page['text'])) : eval('?>'.$page['text']);
empty($page['Markdown']) || $page['Markdown']=='true' ? eval('?>'.Markdown(rewrite($page['text']))) : eval('?>'.rewrite($page['text']));
if ($close) echo "</div></div>";
}
unset($pages,$page,$pgs,$pg,$icon);
@@ -532,17 +525,17 @@ echo '<div id="footer"><span id="statusraid"><span id="statusbar">';
$progress = ($var['fsProgress']!='')? "&bullet;<span class='blue strong'>{$var['fsProgress']}</span>" : '';
switch ($var['fsState']) {
case 'Stopped':
echo "<span class='red strong'><i class='fa fa-stop-circle'></i> Array Stopped</span>$progress"; break;
echo "<span class='red strong'><i class='fa fa-stop-circle'></i> "._('Array Stopped')."</span>$progress"; break;
case 'Starting':
echo "<span class='orange strong'><i class='fa fa-pause-circle'></i> Array Starting</span>$progress"; break;
echo "<span class='orange strong'><i class='fa fa-pause-circle'></i> "._('Array Starting')."</span>$progress"; break;
case 'Stopping':
echo "<span class='orange strong'><i class='fa fa-pause-circle'></i> Array Stopping</span>$progress"; break;
echo "<span class='orange strong'><i class='fa fa-pause-circle'></i> "._('Array Stopping')."</span>$progress"; break;
default:
echo "<span class='green strong'><i class='fa fa-play-circle'></i> Array Started</span>$progress"; break;
echo "<span class='green strong'><i class='fa fa-play-circle'></i> "._('Array Started')."</span>$progress"; break;
}
echo "</span></span><span id='countdown'></span><span id='user-notice' class='red-text'></span>";
echo "<span id='copyright'>Unraid&reg; webGui &copy;2020, Lime Technology, Inc.";
echo " <a href='http://lime-technology.com/wiki/index.php/Official_Documentation' target='_blank' title='Online manual'><i class='fa fa-book'></i> manual</a>";
echo " <a href='http://lime-technology.com/wiki/index.php/Official_Documentation' target='_blank' title='"._('Online manual')."'><i class='fa fa-book'></i> "._('manual')."</a>";
echo "</span></div>";
?>
<script>
@@ -588,23 +581,23 @@ watchdog.on('message', function(data) {
var progress = ini['fsProgress'];
var status;
if (state=='Stopped') {
status = "<span class='red strong'><i class='fa fa-stop-circle'></i> Array Stopped</span>";
status = "<span class='red strong'><i class='fa fa-stop-circle'></i> <?=_('Array Stopped')?></span>";
} else if (state=='Started') {
status = "<span class='green strong'><i class='fa fa-play-circle'></i> Array Started</span>";
status = "<span class='green strong'><i class='fa fa-play-circle'></i> <?=_('Array Started')?></span>";
} else if (state=='Formatting') {
status = "<span class='green strong'><i class='fa fa-play-circle'></i> Array Started</span>&bullet;<span class='orange strong'>Formatting device(s)</span>";
status = "<span class='green strong'><i class='fa fa-play-circle'></i> <?=_('Array Started')?></span>&bullet;<span class='orange strong'><?=_('Formatting device(s)')?></span>";
} else {
status = "<span class='orange strong'><i class='fa fa-pause-circle'></i> Array "+state+"</span>";
}
if (ini['mdResyncPos']>0) {
var action;
if (ini['mdResyncAction'].indexOf("recon")>=0) action = "Parity-Sync / Data-Rebuild";
else if (ini['mdResyncAction'].indexOf("clear")>=0) action = "Clearing";
else if (ini['mdResyncAction']=="check") action = "Read-Check";
else if (ini['mdResyncAction'].indexOf("check")>=0) action = "Parity-Check";
if (ini['mdResyncAction'].indexOf("recon")>=0) action = "<?=_('Parity-Sync / Data-Rebuild')?>";
else if (ini['mdResyncAction'].indexOf("clear")>=0) action = "<?=_('Clearing')?>";
else if (ini['mdResyncAction']=="check") action = "<?=_('Read-Check')?>";
else if (ini['mdResyncAction'].indexOf("check")>=0) action = "<?=_('Parity-Check')?>";
action += " "+(ini['mdResyncPos']/(ini['mdResyncSize']/100+1)).toFixed(1)+" %";
status += "&bullet;<span class='orange strong'>"+action.replace('.','<?=$display['number'][0]?>')+"</span>";
if (ini['mdResync']==0) status += "(Paused)";
if (ini['mdResync']==0) status += "(<?=_('Paused')?>)";
}
if (progress) status += "&bullet;<span class='blue strong'>"+progress+"</span>";
$('#statusbar').html(status);
@@ -618,7 +611,7 @@ $(window).scroll(function() {
$('.back_to_top').fadeOut(backtotopduration);
}
<?if ($themes1):?>
var top = $('div#header').height() - 1; // header height has 1 extra pixel to cover overlap
var top = $('div#header').height()-1; // header height has 1 extra pixel to cover overlap
$('div#menu').css($(this).scrollTop() > top ? {position:'fixed',top:'0'} : {position:'absolute',top:top+'px'});
<?endif;?>
});
@@ -639,10 +632,11 @@ $(function() {
<?if ($notify['entity'] & 1 == 1):?>
$.post('/webGui/include/Notify.php',{cmd:'init'},function(){timers.notifier = setTimeout(notifier,0);});
<?endif;?>
$('input[value="Apply"],input[name="cmdEditShare"],input[name="cmdUserEdit"]').prop('disabled',true);
$('input[value="<?=_('Apply')?>"],input[value="Apply"],input[name="cmdEditShare"],input[name="cmdUserEdit"]').prop('disabled',true);
$('form').find('select,input[type=text],input[type=number],input[type=password],input[type=checkbox],input[type=radio],input[type=file],textarea').each(function(){$(this).on('input change',function() {
var form = $(this).parentsUntil('form').parent();
form.find('input[value="Apply"],input[name="cmdEditShare"],input[name="cmdUserEdit"]').not('input.lock').prop('disabled',false);
form.find('input[value="<?=_('Apply')?>"],input[value="Apply"],input[name="cmdEditShare"],input[name="cmdUserEdit"]').not('input.lock').prop('disabled',false);
form.find('input[value="<?=_('Done')?>"]').not('input.lock').val('<?=_('Reset')?>').prop('onclick',null).off('click').click(function(){refresh(form.offset().top)});
form.find('input[value="Done"]').not('input.lock').val('Reset').prop('onclick',null).off('click').click(function(){refresh(form.offset().top)});
});});
@@ -650,46 +644,46 @@ $(function() {
if (top>0) {$('html,body').scrollTop(top);}
$.removeCookie('top',{path:'/'});
<?if ($safemode):?>
showNotice('System running in <b>safe</b> mode');
showNotice('<?=_("System running in")?> <b><?=("safe mode")?></b>');
<?else:?>
<?$readme = @file_get_contents("$docroot/plugins/unRAIDServer/README.md",false,null,0,20);?>
<?if (strpos($readme,'REBOOT REQUIRED')!==false):?>
showUpgrade('<b>Reboot Now</b> to upgrade Unraid OS',true);
showUpgrade("<b><?=_('Reboot Now')?></b> <?=_('to upgrade Unraid OS')?>",true);
<?elseif (strpos($readme,'DOWNGRADE')!==false):?>
showUpgrade('<b>Reboot Now</b> to downgrade Unraid OS',true);
showUpgrade("<b><?=_('Reboot Now')?></b> <?=_('to downgrade Unraid OS')?>",true);
<?elseif ($version = plugin_update_available('unRAIDServer',true)):?>
showUpgrade('Unraid OS v<?=$version?> is available. <a>Update Now</a>');
showUpgrade("Unraid OS v<?=$version?> <?=_('is available')?>. <a><?=_('Update Now')?></a>");
<?endif;?>
<?if (!$notify['system']):?>
addBannerWarning('System notifications are <b>disabled</b>. Click <a href="/Settings/Notifications" style="cursor:pointer">here</a> to change notification settings.',true,true);
addBannerWarning('<?=_("System notifications are")?> <b><?=_("disabled")?></b>. <?=_("Click")?> <a href="/Settings/Notifications" style="cursor:pointer"><?=_("here")?></a> <?=_("to change notification settings")?>.',true,true);
<?endif;?>
<?endif;?>
<?if ($notify['display']):?>
var opts = [];
context.init({preventDoubleContext:false,left:true,above:false});
opts.push({text:'View',icon:'fa-folder-open-o',action:function(e){e.preventDefault();openNotifier('alert');}});
opts.push({text:'<?=_("View")?>',icon:'fa-folder-open-o',action:function(e){e.preventDefault();openNotifier('alert');}});
opts.push({divider:true});
opts.push({text:'History',icon:'fa-file-text-o',action:function(e){e.preventDefault();viewHistory('alert');}});
opts.push({text:'<?=_("History")?>',icon:'fa-file-text-o',action:function(e){e.preventDefault();viewHistory('alert');}});
opts.push({divider:true});
opts.push({text:'Acknowledge',icon:'fa-check-square-o',action:function(e){e.preventDefault();closeNotifier('alert');}});
opts.push({text:'<?=_("Acknowledge")?>',icon:'fa-check-square-o',action:function(e){e.preventDefault();closeNotifier('alert');}});
context.attach('#nav-tub1',opts);
var opts = [];
context.init({preventDoubleContext:false,left:true,above:false});
opts.push({text:'View',icon:'fa-folder-open-o',action:function(e){e.preventDefault();openNotifier('warning');}});
opts.push({text:'<?=_("View")?>',icon:'fa-folder-open-o',action:function(e){e.preventDefault();openNotifier('warning');}});
opts.push({divider:true});
opts.push({text:'History',icon:'fa-file-text-o',action:function(e){e.preventDefault();viewHistory('warning');}});
opts.push({text:'<?=_("History")?>',icon:'fa-file-text-o',action:function(e){e.preventDefault();viewHistory('warning');}});
opts.push({divider:true});
opts.push({text:'Acknowledge',icon:'fa-check-square-o',action:function(e){e.preventDefault();closeNotifier('warning');}});
opts.push({text:'<?=_("Acknowledge")?>',icon:'fa-check-square-o',action:function(e){e.preventDefault();closeNotifier('warning');}});
context.attach('#nav-tub2',opts);
var opts = [];
context.init({preventDoubleContext:false,left:true,above:false});
opts.push({text:'View',icon:'fa-folder-open-o',action:function(e){e.preventDefault();openNotifier('normal');}});
opts.push({text:'<?=_("View")?>',icon:'fa-folder-open-o',action:function(e){e.preventDefault();openNotifier('normal');}});
opts.push({divider:true});
opts.push({text:'History',icon:'fa-file-text-o',action:function(e){e.preventDefault();viewHistory('normal');}});
opts.push({text:'<?=_("History")?>',icon:'fa-file-text-o',action:function(e){e.preventDefault();viewHistory('normal');}});
opts.push({divider:true});
opts.push({text:'Acknowledge',icon:'fa-check-square-o',action:function(e){e.preventDefault();closeNotifier('normal');}});
opts.push({text:'<?=_("Acknowledge")?>',icon:'fa-check-square-o',action:function(e){e.preventDefault();closeNotifier('normal');}});
context.attach('#nav-tub3',opts);
<?endif;?>
if (location.pathname.search(/\/(AddVM|UpdateVM|AddContainer|UpdateContainer)/)==-1) {
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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 -40
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2019, Lime Technology
* Copyright 2012-2019, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -12,6 +12,10 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = 'main';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
$path = $_POST['path'];
@@ -44,24 +48,24 @@ function in_parity_log($log,$timestamp) {
function device_info(&$disk,$online) {
global $path, $var, $crypto;
$name = $disk['name'];
$fancyname = $disk['type']=='New' ? $name : my_disk($name);
$fancyname = $disk['type']=='New' ? $name : my_lang(my_disk($name),3);
$type = $disk['type']=='Flash' || $disk['type']=='New' ? $disk['type'] : 'Device';
$action = strpos($disk['color'],'blink')===false ? 'down' : 'up';
switch ($disk['color']) {
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;
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;
}
$ctrl = '';
if ($var['fsState']=='Started' && $type!='Flash' && strpos($disk['status'],'_NP')===false) {
$ctrl = " style='cursor:pointer' onclick=\"toggle_state('$type','$name','$action')\"";
$help .= "<br>Click to spin $action device";
$help .= "<br>"._("Click to spin $action device");
}
$status = "<a class='info'><i ".($ctrl?"id='dev-$name' ":"")."class='fa fa-$orb orb $color-orb'$ctrl></i><span>$help</span></a>";
$link = ($disk['type']=='Parity' && strpos($disk['status'],'_NP')===false) ||
@@ -74,22 +78,22 @@ function device_info(&$disk,$online) {
if (!vfs_luks($disk['fsType']))
$luks = "<i class='nolock fa fa-lock'></i>";
else
$luks = "<a class='info'><i class='padlock fa fa-unlock orange-text'></i><span>Device to be encrypted</span></a>";
$luks = "<a class='info'><i class='padlock fa fa-unlock orange-text'></i><span>"._('Device to be encrypted')."</span></a>";
break;
case 1:
if ($online) {
$luks = "<a class='info'><i class='padlock fa fa-unlock-alt green-text'></i><span>Device encrypted and unlocked</span></a>";
$luks = "<a class='info'><i class='padlock fa fa-unlock-alt green-text'></i><span>"._('Device encrypted and unlocked')."</span></a>";
break;
}
/* fall thru */
case 2:
$luks = "<a class='info'><i class='padlock fa fa-lock green-text'></i><span>Device encrypted</span></a>";
$luks = "<a class='info'><i class='padlock fa fa-lock green-text'></i><span>"._('Device encrypted')."</span></a>";
break;
case 3:
$luks = "<a class='info'><i class='padlock fa fa-lock red-text'></i><span>Device locked: wrong encryption key</span></a>";
$luks = "<a class='info'><i class='padlock fa fa-lock red-text'></i><span>"._('Device locked: wrong encryption key')."</span></a>";
break;
default:
$luks = "<a class='info'><i class='padlock fa fa-lock red-text'></i><span>Device locked: unknown error</span></a>";
$luks = "<a class='info'><i class='padlock fa fa-lock red-text'></i><span>"._('Device locked: unknown error')."</span></a>";
break;
} else $luks = '';
return $status.$luks.$link;
@@ -97,7 +101,7 @@ function device_info(&$disk,$online) {
function device_browse(&$disk) {
global $path;
$dir = $disk['name']=='flash' ? "/boot" : "/mnt/{$disk['name']}";
return "<a href=\"".htmlspecialchars("$path/Browse?dir=$dir")."\"><img src='/webGui/images/explore.png' title='Browse $dir'></a>";
return "<a href=\"".htmlspecialchars("$path/Browse?dir=$dir")."\"><img src='/webGui/images/explore.png' title='"._('Browse')." $dir'></a>";
}
function device_desc(&$disk) {
global $var;
@@ -108,7 +112,7 @@ function device_desc(&$disk) {
case 'Data' :
case 'Cache' : $type = $disk['rotational'] ? ($disk['luksState'] ? 'disk-encrypted' : 'disk') : 'nvme'; break;
}
$log = $var['fsState']=='Started' ? "<a class='info hand' onclick=\"openBox('/webGui/scripts/disk_log&arg1={$disk['device']}','Disk Log Information',600,900,false);return false\"><i class=\"icon-$type icon\"></i><span>Disk log information</span></a>" : "";
$log = $var['fsState']=='Started' ? "<a class='info hand' onclick=\"openBox('/webGui/scripts/disk_log&arg1={$disk['device']}','"._('Disk Log Information')."',600,900,false);return false\"><i class=\"icon-$type icon\"></i><span>"._('Disk Log Information')."</span></a>" : "";
return $log."<span style='font-family:bitstream'>".my_id($disk['id'])."</span> - $size $unit ({$disk['device']})";
}
function assignment(&$disk) {
@@ -117,7 +121,7 @@ function assignment(&$disk) {
$out .= "<input type='hidden' name='changeDevice' value='apply'>";
$out .= "<input type='hidden' name='csrf_token' value='{$var['csrf_token']}'>";
$out .= "<select class=\"slot\" name=\"slotId.{$disk['idx']}\" onChange=\"{$disk['name']}Form.submit()\">";
$empty = ($disk['idSb']!='' ? 'no device' : 'unassigned');
$empty = $disk['idSb']!='' ? _('no device') : _('unassigned');
if ($disk['id']!='') {
$out .= "<option value=\"{$disk['id']}\" selected>".device_desc($disk)."</option>";
$out .= "<option value=''>$empty</option>";
@@ -135,7 +139,7 @@ function vfs_luks($fs) {
function fs_info(&$disk) {
global $display;
if ($disk['fsStatus']=='-') {
echo ($disk['type']=='Cache' && $disk['name']!='cache') ? "<td colspan='4'>Device is part of cache pool</td><td></td>" : "<td colspan='5'></td>";
echo ($disk['type']=='Cache' && $disk['name']!='cache') ? "<td colspan='4'>"._('Device is part of cache pool')."</td><td></td>" : "<td colspan='5'></td>";
return;
} elseif ($disk['fsStatus']=='Mounted') {
echo "<td>".vfs_type($disk['fsType'])."</td>";
@@ -171,7 +175,7 @@ function cache_only($disk) {
function array_offline(&$disk) {
global $var, $disks;
if (strpos($var['mdState'],'ERROR:')===false) {
$text = '<span class="red-text"><em>All existing data on this device will be OVERWRITTEN when array is Started</em></span>';
$text = "<span class='red-text'><em>"._('All existing data on this device will be OVERWRITTEN when array is Started')."</em></span>";
if ($disk['type']=='Cache') {
if (!empty($disks['cache']['uuid']) && $disk['status']=='DISK_NEW') $warning = $text;
} else {
@@ -191,7 +195,7 @@ function array_offline(&$disk) {
echo "<td colspan='9'></td>";
break;
case 'DISK_NP_MISSING':
echo "<td>".device_info($disk,false)."<br><span class='diskinfo'><em>Missing</em></span></td>";
echo "<td>".device_info($disk,false)."<br><span class='diskinfo'><em>"._('Missing')."</em></span></td>";
echo "<td>".assignment($disk)."<em>{$disk['idSb']} - ".my_scale($disk['sizeSb']*1024,$unit)." $unit</em></td>";
echo "<td colspan='9'></td>";
break;
@@ -207,7 +211,7 @@ function array_offline(&$disk) {
echo "<td colspan='8'>$warning</td>";
break;
case 'DISK_WRONG':
echo "<td>".device_info($disk,false)."<br><span class='diskinfo'><em>Wrong</em></span></td>";
echo "<td>".device_info($disk,false)."<br><span class='diskinfo'><em>"._('Wrong')."</em></span></td>";
echo "<td>".assignment($disk)."<em>{$disk['idSb']} - ".my_scale($disk['sizeSb']*1024,$unit)." $unit</em></td>";
echo "<td>".my_temp($disk['temp'])."</td>";
echo "<td colspan='8'>$warning</td>";
@@ -241,14 +245,14 @@ function array_online(&$disk) {
case 'DISK_NP':
if ($disk['name']=="cache") {
echo "<td>".device_info($disk,true)."</td>";
echo "<td><em>Not installed</em></td>";
echo "<td><em>"._('Not installed')."</em></td>";
echo "<td colspan='4'></td>";
fs_info($disk);
}
break;
case 'DISK_NP_DSBL':
echo "<td>".device_info($disk,true)."</td>";
echo "<td><em>Not installed</em></td>";
echo "<td><em>"._('Not installed')."</em></td>";
echo "<td colspan='4'></td>";
fs_info($disk);
break;
@@ -267,7 +271,7 @@ function array_online(&$disk) {
echo "</tr>";
}
function my_clock($time) {
if (!$time) return 'less than a minute';
if (!$time) return _('less than a minute');
$days = floor($time/1440);
$hour = $time/60%24;
$mins = $time%60;
@@ -286,17 +290,17 @@ function read_disk($name, $part) {
return 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)." 2>/dev/null");
}
}
function show_totals($text) {
function show_totals($text,$array) {
global $var, $display, $sum;
echo "<tr class='tr_last'>";
echo "<td></td>";
echo "<td>$text</td>";
echo "<td>".my_lang($text,1)."</td>";
echo "<td>".($sum['count']>0 ? my_temp(round($sum['temp']/$sum['count'],1)) : '*')."</td>";
echo "<td><span class='diskio'>".my_diskio($sum['ioReads'])."</span><span class='number'>".my_number($sum['numReads'])."</span></td>";
echo "<td><span class='diskio'>".my_diskio($sum['ioWrites'])."</span><span class='number'>".my_number($sum['numWrites'])."</span></td>";
echo "<td>".my_number($sum['numErrors'])."</td>";
echo "<td></td>";
if (strstr($text,'Array') && ($var['startMode']=='Normal')) {
if ($array && ($var['startMode']=='Normal')) {
echo "<td>".my_scale($sum['fsSize']*1024,$unit,-1)." $unit</td>";
if ($display['text']%10==0) {
echo "<td>".my_scale($sum['fsUsed']*1024,$unit)." $unit</td>";
@@ -357,11 +361,11 @@ 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>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);
if ($display['total']) show_totals('Array of '.my_word($var['mdNumDisks']).' devices');
if ($display['total']) show_totals(sprintf(_('Array of %s devices'),my_word($var['mdNumDisks'])),true);
}
break;
case 'flash':
@@ -370,7 +374,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'><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>";
$share = "<a class='info'><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>";
@@ -394,11 +398,11 @@ case 'cache':
}
$data = []; foreach ($log as $key => $value) $data[] = "$key=\"$value\"";
file_put_contents($tmp,implode("\n",$data));
echo "<tr class='tr_last'><td>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);
if ($display['total'] && $var['cacheSbNumDisks']>1) show_totals('Pool of '.my_word($var['cacheNumDevices']).' devices');
if ($display['total'] && $var['cacheSbNumDisks']>1) show_totals(sprintf(_('Pool of %s devices'),my_word($var['cacheNumDevices'])),false);
}
break;
case 'open':
@@ -417,7 +421,7 @@ case 'open':
echo "<td><span class='diskio'>".my_diskio($data[1])."</span><span class='number'>".my_number($data[3])."</span></td>";
if (file_exists("/tmp/preclear_stat_$dev")) {
$text = exec("cut -d'|' -f3 /tmp/preclear_stat_$dev|sed 's:\^n:\<br\>:g'");
if (strpos($text,'Total time')===false) $text = 'Preclear in progress... '.$text;
if (strpos($text,'Total time')===false) $text = _('Preclear in progress').'... '.$text;
echo "<td colspan='6' style='text-align:right'><em>$text</em></td>";
} else
echo "<td colspan='6'></td>";
@@ -428,10 +432,10 @@ case 'parity':
$data = [];
if ($var['mdResyncPos']) {
$data[] = my_scale($var['mdResyncSize']*1024,$unit,-1)." $unit";
$data[] = my_clock(floor((time()-$var['sbSynced'])/60)).($var['mdResyncDt'] ? '' : ' (paused)');
$data[] = my_lang(my_clock(floor((time()-$var['sbSynced'])/60)),2).($var['mdResyncDt'] ? '' : ' ('._('paused').')');
$data[] = my_scale($var['mdResyncPos']*1024,$unit)." $unit (".number_format(($var['mdResyncPos']/($var['mdResyncSize']/100+1)),1,$display['number'][0],'')." %)";
$data[] = $var['mdResyncDt'] ? my_scale($var['mdResyncDb']*1024/$var['mdResyncDt'],$unit, 1)." $unit/sec" : '---';
$data[] = $var['mdResyncDb'] ? my_clock(round(((($var['mdResyncDt']*(($var['mdResyncSize']-$var['mdResyncPos'])/($var['mdResyncDb']/100+1)))/100)/60),0)) : 'Unknown';
$data[] = $var['mdResyncDb'] ? my_lang(my_clock(round(((($var['mdResyncDt']*(($var['mdResyncSize']-$var['mdResyncPos'])/($var['mdResyncDb']/100+1)))/100)/60),0)),2) : _('Unknown');
$data[] = $var['sbSyncErrs'];
echo implode(';',$data);
} else {
@@ -441,7 +445,7 @@ case 'parity':
if (in_parity_log($log,$timestamp)) break;
$duration = $var['sbSynced2'] - $var['sbSynced'];
$status = $var['sbSyncExit'];
$speed = ($status==0) ? my_scale($var['mdResyncSize']*1024/$duration,$unit,1)." $unit/s" : "Unavailable";
$speed = ($status==0) ? my_scale($var['mdResyncSize']*1024/$duration,$unit,1)." $unit/s" : _('Unavailable');
$error = $var['sbSyncErrs'];
$year = date('Y',$var['sbSynced2']);
if ($status==0||file_exists($log)) file_put_contents($log,"$year $timestamp|$duration|$speed|$status|$error\n",FILE_APPEND);
+19 -16
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2019, Lime Technology
* Copyright 2012-2019, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -12,6 +12,10 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = 'shares';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
$shares = parse_ini_file('state/shares.ini',true);
@@ -32,8 +36,7 @@ $display['number'] = $_GET['number'];
function disk_share_settings($protocol,$share) {
if (empty($share)) return;
if ($protocol!='yes' || $share['export']=='-') return "-";
if ($share['export']=='e') return ucfirst($share['security']);
return '<em>'.ucfirst($share['security']).'</em>';
return ($share['export']=='e') ? _(ucfirst($share['security'])) : '<em>'._(ucfirst($share['security'])).'</em>';
}
function globalInclude($name) {
@@ -75,14 +78,14 @@ foreach ($disks as $name => $disk) {
$color = $disk['fsColor'];
$row++;
switch ($color) {
case 'green-on' : $orb = 'circle'; $color = 'green'; $help = 'All files protected'; break;
case 'yellow-on': $orb = 'warning'; $color = 'yellow'; $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;
case 1: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-unlock-alt green-text'></i><span>All files encrypted</span></a>"; break;
case 2: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-unlock-alt orange-text'></i><span>Some or all files unencrypted</span></a>"; break;
default: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-lock red-text'></i><span>Unknown encryption state'</span></a>"; break;
case 1: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-unlock-alt green-text'></i><span>"._('All files encrypted')."</span></a>"; break;
case 2: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-unlock-alt orange-text'></i><span>"._('Some or all files unencrypted')."</span></a>"; break;
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'><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>";
@@ -91,12 +94,12 @@ foreach ($disks as $name => $disk) {
echo "<td>".disk_share_settings($var['shareNFSEnabled'], $sec_nfs[$name])."</td>";
echo "<td>".disk_share_settings($var['shareAFPEnabled'], $sec_afp[$name])."</td>";
$cmd="/webGui/scripts/disk_size"."&arg1=".urlencode($name)."&arg2=ssz2";
$type = $disk['rotational'] ? 'HDD' : 'SSD';
$type = $disk['rotational'] ? _('HDD') : _('SSD');
if (array_key_exists($name, $ssz2)) {
echo "<td>$type</td>";
echo "<td>".my_scale(($disk['fsSize'])*1024, $unit)." $unit</td>";
echo "<td>".my_scale($disk['fsFree']*1024, $unit)." $unit</td>";
echo "<td><a href='$path/Browse?dir=/mnt/$name'><img src='/webGui/images/explore.png' title='Browse /mnt/$name'></a></td>";
echo "<td><a href='$path/Browse?dir=/mnt/$name'><img src='/webGui/images/explore.png' title='"._('Browse')." /mnt/$name'></a></td>";
echo "</tr>";
foreach ($ssz2[$name] as $sharename => $sharesize) {
if ($sharename=='share.total') continue;
@@ -104,25 +107,25 @@ foreach ($disks as $name => $disk) {
$inside = in_array($disk['name'], array_filter(array_diff($myDisks, explode(',',$shares[$sharename]['exclude'])), 'shareInclude'));
echo "<tr class='share_status_size".($inside ? "'>" : " warning'>");
echo "<td>$sharename:</td>";
echo "<td>".($inside ? "" : "<em>Share is outside the list of designated disks</em>")."</td>";
echo "<td>".($inside ? "" : "<em>"._('Share is outside the list of designated disks')."</em>")."</td>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td class='disk-$row-1'>".my_scale($sharesize*1024, $unit)." $unit</td>";
echo "<td class='disk-$row-2'>".my_scale($disk['fsFree']*1024, $unit)." $unit</td>";
echo "<td><a href='/update.htm?cmd=$cmd&csrf_token={$var['csrf_token']}' target='progressFrame' title='Recompute...' onclick='$.cookie(\"ssz\",\"ssz\",{path:\"/\"});$(\".disk-$row-1\").html(\"Please wait...\");$(\".disk-$row-2\").html(\"\");'><i class='fa fa-refresh icon'></i></a></td>";
echo "<td><a href='/update.htm?cmd=$cmd&csrf_token={$var['csrf_token']}' target='progressFrame' title='"._('Recompute')."...' onclick='$.cookie(\"ssz\",\"ssz\",{path:\"/\"});$(\".disk-$row-1\").html(\""._('Please wait')."...\");$(\".disk-$row-2\").html(\"\");'><i class='fa fa-refresh icon'></i></a></td>";
echo "</tr>";
}
} else {
echo "<td>$type</td>";
echo "<td><a href='/update.htm?cmd=$cmd&csrf_token={$var['csrf_token']}' target='progressFrame' onclick=\"$.cookie('ssz','ssz',{path:'/'});$(this).text('Please wait...')\">Compute...</a></td>";
echo "<td><a href='/update.htm?cmd=$cmd&csrf_token={$var['csrf_token']}' target='progressFrame' onclick=\"$.cookie('ssz','ssz',{path:'/'});$(this).text('"._('Please wait')."...')\">"._('Compute')."...</a></td>";
echo "<td>".my_scale($disk['fsFree']*1024, $unit)." $unit</td>";
echo "<td><a href='$path/Browse?dir=/mnt/$name'><img src='/webGui/images/explore.png' title='Browse /mnt/$name'></a></td>";
echo "<td><a href='$path/Browse?dir=/mnt/$name'><img src='/webGui/images/explore.png' title='"._('Browse')." /mnt/$name'></a></td>";
echo "</tr>";
}
}
if ($row==0) {
echo "<tr><td colspan='9' style='text-align:center;padding-top:12px'><i class='fa fa-folder-open-o icon'></i>There are no exportable disk shares</td></tr>";
echo "<tr><td colspan='9' style='text-align:center;padding-top:12px'><i class='fa fa-folder-open-o icon'></i>"._('There are no exportable disk shares')."</td></tr>";
}
?>
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2019, Lime Technology
* Copyright 2012-2019, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+19 -17
View File
@@ -1,5 +1,5 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
/* Copyright 2005-2020, 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,
@@ -11,6 +11,10 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = '';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
$var = parse_ini_file('state/var.ini');
@@ -51,9 +55,9 @@ input[type=email]{margin-top:8px;float:left}
<div style="margin-top:0;line-height:30px;margin-left:5px;margin-right:5px">
<div id="control_panel" class="four">
<!-- <label for="optOnlinePoll"><input type="radio" name="mode" id="optOnlinePoll" value="onlinepoll" checked="checked"/> Online Poll</label> -->
<label for="optFeatureRequest"><input type="radio" name="mode" id="optFeatureRequest" value="featurerequest" checked="checked"/> Product Suggestion</label>
<label for="optBugReport"><input type="radio" name="mode" id="optBugReport" value="bugreport"/> Bug Report</label>
<label for="optComment"><input type="radio" name="mode" id="optComment" value="comment"/> Other Comment</label>
<label for="optFeatureRequest"><input type="radio" name="mode" id="optFeatureRequest" value="featurerequest" checked="checked"/> <?=_('Product Suggestion')?></label>
<label for="optBugReport"><input type="radio" name="mode" id="optBugReport" value="bugreport"/> <?=_('Bug Report')?></label>
<label for="optComment"><input type="radio" name="mode" id="optComment" value="comment"/> <?=_('Other Comment')?></label>
<hr>
</div>
<div id="thanks_panel" class="allpanels"></div>
@@ -65,8 +69,8 @@ input[type=email]{margin-top:8px;float:left}
</div>
<div id="bugreport_panel" class="allpanels">
<textarea id="bugDescription"></textarea>
<p style="line-height:14px;margin-top:0;font-size:1.1rem"><b>NOTE:</b> <i>Submission of this bug report will automatically send your system diagnostics to Lime Technology.</i></p>
<label for="anonymize" style="line-height:12px"><input type="checkbox" id="anonymize" value="1" /> Anonymize diagnostics (may make troubleshooting more difficult)</label>
<p style="line-height:14px;margin-top:0;font-size:1.1rem"><b><?=_('NOTE')?>:</b> <i><?=_('Submission of this bug report will automatically send your system diagnostics to Lime Technology')?>.</i></p>
<label for="anonymize" style="line-height:12px"><input type="checkbox" id="anonymize" value="1" /> <?=_('Anonymize diagnostics (may make troubleshooting more difficult)')?></label>
<input type="email" id="bugEmail" placeholder="Contact Email Address (optional)" /><input type="button" id="bugSubmit" value="Submit"/>
</div>
<div id="comment_panel" class="allpanels">
@@ -77,9 +81,9 @@ input[type=email]{margin-top:8px;float:left}
<div id="spinner_image"><img src="/webGui/images/loading.gif"/></div>
<div id="footer_panel">
<hr>
<a href="https://lime-technology.com" target="_blank">Website</a>&nbsp;|&nbsp;
<a href="https://lime-technology.com/forum" target="_blank">Forum</a>&nbsp;|&nbsp;
<a href="https://lime-technology.com/wiki" target="_blank">Wiki</a>
<a href="https://lime-technology.com" target="_blank"><?=_('Website')?></a>&nbsp;|&nbsp;
<a href="https://lime-technology.com/forum" target="_blank"><?=_('Forum')?></a>&nbsp;|&nbsp;
<a href="https://lime-technology.com/wiki" target="_blank"><?=_('Wiki')?></a>
</div>
</div>
<script type="text/javascript" src="<?autov('/webGui/javascript/dynamix.js')?>"></script>
@@ -96,7 +100,7 @@ function onlinepoll_load() {
$.post('https://keys.lime-technology.com/polls',{timestamp:unraid_timestamp,osversion:unraid_osversion,keyfile:keyfile},function(data) {
$('#onlinepoll_panel').hide().html(data).fadeIn('fast');
}).fail(function(data) {
var msg = "<p>Sorry, an error ("+data.status+") occurred. Please try again later.</p>";
var msg = "<p><?=_('Sorry, an error occurred')?>. <?=_('Please try again later')?>.</p>";
$('#onlinepoll_panel').hide().html(msg).fadeIn('fast');
}).always(function() {
$('#spinner_image').fadeOut('fast');
@@ -108,7 +112,7 @@ function featurerequest_reset() {
$('#featureEmail').val("");
}
function bugreport_reset() {
$('#bugDescription').val("Bug Description:\n\nHow to reproduce:\n\nExpected results:\n\nActual results:\n\nOther information:\n\n");
$('#bugDescription').val("<?=_('Bug Description')?>:\n\n<?=_('How to reproduce')?>:\n\n<?=_('Expected results')?>:\n\n<?=_('Actual results')?>:\n\n<?=_('Other information')?>:\n\n");
$('#bugEmail').val("");
}
function comment_reset() {
@@ -128,7 +132,7 @@ function form_submit(url, params, $panel, diagnostics) {
}).fail(function() {
$('#spinner_image').fadeOut('fast');
$panel.fadeOut('fast').find('textarea,input').prop('disabled', false);
var failure_message = '<p class="red-text" style="text-align:center;">Sorry, an error (Unable to generate system diagnostics) occurred. Please try again later.</p>';
var failure_message = '<p class="red-text" style="text-align:center;"><?=_("Sorry, an error occurred")?> (<?=_("Unable to generate system diagnostics")?>). <?=_("Please try again later")?>.</p>';
$('#thanks_panel').html(failure_message).fadeIn('fast');
});
@@ -142,13 +146,12 @@ function form_submit(url, params, $panel, diagnostics) {
$.post(url,params,function(data) {
if (data.error) {
var failure_message = '<p class="red-text" style="text-align:center;">Sorry, an error ('+data.error+') occurred. Please try again later.</p>';
var failure_message = '<p class="red-text" style="text-align:center;"><?=_("Sorry, an error occurred")?>. <?=_("Please try again later")?>.</p>';
$('#thanks_panel').html(failure_message).fadeIn('fast');
} else {
data.message = data.message || '';
var url_parts = url.split('/');
var success_message = '<div style="text-align:center"><h2>Thank You!</h2><img src="/webGui/images/feedback_'+url_parts[4]+'.jpg"/><p style="text-align:center">'+data.message+'</p></div>';
var success_message = '<div style="text-align:center"><h2><?=_("Thank You")?>!</h2><img src="/webGui/images/feedback_'+url_parts[4]+'.jpg"/><p style="text-align:center">'+data.message+'</p></div>';
$('#thanks_panel').html(success_message).fadeIn('fast', function() {
var resetfunction = window[url_parts[4]+'_reset'];
@@ -161,7 +164,7 @@ function form_submit(url, params, $panel, diagnostics) {
if (jqXHR.responseJSON && jqXHR.responseJSON.error) {
errorThrown = jqXHR.responseJSON.error;
}
var failure_message = '<p class="red-text" style="text-align:center;">Sorry, an error ('+errorThrown+') occurred. Please try again later.</p>';
var failure_message = '<p class="red-text" style="text-align:center;"><?=_("Sorry, an error occurred")?>. <?=_("Please try again later")?>.</p>';
$('#thanks_panel').html(failure_message).fadeIn('fast');
}).always(function() {
$('#spinner_image').fadeOut('fast');
@@ -173,7 +176,6 @@ $(function() {
$('#control_panel input[type=radio]').click(function() {
var showPanel = '#'+$( "#control_panel input[type=radio]:checked" ).val()+'_panel';
$('.allpanels').not(showPanel).fadeOut('fast');
var loadfunction = window[$( "#control_panel input[type=radio]:checked" ).val()+'_load'];
if (typeof loadfunction !== 'undefined' && $.isFunction(loadfunction)) {
loadfunction();
+38 -6
View File
@@ -1,21 +1,36 @@
<?PHP
$cmd = isset($_POST['cmd']) ? $_POST['cmd'] : 'load';
$path = $_POST['path'];
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$cmd = $_POST['cmd'] ?? 'load';
$path = $_POST['path'] ?? '';
$file = rawurldecode($_POST['filename']);
$temp = "/var/tmp";
$safepaths = ['/boot/config/plugins/dynamix'];
$boot = "/boot/config/plugins/dynamix";
$safepaths = [$boot];
$safeexts = ['.png'];
switch ($cmd) {
case 'load':
if (isset($_POST['filedata'])) {
exec("rm -f $temp/*.png");
$result = file_put_contents("$temp/".basename($file), base64_decode(str_replace(['data:image/png;base64,',' '],['','+'],$_POST['filedata'])));
$result = file_put_contents("$temp/".basename($file),base64_decode(str_replace(['data:image/png;base64,',' '],['','+'],$_POST['filedata'])));
}
break;
case 'save':
foreach ($safepaths as $safepath) {
if (strpos(dirname("$path/{$_POST['output']}"), $safepath) === 0 && in_array(substr(basename($_POST['output']), -4), $safeexts)) {
if (strpos(dirname("$path/{$_POST['output']}"),$safepath)===0 && in_array(substr(basename($_POST['output']),-4),$safeexts)) {
exec("mkdir -p ".escapeshellarg(realpath($path)));
$result = @rename("$temp/".basename($file), "$path/{$_POST['output']}");
break;
@@ -31,6 +46,23 @@ case 'delete':
}
}
break;
case 'add':
$path = "$docroot/languages/$file";
exec("mkdir -p ".escapeshellarg($path));
$result = file_put_contents("/$boot/$file.lang.zip",base64_decode(preg_replace('/^data:.*;base64,/','',$_POST['filedata'])));
if ($result) {
foreach (glob("$path/*.dot",GLOB_NOSORT) as $dot) unlink($dot);
exec("unzip -qqjLo -d ".escapeshellarg($path)." ".escapeshellarg("$boot/$file.lang.zip"));
}
$installed = [];
foreach (glob("$docroot/languages/*",GLOB_ONLYDIR) as $dir) $installed[] = basename($dir);
if ($result) exit(implode(',',$installed));
case 'rm':
$path = "$docroot/languages/$file";
if ($result = is_dir($path)) {exec("rm -rf ".escapeshellarg($path)); @unlink("$boot/$file.lang.zip");}
$installed = [];
foreach (glob("$docroot/languages/*",GLOB_ONLYDIR) as $dir) $installed[] = basename($dir);
if ($result) exit(implode(',',$installed));
}
echo ($result ? 'OK 200' : 'Internal Error 500');
exit($result ? 'OK 200' : 'Internal Error 500');
?>
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+2 -50
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -190,54 +190,6 @@ function pgrep($process_name, $escape_arg=true) {
$pid = exec("pgrep ".($escape_arg?escapeshellarg($process_name):$process_name), $output, $retval);
return $retval == 0 ? $pid : false;
}
function input_secure_users($sec) {
global $name, $users;
echo "<table class='settings'>";
$write_list = explode(",", $sec[$name]['writeList']);
foreach ($users as $user) {
$idx = $user['idx'];
if ($user['name'] == "root") {
echo "<input type='hidden' name='userAccess.$idx' value='no-access'>";
continue;
}
if (in_array( $user['name'], $write_list))
$userAccess = "read-write";
else
$userAccess = "read-only";
echo "<tr><td>{$user['name']}</td>";
echo "<td><select name='userAccess.$idx' size='1'>";
echo mk_option($userAccess, "read-write", "Read/Write");
echo mk_option($userAccess, "read-only", "Read-only");
echo "</select></td></tr>";
}
echo "</table>";
}
function input_private_users($sec) {
global $name, $users;
echo "<table class='settings'>";
$read_list = explode(",", $sec[$name]['readList']);
$write_list = explode(",", $sec[$name]['writeList']);
foreach ($users as $user) {
$idx = $user['idx'];
if ($user['name'] == "root") {
echo "<input type='hidden' name='userAccess.$idx' value='no-access'>";
continue;
}
if (in_array( $user['name'], $read_list))
$userAccess = "read-only";
elseif (in_array( $user['name'], $write_list))
$userAccess = "read-write";
else
$userAccess = "no-access";
echo "<tr><td>{$user['name']}</td>";
echo "<td><select name='userAccess.$idx' size='1'>";
echo mk_option($userAccess, "read-write", "Read/Write");
echo mk_option($userAccess, "read-only", "Read-only");
echo mk_option($userAccess, "no-access", "No Access");
echo "</select></td></tr>";
}
echo "</table>";
}
function is_block($path) {
return (@filetype(realpath($path))=='block');
}
+62
View File
@@ -0,0 +1,62 @@
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
function input_secure_users($sec) {
global $name, $users;
echo "<table class='settings'>";
$write_list = explode(",", $sec[$name]['writeList']);
foreach ($users as $user) {
$idx = $user['idx'];
if ($user['name'] == "root") {
echo "<input type='hidden' name='userAccess.$idx' value='no-access'>";
continue;
}
if (in_array( $user['name'], $write_list))
$userAccess = "read-write";
else
$userAccess = "read-only";
echo "<tr><td>{$user['name']}</td>";
echo "<td><select name='userAccess.$idx'";
echo mk_option($userAccess, "read-write", _("Read/Write"));
echo mk_option($userAccess, "read-only", _("Read-only"));
echo "</select></td></tr>";
}
echo "</table>";
}
function input_private_users($sec) {
global $name, $users;
echo "<table class='settings'>";
$read_list = explode(",", $sec[$name]['readList']);
$write_list = explode(",", $sec[$name]['writeList']);
foreach ($users as $user) {
$idx = $user['idx'];
if ($user['name'] == "root") {
echo "<input type='hidden' name='userAccess.$idx' value='no-access'>";
continue;
}
if (in_array( $user['name'], $read_list))
$userAccess = "read-only";
elseif (in_array( $user['name'], $write_list))
$userAccess = "read-write";
else
$userAccess = "no-access";
echo "<tr><td>{$user['name']}</td>";
echo "<td><select name='userAccess.$idx'>";
echo mk_option($userAccess, "read-write", _("Read/Write"));
echo mk_option($userAccess, "read-only", _("Read-only"));
echo mk_option($userAccess, "no-access", _("No Access"));
echo "</select></td></tr>";
}
echo "</table>";
}
?>
+1 -1
View File
@@ -1,5 +1,5 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
/* Copyright 2005-2020, 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,
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -12,6 +12,10 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = 'tools';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Wrappers.php";
$dynamix = parse_plugin_cfg('dynamix',true);
@@ -35,9 +39,9 @@ foreach ($files as $file) {
if ($c==5) break;
$text = $field ? explode('=',$field,2)[1] : "-";
$tag = ($c<4) ? "" : " data='".str_replace(['alert','warning','normal'],['0','1','2'],$text)."'";
echo (!$c++) ? "<tr>".str_replace('*',$text,$td_).date($dynamix['notify']['date'].' '.$dynamix['notify']['time'],$text)."$_td" : "<td$tag>$text</td>";
echo (!$c++) ? "<tr>".str_replace('*',$text,$td_).date($dynamix['notify']['date'].' '.$dynamix['notify']['time'],$text)."$_td" : "<td$tag>"._($text)."</td>";
}
echo "<td><a href='#' onclick='$.post(\"/webGui/include/DeleteLogFile.php\",{log:\"$archive\"},function(){archiveList();});return false' title='Delete notification'><i class='fa fa-trash-o'></i></a></td></tr>";
echo "<td><a href='#' onclick='$.post(\"/webGui/include/DeleteLogFile.php\",{log:\"$archive\"},function(){archiveList();});return false' title='"._('Delete notification')."'><i class='fa fa-trash-o'></i></a></td></tr>";
if ($extra) {
$text = explode('=',$field,2)[1];
echo "<tr class='tablesorter-childRow row$row'><td colspan='4'>$text</td><td></td></tr><tr class='tablesorter-childRow row$row'><td colspan='5'></td></tr>";
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
* Copyright 2012, Andrew Hamer-Adams, http://www.pixeleyes.co.nz.
*
* This program is free software; you can redistribute it and/or
+22 -12
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -22,15 +22,15 @@ function get_ini_key($key,$default) {
}
function get_file_key($file,$default) {
list($key, $default) = explode('=',$default,2);
[$key, $default] = explode('=',$default,2);
$var = @parse_ini_file($file);
return isset($var[$key]) ? $var[$key] : $default;
}
function build_pages($pattern) {
global $site;
foreach (glob($pattern, GLOB_NOSORT) as $entry) {
list($header, $content) = explode("---\n", file_get_contents($entry), 2);
foreach (glob($pattern,GLOB_NOSORT) as $entry) {
[$header, $content] = explode("---\n", file_get_contents($entry),2);
$page = parse_ini_string($header);
$page['file'] = $entry;
$page['root'] = dirname($entry);
@@ -41,7 +41,7 @@ function build_pages($pattern) {
}
function find_pages($item) {
global $site,$var,$disks,$devs,$users,$shares,$sec,$sec_nfs,$sec_afp,$name,$display;
global $docroot,$site,$var,$disks,$devs,$users,$shares,$sec,$sec_nfs,$sec_afp,$name,$display;
$pages = [];
foreach ($site as $page) {
if (empty($page['Menu'])) continue;
@@ -51,7 +51,7 @@ function find_pages($item) {
case '/': $menu = get_file_key($menu,strtok(' ')); break;
}
while ($menu !== false) {
list($menu,$rank) = explode(':',$menu);
[$menu,$rank] = explode(':',$menu);
if ($menu == $item) {
$enabled = true;
if (isset($page['Cond'])) eval("\$enabled={$page['Cond']};");
@@ -67,23 +67,33 @@ function find_pages($item) {
function tab_title($name,$path,$tag) {
global $docroot;
if (preg_match('/^(disk|cache|parity)/',$name)) {
$text = [];
foreach (explode(' ',$name) as $word) $text[] = my_lang(my_disk($word),3);
$name = implode(' ',$text);
} elseif (substr($name,0,9)=='Interface') {
[$p1,$p2] = explode(' ',$name);
$name = rtrim(_($p1).' '._($p2));
} else {
$name = _($name);
}
if (!$tag || substr($tag,-4)=='.png') {
$file = "$path/icons/".($tag ?: strtolower(str_replace(' ','',$name)).".png");
if (file_exists("$docroot/$file")) {
return "<img src='/$file' class='icon'>".htmlspecialchars(my_disk($name));
return "<img src='/$file' class='icon'>$name";
} else {
return "<i class='fa fa-th title'></i>".htmlspecialchars(my_disk($name));
return "<i class='fa fa-th title'></i>$name";
}
} elseif (substr($tag,0,5)=='icon-') {
return "<i class='$tag title'></i>".htmlspecialchars(my_disk($name));
return "<i class='$tag title'></i>$name";
} else {
if (substr($tag,0,3)!='fa-') $tag = "fa-$tag";
return "<i class='fa $tag title'></i>".htmlspecialchars(my_disk($name));
return "<i class='fa $tag title'></i>$name";
}
}
// hack to embed function output in a quoted string (e.g., in a page Title)
// see: http://stackoverflow.com/questions/6219972/why-embedding-functions-inside-of-strings-is-different-than-variables
function _func($x) { return $x; }
function _func($x) {return $x;}
$func = '_func';
?>
+13 -9
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -12,6 +12,10 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = 'main';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
$month = [' Jan '=>'-01-',' Feb '=>'-02-',' Mar '=>'-03-',' Apr '=>'-04-',' May '=>'-05-',' Jun '=>'-06-',' Jul '=>'-07-',' Aug '=>'-08-',' Sep '=>'-09-',' Oct '=>'-10-',' Nov '=>'-11-',' Dec '=>'-12-'];
@@ -26,7 +30,7 @@ function his_duration($time) {
$hour = floor($hmss/3600);
$mins = $hmss/60%60;
$secs = $hmss%60;
return his_plus($days,'day',($hour|$mins|$secs)==0).his_plus($hour,'hr',($mins|$secs)==0).his_plus($mins,'min',$secs==0).his_plus($secs,'sec',true);
return his_plus($days,_('day'),($hour|$mins|$secs)==0).his_plus($hour,_('hr'),($mins|$secs)==0).his_plus($mins,_('min'),$secs==0).his_plus($secs,_('sec'),true);
}
?>
<!DOCTYPE html>
@@ -39,25 +43,25 @@ function his_duration($time) {
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/default-popup.css")?>">
</head>
<body>
<table class='share_status'><thead><tr><td>Date</td><td>Duration</td><td>Speed</td><td>Status</td><td>Errors</td></tr></thead><tbody>
<table class='share_status'><thead><tr><td><?=_('Date')?></td><td><?=_('Duration')?></td><td><?=_('Speed')?></td><td><?=_('Status')?></td><td><?=_('Errors')?></td></tr></thead><tbody>
<?
$log = '/boot/config/parity-checks.log'; $list = [];
if (file_exists($log)) {
$handle = fopen($log, 'r');
while (($line = fgets($handle)) !== false) {
list($date,$duration,$speed,$status,$error) = explode('|',$line);
if ($speed==0) $speed = 'Unavailable';
[$date,$duration,$speed,$status,$error] = explode('|',$line);
if ($speed==0) $speed = _('Unavailable');
$date = str_replace(' ',', ',strtr(str_replace(' ',' 0',$date),$month));
if ($duration>0||$status<>0) $list[] = "<tr><td>$date</td><td>".his_duration($duration)."</td><td>$speed</td><td>".($status==0?'OK':($status==-4?'Canceled':$status))."</td><td>$error</td></tr>";
if ($duration>0||$status<>0) $list[] = "<tr><td>$date</td><td>".his_duration($duration)."</td><td>$speed</td><td>".($status==0?_('OK'):($status==-4?_('Canceled'):$status))."</td><td>$error</td></tr>";
}
fclose($handle);
}
if ($list)
for ($i=count($list); $i>=0; --$i) echo $list[$i];
else
echo "<tr><td colspan='5' style='text-align:center;padding-top:12px'>No parity check history present!</td></tr>";
echo "<tr><td colspan='5' style='text-align:center;padding-top:12px'>"._('No parity check history present')."!</td></tr>";
?>
</tbody></table>
<div style="text-align:center;margin-top:12px"><input type="button" value="Done" onclick="top.Shadowbox.close()"></div>
<div style="text-align:center;margin-top:12px"><input type="button" value="<?=_('Done')?>" onclick="top.Shadowbox.close()"></div>
</body>
</html>
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2016, Bergware International.
* Copyright 2016, Lime Technology
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+8 -3
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2015-2018, Bergware International
/* Copyright 2005-2020, Lime Technology
* Copyright 2015-2020, 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,
@@ -11,6 +11,11 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = '';
require_once "$docroot/webGui/include/Translations.php";
$name = $_POST['name'];
switch ($name) {
case 'crontab':
@@ -32,5 +37,5 @@ default:
if (isset($_POST['update'])) {$span = ""; $_span = "";}
else {$span = "<span id='progress' class='status'>"; $_span = "</span>";}
echo $pid ? "{$span}Status:<span class='green'>Running</span>{$_span}" : "{$span}Status:<span class='orange'>Stopped</span>{$_span}";
echo $pid ? "{$span}"._('Status').":<span class='green'>"._('Running')."</span>{$_span}" : "{$span}Status:<span class='orange'>"._('Stopped')."</span>{$_span}";
?>
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+12 -7
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -11,6 +11,11 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = 'settings';
require_once "$docroot/webGui/include/Translations.php";
$cli = php_sapi_name()=='cli';
function response_complete($httpcode, $result, $cli_success_msg='') {
@@ -35,19 +40,19 @@ if (file_exists("/boot/config/ssl/certs/certificate_bundle.pem")) {
$subject = exec("/usr/bin/openssl x509 -subject -noout -in /etc/ssl/certs/unraid_bundle.pem");
if (!preg_match('/.*\.unraid\.net$/', $subject)) {
if ($cli) exit(0); // cert common name isn't <hash>.unraid.net
response_complete(406, '{"error":"Cannot provision cert that would overwrite your existing custom cert at /boot/config/ssl/certs/certificate_bundle.pem"}');
response_complete(406, '{"error":"'._('Cannot provision cert that would overwrite your existing custom cert at').' /boot/config/ssl/certs/certificate_bundle.pem"}');
}
exec("/usr/bin/openssl x509 -checkend 2592000 -noout -in /etc/ssl/certs/unraid_bundle.pem",$arrout,$retval_expired);
if ($retval_expired === 0) {
if ($cli) exit(0); // not within 30 days of cert expire date
response_complete(406, '{"error":"Cannot renew cert until within 30 days of expiry"}');
response_complete(406, '{"error":"'._('Cannot renew cert until within 30 days of expiry').'"}');
}
}
$keyfile = @file_get_contents($var['regFILE']);
if ($keyfile === false) {
if ($cli) exit(0);
response_complete(406, '{"error":"License key required"}');
response_complete(406, '{"error":"'.('License key required').'"}');
}
$keyfile = @base64_encode($keyfile);
$internalip = $eth0['IPADDR:0'];
@@ -69,7 +74,7 @@ curl_close($ch);
if ($cli) {
$json = @json_decode($result,true);
if (empty($json['bundle'])) {
$strError = 'Server was unable to provision SSL certificate';
$strError = _('Server was unable to provision SSL certificate');
if (!empty($json['error'])) {
$strError .= ' - '.$json['error'];
}
@@ -80,5 +85,5 @@ if ($cli) {
exec("/etc/rc.d/rc.nginx reload");
}
response_complete($httpcode, $result, 'LE Cert Provisioned successfully');
response_complete($httpcode, $result, _('LE Cert Provisioned successfully'));
?>
+9 -4
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2015-2018, Bergware International
/* Copyright 2005-2020, Lime Technology
* Copyright 2015-2020, 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,
@@ -11,14 +11,19 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = '';
require_once "$docroot/webGui/include/Translations.php";
if (empty($_GET['btrfs'])) {
$var = parse_ini_file("state/var.ini");
switch ($var['fsState']) {
case 'Copying':
echo "<strong>Copying, {$var['fsCopyPrcnt']}% complete...</strong>";
echo "<strong>"._('Copying').", {$var['fsCopyPrcnt']}% "._('complete')."...</strong>";
break;
case 'Clearing':
echo "<strong>Clearing, {$var['fsClearPrcnt']}% complete...</strong>";
echo "<strong>"._('Clearing').", {$var['fsClearPrcnt']}% "._('complete')."...</strong>";
break;
default:
echo substr($var['fsState'],-3)=='ing' ? 'wait' : 'stop';
+11 -8
View File
@@ -1,5 +1,5 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
/* Copyright 2005-2020, 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,
@@ -11,6 +11,10 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = 'tools';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
$var = parse_ini_file('state/var.ini');
@@ -36,11 +40,11 @@ function replaceKey(email, guid, keyfile) {
$.post('https://keys.lime-technology.com/account/license/transfer',{timestamp:timestamp,guid:guid,email:email,keyfile:keyfile},function(data) {
$('#spinner_image').fadeOut('fast');
var msg = "<p>A registration replacement key has been created for USB Flash GUID <strong>"+guid+"</strong></p>" +
"<p>An email has been sent to <strong>"+email+"</strong> containing your key file URL." +
" When received, please paste the URL into the <i>Key file URL</i> box and" +
" click <i>Install Key</i>.</p>" +
"<p>If you do not receive an email, please check your spam or junk-email folder.</p>";
var msg = "<p><?=_('A registration replacement key has been created for USB Flash GUID')?> <strong>"+guid+"</strong></p>" +
"<p><?=_('An email has been sent to')?> <strong>"+email+"</strong> <?=_('containing your key file URL')?>." +
" <?=_('When received, please paste the URL into the <i>Key file URL</i> box and')?>" +
" <?=_('click <i>Install Key</i>')?>.</p>" +
"<p><?=_('If you do not receive an email, please check your spam or junk-email folder')?>.</p>";
$('#status_panel').hide().html(msg).slideDown('fast');
$('#input_form').fadeOut('fast');
@@ -49,8 +53,7 @@ function replaceKey(email, guid, keyfile) {
$('#spinner_image').fadeOut('fast');
var status = data.status;
var obj = data.responseJSON;
var msg = "<p>Sorry, an error ("+status+") occurred registering USB Flash GUID <strong>"+guid+"</strong><p>" +
"<p>The error is: "+obj.error+"</p>";
var msg = "<p><?=_('Sorry, an error occurred')?> <?=_('registering USB Flash GUID')?> <strong>"+guid+"</strong><p>"+"<p><?=_('The error is')?>: "+obj.error+"</p>";
$('#status_panel').hide().html(msg).slideDown('fast');
});
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+7 -4
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -12,6 +12,9 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = '';
require_once "$docroot/webGui/include/Translations.php";
function PsExecute($command, $timeout = 20, $sleep = 2) {
exec($command.'>/dev/null & echo $!',$op);
@@ -36,8 +39,8 @@ function PsKill($pid) {
if (PsExecute("$docroot/webGui/scripts/notify -s 'Unraid SMTP Test' -d 'Test message received!' -i 'alert' -t")) {
$result = exec("tail -3 /var/log/syslog|awk '/sSMTP/ {getline;print}'|cut -d']' -f2|cut -d'(' -f1");
$color = strpos($result, 'Sent mail') ? 'green' : 'red';
echo "Test result<span class='$color'>$result</span>";
echo _("Test result")."<span class='$color'>$result</span>";
} else {
echo "Test result<span class='red'>: No reply from mail server</span>";
echo _("Test result")."<span class='red'>: "._('No reply from mail server')."</span>";
}
?>
+8 -4
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2019, Lime Technology
* Copyright 2012-2019, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -12,6 +12,10 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = 'dashboard';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
$boot = "/boot/config/plugins/dynamix";
@@ -90,8 +94,8 @@ foreach ($models as $model) {
}
$select = substr($casemodel,-4)=='.png' ? 'color:#e68a00' : '';
?>
<a style='text-decoration:none;cursor:pointer;<?=$select?>' onclick='$("input#file").trigger("click")'><div class='case-list' id='Custom'><i class='fa fa-file-image-o'></i><div class='case-name'>custom image</div></div></a>
<a style='text-decoration:none;cursor:pointer' onclick='deleteCase()'><div class='case-list'><i class='fa fa-hdd-o'></i><div class='case-name'>default image</div></div></a>
<a style='text-decoration:none;cursor:pointer;<?=$select?>' onclick='$("input#file").trigger("click")'><div class='case-list' id='Custom'><i class='fa fa-file-image-o'></i><div class='case-name'><?=_('custom image')?></div></div></a>
<a style='text-decoration:none;cursor:pointer' onclick='deleteCase()'><div class='case-list'><i class='fa fa-hdd-o'></i><div class='case-name'><?=_('default image')?></div></div></a>
<input type='file' id='file' accept='.png' onchange='importFile(this.files[0])' style='display:none'>
</div>
</body>
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+21 -18
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2019, Lime Technology
* Copyright 2012-2019, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -12,6 +12,10 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = 'shares';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
$shares = parse_ini_file('state/shares.ini',true);
@@ -29,7 +33,7 @@ $display['scale'] = $_GET['scale'];
$display['number'] = $_GET['number'];
if (!$shares) {
echo "<tr><td colspan='8' style='text-align:center;padding-top:12px'><i class='fa fa-folder-open-o icon'></i>There are no exportable user shares</td></tr>";
echo "<tr><td colspan='8' style='text-align:center;padding-top:12px'><i class='fa fa-folder-open-o icon'></i>"._('There are no exportable user shares')."</td></tr>";
exit;
}
// Natural sorting of share names
@@ -39,8 +43,7 @@ uksort($shares,'strnatcasecmp');
function user_share_settings($protocol,$share) {
if (empty($share)) return;
if ($protocol!='yes' || $share['export']=='-') return "-";
if ($share['export']=='e') return ucfirst($share['security']);
return '<em>'.ucfirst($share['security']).'</em>';
return ($share['export']=='e') ? _(ucfirst($share['security'])) : '<em>'._(ucfirst($share['security'])).'</em>';
}
function globalInclude($name) {
@@ -76,14 +79,14 @@ foreach ($shares as $name => $share) {
$row++;
$color = $share['color'];
switch ($color) {
case 'green-on' : $orb = 'circle'; $color = 'green'; $help = 'All files protected'; break;
case 'yellow-on': $orb = 'warning'; $color = 'yellow'; $help = 'Some or all files unprotected'; break;
case 'green-on' : $orb = 'circle'; $color = 'green'; $help = _('All files protected'); break;
case 'yellow-on': $orb = 'warning'; $color = 'yellow'; $help = _('Some or all files unprotected'); break;
}
if ($crypto) switch ($share['luksStatus']) {
case 0: $luks = "<i class='nolock fa fa-lock'></i>"; break;
case 1: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-unlock-alt green-text'></i><span>All files encrypted</span></a>"; break;
case 2: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-unlock-alt orange-text'></i><span>Some or all files unencrypted</span></a>"; break;
default: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-lock red-text'></i><span>Unknown encryption state'</span></a>"; break;
case 1: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-unlock-alt green-text'></i><span>"._('All files encrypted')."</span></a>"; break;
case 2: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-unlock-alt orange-text'></i><span>"._('Some or all files unencrypted')."</span></a>"; break;
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'><i class='fa fa-$orb orb $color-orb'></i><span style='left:18px'>$help</span></a>$luks<a href='$path/Share?name=".urlencode($name)."' onclick=\"$.cookie('one','tab1',{path:'/'})\">$name</a></td>";
@@ -92,37 +95,37 @@ foreach ($shares as $name => $share) {
echo "<td>".user_share_settings($var['shareNFSEnabled'], $sec_nfs[$name])."</td>";
echo "<td>".user_share_settings($var['shareAFPEnabled'], $sec_afp[$name])."</td>";
$cmd="/webGui/scripts/share_size"."&arg1=".urlencode($name)."&arg2=ssz1";
$cache = ucfirst($share['useCache']);
$cache = _(ucfirst($share['useCache']));
if (array_key_exists($name, $ssz1)) {
echo "<td>$cache</td>";
echo "<td>".my_scale($ssz1[$name]['disk.total']*1024, $unit)." $unit</td>";
echo "<td>".my_scale($share['free']*1024, $unit)." $unit</td>";
echo "<td><a href='$path/Browse?dir=/mnt/user/".urlencode($name)."'><img src='/webGui/images/explore.png' title='Browse /mnt/user/".urlencode($name)."'></a></td>";
echo "<td><a href='$path/Browse?dir=/mnt/user/".urlencode($name)."'><img src='/webGui/images/explore.png' title='"._('Browse')." /mnt/user/".urlencode($name)."'></a></td>";
echo "</tr>";
foreach ($ssz1[$name] as $diskname => $disksize) {
if ($diskname=='disk.total') continue;
$include = $share['include'];
$inside = in_array($diskname, array_filter(array_diff($myDisks, explode(',',$share['exclude'])), 'shareInclude'));
echo "<tr class='share_status_size".($inside ? "'>" : " warning'>");
echo "<td>".my_disk($diskname).":</td>";
echo "<td>".($inside ? "" : "<em>Share is outside the list of designated disks</em>")."</td>";
echo "<td>".my_lang(my_disk($diskname),3).":</td>";
echo "<td>".($inside ? "" : "<em>"._('Share is outside the list of designated disks')."</em>")."</td>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td class='share-$row-1'>".my_scale($disksize*1024, $unit)." $unit</td>";
echo "<td class='share-$row-2'>".my_scale($disks[$diskname]['fsFree']*1024, $unit)." $unit</td>";
echo "<td><a href='/update.htm?cmd=$cmd&csrf_token={$var['csrf_token']}' target='progressFrame' title='Recompute...' onclick='$.cookie(\"ssz\",\"ssz\",{path:\"/\"});$(\".share-$row-1\").html(\"Please wait...\");$(\".share-$row-2\").html(\"\");'><i class='fa fa-refresh icon'></i></a></td>";
echo "<td><a href='/update.htm?cmd=$cmd&csrf_token={$var['csrf_token']}' target='progressFrame' title='"._('Recompute')."...' onclick='$.cookie(\"ssz\",\"ssz\",{path:\"/\"});$(\".share-$row-1\").html(\""._('Please wait')."...\");$(\".share-$row-2\").html(\"\");'><i class='fa fa-refresh icon'></i></a></td>";
echo "</tr>";
}
} else {
echo "<td>$cache</td>";
echo "<td><a href='/update.htm?cmd=$cmd&csrf_token={$var['csrf_token']}' target='progressFrame' onclick=\"$.cookie('ssz','ssz',{path:'/'});$(this).text('Please wait...')\">Compute...</a></td>";
echo "<td><a href='/update.htm?cmd=$cmd&csrf_token={$var['csrf_token']}' target='progressFrame' onclick=\"$.cookie('ssz','ssz',{path:'/'});$(this).text('"._('Please wait')."...')\">"._('Compute')."...</a></td>";
echo "<td>".my_scale($share['free']*1024, $unit)." $unit</td>";
echo "<td><a href='$path/Browse?dir=/mnt/user/".urlencode($name)."'><img src='/webGui/images/explore.png' title='Browse /mnt/user/".urlencode($name)."'></a></td>";
echo "<td><a href='$path/Browse?dir=/mnt/user/".urlencode($name)."'><img src='/webGui/images/explore.png' title='"._('Browse')." /mnt/user/".urlencode($name)."'></a></td>";
echo "</tr>";
}
}
if ($row==0) {
echo "<tr><td colspan='9' style='text-align:center;padding-top:12px'><i class='fa fa-folder-open-o icon'></i>There are no exportable user shares</td></tr>";
echo "<tr><td colspan='9' style='text-align:center;padding-top:12px'><i class='fa fa-folder-open-o icon'></i>"._('There are no exportable user shares')."</td></tr>";
}
+22 -18
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -11,8 +11,12 @@
*/
?>
<?
$disks = []; $var = [];
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = 'main';
require_once "$docroot/webGui/include/Translations.php";
$disks = []; $var = [];
require_once "$docroot/webGui/include/CustomMerge.php";
require_once "$docroot/webGui/include/Wrappers.php";
require_once "$docroot/webGui/include/Preselect.php";
@@ -77,7 +81,7 @@ case "attributes":
echo "<tr{$color}>".implode('',array_map('normalize', $info))."</tr>";
$empty = false;
}
if ($empty) echo "<tr><td colspan='10' style='text-align:center;padding-top:12px'>Can not read attributes</td></tr>";
if ($empty) echo "<tr><td colspan='10' style='text-align:center;padding-top:12px'>"._('Can not read attributes')."</td></tr>";
} else {
// probably a NMVe or SAS device that smartmontools doesn't know how to parse in to a SMART Attributes Data Structure
foreach ($output as $line) {
@@ -116,7 +120,7 @@ case "capabilities":
$empty = false;
}
}
if ($empty) echo "<tr><td colspan='3' style='text-align:center;padding-top:12px'>Can not read capabilities</td></tr>";
if ($empty) echo "<tr><td colspan='3' style='text-align:center;padding-top:12px'>"._('Can not read capabilities')."</td></tr>";
break;
case "identify":
$passed = ['PASSED','OK'];
@@ -128,13 +132,13 @@ case "identify":
if (!$line) continue;
if (strpos($line,'VALID ARGUMENTS')!==false) break;
list($title,$info) = array_map('trim', explode(':', $line, 2));
if (in_array($info,$passed)) $info = "<span class='green-text'>Passed</span>";
if (in_array($info,$failed)) $info = "<span class='red-text'>Failed</span>";
if (in_array($info,$passed)) $info = "<span class='green-text'>"._('Passed')."</span>";
if (in_array($info,$failed)) $info = "<span class='red-text'>"._('Failed')."</span>";
echo "<tr>".normalize(preg_replace('/ is:$/',':',"$title:"),' ')."<td>$info</td></tr>";
$empty = false;
}
if ($empty) {
echo "<tr><td colspan='2' style='text-align:center;padding-top:12px'>Can not read identification</td></tr>";
echo "<tr><td colspan='2' style='text-align:center;padding-top:12px'>"._('Can not read identification')."</td></tr>";
} else {
$file = '/boot/config/disk.log';
$disks = parse_ini_file('state/disks.ini',true);
@@ -142,10 +146,10 @@ case "identify":
$disk = $disks[$name]['id'];
$info = &$extra[$disk];
$periods = ['6','12','18','24','36','48','60'];
echo "<tr><td>Manufacturing date:</td><td><input type='date' class='narrow' value='{$info['date']}' onchange='disklog(\"$disk\",\"date\",this.value)'></td></tr>";
echo "<tr><td>Date of purchase:</td><td><input type='date' class='narrow' value='{$info['purchase']}' onchange='disklog(\"$disk\",\"purchase\",this.value)'></td></tr>";
echo "<tr><td>Warranty period:</td><td><select size='1' class='noframe' onchange='disklog(\"$disk\",\"warranty\",this.value)'><option value=''>unknown</option>";
foreach ($periods as $period) echo "<option value='$period'".($info['warranty']==$period?" selected":"").">$period months</option>";
echo "<tr><td>"._('Manufacturing date').":</td><td><input type='date' class='narrow' value='{$info['date']}' onchange='disklog(\"$disk\",\"date\",this.value)'></td></tr>";
echo "<tr><td>"._('Date of purchase').":</td><td><input type='date' class='narrow' value='{$info['purchase']}' onchange='disklog(\"$disk\",\"purchase\",this.value)'></td></tr>";
echo "<tr><td>"._('Warranty period').":</td><td><select class='noframe' onchange='disklog(\"$disk\",\"warranty\",this.value)'><option value=''>"._('unknown')."</option>";
foreach ($periods as $period) echo "<option value='$period'".($info['warranty']==$period?" selected":"").">$period "._('months')."</option>";
echo "</select></td></tr>";
}
break;
@@ -171,28 +175,28 @@ case "stop":
case "update":
if (!exec("hdparm -C ".escapeshellarg("/dev/$port")."|grep -Pom1 'active|unknown'")) {
$cmd = $_POST['type']=='New' ? "cmd=/webGui/scripts/hd_parm&arg1=up&arg2=$name" : "cmdSpinup=$name";
echo "<a href='/update.htm?$cmd&csrf_token={$_POST['csrf']}' class='info' target='progressFrame'><input type='button' value='Spin Up'></a><span class='big orange-text'>Unavailable - disk must be spun up</span>";
echo "<a href='/update.htm?$cmd&csrf_token={$_POST['csrf']}' class='info' target='progressFrame'><input type='button' value='"._('Spin Up')."'></a><span class='big orange-text'>"._('Unavailable - disk must be spun up')."</span>";
break;
}
$progress = exec("smartctl -c $type ".escapeshellarg("/dev/$port")."|grep -Pom1 '\d+%'");
if ($progress) {
echo "<span class='big'><i class='fa fa-spinner fa-pulse'></i> self-test in progress, ".(100-substr($progress,0,-1))."% complete</span>";
echo "<span class='big'><i class='fa fa-spinner fa-pulse'></i> "._('self-test in progress').", ".(100-substr($progress,0,-1))."% "._('complete')."</span>";
break;
}
$result = trim(exec("smartctl -l selftest $type ".escapeshellarg("/dev/$port")."|grep -m1 '^# 1'|cut -c26-55"));
if (!$result) {
echo "<span class='big'>No self-tests logged on this disk</span>";
echo "<span class='big'>"._('No self-tests logged on this disk')."</span>";
break;
}
if (strpos($result, "Completed without error")!==false) {
echo "<span class='big green-text'>$result</span>";
echo "<span class='big green-text'>"._($result)."</span>";
break;
}
if (strpos($result, "Aborted")!==false or strpos($result, "Interrupted")!==false) {
echo "<span class='big orange-text'>$result</span>";
echo "<span class='big orange-text'>"._($result)."</span>";
break;
}
echo "<span class='big red-text'>Errors occurred - Check SMART report</span>";
echo "<span class='big red-text'>"._('Errors occurred - Check SMART report')."</span>";
break;
case "selftest":
echo shell_exec("smartctl -l selftest $type ".escapeshellarg("/dev/$port")."|awk 'NR>5'");
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+30 -26
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
* Copyright 2012, Andrew Hamer-Adams, http://www.pixeleyes.co.nz.
*
* This program is free software; you can redistribute it and/or
@@ -13,6 +13,10 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = '';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
$var = parse_ini_file('state/var.ini');
@@ -65,31 +69,31 @@ function updateTime() {
</head>
<body onLoad="updateTime()">
<div class="box">
<div><span class="key">Model:</span>
<div><span class="key"><?=_('Model')?>:</span>
<?
echo empty($var['SYS_MODEL']) ? 'N/A' : "{$var['SYS_MODEL']}";
echo empty($var['SYS_MODEL']) ? _('N/A') : $var['SYS_MODEL'];
?>
</div>
<div><span class="key">M/B:</span>
<?
$board = dmidecode('Base Board Information','2',0);
echo "{$board['Manufacturer']} {$board['Product Name']} Version {$board['Version']} - s/n: {$board['Serial Number']}";
echo "{$board['Manufacturer']} {$board['Product Name']} "._('Version')." {$board['Version']} - "._('s/n').": {$board['Serial Number']}";
?>
</div>
<div><span class="key">BIOS:</span>
<div><span class="key"><?=_('BIOS')?>:</span>
<?
$bios = dmidecode('BIOS Information','0',0);
echo "{$bios['Vendor']} Version {$bios['Version']}. Dated: {$bios['Release Date']}";
?>
</div>
<div><span class="key">CPU:</span>
<div><span class="key"><?=_('CPU')?>:</span>
<?
$cpu = dmidecode('Processor Information','4',0);
$cpumodel = str_ireplace(["Processor","(C)","(R)","(TM)"],["","&#169;","&#174;","&#8482;"],$cpu['Version']);
echo $cpumodel.(strpos($cpumodel,'@')!==false ? "" : " @ {$cpu['Current Speed']}");
?>
</div>
<div><span class="key">HVM:</span>
<div><span class="key"><?=_('HVM')?>:</span>
<?
// Check for Intel VT-x (vmx) or AMD-V (svm) cpu virtualization support
// If either kvm_intel or kvm_amd are loaded then Intel VT-x (vmx) or AMD-V (svm) cpu virtualization support was found
@@ -100,42 +104,42 @@ $strCPUInfo = file_get_contents('/proc/cpuinfo');
if (!empty($strLoadedModules)) {
// Yah! CPU and motherboard supported and enabled in BIOS
echo "Enabled";
echo _("Enabled");
} else {
echo '<a href="http://lime-technology.com/wiki/index.php/UnRAID_Manual_6#Determining_HVM.2FIOMMU_Hardware_Support" target="_blank">';
if (strpos($strCPUInfo,'vmx')===false && strpos($strCPUInfo, 'svm')===false) {
// CPU doesn't support virtualization
echo "Not Available";
echo _("Not Available");
} else {
// Motherboard either doesn't support virtualization or BIOS has it disabled
echo "Disabled";
echo _("Disabled");
}
echo '</a>';
}
?>
</div>
<div><span class="key">IOMMU:</span>
<div><span class="key"><?=_('IOMMU')?>:</span>
<?
// Check for any IOMMU Groups
$iommu_groups = shell_exec("find /sys/kernel/iommu_groups/ -type l");
if (!empty($iommu_groups)) {
// Yah! CPU and motherboard supported and enabled in BIOS
echo "Enabled";
echo _("Enabled");
} else {
echo '<a href="http://lime-technology.com/wiki/index.php/UnRAID_Manual_6#Determining_HVM.2FIOMMU_Hardware_Support" target="_blank">';
if (strpos($strCPUInfo,'vmx')===false && strpos($strCPUInfo, 'svm')===false) {
// CPU doesn't support virtualization so iommu would be impossible
echo "Not Available";
echo _("Not Available");
} else {
// Motherboard either doesn't support iommu or BIOS has it disabled
echo "Disabled";
echo _("Disabled");
}
echo '</a>';
}
?>
</div>
<div><span class="key">Cache:</span>
<div><span class="key"><?=_('Cache')?>:</span>
<?
$cache_installed = [];
$cache_devices = dmidecode('Cache Information','7');
@@ -143,7 +147,7 @@ foreach ($cache_devices as $device) $cache_installed[] = str_replace('kB','KiB',
echo implode(', ',$cache_installed);
?>
</div>
<div><span class="key link" onclick="document.getElementsByClassName('dimm_info')[0].classList.toggle('closed')">Memory:</span>
<div><span class="key link" onclick="document.getElementsByClassName('dimm_info')[0].classList.toggle('closed')"><?=_('Memory')?>:</span>
<?
/*
Memory Device (16) will get us each ram chip. By matching on MB it'll filter out Flash/Bios chips
@@ -167,7 +171,7 @@ foreach ($memory_devices as $device) {
}
$memory_array = dmidecode('Physical Memory Array','16');
foreach ($memory_array as $device) {
list($size, $unit) = explode(' ',$device['Maximum Capacity']);
[$size, $unit] = explode(' ',$device['Maximum Capacity']);
$base = array_search($unit,$sizes);
if ($base>=1) $memory_maximum += $size*pow(1024,$base);
if (!$ecc && $device['Error Correction Type']!='None') $ecc = "{$device['Error Correction Type']} ";
@@ -181,7 +185,7 @@ if ($memory_installed >= 1024) {
// If maximum < installed then roundup maximum to the next power of 2 size of installed. E.g. 6 -> 8 or 12 -> 16
$low = $memory_maximum < $memory_installed;
if ($low) $memory_maximum = pow(2,ceil(log($memory_installed)/log(2)));
echo "$memory_installed $unit $memory_type $ecc(max. installable capacity $memory_maximum $unit".($low?'*':'').")";
echo "$memory_installed $unit $memory_type $ecc("._('max. installable capacity')." $memory_maximum $unit".($low?'*':'').")";
?>
<div class="dimm_info closed">
<?
@@ -193,7 +197,7 @@ foreach ($memory_devices as $device) {
?>
</div>
</div>
<div><span class="key">Network:</span>
<div><span class="key"><?=_('Network')?>:</span>
<?
exec("ls /sys/class/net|grep -Po '^(bond|eth)\d+$'",$sPorts);
$i = 0;
@@ -212,24 +216,24 @@ foreach ($sPorts as $port) {
$speed = file_get_contents("$int/speed");
$duplex = file_get_contents("$int/duplex");
echo "$port: $speed Mbps, $duplex duplex, mtu $mtu";
} else echo "$port: interface down";
} else echo "$port: "._("interface down");
}
}
?>
</div>
<div><span class="key">Kernel:</span>
<div><span class="key"><?=_('Kernel')?>:</span>
<?$kernel = exec("uname -srm");
echo $kernel;
?></div>
<div><span class="key">OpenSSL:</span>
<div><span class="key"><?=_('OpenSSL')?>:</span>
<?$openssl_ver = exec("openssl version|cut -d' ' -f2");
echo $openssl_ver;
?></div>
<div><span class="key">Uptime:</span>&nbsp;<span id="uptime"></span></div>
<div><span class="key"><?=_('Uptime')?>:</span>&nbsp;<span id="uptime"></span></div>
<div style="margin-top:24px;margin-bottom:12px"><span class="key"></span>
<input type="button" value="Close" onclick="top.Shadowbox.close()">
<input type="button" value="<?=_('Close')?>" onclick="top.Shadowbox.close()">
<?if ($_GET['more']):?>
<a href="<?=htmlspecialchars($_GET['more'])?>" class="button" style="display:inline-block;padding:1px" target="_parent">More</a>
<a href="<?=htmlspecialchars($_GET['more'])?>" class="button" style="display:inline-block;padding:1px" target="_parent"><?=_('More')?></a>
<?endif;?>
</div></div>
</body>
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+99
View File
@@ -0,0 +1,99 @@
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
session_start();
function _($text) {
global $language;
if (!$text) return '';
$data = $language[preg_replace(['/\&amp;|[\?\{\}\|\&\~\!\[\]\(\)\/\\:\*^\.\"\']|<.+?\/?>/','/^(null|yes|no|true|false|on|off|none)$/i','/ +/'],['','$1.',' '],$text)] ?? $text;
return strpos($data,'*')===false ? $data : preg_replace(['/\*\*(.+?)\*\*/','/\*(.+?)\*/'],['<b>$1</b>','<i>$1</i>'],$data);
}
function parse_lang_file($file) {
return array_filter(parse_ini_string(preg_replace(['/"/m','/^(null|yes|no|true|false|on|off|none)=/mi','/^([^>].*)=([^"\'`].*)$/m','/^:((help|plug)\d*)$/m','/^:end$/m'],['\'','$1.=','$1="$2"',"_$1_=\"",'"'],str_replace("=\n","=''\n",file_get_contents($file)))),'strlen');
}
function rewrite($text) {
return preg_replace_callback('/_\((.+?)\)_/m',function($m){return _($m[1]);},preg_replace(["/^:((help|plug)\d*)$/m","/^:end$/m"],["<?if (translate(\"_$1_\")):?>","<?endif;?>"],$text));
}
function my_lang($text,$do=0) {
global $language;
switch ($do) {
case 0: // date translation
$months = isset($language['Months_array']) ? explode(' ',$language['Months_array']) : [];
$days = isset($language['Days_array']) ? explode(' ',$language['Days_array']) : [];
foreach ($months as $month) {
[$word,$that] = explode(':',$month);
if (strpos($text,$word)!==false) {$text = str_replace($word,$that,$text); break;}
}
foreach ($days as $day) {
[$word,$that] = explode(':',$day);
if (strpos($text,$word)!==false) {$text = str_replace($word,$that,$text); break;}
}
if (isset($language['today'])) $text = str_replace('today',$language['today'],$text);
if (isset($language['yesterday'])) $text = str_replace('yesterday',$language['yesterday'],$text);
if (isset($language['days ago'])) $text = str_replace('days ago',$language['days ago'],$text);
break;
case 1: // number translation
$numbers = isset($language['Numbers_array']) ? explode(' ',$language['Numbers_array']) : [];
foreach ($numbers as $number) {
[$word,$that] = explode(':',$number);
if (strpos($text,$word)!==false) {$text = str_replace($word,$that,$text); break;}
}
break;
case 2: // time translation
$time1 = ['days'=>$language['days']??'','hours'=>$language['hours']??'','minutes'=>$language['minutes']??'','seconds'=>$language['seconds']??''];
$time2 = ['day'=>$language['day']??'','hour'=>$language['hour']??'','minute'=>$language['minute']??'','second'=>$language['second']??''];
foreach ($time1 as $word => $that) {
if ($that && strpos($text,$word)!==false) {
$text = str_replace($word,$that,$text);
} else {
$one = substr($word,0,-1);
if ($time2[$one]) $text = str_replace($one,$time2[$one],$text);
}
}
if (isset($language['Average speed'])) $text = str_replace('Average speed',$language['Average speed'],$text);
break;
case 3: // device translation
[$p1,$p2] = explode(' ',$text);
$text = rtrim(_($p1)." $p2");
}
return $text;
}
function translate($key) {
global $language;
if ($plug = isset($language[$key])) eval('?>'.Markdown($language[$key]));
return !$plug;
}
$language = [];
$locale = $_SESSION['locale'];
if ($locale) {
$uri = explode('/',explode('?',$_SERVER['REQUEST_URI'])[0]);
$text = "$docroot/languages/$locale/translations.txt";
if (file_exists($text)) {
$data = "$docroot/languages/$locale/translations.dot";
if (!file_exists($data)) file_put_contents($data,serialize(parse_lang_file($text)));
$language = unserialize(file_get_contents($data));
}
foreach($uri as $add) {
if (!$add) continue;
$add = strtolower($add);
$text = "$docroot/languages/$locale/$add.txt";
if (file_exists($text)) {
$data = "$docroot/languages/$locale/$add.dot";
if (!file_exists($data)) file_put_contents($data,serialize(parse_lang_file($text)));
$language = array_merge($language,unserialize(file_get_contents($data)));
}
}
}
?>
+9 -7
View File
@@ -1,5 +1,5 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
/* Copyright 2005-2020, 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,
@@ -11,6 +11,10 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = 'tools';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
$var = parse_ini_file('state/var.ini');
@@ -35,11 +39,11 @@ if (!empty($_POST['trial'])) {
<div id="status_panel"></div>
<form markdown="1" id="trial_form">
<p><input type="checkbox" id="eula" name="eula"><label for="eula">By using this software, you agree with our <a target="_blank" href="/Tools/EULA">End-User License Agreement</a> and <a target="_blank" href="https://unraid.net/policies">Privacy Policy</a>.</label></p>
<p><input type="checkbox" id="eula" name="eula"><label for="eula"><?=_('By using this software, you agree with our')?> <a target="_blank" href="/Tools/EULA"><?=_('End-User License Agreement')?></a> <?=_('and')?> <a target="_blank" href="https://unraid.net/policies"><?=_('Privacy Policy')?></a>.</label></p>
<br><br>
<center><input type="button" id="trial_button" value="<?=(strstr($var['regTy'], "expired")?"Extend":"Start")?> Trial" onclick="startTrial()" disabled></center>
<center><input type="button" id="trial_button" value="<?=(strstr($var['regTy'], "expired")?_("Extend"):_("Start"))?> <?=_('Trial')?>" onclick="startTrial()" disabled></center>
</form>
</div>
@@ -54,16 +58,14 @@ function startTrial() {
$.post('https://keys.lime-technology.com/account/trial',{timestamp:timestamp,guid:guid},function(data) {
$.post('/webGui/include/TrialRequest.php',{trial:data.trial,csrf_token:'<?=$var['csrf_token']?>'},function(data2) {
$('#spinner_image,#status_panel').fadeOut('fast');
parent.swal({title:'Trial <?=(strstr($var['regTy'], "expired")?"extended":"started")?>',text:'Thank you for registering USB Flash GUID '+guid+'.',type:'success'},function(){parent.window.location='/Main';});
parent.swal({title:"<?=_('Trial')?> <?=(strstr($var['regTy'], 'expired')?_('extended'):_('started'))?>",text:"<?=_('Thank you for registering USB Flash GUID')?> "+guid+".",type:'success'},function(){parent.window.location='/Main';});
});
}).fail(function(data) {
$('#trial_form').find('input').prop('disabled', false);
$('#spinner_image').fadeOut('fast');
var status = data.status;
var obj = data.responseJSON;
var msg = "<p>Sorry, an error ("+status+") occurred registering USB Flash GUID <strong>"+guid+"</strong><p>" +
"<p>The error is: "+obj.error+"</p>";
var msg = "<p><?=_('Sorry, an error occurred')?> <?=('registering USB Flash GUID')?> <strong>"+guid+"</strong><p>"+"<p><?=_('The error is')?>: "+obj.error+"</p>";
$('#status_panel').hide().html(msg).slideDown('fast');
});
}
+5 -5
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -32,14 +32,14 @@ function response_complete($httpcode, $result, $cli_success_msg='') {
list($protocol, $hostname, $internalport) = explode(":", rtrim(file_get_contents("/var/run/nginx.origin")));
$hostname = substr($hostname, 2);
if (!preg_match('/.*\.unraid\.net$/', $hostname)) {
response_complete(406, '{"error":"Nothing to do"}');
response_complete(406, '{"error":"'._('Nothing to do').'"}');
}
// keyfile
$var = parse_ini_file("/var/local/emhttp/var.ini");
$keyfile = @file_get_contents($var['regFILE']);
if ($keyfile === false) {
response_complete(406, '{"error":"Registration key required"}');
response_complete(406, '{"error":"'._('Registration key required').'"}');
}
$keyfile = @base64_encode($keyfile);
@@ -63,5 +63,5 @@ if ($result === false) {
response_complete(500, '{"error":"'.$error.'"}');
}
response_complete($httpcode, $result, 'success');
response_complete($httpcode, $result, _('success'));
?>
+10 -6
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -11,12 +11,16 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = 'settings';
require_once "$docroot/webGui/include/Translations.php";
$map = $changes = [];
function decode($data) {
return str_replace('%2e','.',urldecode($data));
}
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$map = $changes = [];
foreach (array_map('decode',explode(';',$_POST['names'])) as $name) $map[$name] = '';
foreach($_POST as $key => $val) {
@@ -33,7 +37,7 @@ case 'vm':
require_once "$docroot/plugins/dynamix.vm.manager/include/libvirt_helpers.php";
foreach ($map as $name => $cpuset) {
if (!strlen($cpuset)) {
$reply = ['error' => "Not allowed to assign ZERO cores"];
$reply = ['error' => _("Not allowed to assign ZERO cores")];
break 2;
}
$uuid = $lv->domain_get_uuid($lv->get_domain_by_name($name));
+6 -3
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -12,6 +12,9 @@
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
$_SERVER['REQUEST_URI'] = 'settings';
require_once "$docroot/webGui/include/Translations.php";
function scan($line, $text) {
return stripos($line,$text)!==false;
@@ -70,7 +73,7 @@ case 'vm':
}
} else $stopped = true;
if (!$stopped) {
$reply = ['error' => "Failed to stop '$name'"];
$reply = ['error' => _('Failed to stop')." '$name'"];
break;
}
$lv->nvram_backup($uuid);
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+32
View File
@@ -0,0 +1,32 @@
af_ZA=Afrikaans
ar_SA=العربية
bs_BA=Bosanski
cs_CZ=Čeština
da_DK=Dansk
de_DE=Deutsch
es_ES=Español
et_EE=Eesti
fi_FI=Suomi
fr_FR=Français
ga_IE=Gaeilge
he_IL=עברית
hi_IN=हिन्दी, हिंदी
hr_HR=Hrvatski
hu_HU=Magyar
id_ID=Bahasa
ja_JP=日本語
ko_KR=한국어
nl_NL=Nederlands
no_NO=Norsk
pt_PT=Português
ro_RO=Română
ru_RU=Русский
sk_SK=Slovenčina
sl_SI=Slovenščina
sr_RS=Српски Језик
sv_SE=Svenska
th_TH=ไทย
tr_TR=Türkçe
uk_UA=Українська
vi_VN=Tiếng Việt
zh_CN=中文
+1 -1
View File
@@ -1,5 +1,5 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
/* Copyright 2005-2020, 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,
+1 -1
View File
@@ -1,5 +1,5 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
/* Copyright 2005-2020, 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,
+7 -3
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -11,6 +11,10 @@
*/
?>
<?
// add translations
$_SERVER['REQUEST_URI'] = '';
require_once "$docroot/webGui/include/Translations.php";
$index = $_GET['index'];
$tests = explode(',',$_GET['test']);
if ($index < count($tests)) {
@@ -38,6 +42,6 @@ if ($index < count($tests)) {
elseif (strpos($text,'LUKS1:')!==false) echo str_replace("\t"," ",$text);
}
pclose($bm);
echo "<div style='text-align:center;margin-top:12px'><input type='button' value='Done' onclick='top.Shadowbox.close()'></div>";
echo "<div style='text-align:center;margin-top:12px'><input type='button' value='"._('Done')."' onclick='top.Shadowbox.close()'></div>";
}
?>
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2016, Lime Technology
* Copyright 2016, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,