summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/pkg_edit.php
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-09-21 16:07:34 -0300
committerRenato Botelho <renato@netgate.com>2015-09-21 16:07:34 -0300
commitb365d2ea3ea2bbf9224f25b9c3239235c30fe65c (patch)
tree521f6923d43fd07baf9b73562086992168d76b42 /src/usr/local/www/pkg_edit.php
parent22d95a680eeba1b5b077ce2fee78adce938a7118 (diff)
parent8141416fb2dab0349a938eeaa2563253b489dfe7 (diff)
downloadpfsense-b365d2ea3ea2bbf9224f25b9c3239235c30fe65c.zip
pfsense-b365d2ea3ea2bbf9224f25b9c3239235c30fe65c.tar.gz
Merge pull request #1787 from k-paulius/patch-pkg-1
Diffstat (limited to 'src/usr/local/www/pkg_edit.php')
-rw-r--r--src/usr/local/www/pkg_edit.php33
1 files changed, 10 insertions, 23 deletions
diff --git a/src/usr/local/www/pkg_edit.php b/src/usr/local/www/pkg_edit.php
index 0b01a28..30b7911 100644
--- a/src/usr/local/www/pkg_edit.php
+++ b/src/usr/local/www/pkg_edit.php
@@ -90,13 +90,6 @@ if (!isset($pkg['adddeleteeditpagefields'])) {
$only_edit = false;
}
-$package_name = $pkg['menu'][0]['name'];
-$section = $pkg['menu'][0]['section'];
-$config_path = $pkg['configpath'];
-$name = $pkg['name'];
-$title = $pkg['title'];
-$pgtitle = $title;
-
$id = $_GET['id'];
if (isset($_POST['id'])) {
$id = htmlspecialchars($_POST['id']);
@@ -139,7 +132,6 @@ if ($pkg['custom_php_command_before_form'] <> "") {
}
if ($_POST) {
- $firstfield = "";
$rows = 0;
$input_errors = array();
@@ -210,6 +202,7 @@ if ($_POST) {
$rowhelpername="row";
foreach ($fields['rowhelper']['rowhelperfield'] as $rowhelperfield) {
foreach ($_POST as $key => $value) {
+ $matches = array();
if (preg_match("/^{$rowhelperfield['fieldname']}(\d+)$/", $key, $matches)) {
$pkgarr[$rowhelpername][$matches[1]][$rowhelperfield['fieldname']] = $value;
}
@@ -285,13 +278,11 @@ if ($_POST) {
if ($pkg['title'] <> "") {
$edit = ($only_edit ? '' : ": " . gettext("Edit"));
- $title = $pkg['title'] . $edit;
+ $pgtitle = $pkg['title'] . $edit;
} else {
- $title = gettext("Package Editor");
+ $pgtitle = gettext("Package Editor");
}
-$pgtitle = $title;
-
if ($pkg['custom_php_after_head_command']) {
$closehead = false;
include("head.inc");
@@ -481,6 +472,7 @@ if ($pkg['tabs'] <> "") {
$advanced = "<td>&nbsp;</td>";
$advanced .= "<tr><td colspan=\"2\" class=\"listtopic\">". gettext("Advanced features") . "<br /></td></tr>\n";
}
+ $js_array = array();
foreach ($pkg['fields']['field'] as $pkga) {
if ($pkga['type'] == "sorting") {
continue;
@@ -582,10 +574,12 @@ if ($pkg['tabs'] <> "") {
$value = implode(',', $value);
}
} else {
- if (isset($id) && $a_pkg[$id]) {
+ if (isset($id) && isset($a_pkg[$id][$fieldname])) {
$value = $a_pkg[$id][$fieldname];
} else {
- $value = $pkga['default_value'];
+ if (isset($pkga['default_value'])) {
+ $value = $pkga['default_value'];
+ }
}
}
switch ($pkga['type']) {
@@ -963,13 +957,8 @@ if ($pkg['tabs'] <> "") {
if (isset($id) && $a_pkg[$id]) {
$value = $row[$fieldname];
}
- $options = "";
$type = $rowhelper['type'];
- $description = $rowhelper['description'];
$fieldname = $rowhelper['fieldname'];
- if ($type == "option") {
- $options = &$rowhelper['options']['option'];
- }
if ($rowhelper['size']) {
$size = $rowhelper['size'];
} else if ($pkga['size']) {
@@ -1101,7 +1090,7 @@ if ($pkg['tabs'] <> "") {
* ROW Helpers function
*/
function display_row($trc, $value, $fieldname, $type, $rowhelper, $size) {
- global $text, $config;
+ global $text;
echo "<td>\n";
switch ($type) {
case "input":
@@ -1202,13 +1191,11 @@ function fixup_string($string) {
* Parse templates if they are defined
*/
function parse_package_templates() {
- global $pkg, $config;
- $rows = 0;
+ global $pkg;
if ($pkg['templates']['template'] <> "") {
foreach ($pkg['templates']['template'] as $pkg_template_row) {
$filename = $pkg_template_row['filename'];
$template_text = $pkg_template_row['templatecontents'];
- $firstfield = "";
/* calculate total row helpers count and */
/* change fields defined as fieldname_fieldvalue to their value */
foreach ($pkg['fields']['field'] as $fields) {
OpenPOWER on IntegriCloud