Example #1
0
 | Author: Jon LaBass                                                      |
 +-------------------------------------------------------------------------+
*/
$map = isset($_GET['map']) ? strtolower($_GET['map']) : 'forward';
/** Include module variables */
if (isset($_SESSION['module'])) {
    include ABSPATH . 'fm-modules/' . $_SESSION['module'] . '/variables.inc.php';
}
$default_record_type = $map == 'reverse' ? 'PTR' : 'A';
if (isset($_GET['record_type'])) {
    $record_type = strtoupper($_GET['record_type']);
} else {
    $record_type = $default_record_type;
}
$domain_id = isset($_GET['domain_id']) ? $_GET['domain_id'] : header('Location: ' . getMenuURL(__('Zones')));
if (!isValidDomain($domain_id)) {
    header('Location: ' . getMenuURL(__('Zones')));
}
/** Does the user have access? */
if (!currentUserCan(array('access_specific_zones', 'view_all'), $_SESSION['module'], array(0, $domain_id))) {
    unAuth();
}
if (in_array($record_type, $__FM_CONFIG['records']['require_zone_rights']) && !currentUserCan('manage_zones', $_SESSION['module'])) {
    unAuth();
}
if ($record_type == 'SOA') {
    if (getNameFromID($domain_id, 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'domains', 'domain_', 'domain_id', 'domain_clone_domain_id')) {
        $record_type = $default_record_type;
    } elseif (getNameFromID($domain_id, 'fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'domains', 'domain_', 'domain_id', 'domain_template_id')) {
        $record_type = $default_record_type;
    }
function isValidForParser($rel = 0, $comp = 'A', $realpath)
{
    $path = "license/license.txt";
    if ($rel == "1") {
        $path = "{$realpath}/license/license.txt";
    }
    if ($fp = @fopen($path, "r")) {
        $buffer = fread($fp, filesize($path));
        $buffer = trim($buffer);
        $arr_keys = decodeall($buffer);
        fclose($fp);
        switch ($comp) {
            case 'A':
                if (!isValidDomain($arr_keys[0])) {
                    echo "Invalid Domain";
                    return false;
                } elseif (!isValidPackage($arr_keys[1], $arr_keys[2], $arr_keys[3])) {
                    echo "Invalid Package" . $arr_keys[1] . " : " . $arr_keys[2] . " : " . $arr_keys[3];
                    return false;
                } else {
                    return true;
                }
                break;
            case 'D':
                if (!isValidDomain($arr_keys[0])) {
                    echo "Invalid Domain";
                    return false;
                } else {
                    return true;
                }
                break;
            case 'P':
                if (!isValidPackage($arr_keys[1], $arr_keys[2], $arr_keys[3])) {
                    echo "Invalid Package";
                    return false;
                } else {
                    return true;
                }
                break;
        }
    } else {
        //echo("Invalid file.");
        return false;
    }
}