listform.inc.php 21 KB
Newer Older
tbrehm's avatar
tbrehm committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php

/*
Copyright (c) 2007, Till Brehm, projektfarm Gmbh
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of ISPConfig nor the names of its contributors
      may be used to endorse or promote products derived from this software without
      specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

class listform {

    private $debug = 0;
    private $errorMessage;
    public  $listDef;
    public  $searchValues;
    public  $pagingHTML;
    private $pagingValues;
    private $searchChanged = 0;
    private $module;
	public $wordbook;

    public function loadListDef($file, $module = '')
    {
        global $app,$conf;
        if(!is_file($file)){
            die("List-Definition: $file not found.");
        }
        require_once($file);
        $this->listDef = $liste;
        $this->module = $module;
		
		//* Fill datasources
54
55
56
57
58
59
        if(@is_array($this->listDef['item'])) {
		    foreach($this->listDef['item'] as $key => $field) {
			    if(@is_array($field['datasource'])) {
                    $this->listDef['item'][$key]['value'] = $this->getDatasourceData($field);
                }
		    }
tbrehm's avatar
tbrehm committed
60
		}
61
        
tbrehm's avatar
tbrehm committed
62
		//* Set local Language File
63
64
65
		$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_'.$this->listDef['name'].'_list.lng';
		if(!file_exists($lng_file)) $lng_file = 'lib/lang/en_'.$this->listDef['name'].'_list.lng';
		include($lng_file);
tbrehm's avatar
tbrehm committed
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
		
		$this->wordbook = $wb;
		
        return true;
    }
		
	/**
    * Get the key => value array of a form filed from a datasource definitiom
    *
    * @param field = array with field definition
    * @param record = Dataset as array
    * @return array key => value array for the value field of a form
    */
    private function getDatasourceData($field)
    {
        global $app;
        $values = array();

        if($field['datasource']['type'] == 'SQL') {

            //** Preparing SQL string. We will replace some common placeholders
            $querystring = $field['datasource']['querystring'];
            $querystring = str_replace('{USERID}', $_SESSION['s']['user']['userid'], $querystring);
            $querystring = str_replace('{GROUPID}', $_SESSION['s']['user']['default_group'], $querystring);
            $querystring = str_replace('{GROUPS}', $_SESSION['s']['user']['groups'], $querystring);
            //TODO:
            //$table_idx = $this->formDef['db_table_idx'];
            //$querystring = str_replace("{RECORDID}",$record[$table_idx],$querystring);
			$app->uses('tform');
            $querystring = str_replace("{AUTHSQL}",$app->tform->getAuthSQL('r'),$querystring);
96
97
            $querystring = str_replace("{AUTHSQL-A}",$app->tform->getAuthSQL('r','a'),$querystring);
            $querystring = str_replace("{AUTHSQL-B}",$app->tform->getAuthSQL('r','b'),$querystring);
tbrehm's avatar
tbrehm committed
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

            //* Getting the records
            $tmp_records = $app->db->queryAllRecords($querystring);
            if($app->db->errorMessage != '') die($app->db->errorMessage);
            if(is_array($tmp_records)) {
                $key_field = $field['datasource']['keyfield'];
                $value_field = $field['datasource']['valuefield'];
                foreach($tmp_records as $tmp_rec) {
                    $tmp_id = $tmp_rec[$key_field];
                    $values[$tmp_id] = $tmp_rec[$value_field];
                }
            }
        }

        if($field['datasource']['type'] == 'CUSTOM') {
            //* Calls a custom class to validate this record
            if($field['datasource']['class'] != '' and $field['datasource']['function'] != '') {
                $datasource_class = $field['datasource']['class'];
                $datasource_function = $field['datasource']['function'];
                $app->uses($datasource_class);
				$record = array();
                $values = $app->$datasource_class->$datasource_function($field, $record);
            } else {
fantu's avatar
fantu committed
121
                $this->errorMessage .= "Custom datasource class or function is empty<br />\r\n";
tbrehm's avatar
tbrehm committed
122
123
124
125
126
127
128
            }
        }
        return $values;
    }

    public function getSearchSQL($sql_where = '') 
    {
129
        global $app, $db;
tbrehm's avatar
tbrehm committed
130
131
132
133

        //* Get config variable
        $list_name = $this->listDef['name'];
        $search_prefix = $this->listDef['search_prefix'];
134
135
136
137
138
		
		if(isset($_REQUEST['Filter']) && !isset($_SESSION['search'][$list_name])) {
			//* Jump back to page 1 of the list when a new search gets started.
			$_SESSION['search'][$list_name]['page'] = 0;
		}
tbrehm's avatar
tbrehm committed
139
140

        //* store retrieval query
141
142
143
144
145
146
147
148
149
150
151
        if(@is_array($this->listDef['item'])) { 
            foreach($this->listDef['item'] as $i) {
                $field = $i['field'];

                //* The search string has been changed
                if(isset($_REQUEST[$search_prefix.$field]) && isset($_SESSION['search'][$list_name][$search_prefix.$field]) && $_REQUEST[$search_prefix.$field] != $_SESSION['search'][$list_name][$search_prefix.$field]){
                        $this->searchChanged = 1;
					    
					    //* Jump back to page 1 of the list when search has changed.
					    $_SESSION['search'][$list_name]['page'] = 0;
                }
tbrehm's avatar
tbrehm committed
152

153
                //* Store field in session
154
                if(isset($_REQUEST[$search_prefix.$field]) && !stristr($_REQUEST[$search_prefix.$field],"'")){
155
                    $_SESSION['search'][$list_name][$search_prefix.$field] = $_REQUEST[$search_prefix.$field];
156
157
					if(preg_match("/['\\\\]/", $_SESSION['search'][$list_name][$search_prefix.$field])) $_SESSION['search'][$list_name][$search_prefix.$field] = '';
				}
tbrehm's avatar
tbrehm committed
158

159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
                if(isset($i['formtype']) && $i['formtype'] == 'SELECT'){
                    if(is_array($i['value'])) {
                        $out = '<option value=""></option>';
                        foreach($i['value'] as $k => $v) {
                            // TODO: this could be more elegant
                            $selected = (isset($_SESSION['search'][$list_name][$search_prefix.$field]) 
                                            && $k == $_SESSION['search'][$list_name][$search_prefix.$field] 
                                            && $_SESSION['search'][$list_name][$search_prefix.$field] != '')
                                            ? ' SELECTED' : '';
                            $out .= "<option value='$k'$selected>$v</option>\r\n";
                        }
                    }
                        $this->searchValues[$search_prefix.$field] = $out;
                } else {
                    if(isset($_SESSION['search'][$list_name][$search_prefix.$field])){
                        $this->searchValues[$search_prefix.$field] = htmlspecialchars($_SESSION['search'][$list_name][$search_prefix.$field]);
tbrehm's avatar
tbrehm committed
175
176
177
178
179
                    }
                }
            }
        }
        //* Store variables in object | $this->searchValues = $_SESSION["search"][$list_name];
180
181
182
183
184
        if(@is_array($this->listDef['item'])) { 
            foreach($this->listDef['item'] as $i) {
                $field = $i['field'];
                // if($_REQUEST[$search_prefix.$field] != '') $sql_where .= " $field ".$i["op"]." '".$i["prefix"].$_REQUEST[$search_prefix.$field].$i["suffix"]."' and";
		        if(isset($_SESSION['search'][$list_name][$search_prefix.$field]) && $_SESSION['search'][$list_name][$search_prefix.$field] != ''){
185
                    $sql_where .= " $field ".$i['op']." '".$app->db->quote($i['prefix'].$_SESSION['search'][$list_name][$search_prefix.$field].$i['suffix'])."' and";
186
                }
tbrehm's avatar
tbrehm committed
187
188
189
190
191
192
193
194
            }
        }
        return ( $sql_where != '' ) ? $sql_where = substr($sql_where,0,-3) : '1';
    }

    public function getPagingSQL($sql_where = '1') 
    {
        global $app, $conf;
195
196
        
        //* Add Global Limit from selectbox
197
198
        if(!empty($_POST['search_limit']) AND $app->functions->intval($_POST['search_limit'])){
			$_SESSION['search']['limit'] = $app->functions->intval($_POST['search_limit']);
199
		}
tbrehm's avatar
tbrehm committed
200
201
202
203

        //* Get Config variables
        $list_name          = $this->listDef['name'];
        $search_prefix      = $this->listDef['search_prefix'];
204
        $records_per_page   = (empty($_SESSION['search']['limit']) ? $app->functions->intval($this->listDef['records_per_page']) : $app->functions->intval($_SESSION['search']['limit'])) ;
tbrehm's avatar
tbrehm committed
205
206
207
208
209
210
211
212
        $table              = $this->listDef['table'];

        //* set PAGE to zero, if in session not set
        if(!isset($_SESSION['search'][$list_name]['page']) || $_SESSION['search'][$list_name]['page'] == ''){
            $_SESSION['search'][$list_name]['page'] = 0;
        }

        //* set PAGE to worth request variable "PAGE" - ? setze page auf wert der request variablen "page"
213
        if(isset($_REQUEST["page"])) $_SESSION["search"][$list_name]["page"] = $app->functions->intval($_REQUEST["page"]);
tbrehm's avatar
tbrehm committed
214
215
216
217

        //* 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;

218
        $sql_von = $app->functions->intval($_SESSION['search'][$list_name]['page'] * $records_per_page);
tbrehm's avatar
tbrehm committed
219
        $record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM $table WHERE $sql_where");
220
        $pages = $app->functions->intval(($record_count['anzahl'] - 1) / $records_per_page);
tbrehm's avatar
tbrehm committed
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245


        $vars['list_file']      = $_SESSION['s']['module']['name'].'/'.$this->listDef['file'];
        $vars['page']           = $_SESSION['search'][$list_name]['page'];
        $vars['last_page']      = $_SESSION['search'][$list_name]['page'] - 1;
        $vars['next_page']      = $_SESSION['search'][$list_name]['page'] + 1;
        $vars['pages']          = $pages;
        $vars['max_pages']      = $pages + 1;
        $vars['records_gesamt'] = $record_count['anzahl'];
        $vars['page_params']    = (isset($this->listDef['page_params'])) ? $this->listDef['page_params'] : '';
        //$vars['module'] = $_SESSION['s']['module']['name'];

        if($_SESSION['search'][$list_name]['page'] > 0) $vars['show_page_back'] = 1;
        if($_SESSION['search'][$list_name]['page'] <= $vars['pages'] - 1) $vars['show_page_next'] = 1;

        $this->pagingValues = $vars;
        $this->pagingHTML = $this->getPagingHTML($vars);

        //* Return limit sql
        return "LIMIT $sql_von, $records_per_page";
    }

    public function getPagingHTML($vars)
    {
        global $app;
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
        
        // we want to show at max 17 page numbers (8 left, current, 8 right)
        $show_pages_count = 17;
        
        $show_pages = array(0); // first page
        if($vars['pages'] > 0) $show_pages[] = $vars['pages']; // last page
        for($p = $vars['page'] - 2; $p <= $vars['page'] + 2; $p++) { // surrounding pages
            if($p > 0 && $p < $vars['pages']) $show_pages[] = $p;
        }
        
        $l_start = $vars['page'] - 13;
        $l_start -= ($l_start % 10) + 1;
        $h_end = $vars['page'] + 23;
        $h_end -= ($h_end % 10) + 1;
        for($p = $l_start; $p <= $h_end; $p += 10) { // surrounding pages
            if($p > 0 && $p < $vars['pages'] && !in_array($p, $show_pages, true) && count($show_pages) < $show_pages_count) $show_pages[] = $p;
        }
        
        $l_start = $vars['page'] - 503;
        $l_start -= ($l_start % 100) + 1;
        $h_end = $vars['page'] + 603;
        $h_end -= ($h_end % 100) + 1;
        for($p = $l_start; $p <= $h_end; $p += 100) { // surrounding pages
            if($p > 0 && $p < $vars['pages'] && !in_array($p, $show_pages, true) && count($show_pages) < $show_pages_count) $show_pages[] = $p;
        }
        
        $l_start = $vars['page'] - 203;
        $l_start -= ($l_start % 25) + 1;
        $h_end = $vars['page'] + 228;
        $h_end -= ($h_end % 25) + 1;
        for($p = $l_start; $p <= $h_end; $p += 25) { // surrounding pages
            if($p > 0 && $p < $vars['pages'] && abs($p - $vars['page']) > 30 && !in_array($p, $show_pages, true) && count($show_pages) < $show_pages_count) $show_pages[] = $p;
        }
        
        sort($show_pages);
        $show_pages = array_unique($show_pages);
        
tbrehm's avatar
tbrehm committed
283
284
        //* Show Back 
        if(isset($vars['show_page_back']) && $vars['show_page_back'] == 1){
285
286
287
        $content = '<a class="btn-page first-page" href="'."javascript:loadContent('".$vars['list_file'].'?page=0'.$vars['page_params']."');".'">'
                    .'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow_stop_180.png"></a> &nbsp; ';
            $content .= '<a class="btn-page previous-page" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$vars['last_page'].$vars['page_params']."');".'">'
288
                        .'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow_180.png"></a> &nbsp; ';
tbrehm's avatar
tbrehm committed
289
        }
