From 86e6990d7e6f5634f83ef2a125e14cf08bac1dc0 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Fri, 22 May 2015 12:46:29 -0400
Subject: [PATCH] - checked and fixed usage of empty()
---
install/dist/lib/centos53.lib.php | 4 ++--
install/lib/installer_base.lib.php | 2 +-
install/dist/lib/fedora.lib.php | 2 +-
install/dist/lib/centos70.lib.php | 2 +-
install/dist/lib/opensuse.lib.php | 2 +-
server/plugins-available/mailman_plugin.inc.php | 4 ++--
server/lib/classes/file.inc.php | 2 +-
interface/lib/classes/tform_base.inc.php | 4 ++--
interface/lib/app.inc.php | 2 +-
install/dist/lib/centos52.lib.php | 3 ++-
10 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/install/dist/lib/centos52.lib.php b/install/dist/lib/centos52.lib.php
index 9111528..7e7cf73 100644
--- a/install/dist/lib/centos52.lib.php
+++ b/install/dist/lib/centos52.lib.php
@@ -51,7 +51,7 @@
if (trim($line) != '' && substr($line, 0, 1) != '#')
{
@list($key, $value) = @explode("=", $line);
- if (!empty($value))
+ if (isset($value) && $value !== '')
{
$key = rtrim($key);
$old_options[$key] = trim($value);
@@ -112,6 +112,7 @@
// amavisd user config file
$configfile = 'fedora_amavisd_conf';
+ if(!is_dir($conf["amavis"]["config_dir"])) mkdir($conf["amavis"]["config_dir"]);
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf', $conf["amavis"]["config_dir"].'/amavisd.conf~');
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~');
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
diff --git a/install/dist/lib/centos53.lib.php b/install/dist/lib/centos53.lib.php
index 0ac99f2..81156da 100644
--- a/install/dist/lib/centos53.lib.php
+++ b/install/dist/lib/centos53.lib.php
@@ -51,7 +51,7 @@
if (trim($line) != '' && substr($line, 0, 1) != '#')
{
@list($key, $value) = @explode("=", $line);
- if (!empty($value))
+ if (isset($value) && $value !== '')
{
$key = rtrim($key);
$old_options[$key] = trim($value);
@@ -112,9 +112,9 @@
// amavisd user config file
$configfile = 'fedora_amavisd_conf';
+ if(!is_dir($conf["amavis"]["config_dir"])) mkdir($conf["amavis"]["config_dir"]);
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf', $conf["amavis"]["config_dir"].'/amavisd.conf~');
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~');
- if(!is_dir($conf["amavis"]["config_dir"])) mkdir($conf["amavis"]["config_dir"]);
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
diff --git a/install/dist/lib/centos70.lib.php b/install/dist/lib/centos70.lib.php
index 9cee55f..54542dd 100644
--- a/install/dist/lib/centos70.lib.php
+++ b/install/dist/lib/centos70.lib.php
@@ -51,7 +51,7 @@
if (trim($line) != '' && substr($line, 0, 1) != '#')
{
@list($key, $value) = @explode("=", $line);
- if (!empty($value))
+ if (isset($value) && $value !== '')
{
$key = rtrim($key);
$old_options[$key] = trim($value);
diff --git a/install/dist/lib/fedora.lib.php b/install/dist/lib/fedora.lib.php
index f017ea5..658af9b 100644
--- a/install/dist/lib/fedora.lib.php
+++ b/install/dist/lib/fedora.lib.php
@@ -51,7 +51,7 @@
if (trim($line) != '' && substr($line, 0, 1) != '#')
{
@list($key, $value) = @explode("=", $line);
- if (!empty($value))
+ if (isset($value) && $value !== '')
{
$key = rtrim($key);
$old_options[$key] = trim($value);
diff --git a/install/dist/lib/opensuse.lib.php b/install/dist/lib/opensuse.lib.php
index b452c2f..ec278b9 100644
--- a/install/dist/lib/opensuse.lib.php
+++ b/install/dist/lib/opensuse.lib.php
@@ -67,7 +67,7 @@
if (trim($line) != '' && substr($line, 0, 1) != '#')
{
@list($key, $value) = @explode("=", $line);
- if (!empty($value))
+ if (isset($value) && $value !== '')
{
$key = rtrim($key);
$old_options[$key] = trim($value);
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index f867f04..12fc8a0 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -616,7 +616,7 @@
if (trim($line) != '' && substr($line, 0, 1) != '#')
{
@list($key, $value) = @explode("=", $line);
- if (!empty($value))
+ if (isset($value) && $value !== '')
{
$key = rtrim($key);
$old_options[$key] = trim($value);
diff --git a/interface/lib/app.inc.php b/interface/lib/app.inc.php
index 949f164..e23b6ca 100755
--- a/interface/lib/app.inc.php
+++ b/interface/lib/app.inc.php
@@ -240,7 +240,7 @@
}
$this->_language_inc = 1;
}
- if(!empty($this->_wb[$text])) {
+ if(isset($this->_wb[$text]) && $this->wb[$text] !== '') {
$text = $this->_wb[$text];
} else {
if($this->_conf['debug_language']) {
diff --git a/interface/lib/classes/tform_base.inc.php b/interface/lib/classes/tform_base.inc.php
index 749ea5c..f5de558 100644
--- a/interface/lib/classes/tform_base.inc.php
+++ b/interface/lib/classes/tform_base.inc.php
@@ -447,7 +447,7 @@
if(is_array($field['value'])) {
foreach($field['value'] as $k => $v) {
$selected = ($k == $val)?' SELECTED':'';
- if(!empty($this->wordbook[$v]))
+ if(isset($this->wordbook[$v]))
$v = $this->wordbook[$v];
$out .= "<option value='$k'$selected>".$this->lng($v)."</option>\r\n";
}
@@ -881,7 +881,7 @@
}
break;
case 'NOTEMPTY':
- if(empty($field_value)) {
+ if(!isset($field_value) || $field_value === '') {
$errmsg = $validator['errmsg'];
if(isset($this->wordbook[$errmsg])) {
$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
diff --git a/server/lib/classes/file.inc.php b/server/lib/classes/file.inc.php
index a5f4c84..eadb38b 100644
--- a/server/lib/classes/file.inc.php
+++ b/server/lib/classes/file.inc.php
@@ -190,7 +190,7 @@
// @ext_save : 1 for YES, 0 for NO - meaning it will filter out system files or not (such as .htaccess)
$dirname = realpath($dirname);
- if (!$exts || empty($exts) || $exts == '') {
+ if (empty($exts)) {
$exts = array('jpg', 'gif', 'jpeg', 'png');
}
if ($handle = opendir($dirname)) {
diff --git a/server/plugins-available/mailman_plugin.inc.php b/server/plugins-available/mailman_plugin.inc.php
index 9ebb2aa..0d282f5 100644
--- a/server/plugins-available/mailman_plugin.inc.php
+++ b/server/plugins-available/mailman_plugin.inc.php
@@ -115,7 +115,7 @@
function update_config() {
global $app, $conf;
- copy($this->mailman_config_dir.'mm_cfg.py', $this->mailman_config_dir.'mm_cfg.py');
+ copy($this->mailman_config_dir.'mm_cfg.py', $this->mailman_config_dir.'mm_cfg.py~');
// load the server configuration options
$app->uses('getconf');
@@ -136,7 +136,7 @@
if (strlen($line) && substr($line, 0, 1) != '#')
{
list($key, $value) = explode("=", $line);
- if (!empty($value))
+ if ($value && $value !== '')
{
$key = rtrim($key);
$old_options[$key] = trim($value);
--
Gitblit v1.9.1