Issues (1844)

Security Analysis    not enabled

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

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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.

vendor/amenadiel/jpgraph/src/graph/CCBPGraph.php (1 issue)

1
<?php
2
3
/**
4
 * JPGraph v4.0.3
5
 */
6
7
namespace Amenadiel\JpGraph\Graph;
8
9
use Amenadiel\JpGraph\Plot;
10
use Amenadiel\JpGraph\Text;
11
use Amenadiel\JpGraph\Util;
12
13
/**
14
 * Class CCBPGraph
15
 * Utility class to create Critical Chain Buffer penetration charts.
16
 */
17
class CCBPGraph
18
{
19
    const TickStep   = 25;
20
    const YTitle     = '% Buffer used';
21
    const XTitle     = '% CC Completed';
22
    const NColorMaps = 2;
23
    private $graph;
24
    private $iWidth;
25
    private $iHeight;
26
    private $iPlots    = [];
27
    private $iXMin     = -50;
28
    private $iXMax     = 100;
29
    private $iYMin     = -50;
30
    private $iYMax     = 150;
31
    private $iColorInd = [
32
        [5, 75], /* Green */
33
        [25, 85], /* Yellow */
34
        [50, 100], ]; /* Red */
35
    private $iColorMap  = 0;
36
    private $iColorSpec = [
37
        ['darkgreen:1.0', 'yellow:1.4', 'red:0.8', 'darkred:0.85'],
38
        ['#c6e9af', '#ffeeaa', '#ffaaaa', '#de8787'], ];
39
    private $iMarginColor = ['[email protected]', '[email protected]'];
40
    private $iSubTitle    = '';
41
    private $iTitle       = 'CC Buffer penetration';
42
43
    /**
44
     * Construct a new instance of CCBPGraph.
45
     *
46
     * @param int $aWidth
47
     * @param int $aHeight
48
     *
49
     * @return CCBPGraph
50
     */
51
    public function __construct($aWidth, $aHeight)
52
    {
53
        $this->iWidth  = $aWidth;
54
        $this->iHeight = $aHeight;
55
    }
56
57
    /**
58
     * Set the title and subtitle for the graph.
59
     *
60
     * @param string $aTitle
61
     * @param string $aSubTitle
62
     */
63
    public function SetTitle($aTitle, $aSubTitle)
64
    {
65
        $this->iTitle    = $aTitle;
66
        $this->iSubTitle = $aSubTitle;
67
    }
68
69
    /**
70
     * Set the x-axis min and max values.
71
     *
72
     * @param int $aMin
73
     * @param int $aMax
74
     */
75
    public function SetXMinMax($aMin, $aMax)
76
    {
77
        $this->iXMin = floor($aMin / CCBPGraph::TickStep) * CCBPGraph::TickStep;
78
        $this->iXMax = ceil($aMax / CCBPGraph::TickStep) * CCBPGraph::TickStep;
79
    }
80
81
    /**
82
     * Specify what color map to use.
83
     *
84
     * @param int $aMap
85
     */
86
    public function SetColorMap($aMap)
87
    {
88
        $this->iColorMap = $aMap % CCBPGraph::NColorMaps;
89
    }
90
91
    /**
92
     * Set the y-axis min and max values.
93
     *
94
     * @param int $aMin
95
     * @param int $aMax
96
     */
97
    public function SetYMinMax($aMin, $aMax)
98
    {
99
        $this->iYMin = floor($aMin / CCBPGraph::TickStep) * CCBPGraph::TickStep;
100
        $this->iYMax = ceil($aMax / CCBPGraph::TickStep) * CCBPGraph::TickStep;
101
    }
102
103
    /**
104
     * Set the specification of the color backgrounds and also the
105
     * optional exact colors to be used.
106
     *
107
     * @param mixed $aSpec   An array of 3 1x2 arrays. Each array specify the
108
     *                       color indication value at x=0 and x=max x in order to determine the slope
109
     * @param mixed $aColors An array with four elements specifying the colors
110
     *                       of each color indicator
111
     */
112
    public function SetColorIndication(array $aSpec, array $aColors = null)
113
    {
114
        if (safe_count($aSpec) !== 3) {
115
            Util\JpGraphError::Raise('Specification of scale values for background indicators must be an array with three elements.');
116
        }
117
        $this->iColorInd = $aSpec;
118
        if ($aColors !== null) {
119
            if (is_array($aColors) && safe_count($aColors) == 4) {
120
                $this->iColorSpec = $aColors;
121
            } else {
122
                Util\JpGraphError::Raise('Color specification for background indication must have four colors.');
123
            }
124
        }
125
    }
126
127
    /**
128
     * Construct the graph.
129
     */
130
    private function Init()
131
    {
132
        // Setup limits for color indications
133
        $lowx   = $this->iXMin;
134
        $highx  = $this->iXMax;
135
        $lowy   = $this->iYMin;
136
        $highy  = $this->iYMax;
137
        $width  = $this->iWidth;
138
        $height = $this->iHeight;
139
140
        // Margins
141
        $lm = 50;
142
        $rm = 40;
143
        $tm = 60;
144
        $bm = 40;
145
146
        if ($width <= 300 || $height <= 250) {
147
            $labelsize = 8;
148
            $lm        = 25;
149
            $rm        = 25;
150
            $tm        = 45;
151
            $bm        = 25;
152
        } elseif ($width <= 450 || $height <= 300) {
153
            $labelsize = 8;
154
            $lm        = 30;
155
            $rm        = 30;
156
            $tm        = 50;
157
            $bm        = 30;
158
        } elseif ($width <= 600 || $height <= 400) {
159
            $labelsize = 9;
160
        } else {
161
            $labelsize = 11;
162
        }
163
164
        if ($this->iSubTitle == '') {
165
            $tm -= $labelsize + 4;
166
        }
167
168
        $graph = new Graph($width, $height);
169
        $graph->clearTheme();
170
        $graph->SetScale('intint', $lowy, $highy, $lowx, $highx);
171
        $graph->SetMargin($lm, $rm, $tm, $bm);
172
        $graph->SetMarginColor($this->iMarginColor[$this->iColorMap]);
173
        $graph->SetClipping();
174
175
        $graph->title->Set($this->iTitle);
176
        $graph->subtitle->Set($this->iSubTitle);
177
178
        $graph->title->SetFont(FF_ARIAL, FS_BOLD, $labelsize + 4);
179
        $graph->subtitle->SetFont(FF_ARIAL, FS_BOLD, $labelsize + 1);
180
181
        $graph->SetBox(true, '[email protected]');
182
183
        $graph->xaxis->SetFont(FF_ARIAL, FS_BOLD, $labelsize);
184
        $graph->yaxis->SetFont(FF_ARIAL, FS_BOLD, $labelsize);
185
186
        $graph->xaxis->scale->ticks->Set(CCBPGraph::TickStep, CCBPGraph::TickStep);
187
        $graph->yaxis->scale->ticks->Set(CCBPGraph::TickStep, CCBPGraph::TickStep);
188
189
        $graph->xaxis->HideZeroLabel();
190
        $graph->yaxis->HideZeroLabel();
191
192
        $graph->xaxis->SetLabelFormatString('%d%%');
193
        $graph->yaxis->SetLabelFormatString('%d%%');
194
195
        // For the x-axis we adjust the color so labels on the left of the Y-axis are in black
196
        $n1 = floor(abs($this->iXMin / 25)) + 1;
197
        $n2 = floor($this->iXMax / 25);
198
        if ($this->iColorMap == 0) {
199
            $xlcolors = [];
200
            for ($i = 0; $i < $n1; ++$i) {
201
                $xlcolors[$i] = 'black';
202
            }
203
            for ($i = 0; $i < $n2; ++$i) {
204
                $xlcolors[$n1 + $i] = 'lightgray:1.5';
205
            }
206
            $graph->xaxis->SetColor('gray', $xlcolors);
207
            $graph->yaxis->SetColor('gray', 'lightgray:1.5');
208
        } else {
209
            $graph->xaxis->SetColor('darkgray', 'darkgray:0.8');
210
            $graph->yaxis->SetColor('darkgray', 'darkgray:0.8');
211
        }
212
        $graph->SetGridDepth(DEPTH_FRONT);
213
        $graph->ygrid->SetColor('[email protected]');
214
        $graph->ygrid->SetLineStyle('dotted');
215
216
        $graph->ygrid->Show();
217
218
        $graph->xaxis->SetWeight(1);
219
        $graph->yaxis->SetWeight(1);
220
221
        $ytitle = new Text\Text(CCBPGraph::YTitle, floor($lm * .75), ($height - $tm - $bm) / 2 + $tm);
222
        #$ytitle->SetFont(FF_VERA,FS_BOLD,$labelsize+1);
223
        $ytitle->SetAlign('right', 'center');
224
        $ytitle->SetAngle(90);
225
        $graph->Add($ytitle);
226
227
        $xtitle = new Text\Text(CCBPGraph::XTitle, ($width - $lm - $rm) / 2 + $lm, $height - 10);
228
        #$xtitle->SetFont(FF_VERA,FS_BOLD,$labelsize);
229
        $xtitle->SetAlign('center', 'bottom');
230
        $graph->Add($xtitle);
231
232
        $df = 'D j:S M, Y';
233
        if ($width < 400) {
234
            $df = 'D j:S M';
235
        }
236
237
        $time = new Text\Text(date($df), $width - 10, $height - 10);
238
        $time->SetAlign('right', 'bottom');
239
        #$time->SetFont(FF_VERA,FS_NORMAL,$labelsize-1);
240
        $time->SetColor('darkgray');
241
        $graph->Add($time);
242
243
        // Use an accumulated fille line graph to create the colored bands
244
245
        $n = 3;
246
        for ($i = 0; $i < $n; ++$i) {
247
            $b           = $this->iColorInd[$i][0];
248
            $k           = ($this->iColorInd[$i][1] - $this->iColorInd[$i][0]) / $this->iXMax;
249
            $colarea[$i] = [[$lowx, $lowx * $k + $b], [$highx, $highx * $k + $b]];
250
        }
251
        $colarea[3] = [[$lowx, $highy], [$highx, $highy]];
252
253
        $cb = [];
254
        for ($i = 0; $i < 4; ++$i) {
255
            $cb[$i] = new Plot\LinePlot(
256
                [$colarea[$i][0][1], $colarea[$i][1][1]],
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $colarea does not seem to be defined for all execution paths leading up to this point.
Loading history...
257
                [$colarea[$i][0][0], $colarea[$i][1][0]]
258
            );
259
            $cb[$i]->SetFillColor($this->iColorSpec[$this->iColorMap][$i]);
260
            $cb[$i]->SetFillFromYMin();
261
        }
262
263
        $graph->Add(array_slice(array_reverse($cb), 0, 4));
264
        $this->graph = $graph;
265
    }
266
267
    /**
268
     * Add a line or scatter plot to the graph.
269
     *
270
     * @param mixed $aPlots
271
     */
272
    public function Add($aPlots)
273
    {
274
        if (is_array($aPlots)) {
275
            $this->iPlots = array_merge($this->iPlots, $aPlots);
276
        } else {
277
            $this->iPlots[] = $aPlots;
278
        }
279
    }
280
281
    /**
282
     * Stroke the graph back to the client or to a file.
283
     *
284
     * @param mixed $aFile
285
     */
286
    public function Stroke($aFile = '')
287
    {
288
        $this->Init();
289
        if (safe_count($this->iPlots) > 0) {
290
            $this->graph->Add($this->iPlots);
291
        }
292
        $this->graph->Stroke($aFile);
293
    }
294
}
295