Merge branch 'master' of github.com:limetech/dynamix-6.2

This commit is contained in:
Eric Schultz
2016-08-26 20:58:07 -05:00
13 changed files with 451 additions and 162 deletions

View File

@@ -14,129 +14,31 @@ Icon="date-time.png"
* all copies or substantial portions of the Software.
*/
?>
<script>
function checkDateTimeSettings() {
form = document.datetime_settings;
if (form.USE_NTP.value=="yes") {
form.newDateTime.disabled=true;
form.NTP_SERVER1.disabled=false;
form.NTP_SERVER2.disabled=false;
form.NTP_SERVER3.disabled=false;
} else {
form.newDateTime.disabled=false;
form.NTP_SERVER1.disabled=true;
form.NTP_SERVER2.disabled=true;
form.NTP_SERVER3.disabled=true;
}
}
$(checkDateTimeSettings);
</script>
<?$keys = explode("\n", file_get_contents('webGui/include/timezones.key'));?>
<form markdown="1" name="datetime_settings" method="POST" action="/update.htm" target="progressFrame">
Current date and time:
: <?=my_time($var['currTime'])?>
Time zone:
: <select name="timeZone" size="1">
<?if (file_exists("/boot/config/timezone")):?>
<?=mk_option($var['timeZone'], "custom", "(custom)")?>
<?endif; ?>
<?=mk_option($var['timeZone'], "Pacific/Apia", "(UTC-11:00) Midway Island, Samoa")?>
<?=mk_option($var['timeZone'], "Pacific/Honolulu", "(UTC-10:00) Hawaii")?>
<?=mk_option($var['timeZone'], "America/Anchorage", "(UTC-09:00) Alaska")?>
<?=mk_option($var['timeZone'], "America/Los_Angeles", "(UTC-08:00) Pacific Time (US & Canada)")?>
<?=mk_option($var['timeZone'], "America/Tijuana", "(UTC-08:00) Tijuana, Baja California")?>
<?=mk_option($var['timeZone'], "America/Phoenix", "(UTC-07:00) Arizona")?>
<?=mk_option($var['timeZone'], "America/Chihuahua", "(UTC-07:00) Chihuahua, La Paz, Mazatlan")?>
<?=mk_option($var['timeZone'], "America/Denver", "(UTC-07:00) Mountain Time (US & Canada)")?>
<?=mk_option($var['timeZone'], "America/Guatemala", "(UTC-06:00) Central America")?>
<?=mk_option($var['timeZone'], "America/Chicago", "(UTC-06:00) Central Time (US & Canada)")?>
<?=mk_option($var['timeZone'], "America/Mexico_City", "(UTC-06:00) Guadalajara, Mexico City, Monterrey")?>
<?=mk_option($var['timeZone'], "America/Regina", "(UTC-06:00) Saskatchewan")?>
<?=mk_option($var['timeZone'], "America/Bogota", "(UTC-05:00) Bogota, Lima, Quito")?>
<?=mk_option($var['timeZone'], "America/New_York", "(UTC-05:00) Eastern Time (US & Canada)")?>
<?=mk_option($var['timeZone'], "America/Indiana/Indianapolis", "(UTC-05:00) Indiana (East)")?>
<?=mk_option($var['timeZone'], "America/Caracas", "(UTC-04:30) Caracas")?>
<?=mk_option($var['timeZone'], "America/Asuncion", "(UTC-04:00) Asuncion")?>
<?=mk_option($var['timeZone'], "America/Halifax", "(UTC-04:00) Atlantic Time (Canada)")?>
<?=mk_option($var['timeZone'], "America/La_Paz", "(UTC-04:00) Georgetown, La Paz, San Juan")?>
<?=mk_option($var['timeZone'], "America/Campo_Grande", "(UTC-04:00) Manaus")?>
<?=mk_option($var['timeZone'], "America/Santiago", "(UTC-04:00) Santiago")?>
<?=mk_option($var['timeZone'], "America/Buenos_Aires", "(UTC-03:00) Buenos Aires")?>
<?=mk_option($var['timeZone'], "America/Sao_Paulo", "(UTC-03:00) Brasilia")?>
<?=mk_option($var['timeZone'], "America/Noronha", "(UTC-02:00) Mid-Atlantic")?>
<?=mk_option($var['timeZone'], "Atlantic/Azores", "(UTC-01:00) Azores")?>
<?=mk_option($var['timeZone'], "Atlantic/Cape_Verde", "(UTC-01:00) Cape Verde Is.")?>
<?=mk_option($var['timeZone'], "America/Cayenne", "(UTC-03:00) Cayenne")?>
<?=mk_option($var['timeZone'], "America/Godthab", "(UTC-03:00) Greenland")?>
<?=mk_option($var['timeZone'], "America/Montevideo", "(UTC-03:00) Montevideo")?>
<?=mk_option($var['timeZone'], "America/St_Johns", "(UTC-03:30) Newfoundland")?>
<?=mk_option($var['timeZone'], "UTC", "(UTC) Coordinated Universal Time")?>
<?=mk_option($var['timeZone'], "Africa/Casablanca", "(UTC+00:00) Casablanca")?>
<?=mk_option($var['timeZone'], "Europe/London", "(UTC+00:00) Dublin, Edinburgh, Lisbon, London")?>
<?=mk_option($var['timeZone'], "Atlantic/Reykjavik", "(UTC+00:00) Monrovia, Reykjavik")?>
<?=mk_option($var['timeZone'], "Europe/Berlin", "(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna")?>
<?=mk_option($var['timeZone'], "Europe/Budapest", "(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague")?>
<?=mk_option($var['timeZone'], "Europe/Paris", "(UTC+01:00) Brussels, Copenhagen, Madrid, Paris")?>
<?=mk_option($var['timeZone'], "Europe/Warsaw", "(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb")?>
<?=mk_option($var['timeZone'], "Africa/Lagos", "(UTC+01:00) West Central Africa")?>
<?=mk_option($var['timeZone'], "Asia/Amman", "(UTC+02:00) Amman")?>
<?=mk_option($var['timeZone'], "Europe/Istanbul", "(UTC+02:00) Athens, Bucharest, Istanbul")?>
<?=mk_option($var['timeZone'], "Asia/Beirut", "(UTC+02:00) Beirut")?>
<?=mk_option($var['timeZone'], "Africa/Cairo", "(UTC+02:00) Cairo")?>
<?=mk_option($var['timeZone'], "Africa/Johannesburg", "(UTC+02:00) Harare, Pretoria")?>
<?=mk_option($var['timeZone'], "Europe/Kiev", "(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius")?>
<?=mk_option($var['timeZone'], "Asia/Jerusalem", "(UTC+02:00) Jerusalem")?>
<?=mk_option($var['timeZone'], "Europe/Minsk", "(UTC+02:00) Minsk")?>
<?=mk_option($var['timeZone'], "Africa/Windhoek", "(UTC+02:00) Windhoek")?>
<?=mk_option($var['timeZone'], "Asia/Baghdad", "(UTC+03:00) Baghdad")?>
<?=mk_option($var['timeZone'], "Asia/Riyadh", "(UTC+03:00) Kuwait, Riyadh")?>
<?=mk_option($var['timeZone'], "Europe/Moscow", "(UTC+03:00) Moscow, St. Petersburg, Volgograd")?>
<?=mk_option($var['timeZone'], "Africa/Nairobi", "(UTC+03:00) Nairobi")?>
<?=mk_option($var['timeZone'], "Asia/Tehran", "(UTC+03:30) Tehran")?>
<?=mk_option($var['timeZone'], "Asia/Dubai", "(UTC+04:00) Abu Dhabi, Muscat")?>
<?=mk_option($var['timeZone'], "Asia/Baku", "(UTC+04:00) Baku")?>
<?=mk_option($var['timeZone'], "Indian/Mauritius", "(UTC+04:00) Port Louis")?>
<?=mk_option($var['timeZone'], "Asia/Yerevan", "(UTC+04:00) Yerevan")?>
<?=mk_option($var['timeZone'], "Asia/Kabul", "(UTC+04:30) Kabul")?>
<?=mk_option($var['timeZone'], "Asia/Yekaterinburg", "(UTC+05:00) Ekaterinburg")?>
<?=mk_option($var['timeZone'], "Asia/Karachi", "(UTC+05:00) Islamabad, Karachi")?>
<?=mk_option($var['timeZone'], "Asia/Tashkent", "(UTC+05:00) Tashkent")?>
<?=mk_option($var['timeZone'], "Asia/Calcutta", "(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi")?>
<?=mk_option($var['timeZone'], "Asia/Colombo", "(UTC+05:30) Sri Jayawardenepura")?>
<?=mk_option($var['timeZone'], "Asia/Katmandu", "(UTC+05:45) Kathmandu")?>
<?=mk_option($var['timeZone'], "Asia/Almaty", "(UTC+06:00) Astana")?>
<?=mk_option($var['timeZone'], "Asia/Dhaka", "(UTC+06:00) Dhaka")?>
<?=mk_option($var['timeZone'], "Asia/Novosibirsk", "(UTC+06:00) Novosibirsk")?>
<?=mk_option($var['timeZone'], "Asia/Rangoon", "(UTC+06:30) Yangon (Rangoon)")?>
<?=mk_option($var['timeZone'], "Asia/Bangkok", "(UTC+07:00) Bangkok, Hanoi, Jakarta")?>
<?=mk_option($var['timeZone'], "Asia/Krasnoyarsk", "(UTC+07:00) Krasnoyarsk")?>
<?=mk_option($var['timeZone'], "Asia/Shanghai", "(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi")?>
<?=mk_option($var['timeZone'], "Asia/Irkutsk", "(UTC+08:00) Irkutsk")?>
<?=mk_option($var['timeZone'], "Asia/Singapore", "(UTC+08:00) Kuala Lumpur, Singapore")?>
<?=mk_option($var['timeZone'], "Australia/Perth", "(UTC+08:00) Perth")?>
<?=mk_option($var['timeZone'], "Asia/Taipei", "(UTC+08:00) Taipei")?>
<?=mk_option($var['timeZone'], "Asia/Ulaanbaatar", "(UTC+08:00) Ulaanbaatar")?>
<?=mk_option($var['timeZone'], "Asia/Tokyo", "(UTC+09:00) Osaka, Sapporo, Tokyo")?>
<?=mk_option($var['timeZone'], "Asia/Seoul", "(UTC+09:00) Seoul")?>
<?=mk_option($var['timeZone'], "Asia/Yakutsk", "(UTC+09:00) Yakutsk")?>
<?=mk_option($var['timeZone'], "Australia/Adelaide", "(UTC+09:30) Adelaide")?>
<?=mk_option($var['timeZone'], "Australia/Darwin", "(UTC+09:30) Darwin")?>
<?=mk_option($var['timeZone'], "Australia/Brisbane", "(UTC+10:00) Brisbane")?>
<?=mk_option($var['timeZone'], "Australia/Sydney", "(UTC+10:00) Canberra, Melbourne, Sydney")?>
<?=mk_option($var['timeZone'], "Pacific/Port_Moresby", "(UTC+10:00) Guam, Port Moresby")?>
<?=mk_option($var['timeZone'], "Australia/Hobart", "(UTC+10:00) Hobart")?>
<?=mk_option($var['timeZone'], "Asia/Vladivostok", "(UTC+10:00) Vladivostok")?>
<?=mk_option($var['timeZone'], "Pacific/Guadalcanal", "(UTC+11:00) Magadan, Solomon Is., New Caledonia")?>
<?=mk_option($var['timeZone'], "Pacific/Auckland", "(UTC+12:00) Auckland, Wellington")?>
<?=mk_option($var['timeZone'], "Pacific/Fiji", "(UTC+12:00) Fiji, Marshall Is.")?>
<?=mk_option($var['timeZone'], "Asia/Kamchatka", "(UTC+12:00) Petropavlovsk-Kamchatsky")?>
<?=mk_option($var['timeZone'], "Pacific/Tongatapu", "(UTC+13:00) Nuku'alofa")?>
</select>
: <select name="timeZone" size="1"><?
if (file_exists("/boot/config/timezone")) {
$yr = date('Y') + 1;
$tz = exec("zdump -V -c $yr /boot/config/timezone|tail -2|grep -Po 'isdst=0 gmtoff=\K.*'");
$hh = strlen($tz) ? sprintf("%'.02d",floor(abs($tz)/3600)) : '??';
$mm = strlen($tz) ? sprintf("%'.02d",abs($tz)%3600/60) : '??';
$tt = $tz < 0 ? 'UTC-' : 'UTC+';
echo mk_option($var['timeZone'], "custom", "($tt$hh:$mm) Custom time zone");
}
foreach ($keys as $key) {
list($timezone, $city) = explode('|', $key);
echo mk_option($var['timeZone'], $timezone, $city);
}
?></select>
> Select your time zone. You may also define a custom time zone file and have it appear as a selection
> Select your time zone. You may also define a custom time zone file and have it appear as a selection in the drop-down list.
>
> in the drop-down list. To do this, copy your time zone file to your flash device, with name `config/timezone`.
> To do this, copy your time zone file with name **timezone** to the folder **config** on your flash device.
Use NTP:
: <select name="USE_NTP" size="1" class="narrow" onchange="checkDateTimeSettings(this.form)">
@@ -169,4 +71,22 @@ New date and time:
&nbsp;
: <input type="submit" name="setDateTime" value="Apply"><input type="button" value="Done" onclick="done()">
</form>
</form>
<script>
function checkDateTimeSettings() {
form = document.datetime_settings;
if (form.USE_NTP.value=="yes") {
form.newDateTime.disabled=true;
form.NTP_SERVER1.disabled=false;
form.NTP_SERVER2.disabled=false;
form.NTP_SERVER3.disabled=false;
} else {
form.newDateTime.disabled=false;
form.NTP_SERVER1.disabled=true;
form.NTP_SERVER2.disabled=true;
form.NTP_SERVER3.disabled=true;
}
}
$(checkDateTimeSettings);
</script>

