From 0c9b5d1493f623492f6295e39367655f3a3979a1 Mon Sep 17 00:00:00 2001 From: Squidly271 Date: Wed, 1 Apr 2020 14:25:36 -0400 Subject: [PATCH 1/6] Revert "LT Catchup" --- plugins/dynamix/ArrayOperation.page | 6 +++--- plugins/dynamix/include/Translations.php | 13 ++++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/plugins/dynamix/ArrayOperation.page b/plugins/dynamix/ArrayOperation.page index ba81255f2..21aa92d89 100644 --- a/plugins/dynamix/ArrayOperation.page +++ b/plugins/dynamix/ArrayOperation.page @@ -306,7 +306,7 @@ function formatWarning(val) { **_(Clear)_** _(will start **Clearing** new data disk(s))_. - **_(Check)_** _(will start **Read-Check** of all array disks)_. + **_(Check)_** _ (will start **Read-Check** of all array disks)_. _(Parity is valid)_.**_(Check)_** _(will start **Parity-Check**)_.   onclick="$.cookie('one','tab1',{path:'/'})">(_(Schedule)_)
_(Write corrections to parity)_ @@ -488,7 +488,7 @@ function formatWarning(val) { _(Too many wrong and/or missing disks)_! - **_(Stopped)_**. _(No data disks)_. + **_(Stopped)_**. _ (No data disks)_. _(No array data disks have been assigned)_! -

'.parse_file($display['sleep']))?> +

#is',$tempElement) || preg_match('#(.*?)#is',$tempElement) || (stripos($tempElement,"'.Markdown($language[$key])); From f2d13b397a0c383678f3304c99c9ac3f0fd9f461 Mon Sep 17 00:00:00 2001 From: Squidly271 Date: Fri, 3 Apr 2020 14:53:16 -0400 Subject: [PATCH 2/6] Fix merge conflict --- plugins/dynamix/include/Translations.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/plugins/dynamix/include/Translations.php b/plugins/dynamix/include/Translations.php index dfa8f869b..c8ea5e5a8 100644 --- a/plugins/dynamix/include/Translations.php +++ b/plugins/dynamix/include/Translations.php @@ -21,7 +21,7 @@ function _($text) { return strpos($data,'*')===false ? $data : preg_replace(['/\*\*(.+?)\*\*/','/\*(.+?)\*/'],['$1','$1'],$data); } function parse_lang_file($file) { - return languageSecurity(array_filter(parse_ini_string(preg_replace(['/"/m','/^(null|yes|no|true|false|on|off|none)=/mi','/^([^>].*)=([^"\'`].*)$/m','/^:((help|plug)\d*)$/m','/^:end$/m'],['\'','$1.=','$1="$2"',"_$1_=\"",'"'],str_replace("=\n","=''\n",file_get_contents($file)))),'strlen')); + return array_filter(parse_ini_string(preg_replace(['/^(null|yes|no|true|false|on|off|none)=/mi','/^([^>].*)=([^"\'`].*)$/m','/^:((help|plug)\d*)$/m','/^:end$/m'],['$1.=','$1="$2"',"_$1_=\"",'"'],str_replace(['"',"=\n"],[""","=\"\"\n"],file_get_contents($file)))),'secured',ARRAY_FILTER_USE_BOTH); } function parse_text($text) { return preg_replace_callback('/_\((.+?)\)_/m',function($m){return _($m[1]);},preg_replace(["/^:((help|plug)\d*)$/m","/^:end$/m"],["",""],$text)); @@ -57,16 +57,9 @@ function my_lang($text,$do=0) { } return $text; } - -function languageSecurity($languageArray) { - foreach ($languageArray as &$translation) { - $tempElement = html_entity_decode($translation); - if ( preg_match('#(.*?)#is',$tempElement) || preg_match('#(.*?)#is',$tempElement) || (stripos($tempElement,"(.+?)|<(link|meta)\s(.+?)/?>#is',html_entity_decode($v)); } - function translate($key) { global $language; if ($plug = isset($language[$key])) eval('?>'.Markdown($language[$key])); From 03131a9409bbfb1c250433aee5a6bd6ffcec574b Mon Sep 17 00:00:00 2001 From: Andrew Z Date: Fri, 3 Apr 2020 14:58:39 -0400 Subject: [PATCH 3/6] Display default image in case of docker icon corrupted download --- .../include/DockerContainers.php | 51 ++++++++----------- plugins/dynamix/include/DashboardApps.php | 24 ++++----- 2 files changed, 30 insertions(+), 45 deletions(-) diff --git a/plugins/dynamix.docker.manager/include/DockerContainers.php b/plugins/dynamix.docker.manager/include/DockerContainers.php index aeb4bddbf..07252325e 100644 --- a/plugins/dynamix.docker.manager/include/DockerContainers.php +++ b/plugins/dynamix.docker.manager/include/DockerContainers.php @@ -13,10 +13,6 @@ ?> "._('No Docker containers installed').""; + echo "No Docker containers installed"; return; } @@ -48,13 +44,6 @@ $menu = []; $autostart = @file($autostart_file, FILE_IGNORE_NEW_LINES) ?: []; $names = array_map('var_split', $autostart); -function my_lang_log($text) { - global $language; - if (isset($language['healthy'])) $text = str_replace('healthy',$language['healthy'],$text); - if (isset($language['Exited'])) $text = str_replace('Exited',$language['Exited'],$text); - return my_lang(my_lang(_($text),2)); -} - foreach ($containers as $ct) { $name = $ct['Name']; $id = $ct['Id']; @@ -76,7 +65,7 @@ foreach ($containers as $ct) { $color = $status=='started' ? 'green-text' : ($status=='paused' ? 'orange-text' : 'red-text'); $update = $updateStatus==1 ? 'blue-text' : ''; $icon = $info['icon'] ?: '/plugins/dynamix.docker.manager/images/question.png'; - $image = substr($icon,-4)=='.png' ? "" : (substr($icon,0,5)=='icon-' ? "" : ""); + $image = substr($icon,-4)=='.png' ? "" : (substr($icon,0,5)=='icon-' ? "" : ""); $wait = var_split($autostart[array_search($name,$names)],1); $ports = []; foreach ($ct['Ports'] as $port) { @@ -96,12 +85,12 @@ foreach ($containers as $ct) { } else { $appname = htmlspecialchars($name); } - echo "$image$appname
"._($status)."
"; - echo ""._('Container ID').": $id
"; + echo "$image$appname
$status
"; + echo "Container ID: $id
"; if ($ct['BaseImage']) echo "".htmlspecialchars(${ct['BaseImage']})."
"; - echo _('By').": "; + echo "By: "; $registry = $info['registry']; - [$author,$version] = explode(':',$ct['Image']); + list($author,$version) = explode(':',$ct['Image']); if ($registry) { echo "".htmlspecialchars($author).""; } else { @@ -110,42 +99,42 @@ foreach ($containers as $ct) { echo "
"; switch ($updateStatus) { case 0: - echo " "._('up-to-date').""; - echo ""; + echo " up-to-date"; + echo ""; break; case 1: - echo "
"._('update ready')."
"; - echo " "._('apply update').""; + echo "
update ready
"; + echo " apply update"; break; case 2: - echo "
".('rebuild ready')."
"; - echo " "._('rebuilding').""; + echo "
rebuild ready
"; + echo " rebuilding"; break; default: - echo " "._('not available').""; - echo ""; + echo " not available"; + echo ""; break; } - echo "
"._($version)."
"; + echo "
$version
"; echo "{$ct['NetworkMode']}"; echo "".implode('
',$ports)."
"; echo "".implode('
',$paths)."
"; echo "0%
"; echo "
0 / 0"; echo ""; - echo ""; + echo ""; echo "
"; - echo htmlspecialchars(str_replace('Up',_('Uptime'),my_lang_log($ct['Status'])))."
"._('Created')." ".htmlspecialchars(my_lang($ct['Created']))."
"; + echo htmlspecialchars(str_replace('Up','Uptime',$ct['Status']))."
Created ".htmlspecialchars($ct['Created'])."
"; } foreach ($images as $image) { if (count($image['usedBy'])) continue; $id = $image['Id']; $menu[] = sprintf("addDockerImageContext('%s','%s');", $id, implode(',',$image['Tags'])); echo ""; - echo "("._('orphan image').")
"._('stopped')."
"; - echo ""._('Image ID').": $id
"; + echo "(orphan image)
stopped
"; + echo "Image ID: $id
"; echo implode(', ',array_map('htmlspecialchars',$image['Tags'])); - echo ""._('Created')." ".htmlspecialchars(my_lang($image['Created'])).""; + echo "Created ".htmlspecialchars($image['Created']).""; } echo "\0".implode($menu).implode($docker)."\0".(pgrep('rc.docker')!==false ? 1:0); ?> diff --git a/plugins/dynamix/include/DashboardApps.php b/plugins/dynamix/include/DashboardApps.php index 3411f02a2..10153c5cd 100644 --- a/plugins/dynamix/include/DashboardApps.php +++ b/plugins/dynamix/include/DashboardApps.php @@ -1,7 +1,7 @@ " : (substr($icon,0,5)=='icon-' ? "" : ""); - echo "$image$name
"._($status)."
"; + $image = substr($icon,-4)=='.png' ? "" : (substr($icon,0,5)=='icon-' ? "" : ""); + echo "$image$name
$status
"; } - $none = count($containers) ? _('No running docker containers') : _('No docker containers defined'); + $none = count($containers) ? "No running docker containers" : "No docker containers defined"; echo ""; echo ""; } @@ -112,9 +108,9 @@ if ($_POST['vms'] && ($display=='icons' || $display=='vms')) { break; } $image = substr($icon,-4)=='.png' ? "" : (substr($icon,0,5)=='icon-' ? "" : ""); - echo "$image$vm
"._($status)."
"; + echo "$image$vm
$status
"; } - $none = count($vms) ? _('No running virtual machines') : _('No virtual machines defined'); + $none = count($vms) ? "No running virtual machines" : "No virtual machines defined"; echo ""; echo ""; } From 7cdea2d9f08d0e4080ed24b2908f78dbc8851d3e Mon Sep 17 00:00:00 2001 From: Squidly271 Date: Fri, 3 Apr 2020 15:19:25 -0400 Subject: [PATCH 4/6] Revert "Display default image in case of docker icon corrupted download" This reverts commit 03131a9409bbfb1c250433aee5a6bd6ffcec574b. --- .../include/DockerContainers.php | 51 +++++++++++-------- plugins/dynamix/include/DashboardApps.php | 24 +++++---- 2 files changed, 45 insertions(+), 30 deletions(-) diff --git a/plugins/dynamix.docker.manager/include/DockerContainers.php b/plugins/dynamix.docker.manager/include/DockerContainers.php index 07252325e..aeb4bddbf 100644 --- a/plugins/dynamix.docker.manager/include/DockerContainers.php +++ b/plugins/dynamix.docker.manager/include/DockerContainers.php @@ -13,6 +13,10 @@ ?> No Docker containers installed"; + echo ""._('No Docker containers installed').""; return; } @@ -44,6 +48,13 @@ $menu = []; $autostart = @file($autostart_file, FILE_IGNORE_NEW_LINES) ?: []; $names = array_map('var_split', $autostart); +function my_lang_log($text) { + global $language; + if (isset($language['healthy'])) $text = str_replace('healthy',$language['healthy'],$text); + if (isset($language['Exited'])) $text = str_replace('Exited',$language['Exited'],$text); + return my_lang(my_lang(_($text),2)); +} + foreach ($containers as $ct) { $name = $ct['Name']; $id = $ct['Id']; @@ -65,7 +76,7 @@ foreach ($containers as $ct) { $color = $status=='started' ? 'green-text' : ($status=='paused' ? 'orange-text' : 'red-text'); $update = $updateStatus==1 ? 'blue-text' : ''; $icon = $info['icon'] ?: '/plugins/dynamix.docker.manager/images/question.png'; - $image = substr($icon,-4)=='.png' ? "" : (substr($icon,0,5)=='icon-' ? "" : ""); + $image = substr($icon,-4)=='.png' ? "" : (substr($icon,0,5)=='icon-' ? "" : ""); $wait = var_split($autostart[array_search($name,$names)],1); $ports = []; foreach ($ct['Ports'] as $port) { @@ -85,12 +96,12 @@ foreach ($containers as $ct) { } else { $appname = htmlspecialchars($name); } - echo "$image$appname
$status
"; - echo "Container ID: $id
"; + echo "$image$appname
"._($status)."
"; + echo ""._('Container ID').": $id
"; if ($ct['BaseImage']) echo "".htmlspecialchars(${ct['BaseImage']})."
"; - echo "By: "; + echo _('By').": "; $registry = $info['registry']; - list($author,$version) = explode(':',$ct['Image']); + [$author,$version] = explode(':',$ct['Image']); if ($registry) { echo "".htmlspecialchars($author).""; } else { @@ -99,42 +110,42 @@ foreach ($containers as $ct) { echo "
"; switch ($updateStatus) { case 0: - echo " up-to-date"; - echo ""; + echo " "._('up-to-date').""; + echo ""; break; case 1: - echo "
update ready
"; - echo " apply update"; + echo "
"._('update ready')."
"; + echo " "._('apply update').""; break; case 2: - echo "
rebuild ready
"; - echo " rebuilding"; + echo "
".('rebuild ready')."
"; + echo " "._('rebuilding').""; break; default: - echo " not available"; - echo ""; + echo " "._('not available').""; + echo ""; break; } - echo "
$version
"; + echo "
"._($version)."
"; echo "{$ct['NetworkMode']}"; echo "".implode('
',$ports)."
"; echo "".implode('
',$paths)."
"; echo "0%
"; echo "
0 / 0"; echo ""; - echo ""; + echo ""; echo "
"; - echo htmlspecialchars(str_replace('Up','Uptime',$ct['Status']))."
Created ".htmlspecialchars($ct['Created'])."
"; + echo htmlspecialchars(str_replace('Up',_('Uptime'),my_lang_log($ct['Status'])))."
"._('Created')." ".htmlspecialchars(my_lang($ct['Created']))."
"; } foreach ($images as $image) { if (count($image['usedBy'])) continue; $id = $image['Id']; $menu[] = sprintf("addDockerImageContext('%s','%s');", $id, implode(',',$image['Tags'])); echo ""; - echo "(orphan image)
stopped
"; - echo "Image ID: $id
"; + echo "("._('orphan image').")
"._('stopped')."
"; + echo ""._('Image ID').": $id
"; echo implode(', ',array_map('htmlspecialchars',$image['Tags'])); - echo "Created ".htmlspecialchars($image['Created']).""; + echo ""._('Created')." ".htmlspecialchars(my_lang($image['Created'])).""; } echo "\0".implode($menu).implode($docker)."\0".(pgrep('rc.docker')!==false ? 1:0); ?> diff --git a/plugins/dynamix/include/DashboardApps.php b/plugins/dynamix/include/DashboardApps.php index 10153c5cd..3411f02a2 100644 --- a/plugins/dynamix/include/DashboardApps.php +++ b/plugins/dynamix/include/DashboardApps.php @@ -1,7 +1,7 @@ " : (substr($icon,0,5)=='icon-' ? "" : ""); - echo "$image$name
$status
"; + $image = substr($icon,-4)=='.png' ? "" : (substr($icon,0,5)=='icon-' ? "" : ""); + echo "$image$name
"._($status)."
"; } - $none = count($containers) ? "No running docker containers" : "No docker containers defined"; + $none = count($containers) ? _('No running docker containers') : _('No docker containers defined'); echo ""; echo ""; } @@ -108,9 +112,9 @@ if ($_POST['vms'] && ($display=='icons' || $display=='vms')) { break; } $image = substr($icon,-4)=='.png' ? "" : (substr($icon,0,5)=='icon-' ? "" : ""); - echo "$image$vm
$status
"; + echo "$image$vm
"._($status)."
"; } - $none = count($vms) ? "No running virtual machines" : "No virtual machines defined"; + $none = count($vms) ? _('No running virtual machines') : _('No virtual machines defined'); echo ""; echo ""; } From cadba1e54ccddd78ed52b47d1c95808bc0f1de61 Mon Sep 17 00:00:00 2001 From: Andrew Z Date: Fri, 3 Apr 2020 15:25:56 -0400 Subject: [PATCH 5/6] Display default docker icon if download corrupted --- plugins/dynamix.docker.manager/include/DockerContainers.php | 2 +- plugins/dynamix/include/DashboardApps.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/dynamix.docker.manager/include/DockerContainers.php b/plugins/dynamix.docker.manager/include/DockerContainers.php index aeb4bddbf..e52a984b9 100644 --- a/plugins/dynamix.docker.manager/include/DockerContainers.php +++ b/plugins/dynamix.docker.manager/include/DockerContainers.php @@ -76,7 +76,7 @@ foreach ($containers as $ct) { $color = $status=='started' ? 'green-text' : ($status=='paused' ? 'orange-text' : 'red-text'); $update = $updateStatus==1 ? 'blue-text' : ''; $icon = $info['icon'] ?: '/plugins/dynamix.docker.manager/images/question.png'; - $image = substr($icon,-4)=='.png' ? "" : (substr($icon,0,5)=='icon-' ? "" : ""); + $image = substr($icon,-4)=='.png' ? "" : (substr($icon,0,5)=='icon-' ? "" : ""); $wait = var_split($autostart[array_search($name,$names)],1); $ports = []; foreach ($ct['Ports'] as $port) { diff --git a/plugins/dynamix/include/DashboardApps.php b/plugins/dynamix/include/DashboardApps.php index 3411f02a2..bf8f15426 100644 --- a/plugins/dynamix/include/DashboardApps.php +++ b/plugins/dynamix/include/DashboardApps.php @@ -55,7 +55,7 @@ if ($_POST['docker'] && ($display=='icons' || $display=='docker')) { $color = $status=='started' ? 'green-text' : ($status=='paused' ? 'orange-text' : 'red-text'); $update = $updateStatus==1 ? 'blue-text' : ''; $icon = $info['icon'] ?: '/plugins/dynamix.docker.manager/images/question.png'; - $image = substr($icon,-4)=='.png' ? "" : (substr($icon,0,5)=='icon-' ? "" : ""); + $image = substr($icon,-4)=='.png' ? "" : (substr($icon,0,5)=='icon-' ? "" : ""); echo "$image$name
"._($status)."
"; } $none = count($containers) ? _('No running docker containers') : _('No docker containers defined'); From ec6009dd2ff0bae719b6c81a024956f679204018 Mon Sep 17 00:00:00 2001 From: Squidly271 Date: Sat, 4 Apr 2020 01:22:52 -0400 Subject: [PATCH 6/6] LT Catchup --- plugins/dynamix/ArrayOperation.page | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/dynamix/ArrayOperation.page b/plugins/dynamix/ArrayOperation.page index 21aa92d89..ba81255f2 100644 --- a/plugins/dynamix/ArrayOperation.page +++ b/plugins/dynamix/ArrayOperation.page @@ -306,7 +306,7 @@ function formatWarning(val) { **_(Clear)_** _(will start **Clearing** new data disk(s))_. - **_(Check)_** _ (will start **Read-Check** of all array disks)_. + **_(Check)_** _(will start **Read-Check** of all array disks)_. _(Parity is valid)_.**_(Check)_** _(will start **Parity-Check**)_.   onclick="$.cookie('one','tab1',{path:'/'})">(_(Schedule)_)
_(Write corrections to parity)_ @@ -488,7 +488,7 @@ function formatWarning(val) { _(Too many wrong and/or missing disks)_! - **_(Stopped)_**. _ (No data disks)_. + **_(Stopped)_**. _(No data disks)_. _(No array data disks have been assigned)_! -

+

'.parse_file($display['sleep']))?>