Issues (992)

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.

class/pcltrace.lib.php (2 issues)

1
<?php
2
3
namespace XoopsModules\Extgallery;
4
5
// --------------------------------------------------------------------------------
6
// PhpConcept Library (PCL) Trace 1.0
7
// --------------------------------------------------------------------------------
8
// License GNU/GPL - Vincent Blavet - Janvier 2001
9
// http://www.phpconcept.net & http://phpconcept.free.fr
10
// --------------------------------------------------------------------------------
11
// Français :
12
//   La description de l'usage de la librairie PCL Trace 1.0 n'est pas encore
13
//   disponible. Celle-ci n'est pour le moment distribuée qu'avec l'application
14
//   et la librairie PhpZip.
15
//   Une version indépendante sera bientot disponible sur http://www.phpconcept.net
16
//
17
// English :
18
//   The PCL Trace 1.0 library description is not available yet. This library is
19
//   released only with PhpZip application and library.
20
//   An independant release will be soon available on http://www.phpconcept.net
21
//
22
// --------------------------------------------------------------------------------
23
//
24
//   * Avertissement :
25
//
26
//   Cette librairie a été créée de façon non professionnelle.
27
//   Son usage est au risque et péril de celui qui l'utilise, en aucun cas l'auteur
28
//   de ce code ne pourra être tenu pour responsable des éventuels dégats qu'il pourrait
29
//   engendrer.
30
//   Il est entendu cependant que l'auteur a réalisé ce code par plaisir et n'y a
31
//   caché aucun virus, ni malveillance.
32
//   Cette libairie est distribuée sous la license GNU/GPL (https://www.gnu.org)
33
//
34
//   * Auteur :
35
//
36
//   Ce code a Ă©tĂ© Ă©crit par Vincent Blavet ([email protected]) sur son temps
37
//   de loisir.
38
//
39
// --------------------------------------------------------------------------------
40
41
// ----- Look for double include
42
if (!\defined('PCLTRACE_LIB')) {
43
    \define('PCLTRACE_LIB', 1);
44
45
    // ----- Version
46
    $g_pcl_trace_version = '1.0';
47
48
    // ----- Internal variables
49
    // These values must be change by PclTrace library functions
50
    $g_pcl_trace_mode     = 'memory';
51
    $g_pcl_trace_filename = 'trace.txt';
52
    $g_pcl_trace_name     = [];
53
    $g_pcl_trace_index    = 0;
54
    $g_pcl_trace_level    = 0;
55
    //$g_pcl_trace_entries = [];
56
57
    // --------------------------------------------------------------------------------
58
    // Function : TrOn($p_level, $p_mode, $p_filename)
59
    // Description :
60
    // Parameters :
61
    //   $p_level : Trace level
62
    //   $p_mode : Mode of trace displaying :
63
    //             'normal' : messages are displayed at function call
64
    //             'memory' : messages are memorized in a table and can be display by
65
    //                        TrDisplay() function. (default)
66
    //             'log'    : messages are writed in the file $p_filename
67
    // --------------------------------------------------------------------------------
68
    /**
69
     * @param int    $p_level
70
     * @param string $p_mode
71
     * @param string $p_filename
72
     */
73
    function TrOn($p_level = 1, $p_mode = 'memory', $p_filename = 'trace.txt')
74
    {
75
        global $g_pcl_trace_level;
76
        global $g_pcl_trace_mode;
77
        global $g_pcl_trace_filename;
78
        global $g_pcl_trace_name;
79
        global $g_pcl_trace_index;
80
        global $g_pcl_trace_entries;
81
82
        // ----- Enable trace mode
83
        $g_pcl_trace_level = $p_level;
84
85
        // ----- Memorize mode and filename
86
        switch ($p_mode) {
87
            case 'normal':
88
            case 'memory':
89
            case 'log':
90
                $g_pcl_trace_mode = $p_mode;
91
                break;
92
            default:
93
                $g_pcl_trace_mode = 'logged';
94
        }
95
96
        // ----- Memorize filename
97
        $g_pcl_trace_filename = $p_filename;
98
    }
99
100
    // --------------------------------------------------------------------------------
101
102
    // --------------------------------------------------------------------------------
103
    // Function : IsTrOn()
104
    // Description :
105
    // Return value :
106
    //   The trace level (0 for disable).
107
    // --------------------------------------------------------------------------------
108
    /**
109
     * @return int
110
     */
111
    function IsTrOn()
112
    {
113
        global $g_pcl_trace_level;
114
115
        return $g_pcl_trace_level;
116
    }
117
118
    // --------------------------------------------------------------------------------
119
120
    // --------------------------------------------------------------------------------
121
    // Function : TrOff()
122
    // Description :
123
    // Parameters :
124
    // --------------------------------------------------------------------------------
125
    function TrOff()
126
    {
127
        global $g_pcl_trace_level;
128
        global $g_pcl_trace_mode;
129
        global $g_pcl_trace_filename;
130
        global $g_pcl_trace_name;
131
        global $g_pcl_trace_index;
132
133
        // ----- Clean
134
        $g_pcl_trace_mode = 'memory';
135
        unset($g_pcl_trace_entries, $g_pcl_trace_name, $g_pcl_trace_index);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $g_pcl_trace_entries does not exist. Did you maybe mean $g_pcl_trace_level?
Loading history...
136
137
        // ----- Switch off trace
138
        $g_pcl_trace_level = 0;
139
    }
140
141
    // --------------------------------------------------------------------------------
142
143
    // --------------------------------------------------------------------------------
144
    // Function : TrFctStart()
145
    // Description :
146
    //   Just a trace function for debbugging purpose before I use a better tool !!!!
147
    //   Start and stop of this function is by $g_pcl_trace_level global variable.
148
    // Parameters :
149
    //   $p_level : Level of trace required.
150
    // --------------------------------------------------------------------------------
151
    /**
152
     * @param        $p_file
153
     * @param        $p_line
154
     * @param        $p_name
155
     * @param string $p_param
156
     * @param string $p_message
157
     */
158
    function TrFctStart($p_file, $p_line, $p_name, $p_param = '', $p_message = '')
159
    {
160
        global $g_pcl_trace_level;
161
        global $g_pcl_trace_mode;
162
        global $g_pcl_trace_filename;
163
        global $g_pcl_trace_name;
164
        global $g_pcl_trace_index;
165
        global $g_pcl_trace_entries;
166
167
        // ----- Look for disabled trace
168
        if ($g_pcl_trace_level < 1) {
169
            return;
170
        }
171
172
        // ----- Add the function name in the list
173
        if (!isset($g_pcl_trace_name)) {
174
            $g_pcl_trace_name = $p_name;
175
        } else {
176
            $g_pcl_trace_name .= ',' . $p_name;
177
        }
178
179
        // ----- Update the function entry
180
        $i                                  = \count($g_pcl_trace_entries);
181
        $g_pcl_trace_entries[$i]['name']    = $p_name;
182
        $g_pcl_trace_entries[$i]['param']   = $p_param;
183
        $g_pcl_trace_entries[$i]['message'] = '';
184
        $g_pcl_trace_entries[$i]['file']    = $p_file;
185
        $g_pcl_trace_entries[$i]['line']    = $p_line;
186
        $g_pcl_trace_entries[$i]['index']   = $g_pcl_trace_index;
187
        $g_pcl_trace_entries[$i]['type']    = '1'; // means start of function
188
189
        // ----- Update the message entry
190
        if ('' != $p_message) {
191
            $i                                  = \count($g_pcl_trace_entries);
192
            $g_pcl_trace_entries[$i]['name']    = '';
193
            $g_pcl_trace_entries[$i]['param']   = '';
194
            $g_pcl_trace_entries[$i]['message'] = $p_message;
195
            $g_pcl_trace_entries[$i]['file']    = $p_file;
196
            $g_pcl_trace_entries[$i]['line']    = $p_line;
197
            $g_pcl_trace_entries[$i]['index']   = $g_pcl_trace_index;
198
            $g_pcl_trace_entries[$i]['type']    = '3'; // means message
199
        }
200
201
        // ----- Action depending on mode
202
        PclTraceAction($g_pcl_trace_entries[$i]);
203
204
        // ----- Increment the index
205
        ++$g_pcl_trace_index;
206
    }
207
208
    // --------------------------------------------------------------------------------
209
210
    // --------------------------------------------------------------------------------
211
    // Function : TrFctEnd()
212
    // Description :
213
    //   Just a trace function for debbugging purpose before I use a better tool !!!!
214
    //   Start and stop of this function is by $g_pcl_trace_level global variable.
215
    // Parameters :
216
    //   $p_level : Level of trace required.
217
    // --------------------------------------------------------------------------------
218
    /**
219
     * @param        $p_file
220
     * @param        $p_line
221
     * @param int    $p_return
222
     * @param string $p_message
223
     */
224
    function TrFctEnd($p_file, $p_line, $p_return = 1, $p_message = '')
225
    {
226
        global $g_pcl_trace_level;
227
        global $g_pcl_trace_mode;
228
        global $g_pcl_trace_filename;
229
        global $g_pcl_trace_name;
230
        global $g_pcl_trace_index;
231
        global $g_pcl_trace_entries;
232
233
        // ----- Look for disabled trace
234
        if ($g_pcl_trace_level < 1) {
235
            return;
236
        }
237
238
        // ----- Extract the function name in the list
239
        // ----- Remove the function name in the list
240
        if (!($v_name = mb_strrchr($g_pcl_trace_name, ','))) {
241
            $v_name           = $g_pcl_trace_name;
242
            $g_pcl_trace_name = '';
243
        } else {
244
            $g_pcl_trace_name = mb_substr($g_pcl_trace_name, 0, -mb_strlen($v_name));
245
            $v_name           = mb_substr($v_name, -mb_strlen($v_name) + 1);
246
        }
247
248
        // ----- Decrement the index
249
        $g_pcl_trace_index--;
250
251
        // ----- Update the message entry
252
        if ('' != $p_message) {
253
            $i                                  = \count($g_pcl_trace_entries);
254
            $g_pcl_trace_entries[$i]['name']    = '';
255
            $g_pcl_trace_entries[$i]['param']   = '';
256
            $g_pcl_trace_entries[$i]['message'] = $p_message;
257
            $g_pcl_trace_entries[$i]['file']    = $p_file;
258
            $g_pcl_trace_entries[$i]['line']    = $p_line;
259
            $g_pcl_trace_entries[$i]['index']   = $g_pcl_trace_index;
260
            $g_pcl_trace_entries[$i]['type']    = '3'; // means message
261
        }
262
263
        // ----- Update the function entry
264
        $i                                  = \count($g_pcl_trace_entries);
265
        $g_pcl_trace_entries[$i]['name']    = $v_name;
266
        $g_pcl_trace_entries[$i]['param']   = $p_return;
267
        $g_pcl_trace_entries[$i]['message'] = '';
268
        $g_pcl_trace_entries[$i]['file']    = $p_file;
269
        $g_pcl_trace_entries[$i]['line']    = $p_line;
270
        $g_pcl_trace_entries[$i]['index']   = $g_pcl_trace_index;
271
        $g_pcl_trace_entries[$i]['type']    = '2'; // means end of function
272
273
        // ----- Action depending on mode
274
        PclTraceAction($g_pcl_trace_entries[$i]);
275
    }
276
277
    // --------------------------------------------------------------------------------
278
279
    // --------------------------------------------------------------------------------
280
    // Function : TrFctMessage()
281
    // Description :
282
    // Parameters :
283
    // --------------------------------------------------------------------------------
284
    /**
285
     * @param        $p_file
286
     * @param        $p_line
287
     * @param        $p_level
288
     * @param string $p_message
289
     */
290
    function TrFctMessage($p_file, $p_line, $p_level, $p_message = '')
291
    {
292
        global $g_pcl_trace_level;
293
        global $g_pcl_trace_mode;
294
        global $g_pcl_trace_filename;
295
        global $g_pcl_trace_name;
296
        global $g_pcl_trace_index;
297
        global $g_pcl_trace_entries;
298
299
        // ----- Look for disabled trace
300
        if ($g_pcl_trace_level < $p_level) {
301
            return;
302
        }
303
304
        // ----- Update the entry
305
        $i                                  = \count($g_pcl_trace_entries);
306
        $g_pcl_trace_entries[$i]['name']    = '';
307
        $g_pcl_trace_entries[$i]['param']   = '';
308
        $g_pcl_trace_entries[$i]['message'] = $p_message;
309
        $g_pcl_trace_entries[$i]['file']    = $p_file;
310
        $g_pcl_trace_entries[$i]['line']    = $p_line;
311
        $g_pcl_trace_entries[$i]['index']   = $g_pcl_trace_index;
312
        $g_pcl_trace_entries[$i]['type']    = '3'; // means message of function
313
314
        // ----- Action depending on mode
315
        PclTraceAction($g_pcl_trace_entries[$i]);
316
    }
317
318
    // --------------------------------------------------------------------------------
319
320
    // --------------------------------------------------------------------------------
321
    // Function : TrMessage()
322
    // Description :
323
    // Parameters :
324
    // --------------------------------------------------------------------------------
325
    /**
326
     * @param        $p_file
327
     * @param        $p_line
328
     * @param        $p_level
329
     * @param string $p_message
330
     */
331
    function TrMessage($p_file, $p_line, $p_level, $p_message = '')
332
    {
333
        global $g_pcl_trace_level;
334
        global $g_pcl_trace_mode;
335
        global $g_pcl_trace_filename;
336
        global $g_pcl_trace_name;
337
        global $g_pcl_trace_index;
338
        global $g_pcl_trace_entries;
339
340
        // ----- Look for disabled trace
341
        if ($g_pcl_trace_level < $p_level) {
342
            return;
343
        }
344
345
        // ----- Update the entry
346
        $i                                  = \count($g_pcl_trace_entries);
347
        $g_pcl_trace_entries[$i]['name']    = '';
348
        $g_pcl_trace_entries[$i]['param']   = '';
349
        $g_pcl_trace_entries[$i]['message'] = $p_message;
350
        $g_pcl_trace_entries[$i]['file']    = $p_file;
351
        $g_pcl_trace_entries[$i]['line']    = $p_line;
352
        $g_pcl_trace_entries[$i]['index']   = $g_pcl_trace_index;
353
        $g_pcl_trace_entries[$i]['type']    = '4'; // means simple message
354
355
        // ----- Action depending on mode
356
        PclTraceAction($g_pcl_trace_entries[$i]);
357
    }
358
359
    // --------------------------------------------------------------------------------
360
361
    // --------------------------------------------------------------------------------
362
    // Function : TrDisplay()
363
    // Description :
364
    // Parameters :
365
    // --------------------------------------------------------------------------------
366
    function TrDisplay()
367
    {
368
        global $g_pcl_trace_level;
369
        global $g_pcl_trace_mode;
370
        global $g_pcl_trace_filename;
371
        global $g_pcl_trace_name;
372
        global $g_pcl_trace_index;
373
        global $g_pcl_trace_entries;
374
375
        // ----- Look for disabled trace
376
        if (($g_pcl_trace_level <= 0) || ('memory' !== $g_pcl_trace_mode)) {
377
            return;
378
        }
379
380
        $v_font = '"Verdana, Arial, Helvetica, sans-serif"';
381
382
        // ----- Trace Header
383
        echo '<table width=100% border=0 cellspacing=0 cellpadding=0>';
384
        echo '<tr bgcolor=#0000CC>';
385
        echo '<td bgcolor=#0000CC width=1>';
386
        echo '</td>';
387
        echo "<td><div align=center><span style='font-size: small; color: #FFFFFF; font-family: $v_font; '>Trace</span></div></td>";
388
        echo '</tr>';
389
        echo '<tr>';
390
        echo '<td bgcolor=#0000CC width=1>';
391
        echo '</td>';
392
        echo '<td>';
393
394
        // ----- Content header
395
        echo '<table width=100% border=0 cellspacing=0 cellpadding=0>';
396
397
        // ----- Display
398
        $v_again = 0;
0 ignored issues
show
The assignment to $v_again is dead and can be removed.
Loading history...
399
        for ($i = 0, $iMax = \count($g_pcl_trace_entries); $i < $iMax; ++$i) {
400
            // ---- Row header
401
            echo '<tr>';
402
            echo '<td><table width=100% border=0 cellspacing=0 cellpadding=0><tr>';
403
            $n = ($g_pcl_trace_entries[$i]['index'] + 1) * 10;
404
            echo '<td width=' . $n . '><table width=100% border=0 cellspacing=0 cellpadding=0><tr>';
405
406
            for ($j = 0; $j <= $g_pcl_trace_entries[$i]['index']; ++$j) {
407
                if ($j == $g_pcl_trace_entries[$i]['index']) {
408
                    if ((1 == $g_pcl_trace_entries[$i]['type']) || (2 == $g_pcl_trace_entries[$i]['type'])) {
409
                        echo "<td width=10><div align=center><span style='font-size: x-small; font-family: $v_font; '>+</span></div></td>";
410
                    }
411
                } else {
412
                    echo "<td width=10><div align=center><span style='font-size: x-small; font-family: $v_font; '>|</span></div></td>";
413
                }
414
            }
415
            //echo "<td>&nbsp</td>";
416
            echo '</tr></table></td>';
417
418
            echo '<td width=2></td>';
419
            switch ($g_pcl_trace_entries[$i]['type']) {
420
                case 1:
421
                    echo "<td><span style='font-size: x-small; font-family: $v_font; '>" . $g_pcl_trace_entries[$i]['name'] . '(' . $g_pcl_trace_entries[$i]['param'] . ')</span></td>';
422
                    break;
423
                case 2:
424
                    echo "<td><span style='font-size: x-small; font-family: $v_font; '>" . $g_pcl_trace_entries[$i]['name'] . '()=' . $g_pcl_trace_entries[$i]['param'] . '</span></td>';
425
                    break;
426
                case 3:
427
                case 4:
428
                    echo '<td><table width=100% border=0 cellspacing=0 cellpadding=0><td width=20></td><td>';
429
                    echo "<span style='font-size: x-small; font-family: $v_font; '>" . $g_pcl_trace_entries[$i]['message'] . '</span>';
430
                    echo '</td></table></td>';
431
                    break;
432
                default:
433
                    echo "<td><span style='font-size: x-small; font-family: $v_font; '>" . $g_pcl_trace_entries[$i]['name'] . '(' . $g_pcl_trace_entries[$i]['param'] . ')</span></td>';
434
            }
435
            echo '</tr></table></td>';
436
            echo '<td width=5></td>';
437
            echo "<td><span style='font-size: xx-small; font-family: $v_font; '>" . \basename($g_pcl_trace_entries[$i]['file']) . '</span></td>';
438
            echo '<td width=5></td>';
439
            echo "<td><span style='font-size: xx-small; font-family: $v_font; '>" . $g_pcl_trace_entries[$i]['line'] . '</span></td>';
440
            echo '</tr>';
441
        }
442
443
        // ----- Content footer
444
        echo '</table>';
445
446
        // ----- Trace footer
447
        echo '</td>';
448
        echo '<td bgcolor=#0000CC width=1>';
449
        echo '</td>';
450
        echo '</tr>';
451
        echo '<tr bgcolor=#0000CC>';
452
        echo '<td bgcolor=#0000CC width=1>';
453
        echo '</td>';
454
        echo "<td><span align=center><span style='color: #FFFFFF; font-family: $v_font; '>&nbsp</font></span></td>";
455
        echo '</tr>';
456
        echo '</table>';
457
    }
458
459
    // --------------------------------------------------------------------------------
460
461
    // --------------------------------------------------------------------------------
462
    // Function : PclTraceAction()
463
    // Description :
464
    // Parameters :
465
    // --------------------------------------------------------------------------------
466
    /**
467
     * @param $p_entry
468
     */
469
    function PclTraceAction($p_entry)
470
    {
471
        global $g_pcl_trace_level;
472
        global $g_pcl_trace_mode;
473
        global $g_pcl_trace_filename;
474
        global $g_pcl_trace_name;
475
        global $g_pcl_trace_index;
476
        global $g_pcl_trace_entries;
477
478
        if ('normal' === $g_pcl_trace_mode) {
479
            for ($i = 0; $i < $p_entry['index']; ++$i) {
480
                echo '---';
481
            }
482
            if (1 == $p_entry['type']) {
483
                echo '<b>' . $p_entry['name'] . '</b>(' . $p_entry['param'] . ') : ' . $p_entry['message'] . ' [' . $p_entry['file'] . ', ' . $p_entry['line'] . ']<br>';
484
            } elseif (2 == $p_entry['type']) {
485
                echo '<b>' . $p_entry['name'] . '</b>()=' . $p_entry['param'] . ' : ' . $p_entry['message'] . ' [' . $p_entry['file'] . ', ' . $p_entry['line'] . ']<br>';
486
            } else {
487
                echo $p_entry['message'] . ' [' . $p_entry['file'] . ', ' . $p_entry['line'] . ']<br>';
488
            }
489
        }
490
    }
491
492
    // --------------------------------------------------------------------------------
493
494
    // ----- End of double include look
495
}
496