function _showMXLookup() { global $_ARRAYLANG; $this->_objTpl->loadTemplateFile('module_nettools_mxlookup.html'); $this->pageTitle = $_ARRAYLANG['TXT_MX_LOOKUP']; $this->_objTpl->setVariable(array('TXT_MX_LOOKUP' => $_ARRAYLANG['TXT_MX_LOOKUP'], 'TXT_MX_LOOKUP_TEXT' => $_ARRAYLANG['TXT_MX_LOOKUP_TEXT'], 'TXT_PREFERENCE' => $_ARRAYLANG['TXT_PREFERENCE'], 'TXT_HOSTNAME' => $_ARRAYLANG['TXT_HOSTNAME'])); if (isset($_REQUEST['address']) && !empty($_REQUEST['address'])) { $address = strip_tags($_REQUEST['address']); $objMXLookup = new MXLookup(); if ($objMXLookup->getMailServers($address)) { $arrMxRRs = $objMXLookup->arrMXRRs; $rowNr = 0; foreach ($arrMxRRs as $arrMxRR) { $this->_objTpl->setVariable(array('NETTOOLS_MX_LOOKUP_PREFERENCE' => $arrMxRR['PREFERENCE'], 'NETTOOLS_MX_LOOKUP_HOST' => $arrMxRR['EXCHANGE'], 'NETTOOLS_MX_LOOKUP_CLASS' => $rowNr % 2 == 0 ? "row2" : "row1")); $this->_objTpl->parse('mxlookup-list'); $rowNr++; } $this->_objTpl->parse('mxlookup'); $this->_objTpl->hideBlock('mxlookup-error'); } else { $this->_objTpl->setVariable('NETTOOLS_MX_LOOKUP_ERROR', $objMXLookup->errorMsg); $this->_objTpl->hideBlock('mxlookup'); $this->_objTpl->parse('mxlookup-error'); } $this->_objTpl->setVariable('NETTOOLS_MX_LOOKUP_ADDRESS', $address); } else { $this->_objTpl->hideBlock('mxlookup'); $this->_objTpl->hideBlock('mxlookup-error'); } }
function _getMXHosts($email) { $objMXLookup = new \MXLookup(); $host = substr($email, strrpos($email, '@') + 1); if ($objMXLookup->getMailServers($host)) { return $objMXLookup->arrMXRRs; } else { return false; } }