diff --git a/sysutils/smart/Makefile b/sysutils/smart/Makefile index 7950b318d..70c94fb37 100644 --- a/sysutils/smart/Makefile +++ b/sysutils/smart/Makefile @@ -1,5 +1,5 @@ PLUGIN_NAME= smart -PLUGIN_VERSION= 1.2 +PLUGIN_VERSION= 1.3 PLUGIN_COMMENT= SMART tools PLUGIN_DEPENDS= smartmontools PLUGIN_MAINTAINER= franco@opnsense.org diff --git a/sysutils/smart/src/www/diag_smart.php b/sysutils/smart/src/www/diag_smart.php index d666b4efb..10c7c065a 100644 --- a/sysutils/smart/src/www/diag_smart.php +++ b/sysutils/smart/src/www/diag_smart.php @@ -52,18 +52,18 @@ include("fbegin.inc");
-' . gettext("PASSED") . ''; - $replacements[1] = '' . gettext("FAILED") . ''; - $replacements[2] = '' . gettext("Warning") . ''; + $replacements[0] = '' . gettext("PASSED") . ''; + $replacements[1] = '' . gettext("FAILED") . ''; + $replacements[2] = ''; ksort($patterns); ksort($replacements); return preg_replace($patterns, $replacements, $string); @@ -74,16 +74,16 @@ function add_colors($string) $action = (isset($_POST['action']) ? $_POST['action'] : $_GET['action']); $targetdev = basename($_POST['device']); if (!file_exists('/dev/' . $targetdev)) { - echo "Device does not exist, bailing."; + echo gettext("Device does not exist, bailing."); return; } + switch($action) { // Testing devices case 'test': - { $test = $_POST['testType']; if (!in_array($test, $valid_test_types)) { - echo "Invalid test type, bailing."; + echo gettext("Invalid test type, bailing."); return; } $output = add_colors(shell_exec($smartctl . " -t " . escapeshellarg($test) . " /dev/" . escapeshellarg($targetdev))); @@ -95,60 +95,51 @@ switch($action) { '; break; - } // Info on devices case 'info': - { $type = $_POST['type']; if (!in_array($type, $valid_info_types)) { - echo "Invalid info type, bailing."; + echo gettext("Invalid info type, bailing."); return; } $output = add_colors(shell_exec($smartctl . " -" . escapeshellarg($type) . " /dev/" . escapeshellarg($targetdev))); echo "
$output
"; break; - } // View logs case 'logs': - { $type = $_POST['type']; if (!in_array($type, $valid_log_types)) { - echo "Invalid log type, bailing."; + echo gettext("Invalid log type, bailing."); return; } $output = add_colors(shell_exec($smartctl . " -l " . escapeshellarg($type) . " /dev/" . escapeshellarg($targetdev))); echo "
$output
"; break; - } // Abort tests case 'abort': - { $output = shell_exec($smartctl . " -X /dev/" . escapeshellarg($targetdev)); echo "
$output
"; break; - } // Default page, prints the forms to view info, test, etc... default: - { - // Get all AD* and DA* (IDE and SCSI) devices currently installed and stores them in the $devs array exec("ls /dev | grep '^\(ad\|da\|ada\)[0-9]\{1,2\}$'", $devs); - if (count($devs) > 0) { + if (count($devs) > 0): ?>
-
+ - + @@ -183,11 +171,9 @@ switch($action) { -
-
- +
    @@ -162,12 +153,9 @@ switch($action) {
@@ -196,7 +182,7 @@ switch($action) { - @@ -231,17 +214,17 @@ switch($action) {
- +
-   +       @@ -205,14 +191,11 @@ switch($action) {
+
- + @@ -249,12 +232,9 @@ switch($action) { @@ -273,21 +253,18 @@ switch($action) {
- +
-   - +   +
- + @@ -304,26 +281,25 @@ switch($action) { ' . gettext("Back") . ''; +if(isset($_POST['submit']) && $_POST['submit'] != "Save") { + echo '
' . gettext("Back") . ''; } ?>
-" . $ulmsg . "

\n"; ?> +" . html_safe($ulmsg) . "

\n"; +} ?> -