2022-08-18 14:01:52 +02:00
< ? php
//
// OpenSMTPD Admin
// by Mischa Peters <mischa at high5 dot nl>
// Copyright (c) 2022 High5!
// License Info: LICENSE.TXT
//
// File: search.php
//
// Template File: search.tpl
//
// Template Variables:
//
2022-09-03 10:44:32 +02:00
// list_alias
// list_mailbox
2022-08-18 14:01:52 +02:00
//
// Form POST \ GET Variables:
//
2022-09-03 10:44:32 +02:00
// search
2022-08-18 14:01:52 +02:00
//
2022-09-03 10:44:32 +02:00
require_once '../functions.inc.php' ;
include '../languages/' . check_language () . '.lang' ;
$search = filter_input ( INPUT_POST , 'search' , FILTER_DEFAULT );
if ( isset ( $search )) {
$dbh = connect_db ();
$sth = $dbh -> prepare ( " SELECT alias.address,alias.goto,alias.modified,alias.domain FROM alias LEFT JOIN mailbox ON alias.address=mailbox.username WHERE alias.address LIKE ? AND mailbox.maildir IS NULL ORDER BY alias.address " );
$sth -> bindValue ( 1 , '%' . $search . '%' , PDO :: PARAM_STR );
$sth -> execute ();
$list_alias = $sth -> fetchAll ();
$sth = $dbh -> prepare ( " SELECT * FROM mailbox WHERE username LIKE ? ORDER BY username " );
$sth -> bindValue ( 1 , '%' . $search . '%' , PDO :: PARAM_STR );
$sth -> execute ();
$list_mailbox = $sth -> fetchAll ();
} else {
$list_alias = array ();
$list_mailbox = array ();
2022-08-18 14:01:52 +02:00
}
2022-09-03 10:44:32 +02:00
include '../templates/header.tpl' ;
include '../templates/admin_menu.tpl' ;
include '../templates/admin_search.tpl' ;
include '../templates/footer.tpl' ;
2022-08-18 14:01:52 +02:00
?>