View File

@@ -14,8 +14,8 @@ Title="New Config"
*/
?>
<?
$superdat = file_exists('/boot/config/super.dat');
$disabled = $var['fsState']=="Started" || !$superdat ? 'disabled' : '';
$newarray = $var['mdState']=='NEW_ARRAY';
$disabled = $var['fsState']=="Started" || $newarray ? 'disabled' : '';
?>
<style>
span.indent{display:inline-block;width:200px;margin-top:11px;}
@@ -78,7 +78,7 @@ effect of making it ***impossible*** to rebuild an existing failed drive - you h
<br>
<span class="indent"><input type="submit" name="cmdInit" value=" Apply " disabled><input type="button" value=" Done " onclick="done()"></span>
<?if ($disabled):?>
<?=$superdat ? 'Array must be <b>STOPPED</b>' : 'Array has been <b>RESET</b> (please configure)'?>
<?=$newarray ? 'Array has been <b>RESET</b> (please configure)' : 'Array must be <b>STOPPED</b>'?>
<?else:?>
<input type="checkbox" onClick="cmdInit.disabled=!this.checked"><small>Yes I want to do this</small>
<?endif;?>

View File

@@ -14,7 +14,29 @@ Cond="(($var['shareSMBEnabled']!='no') && (isset($name)?array_key_exists($name,$
* all copies or substantial portions of the Software.
*/
?>
<form markdown="1" method="POST" action="/update.htm" target="progressFrame">
<?
function clone_list($disk) {
return strpos($disk['status'],'_NP')===false && ($disk['type']=='Data' || $disk['name']=='cache');
}
?>
<style>
table.settings{width:83.3%;}
table.settings tr td:first-child{width:40%;}
</style>
<div style="float:right">
<span style="display:block;font-weight:bold;margin-left:2px;margin-bottom:4px">Clone destinations</span>
<select id="s4" name="smbClone" size="1" multiple="multiple" style="display:none">
<?
if (isset($disks[$name])) {
foreach (array_filter($disks,'clone_list') as $list) if ($list['name']!=$name) echo mk_option("", $list['name'], my_disk($list['name']));
} else {
foreach ($shares as $list) if ($list['name']!=$name) echo mk_option("", $list['name'], $list['name']);
}
?>
</select>
</div>
<form markdown="1" method="POST" action="/update.htm" target="progressFrame" onchange="$('#clonesmb').prop('disabled',true)">
<input type="hidden" name="shareName" value="<?=$name?>">
Share name:
@@ -44,30 +66,116 @@ Security:
> **Secure** All users including guests have read access, you select which of your users
> have write access.
>
> **Private** No guest access at all, you select which of your users have read/write or
> **Private** No guest access at all, you select which of your users have read/write or
> read-only access.
&nbsp;
: <input type="submit" name="changeShareSecurity" value="Apply"><input type="button" value="Done" onclick="done()">
: <input type="submit" name="changeShareSecurity" value="Apply"><input type="button" value="Done" onclick="done()"><input type="button" id="clonesmb" value="Clone" onclick="cloneSMB()">
</form>
<?if ($sec[$name]['security'] == 'secure'):?>
<form markdown="1" method="POST" action="/update.htm" target="progressFrame">
<input type="hidden" name="shareName" value="<?=$name?>">
<div id="title" class="nocontrol"><dt>User Access</dt><i>Guests have <b>read-only</b> access.</i></div>
<div style="float:right">
<span style="display:block;font-weight:bold;margin-left:2px;margin-bottom:4px">Clone destinations</span>
<select id="s5" name="smbClone" size="1" multiple="multiple" style="display:none">
<?
if (isset($disks[$name])) {
foreach ($disks as $list) if ($list['name']!=$name && ($list['type']=='Data' || $list['name']=='cache') && $sec[$list['name']]['security']=='secure') echo mk_option("", $list['name'], my_disk($list['name']));
} else {
foreach ($shares as $list) if ($list['name']!=$name && $sec[$list['name']]['security']=='secure') echo mk_option("", $list['name'], $list['name']);
}
?>
</select>
</div>
<form markdown="1" method="POST" action="/update.htm" target="progressFrame" onchange="$('#cloneuser').prop('disabled',true)">
<input type="hidden" name="shareName" value="<?=$name?>">
<?input_secure_users($sec);?>
&nbsp;
: <input type="submit" name="changeShareAccess" value="Apply"><input type="button" value="Done" onclick="done()">
: <input type="submit" name="changeShareAccess" value="Apply"><input type="button" value="Done" onclick="done()"><input type="button" id="cloneuser" value="Clone" onclick="cloneUser()">
</form>
<?elseif ($sec[$name]['security'] == 'private'):?>
<form markdown="1" method="POST" action="/update.htm" target="progressFrame">
<input type="hidden" name="shareName" value="<?=$name?>">
<div id="title" class="nocontrol"><dt>User Access</dt><i>Guests have <b>no</b> access.</i></div>
<div style="float:right">
<span style="display:block;font-weight:bold;margin-left:2px;margin-bottom:4px">Clone destinations</span>
<select id="s5" name="smbClone" size="1" multiple="multiple" style="display:none">
<?
if (isset($disks[$name])) {
foreach (array_filter($disks,'clone_list') as $list) if ($list['name']!=$name && $sec[$list['name']]['security']=='private') echo mk_option("", $list['name'], my_disk($list['name']));
} else {
foreach ($shares as $list) if ($list['name']!=$name && $sec[$list['name']]['security']=='private') echo mk_option("", $list['name'], $list['name']);
}
?>
</select>
</div>
<form markdown="1" method="POST" action="/update.htm" target="progressFrame" onchange="$('#cloneuser').prop('disabled',true)">
<input type="hidden" name="shareName" value="<?=$name?>">
<?input_private_users($sec);?>
&nbsp;
: <input type="submit" name="changeShareAccess" value="Apply"><input type="button" value="Done" onclick="done()">
: <input type="submit" name="changeShareAccess" value="Apply"><input type="button" value="Done" onclick="done()"><input type="button" id="cloneuser" value="Clone" onclick="cloneUser()">
</form>
<?endif;?>
<script>
$(function() {
initDropdown2(false);
<?if ($tabbed):?>
$('#tab'+$('input[name$="tabs"]').length).bind({click:function(){initDropdown2(true);}});
<?endif;?>
<?if (count($users)==1):?>
$('#cloneuser').prop('disabled',true);
<?endif;?>
});
function initDropdown2(reset) {
if (reset) {
$('#s4').dropdownchecklist('destroy');
$('#s5').dropdownchecklist('destroy');
}
$("#s4").dropdownchecklist({emptyText:'None', width:150, explicitClose:'...close'});
$("#s5").dropdownchecklist({emptyText:'None', width:150, explicitClose:'...close'});
}
function cloneSMB() {
var data = {}, copied = false;
data['shareExport'] = '<?=$sec[$name]['export']?>';
data['shareSecurity'] = '<?=$sec[$name]['security']?>';
data['changeShareSecurity'] = 'Apply';
$('select#s4 option').map(function() {
if ($(this).prop('selected')==true) {
data['shareName'] = $(this).val();
$.post('/update.htm', data);
copied = true;
}
});
if (copied) swal({title:'Clone complete',text:'SMB security settings are cloned to the selected shares',type:'success'},function(){refresh();});
}
function cloneUser() {
var data = {}, copied = false;
data['userAccess.0'] = 'no-access';
<?
$read_list = explode(",", $sec[$name]['readList']);
$write_list = explode(",", $sec[$name]['writeList']);
foreach ($users as $user) {
if ($user['name'] == "root") continue;
$idx = $user['idx'];
$userAccess = null;
if ($sec[$name]['security']=='secure') {
$userAccess = in_array($user['name'], $write_list) ? "read-write" : "read-only";
} elseif ($sec[$name]['security'] == 'private') {
$userAccess = in_array($user['name'], $write_list) ? "read-write" : (in_array($user['name'], $read_list) ? "read-only" : "no-access");
}
if ($userAccess) echo " data['userAccess.$idx'] = '$userAccess';\n";
}
?>
data['changeShareAccess'] = 'Apply';
$('select#s5 option').map(function() {
if ($(this).prop('selected')==true) {
data['shareName'] = $(this).val();
$.post('/update.htm', data);
copied = true;
}
});
if (copied) swal('Clone complete','User access settings are cloned to the selected shares','success');
}
</script>

