* GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) */ namespace Panel\Vdns; class Zones extends \Panel\Vdns { /* use this to make query */ function beforeRoute($f3) { parent::beforeRoute($f3); if ($f3->exists('PARAMS.zone')) { $zone = $f3->get('PARAMS.zone'); if ($f3->call('\Panel\Vdns::verifyZoneExists', $zone)) { if ($zone_array = $f3->call('\Panel::vGet', array("vdns-zone-exp.sh -z $zone -c", FALSE))) { $f3->set('zone_array', $zone_array); } $ns_info_array = array(); $ns_info_array['zone'] = $zone; $ns_info_array['status'] = $f3->call('\Panel\Vdns::returnNameserverStatus', $zone); if ($ns_info_array['status'] != "Verified") { $ns_info_array['defaults_ns_array'] = $f3->call('\Panel\Vdns::returnZoneDefaultsNameserverArray', $zone); $ns_info_array['ns_array'] = $f3->call('\Panel\Vdns::returnNameserverArray', $zone); } $f3->set('ns_info_array', $ns_info_array); } } else { if ($zones_array = $f3->call('\Panel::vGet', array("vdns-zone-lst.sh", FALSE))) { foreach ($zones_array as $k=>$zone_array) { $zones_array[$k]['ns_status'] = $f3->call('\Panel\Vdns::returnNameserverStatus', $zone_array['zone']); } $f3->set('zones_array', $zones_array); } } } static function get($f3) { if ($f3->exists('PARAMS.zone')) { $zone = $f3->get('PARAMS.zone'); if (is_array($f3->get('zone_array'))) { $f3->set('page_header', "DNS Zone records for $zone"); echo \Template::instance()->render('vdns/zones-zone.html'); } else { $messages[] = "Zone $zone not found."; $f3->set('SESSION.messages', $messages); $f3->reroute("/DNS"); } } else { $f3->set('page_header', "DNS Zones"); echo \Template::instance()->render('vdns/zones.html'); } } }