diff --git a/core/domain_settings/app_config.php b/core/domain_settings/app_config.php index c0f504d709..e3898efd6f 100644 --- a/core/domain_settings/app_config.php +++ b/core/domain_settings/app_config.php @@ -68,10 +68,22 @@ $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary"; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_parent_uuid"; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; + $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign"; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains"; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid"; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_name"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the domain name."; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_enabled"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Set the status of the domain."; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_description"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the description."; @@ -90,6 +102,8 @@ $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign"; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains"; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid"; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_setting_uuid"; $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; diff --git a/core/domain_settings/app_defaults.php b/core/domain_settings/app_defaults.php index bddc363f9c..95633206c5 100644 --- a/core/domain_settings/app_defaults.php +++ b/core/domain_settings/app_defaults.php @@ -34,4 +34,14 @@ //unset($sql); } +//proccess this only one time +if ($domains_processed == 1) { + + //set domains with enabled status of empty or null to true + $sql = "update v_domains set domain_enabled = 'true' where domain_enabled = '' or domain_enabled is null"; + $db->exec(check_sql($sql)); + unset($sql); + +} + ?> \ No newline at end of file diff --git a/core/domain_settings/app_languages.php b/core/domain_settings/app_languages.php index 9f993570cc..4432e5d3e9 100644 --- a/core/domain_settings/app_languages.php +++ b/core/domain_settings/app_languages.php @@ -170,10 +170,10 @@ $text['label-enabled']['pt-pt'] = "Habilitado"; $text['label-enabled']['fr-fr'] = "Actif"; - $text['description-enabled']['en-us'] = "Set the status of this default setting."; - $text['description-enabled']['es-cl'] = "Configure el estado de esta configuración predeterminada."; - $text['description-enabled']['pt-pt'] = "Escolha o estado desta definição por omissão."; - $text['description-enabled']['fr-fr'] = "Choisir l'état de ce paramètre"; + $text['description-setting_enabled']['en-us'] = "Set the status of this default setting."; + $text['description-setting_enabled']['es-cl'] = "Configure el estado de esta configuración predeterminada."; + $text['description-setting_enabled']['pt-pt'] = "Escolha o estado desta definição por omissão."; + $text['description-setting_enabled']['fr-fr'] = "Choisir l'état de ce paramètre"; $text['label-description']['en-us'] = "Description"; $text['label-description']['es-cl'] = "Descripción"; @@ -270,4 +270,24 @@ $text['message-required']['pt-pt'] = "Por favor indique: "; $text['message-required']['fr-fr'] = "Merci d'indiquer: "; + $text['description-domain_enabled']['en-us'] = "Set the status of the domain."; + $text['description-domain_enabled']['es-cl'] = "Ajuste el estado del dominio."; + $text['description-domain_enabled']['pt-pt'] = "Definir o estado do domínio."; + $text['description-domain_enabled']['fr-fr'] = "Régler le statut du domaine."; + + $text['label-parent_domain']['en-us'] = "Parent Domain"; + $text['label-parent_domain']['es-cl'] = "Dominio de los Padres"; + $text['label-parent_domain']['pt-pt'] = "Domínio Parent"; + $text['label-parent_domain']['fr-fr'] = "Domaine Parent"; + + $text['description-parent_domain']['en-us'] = "Set the parent domain."; + $text['description-parent_domain']['es-cl'] = "Establecer el dominio principal."; + $text['description-parent_domain']['pt-pt'] = "Defina o domínio pai."; + $text['description-parent_domain']['fr-fr'] = "Réglez le domaine parent."; + + $text['label-disabled']['en-us'] = "Disabled"; + $text['label-disabled']['es-cl'] = "Discapacitado"; + $text['label-disabled']['pt-pt'] = "Inválido"; + $text['label-disabled']['fr-fr'] = "Non Permis"; + ?> \ No newline at end of file diff --git a/core/domain_settings/domain_edit.php b/core/domain_settings/domain_edit.php index ec6d903bd1..838da35567 100644 --- a/core/domain_settings/domain_edit.php +++ b/core/domain_settings/domain_edit.php @@ -50,7 +50,11 @@ else { //get http post variables and set them to php variables if (count($_POST) > 0) { $domain_name = strtolower(check_str($_POST["domain_name"])); + $domain_parent_uuid = check_str($_POST["domain_parent_uuid"]); + $domain_enabled = check_str($_POST["domain_enabled"]); $domain_description = check_str($_POST["domain_description"]); + + $domain_parent_uuid = ($domain_parent_uuid == '') ? 'null' : "'".$domain_parent_uuid."'"; // fix null } if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { @@ -80,7 +84,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if ($_POST["persistformvar"] != "true") { if ($action == "add" && permission_exists('domain_add')) { $sql = "select count(*) as num_rows from v_domains "; - $sql .= "where domain_name = '$domain_name' "; + $sql .= "where domain_name = '".$domain_name."' "; $prep_statement = $db->prepare($sql); if ($prep_statement) { $prep_statement->execute(); @@ -90,13 +94,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "("; $sql .= "domain_uuid, "; $sql .= "domain_name, "; + $sql .= "domain_parent_uuid, "; + $sql .= "domain_enabled, "; $sql .= "domain_description "; $sql .= ")"; $sql .= "values "; $sql .= "("; $sql .= "'".uuid()."', "; - $sql .= "'$domain_name', "; - $sql .= "'$domain_description' "; + $sql .= "'".$domain_name."', "; + $sql .= $domain_parent_uuid.", "; + $sql .= "'".$domain_enabled."', "; + $sql .= "'".$domain_description."' "; $sql .= ")"; $db->exec(check_sql($sql)); unset($sql); @@ -120,6 +128,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { // update domain name, description $sql = "update v_domains set "; $sql .= "domain_name = '".$domain_name."', "; + $sql .= "domain_parent_uuid = ".$domain_parent_uuid.", "; + $sql .= "domain_enabled = '".$domain_enabled."', "; $sql .= "domain_description = '".$domain_description."' "; $sql .= "where domain_uuid = '".$domain_uuid."' "; $db->exec(check_sql($sql)); @@ -550,6 +560,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { $domain_name = strtolower($row["domain_name"]); + $domain_parent_uuid = $row["domain_parent_uuid"]; + $domain_enabled = $row["domain_enabled"]; $domain_description = $row["domain_description"]; } unset ($prep_statement); @@ -565,16 +577,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } //show the content - echo "
| \n";
- echo " "; - echo " |