View File

@@ -25,6 +25,7 @@ foreach ($shares as $ref) {
$end = count($refs)-1;
$prev = urlencode($i>0 ? $refs[$i-1] : $refs[$end]);
$next = urlencode($i<$end ? $refs[$i+1] : $refs[0]);
?>
<script>
var ctrl = "<span class='ctrl1 status vhshift'><a href='/Shares/Share?name=<?=$prev?>' title='previous user share'><button type='button' style='margin-right:4px'><i class='fa fa-chevron-left'></i></button></a><a href='/Shares/Share?name=<?=$next?>' title='next user share'><button type='button'><i class='fa fa-chevron-right'></i></button></a></span>";
@@ -37,4 +38,6 @@ $(function() {
<?endif;?>
});
</script>
<?else:?>
<?$tabbed = false;?>
<?endif;?>

View File

@@ -57,11 +57,27 @@ $myDisks = array_filter(array_diff(array_keys($disks), explode(',',$var['shareUs
<script>
$(function() {
$("#s1").dropdownchecklist({emptyText:'All', width:300, explicitClose:'...close'});
$("#s2").dropdownchecklist({emptyText:'None', width:300, explicitClose:'...close'});
initDropdown1(false);
<?if ($tabbed):?>
$('#tab1').bind({click:function(){initDropdown1(true);}});
<?endif;?>
setDiskList(document.share_edit.shareUseCache.value);
presetSpace(document.share_edit.shareFloor);
});
function initDropdown1(reset) {
if (reset) {
$('#s1').dropdownchecklist('destroy');
$('#s2').dropdownchecklist('destroy');
<?if ($name):?>
$('#s3').dropdownchecklist('destroy');
<?endif;?>
}
$("#s1").dropdownchecklist({emptyText:'All', width:300, explicitClose:'...close'});
$("#s2").dropdownchecklist({emptyText:'None', width:300, explicitClose:'...close'});
<?if ($name):?>
$("#s3").dropdownchecklist({emptyText:'None', width:150, explicitClose:'...close'});
<?endif;?>
}
function setDiskList(cache) {
var onOff = cache=='only' ? 'disable' : 'enable';
$("#s1").dropdownchecklist(onOff);
@@ -79,8 +95,12 @@ function presetSpace(shareFloor) {
function prepareEdit(form) {
// Test share name validity
var share = form.shareName.value.trim();
if (share.length==0) {
swal('Missing share name', 'Enter a name for the share', 'error');
return false;
}
if (share.match('^(disk[0-9]+|cache[0-9]*|flash)$')) {
swal({title:"Invalid share name",text:"Do not use reserved names",type:"error"});
swal('Invalid share name', 'Do not use reserved names', 'error');
return false;
}
form.shareName.value = share;
@@ -115,12 +135,42 @@ function prepareEdit(form) {
item.selected = true;
return true;
}
<?if ($name):?>
function cloneShare() {
var data = {}, copied = false;
data['shareAllocator'] = '<?=$share['allocator']?>';
data['shareFloor'] = '<?=$share['floor']?>';
data['shareSplitLevel'] = '<?=$share['splitLevel']?>';
data['shareInclude'] = '<?=$share['include']?>';
data['shareExclude'] = '<?=$share['exclude']?>';
data['shareUseCache'] = '<?=$share['useCache']?>';
data['cmdEditShare'] = 'Apply';
$('select#s3 option').map(function() {
if ($(this).prop('selected')==true) {
data['shareNameOrig'] = $(this).val();
data['shareName'] = $(this).val();
$.post('/update.htm', data);
copied = true;
}
});
if (copied) swal('Clone complete','Share settings are cloned to the selected shares','success');
}
<?endif;?>
</script>
<form markdown="1" name="share_edit" method="POST" action="/update.htm" target="progressFrame" onchange="this.cmdEditShare.disabled=this.shareName.value.trim()==''" onsubmit="return prepareEdit(this)">
<?if ($name):?>
<div style="float:right">
<span style="display:block;font-weight:bold;margin-left:2px;margin-bottom:4px">Clone destinations</span>
<select id="s3" name="shareClone" size="1" multiple="multiple" style="display:none">
<?foreach ($shares as $list) if ($list['name']!=$name) echo mk_option("", $list['name'], $list['name']);?>
</select>
</div>
<?endif;?>
<form markdown="1" name="share_edit" method="POST" action="/update.htm" target="progressFrame" onsubmit="return prepareEdit(this)" onchange="$('#cloneshare').prop('disabled',true)">
<input type="hidden" name="shareNameOrig" value="<?=$share['nameOrig']?>">
Share name:
: <input type="text" name="shareName" maxlength="40" value="<?=$share['name']?>">
: <input type="text" name="shareName" maxlength="40" value="<?=$name?>">
> The share name can be up to 40 characters, and is case-sensitive with these restrictions:
>
@@ -261,17 +311,17 @@ Enable Copy-on-write:
>
> Set to **Auto** for normal operation, meaning COW **will** be in effect on devices formatted with *btrfs*.
<?if ($share['name'] == ""):?>
<?if (!$name):?>
&nbsp;
: <input type="submit" name="cmdEditShare" value="Add Share"><input type="button" value="Done" onclick="done()">
<?elseif (shareEmpty($share['name'])):?>
<?elseif (shareEmpty($name)):?>
Share status:
: <big>Share is empty</big>
> Share does *not* contain any data and may be deleted if not needed any longer.
Delete<input type="checkbox" name="confirmDelete" onchange="chkDelete(this.form, this.form.cmdEditShare);">
: <input type="submit" name="cmdEditShare" value="Apply"><input type="button" value="Done" onclick="done()">
: <input type="submit" name="cmdEditShare" value="Apply"><input type="button" value="Done" onclick="done()"><input type="button" id="cloneshare" value="Clone" onclick="cloneShare()">
<?else:?>
Share status:
: <big>Share contains data</big>
@@ -279,6 +329,6 @@ Share status:
> Share can *not* be deleted as long as it contains data. Be aware that some data can be hidden. See also [SMB Settings](/Settings/SMB) -> Hide "dot" files.
&nbsp;
: <input type="submit" name="cmdEditShare" value="Apply"><input type="button" value="Done" onclick="done()">
: <input type="submit" name="cmdEditShare" value="Apply"><input type="button" value="Done" onclick="done()"><input type="button" id="cloneshare" value="Clone" onclick="cloneShare()">
<?endif;?>
</form>

View File

@@ -14,6 +14,9 @@ Title="SMTP Settings"
*/
?>
<?
require_once 'webGui/include/Encryption.php';
$ssmtp['AuthPass'] = base64_decrypt($ssmtp['AuthPass']);
$incomplete = strlen($ssmtp['root'])==0 || strlen($ssmtp['server'])==0 || strlen($ssmtp['port'])==0 || ((strlen($ssmtp['AuthUser'])==0 || strlen($ssmtp['AuthPass'])==0) && $ssmtp['AuthMethod']!='none');
?>
<script>
@@ -66,6 +69,7 @@ function settings(form, data) {
<form markdown="1" name="smtp_setup" method="POST" action="/update.php" target="progressFrame" onsubmit="return mailcheck(this)" onchange="disableTest()">
<input type="hidden" name="#file" value="dynamix/dynamix.cfg">
<input type="hidden" name="#section" value="ssmtp">
<input type="hidden" name="#include" value="/webGui/include/update.ssmtp.php">
<input type="hidden" name="#command" value="/webGui/scripts/notify">
<input type="hidden" name="#arg[1]" value="smtp-init">
Preset service:

View File

@@ -0,0 +1,63 @@
<?PHP
// PHP encrypt decrypt using base64
// v1 (2013-04-14)
// http://www.geocontext.org/publ/2013/04/base64_encrypt_decrypt/
// Krystian Pietruszka
// www.geocontext.org
// info@geocontext.org
// Public domain license
// Adapted by Bergware for use in unRAID
// forced use of hash key
/*
Example encrypt:
base64_encrypt('AuthPass');
Example decrypt:
base64_decrypt('AuthPass');
*/
$abc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$key = 'unraid#hash#key';
function base64_encrypt($pw) {
global $abc, $key;
$s = '';
$a = str_split('+/='.$abc);
$b = str_split(mixing_key(strrev('-_='.$abc), $key));
$t = str_split(base64_encode(substr(md5($key),0,16).$pw));
for ($i=0; $i<count($t); $i++) for ($j=0; $j<count($a); $j++) {
if ($t[$i]==$a[$j]) $s .= $b[$j];
}
return $s;
}
function base64_decrypt($pw) {
global $abc, $key;
$s = '';
$a = str_split('+/='.$abc);
$b = str_split(mixing_key(strrev('-_='.$abc), $key));
$t = str_split($pw);
for ($i=0; $i<count($t); $i++) for ($j=0; $j<count($b); $j++) {
if ($t[$i]==$b[$j]) $s .= $a[$j];
}
$s = base64_decode($s);
// return decrypted or plain password (backward compability)
return substr($s,0,16)==substr(md5($key),0,16) ? substr($s,16) : $pw;
}
function mixing_key($b, $key) {
$s = '';
$c = $b;
$t = str_split($b);
$k = str_split(sha1($key));
for ($i=0; $i<count($k); $i++) for ($j=0; $j<count($t); $j++) {
if ($k[$i]==$t[$j]) {
$c = str_replace($t[$j],'',$c);
if (!preg_match('/'.$t[$j].'/',$s)) $s .= $t[$j];
}
}
return $c.$s;
}
?>

View File

@@ -28,7 +28,7 @@ $display['scale'] = $_GET['scale'];
$display['number'] = $_GET['number'];
if (!$shares) {
echo "<tr><td colspan='8' style='text-align:center'>There are no user shares</td></tr>";
echo "<tr><td colspan='8' style='text-align:center'><i class='fa fa-folder-open-o icon'></i>There are no exportable user shares</td></tr>";
exit;
}

View File

@@ -17,6 +17,11 @@ $var = parse_ini_file('state/var.ini');
<link type="text/css" rel="stylesheet" href="/webGui/styles/default-fonts.css">
<link type="text/css" rel="stylesheet" href="/webGui/styles/default-white.css">
<style>
span.key{width:82px;display:inline-block;font-weight:bold;}
div.box{margin-top:8px;font-size:12px;line-height:30px;color:#303030;margin-left:40px;}
</style>
<script>
// server uptime & update period
var uptime = <?=strtok(exec("cat /proc/uptime"),' ')?>;
@@ -35,18 +40,18 @@ function updateTime() {
</script>
<body onLoad="updateTime()">
<div style="margin-top:20px;font-size:12px;line-height:30px;color:#303030;margin-left:40px;">
<div><span style="width:90px;display:inline-block"><strong>Model:</strong></span>
<div class="box">
<div><span class="key">Model:</span>
<?
echo empty($var['SYS_MODEL']) ? 'N/A' : "{$var['SYS_MODEL']}";
?>
</div>
<div><span style="width:90px;display:inline-block"><strong>M/B:</strong></span>
<div><span class="key">M/B:</span>
<?
echo exec("dmidecode -q -t 2|awk -F: '/^\tManufacturer:/{m=$2;}; /^\tProduct Name:/{p=$2;} END{print m\" -\"p}'");
?>
</div>
<div><span style="width:90px; display:inline-block"><strong>CPU:</strong></span>
<div><span class="key">CPU:</span>
<?
function write($number) {
$words = array('zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty');
@@ -66,7 +71,7 @@ if (strpos($cpumodel,'@')===false) {
}
?>
</div>
<div><span style="width:90px; display:inline-block"><strong>HVM:</strong></span>
<div><span class="key">HVM:</span>
<?
// Check for Intel VT-x (vmx) or AMD-V (svm) cpu virtualzation support
// If either kvm_intel or kvm_amd are loaded then Intel VT-x (vmx) or AMD-V (svm) cpu virtualzation support was found
@@ -91,7 +96,7 @@ if (strpos($cpumodel,'@')===false) {
}
?>
</div>
<div><span style="width:90px; display:inline-block"><strong>IOMMU:</strong></span>
<div><span class="key">IOMMU:</span>
<?
// Check for any IOMMU Groups
$iommu_groups = shell_exec("find /sys/kernel/iommu_groups/ -type l");
@@ -112,7 +117,7 @@ if (strpos($cpumodel,'@')===false) {
}
?>
</div>
<div><span style="width:90px; display:inline-block"><strong>Cache:</strong></span>
<div><span class="key">Cache:</span>
<?
$cache = explode('#',exec("dmidecode -q -t 7|awk -F: '/^\tSocket Designation:/{c=c$2\";\";}; /^\tInstalled Size:/{s=s$2\";\";} END{print c\"#\"s}'"));
$socket = array_map('trim',explode(';',$cache[0]));
@@ -129,7 +134,7 @@ for ($i=0; $i<count($socket); $i++) {
echo $size;
?>
</div>
<div><span style="width:90px; display:inline-block"><strong>Memory:</strong></span>
<div><span class="key">Memory:</span>
<?
// Memory Device (16) will get us each ram chip. By matching on MB it'll filter out Flash/Bios chips
// Sum up all the Memory Devices to get the amount of system memory installed. Convert MB to GB
@@ -144,13 +149,13 @@ if ($memory_maximum < $memory_installed) {$memory_maximum = pow(2,ceil(log($memo
echo "$memory_installed GB (max. installable capacity $memory_maximum GB)$star";
?>
</div>
<div><span style="width:90px; display:inline-block"><strong>Network:</strong></span>
<div><span class="key">Network:</span>
<?
exec("ls /sys/class/net|grep -Po '^(bond|eth)\d+$'",$sPorts);
$i = 0;
foreach ($sPorts as $port) {
$mtu = file_get_contents("/sys/class/net/$port/mtu");
if ($i++) echo "<br><span style='width:94px; display:inline-block'>&nbsp;</span>";
if ($i++) echo "<br><span class='key'></span>&nbsp;";
if ($port=='bond0') {
echo "$port: ".exec("grep -Pom1 '^Bonding Mode: \K.+' /proc/net/bonding/bond0").", mtu $mtu";
} else {
@@ -161,19 +166,19 @@ foreach ($sPorts as $port) {
}
?>
</div>
<div><span style="width:90px;display:inline-block"><strong>Kernel:</strong></span>
<div><span class="key">Kernel:</span>
<?$kernel = exec("uname -srm");
echo $kernel;
?></div>
<div><span style="width:90px; display:inline-block"><strong>OpenSSL:</strong></span>
<div><span class="key">OpenSSL:</span>
<?$openssl_ver = exec("openssl version|cut -d' ' -f2");
echo $openssl_ver;
?></div>
<div><span style="width:94px; display:inline-block"><strong>Uptime:</strong></span><span id="uptime"></span></div>
<center><br>
<div><span class="key">Uptime:</span>&nbsp;<span id="uptime"></span></div>
<div><span class="key"></span>
<input type="button" value="Close" onclick="top.Shadowbox.close()">
<?if ($_GET['more']):?>
<a href="<?=$_GET['more']?>" class="button" target="_parent">More</a>
<?endif;?>
</center>
</div></div>
</body>

View File

@@ -0,0 +1,94 @@
Pacific/Honolulu|(UTC-10:00) Hawaii
America/Anchorage|(UTC-09:00) Alaska
America/Los_Angeles|(UTC-08:00) Pacific Time (US & Canada)
America/Tijuana|(UTC-08:00) Baja California, Tijuana
America/Phoenix|(UTC-07:00) Arizona
America/Chihuahua|(UTC-07:00) Chihuahua, La Paz, Mazatlan
America/Denver|(UTC-07:00) Mountain Time (US & Canada)
America/Guatemala|(UTC-06:00) Central America
America/Chicago|(UTC-06:00) Central Time (US & Canada)
America/Mexico_City|(UTC-06:00) Guadalajara, Mexico City, Monterrey
America/Regina|(UTC-06:00) Saskatchewan
America/Bogota|(UTC-05:00) Bogota, Lima, Quito, Rio Branco
America/New_York|(UTC-05:00) Eastern Time (US & Canada)
America/Indiana/Indianapolis|(UTC-05:00) Indiana (East)
America/Caracas|(UTC-04:00) Caracas
America/Asuncion|(UTC-04:00) Asuncion
America/Halifax|(UTC-04:00) Atlantic Time (Canada)
America/La_Paz|(UTC-04:00) Georgetown, La Paz, San Juan
America/Campo_Grande|(UTC-04:00) Manaus
America/Santiago|(UTC-04:00) Santiago
America/St_Johns|(UTC-03:30) Newfoundland
America/Buenos_Aires|(UTC-03:00) Buenos Aires
America/Sao_Paulo|(UTC-03:00) Brasilia, Sao Paulo
America/Cayenne|(UTC-03:00) Cayenne, Fortaleza
America/Godthab|(UTC-03:00) Greenland
America/Montevideo|(UTC-03:00) Montevideo
America/Noronha|(UTC-02:00) Mid-Atlantic
Atlantic/Azores|(UTC-01:00) Azores
Atlantic/Cape_Verde|(UTC-01:00) Cabo Verde Is.
UTC|(UTC) Coordinated Universal Time
Africa/Casablanca|(UTC+00:00) Casablanca
Europe/London|(UTC+00:00) Dublin, Edinburgh, Lisbon, London
Atlantic/Reykjavik|(UTC+00:00) Monrovia, Reykjavik
Europe/Berlin|(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
Europe/Budapest|(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague
Europe/Paris|(UTC+01:00) Brussels, Copenhagen, Madrid, Paris
Europe/Warsaw|(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb
Africa/Lagos|(UTC+01:00) West Central Africa
Africa/Windhoek|(UTC+01:00) Windhoek
Asia/Amman|(UTC+02:00) Amman
Europe/Istanbul|(UTC+02:00) Athens, Bucharest, Istanbul
Asia/Beirut|(UTC+02:00) Beirut
Africa/Cairo|(UTC+02:00) Cairo
Africa/Johannesburg|(UTC+02:00) Harare, Pretoria
Europe/Kiev|(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius
Asia/Jerusalem|(UTC+02:00) Jerusalem
Asia/Baghdad|(UTC+03:00) Baghdad
Asia/Riyadh|(UTC+03:00) Kuwait, Riyadh
Europe/Minsk|(UTC+03:00) Minsk
Europe/Moscow|(UTC+03:00) Moscow, St. Petersburg, Volgograd
Africa/Nairobi|(UTC+03:00) Nairobi
Asia/Tehran|(UTC+03:30) Tehran
Asia/Dubai|(UTC+04:00) Abu Dhabi, Muscat
Asia/Baku|(UTC+04:00) Baku
Indian/Mauritius|(UTC+04:00) Port Louis
Asia/Yerevan|(UTC+04:00) Yerevan
Asia/Kabul|(UTC+04:30) Kabul
Asia/Yekaterinburg|(UTC+05:00) Ekaterinburg
Asia/Karachi|(UTC+05:00) Islamabad, Karachi
Asia/Tashkent|(UTC+05:00) Ashgabat, Tashkent
Asia/Calcutta|(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi
Asia/Colombo|(UTC+05:30) Sri Jayawardenepura
Asia/Katmandu|(UTC+05:45) Kathmandu
Asia/Almaty|(UTC+06:00) Astana
Asia/Dhaka|(UTC+06:00) Dhaka
Asia/Novosibirsk|(UTC+06:00) Novosibirsk
Asia/Rangoon|(UTC+06:30) Yangon (Rangoon)
Asia/Bangkok|(UTC+07:00) Bangkok, Hanoi, Jakarta
Asia/Krasnoyarsk|(UTC+07:00) Krasnoyarsk
Asia/Shanghai|(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi
Asia/Irkutsk|(UTC+08:00) Irkutsk
Asia/Singapore|(UTC+08:00) Kuala Lumpur, Singapore
Australia/Perth|(UTC+08:00) Perth
Asia/Taipei|(UTC+08:00) Manila, Taipei
Asia/Ulaanbaatar|(UTC+08:00) Ulaanbaatar
Asia/Pyongyang|(UTC+08:30) Pyongyang
Australia/Eucla|(UTC+08:45) Eucla
Asia/Tokyo|(UTC+09:00) Osaka, Sapporo, Tokyo
Asia/Seoul|(UTC+09:00) Seoul
Asia/Yakutsk|(UTC+09:00) Yakutsk
Australia/Adelaide|(UTC+09:30) Adelaide
Australia/Darwin|(UTC+09:30) Darwin
Australia/Brisbane|(UTC+10:00) Brisbane
Australia/Sydney|(UTC+10:00) Canberra, Melbourne, Sydney
Pacific/Port_Moresby|(UTC+10:00) Guam, Port Moresby
Australia/Hobart|(UTC+10:00) Hobart
Asia/Vladivostok|(UTC+10:00) Vladivostok
Asia/Sakhalin|(UTC+11:00) Magadan, Yuzhno-Sakhalinsk
Pacific/Guadalcanal|(UTC+11:00) New Caledonia, Solomon Is.
Asia/Kamchatka|(UTC+12:00) Anadyr, Petropavlovsk-Kamchatsky
Pacific/Auckland|(UTC+12:00) Auckland, Wellington
Pacific/Fiji|(UTC+12:00) Fiji, Marshall Is.
Pacific/Apia|(UTC+13:00) Samoa
Pacific/Tongatapu|(UTC+13:00) Nuku'alofa

View File

@@ -0,0 +1,17 @@
<?PHP
/* Copyright 2005-2016, Lime Technology
* Copyright 2012-2016, 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.
*/
?>
<?
require_once 'webGui/include/Encryption.php';
$_POST['AuthPass'] = base64_encrypt($_POST['AuthPass']);
?>

View File

@@ -116,7 +116,7 @@ foreach ($shares as $share) {
if (!in_array("/boot/config/shares/$name.cfg",$files)) file_put_contents(anonymize("/$diag/shares/$name.cfg",2),"# This share has default settings.\r\n");
}
// copy syslog information (anonymize if applicable)
$max = 3*1024*1024; //3MB
$max = 2*1024*1024; //=2MB
foreach (glob("/var/log/syslog*") as $file) {
$log = "/$diag/logs/".basename($file);
exec("todos <$file >$log.txt");
@@ -131,18 +131,42 @@ foreach (glob("/var/log/syslog*") as $file) {
exec("grep -n ' cache_dirs: -' $log.txt 2>/dev/null|cut -d: -f1", $rows);
for ($i = 0; $i < count($rows); $i += 2) for ($row = $rows[$i]+1; $row < $rows[$i+1]; $row++) exec("sed -ri '$row s|(cache_dirs: \S).*(\S)|\\1..\\2|' $log.txt 2>/dev/null");
}
exec("tail -n 200 $log.txt >$log.last200.txt");
if (basename($file)=='syslog' && filesize($file)>=$max) exec("tail -n 200 $log.txt >$log.last200.txt");
exec("truncate -s '<$max' $log.txt");
}
// copy docker information (if existing)
$max = 1*1024*1024; //=1MB
$docker = "/var/log/docker.log";
if (file_exists($docker)) exec("todos <$docker >/$diag/logs/docker.log");
if (file_exists($docker)) {
$log = "/$diag/logs/docker.log";
exec("todos <$docker >$log");
if (filesize($docker)>=$max) {
exec("tail -n 200 $log >$log.last200");
exec("truncate -s '<$max' $log");
}
}
// copy libvirt information (if existing)
$libvirtd = "/var/log/libvirt/libvirtd.log";
if (file_exists($libvirtd)) exec("todos <$libvirtd >/$diag/logs/libvirtd.log");
if (file_exists($libvirtd)) {
$log = "/$diag/logs/libvirt";
exec("todos <$libvirtd >$log");
if (filesize($libvirtd)>=$max) {
exec("tail -n 200 $log.log >$log.last200");
exec("truncate -s '<$max' $log");
}
}
// copy VMs information (if existing)
$qemu = glob("/var/log/libvirt/qemu/*.log*");
if ($qemu)
foreach ($qemu as $file) exec("todos <".escapeshellarg($file)." >/$diag/qemu/".escapeshellarg(basename($file)));
else
if ($qemu) {
foreach ($qemu as $file) {
$log = "/$diag/qemu/".escapeshellarg(basename($file));
exec("todos <".escapeshellarg($file)." >$log");
if (filesize($file)>=$max) {
exec("tail -n 200 $log.log >$log.last200");
exec("truncate -s '<$max' $log");
}
}
} else
file_put_contents("/$diag/qemu/no qemu log files","");
// create SMART reports (suppress errors)
$disks = file_exists("$get/disks.ini") ? parse_ini_file("$get/disks.ini", true) : [];

View File

@@ -14,6 +14,7 @@
?>
<?
require_once '/usr/local/emhttp/webGui/include/Wrappers.php';
require_once '/usr/local/emhttp/webGui/include/Encryption.php';
function usage() {
echo <<<EOT
@@ -114,7 +115,7 @@ case 'smtp-init':
@mkdir($unread,0755,true);
@mkdir($archive,0755,true);
$conf = [];
$conf[] = "# Generated";
$conf[] = "# Generated settings:";
$conf[] = "Root={$ssmtp['root']}";
$domain = strtok($ssmtp['root'],'@');
$domain = strtok('@');
@@ -126,7 +127,7 @@ case 'smtp-init':
if ($ssmtp['AuthMethod'] != "none") {
$conf[] = "AuthMethod={$ssmtp['AuthMethod']}";
$conf[] = "AuthUser={$ssmtp['AuthUser']}";
$conf[] = "AuthPass={$ssmtp['AuthPass']}";
$conf[] = "AuthPass=".base64_decrypt($ssmtp['AuthPass']);
}
$conf[] = "";
file_put_contents("/etc/ssmtp/ssmtp.conf", implode("\n", $conf));