Issues (556)

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.

csphere/core/template/cmd_parse.php (8 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
/**
4
 * Contains template string replace tools
5
 *
6
 * PHP Version 5
7
 *
8
 * @category  Core
9
 * @package   Template
10
 * @author    Hans-Joachim Piepereit <[email protected]>
11
 * @copyright 2013 cSphere Team
12
 * @license   http://opensource.org/licenses/bsd-license Simplified BSD License
13
 * @link      http://www.csphere.eu
14
 **/
15
16
namespace csphere\core\template;
17
18
/**
19
 * Contains template string replace tools
20
 *
21
 * @category  Core
22
 * @package   Template
23
 * @author    Hans-Joachim Piepereit <[email protected]>
24
 * @copyright 2013 cSphere Team
25
 * @license   http://opensource.org/licenses/bsd-license Simplified BSD License
26
 * @link      http://www.csphere.eu
27
 **/
28
29
abstract class CMD_Parse
30
{
31
    /**
32
     * Store view driver for boxes
33
     **/
34
    private static $_view = null;
35
36
    /**
37
     * Enhance problem details for unknown calls
38
     *
39
     * @param string $name      Method name
40
     * @param array  $arguments Method parameters
41
     *
42
     * @throws \Exception
43
     *
44
     * @return void
45
     **/
0 ignored issues
show
There must be no blank lines after the function comment
Loading history...
46
47
    public static function __callStatic($name, array $arguments)
48
    {
49
        unset($arguments);
50
51
        throw new \Exception('Command unknown: ' . $name);
52
    }
53
54
    /**
55
     * Include prepared boxes
56
     *
57
     * @param array $part Placeholder cmd and key, maybe even more
58
     * @param array $data Array with data to use in the template
59
     *
60
     * @return string
61
     **/
0 ignored issues
show
There must be no blank lines after the function comment
Loading history...
62
63
    public static function box(array $part, array $data)
64
    {
65
        // Get settings if not done yet
66
        if (self::$_view == '') {
67
68
            $loader      = \csphere\core\service\Locator::get();
69
            self::$_view = $loader->load('view');
70
        }
71
72
        // Set box params for this box
73
        \csphere\core\http\Input::setBox($part['params']);
74
75
        // Clear current box to not end in an infinite loop
76
        self::$_view->clear();
77
78
        \csphere\core\router\Sandbox::full($part['key']);
79
80
        $box = self::$_view->box();
81
82
        // Add box name as div if not declined
83
        if (!isset($data['nodiv'])) {
84
85
            //$div = '<div class="' . $part['name'] . '">';
86
            //$box = $div . $box . '</div>';
87
        }
88
89
        return $box;
90
    }
91
92
    /**
93
     * Datetime replaces extendable by zone
94
     *
95
     * @param array $part Placeholder cmd and key, maybe even more
96
     * @param array $data Array with data to use in the template
97
     *
98
     * @return string
99
     **/
0 ignored issues
show
There must be no blank lines after the function comment
Loading history...
100
101
    public static function datetime(array $part, array $data)
102
    {
103
        $part = \csphere\core\template\Parse::sub($part, $data);
104
105
        // Data must be an unix timestamp of type integer
106
        $unix = (int)$part['data'];
107
108
        $result=\csphere\core\date\Unixtime::string($unix, true, true);
109
110
        return $result;
111
    }
112
113
    /**
114
     * Date replaces extendable by zone
115
     *
116
     * @param array $part Placeholder cmd and key, maybe even more
117
     * @param array $data Array with data to use in the template
118
     *
119
     * @return string
120
     **/
0 ignored issues
show
There must be no blank lines after the function comment
Loading history...
121
122
    public static function date(array $part, array $data)
123
    {
124
        $part = \csphere\core\template\Parse::sub($part, $data);
125
126
        // Data must be an unix timestamp of type integer
127
        $unix = (int)$part['data'];
128
129
        $result=\csphere\core\date\Unixtime::string($unix, true, false);
130
131
        return $result;
132
    }
133
134
    /**
135
     * Time replaces extendable by zone
136
     *
137
     * @param array $part Placeholder cmd and key, maybe even more
138
     * @param array $data Array with data to use in the template
139
     *
140
     * @return string
141
     **/
0 ignored issues
show
There must be no blank lines after the function comment
Loading history...
142
143
    public static function time(array $part, array $data)
144
    {
145
        $part = \csphere\core\template\Parse::sub($part, $data);
146
147
        // Data must be an unix timestamp of type integer
148
        $unix = (int)$part['data'];
149
150
        $result=\csphere\core\date\Unixtime::string($unix, false, true);
151
152
        return $result;
153
    }
154
155
    /**
156
     * Debug info for template data
157
     *
158
     * @param array $part Placeholder cmd and key, maybe even more
159
     * @param array $data Array with data to use in the template
160
     *
161
     * @return string
162
     **/
0 ignored issues
show
There must be no blank lines after the function comment
Loading history...
163
164
    public static function debug(array $part, array $data)
165
    {
166
        // Get target array data
167
        $key = explode('.', $part['key']);
168
169
        foreach ($key AS $target) {
170
171
            $data = isset($data[$target]) ? $data[$target] : null;
172
        }
173
174
        // Generate output and format it
175
        if ($data != null) {
176
            ob_start();
177
            var_dump($data);
0 ignored issues
show
Security Debugging Code introduced by
var_dump($data); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
178
            $content = ob_get_clean();
179
            $content = nl2br($content, false);
180
181
        } else {
182
183
            $content = 'Error: No data found';
184
        }
185
186
        $info   = 'Debug info for "' . $part['key'] . '":<br>' . "\n";
187
        $result = $info . '<pre>' . $content . '</pre>';
188
189
        return $result;
190
    }
191
192
    /**
193
     * Placeholder right before form ends
194
     *
195
     * @param array $part Placeholder cmd and key, maybe even more
196
     * @param array $data Array with data to use in the template
197
     *
198
     * @return string
199
     **/
0 ignored issues
show
There must be no blank lines after the function comment
Loading history...
200
201
    public static function form(array $part, array $data)
202
    {
203
        unset($part, $data);
204
205
        // Add hidden input to catch form submit
206
        $result = '<input type="hidden" name="csphere_form" value="1">';
207
208
        return $result;
209
    }
210
}
211