function showDomainResult($domain, $server, $findText)
{
    if (checkDomain($domain, $server, $findText)) {
        echo "<tr><td>{$domain}</td><td>AVAILABLE</td></tr>";
    } else {
        echo "<tr><td>{$domain}</td><td>TAKEN</td></tr>";
    }
}
Esempio n. 2
0
function showDomainResult($domain, $server, $findText)
{
    if (checkDomain($domain, $server, $findText)) {
        echo "<div style='margin-bottom:4px'>{$domain} Available</div>";
    } else {
        echo "<div style='margin-bottom:4px'>{$domain} Taken</div>";
    }
}
Esempio n. 3
0
                 }
                 $content .= sprintf($html->string_error, $toprint) . '<br>';
                 $localerror = 1;
             }
         }
     }
 }
 // end no error after empty checks
 if (!$localerror) {
     // ****************************************
     // *            Create new zone           *
     // ****************************************
     // import zone content
     if (!empty($serverimport)) {
         // check if server is IP or NS name
         if (!(checkIP($serverimport) || checkDomain($serverimport))) {
             $content .= sprintf($html->string_warning, $l['str_bad_serverimport_name']);
             $server = "";
         }
     }
     if (0) {
         if (!empty($zonearea)) {
             if (strcmp($zonetypenew, 'P')) {
                 $content .= sprintf($html->string_warning, $l['str_no_zonearea']);
                 $zonearea = "";
             }
         }
     }
     if ($config->usergroups) {
         // if usergroups, zone is owned by
         // group and not individuals
}
fclose($fi1);
echo "Done checking external_domains.txt\n";
while (!feof($fi2)) {
    $domain = fgets($fi2);
    if ($domain != "") {
        checkDomain($domain, $domainsString, $domains);
    }
}
fclose($fi2);
echo "Done checking dom-bl-base.txt\n";
while (!feof($fi3)) {
    $domain = fgets($fi3);
    $domain = trim(preg_replace('/#.*$/', '', $domain));
    if ($domain != "") {
        checkDomain($domain, $domainsString, $domains);
    }
}
fclose($fi3);
echo "Done checking mozilla-blacklist.txt\n";
function checkDomain($domain, &$domainsString, &$domains)
{
    $re = "@" . trim($domain) . "@";
    $count = preg_match($re, $domainsString, $matches);
    if ($count > 0) {
        //mark it found
        $domains[$matches[0]]['found'] = true;
    } else {
        //echo 'no match ' . $domain . "\n";
    }
}
Esempio n. 5
0
/**
 * Do an axfr dig of a zone
 *
 *@param string $server server to dig
 *@param string $zone zone to dig
 *@return string dig result
 */
function zoneDig($server, $zone)
{
    global $config;
    if (!checkIP($server) && !checkDomain($server)) {
        return "";
    }
    $server = escapeshellarg($server);
    $zone = escapeshellarg($zone);
    $cmd = escapeshellcmd("{$config->bindig} @{$server} {$zone} axfr -b '{$config->nsaddress}'");
    $result = shell_exec($cmd);
    return $result;
}
Esempio n. 6
0
echo "</div>\n";
echo "<br style='clear: both'>";
//Favorites
if ($perm->isAccessSiteMap() || $perm->isGuest()) {
    echo "<div class='main_page_block'>\n";
    echo "\t<div class='block_title'>\n";
    //echo "\t\t<img src='".$ADMIN_TEMPLATE."img/i_favorites_big.gif' alt='".FAVORITE_HEADERTEXT."'>\n";
    echo "\t\t<span>" . FAVORITE_HEADERTEXT . "</span>\n";
    echo "\t</div>\n";
    if ($favorites) {
        $i = 0;
        foreach ($favorites as $fkey => $favorite) {
            if ($catalogue != $favorite['Catalogue_ID']) {
                echo "\t<div class='block_title_line'>";
                echo "\t\t<i class='nc-icon nc--site'></i>";
                $domainError = checkDomain($favorite['Domain'], $favorite['Catalogue_ID']);
                echo "\t\t<span><a href='subdivision/full.php?CatalogueID=" . $favorite['Catalogue_ID'] . "'" . (!$favorite['CatalogueChecked'] ? " class='gray'" : "") . ">" . $favorite['Catalogue_Name'] . "</a>" . $domainError . "</span>\n";
                echo "\t</div>\n";
                $catalogue = $favorite['Catalogue_ID'];
                $count++;
            }
            $subclass_id = $db->get_var("SELECT Sub_Class_ID\n                                       FROM Sub_Class\n                                      WHERE Subdivision_ID = '" . $favorite['Subdivision_ID'] . "'\n                                   ORDER BY Priority\n                                      LIMIT 1");
            echo "\t<div class='" . ($i % 2 ? "block_line" : "block_line_gray") . "'>\n";
            echo "\t\t<i class='nc-icon nc--folder" . (!$favorite['SubChecked'] ? " nc--disabled" : "") . "'></i>\n";
            echo "\t\t<span><a href='" . ($subclass_id ? "../?inside_admin=1&cc={$subclass_id}" : "subdivision/SubClass.php?phase=1&SubdivisionID=" . $favorite['Subdivision_ID']) . "' title='" . $favorite['Subdivision_Name'] . "'" . (!$favorite['SubChecked'] ? " class='gray'" : "") . ">" . $favorite['Subdivision_Name'] . "</a></span>\n";
            echo "\t\t<div class='block_line_link'><img border='0' src=" . $ADMIN_TEMPLATE . "img/px.gif width='16' height='16' style='margin:0px 2px 0px 2px;'>" . ($subclass_id ? "<a href='http://" . $EDIT_DOMAIN . $SUB_FOLDER . $HTTP_ROOT_PATH . "?inside_admin=1&cc=" . $subclass_id . (strlen(session_id()) > 0 ? "&" . session_name() . "=" . session_id() . "" : "") . "'><i class='nc-icon nc--edit nc--hovered' title='" . CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWMENU_A_EDIT . "'></i></a>" : "<img border='0' src=" . $ADMIN_TEMPLATE . "img/px.gif width='19' height='19' style='margin:0px 2px 0px 2px;'>") . "<a href='" . nc_subdivision_preview_link($favorite) . "' target='_blank'><i class='nc-icon nc--arrow-right nc--hovered' title='" . CONTROL_CONTENT_SUBDIVISION_FUNCS_TOVIEW . "'></i></a></div>\n";
            echo "\t</div>\n";
            if ($catalogue != $favorites[$fkey + 1]['Catalogue_ID']) {
                echo "\t<div class='block_line block_map'>";
                echo "\t\t<span><a href='subdivision/full.php?CatalogueID=" . $favorite['Catalogue_ID'] . "'" . (!$favorite['CatalogueChecked'] ? " class='gray'" : "") . ">" . NETCAT_TREE_SITEMAP . "</a></span>\n";
                echo "\t</div>\n";
Esempio n. 7
0
<?php

$NETCAT_FOLDER = realpath(dirname(__FILE__) . '/../../../../') . DIRECTORY_SEPARATOR;
require_once $NETCAT_FOLDER . 'vars.inc.php';
require_once $ADMIN_FOLDER . 'function.inc.php';
require_once $ADMIN_FOLDER . "catalogue/function.inc.php";
$favorites = array();
$catalogues = array();
if ($perm->isAccessSiteMap() || $perm->isGuest()) {
    $sub_ids = array();
    $all_favorites = GetFavorites();
    if (!empty($all_favorites)) {
        foreach ($all_favorites as $i => $row) {
            $row['link'] = 'subdivision/SubClass.php?phase=1&SubdivisionID=' . $row['Subdivision_ID'];
            $favorites[$row['Catalogue_ID']][$row['Subdivision_ID']] = $row;
            $catalogues[$row['Catalogue_ID']] = array('checked' => $row['CatalogueChecked'], 'name' => $row['Catalogue_Name'], 'link' => 'subdivision/full.php?CatalogueID=' . $row['Catalogue_ID'], 'domain_error' => checkDomain($row['Domain'], $row['Catalogue_ID'], true));
            $sub_ids[$row['Subdivision_ID']] = $row['Subdivision_ID'];
        }
        $result = $db->get_results("SELECT Sub_Class_ID, Subdivision_ID\n                    FROM Sub_Class\n                    WHERE Subdivision_ID IN (" . implode(', ', $sub_ids) . ") ORDER BY Priority");
    }
    $subclass_link = array();
    if (!empty($result)) {
        foreach ($result as $row) {
            // пропускаем 2,3,... компоненты
            if (isset($sub_classes[$row->Subdivision_ID])) {
                continue;
            }
            $subclass_link[$row->Subdivision_ID] = 'http://' . $EDIT_DOMAIN . $SUB_FOLDER . $HTTP_ROOT_PATH . '?inside_admin=1&cc=' . $row->Sub_Class_ID;
        }
    }
}
$whiteDomains = split("\n", $whitelistString);
foreach ($whiteDomains as $domain) {
    $domain = trim(preg_replace('/#.*$/', '', $domain));
    if ($domain == "") {
        continue;
    }
    $urlInfo = parse_url("http://" . $domain);
    $parts = preg_split('&\\.&', $urlInfo['host']);
    $total = count($parts);
    $domain = $parts[$total - 2] . '.' . $parts[$total - 1];
    if (substr($domain, -1) == "\\") {
        $domain = substr($domain, 0, -1);
    }
    //Is that domain in our list anywhere?
    //just mark that domain as one we don't want
    checkDomain($domain, $domainsString, $domains, false);
    /*if($domain != ""){
    		checkSubDomain($urlInfo['host'], $domainsString, $domains);
    	}*/
}
function checkDomain($domain, &$domainsString, &$domains, $markValue = true)
{
    $count = preg_match('&' . trim($domain) . '&', $domainsString, $matches);
    if ($count > 0) {
        if (!empty($domains[$matches[0]])) {
            //mark it found
            $domains[$matches[0]]['found'] = $markValue;
        }
    } else {
        //echo 'no match ' . $domain . "\n";
    }
Esempio n. 9
0
 function parseZoneInput($dig)
 {
     global $db, $l;
     $this->error = "";
     $first = 1;
     $dbqueries = 0;
     $diglist = explode("\n", $dig);
     foreach ($diglist as $line) {
         $query = "";
         if (!preg_match("/^\\s*;/", $line)) {
             if (preg_match("/^\\s*?(.*?)\\s+(.*?)\\s+IN\\s+(.*?)\\s+(.*)\\s*\$/", $line, $record)) {
                 $data = preg_split("/\\s+/", $record[4]);
                 $shortname = preg_replace("/\\./", "\\.", $this->zonename);
                 $shortname = preg_replace("/\\." . $shortname . "\\.\$/", "", $record[1]);
                 switch ($record[3]) {
                     case "SOA":
                         if ($first) {
                             $first = 0;
                             // split SOA params
                             if (preg_match("/([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s*\$/", $record[4], $soa)) {
                                 /* serial $soa[1]
                                       refresh $soa[2];
                                       retry $soa[3];
                                       expire $soa[4];
                                       negative caching $soa[5];
                                    */
                                 $query = sprintf("INSERT INTO dns_confprimary\n                    (zoneid,serial,refresh,retry,expiry,minimum,xfer,defaultttl)\n                    VALUES('%s', '%s', '%s', '%s', '%s', '%s', 'any', '86400')", $this->zoneid, mysql_real_escape_string(intval($soa[1])), mysql_real_escape_string(intval($soa[2])), mysql_real_escape_string(intval($soa[3])), mysql_real_escape_string(intval($soa[4])), mysql_real_escape_string(intval($soa[5])));
                             }
                             // SOA params match
                         }
                         break;
                     case "NS":
                         if (!checkIP($data[0]) && !checkDomain($data[0])) {
                             print "<p><span class=\"error\">" . $l['str_log_unknown'] . "</span>" . "<br>\n" . $line . "\n</p>";
                             break;
                         }
                         // if NS on zone, create NS. Otherwise, create subns.
                         if (!strcmp($this->zonename . ".", $record[1])) {
                             $query = sprintf("INSERT INTO dns_record (zoneid,type,val1,ttl)\n                    VALUES ('%s', 'NS', '%s', '%s')", $this->zoneid, mysql_real_escape_string($data[0]), mysql_real_escape_string($record[2]));
                         } else {
                             // subns
                             $query = sprintf("INSERT INTO dns_record (zoneid,type,val1,val2,ttl)\n                    VALUES ('%s', 'SUBNS', '%s', '%s', '%s')", $this->zoneid, mysql_real_escape_string($shortname), mysql_real_escape_string($data[0]), mysql_real_escape_string($record[2]));
                         }
                         break;
                     case "MX":
                         $query = sprintf("INSERT INTO dns_record (zoneid,type,val1,val2,val3,ttl)\n                  VALUES ('%s', 'MX', '%s', '%s', '%s', '%s')", $this->zoneid, mysql_real_escape_string($shortname), mysql_real_escape_string($data[0]), mysql_real_escape_string($data[1]), mysql_real_escape_string($record[2]));
                         break;
                     case "A":
                         $query = sprintf("INSERT INTO dns_record (zoneid,type,val1,val2,ttl)\n                  VALUES ('%s', 'A', '%s', '%s', '%s')", $this->zoneid, mysql_real_escape_string($shortname), mysql_real_escape_string($data[0]), mysql_real_escape_string($record[2]));
                         break;
                     case "AAAA":
                         $query = sprintf("INSERT INTO dns_record (zoneid,type,val1,val2,ttl)\n                  VALUES ('%s', 'AAAA', '%s', '%s', '%s')", $this->zoneid, mysql_real_escape_string($shortname), mysql_real_escape_string($data[0]), mysql_real_escape_string($record[2]));
                         break;
                     case "CNAME":
                         if (preg_match("/^(.*)." . $this->zonename . ".\$/", $data[0], $tmp)) {
                             $data[0] = $tmp[1];
                         }
                         $query = sprintf("INSERT INTO dns_record (zoneid,type,val1,val2,ttl)\n                  VALUES ('%s', 'CNAME', '%s', '%s', '%s')", $this->zoneid, mysql_real_escape_string($shortname), mysql_real_escape_string($data[0]), mysql_real_escape_string($record[2]));
                         break;
                     case "PTR":
                         $query = sprintf("INSERT INTO dns_record (zoneid,type,val1,val2,ttl)\n                  VALUES ('%s', 'PTR', '%s', '%s', '%s')", $this->zoneid, mysql_real_escape_string($shortname), mysql_real_escape_string($data[0]), mysql_real_escape_string($record[2]));
                         break;
                     case "SRV":
                         $query = sprintf("INSERT INTO dns_record (zoneid,type,val1,val2,val3,val4,val5,ttl)\n                  VALUES ('%s', 'SRV', '%s', '%s', '%s', '%s', '%s', '%s')", $this->zoneid, mysql_real_escape_string($shortname), mysql_real_escape_string($data[0]), mysql_real_escape_string($data[1]), mysql_real_escape_string($data[2]), mysql_real_escape_string($data[3]), mysql_real_escape_string($record[2]));
                         break;
                     case "TXT":
                         $txt = $record[4];
                         $txt = str_replace('" "', '', $txt);
                         $txt = trim($txt, '"');
                         $query = sprintf("INSERT INTO dns_record (zoneid,type,val1,val2,ttl)\n                  VALUES ('%s', 'TXT', '%s', '%s', '%s')", $this->zoneid, mysql_real_escape_string($shortname), mysql_real_escape_string($txt), mysql_real_escape_string($record[2]));
                         break;
                     default:
                         print "<p><span class=\"error\">" . $l['str_log_unknown'] . "</span>" . "<br>\n" . $line . "\n</p>";
                 }
                 if (!empty($query)) {
                     $dbqueries++;
                     $db->query($query);
                     if ($db->error()) {
                         $this->error = $l['str_trouble_with_db'];
                         return 0;
                     }
                 }
             }
             // standard line
         }
         // not ";" beginning line
     }
     // end foreach line of dig result
     $query = "UPDATE dns_record SET ttl='-1' WHERE ttl='86400' AND zoneid='" . $this->zoneid . "';";
     $db->query($query);
     if (!$dbqueries) {
         $this->error .= '<pre>' . $dig . '</pre>';
     }
     return $dbqueries;
 }
Esempio n. 10
0
$vhost = '/etc/httpd/vhosts/' . $project . '.conf';
$syncDir = '/home/forseti/Sync/Projekty/' . $project;
$projDir = '/home/forseti/Dokumenty/Kod/PHP/' . $project;
$docRoot = '/var/www/html/' . $project;
$hosts = '/etc/hosts.d/' . $project . 'conf';
// Sprawdzamy
$checks = array(['makeVhost', $vhost, 'Virtual host '], ['makeSyncDir', $syncDir, 'Katalog synchronizowany '], ['makeProjDir', $projDir, 'Katalog projektu '], ['makeDocRoot', $docRoot, 'Link do Apache documentRoot '], ['makeHostFile', $hosts, 'Plik hosts dla ']);
foreach ($checks as list($proc, $path, $msg)) {
    if (!file_exists($path)) {
        $proc();
        echo $msg . $project . " utworzony\n";
    } else {
        echo $msg . $project . " już istnieje\n";
    }
}
checkDomain($project);
exit(0);
// Stwórz nowego virtualhosta Apache'a
function makeVhost()
{
    global $project, $vhost, $docRoot;
    file_put_contents($vhost, <<<EOT
<VirtualHost *:80>
\tServerName {$project}.forseti.home

\tServerAdmin webmaster@localhost
\tDocumentRoot {$docRoot}/web

\t<Directory {$docRoot}/web>
\t\tOptions Indexes FollowSymlinks Multiviews
\t\tAllowOverride All
Esempio n. 11
0
     nc_print_status(CONTROL_CONTENT_CATALOUGE_ERROR_CASETREE_ONE, 'error');
     CatalogueForm($CatalogueID, 3, "index.php", $type, $action);
     break;
 }
 if (!IsAllowedDomain($Domain, $CatalogueID)) {
     nc_print_status(CONTROL_CONTENT_CATALOUGE_ERROR_DUPLICATE_DOMAIN, 'error');
     CatalogueForm($CatalogueID, 3, "index.php", $type, $action);
     break;
 }
 // домен сайта должен содеражить только  буквы, цифры, подчеркивание, дефис и точку, либо быть пустым
 if (!nc_preg_match($nc_core->NC_UNICODE ? "/^[-0-9a-zа-я._]*\$/i" : "/^[-0-9a-z._]*\$/i", $Domain)) {
     nc_print_status(CONTROL_CONTENT_CATALOUGE_ERROR_CASETREE_THREE, 'error');
     CatalogueForm($CatalogueID, 3, "index.php", $type, $action);
     break;
 }
 $infoMessage = checkDomain($Domain, $CatalogueID);
 if (!empty($infoMessage)) {
     nc_print_status(CONTROL_CONTENT_CATALOUGE_ERROR_INCORRECT_DOMAIN_FULLTEXT, 'info');
 }
 if (ActionCatalogueCompleted($CatalogueID, $type, $phase_action)) {
     $UI_CONFIG = new ui_config_catalogue('map', $CatalogueID);
     $site = $nc_core->catalogue->get_by_id($CatalogueID, null, 1);
     $image = $site['Checked'] ? 'i_site.gif' : 'i_site_disabled.gif';
     if ($type == 1) {
         $buttons = array();
         $buttons[] = array("image" => "i_preview.gif", "label" => CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWMENU_A_VIEW, "action" => "window.open('http://" . ($site['Domain'] ? $site['Domain'] : $HTTP_HOST) . "');", "icon" => "arrow-right", "sprite" => true);
         $buttons[] = array("image" => "i_folder_add.gif", "label" => CONTROL_CONTENT_SUBDIVISION_FUNCS_MAINDATA_A_ADDSUBSECTION, "action" => "parent.location.hash = 'subdivision.add(0,{$site['Catalogue_ID']})'", "icon" => "folder-add", "sprite" => true);
         $UI_CONFIG->treeChanges['addNode'][] = array("nodeId" => "site-{$site['Catalogue_ID']}", "name" => $site[Catalogue_ID] . ". " . $site["Catalogue_Name"], "href" => "#site.map({$site['Catalogue_ID']})", "hasChildren" => true, "acceptDropFn" => "treeSitemapAcceptDrop", "onDropFn" => "treeSitemapOnDrop", "dragEnabled" => true, "buttons" => $buttons);
         $UI_CONFIG->addNavBarCatalogue = array('name' => $site["Catalogue_Name"], 'href' => "#site.map({$site[Catalogue_ID]})");
         nc_print_status(CONTROL_CONTENT_CATALOUGE_SUCCESS_ADD, 'ok');
         ShowFullSubdivisionList();