SF.net SVN: postfixadmin:[1354] trunk
Brought to you by:
christian_boltz,
gingerdog
From: <chr...@us...> - 2012-04-08 23:11:52
|
Revision: 1354 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=1354&view=rev Author: christian_boltz Date: 2012-04-08 23:11:46 +0000 (Sun, 08 Apr 2012) Log Message: ----------- list-virtual.php: - use AliasHandler instead of direct SQL queries templates/list-virtual_alias.tpl: - goto is an array now, not a comma-separated string Modified Paths: -------------- trunk/list-virtual.php trunk/templates/list-virtual_alias.tpl Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2012-04-08 23:07:22 UTC (rev 1353) +++ trunk/list-virtual.php 2012-04-08 23:11:46 UTC (rev 1354) @@ -125,9 +125,13 @@ # if ($search == "") { + $list_param = "domain='$fDomain'"; + # sql_domain / sql_where only needed for pagebrowser $sql_domain = " $table_alias.domain='$fDomain' "; $sql_where = ""; } else { + $list_param = "(address LIKE '%$search%' OR goto LIKE '%$search%')"; + # sql_domain / sql_where only needed for pagebrowser $sql_domain = db_in_clause("$table_alias.domain", $list_domains); $sql_where = " AND ( address LIKE '%$search%' OR goto LIKE '%$search%' ) "; } @@ -137,28 +141,24 @@ WHERE $sql_domain AND NOT EXISTS(SELECT 1 FROM $table_mailbox WHERE username=$table_alias.address) $sql_where ORDER BY address "; - +/* $query = " SELECT address, goto, modified, active $alias_pagebrowser_query LIMIT $page_size OFFSET $fDisplay "; +*/ -$result = db_query ($query); -if ($result['rows'] > 0) { - while ($row = db_array ($result['result'])) { - if ('pgsql'==$CONF['database_type']) { - //. at least in my database, $row['modified'] already looks like : 2009-04-11 21:38:10.75586+01, - // while gmstrftime expects an integer value. strtotime seems happy though. - //$row['modified']=gmstrftime('%c %Z',$row['modified']); - $row['modified'] = date('Y-m-d H:i', strtotime($row['modified'])); - $row['active']=('t'==$row['active']) ? 1 : 0; - } - $tAlias[] = $row; - } +$handler = new AliasHandler(0, $admin_username); +if ($handler->getList($list_param, $page_size, $fDisplay)) { + $tAlias = $handler->result(); +} else { + $tAlias= array(); + # TODO: check if there was an error or simply no aliases } + # # mailboxes # @@ -295,7 +295,7 @@ $check_alias_owner = array (); if ((is_array ($tAlias) and sizeof ($tAlias) > 0)) - for ($i = 0; $i < sizeof ($tAlias); $i++) { + foreach (array_keys($tAlias) as $i) { $gen_show_status [$i] = gen_show_status($tAlias[$i]['address']); $check_alias_owner [$i] = check_alias_owner($admin_username, $tAlias[$i]['address']); } Modified: trunk/templates/list-virtual_alias.tpl =================================================================== --- trunk/templates/list-virtual_alias.tpl 2012-04-08 23:07:22 UTC (rev 1353) +++ trunk/templates/list-virtual_alias.tpl 2012-04-08 23:11:46 UTC (rev 1354) @@ -24,11 +24,15 @@ <td><i>sorry, alias_goto_limit > 0 not handled</i></td> {else} <td> + {foreach key=key2 item=singlegoto from=$item.goto} + {if $search eq ""} - {$item.goto|replace:",":"<br/>"} + {$singlegoto}<br /> {else} - {$item.goto|replace:",":"<br/>"|replace:$search:"<span class='searchresult'>$search</span>"} + {$singlegoto|replace:$search:"<span class='searchresult'>$search</span>"}<br /> {/if} + + {/foreach} </td> {/if} <td>{$item.modified}</td> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |