mirror of
https://github.com/itflow-org/itflow
synced 2026-03-05 05:14:51 +00:00
Merge pull request #468 from wrongecho/dom-ssl-func
Move domain info logic to functions.php
This commit is contained in:
@@ -352,6 +352,12 @@ function encryptLoginEntry($login_password_cleartext){
|
|||||||
|
|
||||||
// Get domain expiration date
|
// Get domain expiration date
|
||||||
function getDomainExpirationDate($name){
|
function getDomainExpirationDate($name){
|
||||||
|
|
||||||
|
// Only run if we think the domain is valid
|
||||||
|
if(!filter_var($name, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
|
||||||
|
return '0000-00-00';
|
||||||
|
}
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, "https://itflow-whois.herokuapp.com/$name");
|
curl_setopt($ch, CURLOPT_URL, "https://itflow-whois.herokuapp.com/$name");
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
||||||
@@ -372,6 +378,28 @@ function getDomainExpirationDate($name){
|
|||||||
return '0000-00-00';
|
return '0000-00-00';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get domain general info (whois + NS/A/MX records)
|
||||||
|
function getDomainRecords($name){
|
||||||
|
|
||||||
|
$records = array();
|
||||||
|
|
||||||
|
// Only run if we think the domain is valid
|
||||||
|
if(!filter_var($name, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
|
||||||
|
$records['a'] = '';
|
||||||
|
$records['ns'] = '';
|
||||||
|
$records['mx'] = '';
|
||||||
|
$records['whois'] = '';
|
||||||
|
return $records;
|
||||||
|
}
|
||||||
|
|
||||||
|
$domain = escapeshellarg($name);
|
||||||
|
$records['a'] = substr(trim(strip_tags(shell_exec("dig +short $domain"))), 0, 254);
|
||||||
|
$records['ns'] = substr(trim(strip_tags(shell_exec("dig +short NS $domain"))), 0, 254);
|
||||||
|
$records['mx'] = substr(trim(strip_tags(shell_exec("dig +short MX $domain"))), 0, 254);
|
||||||
|
$records['whois'] = substr(trim(strip_tags(shell_exec("whois -H $domain | sed 's/ //g' | head -30"))), 0, 254);
|
||||||
|
|
||||||
|
return $records;
|
||||||
|
}
|
||||||
|
|
||||||
function strto_AZaz09($string){
|
function strto_AZaz09($string){
|
||||||
$string = ucwords(strtolower($string));
|
$string = ucwords(strtolower($string));
|
||||||
|
|||||||
57
post.php
57
post.php
@@ -5967,27 +5967,18 @@ if(isset($_POST['add_domain'])){
|
|||||||
$expire = "0000-00-00";
|
$expire = "0000-00-00";
|
||||||
}
|
}
|
||||||
|
|
||||||
// NS, MX and WHOIS data
|
// Get domain expiry date - if not specified
|
||||||
if(filter_var($name, FILTER_VALIDATE_DOMAIN) && (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')){
|
if($expire == '0000-00-00'){
|
||||||
$domain = escapeshellarg($name);
|
$expire = getDomainExpirationDate($name);
|
||||||
$a = strip_tags(mysqli_real_escape_string($mysqli,shell_exec("dig +short $domain")));
|
|
||||||
$ns = strip_tags(mysqli_real_escape_string($mysqli,shell_exec("dig +short NS $domain")));
|
|
||||||
$mx = strip_tags(mysqli_real_escape_string($mysqli,shell_exec("dig +short MX $domain")));
|
|
||||||
$whois = trim(strip_tags(mysqli_real_escape_string($mysqli,shell_exec("whois -H $domain | sed 's/ //g' | head -30"))));
|
|
||||||
|
|
||||||
// Get domain expiry date - if not specified
|
|
||||||
if($expire == '0000-00-00'){
|
|
||||||
$expire = getDomainExpirationDate($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$a = '';
|
|
||||||
$ns = '';
|
|
||||||
$mx = '';
|
|
||||||
$whois = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NS, MX, A and WHOIS records/data
|
||||||
|
$records = getDomainRecords($name);
|
||||||
|
$a = mysqli_real_escape_string($mysqli, $records['a']);
|
||||||
|
$ns = mysqli_real_escape_string($mysqli, $records['ns']);
|
||||||
|
$mx = mysqli_real_escape_string($mysqli, $records['mx']);
|
||||||
|
$whois = mysqli_real_escape_string($mysqli, $records['whois']);
|
||||||
|
|
||||||
// Add domain record
|
// Add domain record
|
||||||
mysqli_query($mysqli,"INSERT INTO domains SET domain_name = '$name', domain_registrar = $registrar, domain_webhost = $webhost, domain_expire = '$expire', domain_ip = '$a', domain_name_servers = '$ns', domain_mail_servers = '$mx', domain_raw_whois = '$whois', domain_client_id = $client_id, company_id = $session_company_id");
|
mysqli_query($mysqli,"INSERT INTO domains SET domain_name = '$name', domain_registrar = $registrar, domain_webhost = $webhost, domain_expire = '$expire', domain_ip = '$a', domain_name_servers = '$ns', domain_mail_servers = '$mx', domain_raw_whois = '$whois', domain_client_id = $client_id, company_id = $session_company_id");
|
||||||
|
|
||||||
@@ -6035,24 +6026,18 @@ if(isset($_POST['edit_domain'])){
|
|||||||
$webhost = intval($_POST['webhost']);
|
$webhost = intval($_POST['webhost']);
|
||||||
$expire = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['expire'])));
|
$expire = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['expire'])));
|
||||||
if(empty($expire)){
|
if(empty($expire)){
|
||||||
$expire = "0000-00-00";
|
$expire = "0000-00-00";
|
||||||
}
|
}
|
||||||
|
|
||||||
// A, NS, MX and WHOIS data
|
// Update domain expiry date
|
||||||
if(filter_var($name, FILTER_VALIDATE_DOMAIN) && (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')){
|
$expire = getDomainExpirationDate($name);
|
||||||
$domain = escapeshellarg($name);
|
|
||||||
$a = strip_tags(mysqli_real_escape_string($mysqli,shell_exec("dig +short $domain")));
|
// Update NS, MX, A and WHOIS records/data
|
||||||
$ns = strip_tags(mysqli_real_escape_string($mysqli,shell_exec("dig +short NS $domain")));
|
$records = getDomainRecords($name);
|
||||||
$mx = strip_tags(mysqli_real_escape_string($mysqli,shell_exec("dig +short MX $domain")));
|
$a = mysqli_real_escape_string($mysqli, $records['a']);
|
||||||
$whois = trim(strip_tags(mysqli_real_escape_string($mysqli,shell_exec("whois -H $domain | sed 's/ //g' | head -30"))));
|
$ns = mysqli_real_escape_string($mysqli, $records['ns']);
|
||||||
$expire = getDomainExpirationDate($name);
|
$mx = mysqli_real_escape_string($mysqli, $records['mx']);
|
||||||
}
|
$whois = mysqli_real_escape_string($mysqli, $records['whois']);
|
||||||
else{
|
|
||||||
$a = '';
|
|
||||||
$ns = '';
|
|
||||||
$mx = '';
|
|
||||||
$whois = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
mysqli_query($mysqli,"UPDATE domains SET domain_name = '$name', domain_registrar = $registrar, domain_webhost = $webhost, domain_expire = '$expire', domain_ip = '$a', domain_name_servers = '$ns', domain_mail_servers = '$mx', domain_raw_whois = '$whois' WHERE domain_id = $domain_id AND company_id = $session_company_id");
|
mysqli_query($mysqli,"UPDATE domains SET domain_name = '$name', domain_registrar = $registrar, domain_webhost = $webhost, domain_expire = '$expire', domain_ip = '$a', domain_name_servers = '$ns', domain_mail_servers = '$mx', domain_raw_whois = '$whois' WHERE domain_id = $domain_id AND company_id = $session_company_id");
|
||||||
|
|
||||||
@@ -6067,7 +6052,7 @@ if(isset($_POST['edit_domain'])){
|
|||||||
|
|
||||||
if(isset($_GET['delete_domain'])){
|
if(isset($_GET['delete_domain'])){
|
||||||
|
|
||||||
validateAdminRole();
|
validateAdminRole();
|
||||||
|
|
||||||
$domain_id = intval($_GET['delete_domain']);
|
$domain_id = intval($_GET['delete_domain']);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user