From c7f0b83c0da6f807f5859d5d666c1dfd009019b9 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Tue, 06 Nov 2012 10:11:11 -0500
Subject: [PATCH] Implemented: FS#2437 - iterate_query in dovecot-sql.conf is missing The query is added for reference and is commented out by default as it is not compatible with dovecot 1.2 and not required by ispconfig.

---
 interface/lib/classes/listform.inc.php |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/interface/lib/classes/listform.inc.php b/interface/lib/classes/listform.inc.php
index 96c39f1..6128022 100644
--- a/interface/lib/classes/listform.inc.php
+++ b/interface/lib/classes/listform.inc.php
@@ -194,14 +194,14 @@
         global $app, $conf;
         
         //* Add Global Limit from selectbox
-        if(!empty($_POST['search_limit']) AND intval($_POST['search_limit'])){
-			$_SESSION['search']['limit'] = intval($_POST['search_limit']);
+        if(!empty($_POST['search_limit']) AND $app->functions->intval($_POST['search_limit'])){
+			$_SESSION['search']['limit'] = $app->functions->intval($_POST['search_limit']);
 		}
 
         //* Get Config variables
         $list_name          = $this->listDef['name'];
         $search_prefix      = $this->listDef['search_prefix'];
-        $records_per_page   = (empty($_SESSION['search']['limit']) ? intval($this->listDef['records_per_page']) : intval($_SESSION['search']['limit'])) ;
+        $records_per_page   = (empty($_SESSION['search']['limit']) ? $app->functions->intval($this->listDef['records_per_page']) : $app->functions->intval($_SESSION['search']['limit'])) ;
         $table              = $this->listDef['table'];
 
         //* set PAGE to zero, if in session not set
@@ -210,14 +210,14 @@
         }
 
         //* set PAGE to worth request variable "PAGE" - ? setze page auf wert der request variablen "page"
-        if(isset($_REQUEST["page"])) $_SESSION["search"][$list_name]["page"] = intval($_REQUEST["page"]);
+        if(isset($_REQUEST["page"])) $_SESSION["search"][$list_name]["page"] = $app->functions->intval($_REQUEST["page"]);
 
         //* PAGE to 0 set, if look for themselves ?  page auf 0 setzen, wenn suche sich ge�ndert hat.
         if($this->searchChanged == 1) $_SESSION['search'][$list_name]['page'] = 0;
 
-        $sql_von = intval($_SESSION['search'][$list_name]['page'] * $records_per_page);
+        $sql_von = $app->functions->intval($_SESSION['search'][$list_name]['page'] * $records_per_page);
         $record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM $table WHERE $sql_where");
-        $pages = intval(($record_count['anzahl'] - 1) / $records_per_page);
+        $pages = $app->functions->intval(($record_count['anzahl'] - 1) / $records_per_page);
 
 
         $vars['list_file']      = $_SESSION['s']['module']['name'].'/'.$this->listDef['file'];
@@ -291,6 +291,11 @@
         if(is_array($record) && count($record) > 0 && is_array($this->listDef['item'])) {
             foreach($this->listDef['item'] as $field){
                 $key = $field['field'];
+                //* Apply filter to record value.
+                if(isset($field['filters']) && is_array($field['filters'])) {
+                    $app->uses('tform');
+                    $record[$key] = $app->tform->filterField($key, (isset($record[$key]))?$record[$key]:'', $field['filters'], 'SHOW');
+                }
 				if(isset($record[$key])) {
                 	switch ($field['datatype']){
                     case 'VARCHAR':
@@ -331,7 +336,7 @@
                         break;
 
                     case 'INTEGER':
-                        $record[$key] = intval($record[$key]);
+                        $record[$key] = $app->functions->intval($record[$key]);
                         break;
 
                     case 'DOUBLE':
@@ -387,7 +392,7 @@
                         break;
 
                     case 'INTEGER':
-                        $record[$key] = intval($record[$key]);
+                        $record[$key] = $app->functions->intval($record[$key]);
                         break;
 
                     case 'DOUBLE':

--
Gitblit v1.9.1