diff --git a/configs/menu.conf b/configs/menu.conf index aab8168a..288c3b08 100644 --- a/configs/menu.conf +++ b/configs/menu.conf @@ -38,8 +38,8 @@ tr_header = tr_hilightoff = url_delete = delete.php -url_search = search.php -form_search =
+url_search = list-virtual.php +form_search =
[main] _txt_list_domain = pMenu_overview diff --git a/list-virtual.php b/list-virtual.php index f3477fa1..732b74e1 100644 --- a/list-virtual.php +++ b/list-virtual.php @@ -279,6 +279,16 @@ $tCanAddAlias = false; $tCanAddMailbox = false; # TODO: needs reworking for $search... +# TODO: (= bug: no page browser displayed in search mode!) - https://sourceforge.net/tracker/?func=detail&aid=2782818&group_id=191583&atid=937964 +# for non-search mode, get_domain_properties counts the aliases and mailboxes +# Options: +# a) +# if ($search == "") -> get_domain_properties +# else -> "manual count" +# b) +# "manual count" for all cases (not really more work, queries are similar) +# +# Note: get_domain_properties also creates the page browser (which needs performance tuning anyway...) $limit = get_domain_properties($fDomain); if (isset ($limit)) { if ($fDisplay >= $page_size) { diff --git a/search.php b/search.php deleted file mode 100644 index ec6a0854..00000000 --- a/search.php +++ /dev/null @@ -1,188 +0,0 @@ - 0) -{ - while ($row = db_array ($result['result'])) - { - if (check_owner ($SESSID_USERNAME, $row['domain']) || authentication_has_role('global-admin')) - { - if ('pgsql'==$CONF['database_type']) - { - $row['modified']=gmstrftime('%c %Z',$row['modified']); - $row['active']=('t'==$row['active']) ? 1 : 0; - } - $tAlias[] = $row; - } - } -} - - -if ($CONF['vacation_control_admin'] == 'YES' && $CONF['vacation'] == 'YES') -{ - $query = ("SELECT $table_mailbox.*, $table_vacation.active AS v_active FROM $table_mailbox LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email WHERE $table_mailbox.username LIKE '%$fSearch%' OR $table_mailbox.name LIKE '%$fSearch%' ORDER BY $table_mailbox.username"); -} -else -{ - $query = "SELECT * FROM $table_mailbox WHERE username LIKE '%$fSearch%' OR name LIKE '%$fSearch%' ORDER BY username"; -} - -$result = db_query ($query); -if ($result['rows'] > 0) -{ - while ($row = db_array ($result['result'])) - { - if (check_owner ($SESSID_USERNAME, $row['domain']) || authentication_has_role('global-admin')) - { - if ('pgsql'==$CONF['database_type']) - { - $row['created']=gmstrftime('%c %Z',strtotime($row['created'])); - $row['modified']=gmstrftime('%c %Z',strtotime($row['modified'])); - $row['active']=('t'==$row['active']) ? 1 : 0; - } - $tMailbox[] = $row; - } - } -} - -$check_alias_owner = array (); - -if ((is_array ($tAlias) and sizeof ($tAlias) > 0)) - for ($i = 0; $i < sizeof ($tAlias); $i++) - $check_alias_owner [$i] = check_alias_owner ($SESSID_USERNAME, $tAlias[$i]['address']); - -$divide_quota = array (); -if ((is_array ($tMailbox) and sizeof ($tMailbox) > 0)) - for ($i = 0; $i < sizeof ($tMailbox); $i++) - { - $divide_quota ['quota'][$i] = divide_quota ($tMailbox[$i]['quota']); - } - -for ($i = 0; $i < sizeof ($tAlias); $i++) -{ - if ((is_array ($tAlias) and sizeof ($tAlias) > 0)) - { - $tAlias[$i]['display_address'] = $tAlias[$i]['address']; - if (stristr($tAlias[$i]['display_address'],$fSearch)) - { - $new_address = str_ireplace($fSearch, "".$fSearch."", $tAlias[$i]['display_address']); - $tAlias[$i]['display_address'] = $new_address; - } - if (stristr($tAlias[$i]['goto'], $fSearch)) - { - $tAlias[$i]['goto'] = str_ireplace($fSearch, "".$fSearch."", $tAlias[$i]['goto']); - } - ($tAlias [$i]['active'] == 1) ? $tAlias [$i]['active'] = $PALANG ['YES'] : $tAlias [$i]['active'] = $PALANG ['NO']; - } -} -for ($i = 0; $i < sizeof ($tMailbox); $i++) -{ - if ((is_array ($tMailbox) and sizeof ($tMailbox) > 0)) - { - $tMailbox[$i]['display_username'] = $tMailbox[$i]['username']; - if (stristr($tMailbox[$i]['display_username'],$fSearch)) - { - $new_name = str_ireplace ($fSearch, "".$fSearch."", $tMailbox[$i]['display_username']); - $tMailbox [$i]['display_username'] = $new_name; - } - if (stristr($tMailbox[$i]['name'],$fSearch)) - { - $tMailbox[$i]['name'] = str_ireplace($fSearch, "".$fSearch."", $tMailbox[$i]['name']); - } - ($tMailbox [$i]['active'] == 1) ? $tMailbox [$i]['active'] = $PALANG ['YES'] : $tMailbox [$i]['active'] = $PALANG ['NO']; - ($tMailbox [$i]['v_active'] == 1) ? $tMailbox [$i]['v_active'] = $PALANG ['pOverview_vacation_edit'] : $tMailbox [$i]['v_active'] = ''; - } -} - -$smarty->assign ('fSearch', $fSearch); -$smarty->assign ('select_options', select_options ($list_domains, array ($list_domains[0])), false); -$smarty->assign ('tAlias', $tAlias, false); - -$smarty->assign ('check_alias_owner', $check_alias_owner); -$smarty->assign ('tMailbox', $tMailbox, false); -$smarty->assign ('divide_quota', $divide_quota); - -$smarty->assign ('smarty_template', 'search'); -$smarty->display ('index.tpl'); - -/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ -?> diff --git a/templates/list-virtual.tpl b/templates/list-virtual.tpl index 841b358e..70e8f123 100644 --- a/templates/list-virtual.tpl +++ b/templates/list-virtual.tpl @@ -14,10 +14,10 @@
diff --git a/templates/search.tpl b/templates/search.tpl deleted file mode 100644 index fae5f731..00000000 --- a/templates/search.tpl +++ /dev/null @@ -1,96 +0,0 @@ -
-
- - - - -{if $authentication_has_role.global_admin} - -{/if} - -{else} - -{/if} - -
-

