Issues (1626)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

phpsysinfo/includes/output/class.Webpage.inc.php (4 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * start page for webaccess
4
 *
5
 * PHP version 5
6
 *
7
 * @category  PHP
8
 * @package   PSI_Web
9
 * @author    Michael Cramer <[email protected]>
10
 * @copyright 2009 phpSysInfo
11
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License
12
 * @version   SVN: $Id: class.Webpage.inc.php 661 2012-08-27 11:26:39Z namiltd $
13
 * @link      http://phpsysinfo.sourceforge.net
14
 */
15
 /**
16
 * generate the dynamic webpage
17
 *
18
 * @category  PHP
19
 * @package   PSI_Web
20
 * @author    Michael Cramer <[email protected]>
21
 * @copyright 2009 phpSysInfo
22
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License
23
 * @version   Release: 3.0
24
 * @link      http://phpsysinfo.sourceforge.net
25
 */
26
class Webpage extends Output implements PSI_Interface_Output
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
27
{
28
    /**
29
     * configured indexname
30
     *
31
     * @var String
32
     */
33
    private $_indexname;
34
35
    /**
36
     * configured language
37
     *
38
     * @var String
39
     */
40
    private $_language;
41
42
    /**
43
     * configured template
44
     *
45
     * @var String
46
     */
47
    private $_template;
48
49
    /**
50
     * all available templates
51
     *
52
     * @var Array
53
     */
54
    private $_templates = array();
55
56
    /**
57
     * configured bootstrap template
58
     *
59
     * @var String
60
     */
61
    private $_bootstrap_template;
62
63
    /**
64
     * all available bootstrap templates
65
     *
66
     * @var Array
67
     */
68
    private $_bootstrap_templates = array();
69
70
    /**
71
     * all available languages
72
     *
73
     * @var Array
74
     */
75
    private $_languages = array();
76
77
    /**
78
     * configured show picklist language
79
     *
80
     * @var boolean
81
     */
82
    private $_pick_language;
83
84
    /**
85
     * configured show picklist template
86
     *
87
     * @var boolean
88
     */
89
    private $_pick_template;
90
91
    /**
92
     * check for all extensions that are needed, initialize needed vars and read phpsysinfo.ini
93
     */
94
    public function __construct($indexname="dynamic")
95
    {
96
        $this->_indexname = $indexname;
97
        parent::__construct();
98
        $this->_getTemplateList();
99
        $this->_getLanguageList();
100
    }
101
102
    /**
103
     * checking phpsysinfo.ini setting for template, if not supportet set phpsysinfo.css as default
104
     * checking phpsysinfo.ini setting for language, if not supported set en as default
105
     *
106
     * @return void
107
     */
108
    private function _checkTemplateLanguage()
109
    {
110 View Code Duplication
        if (!defined("PSI_DEFAULT_TEMPLATE") || (($this->_template = strtolower(trim(PSI_DEFAULT_TEMPLATE))) == "") || !file_exists(APP_ROOT.'/templates/'.$this->_template.".css")) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
111
            $this->_template = 'phpsysinfo';
112
        }
113 View Code Duplication
        if (!defined("PSI_DEFAULT_BOOTSTRAP_TEMPLATE") || (($this->_bootstrap_template = strtolower(trim(PSI_DEFAULT_BOOTSTRAP_TEMPLATE))) == "") || !file_exists(APP_ROOT.'/templates/'.$this->_bootstrap_template.".css")) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
114
            $this->_bootstrap_template = 'phpsysinfo';
115
        }
116
        $this->_pick_template = !defined("PSI_SHOW_PICKLIST_TEMPLATE") || (PSI_SHOW_PICKLIST_TEMPLATE !== false);
117
118 View Code Duplication
        if (!defined("PSI_DEFAULT_LANG") || (($this->_language = strtolower(trim(PSI_DEFAULT_LANG))) == "") || !file_exists(APP_ROOT.'/language/'.$this->_language.".xml")) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
119
            $this->_language = 'en';
120
        }
121
        $this->_pick_language = !defined("PSI_SHOW_PICKLIST_LANG") || (PSI_SHOW_PICKLIST_LANG !== false);
122
    }
123
124
    /**
125
     * get all available tamplates and store them in internal array
126
     *
127
     * @return void
128
     */
129
    private function _getTemplateList()
130
    {
131
        $dirlist = CommonFunctions::gdc(APP_ROOT.'/templates/');
132
        sort($dirlist);
133
        foreach ($dirlist as $file) {
134
            $tpl_ext = substr($file, strlen($file) - 4);
135
            $tpl_name = substr($file, 0, strlen($file) - 4);
136
            if ($tpl_ext === ".css") {
137
                if (preg_match("/(\S+)_bootstrap$/", $tpl_name, $ar_buf)) {
138
                    array_push($this->_bootstrap_templates, $ar_buf[1]);
139
                } else {
140
                    array_push($this->_templates, $tpl_name);
141
                }
142
            }
143
        }
144
    }
145
146
    /**
147
     * get all available translations and store them in internal array
148
     *
149
     * @return void
150
     */
151
    private function _getLanguageList()
152
    {
153
        $dirlist = CommonFunctions::gdc(APP_ROOT.'/language/');
154
        sort($dirlist);
155
        foreach ($dirlist as $file) {
156
            $lang_ext = substr($file, strlen($file) - 4);
157
            $lang_name = substr($file, 0, strlen($file) - 4);
158
            if ($lang_ext == ".xml") {
159
                array_push($this->_languages, $lang_name);
160
            }
161
        }
162
    }
163
164
    /**
165
     * render the page
166
     *
167
     * @return void
168
     */
169
    public function run()
170
    {
171
        $this->_checkTemplateLanguage();
172
173
        $tpl = new Template("/templates/html/index_".$this->_indexname.".html");
174
175
        $tpl->set("template", $this->_template);
176
        $tpl->set("templates", $this->_templates);
177
        $tpl->set("bootstraptemplate", $this->_bootstrap_template);
178
        $tpl->set("bootstraptemplates", $this->_bootstrap_templates);
179
        $tpl->set("picktemplate", $this->_pick_template);
180
        $tpl->set("language", $this->_language);
181
        $tpl->set("languages", $this->_languages);
182
        $tpl->set("picklanguage", $this->_pick_language);
183
        $tpl->set("showCPUListExpanded", defined('PSI_SHOW_CPULIST_EXPANDED') ? (PSI_SHOW_CPULIST_EXPANDED ? 'true' : 'false') : 'true');
184
        $tpl->set("showCPUInfoExpanded", defined('PSI_SHOW_CPUINFO_EXPANDED') ? (PSI_SHOW_CPUINFO_EXPANDED ? 'true' : 'false') : 'false');
185
        $tpl->set("showNetworkInfosExpanded", defined('PSI_SHOW_NETWORK_INFOS_EXPANDED') ? (PSI_SHOW_NETWORK_INFOS_EXPANDED ? 'true' : 'false') : 'false');
186
        $tpl->set("showMemoryInfosExpanded", defined('PSI_SHOW_MEMORY_INFOS_EXPANDED') ? (PSI_SHOW_MEMORY_INFOS_EXPANDED ? 'true' : 'false') : 'false');
187
188
        echo $tpl->fetch();
189
    }
190
}
191