From c177d24f97210c24b36097d71c01290160b3f965 Mon Sep 17 00:00:00 2001 From: Leo Feyer Date: Mon, 17 Mar 2014 20:32:21 +0100 Subject: [PATCH] Correctly handle OR queries in the listing module (see #6344) --- src/Resources/contao/dca/tl_module.php | 4 ++-- src/Resources/contao/modules/ModuleListing.php | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Resources/contao/dca/tl_module.php b/src/Resources/contao/dca/tl_module.php index 553d5f05d2..4b63131f08 100644 --- a/src/Resources/contao/dca/tl_module.php +++ b/src/Resources/contao/dca/tl_module.php @@ -53,7 +53,7 @@ 'label' => &$GLOBALS['TL_LANG']['tl_module']['list_search'], 'exclude' => true, 'inputType' => 'text', - 'eval' => array('maxlength'=>255, 'tl_class'=>'w50'), + 'eval' => array('decodeEntities'=>true, 'maxlength'=>255, 'tl_class'=>'w50'), 'sql' => "varchar(255) NOT NULL default ''" ); @@ -71,7 +71,7 @@ 'label' => &$GLOBALS['TL_LANG']['tl_module']['list_info'], 'exclude' => true, 'inputType' => 'text', - 'eval' => array('maxlength'=>255, 'tl_class'=>'w50'), + 'eval' => array('decodeEntities'=>true, 'maxlength'=>255, 'tl_class'=>'w50'), 'sql' => "varchar(255) NOT NULL default ''" ); diff --git a/src/Resources/contao/modules/ModuleListing.php b/src/Resources/contao/modules/ModuleListing.php index eacb01080c..f6bdcd4152 100644 --- a/src/Resources/contao/modules/ModuleListing.php +++ b/src/Resources/contao/modules/ModuleListing.php @@ -80,6 +80,7 @@ public function generate() $this->strTemplate = $this->list_layout; $this->list_where = $this->replaceInsertTags($this->list_where); + $this->list_info_where = $this->replaceInsertTags($this->list_info_where); return parent::generate(); } @@ -137,7 +138,7 @@ protected function compile() if ($this->list_where) { - $strQuery .= " WHERE " . $this->list_where; + $strQuery .= " WHERE (" . $this->list_where . ")"; } $strQuery .= $strWhere; @@ -177,7 +178,7 @@ protected function compile() if ($this->list_where) { - $strQuery .= " WHERE " . $this->list_where; + $strQuery .= " WHERE (" . $this->list_where . ")"; } $strQuery .= $strWhere; @@ -366,7 +367,7 @@ protected function listSingleRecord($id) $this->list_info = deserialize($this->list_info); $this->list_info_where = $this->replaceInsertTags($this->list_info_where); - $objRecord = $this->Database->prepare("SELECT " . $this->list_info . " FROM " . $this->list_table . " WHERE " . (($this->list_info_where != '') ? $this->list_info_where . " AND " : "") . $this->strPk . "=?") + $objRecord = $this->Database->prepare("SELECT " . $this->list_info . " FROM " . $this->list_table . " WHERE " . (($this->list_info_where != '') ? "(" . $this->list_info_where . ") AND " : "") . $this->strPk . "=?") ->limit(1) ->execute($id);