diff options
author | mcrane <mctch@yahoo.com> | 2009-12-19 16:22:57 -0700 |
---|---|---|
committer | mcrane <mctch@yahoo.com> | 2009-12-19 16:22:57 -0700 |
commit | d3f4d86e26aa297416e85a8e99dd926e7e3a78af (patch) | |
tree | ee36fac184147bd0d436a7772d3900d6b852ea1b /config/vhosts/vhosts_php_edit.tmp | |
parent | aeeaaa03a693805aa67c473df7607ac3ef8c8b5d (diff) | |
download | pfsense-packages-d3f4d86e26aa297416e85a8e99dd926e7e3a78af.tar.gz pfsense-packages-d3f4d86e26aa297416e85a8e99dd926e7e3a78af.tar.bz2 pfsense-packages-d3f4d86e26aa297416e85a8e99dd926e7e3a78af.zip |
Introducing vHosts web server package. It uses lighttp that is already installed but runs another instance of it with its own config. Also supports PHP5, and PHP PDO and SQLite
Diffstat (limited to 'config/vhosts/vhosts_php_edit.tmp')
-rw-r--r-- | config/vhosts/vhosts_php_edit.tmp | 231 |
1 files changed, 231 insertions, 0 deletions
diff --git a/config/vhosts/vhosts_php_edit.tmp b/config/vhosts/vhosts_php_edit.tmp new file mode 100644 index 00000000..db3235d6 --- /dev/null +++ b/config/vhosts/vhosts_php_edit.tmp @@ -0,0 +1,231 @@ +<?php +/* $Id$ */ +/* + + vhosts_php_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/vhosts.inc"); + + +$a_vhosts = &$config['installedpackages']['vhosts']['config']; + +$id = $_GET['id']; +if (isset($_POST['id'])) { + $id = $_POST['id']; +} + +if ($_GET['act'] == "del") { + if ($_GET['type'] == 'php') { + if ($a_vhosts[$_GET['id']]) { + unset($a_vhosts[$_GET['id']]); + write_config(); + php_sync_package(); + header("Location: vhosts_php.php"); + exit; + } + } +} + +if (isset($id) && $a_vhosts[$id]) { + $pconfig['name'] = $a_vhosts[$id]['name']; + $pconfig['host'] = $a_vhosts[$id]['host']; + $pconfig['ipaddress'] = $a_vhosts[$id]['ipaddress']; + $pconfig['port'] = $a_vhosts[$id]['port']; + $pconfig['enabled'] = $a_vhosts[$id]['enabled']; + $pconfig['description'] = $a_vhosts[$id]['description']; + +} + +if ($_POST) { + + unset($input_errors); + $pconfig = $_POST; + + if (!$input_errors) { + + $ent = array(); + $ent['name'] = $_POST['name']; + $ent['host'] = $_POST['host']; + $ent['ipaddress'] = $_POST['ipaddress']; + $ent['port'] = $_POST['port']; + $ent['enabled'] = $_POST['enabled']; + $ent['description'] = $_POST['description']; + + if (isset($id) && $a_vhosts[$id]) { + //update + $a_vhosts[$id] = $ent; + } + else { + //add + $a_vhosts[] = $ent; + } + + write_config(); + php_sync_package(); + + header("Location: vhosts_php.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">PHP Service: 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/vhosts/vhosts_php.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>PHP<br> + </strong></span> + </p></td> + </tr> + </table> + --> + <br /> + + <form action="vhosts_php_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">Name</td> + <td width="75%" class="vtable"> + <input name="name" type="text" class="formfld" id="name" size="40" value="<?=htmlspecialchars($pconfig['name']);?>"> + </td> + </tr> + + <tr> + <td width="25%" valign="top" class="vncellreq">Host</td> + <td width="75%" class="vtable"> + <input name="name" type="text" class="formfld" id="host" size="40" value="<?=htmlspecialchars($pconfig['host']);?>"> + </td> + </tr> + + <tr> + <td width="25%" valign="top" class="vncellreq">IP Address</td> + <td width="75%" class="vtable"> + <input name="name" type="text" class="formfld" id="ipaddress" size="40" value="<?=htmlspecialchars($pconfig['ipaddress']);?>"> + </td> + </tr> + + <tr> + <td width="25%" valign="top" class="vncellreq">Port</td> + <td width="75%" class="vtable"> + <input name="name" type="text" class="formfld" id="port" size="40" value="<?=htmlspecialchars($pconfig['port']);?>"> + Example: 8001 + </td> + </tr> + + <tr> + <td width="22%" valign="top" class="vncellreq">Enabled</td> + <td width="78%" class="vtable"> + <?php + echo " <select name='enabled' class='formfld'>\n"; + echo " <option></option>\n"; + switch (htmlspecialchars($pconfig['enabled'])) { + case "true": + echo " <option value='true' selected='yes'>true</option>\n"; + echo " <option value='false'>false</option>\n"; + break; + case "false": + echo " <option value='true'>true</option>\n"; + echo " <option value='false' selected='yes'>false</option>\n"; + break; + default: + echo " <option value='true' selected='yes'>true</option>\n"; + echo " <option value='false'>false</option>\n"; + } + echo " </select>\n"; + ?> + </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"> </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_vhosts[$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> |