From 8681618566f8492a9714ae4cb208198202d3cb04 Mon Sep 17 00:00:00 2001 From: Alan Garcia Date: Tue, 2 Jul 2013 15:31:16 +0000 Subject: [PATCH] La fonction sub_domain_change_status utilise maintenant l'id systeme du sub_domain --- bureau/admin/dom_edit.php | 8 ++++---- bureau/admin/dom_substatus.php | 12 +++++++----- bureau/class/m_dom.php | 8 +++++--- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/bureau/admin/dom_edit.php b/bureau/admin/dom_edit.php index 4d42b160..7a67ea98 100644 --- a/bureau/admin/dom_edit.php +++ b/bureau/admin/dom_edit.php @@ -31,8 +31,8 @@ require_once("../class/config.php"); include_once("head.php"); $fields = array ( - "domain" => array ("request", "string", ""), - "sub" => array ("request", "string", ""), + "domain" => array ("request", "string", (empty($domain)?"":$domain) ), + "sub" => array ("request", "string", (empty($sub)?"":$sub) ), ); getFields($fields); @@ -154,14 +154,14 @@ for($i=0;$i<$r["nsub"];$i++) { switch ($r['sub'][$i]['enable']) { case 'ENABLED': __("Enabled"); - echo "
";__("Disable");echo ""; + echo "
";__("Disable");echo ""; break; case 'ENABLE': __("Activation pending"); break; case 'DISABLED': __("Disabled"); - echo "
";__("Enable");echo ""; + echo "
";__("Enable");echo ""; break; case 'DISABLE': __("Desactivation pending"); diff --git a/bureau/admin/dom_substatus.php b/bureau/admin/dom_substatus.php index 71998be4..5f703772 100644 --- a/bureau/admin/dom_substatus.php +++ b/bureau/admin/dom_substatus.php @@ -2,17 +2,19 @@ require_once("../class/config.php"); $fields = array ( - "domain" => array ("request", "string", ""), - "sub" => array ("request", "string", ""), - "type" => array ("request", "string", ""), - "value" => array ("request", "string", ""), + "sub_id" => array ("request", "integer", ""), "status" => array ("request", "string", ""), ); getFields($fields); $dom->lock(); -$r=$dom->sub_domain_change_status($domain,$sub,$type,$value,$status); +$r=$dom->sub_domain_change_status($sub_id,$status); + +# Usefull for dom_edit +$domi = $dom->get_sub_domain_all($sub_id); +$domain=$domi['domain']; +$sub=$domi['name']; $dom->unlock(); diff --git a/bureau/class/m_dom.php b/bureau/class/m_dom.php index 0fd7cca6..1c6f9b56 100644 --- a/bureau/class/m_dom.php +++ b/bureau/class/m_dom.php @@ -206,13 +206,15 @@ class m_dom { return true; } - function sub_domain_change_status($domain,$sub,$type,$value,$status) { + function sub_domain_change_status($sub_id,$status) { global $db,$err,$cuid; $err->log("dom","sub_domain_change_status"); + $sub_id=intval($sub_id); $status=strtoupper($status); if (! in_array($status,array('ENABLE', 'DISABLE'))) return false; + // FIXME: add check with can_create_subdomain - $db->query("update sub_domaines set enable='$status' where domaine='$domain' and sub='$sub' and lower(type)=lower('$type') and valeur='$value'"); + $db->query("update sub_domaines set enable='$status' where id = '$sub_id'"); return true; } @@ -916,7 +918,7 @@ class m_dom { $compatibility_lst = explode(",",$db->f('compatibility')); // Get the list of type of subdomains already here who have the same name - $db->query("select * from sub_domaines where sub='$sub' and domaine='$dom' and not id = $sub_domain_id and web_action != 'DELETE'"); + $db->query("select * from sub_domaines where sub='$sub' and domaine='$dom' and not id = $sub_domain_id and web_action != 'DELETE' and enabled not in ('DISABLED', 'DISABLE') "); #$db->query("select * from sub_domaines where sub='$sub' and domaine='$dom';"); while ($db->next_record()) { // And if there is a domain with a incompatible type, return false