summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-08-10 19:05:33 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-08-10 19:05:33 +0000
commit6cec4795ae0e4b44d87a68674f94becbe209541c (patch)
tree61a7db676970ae2b210fcc294543ad1bc09e9e49 /usr
parent89a9d56ba2f8408e1f4cee3553395b1e1c5ac8d6 (diff)
downloadpfsense-6cec4795ae0e4b44d87a68674f94becbe209541c.zip
pfsense-6cec4795ae0e4b44d87a68674f94becbe209541c.tar.gz
Remove non alpha characters from interface descriptions
Diffstat (limited to 'usr')
-rwxr-xr-xusr/local/www/interfaces_opt.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/usr/local/www/interfaces_opt.php b/usr/local/www/interfaces_opt.php
index cf4755e..e6a54bc 100755
--- a/usr/local/www/interfaces_opt.php
+++ b/usr/local/www/interfaces_opt.php
@@ -41,10 +41,14 @@ else if ($_POST['index'])
if (!$index)
exit;
+function remove_bad_chars($string) {
+ return preg_replace('/[^a-z]/i','',$string);
+}
+
$optcfg = &$config['interfaces']['opt' . $index];
-$optcfg['descr'] = str_replace(" ", "_", $optcfg['descr']);
+$optcfg['descr'] = remove_bad_chars($optcfg['descr']);
-$pconfig['descr'] = str_replace(" ", "_", $optcfg['descr']);
+$pconfig['descr'] = $optcfg['descr'];
$pconfig['bridge'] = $optcfg['bridge'];
$pconfig['bandwidth'] = $optcfg['bandwidth'];
@@ -78,7 +82,7 @@ if ($_POST) {
unset($input_errors);
/* filter out spaces from descriptions */
- $POST['descr'] = str_replace(" ", "_", $POST['descr']);
+ $POST['descr'] = remove_bad_chars($POST['descr']);
$pconfig = $_POST;
@@ -142,7 +146,7 @@ if ($_POST) {
if (!$input_errors) {
- $optcfg['descr'] = str_replace(" ", "_", $_POST['descr']);
+ $optcfg['descr'] = remove_bad_chars($_POST['descr']);
$optcfg['bridge'] = $_POST['bridge'];
$optcfg['enable'] = $_POST['enable'] ? true : false;
OpenPOWER on IntegriCloud