summaryrefslogtreecommitdiff
path: root/includes/general.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/general.php')
-rw-r--r--includes/general.php40
1 files changed, 27 insertions, 13 deletions
diff --git a/includes/general.php b/includes/general.php
index ac2e597..065daaa 100644
--- a/includes/general.php
+++ b/includes/general.php
@@ -538,20 +538,34 @@
if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\+\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/" , $email))
{
list($username,$domain)=explode('@',$email,2);
- $dom = escapeshellarg($domain);
- $line = trim(shell_exec("dig +short MX $dom 2>&1"));
-#echo $email."-$dom-$line-\n";
-#echo shell_exec("dig +short mx heise.de 2>&1")."-<br>\n";
-
- $list = explode("\n", $line);
- foreach($list as $row) {
- if(!strstr($row, " ")) {
- continue;
+ $mxhosts = array();
+ $mxweight = array();
+ if( !getmxrr($domain, $mxhosts, $mxweight) ) {
+ $mxhostrr = array($domain);
+ $mxweight = array(0);
+ } else if ( empty($mxhosts) ) {
+ $mxhostrr = array($domain);
+ $mxweight = array(0);
+ }
+
+ $mxhostprio = array();
+ for($i = 0; $i < count($mxhostrr); $i++) {
+ $mx_host = trim($mxhostrr[$i], '.');
+ $mx_prio = $mxweight[$i];
+ if(empty($mxhostprio[$mx_prio])) {
+ $mxhostprio[$mx_prio] = arraY();
+ }
+ $mxhostprio[$mx_prio][] = $mx_host;
+ }
+
+ array_walk($mxhostprio, function(&$mx) { shuffle($mx); } );
+
+ $mxhosts = array();
+ foreach($mxhostprio as $mx_prio => $mxhostnames) {
+ foreach($mxhostnames as $mx_host) {
+ $mxhosts[] = $mx_host;
}
- list($pri, $mxhosts[]) = explode(" ", trim($row), 2);
}
- $mxhosts[] = $domain;
- array_walk($mxhosts, function(&$mx) { $mx = trim($mx, '.'); } );
foreach($mxhosts as $key => $domain)
{
@@ -665,7 +679,7 @@
function sanitizeHTML($input)
{
- return htmlentities(strip_tags($input), ENT_QUOTES);
+ return htmlentities(strip_tags($input), ENT_QUOTES, 'ISO-8859-1');
//In case of problems, please use the following line again:
//return htmlentities(strip_tags(utf8_decode($input)), ENT_QUOTES);
//return htmlspecialchars(strip_tags($input));