Add hostname to the variables.

This commit is contained in:
Mark Crane
2015-03-25 18:30:18 +00:00
parent ff19e9c87e
commit 5c33233ce5
4 changed files with 45 additions and 2 deletions

View File

@@ -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") {

View File

@@ -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'] = "";

View File

@@ -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";

View File

@@ -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 "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-hostname']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='var_hostname' maxlength='255' value=\"$var_hostname\">\n";
echo "<br />\n";
echo $text['description-hostname']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " ".$text['label-value']."\n";