57 lines
1.3 KiB
PHP
57 lines
1.3 KiB
PHP
<?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\Vhost;
|
|
|
|
class Vhosts extends \Panel\Vhost {
|
|
|
|
/* use this to make query */
|
|
function beforeRoute($f3) {
|
|
|
|
parent::beforeRoute($f3);
|
|
|
|
if ($f3->exists('PARAMS.vhost')) {
|
|
$vhost = $f3->get('PARAMS.vhost');
|
|
if ($vhost_array = $f3->call('\Panel::vGet', array("vhost-get.sh -d $vhost -c", FALSE))) {
|
|
$f3->set('vhost_array', $vhost_array[0]);
|
|
}
|
|
} else {
|
|
if ($vhosts_array = $f3->call('\Panel::vGet', array("vhost-get.sh -c", FALSE))) {
|
|
$f3->set('vhosts_array', $vhosts_array);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
static function get($f3) {
|
|
|
|
if ($f3->exists('PARAMS.vhost')) {
|
|
|
|
$vhost_array = $f3->get('vhost_array');
|
|
|
|
/* convert data for frontend display */
|
|
// nothing to convert
|
|
|
|
$f3->set('vhost_array', $vhost_array);
|
|
|
|
$vhost = $f3->get('PARAMS.vhost');
|
|
$f3->set('page_header', "Website Hosting for $vhost");
|
|
echo \Template::instance()->render('vhost/vhosts-vhost.html');
|
|
|
|
} else {
|
|
|
|
$f3->set('page_header', "Websites");
|
|
echo \Template::instance()->render('vhost/vhosts.html');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|