aboutsummaryrefslogtreecommitdiffstats
path: root/config/systempatches/system_patches_edit.php
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-08-06 14:35:48 +0545
committerPhil Davis <phil.davis@inf.org>2015-08-06 14:35:48 +0545
commit05074a272afe59851788c3dd7c7a925fbfbc75ed (patch)
tree0ddb15c1e0794abd14093156262ad53a4acf87b2 /config/systempatches/system_patches_edit.php
parentbad0f316bf513e8a7b61646ceb2e1ddb3bf2b03d (diff)
downloadpfsense-packages-05074a272afe59851788c3dd7c7a925fbfbc75ed.tar.gz
pfsense-packages-05074a272afe59851788c3dd7c7a925fbfbc75ed.tar.bz2
pfsense-packages-05074a272afe59851788c3dd7c7a925fbfbc75ed.zip
Systen Patches package code style
Diffstat (limited to 'config/systempatches/system_patches_edit.php')
-rw-r--r--config/systempatches/system_patches_edit.php28
1 files changed, 17 insertions, 11 deletions
diff --git a/config/systempatches/system_patches_edit.php b/config/systempatches/system_patches_edit.php
index 3e63038e..9e1f7a49 100644
--- a/config/systempatches/system_patches_edit.php
+++ b/config/systempatches/system_patches_edit.php
@@ -46,8 +46,9 @@ if (!is_array($config['installedpackages']['patches']['item'])) {
$a_patches = &$config['installedpackages']['patches']['item'];
$id = $_GET['id'];
-if (isset($_POST['id']))
+if (isset($_POST['id'])) {
$id = $_POST['id'];
+}
if (isset($_GET['dup'])) {
$id = $_GET['dup'];
@@ -69,8 +70,9 @@ if (isset($id) && $a_patches[$id]) {
$pconfig['ignorewhitespace'] = true;
}
-if (isset($_GET['dup']))
+if (isset($_GET['dup'])) {
unset($id);
+}
unset($input_errors);
@@ -87,10 +89,11 @@ if ($_POST) {
}
$pf_version=substr(trim(file_get_contents("/etc/version")),0,3);
- if ($pf_version < 2.1)
+ if ($pf_version < 2.1) {
$input_errors = eval('do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); return $input_errors;');
- else
+ } else {
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
+ }
if (!empty($_POST['location']) && !is_commit_id($_POST['location']) && !is_URL($_POST['location'])) {
$input_errors[] = gettext("The supplied commit ID/URL appears to be invalid.");
@@ -111,10 +114,11 @@ if ($_POST) {
/* Strip DOS style carriage returns from textarea input */
$thispatch['patch'] = base64_encode(str_replace("\r", "", $_POST['patch']));
}
- if (is_github_url($thispatch['location']) && ($_POST['pathstrip'] == 0))
+ if (is_github_url($thispatch['location']) && ($_POST['pathstrip'] == 0)) {
$thispatch['pathstrip'] = 1;
- else
+ } else {
$thispatch['pathstrip'] = $_POST['pathstrip'];
+ }
$thispatch['basedir'] = empty($_POST['basedir']) ? "/" : $_POST['basedir'];
$thispatch['ignorewhitespace'] = isset($_POST['ignorewhitespace']);
$thispatch['autoapply'] = isset($_POST['autoapply']);
@@ -125,18 +129,20 @@ if ($_POST) {
}
// Update the patch entry now
- if (isset($id) && $a_patches[$id])
+ if (isset($id) && $a_patches[$id]) {
$a_patches[$id] = $thispatch;
- else {
- if (is_numeric($after))
+ } else {
+ if (is_numeric($after)) {
array_splice($a_patches, $after+1, 0, array($thispatch));
- else
+ } else {
$a_patches[] = $thispatch;
+ }
}
write_config();
- if ($thispatch['autoapply'])
+ if ($thispatch['autoapply']) {
patch_add_shellcmd();
+ }
header("Location: system_patches.php");
return;
}