summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/classes
diff options
context:
space:
mode:
authorNewEraCracker <neweracracker@gmail.com>2016-06-19 18:40:20 +0100
committerNewEraCracker <neweracracker@gmail.com>2016-06-19 18:40:20 +0100
commit6ae99aba5cab12440d88dd9ddaa6535c3b9b5d82 (patch)
tree660c3cceb8ffbf7fec2ce548d3301ee9e71d7fbe /src/usr/local/www/classes
parentb02ae57a4ab4f37060bd39dd005ba01f24877c27 (diff)
downloadpfsense-6ae99aba5cab12440d88dd9ddaa6535c3b9b5d82.zip
pfsense-6ae99aba5cab12440d88dd9ddaa6535c3b9b5d82.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
Diffstat (limited to 'src/usr/local/www/classes')
-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 036a1df..8b73c9a 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) < 4096) {
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