Issues (39)

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/HTMLTable/TableController.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
namespace Jovis\HTMLTable;
4
 
5
/**
6
 * A controller for creating a html table from a movie model.
7
 *
8
 */
9
class TableController implements \Anax\DI\IInjectionAware
10
{
11
    use \Anax\DI\TInjectable;
12
    
13
    private $model;
14
      
15
   /**
16
   * Lists all instances of the model, (databasetable) except for noListing.
17
   *
18
   * @param $noListing params not to be listed
19
   * @param $model model object to list (create an html table from) 
20
   *
21
   * @return void
22
   */
23
  public function listAction($noListing = NULL, $model)
24
  {
25
26
      $this->model = $model;
27
      $this->model->setDI($this->di);
28
   
29
      $all = $this->model->findAll();
30
      
31
      $aContent = array();
32
      
33
      //gör om arrayen av objekt till en array av arrayer
34 View Code Duplication
      foreach ($all as $key1=>$value) {
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...
35
        foreach ($value as $key2=>$v){
36
          if (!in_array($key2, $noListing)) { //$noListing, parametrar som inte ska vara med
37
              $aContent[$key1][$key2] = $v;
38
          }
39
        }
40
      }
41
     
42
      
43
      $aHeading = [];
44
      //hittar objektens parametrar/tabellens kolumnnamn och skapar
45
      //en ny array av rubriker
46 View Code Duplication
      foreach ($all as $key1=>$value) {
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...
47
        foreach ($value as $key2=>$v){
48
          if (!in_array($key2, $noListing)) { //$noListing, parametrar som inte ska vara med
49
              $aHeading[] = $key2;
50
          }
51
        }
52
        break;  
53
      }
54
      
55
      $chtml = new \Jovis\HTMLTable\CHTMLTable($aHeading, $aContent);
56
      
57
      $htmltable = $chtml->getTable();
58
      $source = $this->model->getSource();
59
      
60
   
61
      $this->theme->setTitle("Visa alla användare");
0 ignored issues
show
The property theme does not exist on object<Jovis\HTMLTable\TableController>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
62
      $this->views->add('table/list-all', [
0 ignored issues
show
The property views does not exist on object<Jovis\HTMLTable\TableController>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
63
          'title' => $source,
64
          'htmltable' => $htmltable,
65
      ]);
66
  }
67
  
68
   public function initAction($model){ //används för att befolka databasen, bara för att testa
69
    $model->setDI($this->di);
70
    $model->init();
71
  }
72
}
73