290
291
292
293
294
295
296
297
        $content .= ' '.$this->lng('page_txt').' ';
        $prev = -1;
        foreach($show_pages as $p) {
            if($prev != -1 && $p > $prev + 1) $content .= '<span class="page-spacer">...</span>';
            $content .= '<a class="link-page' . ($p == $vars['page'] ? ' current-page' : '') . '" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$p.$vars['page_params']."');".'">'. ($p+1) .'</a>';
            $prev = $p;
        }
        //.$vars['next_page'].' '.$this->lng('page_of_txt').' '.$vars['max_pages'].' &nbsp; ';
tbrehm's avatar
tbrehm committed
298
299
        //* Show Next
        if(isset($vars['show_page_next']) && $vars['show_page_next'] == 1){
300
            $content .= '<a class="btn-page next-page" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$vars['next_page'].$vars['page_params']."');".'">'
tbrehm's avatar
tbrehm committed
301
                        .'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow.png"></a> &nbsp; ';
302
        $content .= '<a class="btn-page last-page" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$vars['pages'].$vars['page_params']."');".'">'
tbrehm's avatar
tbrehm committed
303
                    .'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow_stop.png"></a>';
304
        }
tbrehm's avatar
tbrehm committed
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
        return $content;
    }
		
	public function getPagingHTMLasTXT($vars)
    {
        global $app;
        $content = '[<a href="'.$vars['list_file'].'?page=0'.$vars['page_params'].'">|&lt;&lt; </a>]';
        if($vars['show_page_back'] == 1){
            $content .= '[<< <a href="'.$vars['list_file'].'?page='.$vars['last_page'].$vars['page_params'].'">'.$app->lng('page_back_txt').'</a>] ';
        }
        $content .= ' '.$this->lng('page_txt').' '.$vars['next_page'].' '.$this->lng('page_of_txt').' '.$vars['max_pages'].' ';
        if($vars['show_page_next'] == 1){
            $content .= '[<a href="'.$vars['list_file'].'?page='.$vars['next_page'].$vars['page_params'].'">'.$app->lng('page_next_txt').' >></a>] ';
        }
        $content .= '[<a href="'.$vars['list_file'].'?page='.$vars['pages'].$vars['page_params'].'"> &gt;&gt;|</a>]';
        return $content;
    }

    public function getSortSQL()
    {
        global $app, $conf;
        //* Get config vars
        $sort_field = $this->listDef['sort_field'];
        $sort_direction = $this->listDef['sort_direction'];
        return ($sort_field != '' && $sort_direction != '') ? "ORDER BY $sort_field $sort_direction" : '';
    }

    public function decode($record) 
    {
334
        global $conf, $app;
335
        if(is_array($record) && count($record) > 0 && is_array($this->listDef['item'])) {
tbrehm's avatar
tbrehm committed
336
337
            foreach($this->listDef['item'] as $field){
                $key = $field['field'];
338
339
340
341
342
                //* 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');
                }
tbrehm's avatar
tbrehm committed
343
344
345
346
				if(isset($record[$key])) {
                	switch ($field['datatype']){
                    case 'VARCHAR':
                    case 'TEXT':
redray's avatar
redray committed
347
                        $record[$key] = htmlentities(stripslashes($record[$key]),ENT_QUOTES,$conf["html_content_encoding"]);
tbrehm's avatar
tbrehm committed
348
349
                         break;

350
351
352
                    case 'DATETSTAMP':
                        if ($record[$key] > 0) {
							// is value int?
353
							if (preg_match("/^[0-9]+[\.]?[0-9]*$/", $record[$key], $p)) {
354
355
356
357
358
359
360
	                        	$record[$key] = date($this->lng('conf_format_dateshort'), $record[$key]);
							} else {
	                        	$record[$key] = date($this->lng('conf_format_dateshort'), strtotime($record[$key]));
							}
						}
                        break;
					case 'DATE':
redray's avatar
redray committed
361
362
                        if ($record[$key] > 0) {
							// is value int?
363
							if (preg_match("/^[0-9]+[\.]?[0-9]*$/", $record[$key], $p)) {
redray's avatar
redray committed
364
365
366
367
368
369
370
371
372
373
	                        	$record[$key] = date($this->lng('conf_format_dateshort'), $record[$key]);
							} else {
	                        	$record[$key] = date($this->lng('conf_format_dateshort'), strtotime($record[$key]));
							}
						}
                        break;
                        
                    case 'DATETIME':
                        if ($record[$key] > 0) {
							// is value int?
374
							if (preg_match("/^[0-9]+[\.]?[0-9]*$/", $record[$key], $p)) {
redray's avatar
redray committed
375
376
377
378
379
	                        	$record[$key] = date($this->lng('conf_format_datetime'), $record[$key]);
							} else {
	                        	$record[$key] = date($this->lng('conf_format_datetime'), strtotime($record[$key]));
							}
						}
tbrehm's avatar
tbrehm committed
380
381
382
                        break;

                    case 'INTEGER':
383
                        $record[$key] = $app->functions->intval($record[$key]);
tbrehm's avatar
tbrehm committed
384
385
386
                        break;

                    case 'DOUBLE':
redray's avatar
redray committed
387
                        $record[$key] = htmlentities($record[$key],ENT_QUOTES,$conf["html_content_encoding"]);
tbrehm's avatar
tbrehm committed
388
389
390
                        break;

                    case 'CURRENCY':
391
                        $record[$key] = $app->functions->currency_format($record[$key]);
tbrehm's avatar
tbrehm committed
392
393
394
                        break;

                    default:
redray's avatar
redray committed
395
                        $record[$key] = htmlentities(stripslashes($record[$key]),ENT_QUOTES,$conf["html_content_encoding"]);
tbrehm's avatar
tbrehm committed
396
397
398
399
400
401
402
403
404
                	}
				}
            }
        }
        return $record;
    }

    public function encode($record)
    {
405
	global $app;
tbrehm's avatar
tbrehm committed
406
407
408
409
410
411
412
413
        if(is_array($record)) {
            foreach($this->listDef['item'] as $field){
                $key = $field['field'];
                switch($field['datatype']){

                    case 'VARCHAR':
                    case 'TEXT':
                        if(!is_array($record[$key])) {
414
                            $record[$key] = $app->db->quote($record[$key]);
tbrehm's avatar
tbrehm committed
415
416
417
418
419
                        } else {
                            $record[$key] = implode($this->tableDef[$key]['separator'],$record[$key]);
                        }
                        break;
                    
420
					case 'DATETSTAMP':
tbrehm's avatar
tbrehm committed
421
                        if($record[$key] > 0) {
redray's avatar
redray committed
422
423
424
						    $record[$key] = date('Y-m-d',strtotime($record[$key]));
                        }
                        break;
425
426
427
428
429
430
					
                    case 'DATE':
                        if($record[$key] != '' && $record[$key] != '0000-00-00') {
						    $record[$key] = $record[$key];
                        }
                        break;
redray's avatar
redray committed
431
432
433
434

                    case 'DATETIME':
                        if($record[$key] > 0) {
						    $record[$key] = date('Y-m-d H:i:s',strtotime($record[$key]));
tbrehm's avatar
tbrehm committed
435
436
437
438
                        }
                        break;

                    case 'INTEGER':
439
                        $record[$key] = $app->functions->intval($record[$key]);
tbrehm's avatar
tbrehm committed
440
441
442
                        break;

                    case 'DOUBLE':
443
                        $record[$key] = $app->db->quote($record[$key]);
tbrehm's avatar
tbrehm committed
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
                        break;

                    case 'CURRENCY':
                        $record[$key] = str_replace(',', '.', $record[$key]);
                        break;
                }
            }
        }
        return $record;
    }
	
	function lng($msg) {
		global $app;
			
		if(isset($this->wordbook[$msg])) {
			return $this->wordbook[$msg];
		} else {
			return $app->lng($msg);
		}	
	}
tbrehm's avatar
tbrehm committed
464
465
	
	function escapeArrayValues($search_values) {
redray's avatar
redray committed
466
	    global $conf;
tbrehm's avatar
tbrehm committed
467
468
469
470
		
		$out = array();
		if(is_array($search_values)) {
			foreach($search_values as $key => $val) {
redray's avatar
redray committed
471
				$out[$key] = htmlentities($val,ENT_QUOTES,$conf["html_content_encoding"]);
tbrehm's avatar
tbrehm committed
472
473
474
475
476
477
			}
		}
		
		return $out;
		
	}
tbrehm's avatar
tbrehm committed
478
479
480

}

481
?>