From b371b57465bde9557505156a0313558571295b8b Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 30 Dec 2019 12:14:57 -0700 Subject: [PATCH] Domain Settings: List view updates, move actions to class. --- core/default_settings/default_settings.php | 2 - core/domain_settings/app_languages.php | 40 -- core/domain_settings/domain_settings.php | 317 +++++++------- .../resources/classes/domain_settings.php | 395 ++++++++++++++++++ core/domains/app_languages.php | 38 +- core/domains/domain_edit.php | 41 +- 6 files changed, 600 insertions(+), 233 deletions(-) create mode 100644 core/domain_settings/resources/classes/domain_settings.php diff --git a/core/default_settings/default_settings.php b/core/default_settings/default_settings.php index c1c108fa18..813e7d262c 100644 --- a/core/default_settings/default_settings.php +++ b/core/default_settings/default_settings.php @@ -234,7 +234,6 @@ echo "  \n"; } echo "\n"; - } if (permission_exists('default_setting_edit')) { $list_row_url = "default_setting_edit.php?id=".urlencode($row['default_setting_uuid']); @@ -305,7 +304,6 @@ echo " ".escape($row['default_setting_value'])."\n"; } echo " \n"; - if (permission_exists('default_setting_edit')) { echo " \n"; echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.$row['default_setting_enabled']],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]); diff --git a/core/domain_settings/app_languages.php b/core/domain_settings/app_languages.php index db4916cafb..9e65d41e1f 100644 --- a/core/domain_settings/app_languages.php +++ b/core/domain_settings/app_languages.php @@ -621,46 +621,6 @@ $text['header-domain_setting-add']['ru-ru'] = "Добавить настройк $text['header-domain_setting-add']['sv-se'] = "Lägg Till Domän Inställning"; $text['header-domain_setting-add']['uk-ua'] = "Параметри домену"; -$text['header-domain-edit']['en-us'] = "Domain"; -$text['header-domain-edit']['ar-eg'] = ""; -$text['header-domain-edit']['de-at'] = "Domain"; //copied from de-de -$text['header-domain-edit']['de-ch'] = "Domain"; //copied from de-de -$text['header-domain-edit']['de-de'] = "Domain"; -$text['header-domain-edit']['es-cl'] = "Dominio"; -$text['header-domain-edit']['es-mx'] = "Dominio"; //copied from es-cl -$text['header-domain-edit']['fr-ca'] = "Domaine"; //copied from fr-fr -$text['header-domain-edit']['fr-fr'] = "Domaine"; -$text['header-domain-edit']['he-il'] = ""; -$text['header-domain-edit']['it-it'] = "Dominio"; -$text['header-domain-edit']['nl-nl'] = ""; -$text['header-domain-edit']['pl-pl'] = "Domena"; -$text['header-domain-edit']['pt-br'] = "Dominio"; -$text['header-domain-edit']['pt-pt'] = "Domínio"; -$text['header-domain-edit']['ro-ro'] = ""; -$text['header-domain-edit']['ru-ru'] = "Домен"; -$text['header-domain-edit']['sv-se'] = "Domän"; -$text['header-domain-edit']['uk-ua'] = "Домен"; - -$text['header-domain-add']['en-us'] = "Domain Add"; -$text['header-domain-add']['ar-eg'] = ""; -$text['header-domain-add']['de-at'] = "Domain hinzufügen"; //copied from de-de -$text['header-domain-add']['de-ch'] = "Domain hinzufügen"; //copied from de-de -$text['header-domain-add']['de-de'] = "Domain hinzufügen"; -$text['header-domain-add']['es-cl'] = "Agregar Dominio"; -$text['header-domain-add']['es-mx'] = "Agregar Dominio"; //copied from es-cl -$text['header-domain-add']['fr-ca'] = "Ajouter un Domaine"; //copied from fr-fr -$text['header-domain-add']['fr-fr'] = "Ajouter un Domaine"; -$text['header-domain-add']['he-il'] = ""; -$text['header-domain-add']['it-it'] = "Inserisci Dominio"; -$text['header-domain-add']['nl-nl'] = ""; -$text['header-domain-add']['pl-pl'] = "Dodaj domenę"; -$text['header-domain-add']['pt-br'] = "Adicionar dominio"; -$text['header-domain-add']['pt-pt'] = "Adicionar Domínio"; -$text['header-domain-add']['ro-ro'] = ""; -$text['header-domain-add']['ru-ru'] = "Добавить домен"; -$text['header-domain-add']['sv-se'] = "Lägg Till Domän"; -$text['header-domain-add']['uk-ua'] = "Новий домен"; - $text['description-setting_enabled']['en-us'] = "Set the status of this default setting."; $text['description-setting_enabled']['ar-eg'] = ""; $text['description-setting_enabled']['de-at'] = "Setzen Sie den Status dieser Standardeinstellung."; //copied from de-de diff --git a/core/domain_settings/domain_settings.php b/core/domain_settings/domain_settings.php index 40b5fda924..859810ffa3 100644 --- a/core/domain_settings/domain_settings.php +++ b/core/domain_settings/domain_settings.php @@ -37,6 +37,47 @@ exit; } +//get the http post data + if ($_POST['action'] != '') { + $action = $_POST['action']; + $domain_uuid = $_POST['domain_uuid']; + $domain_settings = $_POST['domain_settings']; + $domain_uuid_target = $_POST['domain_uuid_target']; + + //process the http post data by action + if (is_array($domain_settings) && @sizeof($domain_settings) != 0) { + switch ($action) { + case 'copy': + if (permission_exists('domain_setting_add') && permission_exists('domain_select') && count($_SESSION['domains']) > 1) { + $obj = new domain_settings; + $obj->domain_uuid = $domain_uuid; + $obj->domain_uuid_target = $domain_uuid_target; + $obj->copy($domain_settings); + } + break; + case 'toggle': + if (permission_exists('domain_setting_edit')) { + $obj = new domain_settings; + $obj->domain_uuid = $domain_uuid; + $obj->toggle($domain_settings); + } + break; + case 'delete': + if (permission_exists('domain_setting_delete')) { + $obj = new domain_settings; + $obj->domain_uuid = $domain_uuid; + $obj->delete($domain_settings); + } + break; + } + } + + //redirect + header('Location: '.PROJECT_PATH.'/core/domains/domain_edit.php?id='.urlencode($_REQUEST['domain_uuid'])); + exit; + } + +/* //get posted values, if any if (is_array($_REQUEST) && @sizeof($_REQUEST) > 1) { //get the variables @@ -45,6 +86,7 @@ $domain_setting_uuids = $_REQUEST["id"]; $enabled = $_REQUEST['enabled']; + //validate the token $token = new token; if (!$token->validate(PROJECT_PATH."/core/domains/domain_edit.php")) { @@ -310,48 +352,34 @@ } } -//include the paging - require_once "resources/paging.php"; +*/ //get the variables $order_by = $_GET["order_by"]; $order = $_GET["order"]; //prepare to page the results - $sql = "select count(*) from v_domain_settings "; + $sql = "select count(domain_setting_uuid) from v_domain_settings "; $sql .= "where domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $domain_uuid; $database = new database; $num_rows = $database->select($sql, $parameters, 'column'); - unset($sql); - -//prepare to page the results - $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 1000; - $param = ""; - if (isset($_GET['page'])) { - $page = $_GET['page']; - if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } - list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); - $offset = $rows_per_page * $page; - } //get the list - $sql = "select * from v_domain_settings "; - $sql .= "where domain_uuid = :domain_uuid "; + $sql = str_replace('count(domain_setting_uuid)', '*', $sql); if ($order_by == '') { - $sql .= "order by domain_setting_category, domain_setting_subcategory, domain_setting_order asc, domain_setting_name, domain_setting_value "; + $sql .= " order by domain_setting_category, domain_setting_subcategory, domain_setting_order asc, domain_setting_name, domain_setting_value "; } else { $sql .= order_by($order_by, $order); } - $sql .= limit_offset($rows_per_page, $offset); $database = new database; - $result = $database->select($sql, $parameters, 'all'); + $domain_settings = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); - $c = 0; - $row_style["0"] = "row_style0"; - $row_style["1"] = "row_style1"; +//create token + $object = new token; + $token = $object->create('/core/domain_settings/domain_settings.php'); //copy settings javascript if ( @@ -364,123 +392,134 @@ echo " var fade_speed = 400;\n"; echo " function show_domains() {\n"; echo " $('#button_copy').fadeOut(fade_speed, function() {\n"; - echo " $('#button_back').fadeIn(fade_speed);\n"; - echo " $('#target_domain_uuid').fadeIn(fade_speed);\n"; + echo " $('#button_reset').fadeIn(fade_speed);\n"; + echo " $('#target_domain').fadeIn(fade_speed);\n"; echo " $('#button_paste').fadeIn(fade_speed);\n"; + echo " document.getElementById('domain_uuid_target').value = '';\n"; echo " });"; echo " }"; echo " function hide_domains() {\n"; - echo " $('#button_back').fadeOut(fade_speed);\n"; - echo " $('#target_domain_uuid').fadeOut(fade_speed);\n"; + echo " $('#button_reset').fadeOut(fade_speed);\n"; + echo " $('#target_domain').fadeOut(fade_speed);\n"; echo " $('#button_paste').fadeOut(fade_speed, function() {\n"; echo " $('#button_copy').fadeIn(fade_speed);\n"; - echo " document.getElementById('target_domain_uuid').selectedIndex = 0;\n"; + echo " document.getElementById('target_domain').selectedIndex = 0;\n"; + echo " document.getElementById('domain_uuid_target').value = '';\n"; echo " });\n"; echo " }\n"; echo ""; } //show the content - echo "
\n"; - echo "\n"; - echo "\n"; - - echo "
\n"; + echo "
\n"; + echo "
".$text['header-domain_settings']." (".$num_rows.")
\n"; + echo "
\n"; if (permission_exists('domain_setting_add')) { - echo ""; + echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'link'=>PROJECT_PATH."/core/domain_settings/domain_setting_edit.php?domain_uuid=".urlencode($domain_uuid)]); } - if (is_array($result) && @sizeof($result) != 0) { - if (permission_exists("domain_select") && permission_exists("domain_setting_add") && count($_SESSION['domains']) > 1) { - echo " "; - echo " "; - echo " \n"; - echo " "; + if (permission_exists("domain_select") && permission_exists("domain_setting_add") && $num_rows) { + echo button::create(['type'=>'button','label'=>$text['button-copy'],'id'=>'button_copy','icon'=>$_SESSION['theme']['button_icon_copy'],'onclick'=>'show_domains();']); + echo button::create(['type'=>'button','label'=>$text['button-reset'],'id'=>'button_reset','icon'=>$_SESSION['theme']['button_icon_reset'],'style'=>'display: none;','onclick'=>'hide_domains();']); + echo ""; + echo button::create(['type'=>'button','label'=>$text['button-paste'],'id'=>'button_paste','icon'=>$_SESSION['theme']['button_icon_paste'],'style'=>'display: none;','onclick'=>"if (confirm('".$text['confirm-copy']."')) { list_action_set('copy'); list_form_submit('form_list'); } else { this.blur(); return false; }"]); } - if (permission_exists('default_setting_view') && is_array($result) && @sizeof($result) != 0) { + if (permission_exists('domain_setting_edit') && $num_rows) { + echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'onclick'=>"if (confirm('".$text['confirm-toggle']."')) { list_action_set('toggle'); list_form_submit('form_list'); } else { this.blur(); return false; }"]); + } + if (permission_exists('domain_setting_delete') && $num_rows) { + echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]); + } + if (permission_exists('default_setting_view') && $num_rows) { echo button::create(['type'=>'button','label'=>$text['button-reload'],'icon'=>$_SESSION['theme']['button_icon_reload'],'style'=>'margin-left: 15px;','link'=>PROJECT_PATH.'/core/default_settings/default_settings_reload.php?id='.$domain_uuid]); } + echo "
\n"; + echo "
\n"; echo "
\n"; - echo "".$text['header-domain_settings'].""; - echo "

