summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNewEraCracker <neweracracker@gmail.com>2016-06-19 18:40:20 +0100
committerStephen Beaver <sbeaver@netgate.com>2016-06-22 11:57:52 -0400
commitbb44b41af0869a29080b9cdd8e03afbb8bc9bcaa (patch)
tree072b09a73f2fe47a416c443f1c27e9555bf70c1e
parenta8ed54b4bfb9c08fe78b2946e85212ee31b166da (diff)
downloadpfsense-bb44b41af0869a29080b9cdd8e03afbb8bc9bcaa.zip
pfsense-bb44b41af0869a29080b9cdd8e03afbb8bc9bcaa.tar.gz
Fix Bug #6394 - Incorrect Output of Translation
Apparently gettext() does not behave correctly when passed an empty string, this commit ensures gettext() is called only with non-empty strings (cherry picked from commit 6ae99aba5cab12440d88dd9ddaa6535c3b9b5d82)
-rw-r--r--src/usr/local/www/classes/Form/Checkbox.class.php2
-rw-r--r--src/usr/local/www/classes/Form/Group.class.php2
-rw-r--r--src/usr/local/www/classes/Form/Input.class.php2
-rw-r--r--src/usr/local/www/classes/Form/Section.class.php7
4 files changed, 9 insertions, 4 deletions
diff --git a/src/usr/local/www/classes/Form/Checkbox.class.php b/src/usr/local/www/classes/Form/Checkbox.class.php
index 0601779..af258a4 100644
--- a/src/usr/local/www/classes/Form/Checkbox.class.php
+++ b/src/usr/local/www/classes/Form/Checkbox.class.php
@@ -63,7 +63,7 @@ class Form_Checkbox extends Form_Input
{
$input = parent::_getInput();
- if (!isset($this->_description))
+ if (empty($this->_description))
return $input;
return '<label class="chkboxlbl">'. $input .' '. htmlspecialchars(gettext($this->_description)) .'</label>';
diff --git a/src/usr/local/www/classes/Form/Group.class.php b/src/usr/local/www/classes/Form/Group.class.php
index ce11969..d07010a 100644
--- a/src/usr/local/www/classes/Form/Group.class.php
+++ b/src/usr/local/www/classes/Form/Group.class.php
@@ -86,7 +86,7 @@ class Form_Group extends Form_Element
protected function _getHelp()
{
- if (!isset($this->_help))
+ if (empty($this->_help))
return null;
$group = new Form_Element;
diff --git a/src/usr/local/www/classes/Form/Input.class.php b/src/usr/local/www/classes/Form/Input.class.php
index 4cdfb28..f146e1b 100644
--- a/src/usr/local/www/classes/Form/Input.class.php
+++ b/src/usr/local/www/classes/Form/Input.class.php
@@ -243,7 +243,7 @@ class Form_Input extends Form_Element
if (!isset($this->_help) && '<div>' == $column)
return (string)$input;
- if (isset($this->_help))
+ if (!empty($this->_help))
{
/* Strings longer than this will break gettext. */
if (strlen($this->_help) < 7620) {
diff --git a/src/usr/local/www/classes/Form/Section.class.php b/src/usr/local/www/classes/Form/Section.class.php
index 631562c..f1c00c9 100644
--- a/src/usr/local/www/classes/Form/Section.class.php
+++ b/src/usr/local/www/classes/Form/Section.class.php
@@ -92,7 +92,12 @@ class Form_Section extends Form_Element
public function __toString()
{
$element = parent::__toString();
- $title = htmlspecialchars(gettext($this->_title));
+
+ if (!empty(trim($this->_title)) || is_numeric($this->_title))
+ $title = htmlspecialchars(gettext($this->_title));
+ else
+ $title = '';
+
$body = implode('', $this->_groups);
$hdricon = "";
$bodyclass = '<div class="panel-body">';
OpenPOWER on IntegriCloud