Merge branch 'master' into refactor/web-component-updates

This commit is contained in:
Zack Spear
2023-11-07 16:18:42 -08:00
committed by GitHub
404 changed files with 3514 additions and 3212 deletions
@@ -50,7 +50,7 @@ $THEME_DARK = in_array($display['theme'],['black','gray']);
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1300">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="robots" content="noindex, nofollow">
<meta http-equiv="Content-Security-Policy" content="block-all-mixed-content">
<meta name="referrer" content="same-origin">
+21 -14
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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,17 +11,24 @@
*/
?>
<?
$ram = "/var/local/emhttp/monitor.ini";
$rom = "/boot/config/plugins/dynamix/monitor.ini";
$saved = parse_ini_file($ram,true);
$saved["smart"]["{$_POST['disk']}.ack"] = "true";
$ram = "/var/local/emhttp/monitor.ini";
$rom = "/boot/config/plugins/dynamix/monitor.ini";
$disk = $_POST['disk'] ?? '';
$text = "";
foreach ($saved as $item => $block) {
if ($block) $text .= "[$item]\n";
foreach ($block as $key => $value) $text .= "$key=\"$value\"\n";
if ($disk) {
$text = "";
$saved = parse_ini_file($ram,true);
$saved["smart"]["$disk.ack"] = "true";
foreach ($saved as $item => $block) {
if ($block) $text .= "[$item]\n";
foreach ($block as $key => $value) $text .= "$key=\"$value\"\n";
}
file_put_contents($ram, $text);
file_put_contents($rom, $text);
echo "200 OK";
} else {
echo "404 ERROR";
}
file_put_contents($ram, $text);
file_put_contents($rom, $text);
echo "200 OK";
?>
?>
+1 -2
View File
@@ -11,8 +11,7 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Helpers.php";
extract(parse_plugin_cfg('dynamix',true));
+1 -1
View File
@@ -11,7 +11,7 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
// add translations
$_SERVER['REQUEST_URI'] = '';
+1 -2
View File
@@ -11,8 +11,7 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Helpers.php";
// add translations
+4 -3
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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 +11,8 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
// add translations
$_SERVER['REQUEST_URI'] = 'settings';
require_once "$docroot/webGui/include/Translations.php";
+2 -2
View File
@@ -11,12 +11,12 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Helpers.php";
// add translations
$_SERVER['REQUEST_URI'] = '';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
function age($number,$time) {
return sprintf(_('%s '.($number==1 ? $time : $time.'s').' ago'),$number);
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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,14 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Helpers.php";
extract(parse_plugin_cfg('dynamix',true));
// add translations
$_SERVER['REQUEST_URI'] = '';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
extract(parse_plugin_cfg('dynamix',true));
[$luks,$size,$hash,$rng] = my_explode(',',exec("/usr/sbin/cryptsetup --help|tail -1"),4);
$luks = str_replace('-plain64','',trim(explode(':',$luks)[1]));
$size = str_replace(' bits','',trim(explode(':',$size)[1]));
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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,7 +1,7 @@
<?PHP
/* Copyright 2005-2023, Lime Technology
* Copyright 2014-2023, Guilherme Jardim, Eric Schultz, Jon Panozzo.
* Copyright 2012-2023, Bergware International.
* Copyright 2014-2021, Guilherme Jardim, Eric Schultz, Jon Panozzo.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -12,13 +12,14 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Helpers.php";
require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
require_once "$docroot/plugins/dynamix.vm.manager/include/libvirt_helpers.php";
// 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";
require_once "$docroot/webGui/include/Helpers.php";
if (isset($_POST['sys'])) {
switch ($_POST['sys']) {
@@ -11,7 +11,7 @@
*/
?>
<?
$display['font'] = filter_var($_COOKIE['fontSize']??$display['font']??'',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
$display['font'] = filter_var($_COOKIE['fontSize'] ?? $display['font'] ?? '',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
$theme = strtok($display['theme'],'-');
$header = $display['header'];
$backgnd = $display['background'];
@@ -46,7 +46,18 @@ function annotate($text) {echo "\n<!--\n",str_repeat("#",strlen($text)),"\n$text
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/jquery.sweetalert.css")?>">
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/default-{$display['theme']}.css")?>">
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/dynamix-{$display['theme']}.css")?>">
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/defaultpagelayout.css")?>">
<style>
<?if (empty($display['width'])):?>
@media (max-width:1280px){#displaybox{min-width:1280px;max-width:1280px;margin:0}}
@media (min-width:1281px){#displaybox{min-width:1280px;max-width:1920px;margin:0 <?=$themes1?'10px':'auto'?>}}
@media (min-width:1921px){#displaybox{min-width:1280px;max-width:1920px;margin:0 auto}}
<?else:?>
@media (max-width:1280px){#displaybox{min-width:1280px;margin:0}}
@media (min-width:1281px){#displaybox{min-width:1280px;margin:0 <?=$themes1?'10px':'auto'?>}}
@media (min-width:1921px){#displaybox{min-width:1280px;margin:0 <?=$themes1?'20px':'auto'?>}}
<?endif;?>
<?if ($display['font']):?>
html{font-size:<?=$display['font']?>%}
<?endif;?>
@@ -64,16 +75,6 @@ html{font-size:<?=$display['font']?>%}
<?endif;?>
<?endif;?>
<?endif;?>
.inline_help{display:none}
.upgrade_notice{position:fixed;top:24px;left:50%;margin-left:-480px;width:900px;height:38px;line-height:38px;color:#e68a00;background-color:#feefb3;border:#e68a00 1px solid;border-radius:38px;text-align:center;font-size:1.4rem;z-index:999}
.upgrade_notice.done{color:#4f8a10;background-color:#dff2bf;border-color:#4f8a10}
.upgrade_notice.alert{color:#f0000c;background-color:#ff9e9e;border-color:#f0000c}
.upgrade_notice i{float:right;cursor:pointer}
.back_to_top{display:none;position:fixed;bottom:30px;right:12px;color:#e22828;font-size:2.5rem;z-index:999}
span.big.blue-text{cursor:pointer}
span.strong.tour{margin-left:5px;padding-left:0}
i.abortOps{font-size:2rem;float:right;margin-right:20px;margin-top:8px;cursor:pointer}
pre#swalbody p{margin-block-end:1em}
<?
$nchan = ['webGui/nchan/notify_poller','webGui/nchan/session_check'];
$safemode = _var($var,'safeMode')=='yes';
@@ -622,7 +623,7 @@ $.ajaxPrefilter(function(s, orig, xhr){
<?include "$docroot/plugins/dynamix.my.servers/include/myservers1.php"?>
</head>
<body>
<div id="template">
<div id="displaybox">
<div class="upgrade_notice" style="display:none"></div>
<div id="header" class="<?=$display['banner']?>">
<div class="logo">
@@ -680,6 +681,13 @@ if ($themes2) echo "</div>";
echo "</div></div>";
foreach ($buttons as $button) {
annotate($button['file']);
// include page specific stylesheets (if existing)
$css = "/{$button['root']}/sheets/{$button['name']}";
$css_stock = "$css.css";
$css_theme = "$css-$theme.css";
if (is_file($docroot.$css_stock)) echo '<link type="text/css" rel="stylesheet" href="',autov($css_stock),'">',"\n";
if (is_file($docroot.$css_theme)) echo '<link type="text/css" rel="stylesheet" href="',autov($css_theme),'">',"\n";
// create page content
eval('?>'.parse_text($button['text']));
}
unset($buttons,$button);
@@ -738,6 +746,13 @@ foreach ($pages as $page) {
// create list of nchan scripts to be started
if (isset($page['Nchan'])) nchan_merge($page['root'], $page['Nchan']);
annotate($page['file']);
// include page specific stylesheets (if existing)
$css = "/{$page['root']}/sheets/{$page['name']}";
$css_stock = "$css.css";
$css_theme = "$css-$theme.css";
if (is_file($docroot.$css_stock)) echo '<link type="text/css" rel="stylesheet" href="',autov($css_stock),'">',"\n";
if (is_file($docroot.$css_theme)) echo '<link type="text/css" rel="stylesheet" href="',autov($css_theme),'">',"\n";
// create page content
empty($page['Markdown']) || $page['Markdown']=='true' ? eval('?>'.Markdown(parse_text($page['text']))) : eval('?>'.parse_text($page['text']));
if ($close) echo "</div></div>";
}
@@ -11,9 +11,8 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Wrappers.php";
extract(parse_plugin_cfg('dynamix',true));
$path = _var($notify,'path','/tmp/notifications');
+3 -3
View File
@@ -11,12 +11,12 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Helpers.php";
// add translations
$_SERVER['REQUEST_URI'] = 'shares';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
$compute = rawurldecode(_var($_POST,'compute'));
$path = rawurldecode(_var($_POST,'path'));
@@ -88,7 +88,7 @@ foreach ($disks as $name => $disk) {
} else $luks = "";
echo "<tr><td><a class='view' href=\"/$path/Browse?dir=/mnt/$name\"><i class=\"icon-u-tab\" title=\"",_('Browse')," /mnt/$name\"></i></a>";
echo "<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')\">",compress($name),"</a></td>";
echo "<td>{$disk['comment']}</td>";
echo "<td>"._var($disk,'comment')."</td>";
echo "<td>",disk_share_settings(_var($var,'shareSMBEnabled'), $sec[$name]),"</td>";
echo "<td>",disk_share_settings(_var($var,'shareNFSEnabled'), $sec_nfs[$name]),"</td>";
$cmd="/webGui/scripts/disk_size&arg1=$name&arg2=ssz2";
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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,20 +11,21 @@
*/
?>
<?
$keys = parse_ini_file($_POST['#cfg'], true);
$text = "";
$keys = parse_ini_file($_POST['#cfg'], true);
$cleanup = isset($_POST['#cleanup']);
$text = "";
foreach ($_POST as $field => $value) {
if ($field[0] == '#') continue;
$n = strrpos($field,'_');
$section = str_replace('%3E','.',substr($field,0,$n));
$key = substr($field,$n+1);
$keys[$section][$key] = $value;
[$section,$key] = explode('_',$field,2);
$keys[str_replace('%3E','.',$section)][$key] = $value;
}
foreach ($keys as $section => $block) {
$pairs = "";
foreach ($block as $key => $value) if (strlen($value) || !$cleanup) $pairs .= "$key=\"$value\"\n";
if ($pairs) $text .= "[$section]\n".$pairs;
}
if ($text) file_put_contents($_POST['#cfg'], $text); else @unlink($_POST['#cfg']);
?>
+2 -1
View File
@@ -11,7 +11,8 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
$file = $_POST['file']??'';
function validpath($file) {
+2 -2
View File
@@ -1,5 +1,5 @@
<?PHP
/* Copyright 2005-2022, Lime Technology
/* Copyright 2005-2023, 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,
@@ -10,7 +10,7 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
if (array_key_exists('getdiagnostics', $_GET)) {
$anonymize = empty($_GET['anonymize']) ? '-a' : '';
@@ -11,7 +11,7 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
$cmd = $_POST['cmd'];
$path = $_POST['path'];
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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 -4
View File
@@ -11,7 +11,7 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Wrappers.php";
require_once "$docroot/webGui/include/Secure.php";
@@ -63,9 +63,6 @@ function my_disks($disk) {
function my_hyperlink($text, $link) {
return str_replace(['[',']'],["<a href=\"$link\">","</a>"],$text);
}
function prefix($key) {
return preg_replace('/\d+$/','',$key);
}
function parity_only($disk) {
return _var($disk,'type')=='Parity';
}
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2022, Lime Technology
* Copyright 2012-2022, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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,9 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$charts = '/var/tmp/charts_data.tmp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
$charts = '/var/tmp/charts_data.tmp';
switch ($_POST['cmd']) {
case 'get':
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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,
@@ -10,8 +10,7 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Helpers.php";
// add translations
@@ -49,7 +48,7 @@ if ($host && in_array($host,['keys.lime-technology.com','lime-technology.com']))
$key_file = basename($url);
exec("/usr/bin/wget -q -O ".escapeshellarg("/boot/config/$key_file")." ".escapeshellarg($url), $output, $return_var);
if ($return_var === 0) {
$var = @parse_ini_file('/var/local/emhttp/var.ini') ?: [];
$var = (array)@parse_ini_file('/var/local/emhttp/var.ini');
if (_var($var,'mdState')=="STARTED") {
response_complete(200, array('status' => _('Please Stop array to complete key installation')), _('success').', '._('Please Stop array to complete key installation'));
} else {
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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 +11,7 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: "/usr/local/emhttp";
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
$lang = $_POST['lang'] ?? '';
$file = '/boot/config/plugins/dynamix/dynamix.cfg';
@@ -287,6 +287,47 @@ done
]]>
</Script>
</Agent>
<Agent>
<Name>ntfy.sh</Name>
<Variables>
<Variable Help="The full server base URL including protocol and port. eg: https://ntfy.sh" Desc="Full Server Base URL" Default="FULL NTFY.SH URL">SERVER_URL</Variable>
<Variable Help="The ntfy.sh Token to use." Desc="ntfy.sh Token" Default="YOUR NTFY.SH TOKEN">NTFY_TOKEN</Variable>
<Variable Help="The ntfy.sh Topic to use." Desc="ntfy.sh Topic" Default="Unraid">TOPIC</Variable>
<Variable Help="Specify the fields which are included in the title of the notification." Desc="Notification Title" Default="$SUBJECT">TITLE</Variable>
<Variable Help="Specify the fields which are included in the message body of the notification." Desc="Notification Message" Default="$DESCRIPTION">MESSAGE</Variable>
</Variables>
<Script>
<![CDATA[
#!/bin/bash
############
{0}
############
MESSAGE=$(echo -e "$MESSAGE")
case "$IMPORTANCE" in
'normal' )
PRIORITY="default"
;;
'warning' )
PRIORITY="high"
;;
'alert' )
PRIORITY="urgent"
;;
esac
# Remove any trailing slash
SERVER_URL=${SERVER_URL%/}
curl \
-H "Priority: $PRIORITY" \
-H "Icon: https://raw.githubusercontent.com/unraid/webgui/master/emhttp/plugins/dynamix.vm.manager/templates/images/unraid.png" \
-H "Authorization: Bearer $NTFY_TOKEN" \
-H "Title: $TITLE" \
-d "$MESSAGE" \
$SERVER_URL/$TOPIC
]]>
</Script>
</Agent>
<Agent>
<Name>Prowl</Name>
<Variables>
@@ -11,12 +11,13 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Secure.php";
require_once "$docroot/webGui/include/Wrappers.php";
// add translations
$_SERVER['REQUEST_URI'] = 'tools';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Secure.php";
require_once "$docroot/webGui/include/Wrappers.php";
$dynamix = parse_plugin_cfg('dynamix',true);
$filter = unscript($_GET['filter']??false);
+3 -2
View File
@@ -12,8 +12,9 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$notify = "$docroot/webGui/scripts/notify";
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
$notify = "$docroot/webGui/scripts/notify";
switch ($_POST['cmd']??'') {
case 'init':
@@ -11,13 +11,13 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Secure.php";
require_once "$docroot/webGui/include/Wrappers.php";
// add translations
$_SERVER['REQUEST_URI'] = '';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Secure.php";
require_once "$docroot/webGui/include/Wrappers.php";
// Get the webGui configuration preferences
extract(parse_plugin_cfg('dynamix',true));
@@ -11,7 +11,7 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
switch ($_POST['cmd']??'') {
case 'clear':
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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-2021, Lime Technology
* Copyright 2015-2021, Bergware International
/* Copyright 2005-2023, Lime Technology
* Copyright 2015-2023, 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 +11,8 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
// add translations
$_SERVER['REQUEST_URI'] = '';
require_once "$docroot/webGui/include/Translations.php";
@@ -11,14 +11,13 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Secure.php";
require_once "$docroot/webGui/include/Wrappers.php";
switch (_var($_GET,'protocol')) {
case 'smb': $data = @parse_ini_file('state/sec.ini',true) ?: []; break;
case 'nfs': $data = @parse_ini_file('state/sec_nfs.ini',true) ?: []; break;
case 'smb': $data = (array)@parse_ini_file('state/sec.ini',true); break;
case 'nfs': $data = (array)@parse_ini_file('state/sec_nfs.ini',true); break;
}
$name = unscript(_var($_GET,'name'));
echo json_encode(_var($data,$name));
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2022, Lime Technology
* Copyright 2012-2022, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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,13 +11,14 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$certPath = "/boot/config/ssl/certs/certificate_bundle.pem";
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Wrappers.php";
// add translations
$_SERVER['REQUEST_URI'] = 'settings';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Wrappers.php";
$certPath = "/boot/config/ssl/certs/certificate_bundle.pem";
$cli = php_sapi_name()=='cli';
function response_complete($httpcode, $result, $cli_success_msg='') {
@@ -46,9 +47,8 @@ $certPresent = file_exists($certPath);
if ($certPresent) {
// renew existing cert
$certSubject = exec("/usr/bin/openssl x509 -subject -noout -in ".escapeshellarg($certPath));
$isLegacyCert = preg_match('/.*\.unraid\.net$/', $certSubject);
$isWildcardCert = preg_match('/.*\.myunraid\.net$/', $certSubject);
if ($isLegacyCert || $isWildcardCert) {
if ($isWildcardCert) {
exec("/usr/bin/openssl x509 -checkend 2592000 -noout -in ".escapeshellarg($certPath), $arrout, $retval_expired);
if ($retval_expired === 0) {
// not within 30 days of cert expire date
@@ -59,7 +59,6 @@ if ($certPresent) {
response_complete(406, '{"error":"'._('Cannot renew a custom cert at').' '.$certPath.'"}');
}
}
$endpoint = ($certPresent && $isLegacyCert) ? "provisioncert" : "provisionwildcard";
$keyfile = empty($var['regFILE']) ? false : @file_get_contents($var['regFILE']);
if ($keyfile === false) {
@@ -67,7 +66,7 @@ if ($keyfile === false) {
}
$keyfile = @base64_encode($keyfile);
$ch = curl_init("https://keys.lime-technology.com/account/ssl/$endpoint");
$ch = curl_init("https://keys.lime-technology.com/account/ssl/provisionwildcard");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
@@ -1,5 +1,5 @@
<?PHP
/* Copyright 2005-2020, Lime Technology
/* Copyright 2005-2023, 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,
@@ -10,14 +10,14 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Helpers.php";
extract(parse_plugin_cfg('dynamix',true));
// add translations
$_SERVER['REQUEST_URI'] = 'tools';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
extract(parse_plugin_cfg('dynamix',true));
$var = parse_ini_file('state/var.ini');
$keyfile = base64_encode(file_get_contents($var['regFILE']));
?>
+2 -3
View File
@@ -11,8 +11,7 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Secure.php";
require_once "$docroot/webGui/include/Wrappers.php";
@@ -42,7 +41,7 @@ case 'notice':
break;
case 'state':
$pools = explode(',',_var($_POST,'pools'));
$disks = @parse_ini_file('state/disks.ini',true) ?: [];
$disks = (array)@parse_ini_file('state/disks.ini',true);
$error = [];
foreach ($pools as $pool) if (stripos(_var($disks[$pool],'state'),'ERROR:')===0) $error[] = $pool.' - '.str_ireplace('ERROR:','',$disks[$pool]['state']);
echo implode('<br>',$error);
@@ -0,0 +1,29 @@
<?PHP
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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 ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
$scripts = ['update_2','update_3'];
$pidfile = '/var/run/nchan.pid';
$nchan = 'webGui/nchan';
if (!is_file($pidfile)) exit;
foreach ($scripts as $script) {
if (exec("grep -Pom1 '^$nchan/$script' $pidfile")) {
// restart selected script
exec("pkill -f $nchan/$script");
exec("$docroot/$nchan/$script &>/dev/null &");
}
}
?>
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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,
+4 -3
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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 +11,8 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
// add translations
$_SERVER['REQUEST_URI'] = '';
require_once "$docroot/webGui/include/Translations.php";
+2 -2
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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 -3
View File
@@ -11,12 +11,11 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Secure.php";
require_once "$docroot/webGui/include/Wrappers.php";
$shares = @parse_ini_file('state/shares.ini',true) ?: [];
$shares = (array)@parse_ini_file('state/shares.ini',true);
$name = unscript(_var($_GET,'name'));
echo json_encode(_var($shares,$name));
?>
+6 -6
View File
@@ -11,7 +11,12 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Helpers.php";
// add translations
$_SERVER['REQUEST_URI'] = 'shares';
require_once "$docroot/webGui/include/Translations.php";
if (isset($_POST['scan'])) {
die((new FilesystemIterator("/mnt/user/{$_POST['scan']}"))->valid() ? '0' : '1');
@@ -31,11 +36,6 @@ if (isset($_POST['cleanup'])) {
die((string)$n);
}
// add translations
$_SERVER['REQUEST_URI'] = 'shares';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
$compute = rawurldecode(_var($_POST,'compute'));
$path = rawurldecode(_var($_POST,'path'));
$all = _var($_POST,'all');
+3 -3
View File
@@ -11,7 +11,9 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Helpers.php";
require_once "$docroot/webGui/include/Preselect.php";
// add translations
$_SERVER['REQUEST_URI'] = 'main';
@@ -19,8 +21,6 @@ require_once "$docroot/webGui/include/Translations.php";
$disks = array_merge_recursive(@parse_ini_file('state/disks.ini',true)?:[], @parse_ini_file('state/devs.ini',true)?:[]);
require_once "$docroot/webGui/include/CustomMerge.php";
require_once "$docroot/webGui/include/Helpers.php";
require_once "$docroot/webGui/include/Preselect.php";
function normalize($text, $glue='_') {
$words = explode($glue,$text);
@@ -11,7 +11,7 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Secure.php";
function pgrep($proc) {
+23 -23
View File
@@ -11,26 +11,27 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Helpers.php";
// add translations
$_SERVER['REQUEST_URI'] = 'tools';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
function usb_physical_port($usbbusdev) {
if (preg_match('/^Bus (?P<bus>\S+) Device (?P<dev>\S+): ID (?P<id>\S+)(?P<name>.*)$/', $usbbusdev, $usbMatch)) {
//udevadm info -a --name=/dev/bus/usb/003/002 | grep KERNEL==
$udevcmd = "udevadm info -a --name=/dev/bus/usb/".$usbMatch['bus']."/".$usbMatch['dev']." | grep KERNEL==" ;
$physical_busid = _("None") ;
//udevadm info -a --name=/dev/bus/usb/003/002 | grep KERNEL==
$udevcmd = "udevadm info -a --name=/dev/bus/usb/".$usbMatch['bus']."/".$usbMatch['dev']." | grep KERNEL==";
$physical_busid = _("None");
exec($udevcmd , $udev);
if (isset($udev)) {
$physical_busid = trim(substr($udev[0], 13) , '"') ;
$physical_busid = trim(substr($udev[0], 13) , '"');
if (substr($physical_busid,0,3) =='usb') {
$physical_busid = substr($physical_busid,3).'-0' ;
$physical_busid = substr($physical_busid,3).'-0';
}
}
}
return($physical_busid) ;
return($physical_busid);
}
switch ($_POST['table']) {
@@ -40,7 +41,7 @@ case 't1':
exec('lspci -n|awk \'{print "["$3"]"}\'',$iommu);
exec('lspci',$lspci);
$i = 0;
foreach ($lspci as $line) echo "<tr><td>".$iommu[$i++]."</td><td>$line</td></tr>";
foreach ($lspci as $line) echo "<tr><td>",$iommu[$i++],"</td><td>$line</td></tr>";
$noiommu = true;
} else {
$BDF_VD_REGEX = '/^[[:xdigit:]]{2}:[[:xdigit:]]{2}\.[[:xdigit:]](\|[[:xdigit:]]{4}:[[:xdigit:]]{4})?$/';
@@ -103,7 +104,6 @@ case 't1':
}
}
$lines = array_values(array_unique($lines, SORT_STRING));
$iommuinuse = array ();
foreach ($lines as $pciinuse){
$string = exec("ls /sys/kernel/iommu_groups/*/devices/$pciinuse -1 -d");
@@ -126,35 +126,35 @@ case 't1':
// By default lspci does not output the <Domain> when the only domain in the system is 0000. Add it back.
$pciaddress = "0000:".$pciaddress;
}
echo ($append)?"":"<tr><td></td><td>";
echo ($append) ? "" : "<tr><td></td><td>";
exec("lspci -v -s $pciaddress", $outputvfio);
if (preg_grep("/vfio-pci/i", $outputvfio)) {
echo "<i class=\"fa fa-circle orb green-orb middle\" title=\""._('Kernel driver in use: vfio-pci')."\"></i>";
echo "<i class=\"fa fa-circle orb green-orb middle\" title=\"",_('Kernel driver in use: vfio-pci'),"\"></i>";
$isbound = "true";
}
echo "</td><td>";
if ((strpos($line, 'Host bridge') === false) && (strpos($line, 'PCI bridge') === false)) {
if (file_exists('/sys/kernel/iommu_groups/'.$iommu.'/devices/'.$pciaddress.'/reset')) echo "<i class=\"fa fa-retweet grey-orb middle\" title=\""._('Function Level Reset (FLR) supported').".\"></i>";
if (file_exists('/sys/kernel/iommu_groups/'.$iommu.'/devices/'.$pciaddress.'/reset')) echo "<i class=\"fa fa-retweet grey-orb middle\" title=\"",_('Function Level Reset (FLR) supported'),".\"></i>";
echo "</td><td>";
echo in_array($iommu, $iommuinuse) ? ' <input type="checkbox" value="" title="'._('In use by Unraid').'" disabled ' : ' <input type="checkbox" class="iommu'.$iommu.'" value="'.$pciaddress."|".$vd.'" ';
echo in_array($iommu, $iommuinuse) ? '<input type="checkbox" value="" title="'._('In use by Unraid').'" disabled ' : '<input type="checkbox" class="iommu'.$iommu.'" value="'.$pciaddress."|".$vd.'" ';
// check config file for two formats: <Domain:Bus:Device.Function>|<Vendor:Device> or just <Domain:Bus:Device.Function>
echo (in_array($pciaddress."|".$vd, $vfio_cfg_devices) || in_array($pciaddress, $vfio_cfg_devices)) ? " checked>" : ">";
} else { echo "</td><td>"; }
echo '</td><td title="';
foreach ($outputvfio as $line2) echo htmlentities($line2,ENT_QUOTES)."&#10;";
echo '">'.$line.'</td></tr>';
echo '">',$line,'</td></tr>';
unset($outputvfio);
switch (true) {
case (strpos($line, 'USB controller') !== false):
if (isset($isbound)) {
echo '<tr><td></td><td></td><td></td><td></td><td style="padding-left: 50px;">'._('This controller is bound to vfio, connected USB devices are not visible').'.</td></tr>';
echo '<tr><td></td><td></td><td></td><td></td><td>',_('This controller is bound to vfio, connected USB devices are not visible'),'.</td></tr>';
} else {
exec('for usb_ctrl in $(find /sys/bus/usb/devices/usb* -maxdepth 0 -type l);do path="$(realpath "${usb_ctrl}")";if [[ $path == *'.$pciaddress.'* ]];then bus="$(cat "${usb_ctrl}/busnum")";lsusb -s $bus:|sort;fi;done',$getusb);
foreach($getusb as $usbdevice) {
[$bus,$id] = my_explode(':',$usbdevice);
$usbport = usb_physical_port($usbdevice) ;
$usbport = usb_physical_port($usbdevice);
if (strlen($usbport) > 7 ) {$usbport .= "\t"; } else { $usbport .= "\t\t"; }
echo "<tr><td></td><td></td><td></td><td></td><td style=\"padding-left: 50px;\">$bus Port $usbport".trim($id)."</td></tr>";
echo "<tr><td></td><td></td><td></td><td></td><td>$bus Port $usbport",trim($id),"</td></tr>";
}
unset($getusb);
}
@@ -167,14 +167,14 @@ case 't1':
case (strpos($line, 'Mass storage controller') !== false):
case (strpos($line, 'Non-Volatile memory controller') !== false):
if (isset($isbound)) {
echo '<tr><td></td><td></td><td></td><td></td><td style="padding-left: 50px;">'._('This controller is bound to vfio, connected drives are not visible').'.</td></tr>';
echo '<tr><td></td><td></td><td></td><td></td><td>',_('This controller is bound to vfio, connected drives are not visible'),'.</td></tr>';
} else {
exec('ls -al /sys/block/sd* /sys/block/hd* /sys/block/sr* /sys/block/nvme* 2>/dev/null | grep -i "'.$pciaddress.'"',$getsata);
foreach($getsata as $satadevice) {
$satadevice = substr($satadevice, strrpos($satadevice, '/', -1)+1);
$search = preg_grep('/'.$satadevice.'.*/', $lsscsi);
foreach ($search as $deviceline) {
echo '<tr><td></td><td></td><td></td><td></td><td style="padding-left: 50px;">'.$deviceline.'</td></tr>';
echo '<tr><td></td><td></td><td></td><td></td><td>',$deviceline,'</td></tr>';
}
}
unset($search);
@@ -218,15 +218,15 @@ case 't3':
exec('lsusb|sort',$lsusb);
foreach ($lsusb as $line) {
[$bus,$id] = my_explode(':',$line);
$usbport = usb_physical_port($line) ;
echo "<tr><td>$bus Port $usbport</td><td> ".trim($id)."</td></tr>";
$usbport = usb_physical_port($line);
echo "<tr><td>$bus Port $usbport</td><td>".trim($id)."</td></tr>";
}
break;
case 't4':
exec('lsscsi -s',$lsscsi);
foreach ($lsscsi as $line) {
if (strpos($line,'/dev/')===false) continue;
echo "<tr><td>".preg_replace('/\] +/',']</td><td>',$line)."</td></tr>";
echo "<tr><td>",preg_replace('/\] +/',']</td><td>',$line),"</td></tr>";
}
break;
}
+95 -96
View File
@@ -11,110 +11,109 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Helpers.php";
require_once "$docroot/webGui/include/SysDriversHelpers.php";
require_once "$docroot/plugins/dynamix.plugin.manager/include/PluginHelpers.php";
// add translations
$_SERVER['REQUEST_URI'] = 'tools';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
require_once "$docroot/webGui/include/SysDriversHelpers.php";
require_once "$docroot/plugins/dynamix.plugin.manager/include/PluginHelpers.php";
$kernel = shell_exec("uname -r") ;
$kernel = trim($kernel,"\n") ;
$lsmod = shell_exec("lsmod") ;
$kernel = shell_exec("uname -r");
$kernel = trim($kernel,"\n");
$lsmod = shell_exec("lsmod");
$supportpage = true;
$modtoplgfile = "/tmp/modulestoplg.json" ;
$sysdrvfile = "/tmp/sysdrivers.json" ;
$sysdrvinit = "/tmp/sysdrivers.init" ;
if (!is_file($modtoplgfile) || !is_file($sysdrvfile)) { modtoplg() ; createlist() ;}
$arrModtoPlg = json_decode(file_get_contents("/tmp/modulestoplg.json") ,TRUE) ;
$modtoplgfile = "/tmp/modulestoplg.json";
$sysdrvfile = "/tmp/sysdrivers.json";
$sysdrvinit = "/tmp/sysdrivers.init";
if (!is_file($modtoplgfile) || !is_file($sysdrvfile)) { modtoplg(); createlist();}
$arrModtoPlg = json_decode(file_get_contents("/tmp/modulestoplg.json") ,TRUE);
switch ($_POST['table']) {
case 't1create':
if (is_file("/tmp/sysdrvbuild.running")) break ;
touch("/tmp/sysdrvbuild.running") ;
modtoplg() ;
createlist() ;
unlink("/tmp/sysdrvbuild.running") ;
break;
case 't1create':
if (is_file("/tmp/sysdrvbuild.running")) break;
touch("/tmp/sysdrvbuild.running");
modtoplg();
createlist();
unlink("/tmp/sysdrvbuild.running");
break;
case 't1load':
$list = file_get_contents($sysdrvfile) ;
$arrModules = json_decode($list,TRUE) ;
$init = false;
if (is_file($sysdrvinit)) $init = file_get_contents($sysdrvinit);
$html = "<thead><tr><th><b>"._("Driver")."</th><th><b>"._("Description")."</th><th data-value='System|Inuse|Custom|Disabled|\"Kernel - Inuse\"'><b>"._("State")."</th><th><b>"._("Type")."</th><th><b>"._("Modprobe.d config file")."</th></tr></thead>";
$html .= "<tbody>" ;
if (is_array($arrModules)) ksort($arrModules) ;
foreach($arrModules as $modname => $module) {
if ($modname == "") continue ;
case 't1load':
$list = file_get_contents($sysdrvfile);
$arrModules = json_decode($list,TRUE);
$init = false;
if (is_file($sysdrvinit)) $init = file_get_contents($sysdrvinit);
$html = "<thead><tr><th>"._('Driver')."</th><th>"._('Description')."</th><th data-value='System|Inuse|Custom|Disabled|\"Kernel - Inuse\"'>"._('State')."</th><th>"._('Type')."</th><th>"._('Modprobe.d config file')."</th></tr></thead>";
$html .= "<tbody>";
ksort($arrModules);
foreach($arrModules as $modname => $module) {
if ($modname == "") continue;
if (is_file("/boot/config/modprobe.d/$modname.conf")) {
$modprobe = file_get_contents("/boot/config/modprobe.d/$modname.conf");
$state = strpos($modprobe, "blacklist");
$modprobe = explode(PHP_EOL,$modprobe);
if($state !== false) {$state = "Disabled";} else $state="Custom";
$module['state'] = $state;
$module['modprobe'] = $modprobe;
} else {
if (is_file("/etc/modprobe.d/$modname.conf")) {
$modprobe = file_get_contents("/etc/modprobe.d/$modname.conf");
$state = strpos($modprobe, "blacklist");
$modprobe = explode(PHP_EOL,$modprobe);
if($state !== false) {$state = "Disabled";} else $state="System";
$module['state'] = $state;
$module['modprobe'] = $modprobe;
}
}
$html .= "<tr id='row$modname'>";
if ($supportpage) {
if ($module['support'] == false) {
$supporthtml = "";
} else {
$supporturl = $module['supporturl'];
$pluginname = $module['plugin'];
$supporthtml = "<span id='link$modname'><a href='$supporturl' target='_blank'><i title='"._("Support page $pluginname")."' class='fa fa-phone-square'></i></a></span>";
}
}
if (!empty($module["version"])) $version = " (".$module["version"].")"; else $version = "";
$html .= "<td>$modname$version$supporthtml</td>";
$html .= "<td>{$module['description']}</td><td id=\"status$modname\">{$module['state']}</td><td>{$module['type']}</td>";
$text = "";
if (is_array($module["modprobe"]) && count($module["modprobe"])) {
$text = implode("\n",$module["modprobe"]);
$hidden = ($module['state'] == "System") ? "hidden" : "";
$html .= "<td><span class='pin'>";
$html .= "<a class='info' href=\"#\"><i title='"._("Edit Modprobe config")."' onclick=\"textedit('".$modname."');return false;\" id=\"icon'.$modname.'\" class='fa fa-edit pin'></i></a>";
$html .= "<a class='info' href=\"#\" id=\"bin$modname\" $hidden><i title='"._("Delete Modprobe config")."' onclick=\"removecfg('".$modname."',true);return false;\" class='fa fa-trash pin'></i></a>";
$html .= "<span id=\"save$modname\" hidden onclick=\"textsave('".$modname."');return false;\"><a class='info' href=\"#\"><i title='"._("Save Modprobe config")."' class='fa fa-save pin'></i></a></span></span>";
$html .= "<textarea id=\"text".$modname."\" rows=2 disabled>$text</textarea></td></tr>";
} else {
$html .= "<td><span class='pin'>";
$html .= "<a class='info' href=\"#\"><i title='"._("Edit Modprobe config")."' onclick=\"textedit('".$modname."');return false;\" id=\"icon'.$modname.'\" class='fa fa-edit pin'></i></a>";
$html .= "<a class='info' href=\"#\" id=\"bin$modname\" hidden><i title='"._("Delete Modprobe config")."' onclick=\"removecfg('".$modname."',true);return false;\" class='fa fa-trash pin'></i></a>";
$html .= "<span id=\"save$modname\" hidden onclick=\"textsave('".$modname."');return false;\"><a class='info' href=\"#\"><i title='"._("Save Modprobe config")."' class='fa fa-save pin'></i></a></span></span>";
$html .= "<textarea id=\"text".$modname."\" rows=2 hidden disabled >$text</textarea></td></tr>";
}
}
$html .= "</tbody>";
$rtn = array();
$rtn['html'] = $html;
if ($init !== false) {$init = true; unlink($sysdrvinit);}
$rtn['init'] = $init;
echo json_encode($rtn);
break;
if (is_file("/boot/config/modprobe.d/$modname.conf")) {
$modprobe = file_get_contents("/boot/config/modprobe.d/$modname.conf") ;
$state = strpos($modprobe, "blacklist");
$modprobe = explode(PHP_EOL,$modprobe) ;
if($state !== false) {$state = "Disabled" ;} else $state="Custom" ;
$module['state'] = $state ;
$module['modprobe'] = $modprobe ;
} else {
if (is_file("/etc/modprobe.d/$modname.conf")) {
$modprobe = file_get_contents("/etc/modprobe.d/$modname.conf") ;
$state = strpos($modprobe, "blacklist");
$modprobe = explode(PHP_EOL,$modprobe) ;
if($state !== false) {$state = "Disabled" ;} else $state="System" ;
$module['state'] = $state ;
$module['modprobe'] = $modprobe ;
}
}
$html .= "<tr id='row$modname'>" ;
if ($supportpage) {
if ($module['support'] == false) {
$supporthtml = "" ;
} else {
$supporturl = $module['supporturl'] ;
$pluginname = $module['plugin'] ;
$supporthtml = "<span id='link$modname'><a href='$supporturl' target='_blank'><i title='"._("Support page $pluginname")."' class='fa fa-phone-square'></i></a></span>" ;
}
}
$html .= "<td>$modname$supporthtml</td>" ;
$html .= "<td>{$module['description']}</td><td id=\"status$modname\">{$module['state']}</td><td>{$module['type']}</td>";
$text = "" ;
if (is_array($module["modprobe"])) {
$text = implode("\n",$module["modprobe"]) ;
$html .= "<td><span><a class='info' href=\"#\"><i title='"._("Edit Modprobe config")."' onclick=\"textedit('".$modname."');return false;\" id=\"icon'.$modname.'\" class='fa fa-edit'></i></a>" ;
$hidden = "" ;
if ($module['state'] == "System") $hidden = "hidden" ;
$html .= " <a class='info' href=\"#\" id=\"bin$modname\" $hidden><i title='"._("Delete Modprobe config")."' onclick=\"removecfg('".$modname."',true);return false;\" class='fa fa-trash'></i></a><span>" ;
$html .= "<span><textarea id=\"text".$modname."\" rows=3 disabled>$text</textarea><span id=\"save$modname\" hidden onclick=\"textsave('".$modname."');return false;\" ><a class='info' href=\"#\"><i title='"._("Save Modprobe config")."' class='fa fa-save' ></i></a></span></td></tr>";
} else {
$html .= "<td><span><a class='info' href=\"#\"><i title='"._("Edit Modprobe config")."' onclick=\"textedit('".$modname."');return false;\" id=\"icon'.$modname.'\" class='fa fa-edit'></i></a>" ;
$html .= " <a class='info' href=\"#\" id=\"bin$modname\" hidden><i title='"._("Delete Modprobe config")."' onclick=\"removecfg('".$modname."',true);return false;\" class='fa fa-trash'></i></a><span>" ;
$html .= "<textarea id=\"text".$modname."\" rows=1 hidden disabled >$text</textarea><span id=\"save$modname\" hidden onclick=\"textsave('".$modname."');return false;\" ><a class='info' href=\"#\"><i title='"._("Save Modprobe config")."' class='fa fa-save' ></i></a></span></td></tr>";
}
}
$html .= "</tbody>" ;
$rtn = array() ;
$rtn['html'] = $html ;
if ($init !== false) {$init = true ; unlink($sysdrvinit) ;}
$rtn['init'] = $init ;
echo json_encode($rtn) ;
break;
case "update":
$conf = $_POST['conf'] ;
$module = $_POST['module'] ;
if ($conf == "") $error = unlink("/boot/config/modprobe.d/$module.conf") ; else $error = file_put_contents("/boot/config/modprobe.d/$module.conf",$conf) ;
getmodules($module) ;
$return = $arrModules[$module] ;
$return['supportpage'] = $supportpage ;
if (is_array($return["modprobe"]))$return["modprobe"] = implode("\n",$return["modprobe"]) ;
if ($error !== false) $return["error"] = false ; else $return["error"] = true ;
echo json_encode($return) ;
break ;
}
$conf = $_POST['conf'];
$module = $_POST['module'];
if ($conf == "") $error = unlink("/boot/config/modprobe.d/$module.conf"); else $error = file_put_contents("/boot/config/modprobe.d/$module.conf",$conf);
getmodules($module);
$return = $arrModules[$module];
$return['supportpage'] = $supportpage;
if (is_array($return["modprobe"]))$return["modprobe"] = implode("\n",$return["modprobe"]);
if ($error !== false) $return["error"] = false; else $return["error"] = true;
echo json_encode($return);
break;
}
?>
@@ -12,167 +12,149 @@
function getplugin($in) {
$plugins = "/var/log/plugins/";
$plugin_link = $plugins.$in ;
$plugin_file = @readlink($plugin_link);
$support = plugin('support',$plugin_file) ?: "";
return($support) ;
$plugins = "/var/log/plugins/";
$plugin_link = $plugins.$in;
$plugin_file = @readlink($plugin_link);
return plugin('support',$plugin_file) ?: '';
}
function getmodules($line) {
global $arrModules,$lsmod,$kernel,$arrModtoPlg,$modplugins ;
$modprobe = "" ;
$desc = $file = $pluginfile = $option = $filename = $depends = $support = $supporturl = $dir = $state = null ;
$name = $line ;
$modname = shell_exec("modinfo $name > /dev/null") ;
if ($modname != null) $modname = trim($modname,"\n") ;
$output=null ;
exec("modinfo $name",$output,$error) ;
$parms = array() ;
foreach($output as $outline) {
$data = explode(":",$outline) ;
$support = false ; $supporturl = null ;
switch ($data[0])
{
case "name":
$modname = trim($data[1]) ;
break ;
case "depends":
$depends = trim($data[1]) ;
break ;
case "filename":
$filename = trim($data[1]) ;
break ;
case "description":
$desc = trim($data[1]) ;
break ;
case "parm":
$parms[] = trim(str_replace("parm:","",$outline)) ;
break ;
case "file":
$file = trim(str_replace("file:","",$outline)) ;
break ;
case "alias":
case "author":
case "firmware":
case "intree":
case "vermagic":
case "retpoline":
case "import_ns":
case "license":
break ;
default:
$parms[] = trim($outline) ;
break ;
function getmodules($name) {
global $arrModules,$lsmod,$kernel,$arrModtoPlg,$modplugins;
// preset variables
$modname = $depends = $filename = $desc = $file = $version = $state = $dir = $support = $supporturl = $pluginfile = null;
$modprobe = $parms = [];
exec("modinfo $name",$output,$error);
foreach($output as $outline) {
if (!$outline) continue;
[$key,$data] = array_pad(explode(':',$outline,2),2,'');
$data = trim($data);
switch ($key) {
case "name":
$modname = $data;
break;
case "depends":
$depends = $data;
break;
case "filename":
$filename = $data;
break;
case "description":
$desc = $data;
break;
case "parm":
$parms[] = $data;
break;
case "file":
$file = $data;
break;
case "version":
$version = $data;
break;
case "alias":
case "author":
case "firmware":
case "intree":
case "vermagic":
case "retpoline":
case "import_ns":
case "license":
// ignore
break;
default:
$parms[] = trim($outline);
break;
}
}
if ($modname != null) {
if (strpos($lsmod, $modname,0)) $state = "Inuse" ; else $state = "Available";
if (isset($arrModtoPlg[$modname])) { $support = true ; $supporturl = plugin("support", $modplugins[$arrModtoPlg[$modname]]) ; $pluginfile = "Plugin name: {$arrModtoPlg[$modname]}" ; } else { $support = false ; $supporturl = null ; }
}
if ($modname) {
$state = strpos($lsmod,$modname)!==false ? "Inuse" : "Available";
if (isset($arrModtoPlg[$modname])) {
$support = true;
$supporturl = plugin("support", $modplugins[$arrModtoPlg[$modname]]);
$pluginfile = "Plugin name: {$arrModtoPlg[$modname]}" ;
}
if (is_file("/boot/config/modprobe.d/$modname.conf")) {
$modprobe = file_get_contents("/boot/config/modprobe.d/$modname.conf") ;
$state = strpos($modprobe, "blacklist");
$modprobe = explode(PHP_EOL,$modprobe) ;
if($state !== false) {$state = "Disabled" ;}
else $state="Custom" ;
} else {
if (is_file("/etc/modprobe.d/$modname.conf")) {
$modprobe = file_get_contents("/etc/modprobe.d/$modname.conf") ;
$state = strpos($modprobe, "blacklist");
$modprobe = explode(PHP_EOL,$modprobe) ;
if($state !== false) {$state = "Disabled" ;} else $state="System" ;
$module['state'] = $state ;
$module['modprobe'] = $modprobe ;
}
}
if ($filename != "(builtin)") {
if ($filename != null) {
$type = pathinfo($filename) ;
$dir = $type['dirname'] ;
$dir = str_replace("/lib/modules/$kernel/kernel/drivers/", "" ,$dir) ;
$dir = str_replace("/lib/modules/$kernel/kernel/", "" ,$dir) ;
}
} else {
$dir = $file ;
$dir = str_replace("drivers/", "" ,$dir) ;
if ($state == "Inuse") $state= "Kernel - Inuse"; else $state="Kernel" ;
}
if ($desc != null) $description = substr($desc , 0 ,60) ; else $description = null ;
$arrModules[$modname] = [
'modname' => $modname,
'dependacy' => $depends,
'parms' => $parms,
'file' => $file,
'modprobe' => $modprobe,
'plugin' => $pluginfile ,
'state' => $state,
'type' => $dir,
'support' => $support,
'supporturl' => $supporturl,
'description' => $description ,
] ;
}
if (is_file("/boot/config/modprobe.d/$modname.conf")) {
$modprobe = file_get_contents("/boot/config/modprobe.d/$modname.conf");
$state = strpos($modprobe,"blacklist")!==false ? "Disabled" : "Custom";
$modprobe = explode(PHP_EOL,$modprobe);
} elseif (is_file("/etc/modprobe.d/$modname.conf")) {
$modprobe = file_get_contents("/etc/modprobe.d/$modname.conf");
$state = strpos($modprobe, "blacklist")!==false ? "Disabled" : "System";
$modprobe = explode(PHP_EOL,$modprobe);
$module['state'] = $state;
$module['modprobe'] = $modprobe;
}
if ($filename != "(builtin)") {
if ($filename) {
$type = pathinfo($filename);
$dir = str_replace("/lib/modules/$kernel/kernel/drivers/", "", $type['dirname']);
$dir = str_replace("/lib/modules/$kernel/kernel/", "", $dir);
}
} else {
$dir = str_replace("drivers/", "", $file);
$state = ($state=="Inuse") ? "Kernel - Inuse" : "Kernel";
}
$arrModules[$modname] = [
'modname' => $modname,
'dependacy' => $depends,
'version' => $version,
'parms' => $parms,
'file' => $file,
'modprobe' => $modprobe,
'plugin' => $pluginfile,
'state' => $state,
'type' => $dir,
'support' => $support,
'supporturl' => $supporturl,
'description' => $desc
];
}
function modtoplg() {
global $modtoplgfile,$kernel ;
$files = array();
$kernelsplit = explode('-',$kernel) ;
$kernelvers = trim($kernelsplit[0],"\n") ;
$list = array() ;
$files = glob('/boot/config/plugins/*/packages/' . $kernelvers . '/*.{txz,tgz}', GLOB_BRACE);
foreach ($files as $f) {
$plugin = str_replace("/boot/config/plugins/", "", $f) ;
$plugin = substr($plugin,0,strpos($plugin,'/') ) ;
$tar = [] ;
exec("tar -tf $f | grep -E '.ko.xz|.ko' ",$tar) ;
foreach ($tar as $t) {
$p = pathinfo($t) ;
$filename = str_replace(".ko","",$p["filename"]) ;
$list[$filename] = $plugin ;
}
}
file_put_contents($modtoplgfile,json_encode($list,JSON_PRETTY_PRINT)) ;
global $modtoplgfile,$kernel;
$files = $list = [];
$kernelsplit = explode('-',$kernel);
$kernelvers = trim($kernelsplit[0],"\n");
$files = glob('/boot/config/plugins/*/packages/'.$kernelvers.'/*.{txz,tgz}', GLOB_BRACE);
foreach ($files as $f) {
$plugin = str_replace("/boot/config/plugins/", "", $f);
$plugin = substr($plugin,0,strpos($plugin,'/') );
$tar = [];
exec("tar -tf $f | grep -E '.ko.xz|.ko' ",$tar);
foreach ($tar as $t) {
$p = pathinfo($t);
$filename = str_replace(".ko","",$p["filename"]);
$list[$filename] = $plugin;
}
}
file_put_contents($modtoplgfile,json_encode($list,JSON_PRETTY_PRINT));
}
function createlist() {
global $modtoplgfile, $sysdrvfile, $lsmod, $kernel,$arrModules, $modplugins,$arrModtoPlg ;
$arrModtoPlg = json_decode(file_get_contents($modtoplgfile) ,TRUE) ;
$builtinmodules = file_get_contents("/lib/modules/$kernel/modules.builtin") ;
$builtinmodules = explode(PHP_EOL,$builtinmodules) ;
$procmodules =file_get_contents("/lib/modules/$kernel/modules.order") ;
$procmodules = explode(PHP_EOL,$procmodules) ;
$arrModules = array() ;
$list = scandir('/var/log/plugins/') ;
foreach($list as $f) $modplugins[plugin("name" , @readlink("/var/log/plugins/$f"))] = @readlink("/var/log/plugins/$f") ;
foreach($builtinmodules as $bultin)
{
if ($bultin == "") continue ;
getmodules(pathinfo($bultin)["filename"]) ;
}
foreach($procmodules as $line) {
if ($line == "") continue ;
getmodules(pathinfo($line)["filename"]) ;
}
$lsmod2 = explode(PHP_EOL,$lsmod) ;
foreach($lsmod2 as $line) {
if ($line == "") continue ;
$line2 = explode(" ",$line) ;
getmodules($line2['0']) ;
}
unset($arrModules['null']);
file_put_contents($sysdrvfile,json_encode($arrModules,JSON_PRETTY_PRINT)) ;
global $modtoplgfile, $sysdrvfile, $lsmod, $kernel,$arrModules, $modplugins,$arrModtoPlg;
$arrModtoPlg = json_decode(file_get_contents($modtoplgfile) ,TRUE);
$builtinmodules = file_get_contents("/lib/modules/$kernel/modules.builtin");
$builtinmodules = explode(PHP_EOL,$builtinmodules);
$procmodules =file_get_contents("/lib/modules/$kernel/modules.order");
$procmodules = explode(PHP_EOL,$procmodules);
$arrModules = [];
$list = scandir('/var/log/plugins/');
foreach($list as $f) $modplugins[plugin("name" , @readlink("/var/log/plugins/$f"))] = @readlink("/var/log/plugins/$f");
foreach($builtinmodules as $bultin) {
if (!$bultin) continue;
getmodules(pathinfo($bultin)["filename"]);
}
foreach($procmodules as $line) {
if (!$line) continue;
getmodules(pathinfo($line)["filename"]);
}
$lsmod2 = explode(PHP_EOL,$lsmod);
foreach($lsmod2 as $line) {
if (!$line) continue;
$line2 = explode(" ",$line);
getmodules($line2['0']);
}
unset($arrModules['null']);
file_put_contents($sysdrvfile,json_encode($arrModules,JSON_PRETTY_PRINT));
}
?>
?>
@@ -1,5 +1,5 @@
#!/usr/bin/php
<?php
<?PHP
function SysDriverslog($m, $type = "NOTICE") {
if ($type == "DEBUG") return NULL;
$m = print_r($m,true);
@@ -8,23 +8,25 @@ function SysDriverslog($m, $type = "NOTICE") {
exec("logger -t webGUI -- \"$m\"");
}
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// add translations
require_once "$docroot/webGui/include/Translations.php";
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Helpers.php";
require_once "$docroot/webGui/include/SysDriversHelpers.php";
require_once "$docroot/plugins/dynamix.plugin.manager/include/PluginHelpers.php";
$kernel = shell_exec("uname -r") ;
$kernel = trim($kernel,"\n") ;
$lsmod = shell_exec("lsmod") ;
// add translations
require_once "$docroot/webGui/include/Translations.php";
$kernel = shell_exec("uname -r");
$kernel = trim($kernel,"\n");
$lsmod = shell_exec("lsmod");
$supportpage = true;
$modtoplgfile = "/tmp/modulestoplg.json" ;
$sysdrvfile = "/tmp/sysdrivers.json" ;
$arrModtoPlg = json_decode(file_get_contents("/tmp/modulestoplg.json") ,TRUE) ;
file_put_contents("/tmp/sysdrivers.init","1") ;
SysDriverslog("SysDrivers Build Starting") ;
modtoplg() ;
createlist() ;
SysDriverslog("SysDrivers Build Complete") ;
?>
$modtoplgfile = "/tmp/modulestoplg.json";
$sysdrvfile = "/tmp/sysdrivers.json";
$arrModtoPlg = json_decode(file_get_contents("/tmp/modulestoplg.json") ,TRUE);
file_put_contents("/tmp/sysdrivers.init","1");
SysDriverslog("SysDrivers Build Starting");
modtoplg();
createlist();
SysDriverslog("SysDrivers Build Complete");
?>
+3 -3
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2022, Lime Technology
* Copyright 2012-2022, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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 +11,7 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/ColorCoding.php";
array_multisort(array_map('filemtime',($logs = glob($_POST['log'].'*',GLOB_NOSORT))),SORT_ASC,$logs);
+5 -47
View File
@@ -10,51 +10,9 @@
* all copies or substantial portions of the Software.
*/
?>
<?
$dfm['hover'] = in_array($theme,['white','azure']) ? 'rgba(0,0,0,0.1)' : 'rgba(255,255,255,0.1)';
$dfm['bgcolor'] = in_array($theme,['white','azure']) ? '#f2f2f2' : '#1c1c1c';
$dfm['fgcolor'] = in_array($theme,['white','azure']) ? '#1c1c1c' : '#f2f2f2';
$dfm['incolor'] = $theme!='gray' ? $dfm['bgcolor'] : '#121510';
?>
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/jquery.ui.css")?>">
<link type="text/css" rel="stylesheet" href="<?autov("/plugins/dynamix.docker.manager/styles/style-$theme.css")?>">
<style>
#countdown{float:left;margin-left:100px}
#user-notice{float:left}
div.dfm_info{position:absolute;bottom:4px;width:74%;margin-left:23%}
div.dfm_template{display:none}
div#dfm_dialogWindow{overflow-x:hidden}
div#dfm_dialogWindow dt{width:23%}
div#dfm_joblist{text-align:left;margin-top:20px;margin-left:56px}
span.dfm_filter{position:relative;margin-left:<?=$themes1?'12':'0'?>px;top:-<?=$themes1?'2':'8'?>px}
span.dfm_filter i{position:absolute;left:10px;top:<?=$themes1?'4':'8'?>px;font-size:1.4rem}
span.dfm_loc{display:inline-block}
span.dfm_text{display:inline-block;width:75%;white-space:normal}
span.dfm_device{display:inline-block;float:left}
span.dfm_percent{display:inline-block;width:40px}
span.dfm_speed{display:inline-block;margin-left:10px;width:140px}
input.dfm_filter{border:none;width:100px;background-color:<?=$dfm['incolor']?>;margin:-8px 0 0 0;padding-left:30px}
input.dfm_filter:focus{background-color:<?=$dfm['incolor']?>}
input#dfm_sparse,input#dfm_exist{margin-left:0}
input#dfm_target{color:<?=$dfm['fgcolor']?>;width:500px}
input#dfm_target+.fileTree{background:<?=$dfm['bgcolor']?>;width:500px;max-height:320px;overflow-y:scroll;overflow-x:hidden;position:absolute;z-index:100;display:none}
select.dfm{margin:0 40px 0 10px}
select#dfm_source{min-width:none;max-width:none;border:none;background-image:none;width:660px;cursor:default}
select#dfm_source option{background-color:transparent}
i.dfm{margin-right:8px}
i.dfm_filter{margin-top:-<?=$themes1?'2':'4'?>px}
i.job{cursor:pointer;font-size:1.8rem;vertical-align:middle}
.ui-dfm .ui-dialog-titlebar-close{background:transparent;border:none;font-size:1.8rem!important;margin-top:-14px!important;margin-right:-18px!important}
.ui-dfm .ui-dialog-titlebar-close:hover{background:transparent;color:#ff8c2f}
.ui-dfm .ui-dialog-title{text-align:center;width:100%;font-size:1.8rem}
.ui-dfm .ui-dialog-content{padding-top:15px;vertical-align:bottom}
.ui-dfm .ui-button-text{padding:0px 5px}
.ui-dfm .ui-dialog-buttonpane .ui-dialog-buttonset button[disabled],
.ui-dfm .ui-dialog-buttonpane .ui-dialog-buttonset button[disabled]:hover
{cursor:default;color:#808080;background:-webkit-gradient(linear,left top,right top,from(#404040),to(#808080)) 0 0 no-repeat,-webkit-gradient(linear,left top,right top,from(#404040),to(#808080)) 0 100% no-repeat,-webkit-gradient(linear,left bottom,left top,from(#404040),to(#404040)) 0 100% no-repeat,-webkit-gradient(linear,left bottom,left top,from(#808080),to(#808080)) 100% 100% no-repeat;background:linear-gradient(90deg,#404040 0,#808080) 0 0 no-repeat,linear-gradient(90deg,#404040 0,#808080) 0 100% no-repeat,linear-gradient(0deg,#404040 0,#404040) 0 100% no-repeat,linear-gradient(0deg,#808080 0,#808080) 100% 100% no-repeat;background-size:100% 2px,100% 2px,2px 100%,2px 100%}
</style>
<div class="dfm_template">
<div id="dfm_dialogWindow"></div>
<input type="file" id="dfm_upload" value="" onchange="startUpload(this.files)" multiple>
@@ -316,8 +274,8 @@ _(Search pattern)_:
<!--!
<style>div#dfm_editor{position:absolute;top:0;bottom:0;left:0;right:0}</style>
<div id="dfm_editor"></div>
<script src="<?autov('/plugins/dynamix.file.manager/javascript/ace/ace.js')?>"></script>
<script src="<?autov('/plugins/dynamix.file.manager/javascript/ace/ext-modelist.js')?>"></script>
<script src="<?autov('/webGui/javascript/ace/ace.js')?>"></script>
<script src="<?autov('/webGui/javascript/ace/ext-modelist.js')?>"></script>
<script>
function getMode(file){
var modelist = require('ace/ext/modelist');
@@ -333,7 +291,7 @@ editor.setOptions({
theme:'ace/theme/<?if (in_array($theme,['black','gray'])):?>tomorrow_night<?else:?>tomorrow<?endif;?>'
});
timers.editor = setTimeout(function(){$('div.spinner.fixed').show();},500);
$.post('/plugins/dynamix.file.manager/include/Control.php',{mode:'edit',file:encodeURIComponent(source)},function(data){
$.post('/webGui/include/Control.php',{mode:'edit',file:encodeURIComponent(source)},function(data){
clearTimeout(timers.editor);
$('div.spinner.fixed').hide();
editor.session.setValue(data);
@@ -345,7 +303,7 @@ $.post('/plugins/dynamix.file.manager/include/Control.php',{mode:'edit',file:enc
<div id="dfm_templateViewFile">
<!--!
<img id="dfm_viewer" href="{$0}">
<script src="<?autov('/plugins/dynamix.file.manager/javascript/EZView.js')?>"></script>
<script src="<?autov('/webGui/javascript/EZView.js')?>"></script>
<script>
$('#dfm_viewer').EZView();
$('#dfm_viewer').click();
@@ -358,7 +316,7 @@ $('#dfm_viewer').click();
<style>div#dfm_jobs{position:absolute;top:0;bottom:0;left:0;right:0;line-height:3rem}</style>
<div id="dfm_jobs"></div>
<script>
$.post('/plugins/dynamix.file.manager/include/Control.php',{mode:'jobs'},function(jobs){
$.post('/webGui/include/Control.php',{mode:'jobs'},function(jobs){
$('#dfm_jobs').html(jobs);
});
</script>
+9 -21
View File
@@ -11,54 +11,42 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Wrappers.php";
$device = $_POST['device']??'';
$name = $_POST['name']??'';
$action = $_POST['action']??'';
$state = $_POST['state']??'';
$csrf = $_POST['csrf']??'';
function prefix($key) {
return preg_replace('/\d+$/','',$key);
function emcmd($cmd) {
exec("emcmd $cmd");
}
function emhttpd($cmd) {
global $state, $csrf;
$ch = curl_init("http://127.0.0.1/update");
$options = [CURLOPT_UNIX_SOCKET_PATH => '/var/run/emhttpd.socket', CURLOPT_POST => 1, CURLOPT_POSTFIELDS => "$cmd&startState=$state&csrf_token=$csrf"];
curl_setopt_array($ch, $options);
curl_exec($ch);
curl_close($ch);
}
switch ($device) {
case 'New':
emhttpd("cmdSpin{$action}={$name}");
emcmd("cmdSpin{$action}={$name}");
break;
case 'Clear':
emhttpd("clearStatistics=true");
emcmd("clearStatistics=true");
break;
default:
if (!$name) {
// spin up/down all devices
emhttpd("cmdSpin{$device}All=true");
emcmd("cmdSpin{$device}All=true");
break;
}
if (substr($name,-1) != '*') {
// spin up/down single device
emhttpd("cmdSpin{$action}={$name}");
emcmd("cmdSpin{$action}={$name}");
break;
}
// spin up/down group of devices
$disks = @parse_ini_file('state/disks.ini',true) ?: [];
$disks = (array)@parse_ini_file('state/disks.ini',true);
// remove '*' from name
$name = substr($name,0,-1);
foreach ($disks as $disk) {
if (_var($disk,'status') != 'DISK_OK') continue;
$array = ($name=='array' && in_array(_var($disk,'type'),['Parity','Data']));
if ($array || prefix(_var($disk,'name'))==$name) emhttpd("cmdSpin{$action}="._var($disk,'name'));
if ($array || explode($_tilde_,prefix(_var($disk,'name')))[0]==$name) emcmd("cmdSpin{$action}="._var($disk,'name'));
}
break;
}
@@ -1,5 +1,5 @@
<?PHP
/* Copyright 2005-2020, Lime Technology
/* Copyright 2005-2023, 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,
@@ -10,14 +10,14 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Helpers.php";
extract(parse_plugin_cfg('dynamix',true));
// add translations
$_SERVER['REQUEST_URI'] = 'tools';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
extract(parse_plugin_cfg('dynamix',true));
$var = parse_ini_file('state/var.ini');
if (!empty($_POST['trial'])) {
+5 -5
View File
@@ -11,12 +11,12 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Helpers.php";
// add translations
$_SERVER['REQUEST_URI'] = 'settings';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
function host_lookup_ip($host) {
$result = @dns_get_record($host, DNS_A);
@@ -180,8 +180,8 @@ if ($cli && ($argc > 1) && $argv[1] == "-v") {
if ($cli && ($argc > 1) && $argv[1] == "-vv") {
$verbose = true;
}
$var = @parse_ini_file('/var/local/emhttp/var.ini') ?: [];
$nginx = @parse_ini_file('/var/local/emhttp/nginx.ini') ?: [];
$var = (array)@parse_ini_file('/var/local/emhttp/var.ini');
$nginx = (array)@parse_ini_file('/var/local/emhttp/nginx.ini');
$is69 = version_compare(_var($var,'version'),"6.9.9","<");
$reloadNginx = false;
$dnserr = false;
@@ -189,7 +189,7 @@ $icon_warn = "⚠️ ";
$icon_ok = "✅ ";
$myservers_flash_cfg_path='/boot/config/plugins/dynamix.my.servers/myservers.cfg';
$myservers = file_exists($myservers_flash_cfg_path) ? @parse_ini_file($myservers_flash_cfg_path,true) : [];
$myservers = (array)@parse_ini_file($myservers_flash_cfg_path,true);
// ensure some vars are defined here so we don't have to test them later
if (empty($myservers['remote']['apikey'])) {
$myservers['remote']['apikey'] = "";
+5 -4
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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,11 +11,12 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Helpers.php";
// add translations
$_SERVER['REQUEST_URI'] = 'settings';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Helpers.php";
$map = $changes = [];
+4 -3
View File
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2022, Lime Technology
* Copyright 2012-2022, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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 +11,8 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
// add translations
$_SERVER['REQUEST_URI'] = 'settings';
require_once "$docroot/webGui/include/Translations.php";
+29 -2
View File
@@ -11,7 +11,15 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
// pool name ending in any of these => zfs subpool
$subpools = ['special','logs','dedup','cache','spares'];
// ZFS subpool name separator and replacement
$_tilde_ = '~';
$_proxy_ = '__';
$_arrow_ = '&#187;';
// Wrapper functions
function parse_plugin_cfg($plugin, $sections=false, $scanner=INI_SCANNER_NORMAL) {
@@ -86,9 +94,28 @@ function ipaddr($ethX='eth0', $prot=4) {
return _var($$ethX,'IPADDR:0');
}
}
function no_tilde($name) {
global $_tilde_ ,$_proxy_;
return str_replace($_tilde_,$_proxy_,$name);
}
function prefix($key) {
return preg_replace('/\d+$/','',$key);
}
function native($name, $full=0) {
global $_tilde_, $_arrow_;
switch ($full) {
case 0: return str_replace($_tilde_," $_arrow_ ",$name);
case 1: return strpos($name,$_tilde_)!==false ? "$_arrow_ ".explode($_tilde_,$name)[1] : $name;
}
}
function isSubpool($name) {
global $subpools, $_tilde_;
$subpool = my_explode($_tilde_,$name)[1];
return in_array($subpool,$subpools) ? $subpool : false;
}
// convert strftime to date format
function my_date($fmt, $time) {
$legacy = ['%c' => 'D j M Y h:i:s A T','%A' => 'l','%Y' => 'Y','%B' => 'F','%e' => 'j','%d' => 'd','%m' => 'm','%I' => 'h','%H' => 'H','%M' => 'i','%S' => 's','%p' => 'a','%R' => 'H:i', '%F' => 'Y-m-d', '%T' => 'H:i:s'];
$legacy = ['%c' => 'D j M Y h:i A','%A' => 'l','%Y' => 'Y','%B' => 'F','%e' => 'j','%d' => 'd','%m' => 'm','%I' => 'h','%H' => 'H','%M' => 'i','%S' => 's','%p' => 'a','%R' => 'H:i', '%F' => 'Y-m-d', '%T' => 'H:i:s'];
return date(strtr($fmt,$legacy), $time);
}
?>
+15 -16
View File
@@ -1,5 +1,5 @@
<?PHP
/* Copyright 2005-2021, Lime Technology
/* Copyright 2005-2023, 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,
@@ -10,21 +10,20 @@
*/
?>
<?
function curl_socket($socket, $url, $postdata=NULL)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_UNIX_SOCKET_PATH, $socket);
if ($postdata !== NULL) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
return $result;
function curl_socket($socket, $url, $message) {
$com = curl_init($url);
curl_setopt_array($com,[
CURLOPT_UNIX_SOCKET_PATH => $socket,
CURLOPT_POST=> 1,
CURLOPT_POSTFIELDS => $message,
CURLOPT_RETURNTRANSFER => true
]);
$reply = curl_exec($com);
curl_close($com);
return $reply;
}
function publish($endpoint, $message, $len=1)
{
return curl_socket("/var/run/nginx.socket", "http://localhost/pub/$endpoint?buffer_length=$len", $message);
function publish($endpoint, $message, $len=1) {
return curl_socket("/var/run/nginx.socket", "http://localhost/pub/$endpoint?buffer_length=$len", $message);
}
?>
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2022, Lime Technology
* Copyright 2012-2022, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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 +11,7 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Wrappers.php";
[$job, $cmd] = explode(';',$_POST['#job']);
@@ -23,7 +23,7 @@ if ($index < count($tests)) {
$test = $tests[$index];
[$name,$size] = my_explode(':',$test);
if (!$size) {
$default = ($test==_var($_GET,'hash']));
$default = ($test==_var($_GET,'hash'));
if ($index>0) $test .= '|tail -1';
if ($default) echo "<b>";
echo preg_replace(['/^(# Tests.*\n)/','/\n$/'],["$1\n",""],shell_exec("/usr/sbin/cryptsetup benchmark -h $test"));
@@ -11,11 +11,12 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Wrappers.php";
// add translations
$_SERVER['REQUEST_URI'] = 'settings';
require_once "$docroot/webGui/include/Translations.php";
require_once "$docroot/webGui/include/Wrappers.php";
$save = false;
$disks = parse_ini_file('state/disks.ini',true);
@@ -50,7 +51,7 @@ function removeKey($key,$disk) {
}
function diskname($name) {
global $disks;
foreach ($disks as $disk) if (strncmp($name,$disk['device'],strlen(disk['device']))==0) return $disk['name'];
foreach ($disks as $disk) if (strncmp($name,$disk['device'],strlen($disk['device']))==0) return $disk['name'];
return $name;
}
function reply($text,$type) {
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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 +11,7 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Wrappers.php";
$memory = '/tmp/memory.tmp';
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, 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 +11,7 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Encryption.php";
$_POST['AuthPass'] = base64_encrypt($_POST['AuthPass']);
@@ -11,7 +11,7 @@
*/
?>
<?
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Wrappers.php";
if ($_POST['mode']>0) {
@@ -11,8 +11,7 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Secure.php";
require_once "$docroot/webGui/include/Wrappers.php";
@@ -11,8 +11,7 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Helpers.php";
// add translations
@@ -226,7 +225,10 @@ function createIPs($list) {
return implode(', ',array_map('host',array_filter(array_map('trim',explode(',',$list)))));
}
function parseInput($vtun,&$input,&$x) {
// assign values to parameters, be aware that certain parameters are assigned by parseInput itself
// this is based on the sequence of processing
global $conf,$user,$var,$default4,$default6,$vpn,$tunip;
$tunnel = $protocol = null; // satisfy code checkers
$section = 0; $addPeer = false;
foreach ($input as $key => $value) {
if ($key[0]=='#') continue;
@@ -11,7 +11,7 @@
*/
?>
<?
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
require_once "$docroot/webGui/include/Wrappers.php";
[$job, $cmd] = explode(';',$_POST['#job']);