Issues (312)

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.

src/CTable/CTable.php (1 issue)

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
namespace donami\CTable;
3
4
/**
5
 * Module for creating HTML Tables
6
 */
7
class CTable implements \Anax\DI\IInjectionAware
8
{
9
    use \Anax\DI\TInjectable;
10
    private $data = array();
11
    private $html = '';
0 ignored issues
show
The property $html is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
12
    private $headings = '';
13
14
    private $tags = array(
15
      'table_start' => '<table>',
16
      'table_end' => '</table>',
17
      'tr_start' => '<tr>',
18
      'tr_end' => '</tr>',
19
      'td_start' => '<td>',
20
      'td_end' => '</td>',
21
      'th_start' => '<th>',
22
      'th_end' => '</th>'
23
    );
24
25
    /**
26
     * Set up custom tags for designing the table
27
     * @param  array  $data Array containing the tags to define
28
     * @return void
29
     */
30 1
    public function defineTags($data = array()) {
31 1
      foreach ($data as $key => $value) {
32 1
        $this->tags[$key] = $value;
33 1
      }
34 1
    }
35
36
    /**
37
     * Define the headings for the table
38
     * @param  array  $data Array containing the headings
39
     * @return void
40
     */
41 1
    public function defineHeadings($data = array()) {
42 1
      $html = $this->tags['tr_start'];
43 1
      foreach ($data as $value) {
44 1
        $html .= $this->tags['th_start'];
45 1
        $html .= $value;
46 1
        $html .= $this->tags['th_end'];
47 1
      }
48 1
      $html .= $this->tags['tr_end'];
49 1
      $this->headings = $html;
50 1
    }
51
52
    /**
53
     * Adds a row to the table one by one
54
     * @param  array  $data Array containing one key for each field
55
     * @return void
56
     */
57 1
    public function createRow($data = array()) {
58 1
      $this->data[] = $data;
59 1
    }
60
61
    /**
62
     * Generate the HTML for the table. Either using $this->data or data as argument
63
     * @param  array  $data Optional array to be used
64
     *         if no data has been set before through "create_row"
65
     * @return string The HTML to be returned
66
     */
67 6
    public function generate($data = array()) {
68 6
      $data = !empty($data)? $data : $this->data;
69
70 6
      $html = $this->tags['table_start'];
71
72 6
      $html .= $this->headings;
73
74 6
      foreach ($data as $key => $value) {
75 5
        $html .= $this->tags['tr_start'];;
76 5
        foreach ($value as $td) {
77 5
          $html .= $this->tags['td_start'];
78 5
          $html .= $td;
79 5
          $html .= $this->tags['td_end'];
80 5
        }
81 5
        $html .= $this->tags['tr_end'];
82 6
      }
83
84 6
      $html .= $this->tags['table_end'];
85
86 6
      return $html;
87
    }
88
}
89