From 9e6e1ee6e2896bb89d1267799828063347240ea9 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Wed, 25 Mar 2015 18:30:18 +0000 Subject: [PATCH] Add hostname to the variables. --- app/sip_profiles/sip_profile_setting_edit.php | 4 +-- app/vars/app_config.php | 5 ++++ app/vars/app_languages.php | 12 +++++++++ app/vars/var_edit.php | 26 +++++++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/app/sip_profiles/sip_profile_setting_edit.php b/app/sip_profiles/sip_profile_setting_edit.php index 272b13dc7a..fe2fbb396e 100644 --- a/app/sip_profiles/sip_profile_setting_edit.php +++ b/app/sip_profiles/sip_profile_setting_edit.php @@ -52,14 +52,14 @@ if (strlen($_GET["sip_profile_uuid"]) > 0) { } //get http post variables and set them to php variables - if (count($_POST)>0) { + if (count($_POST) > 0) { $sip_profile_setting_name = check_str($_POST["sip_profile_setting_name"]); $sip_profile_setting_value = check_str($_POST["sip_profile_setting_value"]); $sip_profile_setting_enabled = check_str($_POST["sip_profile_setting_enabled"]); $sip_profile_setting_description = check_str($_POST["sip_profile_setting_description"]); } -if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { +if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $msg = ''; if ($action == "update") { diff --git a/app/vars/app_config.php b/app/vars/app_config.php index d35116131c..57e52f7e68 100644 --- a/app/vars/app_config.php +++ b/app/vars/app_config.php @@ -70,6 +70,11 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "var_hostname"; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(255)"; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "var_value"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; diff --git a/app/vars/app_languages.php b/app/vars/app_languages.php index 3af6633bfd..16164f39a5 100644 --- a/app/vars/app_languages.php +++ b/app/vars/app_languages.php @@ -99,6 +99,18 @@ $text['description-category']['pt-pt'] = "Escolha a categoria."; $text['description-category']['fr-fr'] = ""; + $text['header-hostname']['en-us'] = "Hostname"; + $text['header-hostname']['pt-pt'] = "Hostname"; + $text['header-hostname']['fr-fr'] = "Nom d'hôte"; + + $text['label-hostname']['en-us'] = "Hostname"; + $text['label-hostname']['pt-pt'] = "Hostname"; + $text['label-hostname']['fr-fr'] = "Nom d'hôte"; + + $text['description-hostname']['en-us'] = "Enter the hostname / switchname."; + $text['description-hostname']['pt-pt'] = "Introduza o hostname"; + $text['description-hostname']['fr-fr'] = "Entrer le nom de l'hôte / du switch."; + $text['option-true']['en-us'] = "True"; $text['option-true']['es-cl'] = "Verdadero"; $text['option-true']['pt-pt'] = "Sim"; diff --git a/app/vars/var_edit.php b/app/vars/var_edit.php index 011b94e140..a14c458ca5 100644 --- a/app/vars/var_edit.php +++ b/app/vars/var_edit.php @@ -50,6 +50,7 @@ else { //set http values as php variables if (count($_POST)>0) { $var_name = check_str($_POST["var_name"]); + $var_hostname = check_str($_POST["var_hostname"]); $var_value = check_str($_POST["var_value"]); $var_cat = check_str($_POST["var_cat"]); if (strlen($_POST["var_cat_other"]) > 0) { @@ -95,6 +96,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "("; $sql .= "var_uuid, "; $sql .= "var_name, "; + $sql .= "var_hostname, "; $sql .= "var_value, "; $sql .= "var_cat, "; $sql .= "var_enabled, "; @@ -105,6 +107,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "("; $sql .= "'$var_uuid', "; $sql .= "'$var_name', "; + if (strlen($var_hostname) > 0) { + $sql .= "'$var_hostname', "; + } + else { + $sql .= "null, "; + } $sql .= "'$var_value', "; $sql .= "'$var_cat', "; $sql .= "'$var_enabled', "; @@ -129,6 +137,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //update the variables $sql = "update v_vars set "; $sql .= "var_name = '$var_name', "; + if (strlen($var_hostname) > 0) { + $sql .= "var_hostname = '$var_hostname', "; + } + else { + $sql .= "var_hostname = null, "; + } $sql .= "var_value = '$var_value', "; $sql .= "var_cat = '$var_cat', "; $sql .= "var_enabled = '$var_enabled', "; @@ -161,6 +175,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { $var_name = $row["var_name"]; + $var_hostname = $row["var_hostname"]; $var_value = $row["var_value"]; $var_cat = $row["var_cat"]; $var_enabled = $row["var_enabled"]; @@ -207,6 +222,17 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; + echo "\n"; + echo "\n"; + echo " ".$text['label-hostname']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-hostname']."\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo " ".$text['label-value']."\n";