Skip to content

Commit 86e6990

Browse files
author
Marius Cramer
committed
- checked and fixed usage of empty()
1 parent 7de1b7b commit 86e6990

File tree

10 files changed

+14
-13
lines changed

10 files changed

+14
-13
lines changed

install/dist/lib/centos52.lib.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function configure_mailman($status = 'insert') {
5151
if (trim($line) != '' && substr($line, 0, 1) != '#')
5252
{
5353
@list($key, $value) = @explode("=", $line);
54-
if (!empty($value))
54+
if (isset($value) && $value !== '')
5555
{
5656
$key = rtrim($key);
5757
$old_options[$key] = trim($value);
@@ -112,6 +112,7 @@ public function configure_amavis() {
112112

113113
// amavisd user config file
114114
$configfile = 'fedora_amavisd_conf';
115+
if(!is_dir($conf["amavis"]["config_dir"])) mkdir($conf["amavis"]["config_dir"]);
115116
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf', $conf["amavis"]["config_dir"].'/amavisd.conf~');
116117
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~');
117118
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");

install/dist/lib/centos53.lib.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function configure_mailman($status = 'insert') {
5151
if (trim($line) != '' && substr($line, 0, 1) != '#')
5252
{
5353
@list($key, $value) = @explode("=", $line);
54-
if (!empty($value))
54+
if (isset($value) && $value !== '')
5555
{
5656
$key = rtrim($key);
5757
$old_options[$key] = trim($value);
@@ -112,9 +112,9 @@ public function configure_amavis() {
112112

113113
// amavisd user config file
114114
$configfile = 'fedora_amavisd_conf';
115+
if(!is_dir($conf["amavis"]["config_dir"])) mkdir($conf["amavis"]["config_dir"]);
115116
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf', $conf["amavis"]["config_dir"].'/amavisd.conf~');
116117
if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~');
117-
if(!is_dir($conf["amavis"]["config_dir"])) mkdir($conf["amavis"]["config_dir"]);
118118
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
119119
$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
120120
$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);

install/dist/lib/centos70.lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function configure_mailman($status = 'insert') {
5151
if (trim($line) != '' && substr($line, 0, 1) != '#')
5252
{
5353
@list($key, $value) = @explode("=", $line);
54-
if (!empty($value))
54+
if (isset($value) && $value !== '')
5555
{
5656
$key = rtrim($key);
5757
$old_options[$key] = trim($value);

install/dist/lib/fedora.lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function configure_mailman($status = 'insert') {
5151
if (trim($line) != '' && substr($line, 0, 1) != '#')
5252
{
5353
@list($key, $value) = @explode("=", $line);
54-
if (!empty($value))
54+
if (isset($value) && $value !== '')
5555
{
5656
$key = rtrim($key);
5757
$old_options[$key] = trim($value);

install/dist/lib/opensuse.lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function configure_mailman($status = 'insert') {
6767
if (trim($line) != '' && substr($line, 0, 1) != '#')
6868
{
6969
@list($key, $value) = @explode("=", $line);
70-
if (!empty($value))
70+
if (isset($value) && $value !== '')
7171
{
7272
$key = rtrim($key);
7373
$old_options[$key] = trim($value);

install/lib/installer_base.lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ public function configure_mailman($status = 'insert') {
616616
if (trim($line) != '' && substr($line, 0, 1) != '#')
617617
{
618618
@list($key, $value) = @explode("=", $line);
619-
if (!empty($value))
619+
if (isset($value) && $value !== '')
620620
{
621621
$key = rtrim($key);
622622
$old_options[$key] = trim($value);

interface/lib/app.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public function lng($text) {
240240
}
241241
$this->_language_inc = 1;
242242
}
243-
if(!empty($this->_wb[$text])) {
243+
if(isset($this->_wb[$text]) && $this->wb[$text] !== '') {
244244
$text = $this->_wb[$text];
245245
} else {
246246
if($this->_conf['debug_language']) {

interface/lib/classes/tform_base.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ function getHTML($record, $tab, $action = 'NEW') {
447447
if(is_array($field['value'])) {
448448
foreach($field['value'] as $k => $v) {
449449
$selected = ($k == $val)?' SELECTED':'';
450-
if(!empty($this->wordbook[$v]))
450+
if(isset($this->wordbook[$v]))
451451
$v = $this->wordbook[$v];
452452
$out .= "<option value='$k'$selected>".$this->lng($v)."</option>\r\n";
453453
}
@@ -881,7 +881,7 @@ function validateField($field_name, $field_value, $validators) {
881881
}
882882
break;
883883
case 'NOTEMPTY':
884-
if(empty($field_value)) {
884+
if(!isset($field_value) || $field_value === '') {
885885
$errmsg = $validator['errmsg'];
886886
if(isset($this->wordbook[$errmsg])) {
887887
$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";

server/lib/classes/file.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ function getDirectoryListing($dirname, $sortorder = 'a', $show_subdirs = 0, $sho
190190
// @ext_save : 1 for YES, 0 for NO - meaning it will filter out system files or not (such as .htaccess)
191191

192192
$dirname = realpath($dirname);
193-
if (!$exts || empty($exts) || $exts == '') {
193+
if (empty($exts)) {
194194
$exts = array('jpg', 'gif', 'jpeg', 'png');
195195
}
196196
if ($handle = opendir($dirname)) {

server/plugins-available/mailman_plugin.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function delete($event_name, $data) {
115115
function update_config() {
116116
global $app, $conf;
117117

118-
copy($this->mailman_config_dir.'mm_cfg.py', $this->mailman_config_dir.'mm_cfg.py');
118+
copy($this->mailman_config_dir.'mm_cfg.py', $this->mailman_config_dir.'mm_cfg.py~');
119119

120120
// load the server configuration options
121121
$app->uses('getconf');
@@ -136,7 +136,7 @@ function update_config() {
136136
if (strlen($line) && substr($line, 0, 1) != '#')
137137
{
138138
list($key, $value) = explode("=", $line);
139-
if (!empty($value))
139+
if ($value && $value !== '')
140140
{
141141
$key = rtrim($key);
142142
$old_options[$key] = trim($value);

0 commit comments

Comments
 (0)