diff options
author | mcrane <mctch@yahoo.com> | 2009-05-14 13:56:51 -0600 |
---|---|---|
committer | mcrane <mctch@yahoo.com> | 2009-05-14 13:56:51 -0600 |
commit | 88b1261978373f9222236dc0fd4578d0b399afae (patch) | |
tree | 5a38224b557439445242574e8718621c7fd11d6a /config/shellcmd | |
parent | ab5647f7cd6be472d62284e4fa81dd0e61b54769 (diff) | |
download | pfsense-packages-88b1261978373f9222236dc0fd4578d0b399afae.tar.gz pfsense-packages-88b1261978373f9222236dc0fd4578d0b399afae.tar.bz2 pfsense-packages-88b1261978373f9222236dc0fd4578d0b399afae.zip |
Shellcmd package fix blank record creation
Diffstat (limited to 'config/shellcmd')
-rw-r--r-- | config/shellcmd/shellcmd.tmp | 94 | ||||
-rw-r--r-- | config/shellcmd/shellcmd.xml | 2 | ||||
-rw-r--r-- | config/shellcmd/shellcmd_edit.tmp | 70 |
3 files changed, 86 insertions, 80 deletions
diff --git a/config/shellcmd/shellcmd.tmp b/config/shellcmd/shellcmd.tmp index cc3a652a..5bb387da 100644 --- a/config/shellcmd/shellcmd.tmp +++ b/config/shellcmd/shellcmd.tmp @@ -64,8 +64,6 @@ include("head.inc"); <form action="shellcmd.php" method="post" name="iform" id="iform"> <?php - - //if ($savemsg) print_info_box($savemsg); //if (file_exists($d_hostsdirty_path)): echo"<p>"; //print_info_box_np("This is an info box."); @@ -107,24 +105,24 @@ include("head.inc"); if (count($a_earlyshellcmd) > 0) { //if (isset($a_earlyshellcmd[0]["command"])) { foreach ($a_earlyshellcmd as $ent) { - echo " <tr>\n"; - echo " <td class=\"listr\" ondblclick=\"document.location='shellcmd_edit.php?id=".$i."';\">\n"; - echo " ".$ent['command']." \n"; - echo " </td>\n"; - echo " <td class=\"listbg\" ondblclick=\"document.location='shellcmd_edit.php?id=".$i."';\">\n"; if (strlen($ent['command']) > 0) { + echo " <tr>\n"; + echo " <td class=\"listr\" ondblclick=\"document.location='shellcmd_edit.php?id=".$i."';\">\n"; + echo " ".$ent['command']." \n"; + echo " </td>\n"; + echo " <td class=\"listbg\" ondblclick=\"document.location='shellcmd_edit.php?id=".$i."';\">\n"; echo " earlyshellcmd \n"; + echo " </td>\n"; + echo " <td valign=\"middle\" nowrap class=\"list\">\n"; + echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n"; + echo " <tr>\n"; + echo " <td valign=\"middle\"><a href=\"shellcmd_edit.php?t=earlyshellcmd&id=".$i."\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; + echo " <td><a href=\"shellcmd_edit.php?t=earlyshellcmd&type=cmd&act=del&id=".$i."\" onclick=\"return confirm('Do you really want to delete this?')\"><img src=\"/themes/".$g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; + echo " </tr>\n"; + echo " </table>\n"; + echo " </td>\n"; + echo " </tr>"; } - echo " </td>\n"; - echo " <td valign=\"middle\" nowrap class=\"list\">\n"; - echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n"; - echo " <tr>\n"; - echo " <td valign=\"middle\"><a href=\"shellcmd_edit.php?t=earlyshellcmd&id=".$i."\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; - echo " <td><a href=\"shellcmd_edit.php?t=earlyshellcmd&type=cmd&act=del&id=".$i."\" onclick=\"return confirm('Do you really want to delete this?')\"><img src=\"/themes/".$g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; - echo " </tr>\n"; - echo " </table>\n"; - echo " </td>\n"; - echo " </tr>"; $i++; } //} @@ -135,24 +133,24 @@ include("head.inc"); if (count($a_shellcmd) > 0) { //if (isset($a_shellcmd[0]["command"])) { foreach ($a_shellcmd as $ent) { - echo " <tr>\n"; - echo " <td class=\"listr\" ondblclick=\"document.location='shellcmd_edit.php?id=".$i."';\">\n"; - echo " ".$ent['command']." \n"; - echo " </td>\n"; - echo " <td class=\"listbg\" ondblclick=\"document.location='shellcmd_edit.php?id=".$i."';\">\n"; if (strlen($ent['command']) > 0) { - echo " shellcmd \n"; //<font color="#FFFFFF"> + echo " <tr>\n"; + echo " <td class=\"listr\" ondblclick=\"document.location='shellcmd_edit.php?id=".$i."';\">\n"; + echo " ".$ent['command']." \n"; + echo " </td>\n"; + echo " <td class=\"listbg\" ondblclick=\"document.location='shellcmd_edit.php?id=".$i."';\">\n"; + echo " shellcmd \n"; + echo " </td>\n"; + echo " <td valign=\"middle\" nowrap class=\"list\">\n"; + echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n"; + echo " <tr>\n"; + echo " <td valign=\"middle\"><a href=\"shellcmd_edit.php?t=shellcmd&id=".$i."\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; + echo " <td><a href=\"shellcmd_edit.php?t=shellcmd&type=cmd&act=del&id=".$i."\" onclick=\"return confirm('Do you really want to delete this?')\"><img src=\"/themes/".$g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; + echo " </tr>\n"; + echo " </table>\n"; + echo " </td>\n"; + echo " </tr>"; } - echo " </td>\n"; - echo " <td valign=\"middle\" nowrap class=\"list\">\n"; - echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n"; - echo " <tr>\n"; - echo " <td valign=\"middle\"><a href=\"shellcmd_edit.php?t=shellcmd&id=".$i."\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; - echo " <td><a href=\"shellcmd_edit.php?t=shellcmd&type=cmd&act=del&id=".$i."\" onclick=\"return confirm('Do you really want to delete this?')\"><img src=\"/themes/".$g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; - echo " </tr>\n"; - echo " </table>\n"; - echo " </td>\n"; - echo " </tr>"; $i++; } //} @@ -163,24 +161,24 @@ include("head.inc"); if (count($a_afterfilterchangeshellcmd) > 0) { //if (isset($a_afterfilterchangeshellcmd[0]["command"])) { foreach ($a_afterfilterchangeshellcmd as $ent) { - echo " <tr>\n"; - echo " <td class=\"listr\" ondblclick=\"document.location='shellcmd_edit.php?id=".$i."';\">\n"; - echo " ".$ent['command']." \n"; - echo " </td>\n"; - echo " <td class=\"listr\" ondblclick=\"document.location='shellcmd_edit.php?id=".$i."';\">\n"; if (strlen($ent['command']) > 0) { + echo " <tr>\n"; + echo " <td class=\"listr\" ondblclick=\"document.location='shellcmd_edit.php?id=".$i."';\">\n"; + echo " ".$ent['command']." \n"; + echo " </td>\n"; + echo " <td class=\"listr\" ondblclick=\"document.location='shellcmd_edit.php?id=".$i."';\">\n"; echo " afterfilterchangeshellcmd \n"; + echo " </td>\n"; + echo " <td valign=\"middle\" nowrap class=\"list\">\n"; + echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n"; + echo " <tr>\n"; + echo " <td valign=\"middle\"><a href=\"shellcmd_edit.php?t=afterfilterchangeshellcmd&id=".$i."\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; + echo " <td><a href=\"shellcmd_edit.php?t=afterfilterchangeshellcmd&type=cmd&act=del&id=".$i."\" onclick=\"return confirm('Do you really want to delete this?')\"><img src=\"/themes/".$g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; + echo " </tr>\n"; + echo " </table>\n"; + echo " </td>\n"; + echo " </tr>"; } - echo " </td>\n"; - echo " <td valign=\"middle\" nowrap class=\"list\">\n"; - echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n"; - echo " <tr>\n"; - echo " <td valign=\"middle\"><a href=\"shellcmd_edit.php?t=afterfilterchangeshellcmd&id=".$i."\"><img src=\"/themes/".$g['theme']."/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; - echo " <td><a href=\"shellcmd_edit.php?t=afterfilterchangeshellcmd&type=cmd&act=del&id=".$i."\" onclick=\"return confirm('Do you really want to delete this?')\"><img src=\"/themes/".$g['theme']."/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; - echo " </tr>\n"; - echo " </table>\n"; - echo " </td>\n"; - echo " </tr>"; $i++; } //} diff --git a/config/shellcmd/shellcmd.xml b/config/shellcmd/shellcmd.xml index 7068512b..0f9469a6 100644 --- a/config/shellcmd/shellcmd.xml +++ b/config/shellcmd/shellcmd.xml @@ -41,7 +41,7 @@ <requirements>Describe your package requirements here</requirements> <faq>Currently there are no FAQ items provided.</faq> <name>Shellcmd Settings</name> - <version>0.2</version> + <version>0.3</version> <title>Settings</title> <include_file>/usr/local/pkg/shellcmd.inc</include_file> <menu> diff --git a/config/shellcmd/shellcmd_edit.tmp b/config/shellcmd/shellcmd_edit.tmp index 636e5d21..e8a5f5e7 100644 --- a/config/shellcmd/shellcmd_edit.tmp +++ b/config/shellcmd/shellcmd_edit.tmp @@ -32,17 +32,13 @@ require("guiconfig.inc"); require("/usr/local/pkg/shellcmd.inc"); -$a_earlyshellcmd = &$config['system']['earlyshellcmd']; -$a_shellcmd = &$config['system']['shellcmd']; -$a_afterfilterchangeshellcmd = &$config['system']['afterfilterchangeshellcmd']; - $id = $_GET['id']; -if (isset($_POST['id'])) { +if (strlen($_POST['id'])>0) { $id = $_POST['id']; } $type = $_GET['t']; -if (isset($_POST['t'])) { +if (strlen($_POST['t'])>0) { $type = $_POST['t']; } @@ -51,31 +47,28 @@ if ($_GET['act'] == "del") { switch (htmlspecialchars($type)) { case "earlyshellcmd": - //if ($a_earlyshellcmd[$_GET['id']]) { - unset($a_earlyshellcmd[$_GET['id']]); - write_config(); - php_sync_package(); - header("Location: shellcmd.php"); - exit; - //} + $a_earlyshellcmd = &$config['system']['earlyshellcmd']; + unset($a_earlyshellcmd[$_GET['id']]); + write_config(); + php_sync_package(); + header("Location: shellcmd.php"); + exit; break; case "shellcmd": - //if ($a_shellcmd[$_GET['id']]) { - unset($a_shellcmd[$_GET['id']]); - write_config(); - php_sync_package(); - header("Location: shellcmd.php"); - exit; - //} + $a_shellcmd = &$config['system']['shellcmd']; + unset($a_shellcmd[$_GET['id']]); + write_config(); + php_sync_package(); + header("Location: shellcmd.php"); + exit; break; case "afterfilterchangeshellcmd": - //if ($a_afterfilterchangeshellcmd[$_GET['id']]) { + // $a_afterfilterchangeshellcmd = &$config['system']['afterfilterchangeshellcmd']; // unset($a_afterfilterchangeshellcmd[$_GET['id']]); // write_config(); // php_sync_package(); // header("Location: shellcmd.php"); // exit; - //} break; default: break; @@ -85,20 +78,23 @@ if ($_GET['act'] == "del") { } //get value for the form edit value -if (isset($id) && $a_shellcmd[$id]) { +if (strlen($id) > 0) { switch (htmlspecialchars($type)) { case "earlyshellcmd": + $a_earlyshellcmd = &$config['system']['earlyshellcmd']; if ($a_earlyshellcmd[$id]) { $pconfig['command'] = $a_earlyshellcmd[$id]['command']; } break; case "shellcmd": + $a_shellcmd = &$config['system']['shellcmd']; if ($a_shellcmd[$id]) { $pconfig['command'] = $a_shellcmd[$id]['command']; } break; case "afterfilterchangeshellcmd": + //$a_afterfilterchangeshellcmd = &$config['system']['afterfilterchangeshellcmd']; //if ($a_afterfilterchangeshellcmd[$id]) { // $pconfig['command'] = $a_afterfilterchangeshellcmd[$id]['command']; //} @@ -118,18 +114,27 @@ if ($_POST) { $ent = array(); $ent['command'] = $_POST['command']; - if (isset($id)) { //if ($a_shellcmd[$id]) { + if (strlen($id)>0) { //update switch (htmlspecialchars($type)) { case "earlyshellcmd": - $a_earlyshellcmd[$id] = $ent; + $a_earlyshellcmd = &$config['system']['earlyshellcmd']; + if ($a_earlyshellcmd[$id]) { + $a_earlyshellcmd[$id] = $ent; + } break; case "shellcmd": - $a_shellcmd[$id] = $ent; + $a_shellcmd = &$config['system']['shellcmd']; + if ($a_shellcmd[$id]) { + $a_shellcmd[$id] = $ent; + } break; case "afterfilterchangeshellcmd": - // $a_afterfilterchangeshellcmd[$id] = $ent; + //$a_afterfilterchangeshellcmd = &$config['system']['afterfilterchangeshellcmd']; + //if ($a_afterfilterchangeshellcmd[$id]) { + // $a_afterfilterchangeshellcmd[$id] = $ent; + //} break; default: break; @@ -140,24 +145,27 @@ if ($_POST) { //add switch (htmlspecialchars($type)) { case "earlyshellcmd": + $a_earlyshellcmd = &$config['system']['earlyshellcmd']; $a_earlyshellcmd[] = $ent; break; case "shellcmd": + $a_shellcmd = &$config['system']['shellcmd']; $a_shellcmd[] = $ent; break; case "afterfilterchangeshellcmd": + //$a_afterfilterchangeshellcmd = &$config['system']['afterfilterchangeshellcmd']; //$a_afterfilterchangeshellcmd[] = $ent; break; default: break; } - + } - + write_config(); php_sync_package(); } - + header("Location: shellcmd.php"); exit; } @@ -266,7 +274,7 @@ function show_advanced_config() { <tr> <td valign="top"> </td> <td> - <?php if (isset($id)) { ?> + <?php if (strlen($id)>0) { ?> <input name="id" type="hidden" value="<?=$id;?>"> <?php }; ?> <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()"> |