From f9fbcf10fb6bad4d83465d82fb7596157f5b3491 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Fri, 24 Apr 2015 13:54:57 -0300 Subject: Remove ugly copy files around and use additional_files_needed to install files in proper place. Bump package version --- config/shellcmd/shellcmd.inc | 16 -- config/shellcmd/shellcmd.php | 179 ++++++++++++++++++++++ config/shellcmd/shellcmd.tmp | 179 ---------------------- config/shellcmd/shellcmd.xml | 10 +- config/shellcmd/shellcmd_edit.php | 303 ++++++++++++++++++++++++++++++++++++++ config/shellcmd/shellcmd_edit.tmp | 303 -------------------------------------- 6 files changed, 487 insertions(+), 503 deletions(-) create mode 100644 config/shellcmd/shellcmd.php delete mode 100644 config/shellcmd/shellcmd.tmp create mode 100644 config/shellcmd/shellcmd_edit.php delete mode 100644 config/shellcmd/shellcmd_edit.tmp (limited to 'config/shellcmd') diff --git a/config/shellcmd/shellcmd.inc b/config/shellcmd/shellcmd.inc index c7f50202..c5020d5f 100644 --- a/config/shellcmd/shellcmd.inc +++ b/config/shellcmd/shellcmd.inc @@ -71,19 +71,6 @@ function shellcmd_install_command() conf_mount_rw(); config_lock(); - if (!is_dir('/usr/local/www/packages/')) { - exec("mkdir /usr/local/www/packages/"); - } - - if (!is_dir('/usr/local/www/packages/shellcmd/')) { - exec("mkdir /usr/local/www/packages/shellcmd/"); - } - - - //rename PHP files from .tmp to .php - exec("cp /usr/local/pkg/shellcmd.tmp /usr/local/www/packages/shellcmd/shellcmd.php"); - exec("cp /usr/local/pkg/shellcmd_edit.tmp /usr/local/www/packages/shellcmd/shellcmd_edit.php"); - //write_config(); //write_rcfile(array( @@ -111,9 +98,6 @@ function shellcmd_deinstall_command() conf_mount_rw(); config_lock(); $handle = popen("/usr/local/etc/rc.d/shellcmd.sh stop", "r"); - unlink_if_exists("/usr/local/pkg/shellcmd.xml"); - unlink_if_exists("/usr/local/www/shellcmd.inc"); - exec("rm -R /usr/local/www/packages/shellcmd"); //unlink_if_exists("/usr/local/etc/rc.d/shellcmd.sh"); conf_mount_ro(); config_unlock(); diff --git a/config/shellcmd/shellcmd.php b/config/shellcmd/shellcmd.php new file mode 100644 index 00000000..fd386910 --- /dev/null +++ b/config/shellcmd/shellcmd.php @@ -0,0 +1,179 @@ + + + + + +

Shellcmd: Settings

+ +
+ + +
+ +
+ + + + + +
+ +
+"; +//print_info_box_np("This is an info box."); +//echo"
"; +//endif; + +?> + + + + +

+ The shellcmd utility is used to manage commands on system startup. +

+ +

