Completed
Push — master ( 85914a...2ce878 )
by Harald
06:39 queued 03:01
created

actionRecorderAdmin   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 39
rs 10
c 0
b 0
f 0
wmc 10
lcom 0
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
D __construct() 0 37 10
1
<?php
2
/*
3
  $Id$
4
5
  osCommerce, Open Source E-Commerce Solutions
6
  http://www.oscommerce.com
7
8
  Copyright (c) 2010 osCommerce
9
10
  Released under the GNU General Public License
11
*/
12
13
  use OSC\OM\HTML;
14
  use OSC\OM\OSCOM;
15
  use OSC\OM\Registry;
16
17
  require(OSCOM::getConfig('dir_root', 'Shop') . 'includes/classes/action_recorder.php');
18
19
  class actionRecorderAdmin extends actionRecorder {
20
    function __construct($module, $user_id = null, $user_name = null) {
21
      global $PHP_SELF;
22
23
      $this->lang = Registry::get('Language');
24
25
      $module = HTML::sanitize(str_replace(' ', '', $module));
26
27
      if (defined('MODULE_ACTION_RECORDER_INSTALLED') && tep_not_null(MODULE_ACTION_RECORDER_INSTALLED)) {
28
        if (tep_not_null($module) && in_array($module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), explode(';', MODULE_ACTION_RECORDER_INSTALLED))) {
29
          if (!class_exists($module)) {
30
            if (is_file(OSCOM::getConfig('dir_root', 'Shop') . 'includes/modules/action_recorder/' . $module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)))) {
31
              $this->lang->loadDefinitions('Shop/modules/action_recorder/' . $module);
32
              include(OSCOM::getConfig('dir_root', 'Shop') . 'includes/modules/action_recorder/' . $module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)));
33
            } else {
34
              return false;
0 ignored issues
show
Bug introduced by
Constructors do not have meaningful return values, anything that is returned from here is discarded. Are you sure this is correct?
Loading history...
35
            }
36
          }
37
        } else {
38
          return false;
0 ignored issues
show
Bug introduced by
Constructors do not have meaningful return values, anything that is returned from here is discarded. Are you sure this is correct?
Loading history...
39
        }
40
      } else {
41
        return false;
0 ignored issues
show
Bug introduced by
Constructors do not have meaningful return values, anything that is returned from here is discarded. Are you sure this is correct?
Loading history...
42
      }
43
44
      $this->_module = $module;
45
46
      if (!empty($user_id) && is_numeric($user_id)) {
47
        $this->_user_id = $user_id;
48
      }
49
50
      if (!empty($user_name)) {
51
        $this->_user_name = $user_name;
52
      }
53
54
      $GLOBALS[$this->_module] = new $module();
55
      $GLOBALS[$this->_module]->setIdentifier();
56
    }
57
  }
58
?>
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...
59