vpanel-stack/panel/classes/Panel/Vmail/Aliases.php

64 lines
1.7 KiB
PHP
Raw Normal View History

2022-07-01 15:24:26 -07:00
<?php
/**
* vpanel-stack
* https://git.stack-source.com/msb/vpanel-stack
* Copyright (c) 2022 Matthew Saunders Brown <matthewsaundersbrown@gmail.com>
* GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
*/
namespace Panel\Vmail;
class Aliases extends \Panel\Vmail {
function beforeRoute($f3) {
parent::beforeRoute($f3);
$domain = $f3->get('PARAMS.domain');
/* first confirm domain exists */
if ($f3->call('\Panel::vGet', "vmail-domains-get.sh -d $domain -c")) {
/* check if we are looking for specific alias */
if ($f3->exists('PARAMS.alias')) {
$alias = $f3->get('PARAMS.alias');
/* get aliases */
if ($aliases_array = $f3->call('\Panel::vGet', array("vmail-aliases-get.sh -a $alias@$domain -c", FALSE))) {
$f3->set('page_header', "$alias@$domain Aliases");
$f3->set('aliases_array', $aliases_array);
}
} elseif ($f3->exists('PARAMS.mbox')) {
$mbox = $f3->get('PARAMS.mbox');
/* get aliases */
if ($aliases_array = $f3->call('\Panel::vGet', array("vmail-aliases-get.sh -e $mbox@$domain -c", FALSE))) {
$f3->set('page_header', "Aliases for $mbox@$domain");
$f3->set('aliases_array', $aliases_array);
}
} else {
/* get aliases */
if ($aliases_array = $f3->call('\Panel::vGet', array("vmail-aliases-get.sh -d $domain -c", FALSE))) {
$f3->set('page_header', "Email Aliases for $domain");
$f3->set('aliases_array', $aliases_array);
}
}
}
}
public static function get($f3) {
echo \Template::instance()->render('vmail/aliases.html');
}
}