{$PALANG.pSearch_welcome}{$fSearch}

-
{$PALANG.pSearch}: - -{if $authentication_has_role.global_admin} -
-
-
-{if $tAlias} - - - - - {#tr_header#} - - - - - - - {foreach from=$tAlias item=item key=i} - {#tr_hilightoff#} - - - - {if $CONF.special_alias_control===YES || $authentication_has_role.global_admin} - - - - {else} - {if $check_alias_owner[$i]} - - - - {else} - - - {/if} - {/if} - - {/foreach} -

{$PALANG.pOverview_alias_title}

{$PALANG.pOverview_alias_address}{$PALANG.pOverview_alias_goto}{$PALANG.pOverview_alias_modified}{$PALANG.pOverview_alias_active} 
{$item.display_address}{$item.goto}{$item.modified}{$item.active}{$PALANG.edit}{$PALANG.del}{$item.active}{$PALANG.edit}{$PALANG.del}  
-{/if} -{if $tMailbox} - - - - - - - - {if $CONF.quota===YES}{/if} - - - - {assign var="colspan" value=2} - {if $CONF.vacation_control_admin===YES}{assign var="colspan" value=$colspan+1}{/if} - {if $CONF.alias_control_admin===YES}{assign var="colspan" value=$colspan+1}{/if} - {if $authentication_has_role.global_admin && $CONF.alias_control===YES}{assign var="colspan" value=3}{/if} - - - {foreach from=$tMailbox item=item key=i} - {#tr_hilightoff#} - - - {if $CONF.quota===YES} - - {/if} - - - {if $CONF.vacation_control_admin===YES} - - {/if} - {if $CONF.alias_control===YES || $CONF.alias_control_admin===YES} - - {/if} - - - - {/foreach} -

{$PALANG.pOverview_mailbox_title}

{$PALANG.pOverview_mailbox_username}{$PALANG.pOverview_mailbox_name}{$PALANG.pOverview_mailbox_quota}{$PALANG.pOverview_mailbox_modified}{$PALANG.pOverview_mailbox_active}  
{$item.display_username}{$item.name}{$divide_quota.quota[$i]}{$item.modified}{$item.active}{$item.v_active}{$PALANG.pOverview_alias_edit}{$PALANG.edit}{$PALANG.del}
-{/if}