Exemple #1
0
function decode_punycode_mail($mail, $useutf8 = true)
{
    $iPos = strpos($mail, "@");
    if ($iPos !== false) {
        $mailbox = substr($mail, 0, $iPos);
        $domain = substr($mail, $iPos + 1);
        return $mailbox . '@' . decode_punycode_domain($domain, $useutf8);
    } else {
        return $mail;
    }
}
Exemple #2
0
function load_alldomain()
{
    global $domain_config_file;
    global $xml_database_comname;
    global $allow_register;
    $allow_register = false;
    $filename = encode_utf8($domain_config_file);
    $alldomains = array();
    $xml = simplexml_load_file($filename);
    foreach ($xml->domain->item as $item) {
        $domain = array();
        foreach ($item as $key => $value) {
            $key = (string) $key;
            $value = (string) $value;
            switch ($key) {
                case "domain":
                    $domain["domain"] = $value;
                    $domain["dispdomain"] = decode_punycode_domain($value, true);
                    break;
                case "type":
                    $domain["type"] = $value;
                    break;
                case "allowregister":
                    if ($value == 1) {
                        $allow_register = 1;
                    }
                default:
                    $domain[$key] = $value;
                    break;
            }
        }
        $alldomains[] = $domain;
        unset($domain);
    }
    return $alldomains;
}