[fix] the compatibility system of domaines_types was not working. Fixing that (null in SQL is awefully weird)
This commit is contained in:
parent
1c6191eabc
commit
80ec8fc748
|
@ -32,7 +32,7 @@ $dom->unlock();
|
|||
<tr>
|
||||
<td>
|
||||
<input type="hidden" name="domain" value="<?php ehe($domain) ?>" />
|
||||
<input type="hidden" name="sub_domain_id" value="<?php ehe($sub_domain_id); ?>" />
|
||||
<input type="hidden" name="sub_domain_id" value="<?php echo intval($sub_domain_id); ?>" />
|
||||
<input type="hidden" name="action" value="add" />
|
||||
<?php
|
||||
if ($isedit) {
|
||||
|
|
|
@ -33,7 +33,7 @@ $fields = array (
|
|||
"domain" => array ("post", "string", ""),
|
||||
"sub" => array ("post", "string", ""),
|
||||
"type" => array ("post", "string", $dom->type_local),
|
||||
"sub_domain_id" => array ("post", "integer", ""),
|
||||
"sub_domain_id" => array ("post", "integer", 0),
|
||||
);
|
||||
getFields($fields);
|
||||
|
||||
|
@ -61,8 +61,13 @@ $r=$dom->set_sub_domain($domain,$sub,$type,$value, $sub_domain_id);
|
|||
$dom->unlock();
|
||||
|
||||
if (!$r) {
|
||||
if ($sub_domain_id!=0) {
|
||||
$noread=true;
|
||||
include("dom_subedit.php");
|
||||
} else {
|
||||
// it was a creation, not an edit
|
||||
include("dom_edit.php");
|
||||
}
|
||||
exit();
|
||||
} else {
|
||||
$t = time();
|
||||
|
|
|
@ -32,7 +32,7 @@ include_once("head.php");
|
|||
|
||||
|
||||
$fields = array (
|
||||
"sub_domain_id" => array ("request", "integer", ""),
|
||||
"sub_domain_id" => array ("request", "integer", 0),
|
||||
);
|
||||
getFields($fields);
|
||||
|
||||
|
|
|
@ -1339,9 +1339,11 @@ class m_dom {
|
|||
* @param string $sub SUBdomain
|
||||
* @return boolean tell you if the subdomain can be installed there
|
||||
*/
|
||||
function can_create_subdomain($dom, $sub, $type, $sub_domain_id = 'null') {
|
||||
function can_create_subdomain($dom, $sub, $type, $sub_domain_id = 0) {
|
||||
global $db, $msg;
|
||||
$msg->log("dom", "can_create_subdomain", $dom . "/" . $sub);
|
||||
|
||||
$sub_domain_id=intval($sub_domain_id);
|
||||
$msg->log("dom", "can_create_subdomain", $dom . "/" . $sub . "/" .$type . "/" . $sub_domain_id);
|
||||
|
||||
// Get the compatibility list for this domain type
|
||||
$db->query("select upper(compatibility) as compatibility from domaines_type where upper(name)=upper(?);", array($type));
|
||||
|
@ -1382,7 +1384,7 @@ class m_dom {
|
|||
* de $type (url, ip, dossier...)
|
||||
* @return boolean Retourne FALSE si une erreur s'est produite, TRUE sinon.
|
||||
*/
|
||||
function set_sub_domain($dom, $sub, $type, $dest, $sub_domain_id = null) {
|
||||
function set_sub_domain($dom, $sub, $type, $dest, $sub_domain_id = 0) {
|
||||
global $db, $msg, $cuid, $bro;
|
||||
$msg->log("dom", "set_sub_domain", $dom . "/" . $sub . "/" . $type . "/" . $dest);
|
||||
// Locked ?
|
||||
|
@ -1420,12 +1422,12 @@ class m_dom {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!is_null($sub_domain_id) && !empty($sub_domain_id)) { // It's not a creation, it's an edit. Delete the old one
|
||||
if ($sub_domain_id!=0) { // It's not a creation, it's an edit. Delete the old one
|
||||
$this->del_sub_domain($sub_domain_id);
|
||||
}
|
||||
|
||||
// Re-create the one we want
|
||||
if (!$db->query("replace into sub_domaines (compte,domaine,sub,valeur,type,web_action) values (?, ?, ?, ?, ?, 'UPDATE');", array( $cuid , $dom , $sub , $dest , $type ))) {
|
||||
if (!$db->query("INSERT INTO sub_domaines (compte,domaine,sub,valeur,type,web_action) VALUES (?, ?, ?, ?, ?, 'UPDATE');", array( $cuid , $dom , $sub , $dest , $type ))) {
|
||||
echo "query failed: " . $db->Error;
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue