Premier jet de l'interface d'importation "magique" de zone DNS
Ca "marchotte"
This commit is contained in:
parent
af62765a0e
commit
f25fa5c8a9
|
@ -105,6 +105,7 @@ bureau/admin/dom_dodel.php -text
|
||||||
bureau/admin/dom_edit.inc.php -text
|
bureau/admin/dom_edit.inc.php -text
|
||||||
bureau/admin/dom_edit.php -text
|
bureau/admin/dom_edit.php -text
|
||||||
bureau/admin/dom_editdns.php -text
|
bureau/admin/dom_editdns.php -text
|
||||||
|
bureau/admin/dom_import.php -text
|
||||||
bureau/admin/dom_subdel.php -text
|
bureau/admin/dom_subdel.php -text
|
||||||
bureau/admin/dom_subdodel.php -text
|
bureau/admin/dom_subdodel.php -text
|
||||||
bureau/admin/dom_subdoedit.php -text
|
bureau/admin/dom_subdoedit.php -text
|
||||||
|
|
|
@ -54,7 +54,7 @@ if (isset($error) && $error) echo "<p class=\"error\">$error</p>";
|
||||||
?>
|
?>
|
||||||
<form method="post" action="dom_doadd.php" id="main">
|
<form method="post" action="dom_doadd.php" id="main">
|
||||||
<p>
|
<p>
|
||||||
<label for="newdomain"><b><?php __("Domain name"); ?> :</b></label> <span class="int" id="newdomwww">www.</span><input type="text" class="int" id="newdomain" name="newdomain" value="<?php ehe($newdomain); ?>" size="32" maxlength="255" />
|
<label for="newdomain"><b><?php __("Domain name"); ?> :</b></label> <span class="int" id="newdomwww">www.</span><input type="text" class="int" id="newdomain" name="newdomain" value="<?php ehe($newdomain); ?>" size="32" maxlength="255" /> <a class="inb" href="dom_import.php"><?php __("Advanced import"); ?></a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<input type="checkbox" name="dns" class="inc" value="1" id="yndns"<?php cbox($dns=="1"); ?>/> <label for="yndns"><?php __("host my dns here"); ?></label>
|
<input type="checkbox" name="dns" class="inc" value="1" id="yndns"<?php cbox($dns=="1"); ?>/> <label for="yndns"><?php __("host my dns here"); ?></label>
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
require_once("../class/config.php");
|
require_once("../class/config.php");
|
||||||
include_once("head.php");
|
include_once("head.php");
|
||||||
|
|
||||||
|
|
||||||
# Function to create/edit subdomain
|
# Function to create/edit subdomain
|
||||||
# Take the values of the subdomain in arguments
|
# Take the values of the subdomain in arguments
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,116 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
$Id: ftp_list.php,v 1.5 2003/06/10 13:16:11 root Exp $
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
AlternC - Web Hosting System
|
||||||
|
Copyright (C) 2002 by the AlternC Development Team.
|
||||||
|
http://alternc.org/
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Based on:
|
||||||
|
Valentin Lacambre's web hosting softwares: http://altern.org/
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
LICENSE
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License (GPL)
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Original Author of file: Benjamin Sonntag
|
||||||
|
Purpose of file: List ftp accounts of the user.
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
require_once("../class/config.php");
|
||||||
|
include_once("head.php");
|
||||||
|
|
||||||
|
$fields = array (
|
||||||
|
"domain" => array ("post", "string", ""),
|
||||||
|
"zone" => array ("post", "string", ""),
|
||||||
|
"save" => array ("post", "integer", "0"),
|
||||||
|
"detect_redirect" => array ("post", "integer", "0"),
|
||||||
|
);
|
||||||
|
getFields($fields);
|
||||||
|
$domain=trim($domain);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<h3><?php __("Import a DNS zone"); ?></h3>
|
||||||
|
<hr id="topbar"/>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if (!empty($error)) {
|
||||||
|
echo '<p class="error">'.$error.'</p>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php if ( !empty($zone) ) {
|
||||||
|
if ( empty($domain) ) {
|
||||||
|
echo '<p class="error">'._("The domain field seems to be empty").'</p>';
|
||||||
|
} else { ?>
|
||||||
|
<?php __("Here is my proposition. Modify your zone until my proposition seems good to you"); ?>
|
||||||
|
<table class="tlist">
|
||||||
|
<tr><th colspan=3><h2><?php printf(_("Working on %s"),$domain); ?></h2></th></tr>
|
||||||
|
<tr>
|
||||||
|
<th width="50%"><?php __("Zone"); ?></th><th width="50%"><?php __("Generated entry"); ?></th><?php if ($save) {echo "<th>"._("Result")."</th>"; } ?>
|
||||||
|
</tr>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($dom->import_manual_dns_zone($zone, $domain, $detect_redirect, $save) as $val) {
|
||||||
|
if (empty($val)) continue;
|
||||||
|
//echo "<tr><td>"; print_r($val);
|
||||||
|
echo "<tr class='";
|
||||||
|
if ($save) {
|
||||||
|
echo "tab-".($val['did_it']==1?'ok':'err');
|
||||||
|
} else {
|
||||||
|
echo "tab-".$val['status'];
|
||||||
|
}
|
||||||
|
echo "'><td>".$val['entry_old']."</td><td>".$val['comment']."</td>";
|
||||||
|
if ($save) { echo "<td>".($val['did_it']==1?_("OK"):_("ERROR"))."</td>"; }
|
||||||
|
echo "</tr>\n";
|
||||||
|
} // foreach
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php
|
||||||
|
} // empty domain
|
||||||
|
echo "<hr/>";
|
||||||
|
} // empty $zone
|
||||||
|
|
||||||
|
|
||||||
|
if ($save) {
|
||||||
|
echo '<span class="inb"><a href="dom_edit.php?domain='.urlencode($domain).'" >'._("Click here to continue").'</a></span>';
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<form method="post" action="dom_import.php">
|
||||||
|
<label><?php __("Enter the domain you want to import") ; ?></label>
|
||||||
|
<input type="text" name="domain" value="<?php echo $domain; ?>" />
|
||||||
|
|
||||||
|
<label><?php __("Do you want to detect the redirection?"); ?></label>
|
||||||
|
<input name="detect_redirect" type="checkbox" value="1" <?php cbox($detect_redirect); ?> />
|
||||||
|
|
||||||
|
<fieldset><legend><?php __("Paste your DNS zone here");?></legend>
|
||||||
|
<textarea cols=80 rows=20 name="zone"><?php echo $zone; ?></textarea>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<?php if ( ! empty($zone) && ! empty($domain) ) { // only if you reviewed ?>
|
||||||
|
<label><?php __("Do you want to import the zone as it?"); ?></label>
|
||||||
|
<input name="save" type="checkbox" value="1" />
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<p><input type="submit" name="submit" class="inb ok" value="<?php __("Submit"); ?>" /></p>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
} // $save
|
||||||
|
|
||||||
|
include_once("foot.php");
|
||||||
|
|
||||||
|
?>
|
|
@ -85,6 +85,16 @@ fieldset {
|
||||||
border: 1px solid #555;
|
border: 1px solid #555;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
overflow: auto;
|
||||||
|
background-color: #ddd;
|
||||||
|
padding: 10px;
|
||||||
|
border: solid 1px #999;
|
||||||
|
border-radius: 4px;
|
||||||
|
-webkit-border-radius: 4px;
|
||||||
|
-moz-border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
.inp {
|
.inp {
|
||||||
/* Should not be use anymore !!! */
|
/* Should not be use anymore !!! */
|
||||||
border-color: blue;
|
border-color: blue;
|
||||||
|
@ -568,6 +578,16 @@ input#dir, input#sub_local {
|
||||||
width: 200px;
|
width: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tab-ok {
|
||||||
|
background-color: lightgreen;
|
||||||
|
}
|
||||||
|
.tab-err {
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
.tab-warn {
|
||||||
|
background-color: coral;
|
||||||
|
}
|
||||||
|
|
||||||
.warningmsg {
|
.warningmsg {
|
||||||
width: 500px;
|
width: 500px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,6 +169,266 @@ class m_dom {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function import_manual_dns_zone($zone, $domain, $detect_redirect=true, $save=false) {
|
||||||
|
global $err;
|
||||||
|
if ($save) {
|
||||||
|
if (! $this->import_manual_dns_prep_zone($domain) ) {
|
||||||
|
$err->raise('dom', _("Err: failed to prepare the zone"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$val = array();
|
||||||
|
foreach (explode("\n", $zone) as $z) {
|
||||||
|
$z=trim($z);
|
||||||
|
if (empty($z)) continue;
|
||||||
|
$val[] = $this->import_manual_dns_entry($z,$domain,$detect_redirect,$save);
|
||||||
|
}
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
|
||||||
|
function import_manual_dns_entry($zone, $domain, $detect_redirect=true, $save=false) {
|
||||||
|
global $cuid, $err;
|
||||||
|
$err->log("dom","import_manual_dns_entry");
|
||||||
|
$zone=trim($zone);
|
||||||
|
if (empty($zone)) return false;
|
||||||
|
|
||||||
|
$domain=trim($domain);
|
||||||
|
if ( empty($domain) ) {
|
||||||
|
$err->raise("dom", _("Missing domain name"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$val = array(
|
||||||
|
'status' => 'err', // can be 'ok', 'err', 'warn'
|
||||||
|
'comment' => 'no val',
|
||||||
|
'entry_old' => $zone,
|
||||||
|
'entry_new' => array('domain'=>$domain),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Examples:
|
||||||
|
// ; hello comment
|
||||||
|
if ( preg_match('/^;/', $zone, $ret) ) {
|
||||||
|
$val['status'] = 'ok';
|
||||||
|
$val['comment'] = 'Just a comment, do not import';
|
||||||
|
} else
|
||||||
|
// Examples:
|
||||||
|
// $TTL 86400'
|
||||||
|
if ( preg_match('/^\$TTL\h+(?P<ttl>[\dMHDmhd]+)/', $zone, $ret) ) {
|
||||||
|
$val['status'] = 'ok';
|
||||||
|
$val['comment'] = 'Set TTL to '.$ret['ttl'];
|
||||||
|
$val['entry_new']['type'] = 'set_ttl';
|
||||||
|
$val['entry_new']['value'] = $ret['ttl'];
|
||||||
|
} else
|
||||||
|
|
||||||
|
// Examples:
|
||||||
|
// @ IN A 127.2.1.5
|
||||||
|
// reseau IN A 145.214.44.55
|
||||||
|
if ( preg_match('/^(?P<sub>[\w\.@\-]*)\h*(?P<ttl>\d*)\h*IN\h+A\h+(?P<target>\d+\.\d+\.\d+\.\d+)/i', $zone, $ret) ) {
|
||||||
|
// Check if it is just a redirect
|
||||||
|
if ( substr($ret['sub'], -1) == '.' ) { // if ending by a "." it is allready a FQDN
|
||||||
|
$url="http://".$ret['sub'];
|
||||||
|
} else {
|
||||||
|
if ( $ret['sub'] == '@' || empty($ret['sub']) ) {
|
||||||
|
$url="http://".$domain;
|
||||||
|
} else {
|
||||||
|
$url="http://".$ret['sub'].".".$domain;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( $detect_redirect && $dst_url = $this->is_it_a_redirect($url) ) {
|
||||||
|
$val['status'] = 'warn';
|
||||||
|
$val['comment'] = "Became a redirect to $dst_url";
|
||||||
|
$val['entry_new']['type'] = 'URL';
|
||||||
|
$val['entry_new']['sub'] = $ret['sub'];
|
||||||
|
$val['entry_new']['value'] = $url;
|
||||||
|
} else {
|
||||||
|
$val['status'] = 'ok';
|
||||||
|
$val['comment'] = "Create entry A with ".$ret['sub']." go to ".$ret['target']." with ttl ".$ret['ttl'];
|
||||||
|
$val['entry_new']['type'] = 'IP';
|
||||||
|
$val['entry_new']['sub'] = $ret['sub'];
|
||||||
|
$val['entry_new']['value'] = $ret['target'];
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
|
||||||
|
// Examples:
|
||||||
|
// @ IN NS ns.example.tld.
|
||||||
|
// ns 3600 IN NS 145.214.44.55
|
||||||
|
if ( preg_match('/^(?P<sub>[\w\.@]*)\h*(?P<ttl>\d*)\h*IN\h+NS\h+(?P<target>[\w\.]+)/i', $zone, $ret) ) {
|
||||||
|
if ( empty($ret['sub']) || $ret['sub'] == '@' ) {
|
||||||
|
$val['status'] = 'warn';
|
||||||
|
$val['comment'] = "Won't migrate it, there will get a new value";
|
||||||
|
} else {
|
||||||
|
$val['status'] = 'ok';
|
||||||
|
$val['comment'] = "Create entry NS with ".$ret['sub']." go to ".$ret['target']." with ttl ".$ret['ttl'];
|
||||||
|
$val['entry_new']['type'] = 'FIXME-NS';
|
||||||
|
$val['entry_new']['sub'] = $ret['sub'];
|
||||||
|
$val['entry_new']['value'] = $ret['target'];
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
|
||||||
|
// Examples:
|
||||||
|
// agenda IN CNAME ghs.google.com.
|
||||||
|
// www 3600 IN CNAME @
|
||||||
|
if ( preg_match('/^(?P<sub>[-\w\.@]*)\h*(?P<ttl>\d*)\h*IN\h+CNAME\h+(?P<target>[@\w+\.]+)/i', $zone, $ret) ) {
|
||||||
|
if ( substr($ret['sub'], -1) == '.' ) { // if ending by a "." it is allready a FQDN
|
||||||
|
$url="http://".$ret['sub'];
|
||||||
|
} else {
|
||||||
|
if ( $ret['sub'] == '@' || empty($ret['sub']) ) {
|
||||||
|
$url="http://".$domain;
|
||||||
|
} else {
|
||||||
|
$url="http://".$ret['sub'].".".$domain;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( $detect_redirect && $dst_url = $this->is_it_a_redirect($url) ) {
|
||||||
|
$val['status'] = 'warn';
|
||||||
|
$val['comment'] = "Became a redirect to $dst_url";
|
||||||
|
$val['entry_new']['type'] = 'URL';
|
||||||
|
$val['entry_new']['sub'] = $ret['sub'];
|
||||||
|
$val['entry_new']['value'] = $url;
|
||||||
|
} else {
|
||||||
|
$val['status'] = 'ok';
|
||||||
|
$val['comment'] = "Create entry CNAME with ".$ret['sub']." go to ".$ret['target']." with ttl ".$ret['ttl'];
|
||||||
|
$val['entry_new']['type'] = 'CNAME';
|
||||||
|
$val['entry_new']['sub'] = $ret['sub'];
|
||||||
|
$val['entry_new']['value'] = $ret['target'];
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
|
||||||
|
// Examples:
|
||||||
|
// @ IN MX 10 aspmx.l.google.com.
|
||||||
|
// arf 3600 IN MX 20 pouet.fr.
|
||||||
|
if ( preg_match('/^(?P<sub>[-\w\.@]*)\h*(?P<ttl>\d*)\h*IN\h+MX\h+(?P<weight>\d+)\h+(?P<target>[@\w+\.]+)/i', $zone, $ret) ) {
|
||||||
|
$val['status'] = 'ok';
|
||||||
|
$val['comment'] = "Create entry MX with ".$ret['sub']." go to ".$ret['target']." with ttl ".$ret['ttl']." and weight ".$ret['weight'];
|
||||||
|
$val['entry_new']['type'] = 'MX';
|
||||||
|
$val['entry_new']['sub'] = $ret['sub'];
|
||||||
|
$val['entry_new']['value'] = $ret['target'];
|
||||||
|
} else
|
||||||
|
|
||||||
|
// Examples:
|
||||||
|
// _sip._tcp IN SRV 1 100 5061 sip.example.tld.
|
||||||
|
if ( preg_match('/^(?P<sub>[_\w\.@]+)\h+(?P<ttl>\d*)\h*IN\h+SRV\h+/i', $zone, $ret) ) {
|
||||||
|
$val['status']='err';
|
||||||
|
$val['comment'] = "Please add yourself the entry $zone";
|
||||||
|
} else
|
||||||
|
|
||||||
|
// Examples:
|
||||||
|
// @ IN TXT "google-site-verification=jjjjjjjjjjjjjjjjjjjjjjjjsdsdjlksjdljdslgNj5"
|
||||||
|
if ( preg_match('/^(?P<sub>[_\w\.@]*)\h*(?P<ttl>\d*)\h*IN\h+TXT\h+\"(?P<target>.+)\"/i', $zone, $ret) ) {
|
||||||
|
$val['status']='ok';
|
||||||
|
$val['comment'] = "Create TXT entry with ".$ret['sub']." go to ".$ret['target'];
|
||||||
|
$val['entry_new']['type'] = 'TXT';
|
||||||
|
$val['entry_new']['sub'] = $ret['sub'];
|
||||||
|
$val['entry_new']['value'] = $ret['target'];
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// WTF can it be ?
|
||||||
|
$val['comment'] = "Unknow: $zone";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($save) {
|
||||||
|
return $this->import_manual_dns_entry_doit($val);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function import_manual_dns_entry_doit($entry) {
|
||||||
|
global $err;
|
||||||
|
if ( $entry['status'] == 'err' ) return false;
|
||||||
|
|
||||||
|
$val=$entry['entry_new'];
|
||||||
|
|
||||||
|
if (empty($val['type'])) return false;
|
||||||
|
|
||||||
|
switch($val['type']) {
|
||||||
|
case "set_ttl":
|
||||||
|
$entry['did_it'] = $this->set_ttl($this->get_domain_byname($val['domain']), $val['value']);
|
||||||
|
return $entry;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If it is a know domains type
|
||||||
|
if (! array_key_exists( strtolower($val['type']), $this->domains_type_lst() ) ) {
|
||||||
|
echo "what is this shit ?\n";
|
||||||
|
print_r($entry);
|
||||||
|
return $entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the subdomain is @, we want an empty subdomain
|
||||||
|
if ($val['sub'] == '@') $val['sub'] = '';
|
||||||
|
|
||||||
|
$this->lock();
|
||||||
|
$entry['did_it'] = $this->set_sub_domain($val['domain'], $val['sub'], $val['type'], $val['value']);
|
||||||
|
$this->unlock();
|
||||||
|
|
||||||
|
return $entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function import_manual_dns_prep_zone($domain) {
|
||||||
|
global $err;
|
||||||
|
// Prepare a domain to be importer :
|
||||||
|
// * create the domain
|
||||||
|
// * delete all automatic subdomain
|
||||||
|
// * set no mx
|
||||||
|
$this->lock();
|
||||||
|
|
||||||
|
// function add_domain($domain,$dns,$noerase=0,$force=0,$isslave=0,$slavedom="")
|
||||||
|
if (! $this->add_domain($domain, true, false, 1) ) {
|
||||||
|
$err->raise('dom', "Error adding domain");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set no mx
|
||||||
|
$this->edit_domain($domain, true, false);
|
||||||
|
|
||||||
|
$d = $this->get_domain_all($domain);
|
||||||
|
foreach( $d['sub'] as $sd) {
|
||||||
|
$this->del_sub_domain($sd['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->unlock();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Take an URL, and return FALSE is there is no redirection,
|
||||||
|
// and the target URL if there is one (HTTP CODE 301 & 302)
|
||||||
|
// CURL is needed
|
||||||
|
function is_it_a_redirect($url) {
|
||||||
|
try {
|
||||||
|
$params = array('http' => array(
|
||||||
|
'method' => 'HEAD',
|
||||||
|
'ignore_errors' => true
|
||||||
|
));
|
||||||
|
|
||||||
|
$context = stream_context_create($params);
|
||||||
|
$fp = @fopen($url, 'rb', false, $context);
|
||||||
|
$result = @stream_get_contents($fp);
|
||||||
|
|
||||||
|
if ($result === false) {
|
||||||
|
throw new Exception("Could not read data from {$url}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ( strstr($http_response_header[0], '301') || strstr($http_response_header[0], '302')) {
|
||||||
|
// This is a redirection
|
||||||
|
if ( preg_match( '/Location:\h+(?P<target>[\w:\/.\?\=.]+)/', implode("\n",$http_response_header), $ret ) ) {
|
||||||
|
// check if it is a redirection to himself
|
||||||
|
preg_match('/\/\/(?P<host>[\w\.\-]+)\//', ( substr($url,-1)=='/'?$url:$url.'/') , $original_cname);
|
||||||
|
preg_match('/\/\/(?P<host>[\w\.\-]+)\//', $ret['target'], $target_url);
|
||||||
|
if ($target_url['host'] == $original_cname['host']) { // if it's a redirection to himself (sub pages, http to https...)
|
||||||
|
return false; // do not do a redirection (we must point to the server)
|
||||||
|
}
|
||||||
|
return $ret['target'];
|
||||||
|
}
|
||||||
|
} else { // it isn't a redirection
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function domains_type_regenerate($name) {
|
function domains_type_regenerate($name) {
|
||||||
global $db,$err,$cuid;
|
global $db,$err,$cuid;
|
||||||
$name=mysql_real_escape_string($name);
|
$name=mysql_real_escape_string($name);
|
||||||
|
@ -784,6 +1044,7 @@ class m_dom {
|
||||||
$db->free();
|
$db->free();
|
||||||
$db->query("SELECT sd.*, dt.description AS type_desc, dt.only_dns FROM sub_domaines sd, domaines_type dt WHERE compte='$cuid' AND domaine='$dom' AND UPPER(dt.name)=UPPER(sd.type) ORDER BY sd.sub,sd.type");
|
$db->query("SELECT sd.*, dt.description AS type_desc, dt.only_dns FROM sub_domaines sd, domaines_type dt WHERE compte='$cuid' AND domaine='$dom' AND UPPER(dt.name)=UPPER(sd.type) ORDER BY sd.sub,sd.type");
|
||||||
// Pas de webmail, on le cochera si on le trouve.
|
// Pas de webmail, on le cochera si on le trouve.
|
||||||
|
$r["sub"]=array();
|
||||||
for($i=0;$i<$r["nsub"];$i++) {
|
for($i=0;$i<$r["nsub"];$i++) {
|
||||||
$db->next_record();
|
$db->next_record();
|
||||||
$r["sub"][$i]=array();
|
$r["sub"][$i]=array();
|
||||||
|
@ -1012,7 +1273,7 @@ class m_dom {
|
||||||
$db->next_record();
|
$db->next_record();
|
||||||
if ($db->f('create_tmpdir')) {
|
if ($db->f('create_tmpdir')) {
|
||||||
if (! is_dir($dest_root . "/tmp")) {
|
if (! is_dir($dest_root . "/tmp")) {
|
||||||
if(!mkdir($dest_root . "/tmp",0770,true)){
|
if(!@mkdir($dest_root . "/tmp",0770,true)){
|
||||||
$err->raise("dom",_("Cannot write to the destination folder"));
|
$err->raise("dom",_("Cannot write to the destination folder"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1065,6 +1326,18 @@ class m_dom {
|
||||||
} // del_sub_domain
|
} // del_sub_domain
|
||||||
|
|
||||||
|
|
||||||
|
function set_ttl($dom_id, $ttl) {
|
||||||
|
global $err;
|
||||||
|
$err->log("dom","set_ttl","$dom_id / $ttl");
|
||||||
|
$this->lock();
|
||||||
|
$domaine = $this->get_domain_byid($dom_id);
|
||||||
|
$d = $this->get_domain_all($domaine);
|
||||||
|
|
||||||
|
$j = $this->edit_domain($domaine, $d['dns'], $d['mail'], 0, $ttl);
|
||||||
|
$this->unlock();
|
||||||
|
return $j;
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
/**
|
/**
|
||||||
* Modifie les information du domaine précisé.
|
* Modifie les information du domaine précisé.
|
||||||
|
|
Loading…
Reference in New Issue