+
+ + + + + + + + + + 0) { + foreach ($$category_config as $ent) { + // previous versions of shellcmd stored the command in an additional -xmltag, this unnests this for backwards compatibility + if (is_array($ent)) { $ent = $ent['command']; } + + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " "; + $i++; + } + } + } + + +?> + + + + + + + + + + + +
CommandType + + + + + + +
+ +
\n"; + echo " ".$ent."\n"; + echo " \n"; + echo " ".$category."\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
+ + + + + +
+
+ +
+ + +
+
+
+
+
+
+
+
+ +
+ +
+ + + + + diff --git a/config/shellcmd/shellcmd.tmp b/config/shellcmd/shellcmd.tmp deleted file mode 100644 index fd386910..00000000 --- a/config/shellcmd/shellcmd.tmp +++ /dev/null @@ -1,179 +0,0 @@ - - - - - -

Shellcmd: Settings

- -
- - -
- -
- - - - - -
- -
-"; -//print_info_box_np("This is an info box."); -//echo"
"; -//endif; - -?> - - - - -

- The shellcmd utility is used to manage commands on system startup. -

- -

-
- - - - - - - - - - 0) { - foreach ($$category_config as $ent) { - // previous versions of shellcmd stored the command in an additional -xmltag, this unnests this for backwards compatibility - if (is_array($ent)) { $ent = $ent['command']; } - - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " "; - $i++; - } - } - } - - -?> - - - - - - - - - - - -
CommandType - - - - - - -
- -
\n"; - echo " ".$ent."\n"; - echo " \n"; - echo " ".$category."\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
\n"; - echo "
- - - - - -
-
- -
- - -
-
-
-
-
-
-
-
- -
- -
- - - - - diff --git a/config/shellcmd/shellcmd.xml b/config/shellcmd/shellcmd.xml index ca472078..2c154b7a 100644 --- a/config/shellcmd/shellcmd.xml +++ b/config/shellcmd/shellcmd.xml @@ -75,14 +75,14 @@ https://packages.pfsense.org/packages/config/shellcmd/shellcmd.inc - /usr/local/pkg/ + /usr/local/packages/shellcmd/ 0755 - https://packages.pfsense.org/packages/config/shellcmd/shellcmd.tmp + https://packages.pfsense.org/packages/config/shellcmd/shellcmd.php - /usr/local/pkg/ + /usr/local/packages/shellcmd/ 0755 - https://packages.pfsense.org/packages/config/shellcmd/shellcmd_edit.tmp + https://packages.pfsense.org/packages/config/shellcmd/shellcmd_edit.php @@ -112,4 +112,4 @@ shellcmd_deinstall_command(); - \ No newline at end of file + diff --git a/config/shellcmd/shellcmd_edit.php b/config/shellcmd/shellcmd_edit.php new file mode 100644 index 00000000..5ae466d5 --- /dev/null +++ b/config/shellcmd/shellcmd_edit.php @@ -0,0 +1,303 @@ +0) { + $id = $_POST['id']; +} + +$type = $_GET['t']; +if (strlen($_POST['t'])>0) { + $type = $_POST['t']; +} + +if ($_GET['act'] == "del") { + if ($_GET['type'] == 'cmd') { + + switch (htmlspecialchars($type)) { + case "earlyshellcmd": + $a_earlyshellcmd = &$config['system']['earlyshellcmd']; + unset($a_earlyshellcmd[$_GET['id']]); + write_config(); + shellcmd_sync_package(); + header("Location: shellcmd.php"); + exit; + break; + case "shellcmd": + $a_shellcmd = &$config['system']['shellcmd']; + unset($a_shellcmd[$_GET['id']]); + write_config(); + shellcmd_sync_package(); + header("Location: shellcmd.php"); + exit; + break; + case "afterfilterchangeshellcmd": + // $a_afterfilterchangeshellcmd = &$config['system']['afterfilterchangeshellcmd']; + // unset($a_afterfilterchangeshellcmd[$_GET['id']]); + // write_config(); + // shellcmd_sync_package(); + // header("Location: shellcmd.php"); + // exit; + break; + default: + break; + } + + } +} + +//get value for the form edit value +if (strlen($id) > 0) { + + switch (htmlspecialchars($type)) { + case "earlyshellcmd": + $a_earlyshellcmd = &$config['system']['earlyshellcmd']; + if ($a_earlyshellcmd[$id]) { + $pconfig['command'] = $a_earlyshellcmd[$id]; + } + break; + case "shellcmd": + $a_shellcmd = &$config['system']['shellcmd']; + if ($a_shellcmd[$id]) { + $pconfig['command'] = $a_shellcmd[$id]; + } + break; + case "afterfilterchangeshellcmd": + //$a_afterfilterchangeshellcmd = &$config['system']['afterfilterchangeshellcmd']; + //if ($a_afterfilterchangeshellcmd[$id]) { + // $pconfig['command'] = $a_afterfilterchangeshellcmd[$id]; + //} + break; + default: + break; + } + + // previous version of shellcmd wrapped all commands in a -xmltag, unnesting this for backwards compatibility + if (is_array($pconfig['command'])) $pconfig['command'] = $pconfig['command']['command']; + +} + +if ($_POST) { + + unset($input_errors); + + if (!$input_errors) { + if (strlen($_POST['command']) > 0) { + + $ent = $_POST['command']; + + if (strlen($id)>0) { + //update + + switch (htmlspecialchars($type)) { + case "earlyshellcmd": + $a_earlyshellcmd = &$config['system']['earlyshellcmd']; + if ($a_earlyshellcmd[$id]) { + $a_earlyshellcmd[$id] = $ent; + } + break; + case "shellcmd": + $a_shellcmd = &$config['system']['shellcmd']; + if ($a_shellcmd[$id]) { + $a_shellcmd[$id] = $ent; + } + break; + case "afterfilterchangeshellcmd": + //$a_afterfilterchangeshellcmd = &$config['system']['afterfilterchangeshellcmd']; + //if ($a_afterfilterchangeshellcmd[$id]) { + // $a_afterfilterchangeshellcmd[$id] = $ent; + //} + break; + default: + break; + } + + } + else { + //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(); + shellcmd_sync_package(); + } + + header("Location: shellcmd.php"); + exit; + } +} + +include("head.inc"); + +?> + + + + + +

Shellcmd: Edit

+ + +
+ + +
+ +
+ + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + + + + + +
Command + +
Type + \n"; + echo " \n"; + switch (htmlspecialchars($type)) { + case "earlyshellcmd": + echo " \n"; + echo " \n"; + //echo " \n"; + break; + case "shellcmd": + echo " \n"; + echo " \n"; + //echo " \n"; + break; + case "afterfilterchangeshellcmd": + //echo " \n"; + //echo " \n"; + //echo " \n"; + break; + default: + echo " \n"; + echo " \n"; + echo " \n"; + //echo " \n"; + break; + } + echo " \n"; + ?> +
  + 0) { ?> + + + +
+
+ +
+
+
+
+
+
+ +
+ +
+ + + + diff --git a/config/shellcmd/shellcmd_edit.tmp b/config/shellcmd/shellcmd_edit.tmp deleted file mode 100644 index 5ae466d5..00000000 --- a/config/shellcmd/shellcmd_edit.tmp +++ /dev/null @@ -1,303 +0,0 @@ -0) { - $id = $_POST['id']; -} - -$type = $_GET['t']; -if (strlen($_POST['t'])>0) { - $type = $_POST['t']; -} - -if ($_GET['act'] == "del") { - if ($_GET['type'] == 'cmd') { - - switch (htmlspecialchars($type)) { - case "earlyshellcmd": - $a_earlyshellcmd = &$config['system']['earlyshellcmd']; - unset($a_earlyshellcmd[$_GET['id']]); - write_config(); - shellcmd_sync_package(); - header("Location: shellcmd.php"); - exit; - break; - case "shellcmd": - $a_shellcmd = &$config['system']['shellcmd']; - unset($a_shellcmd[$_GET['id']]); - write_config(); - shellcmd_sync_package(); - header("Location: shellcmd.php"); - exit; - break; - case "afterfilterchangeshellcmd": - // $a_afterfilterchangeshellcmd = &$config['system']['afterfilterchangeshellcmd']; - // unset($a_afterfilterchangeshellcmd[$_GET['id']]); - // write_config(); - // shellcmd_sync_package(); - // header("Location: shellcmd.php"); - // exit; - break; - default: - break; - } - - } -} - -//get value for the form edit value -if (strlen($id) > 0) { - - switch (htmlspecialchars($type)) { - case "earlyshellcmd": - $a_earlyshellcmd = &$config['system']['earlyshellcmd']; - if ($a_earlyshellcmd[$id]) { - $pconfig['command'] = $a_earlyshellcmd[$id]; - } - break; - case "shellcmd": - $a_shellcmd = &$config['system']['shellcmd']; - if ($a_shellcmd[$id]) { - $pconfig['command'] = $a_shellcmd[$id]; - } - break; - case "afterfilterchangeshellcmd": - //$a_afterfilterchangeshellcmd = &$config['system']['afterfilterchangeshellcmd']; - //if ($a_afterfilterchangeshellcmd[$id]) { - // $pconfig['command'] = $a_afterfilterchangeshellcmd[$id]; - //} - break; - default: - break; - } - - // previous version of shellcmd wrapped all commands in a -xmltag, unnesting this for backwards compatibility - if (is_array($pconfig['command'])) $pconfig['command'] = $pconfig['command']['command']; - -} - -if ($_POST) { - - unset($input_errors); - - if (!$input_errors) { - if (strlen($_POST['command']) > 0) { - - $ent = $_POST['command']; - - if (strlen($id)>0) { - //update - - switch (htmlspecialchars($type)) { - case "earlyshellcmd": - $a_earlyshellcmd = &$config['system']['earlyshellcmd']; - if ($a_earlyshellcmd[$id]) { - $a_earlyshellcmd[$id] = $ent; - } - break; - case "shellcmd": - $a_shellcmd = &$config['system']['shellcmd']; - if ($a_shellcmd[$id]) { - $a_shellcmd[$id] = $ent; - } - break; - case "afterfilterchangeshellcmd": - //$a_afterfilterchangeshellcmd = &$config['system']['afterfilterchangeshellcmd']; - //if ($a_afterfilterchangeshellcmd[$id]) { - // $a_afterfilterchangeshellcmd[$id] = $ent; - //} - break; - default: - break; - } - - } - else { - //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(); - shellcmd_sync_package(); - } - - header("Location: shellcmd.php"); - exit; - } -} - -include("head.inc"); - -?> - - - - - -

Shellcmd: Edit

- - -
- - -
- -
- - - - -
- - -
- - -
- - - - - - - - - - - - - - - - - - -
Command - -
Type - \n"; - echo " \n"; - switch (htmlspecialchars($type)) { - case "earlyshellcmd": - echo " \n"; - echo " \n"; - //echo " \n"; - break; - case "shellcmd": - echo " \n"; - echo " \n"; - //echo " \n"; - break; - case "afterfilterchangeshellcmd": - //echo " \n"; - //echo " \n"; - //echo " \n"; - break; - default: - echo " \n"; - echo " \n"; - echo " \n"; - //echo " \n"; - break; - } - echo " \n"; - ?> -
  - 0) { ?> - - - -
-
- -
-
-
-
-
-
- -
- -
- - - - -- cgit v1.2.3