Issues (982)

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.

lib/CustomColumn.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
/**
3
 * COPS (Calibre OPDS PHP Server) class file
4
 *
5
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6
 * @author     Sébastien Lucas <[email protected]>
7
 */
8
9
/**
10
 * A CustomColumn with an value
11
 */
12
class CustomColumn extends Base
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
13
{
14
    /* @var string|integer the ID of the value */
15
    public $valueID;
16
    /* @var string the (string) representation of the value */
17
    public $value;
18
    /* @var CustomColumnType the custom column that contains the value */
19
    public $customColumnType;
20
    /* @var string the value encoded for HTML displaying */
21
    public $htmlvalue;
22
23
    /**
24
     * CustomColumn constructor.
25
     *
26
     * @param integer $pid id of the chosen value
27
     * @param string $pvalue string representation of the value
28
     * @param CustomColumnType $pcustomColumnType the CustomColumn this value lives in
29
     */
30 7
    public function __construct($pid, $pvalue, $pcustomColumnType)
31
    {
32 7
        $this->valueID = $pid;
33 7
        $this->value = $pvalue;
34 7
        $this->customColumnType = $pcustomColumnType;
35 7
        $this->htmlvalue = $this->customColumnType->encodeHTMLValue($this->value);
36 7
    }
37
38
    /**
39
     * Get the URI to show all books with this value
40
     *
41
     * @return string
42
     */
43
    public function getUri()
44
    {
45
        return $this->customColumnType->getUri($this->valueID);
46
    }
47
48
    /**
49
     * Get the EntryID to show all books with this value
50
     *
51
     * @return string
52
     */
53 4
    public function getEntryId()
54
    {
55 4
        return $this->customColumnType->getEntryId($this->valueID);
56
    }
57
58
    /**
59
     * Get the query to find all books with this value
60
     * the returning array has two values:
61
     *  - first the query (string)
62
     *  - second an array of all PreparedStatement parameters
63
     *
64
     * @return array
65
     */
66 6
    public function getQuery()
67
    {
68 6
        return $this->customColumnType->getQuery($this->valueID);
69
    }
70
71
    /**
72
     * Return the value of this column as an HTML snippet
73
     *
74
     * @return string
75
     */
76
    public function getHTMLEncodedValue()
77
    {
78
        return $this->htmlvalue;
79
    }
80
81
    /**
82
     * Create an CustomColumn by CustomColumnID and ValueID
83
     *
84
     * @param integer $customId the id of the customColumn
85
     * @param integer $id the id of the chosen value
86
     * @return CustomColumn|null
87
     */
88 4
    public static function createCustom($customId, $id)
89
    {
90 4
        $columnType = CustomColumnType::createByCustomID($customId);
91
92 4
        return $columnType->getCustom($id);
93
    }
94
95
    /**
96
     * Return this object as an array
97
     *
98
     * @return array
99
     */
100 1
    public function toArray()
101
    {
102
        return array(
103 1
            'valueID'          => $this->valueID,
104 1
            'value'            => $this->value,
105 1
            'customColumnType' => (array)$this->customColumnType,
106 1
            'htmlvalue'        => $this->htmlvalue,
107 1
        );
108
    }
109
}
110