From: Jehan-Guillaume (ioguix) de Rorthais Date: Fri, 30 Dec 2011 14:07:19 +0000 (+0100) Subject: Remove useless noEscape decorator since we removed recoded strings X-Git-Tag: REL_5-1-0~93^2~1 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=33f14343c53dc7eace1bd9e4cce96e05ca3d3514;p=phppgadmin.git Remove useless noEscape decorator since we removed recoded strings noEscape decorator was only used to not escape recoded strings because it was breaking non-ascii chars that was begining by &#...;. This make the code a bit simpler, cleaner and remove useless piece of code. --- diff --git a/database.php b/database.php index c9cbfdc9..03a3b7ca 100755 --- a/database.php +++ b/database.php @@ -601,7 +601,7 @@ $items = $misc->adjustTabsForTree($tabs); $attrs = array( - 'text' => noEscape(field('title')), + 'text' => field('title'), 'icon' => field('icon'), 'action' => url(field('url'), $reqvars, diff --git a/fulltext.php b/fulltext.php index 830c05b8..04fae720 100644 --- a/fulltext.php +++ b/fulltext.php @@ -897,7 +897,7 @@ $reqvars = $misc->getRequestVars('ftscfg'); $attrs = array( - 'text' => noEscape(field('title')), + 'text' => field('title'), 'icon' => field('icon'), 'action' => url('fulltext.php', $reqvars, @@ -940,7 +940,7 @@ $reqvars = $misc->getRequestVars('ftscfg'); $attrs = array( - 'text' => noEscape(field('name')), + 'text' => field('name'), 'icon' => $what, 'toolTip'=> field('comment'), 'action' => url('fulltext.php', diff --git a/libraries/decorator.inc.php b/libraries/decorator.inc.php index fec8f75e..65311f6b 100644 --- a/libraries/decorator.inc.php +++ b/libraries/decorator.inc.php @@ -41,14 +41,6 @@ function url($base, $vars = null /* ... */) { return new UrlDecorator($base, $vars); } -function noEscape($value) { - if (is_a($value, 'Decorator')) { - $value->esc = false; - return $value; - } - return new Decorator($value, false); -} - function replace($str, $params) { return new replaceDecorator($str, $params); } @@ -58,10 +50,10 @@ function replace($str, $params) { function value(&$var, &$fields, $esc = null) { if (is_a($var, 'Decorator')) { $val = $var->value($fields); - if (!$var->esc) $esc = null; } else { $val =& $var; } + if (is_string($val)) { switch($esc) { case 'xml': @@ -99,11 +91,8 @@ function value_url(&$var, &$fields) { class Decorator { - var $esc = true; - - function Decorator($value, $esc = true) { + function Decorator($value) { $this->v = $value; - $this->esc = $esc; } function value($fields) { diff --git a/plugin_slony.php b/plugin_slony.php index 850c2a15..fdb8d8ab 100755 --- a/plugin_slony.php +++ b/plugin_slony.php @@ -56,7 +56,7 @@ $items = $misc->adjustTabsForTree($tabs); $attrs = array( - 'text' => noEscape(field('title')), + 'text' => field('title'), 'icon' => field('icon'), 'action' => url(field('url'), $reqvars, @@ -84,7 +84,7 @@ $items = $misc->adjustTabsForTree($tabs); $attrs = array( - 'text' => noEscape(field('title')), + 'text' => field('title'), 'icon' => field('icon'), 'action' => url(field('url'), $reqvars, @@ -113,7 +113,7 @@ $items = $misc->adjustTabsForTree($tabs); $attrs = array( - 'text' => noEscape(field('title')), + 'text' => field('title'), 'icon' => field('icon'), 'action' => url(field('url'), $reqvars, @@ -172,7 +172,7 @@ $items = $misc->adjustTabsForTree($tabs); $attrs = array( - 'text' => noEscape(field('title')), + 'text' => field('title'), 'icon' => field('icon'), 'action' => url(field('url'), $reqvars, @@ -199,7 +199,7 @@ $items = $misc->adjustTabsForTree($tabs); $attrs = array( - 'text' => noEscape(field('title')), + 'text' => field('title'), 'icon' => field('icon'), 'action' => url(field('url'), $reqvars, @@ -284,7 +284,7 @@ $items = $misc->adjustTabsForTree($tabs); $attrs = array( - 'text' => noEscape(field('title')), + 'text' => field('title'), 'icon' => field('icon'), 'action' => url(field('url'), $reqvars, @@ -311,7 +311,7 @@ $items = $misc->adjustTabsForTree($tabs); $attrs = array( - 'text' => noEscape(field('title')), + 'text' => field('title'), 'icon' => field('icon'), 'action' => url(field('url'), $reqvars, @@ -339,7 +339,7 @@ $items = $misc->adjustTabsForTree($tabs); $attrs = array( - 'text' => noEscape(field('title')), + 'text' => field('title'), 'icon' => field('icon'), 'action' => url(field('url'), $reqvars, diff --git a/schemas.php b/schemas.php index 7ab6e9de..7ad336e5 100755 --- a/schemas.php +++ b/schemas.php @@ -396,7 +396,7 @@ $reqvars = $misc->getRequestVars('schema'); $attrs = array( - 'text' => noEscape(field('title')), + 'text' => field('title'), 'icon' => field('icon'), 'action' => url(field('url'), $reqvars, diff --git a/servers.php b/servers.php index 295585e5..3211b921 100644 --- a/servers.php +++ b/servers.php @@ -133,16 +133,8 @@ $groups = $misc->getServersGroups(); - function escape($fields) { - global $lang; - if ($fields['id'] === 'all') { - return $lang['strallservers']; - } - else return value(field('desc'), $fields, 'xml'); - } - $attrs = array( - 'text' => noEscape(callback('escape')), + 'text' => field('desc'), 'icon' => 'Servers', 'action' => url('servers.php', array( diff --git a/tables.php b/tables.php index ff760c3a..89c4dba0 100644 --- a/tables.php +++ b/tables.php @@ -878,7 +878,7 @@ $reqvars = $misc->getRequestVars('table'); $attrs = array( - 'text' => noEscape(field('title')), + 'text' => field('title'), 'icon' => field('icon'), 'action' => url( field('url'), diff --git a/views.php b/views.php index 90c16709..d782a76e 100644 --- a/views.php +++ b/views.php @@ -660,7 +660,7 @@ $reqvars = $misc->getRequestVars('view'); $attrs = array( - 'text' => noEscape(field('title')), + 'text' => field('title'), 'icon' => field('icon'), 'action' => url(field('url'), $reqvars, field('urlvars'), array('view' => $_REQUEST['view'])), 'branch' => ifempty(