Completed
Push — 23 ( 2cbb94...e876bd )
by Harald
11:26 queued 05:21
created

securityCheck_error_log_files::pass()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 5
nc 3
nop 0
dl 0
loc 9
rs 9.2
c 0
b 0
f 0
1
<?php
2
/*
3
  $Id$
4
5
  osCommerce, Open Source E-Commerce Solutions
6
  http://www.oscommerce.com
7
8
  Copyright (c) 2017 osCommerce
9
10
  Released under the GNU General Public License
11
*/
12
13
  class securityCheck_error_log_files {
14
    var $type = 'warning';
15
16
    function securityCheck_error_log_files() {
17
      global $language;
18
19
      include(DIR_FS_ADMIN . 'includes/languages/' . $language . '/modules/security_check/error_log_files.php');
20
21
      $this->title = MODULE_SECURITY_CHECK_ERROR_LOG_FILES_TITLE;
0 ignored issues
show
Bug introduced by
The property title does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
22
    }
23
24
    function pass() {
25
      if (is_dir(DIR_FS_CATALOG . 'includes/work/error_logs') && is_writable(DIR_FS_CATALOG . 'includes/work/error_logs')) {
26
        if (count(glob(DIR_FS_CATALOG . 'includes/work/error_logs/errors-*.txt')) > 0) {
27
          return false;
28
        }
29
      }
30
31
      return true;
32
    }
33
34
    function getMessage() {
35
      return WARNING_ERROR_LOG_FILES_EXIST;
36
    }
37
  }
38
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
39