From 1b4f376d0ca0256c6b725495e8463a9f6c36ba8e Mon Sep 17 00:00:00 2001 From: Vinicius Coque Date: Mon, 26 Apr 2010 17:02:23 -0300 Subject: Addin gettext functions do system::firmware --- usr/local/www/system_firmware.php | 84 +++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 42 deletions(-) (limited to 'usr/local/www/system_firmware.php') diff --git a/usr/local/www/system_firmware.php b/usr/local/www/system_firmware.php index ed40a97..3a090e4 100755 --- a/usr/local/www/system_firmware.php +++ b/usr/local/www/system_firmware.php @@ -76,32 +76,32 @@ function file_is_for_platform($filename, $ul_name) { function file_upload_error_message($error_code) { switch ($error_code) { case UPLOAD_ERR_INI_SIZE: - return 'The uploaded file exceeds the upload_max_filesize directive in php.ini'; + return gettext('The uploaded file exceeds the upload_max_filesize directive in php.ini'); case UPLOAD_ERR_FORM_SIZE: - return 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'; + return gettext('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'); case UPLOAD_ERR_PARTIAL: - return 'The uploaded file was only partially uploaded'; + return gettext('The uploaded file was only partially uploaded'); case UPLOAD_ERR_NO_FILE: - return 'No file was uploaded'; + return gettext('No file was uploaded'); case UPLOAD_ERR_NO_TMP_DIR: - return 'Missing a temporary folder'; + return gettext('Missing a temporary folder'); case UPLOAD_ERR_CANT_WRITE: - return 'Failed to write file to disk'; + return gettext('Failed to write file to disk'); case UPLOAD_ERR_EXTENSION: - return 'File upload stopped by extension'; + return gettext('File upload stopped by extension'); default: - return 'Unknown upload error'; + return gettext('Unknown upload error'); } } /* if upgrade in progress, alert user */ if(is_subsystem_dirty('firmwarelock')) { - $pgtitle = array("System","Firmware","Manual Update"); + $pgtitle = array(gettext("System"),gettext("Firmware"),gettext("Manual Update")); include("head.inc"); echo "\n"; include("fbegin.inc"); echo "
\n"; - print_info_box("An upgrade is currently in progress.

The firewall will reboot when the operation is complete.

"); + print_info_box(gettext("An upgrade is currently in progress.

The firewall will reboot when the operation is complete.") . "

"); echo "
\n"; include("fend.inc"); echo ""; @@ -145,10 +145,10 @@ if ($_POST && !is_subsystem_dirty('firmwarelock')) { if (is_uploaded_file($_FILES['ulfile']['tmp_name'])) { /* verify firmware image(s) */ if (file_is_for_platform($_FILES['ulfile']['tmp_name'], $_FILES['ulfile']['name']) == false && !$_POST['sig_override']) - $input_errors[] = "The uploaded image file is not for this platform ({$g['platform']})."; + $input_errors[] = gettext("The uploaded image file is not for this platform") . " ({$g['platform']})"; else if (!file_exists($_FILES['ulfile']['tmp_name'])) { /* probably out of memory for the MFS */ - $input_errors[] = "Image upload failed (out of memory?)"; + $input_errors[] = gettext("Image upload failed (out of memory?)"); mwexec("/etc/rc.firmware disable"); clear_subsystem_dirty('firmware'); } else { @@ -159,14 +159,14 @@ if ($_POST && !is_subsystem_dirty('firmwarelock')) { $sigchk = verify_digital_signature("{$g['upload_path']}/firmware.tgz"); if ($sigchk == 1) - $sig_warning = "The digital signature on this image is invalid."; + $sig_warning = gettext("The digital signature on this image is invalid."); else if ($sigchk == 2 && !isset($config['system']['firmware']['allowinvalidsig'])) - $sig_warning = "This image is not digitally signed."; + $sig_warning = gettext("This image is not digitally signed."); else if (($sigchk >= 3)) - $sig_warning = "There has been an error verifying the signature on this image."; + $sig_warning = gettext("There has been an error verifying the signature on this image."); if (!verify_gzip_file("{$g['upload_path']}/firmware.tgz")) { - $input_errors[] = "The image file is corrupt."; + $input_errors[] = gettext("The image file is corrupt."); unlink("{$g['upload_path']}/firmware.tgz"); } } @@ -179,7 +179,7 @@ if ($_POST && !is_subsystem_dirty('firmwarelock')) { if (file_exists("{$g['upload_path']}/firmware.tgz")) { /* fire up the update script in the background */ mark_subsystem_dirty('firmwarelock'); - $savemsg = "The firmware is now being updated. The firewall will reboot automatically."; + $savemsg = gettext("The firmware is now being updated. The firewall will reboot automatically."); if(stristr($_FILES['ulfile']['name'],"nanobsd") or $_POST['isnano'] == "yes") mwexec_bg("/etc/rc.firmware pfSenseNanoBSDupgrade {$g['upload_path']}/firmware.tgz"); else if(stristr($_FILES['ulfile']['name'],"bdiff")) @@ -187,7 +187,7 @@ if ($_POST && !is_subsystem_dirty('firmwarelock')) { else mwexec_bg("/etc/rc.firmware pfSenseupgrade {$g['upload_path']}/firmware.tgz"); } else { - $savemsg = "Firmware image missing or other error, please try again {$errortext}."; + $savemsg = sprintf(gettext("Firmware image missing or other error, please try again %s."),$errortext); } } } @@ -211,11 +211,11 @@ include("head.inc"); "") print_info_box($fwinfo); ?> " . $sig_warning . "
This means that the image you uploaded " . + $sig_warning = "" . $sig_warning . "
" . gettext("This means that the image you uploaded " . "is not an official/supported image and may lead to unexpected behavior or security " . "compromises. Only install images that come from sources that you trust, and make sure ". - "that the image has not been tampered with.

". - "Do you want to install this image anyway (on your own risk)?"; + "that the image has not been tampered with.") . "

". + gettext("Do you want to install this image anyway (on your own risk)?"); print_info_box($sig_warning); if(stristr($_FILES['ulfile']['name'],"nanobsd")) echo "\n"; @@ -229,9 +229,9 @@ if(stristr($_FILES['ulfile']['name'],"nanobsd")) @@ -247,36 +247,36 @@ if(stristr($_FILES['ulfile']['name'],"nanobsd"))  

- Click "Enable firmware - upload" below, then choose the image file () - to be uploaded. +
- Click "Upgrade firmware" to start the upgrade process. +

- + "> - + ">

- Firmware image file:   + :  

- NOTE: You must upload a .img.gz image, not an uncompressed image! + - NOTE: You must upload a .tgz image, not an uncompressed image! +

"; - echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo ""; echo "

"; } @@ -289,17 +289,17 @@ if(stristr($_FILES['ulfile']['name'],"nanobsd")) ?> - You must reboot the system before you can upgrade the firmware. +   - Warning:
-
DO NOT abort the firmware upgrade once it +
+
+ storing the new firmware. The configuration will be maintained.");?>
-- cgit v1.1