GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (358)

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.

app/models/Pagination.php (2 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
/**
4
 * Pagination Class
5
 *
6
 * @license    http://opensource.org/licenses/MIT The MIT License (MIT)
7
 * @author     Omar El Gabry <[email protected]>
8
 */
9
10
class Pagination {
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...
11
12
    /**
13
     * @access public
14
     * @var integer Current Page
15
     */
16
    public $currentPage;
17
18
    /**
19
     * @access public
20
     * @var integer Number of items(newsfeed, posts, ..etc.) to be displayed per page
21
     */
22
    public $perPage;
23
24
    /**
25
     * @access public
26
     * @var integer Total count of items(newsfeed, posts, ..etc.)
27
     */
28
    public $totalCount;
29
30
    /**
31
     * This is the constructor for Pagination Object.
32
     *
33
     * @access  public
34
     * @param   integer  $currentPage
35
     * @param   integer  $totalCount
36
     * @param   integer  $perPage Number of items per page
37
     */
38
    public function __construct($currentPage = 1, $totalCount = 0, $perPage = 0){
39
        $this->currentPage = (empty($currentPage))? 1: (int)$currentPage;
40
        $this->totalCount = (empty($totalCount))? 0: (int)$totalCount;
41
        $this->perPage = (empty($perPage))? Config::get('PAGINATION_DEFAULT_LIMIT'): (int)$perPage;
0 ignored issues
show
Documentation Bug introduced by
It seems like empty($perPage) ? \Confi...IMIT') : (int) $perPage can also be of type string. However, the property $perPage is declared as type integer. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
42
    }
43
44
    /**
45
     * get pagination object by executing COUNT(*) query.
46
     *
47
     * @access public
48
     * @param  string  $table
49
     * @param  string  $options
50
     * @param  array   $values  array of data
51
     * @param  integer $pageNum
52
     * @param  integer $extraOffset check comment class
53
     * @return Pagination
54
     */
55
    public static function pagination($table, $options, $values, $pageNum, $extraOffset = 0){
56
57
        $database = Database::openConnection();
58
        $query  = "SELECT COUNT(*) AS count FROM {$table}  ";
59
        $query .= $options;
60
61
        $database->prepare($query);
62
        $database->execute($values);
63
        $totalCount = $database->fetchAssociative()["count"];
64
        $extraOffset = ((int)$extraOffset > $totalCount)? 0: (int)$extraOffset;
65
66
        return new Pagination((int)$pageNum, $totalCount - $extraOffset);
67
    }
68
69
    /**
70
     * Get the offset.
71
     *
72
     * @access public
73
     * @return integer
74
     */
75
    public function getOffset() {
76
        return ($this->currentPage - 1) * $this->perPage;
77
    }
78
79
    /**
80
     * Get number of total pages.
81
     *
82
     * @access public
83
     * @return integer
84
     */
85
    public function totalPages() {
86
        return ceil($this->totalCount/$this->perPage);
87
    }
88
89
    /**
90
     * Get the number of the previous page.
91
     *
92
     * @access public
93
     * @return integer  Number of previous page
94
     */
95
    public function previousPage() {
96
        return $this->currentPage - 1;
97
    }
98
99
    /**
100
     * Get the number of the next page.
101
     *
102
     * @access public
103
     * @return integer  Number of next page
104
     */
105
    public function nextPage() {
106
        return $this->currentPage + 1;
107
    }
108
109
    /**
110
     * checks if there is a previous page or not
111
     *
112
     * @access public
113
     * @return boolean
114
     */
115
    public function hasPreviousPage() {
116
        return $this->previousPage() >= 1 ? true : false;
117
    }
118
119
    /**
120
     * checks if there is a next page or not
121
     *
122
     * @access public
123
     * @return boolean
124
     */
125
    public function hasNextPage() {
126
        return $this->totalPages() >= $this->nextPage()? true : false;
127
    }
128
129
}
130