\n"; - echo "\n"; + echo $text['header_description-domain_settings']."\n"; + echo "

\n"; - if (is_array($result) && @sizeof($result) != 0) { - $previous_category = ''; - foreach($result as $row) { - if ($previous_category != $row['domain_setting_category']) { - $c = 0; - echo "\n"; - echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; - echo "
".$paging_controls."
"; - - echo ""; - - echo "

"; - - // check or uncheck all category checkboxes - if (isset($subcat_ids) && sizeof($subcat_ids) > 0) { - echo "\n"; - } - - //handle form actions - echo "\n"; - -?> +?> \ No newline at end of file diff --git a/core/domain_settings/resources/classes/domain_settings.php b/core/domain_settings/resources/classes/domain_settings.php new file mode 100644 index 0000000000..f4d810cd71 --- /dev/null +++ b/core/domain_settings/resources/classes/domain_settings.php @@ -0,0 +1,395 @@ + + Portions created by the Initial Developer are Copyright (C) 2019 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ + +//define the domain settings class +if (!class_exists('domain_settings')) { + class domain_settings { + + /** + * declare private variables + */ + private $app_name; + private $app_uuid; + private $permission_prefix; + private $list_page; + private $table; + private $uuid_prefix; + private $toggle_field; + private $toggle_values; + + /** + * declare public variables + */ + public $domain_uuid; + public $domain_uuid_target; + + /** + * called when the object is created + */ + public function __construct() { + + //assign private variables + $this->app_name = 'domain_settings'; + $this->app_uuid = 'b31e723a-bf70-670c-a49b-470d2a232f71'; + $this->permission_prefix = 'domain_setting_'; + $this->list_page = PROJECT_PATH."/core/domains/domain_edit.php?id=".urlencode($this->domain_uuid); + $this->table = 'domain_settings'; + $this->uuid_prefix = 'domain_setting_'; + $this->toggle_field = 'domain_setting_enabled'; + $this->toggle_values = ['true','false']; + + } + + /** + * called when there are no references to a particular object + * unset the variables used in the class + */ + public function __destruct() { + foreach ($this as $key => $value) { + unset($this->$key); + } + } + + /** + * delete records + */ + public function delete($records) { + if (permission_exists($this->permission_prefix.'delete')) { + + //add multi-lingual support + $language = new text; + $text = $language->get(); + + //validate the token + $token = new token; + if (!$token->validate('/core/domain_settings/domain_settings.php')) { + message::add($text['message-invalid_token'],'negative'); + header('Location: '.$this->list_page); + exit; + } + + //delete multiple records + if (is_array($records) && @sizeof($records) != 0) { + + //build the delete array + foreach ($records as $x => $record) { + if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid']; + $array[$this->table][$x]['domain_uuid'] = $this->domain_uuid; + } + } + + //delete the checked rows + if (is_array($array) && @sizeof($array) != 0) { + + //execute delete + $database = new database; + $database->app_name = $this->app_name; + $database->app_uuid = $this->app_uuid; + $database->delete($array); + unset($array); + + //set message + message::add($text['message-delete']); + } + unset($records); + } + } + } + + /** + * toggle records + */ + public function toggle($records) { + if (permission_exists($this->permission_prefix.'edit')) { + + //add multi-lingual support + $language = new text; + $text = $language->get(); + + //validate the token + $token = new token; + if (!$token->validate('/core/domain_settings/domain_settings.php')) { + message::add($text['message-invalid_token'],'negative'); + header('Location: '.$this->list_page); + exit; + } + + //toggle the checked records + if (is_array($records) && @sizeof($records) != 0) { + + //get current toggle state + foreach ($records as $x => $record) { + if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + $uuids[] = "'".$record['uuid']."'"; + } + } + if (is_array($uuids) && @sizeof($uuids) != 0) { + $sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." "; + $sql .= "where domain_uuid = :domain_uuid "; + $sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") "; + $parameters['domain_uuid'] = $this->domain_uuid; + $database = new database; + $rows = $database->select($sql, $parameters, 'all'); + if (is_array($rows) && @sizeof($rows) != 0) { + foreach ($rows as $row) { + $states[$row['uuid']] = $row['toggle']; + } + } + unset($sql, $parameters, $rows, $row); + } + + //build update array + if (is_array($states) && @sizeof($states) != 0) { + $x = 0; + foreach ($states as $uuid => $state) { + $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid; + $array[$this->table][$x][$this->toggle_field] = $state == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0]; + $x++; + } + } + + //save the changes + if (is_array($array) && @sizeof($array) != 0) { + + //save the array + $database = new database; + $database->app_name = $this->app_name; + $database->app_uuid = $this->app_uuid; + $database->save($array); + unset($array); + + //set message + message::add($text['message-toggle']); + } + unset($records, $states); + } + + } + } + + /** + * copy records + */ + public function copy($records) { + if (permission_exists($this->permission_prefix.'add') && permission_exists('domain_select') && count($_SESSION['domains']) > 1) { + + //add multi-lingual support + $language = new text; + $text = $language->get(); + + //validate the token + $token = new token; + if (!$token->validate('/core/domain_settings/domain_settings.php')) { + message::add($text['message-invalid_token'],'negative'); + header('Location: '.$this->location); + exit; + } + + //copy the checked records + if (is_array($records) && @sizeof($records) != 0) { + + //get checked records + foreach($records as $record) { + if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { + $uuids[] = $record['uuid']; + } + } + if (is_array($uuids) && @sizeof($uuids) != 0) { + + $settings_copied = 0; + + //to different domain + if (is_uuid($this->domain_uuid_target)) { + + foreach ($uuids as $uuid) { + + //get domain setting from db + $sql = "select * from v_domain_settings "; + $sql .= "where domain_setting_uuid = :domain_setting_uuid "; + $parameters['domain_setting_uuid'] = $uuid; + $database = new database; + $row = $database->select($sql, $parameters, 'row'); + if (is_array($row) && sizeof($row) != 0) { + $domain_setting_category = $row["domain_setting_category"]; + $domain_setting_subcategory = $row["domain_setting_subcategory"]; + $domain_setting_name = $row["domain_setting_name"]; + $domain_setting_value = $row["domain_setting_value"]; + $domain_setting_order = $row["domain_setting_order"]; + $domain_setting_enabled = $row["domain_setting_enabled"]; + $domain_setting_description = $row["domain_setting_description"]; + } + unset($sql, $parameters, $row); + + //set a random password for http_auth_password + if ($domain_setting_subcategory == "http_auth_password") { + $domain_setting_value = generate_password(); + } + + // check if exists + $sql = "select domain_setting_uuid from v_domain_settings "; + $sql .= "where domain_uuid = :domain_uuid "; + $sql .= "and domain_setting_category = :domain_setting_category "; + $sql .= "and domain_setting_subcategory = :domain_setting_subcategory "; + $sql .= "and domain_setting_name = :domain_setting_name "; + $sql .= "and domain_setting_name <> 'array' "; + $parameters['domain_uuid'] = $this->domain_uuid_target; + $parameters['domain_setting_category'] = $domain_setting_category; + $parameters['domain_setting_subcategory'] = $domain_setting_subcategory; + $parameters['domain_setting_name'] = $domain_setting_name; + $database = new database; + $target_domain_setting_uuid = $database->select($sql, $parameters, 'column'); + + $action = is_uuid($target_domain_setting_uuid) ? 'update' : 'add'; + unset($sql, $parameters); + + // fix null + $domain_setting_order = $domain_setting_order != '' ? $domain_setting_order : null; + + //begin array + $array['domain_settings'][0]['domain_uuid'] = $this->domain_uuid_target; + $array['domain_settings'][0]['domain_setting_category'] = $domain_setting_category; + $array['domain_settings'][0]['domain_setting_subcategory'] = $domain_setting_subcategory; + $array['domain_settings'][0]['domain_setting_name'] = $domain_setting_name; + $array['domain_settings'][0]['domain_setting_value'] = $domain_setting_value; + $array['domain_settings'][0]['domain_setting_order'] = $domain_setting_order; + $array['domain_settings'][0]['domain_setting_enabled'] = $domain_setting_enabled; + $array['domain_settings'][0]['domain_setting_description'] = $domain_setting_description; + + //insert + if ($action == "add" && permission_exists("domain_setting_add")) { + $array['domain_settings'][0]['domain_setting_uuid'] = uuid(); + } + //update + if ($action == "update" && permission_exists('domain_setting_edit')) { + $array['domain_settings'][0]['domain_setting_uuid'] = $target_domain_setting_uuid; + } + + //execute + if (is_uuid($array['domain_settings'][0]['domain_setting_uuid'])) { + $database = new database; + $database->app_name = 'domain_settings'; + $database->app_uuid = 'b31e723a-bf70-670c-a49b-470d2a232f71'; + $database->save($array); + unset($array); + + $settings_copied++; + } + + } //foreach + } //if + + //to default settings + else if ($this->domain_uuid_target == 'default') { + foreach ($uuids as $uuid) { + + //get domain setting from db + $sql = "select * from v_domain_settings "; + $sql .= "where domain_setting_uuid = :domain_setting_uuid "; + $parameters['domain_setting_uuid'] = $uuid; + $database = new database; + $row = $database->select($sql, $parameters, 'row'); + if (is_array($row) && sizeof($row) != 0) { + $domain_setting_category = $row["domain_setting_category"]; + $domain_setting_subcategory = $row["domain_setting_subcategory"]; + $domain_setting_name = $row["domain_setting_name"]; + $domain_setting_value = $row["domain_setting_value"]; + $domain_setting_order = $row["domain_setting_order"]; + $domain_setting_enabled = $row["domain_setting_enabled"]; + $domain_setting_description = $row["domain_setting_description"]; + } + unset($sql, $parameters, $row); + + //set a random password for http_auth_password + if ($domain_setting_subcategory == "http_auth_password") { + $domain_setting_value = generate_password(); + } + + // check if exists + $sql = "select default_setting_uuid from v_default_settings "; + $sql .= "where default_setting_category = :default_setting_category "; + $sql .= "and default_setting_subcategory = :default_setting_subcategory "; + $sql .= "and default_setting_name = :default_setting_name "; + $sql .= "and default_setting_name <> 'array' "; + $parameters['default_setting_category'] = $domain_setting_category; + $parameters['default_setting_subcategory'] = $domain_setting_subcategory; + $parameters['default_setting_name'] = $domain_setting_name; + $database = new database; + $target_default_setting_uuid = $database->select($sql, $parameters, 'column'); + + $action = is_uuid($target_default_setting_uuid) ? 'update' : 'add'; + unset($sql, $parameters); + + // fix null + $domain_setting_order = $domain_setting_order != '' ? $domain_setting_order : null; + + //begin array + $array['default_settings'][0]['default_setting_category'] = $domain_setting_category; + $array['default_settings'][0]['default_setting_subcategory'] = $domain_setting_subcategory; + $array['default_settings'][0]['default_setting_name'] = $domain_setting_name; + $array['default_settings'][0]['default_setting_value'] = $domain_setting_value; + $array['default_settings'][0]['default_setting_order'] = $domain_setting_order; + $array['default_settings'][0]['default_setting_enabled'] = $domain_setting_enabled; + $array['default_settings'][0]['default_setting_description'] = $domain_setting_description; + + //insert + if ($action == "add" && permission_exists("default_setting_add")) { + $array['default_settings'][0]['default_setting_uuid'] = uuid(); + } + //update + if ($action == "update" && permission_exists('default_setting_edit')) { + $array['default_settings'][0]['default_setting_uuid'] = $target_default_setting_uuid; + } + + //execute + if (is_uuid($array['default_settings'][0]['default_setting_uuid'])) { + $database = new database; + $database->app_name = 'domain_settings'; + $database->app_uuid = 'b31e723a-bf70-670c-a49b-470d2a232f71'; + $database->save($array); + unset($array); + + $settings_copied++; + } + + } //foreach + } //if + + // set message + message::add($text['message-copy'].": ".escape($settings_copied)); + + } + + } + + unset($records); + } + } //method + + } //class +} + +?> \ No newline at end of file diff --git a/core/domains/app_languages.php b/core/domains/app_languages.php index e50972c025..1aac0b5183 100644 --- a/core/domains/app_languages.php +++ b/core/domains/app_languages.php @@ -827,25 +827,25 @@ $text['header-domain_setting-add']['ru-ru'] = "Добавить настройк $text['header-domain_setting-add']['sv-se'] = "Lägg Till Domän Inställning"; $text['header-domain_setting-add']['uk-ua'] = "Параметри домену"; -$text['header-domain-edit']['en-us'] = "Domain"; -$text['header-domain-edit']['ar-eg'] = ""; -$text['header-domain-edit']['de-at'] = "Domain"; //copied from de-de -$text['header-domain-edit']['de-ch'] = "Domain"; //copied from de-de -$text['header-domain-edit']['de-de'] = "Domain"; -$text['header-domain-edit']['es-cl'] = "Dominio"; -$text['header-domain-edit']['es-mx'] = "Dominio"; //copied from es-cl -$text['header-domain-edit']['fr-ca'] = "Domaine"; //copied from fr-fr -$text['header-domain-edit']['fr-fr'] = "Domaine"; -$text['header-domain-edit']['he-il'] = ""; -$text['header-domain-edit']['it-it'] = "Dominio"; -$text['header-domain-edit']['nl-nl'] = ""; -$text['header-domain-edit']['pl-pl'] = "Domena"; -$text['header-domain-edit']['pt-br'] = "Domínio"; -$text['header-domain-edit']['pt-pt'] = "Domínio"; -$text['header-domain-edit']['ro-ro'] = ""; -$text['header-domain-edit']['ru-ru'] = "Домен"; -$text['header-domain-edit']['sv-se'] = "Domän"; -$text['header-domain-edit']['uk-ua'] = "Домен"; +$text['header-domain']['en-us'] = "Domain"; +$text['header-domain']['ar-eg'] = ""; +$text['header-domain']['de-at'] = "Domain"; //copied from de-de +$text['header-domain']['de-ch'] = "Domain"; //copied from de-de +$text['header-domain']['de-de'] = "Domain"; +$text['header-domain']['es-cl'] = "Dominio"; +$text['header-domain']['es-mx'] = "Dominio"; //copied from es-cl +$text['header-domain']['fr-ca'] = "Domaine"; //copied from fr-fr +$text['header-domain']['fr-fr'] = "Domaine"; +$text['header-domain']['he-il'] = ""; +$text['header-domain']['it-it'] = "Dominio"; +$text['header-domain']['nl-nl'] = ""; +$text['header-domain']['pl-pl'] = "Domena"; +$text['header-domain']['pt-br'] = "Domínio"; +$text['header-domain']['pt-pt'] = "Domínio"; +$text['header-domain']['ro-ro'] = ""; +$text['header-domain']['ru-ru'] = "Домен"; +$text['header-domain']['sv-se'] = "Domän"; +$text['header-domain']['uk-ua'] = "Домен"; $text['header-domain-add']['en-us'] = "Domain Add"; $text['header-domain-add']['ar-eg'] = ""; diff --git a/core/domains/domain_edit.php b/core/domains/domain_edit.php index 816ac71231..7935540751 100644 --- a/core/domains/domain_edit.php +++ b/core/domains/domain_edit.php @@ -590,20 +590,22 @@ //show the content echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + + echo "
"; + + echo "
\n"; + echo "
"; if ($action == "update") { - echo $text['header-domain-edit']; + echo "".$text['header-domain'].""; } if ($action == "add") { - echo $text['header-domain-add']; + echo "".$text['header-domain-add'].""; } - echo "
\n"; + echo " \n"; + echo "
\n"; if (permission_exists('domain_add')) { //only for superadmin, not admin editing their own domain - echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'domains.php']); + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'domains.php']); + } + if (permission_exists('domain_delete') && is_array($_SESSION['domains']) && @sizeof($_SESSION['domains']) > 1 && $domain_uuid != $_SESSION['domain_uuid']) { + echo button::create(['type'=>'submit','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'action','value'=>'delete','onclick'=>"if (confirm('".$text['confirm-delete']."')) { document.getElementById('frm').submit(); } else { this.blur(); return false; }"]); } if (permission_exists("domain_select") && is_array($_SESSION['domains']) && @sizeof($_SESSION['domains']) > 1) { echo ""; } - if (permission_exists('domain_delete') && is_array($_SESSION['domains']) && @sizeof($_SESSION['domains']) > 1 && $domain_uuid != $_SESSION['domain_uuid']) { - echo button::create(['type'=>'submit','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'action','value'=>'delete','style'=>'margin-left: 15px;','onclick'=>"if (confirm('".$text['confirm-delete']."')) { document.getElementById('frm').submit(); } else { this.blur(); return false; }"]); - } if (permission_exists('domain_export')) { echo button::create(['type'=>'button','label'=>$text['button-export'],'icon'=>$_SESSION['theme']['button_icon_export'],'link'=>PROJECT_PATH."/app/domain_export/index.php?id=".escape($domain_uuid)]); } echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'style'=>'margin-left: 15px;']); - echo "
\n"; + echo " \n"; + echo "
\n"; + echo "\n"; + if ($action == "update") { - echo $text['description-domain-edit']; + echo $text['description-domain-edit']."\n"; } if ($action == "add") { - echo $text['description-domain-add']; + echo $text['description-domain-add']."\n"; } echo "

\n"; - echo "
\n"; echo "\n"; echo "\n"; echo " "; echo "
\n"; @@ -676,8 +675,6 @@ echo " \n"; } echo " \n"; - echo "
"; - echo " \n"; echo "
";