From 560070d2d1a5c367f1c888aa49eec350226847fd Mon Sep 17 00:00:00 2001 From: dman776 Date: Thu, 2 Aug 2018 15:58:01 -0500 Subject: [PATCH] bugfix: node description not saving properly (#101) --- files/etc/config.mesh/_setup | 2 ++ files/etc/config.mesh/_setup.default | 2 ++ files/etc/config.mesh/system | 1 + files/www/cgi-bin/perlfunc.pm | 2 +- files/www/cgi-bin/setup | 14 +++++--------- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/files/etc/config.mesh/_setup b/files/etc/config.mesh/_setup index e373d7e4..ad695063 100644 --- a/files/etc/config.mesh/_setup +++ b/files/etc/config.mesh/_setup @@ -30,3 +30,5 @@ dtdlink_ip=10. time_zone = UTC ntp_server = us.pool.ntp.org + +description_node = diff --git a/files/etc/config.mesh/_setup.default b/files/etc/config.mesh/_setup.default index 2dd4a9e7..f9f6d118 100644 --- a/files/etc/config.mesh/_setup.default +++ b/files/etc/config.mesh/_setup.default @@ -32,3 +32,5 @@ dtdlink_ip=10. time_zone = UTC time_zone_name = UTC ntp_server = us.pool.ntp.org + +description_node = diff --git a/files/etc/config.mesh/system b/files/etc/config.mesh/system index 23f9e78a..9d8cb9e8 100644 --- a/files/etc/config.mesh/system +++ b/files/etc/config.mesh/system @@ -1,6 +1,7 @@ config 'system' option 'hostname' '' option 'timezone' '' + option 'description' '' config 'timeserver' 'ntp' list 'server' '' diff --git a/files/www/cgi-bin/perlfunc.pm b/files/www/cgi-bin/perlfunc.pm index 586dee59..b4cd836b 100644 --- a/files/www/cgi-bin/perlfunc.pm +++ b/files/www/cgi-bin/perlfunc.pm @@ -573,7 +573,7 @@ sub save_setup open(FILE, ">$_[0]") or return 0; foreach(sort keys %parms) { - next unless /^(aprs|dhcp|dmz|lan|olsrd|wan|wifi|dtdlink|ntp|time)_/; + next unless /^(aprs|dhcp|dmz|lan|olsrd|wan|wifi|dtdlink|ntp|time|description)_/; print FILE "$_ = $parms{$_}\n"; } close(FILE); diff --git a/files/www/cgi-bin/setup b/files/www/cgi-bin/setup index ee1bdaa4..aa0fd846 100755 --- a/files/www/cgi-bin/setup +++ b/files/www/cgi-bin/setup @@ -433,17 +433,13 @@ if($parms{button_save}) push (@errors, "OK") unless @errors; } - if($parms{nodedesc}) + if($description_node) { - if($parms{nodedesc} =~ /<.*>|<\/.*>/) { + if($description_node =~ /<.*>|<\/.*>/) { push(@errors, "Node description cannot contain html like tags") } - else - { - $rc = &uci_set_indexed_option("system", "system", "0", "description", "$parms{nodedesc}"); - push(@errors, "unable to store node description. ($rc | $rc2") if($rc); - } } + unless(@errors) { $parms{node} = $node; @@ -469,7 +465,7 @@ reboot_page("/cgi-bin/status") if $parms{button_reboot}; # # retrieve node description # -$nodedesc = &uci_get_indexed_option("system", "system", 0, "description"); +$desc = &uci_get_indexed_option("system", "system", 0, "description"); # # Retreive map url, css, and js locations # @@ -646,7 +642,7 @@ print " Node Description (optional) -"; +"; push @hidden, ""; print " Verify Password