Code Duplication    Length = 21-21 lines in 3 locations

phpsysinfo/plugins/dmraid/class.dmraid.inc.php 1 location

@@ 45-65 (lines=21) @@
42
     *
43
     * @param String $enc encoding
44
     */
45
    public function __construct($enc)
46
    {
47
        $buffer = "";
48
        parent::__construct(__CLASS__, $enc);
49
        switch (strtolower(PSI_PLUGIN_DMRAID_ACCESS)) {
50
        case 'command':
51
            CommonFunctions::executeProgram("dmraid", "-s -vv 2>&1", $buffer);
52
            break;
53
        case 'data':
54
            CommonFunctions::rfts(APP_ROOT."/data/dmraid.txt", $buffer);
55
            break;
56
        default:
57
            $this->global_error->addConfigError("__construct()", "PSI_PLUGIN_DMRAID_ACCESS");
58
            break;
59
        }
60
        if (trim($buffer) != "") {
61
            $this->_filecontent = preg_split("/(\r?\n\*\*\* )|(\r?\n--> )/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
62
        } else {
63
            $this->_filecontent = array();
64
        }
65
    }
66
67
    /**
68
     * doing all tasks to get the required informations that the plugin needs

phpsysinfo/plugins/mdstatus/class.mdstatus.inc.php 1 location

@@ 50-70 (lines=21) @@
47
     *
48
     * @param String $enc encoding
49
     */
50
    public function __construct($enc)
51
    {
52
        $buffer = "";
53
        parent::__construct(__CLASS__, $enc);
54
        switch (strtolower(PSI_PLUGIN_MDSTATUS_ACCESS)) {
55
        case 'file':
56
            CommonFunctions::rfts("/proc/mdstat", $buffer);
57
            break;
58
        case 'data':
59
            CommonFunctions::rfts(APP_ROOT."/data/mdstat.txt", $buffer);
60
            break;
61
        default:
62
            $this->global_error->addConfigError("__construct()", "PSI_PLUGIN_MDSTATUS_ACCESS");
63
            break;
64
        }
65
        if (trim($buffer) != "") {
66
            $this->_filecontent = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
67
        } else {
68
            $this->_filecontent = array();
69
        }
70
    }
71
72
    /**
73
     * doing all tasks to get the required informations that the plugin needs

phpsysinfo/plugins/quotas/class.quotas.inc.php 1 location

@@ 50-70 (lines=21) @@
47
     *
48
     * @param String $enc target encoding
49
     */
50
    public function __construct($enc)
51
    {
52
        parent::__construct(__CLASS__, $enc);
53
        switch (strtolower(PSI_PLUGIN_QUOTAS_ACCESS)) {
54
        case 'command':
55
            CommonFunctions::executeProgram("repquota", "-au", $buffer, PSI_DEBUG);
56
            break;
57
        case 'data':
58
            CommonFunctions::rfts(APP_ROOT."/data/quotas.txt", $buffer);
59
            break;
60
        default:
61
            $this->global_error->addConfigError("__construct()", "PSI_PLUGIN_QUOTAS_ACCESS");
62
            break;
63
        }
64
        if (trim($buffer) != "") {
65
            $this->_filecontent = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY);
66
            unset($this->_filecontent[0]);
67
        } else {
68
            $this->_filecontent = array();
69
        }
70
    }
71
72
    /**
73
     * doing all tasks to get the required informations that the plugin needs