* GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) */ namespace Panel\Vmail; class Dkim extends \Panel\Vmail { /* use this to make query */ function beforeRoute($f3) { parent::beforeRoute($f3); if ($f3->exists('PARAMS.domain')) { $domain = $f3->get('PARAMS.domain'); $dkim_array = array(); if ($f3->call('\Panel::verifyDkimExists', $domain)) { if ($dkim_array = $f3->call('\Panel::vGet', array("vmail-dkim-get.sh -d $domain -c", FALSE))) { $dkim_array = $dkim_array[0]; $dkim_array['dns']['host'] = $dkim_array['selector'] . "._domainkey.$domain"; if ($dns_txt_records = dns_get_record($dkim_array['dns']['host'], DNS_TXT)) { $dkim_array['dns']['status'] = "Verified"; } else { $dkim_array['dns']['status'] = "Update"; } } else { $dkim_array['dns']['status'] = "Error"; } } else { $dkim_array['dns']['status'] = "Create"; } $f3->set('dkim_array', $dkim_array); } else { $messages = $f3->get('SESSION.messages'); $messages[] = "Domain not set, must specify domain for DKIM info."; $f3->set('SESSION.messages', $messages); $f3->reroute('/'); } } static function get($f3) { if ($f3->exists('PARAMS.domain')) { $domain = $f3->get('PARAMS.domain'); $f3->set('page_header', "DKIM Details for $domain"); } else { $messages = $f3->get('SESSION.messages'); $messages[] = "Domain not set, must specify domain for DKIM info."; $f3->set('SESSION.messages', $messages); } echo \Template::instance()->render('vmail/dkim.html'); } }