// Copyright (c) 2022 High5! // License Info: LICENSE.TXT // // File: list-virtual.php // // Template File: admin_list-virtual.tpl // // Template Variables: // // list_alias // list_mailbox // // Form GET Variables: // // domain // offset // require_once '../functions.inc.php'; include '../languages/' . check_language() . '.lang'; $list_domains = list_domains(); $dbh = new PDO(DB_TYPE . ':host='. DB_HOST . ';dbname='. DB_NAME , DB_USER, DB_PASS); if ($_SERVER['REQUEST_METHOD'] == "GET") { $offset = filter_input(INPUT_GET, 'offset', FILTER_VALIDATE_INT) ?? '0'; $limit = PAGE_SIZE; if (count($list_domains) > 0) { $domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN) ?? $list_domains[0]['domain']; $selected_domain = array_search($domain, array_column($list_domains, 'domain')); if ($CONF['alias_control'] == "NO") { $sth = $dbh->prepare("SELECT alias.address,alias.goto,alias.modified FROM alias LEFT JOIN mailbox ON alias.address=mailbox.username WHERE alias.domain=? AND mailbox.maildir IS NULL ORDER BY alias.address LIMIT ?, ?"); } else { $sth = $dbh->prepare("SELECT alias.address,alias.goto,alias.modified FROM alias WHERE alias.domain=? ORDER BY alias.address LIMIT ?, ?"); } $sth->bindParam(1, $domain, PDO::PARAM_STR); $sth->bindParam(2, $offset, PDO::PARAM_INT); $sth->bindParam(3, $limit, PDO::PARAM_INT); $sth->execute(); $list_alias = $sth->fetchAll(); $sth = $dbh->prepare("SELECT * FROM mailbox WHERE domain=? ORDER BY username LIMIT ?, ?"); $sth->bindParam(1, $domain, PDO::PARAM_STR); $sth->bindParam(2, $offset, PDO::PARAM_INT); $sth->bindParam(3, $limit, PDO::PARAM_INT); $sth->execute(); $list_mailbox = $sth->fetchAll(); } } include '../templates/header.tpl'; include '../templates/admin_menu.tpl'; include '../templates/admin_list-virtual.tpl'; include '../templates/footer.tpl'; ?>