aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authormcrane <mctch@yahoo.com>2009-05-14 02:04:20 -0600
committermcrane <mctch@yahoo.com>2009-05-14 02:06:06 -0600
commitfd12957b5b87b842571ead4f6c5521702ae2a285 (patch)
tree64ade4e5914532bd1b6a9a8884e8a8581f81c15f /config
parent453ac62f3a5ca0ebde04d61cba0c7931665dd032 (diff)
downloadpfsense-packages-fd12957b5b87b842571ead4f6c5521702ae2a285.tar.gz
pfsense-packages-fd12957b5b87b842571ead4f6c5521702ae2a285.tar.bz2
pfsense-packages-fd12957b5b87b842571ead4f6c5521702ae2a285.zip
Shellcmd package debut
Diffstat (limited to 'config')
-rw-r--r--config/shellcmd/shellcmd.inc124
-rw-r--r--config/shellcmd/shellcmd.tmp231
-rw-r--r--config/shellcmd/shellcmd.xml115
-rw-r--r--config/shellcmd/shellcmd_edit.tmp236
4 files changed, 706 insertions, 0 deletions
diff --git a/config/shellcmd/shellcmd.inc b/config/shellcmd/shellcmd.inc
new file mode 100644
index 00000000..76ceeb31
--- /dev/null
+++ b/config/shellcmd/shellcmd.inc
@@ -0,0 +1,124 @@
+<?php
+/* $Id$ */
+/*
+/* ========================================================================== */
+/*
+ shellcmd.inc
+ Copyright (C) 2008 Mark J Crane
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require("services.inc");
+
+function pkg_is_service_running($servicename)
+{
+ exec("/bin/ps ax | awk '{ print $5 }'", $psout);
+ array_shift($psout);
+ foreach($psout as $line) {
+ $ps[] = trim(array_pop(explode(' ', array_pop(explode('/', $line)))));
+ }
+ if(is_service_running($servicename, $ps) or is_process_running($servicename) ) {
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+
+function php_sync_package()
+{
+
+ global $config;
+ //synch shellcmd tab
+ //configure_shellcmd();
+ //$handle = popen("/usr/local/etc/rc.d/shellcmd.sh stop", "r");
+ //pclose($handle);
+ //$handle = popen("/usr/local/etc/rc.d/shellcmd.sh start", "r");
+ //pclose($handle);
+
+}
+
+
+function php_install_command()
+{
+
+ global $config;
+ 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 /tmp/shellcmd.tmp /usr/local/www/packages/shellcmd/shellcmd.php");
+ unlink_if_exists("/tmp/shellcmd.tmp");
+
+ exec("cp /tmp/shellcmd_edit.tmp /usr/local/www/packages/shellcmd/shellcmd_edit.php");
+ unlink_if_exists("/tmp/shellcmd_edit.tmp");
+
+ //write_config();
+
+ //write_rcfile(array(
+ // "file" => "shellcmd.sh",
+ // "start" => "/usr/sbin/shellcmd -s &",
+ // "stop" => "kill -9 `cat /var/run/shellcmd.pid`"
+ // )
+ //);
+
+ php_sync_package();
+
+ //if (pkg_is_service_running('shellcmd')) {
+ //documentation purposes
+ //}
+
+ conf_mount_ro();
+ config_unlock();
+
+}
+
+
+function 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();
+
+}
+
+?> \ No newline at end of file
diff --git a/config/shellcmd/shellcmd.tmp b/config/shellcmd/shellcmd.tmp
new file mode 100644
index 00000000..66e32c44
--- /dev/null
+++ b/config/shellcmd/shellcmd.tmp
@@ -0,0 +1,231 @@
+<?php
+/* $Id$ */
+/*
+ shellcmd.php
+ Copyright (C) 2008 Mark J Crane
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require("guiconfig.inc");
+require("/usr/local/pkg/shellcmd.inc");
+
+$a_earlyshellcmd = &$config['system']['earlyshellcmd'];
+$a_shellcmd = &$config['system']['shellcmd'];
+$a_afterfilterchangeshellcmd = &$config['system']['afterfilterchangeshellcmd'];
+
+if ($_GET['act'] == "del") {
+ if ($_GET['type'] == 'cmd') {
+ if ($a_shellcmd[$_GET['id']]) {
+ unset($a_shellcmd[$_GET['id']]);
+ write_config();
+ header("Location: shellcmd.php");
+ exit;
+ }
+ }
+}
+
+include("head.inc");
+
+?>
+
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle">Shellcmd: Settings</p>
+
+<div id="mainlevel">
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr><td class="tabnavtbl">
+<?php
+
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "/packages/shellcmd/shellcmd.php");
+ display_top_tabs($tab_array);
+
+?>
+</td></tr>
+</table>
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabcont" >
+
+<form action="shellcmd.php" method="post" name="iform" id="iform">
+<?php
+
+if ($config_change == 1) {
+ write_config();
+ $config_change = 0;
+}
+
+//if ($savemsg) print_info_box($savemsg);
+//if (file_exists($d_hostsdirty_path)): echo"<p>";
+//print_info_box_np("This is an info box.");
+//echo"<br />";
+//endif;
+
+?>
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td><p><!--<span class="vexpl"><span class="red"><strong>shellcmd<br></strong></span>-->
+ shellcmd controls the commands that are started when the sytems is booted up.
+ <br /><br />
+ <!--For more information see: <a href='http://www.' target='_blank'>http://www.</a>-->
+ </p></td>
+ </tr>
+ </table>
+ <br />
+
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td width="50%" class="listhdrr">command</td>
+ <td width="30%" class="listhdrr">type</td>
+ <td width="10%" class="list">
+
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td width="17"></td>
+ <td valign="middle"><a href="shellcmd_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
+ </tr>
+ </table>
+
+ </td>
+ </tr>
+
+
+<?php
+
+ $i = 0;
+ if (count($a_earlyshellcmd) > 0) {
+ foreach ($a_earlyshellcmd as $ent) {
+ echo " <tr>\n";
+ echo " <td class=\"listr\" ondblclick=\"document.location='shellcmd_edit.php?id=".$i."';\">\n";
+ echo " ".$ent['command']."&nbsp;\n";
+ echo " </td>\n";
+ echo " <td class=\"listr\" ondblclick=\"document.location='shellcmd_edit.php?id=".$i."';\">\n";
+ echo " earlyshellcmd&nbsp;\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?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++;
+ }
+ }
+
+
+ $i = 0;
+ if (count($a_shellcmd) > 0) {
+ foreach ($a_shellcmd as $ent) {
+ echo " <tr>\n";
+ echo " <td class=\"listr\" ondblclick=\"document.location='shellcmd_edit.php?id=".$i."';\">\n";
+ echo " ".$ent['command']."&nbsp;\n";
+ echo " </td>\n";
+ echo " <td class=\"listr\" ondblclick=\"document.location='shellcmd_edit.php?id=".$i."';\">\n";
+ echo " shellcmd&nbsp;\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?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++;
+ }
+ }
+
+
+ $i = 0;
+ if (count($a_afterfilterchangeshellcmd) > 0) {
+ foreach ($a_afterfilterchangeshellcmd as $ent) {
+ echo " <tr>\n";
+ echo " <td class=\"listr\" ondblclick=\"document.location='shellcmd_edit.php?id=".$i."';\">\n";
+ echo " ".$ent['command']."&nbsp;\n";
+ echo " </td>\n";
+ echo " <td class=\"listr\" ondblclick=\"document.location='shellcmd_edit.php?id=".$i."';\">\n";
+ echo " afterfilterchangeshellcmd&nbsp;\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?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++;
+ }
+ }
+?>
+
+ <tr>
+ <td class="list" colspan="7"></td>
+ <td class="list">
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td width="17"></td>
+ <td valign="middle"><a href="shellcmd_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+
+ <tr>
+ <td class="list" colspan="8"></td>
+ <td class="list"></td>
+ </tr>
+ </table>
+
+</form>
+
+
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+
+</td>
+</tr>
+</table>
+
+</div>
+
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/config/shellcmd/shellcmd.xml b/config/shellcmd/shellcmd.xml
new file mode 100644
index 00000000..7e5af996
--- /dev/null
+++ b/config/shellcmd/shellcmd.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd">
+<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?>
+<packagegui>
+ <copyright>
+ <![CDATA[
+/* $Id$ */
+/* ========================================================================== */
+/*
+ shellcmd.xml
+ Copyright (C) 2008 Mark J Crane
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+ ]]>
+ </copyright>
+ <description>Shellcmd</description>
+ <requirements>Describe your package requirements here</requirements>
+ <faq>Currently there are no FAQ items provided.</faq>
+ <name>Shellcmd Settings</name>
+ <version>0.1</version>
+ <title>Settings</title>
+ <include_file>/usr/local/pkg/shellcmd.inc</include_file>
+ <menu>
+ <name>Shellcmd</name>
+ <tooltiptext>shellcmd settings.</tooltiptext>
+ <section>Services</section>
+ <configfile>shellcmd.xml</configfile>
+ <url>/packages/shellcmd/shellcmd.php</url>
+ </menu>
+ <tabs>
+ <tab>
+ <text>Settings</text>
+ <url>/pkg_edit.php?xml=shellcmd.xml&amp;id=0</url>
+ <active/>
+ </tab>
+ <tab>
+ <text>Settings</text>
+ <url>/packages/shellcmd.php</url>
+ <active/>
+ </tab>
+ </tabs>
+ <configpath>installedpackages->package->$packagename->configuration->shellcmd</configpath>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/shellcmd/shellcmd.xml</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/shellcmd/shellcmd.inc</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/shellcmd/shellcmd.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/shellcmd/shellcmd_edit.tmp</item>
+ </additional_files_needed>
+ <fields>
+ <field>
+ <fielddescr>Variable One</fielddescr>
+ <fieldname>var1</fieldname>
+ <description>Enter the variable one here.</description>
+ <type>input</type>
+ </field>
+ <field>
+ <fielddescr>Variable Two</fielddescr>
+ <fieldname>var1</fieldname>
+ <description>Enter the variable one here.</description>
+ <type>input</type>
+ </field>
+ </fields>
+ <custom_add_php_command>
+ </custom_add_php_command>
+ <custom_php_resync_config_command>
+ php_sync_package();
+ </custom_php_resync_config_command>
+ <custom_delete_php_command>
+ php_sync_package();
+ </custom_delete_php_command>
+ <custom_php_install_command>
+ php_install_command();
+ </custom_php_install_command>
+ <custom_php_deinstall_command>
+ deinstall_command();
+ </custom_php_deinstall_command>
+</packagegui> \ No newline at end of file
diff --git a/config/shellcmd/shellcmd_edit.tmp b/config/shellcmd/shellcmd_edit.tmp
new file mode 100644
index 00000000..904c6008
--- /dev/null
+++ b/config/shellcmd/shellcmd_edit.tmp
@@ -0,0 +1,236 @@
+<?php
+/* $Id$ */
+/*
+
+ shellcmd_edit.php
+ Copyright (C) 2008 Mark J Crane
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+
+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'])) {
+ $id = $_POST['id'];
+}
+
+$type = $_GET['t'];
+if (isset($_POST['t'])) {
+ $type = $_POST['t'];
+}
+
+if ($_GET['act'] == "del") {
+ if ($_GET['type'] == 'cmd') {
+ if ($a_shellcmd[$_GET['id']]) {
+ unset($a_shellcmd[$_GET['id']]);
+ write_config();
+ php_sync_package();
+ header("Location: shellcmd.php");
+ exit;
+ }
+ }
+}
+
+if (isset($id) && $a_shellcmd[$id]) {
+
+ $pconfig['command'] = $a_shellcmd[$id]['command'];
+
+
+}
+
+if ($_POST) {
+
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ if (!$input_errors) {
+
+ $ent = array();
+ $ent['command'] = $_POST['command'];
+
+ if (isset($id) && $a_shellcmd[$id]) {
+ //update
+ $a_shellcmd[$id] = $ent;
+ }
+ else {
+ //add
+ switch (htmlspecialchars($type)) {
+ case "earlyshellcmd":
+ $a_earlyshellcmd[] = $ent;
+ break;
+ case "shellcmd":
+ $a_shellcmd[] = $ent;
+ break;
+ case "afterfilterchangeshellcmd":
+ $a_afterfilterchangeshellcmd[] = $ent;
+ break;
+ default:
+ break;
+ }
+
+ }
+
+ write_config();
+ php_sync_package();
+
+ header("Location: shellcmd.php");
+ exit;
+ }
+}
+
+include("head.inc");
+
+?>
+
+<script type="text/javascript" language="JavaScript">
+
+function show_advanced_config() {
+ document.getElementById("showadvancedbox").innerHTML='';
+ aodiv = document.getElementById('showadvanced');
+ aodiv.style.display = "block";
+</script>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle">shellcmd: Edit</p>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+
+
+<div id="mainlevel">
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr><td class="tabnavtbl">
+<?php
+
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "/packages/shellcmd/shellcmd.php");
+ display_top_tabs($tab_array);
+
+?>
+</td></tr>
+</table>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabcont" >
+
+ <!--
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td><p><span class="vexpl"><span class="red"><strong>shellcmd<br>
+ </strong></span>
+ </p></td>
+ </tr>
+ </table>
+ -->
+ <br />
+
+
+ <form action="shellcmd_edit.php" method="post" name="iform" id="iform">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="25%" valign="top" class="vncellreq">type</td>
+ <td width="75%" class="vtable">
+ <?php
+ echo " <select name='t' class='formfld'>\n";
+ echo " <option></option>\n";
+ switch (htmlspecialchars($type)) {
+ case "earlyshellcmd":
+ echo " <option value='earlyshellcmd' selected='yes'>earlyshellcmd</option>\n";
+ echo " <option value='shellcmd'>shellcmd</option>\n";
+ echo " <option value='afterfilterchangeshellcmd'>afterfilterchangeshellcmd</option>\n";
+ break;
+ case "shellcmd":
+ echo " <option value='earlyshellcmd'>earlyshellcmd</option>\n";
+ echo " <option value='shellcmd' selected='yes'>shellcmd</option>\n";
+ echo " <option value='afterfilterchangeshellcmd'>afterfilterchangeshellcmd</option>\n";
+ break;
+ case "afterfilterchangeshellcmd":
+ echo " <option value='earlyshellcmd'>earlyshellcmd</option>\n";
+ echo " <option value='shellcmd'>shellcmd</option>\n";
+ echo " <option value='afterfilterchangeshellcmd' selected='yes'>afterfilterchangeshellcmd</option>\n";
+ break;
+ default:
+ echo " <option value=''></option>\n";
+ echo " <option value='earlyshellcmd'>earlyshellcmd</option>\n";
+ echo " <option value='shellcmd'>shellcmd</option>\n";
+ echo " <option value='afterfilterchangeshellcmd'>afterfilterchangeshellcmd</option>\n";
+ break;
+ }
+ echo " </select>\n";
+ ?>
+ <input name="type" type="text" class="formfld" id="minute" size="40" value="<?=htmlspecialchars($pconfig['type']);?>">
+ </td>
+ </tr>
+
+ <tr>
+ <td width="25%" valign="top" class="vncellreq">command</td>
+ <td width="75%" class="vtable">
+ <input name="command" type="text" class="formfld" id="command" size="40" value="<?=htmlspecialchars($pconfig['command']);?>">
+ </td>
+ </tr>
+
+
+ <!--
+ <tr>
+ <td width="25%" valign="top" class="vncellreq">Description</td>
+ <td width="75%" class="vtable">
+ <input name="description" type="text" class="formfld" id="description" size="40" value="<?=htmlspecialchars($pconfig['description']);?>">
+ <br><span class="vexpl">Enter the description here.<br></span>
+ </td>
+ </tr>
+ -->
+
+ <tr>
+ <td valign="top">&nbsp;</td>
+ <td>
+ <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
+ <?php if (isset($id) && $a_shellcmd[$id]): ?>
+ <input name="id" type="hidden" value="<?=$id;?>">
+ <?php endif; ?>
+ </td>
+ </tr>
+ </table>
+ </form>
+
+ <br>
+ <br>
+ <br>
+ <br>
+ <br>
+ <br>
+
+ </td>
+ </tr>
+</table>
+
+</div>
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
411' href='#n1411'>1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781