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 (1410)

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.

protected/models/seo/Link.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
 * @author Nikita Melnikov <[email protected]>, Vladimir Utenkov <[email protected]>
4
 * @link https://github.com/shogodev/argilla/
5
 * @copyright Copyright &copy; 2003-2014 Shogo
6
 * @license http://argilla.ru/LICENSE
7
 * @package frontend.models.seo
8
 *
9
 * Class Link Ссылка на ресурс по теме.
10
 *
11
 * @method static Link model(string $className = __CLASS__)
12
 * @method Link visible()
13
 *
14
 * @property integer $id
15
 * @property integer $section_id
16
 * @property string  $title
17
 * @property string  $content
18
 * @property string  $email
19
 * @property string  $region
20
 * @property string  $url
21
 * @property string  $date
22
 * @property integer $page
23
 * @property boolean $visible
24
 * @property integer $position
25
 *
26
 * @property LinkSection $section Секция, к которой принадлежит данная ссылка.
27
 */
28
class Link extends FActiveRecord
29
{
30
  const LINKS_PER_PAGE = 10;
31
32 21
  public function tableName()
33
  {
34 21
    return '{{seo_link}}';
35
  }
36
37
  public function rules()
38
  {
39
    return [
40
      ['title, url, section_id, email', 'required'],
41
      ['title, url, region', 'length', 'max' => 255, 'min' => 3],
42
      ['url', 'url'],
43
      ['email', 'email'],
44
      ['section_id', 'numerical', 'integerOnly' => true],
45
      ['title, url, content', 'filter', 'filter' => 'htmlspecialchars'],
46
    ];
47
  }
48
49
  public function attributeLabels()
50
  {
51
    return [
52
      'url' => 'URL сайта',
53
      'title' => 'Название сайта',
54
      'content' => 'Описание сайта',
55
      'section_id' => 'Категория',
56
      'email' => 'E-mail',
57
    ];
58
  }
59
60 1
  public function relations()
61
  {
62
    return [
63 1
      'section' => [self::BELONGS_TO, 'LinkSection', 'section_id'],
64 1
    ];
65
  }
66
67
  /**
68
   * Ссылки отсортированные по атрибуту 'position' по возрастанию.
69
   *
70
   * @return array
71
   */
72 16
  public function defaultScope()
73
  {
74
    return [
75 16
      'order' => 'IF(position, position, 999999999)',
76 16
    ];
77
  }
78
79 11
  public function scopes()
80
  {
81
    return [
82
      'visible' => [
83 11
        'condition' => 'visible = :visible',
84
        'params' => [
85 11
          ':visible' => '1',
86 11
        ],
87 11
      ],
88 11
    ];
89
  }
90
91
  /**
92
   * Ссылки на указанной странице.
93
   *
94
   * @param int $page Номер страницы, для которой нужно найти ссылки.
95
   *
96
   * @return Link
97
   */
98 7 View Code Duplication
  public function onPage($page)
0 ignored issues
show
This method seems to be duplicated in 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...
99
  {
100 7
    $this->getDbCriteria()->mergeWith([
101 7
      'condition' => 'page = :page',
102
      'params' => [
103 7
        ':page' => strval($page),
104 7
      ],
105 7
    ]);
106
107 7
    return $this;
108
  }
109
110
  /**
111
   * Ссылки в указанной секции.
112
   *
113
   * @param int $sectionId ID секции, для которой искать ссылки.
114
   *
115
   * @return Link
116
   */
117 7 View Code Duplication
  public function inSection($sectionId)
0 ignored issues
show
This method seems to be duplicated in 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...
118
  {
119 7
    $this->getDbCriteria()->mergeWith([
120 7
      'condition' => 'section_id = :sectionId',
121
      'params' => [
122 7
        ':sectionId' => strval($sectionId),
123 7
      ],
124 7
    ]);
125
126 7
    return $this;
127
  }
128
129
  /**
130
   * Ссылки на всех страницах перед указанной.
131
   *
132
   * @param int $page Страница до которой искать ссылки.
133
   *
134
   * @return Link
135
   */
136 3
  public function linksOnPagesBefore($page)
137
  {
138 3
    $this->getDbCriteria()->mergeWith([
139 3
      'condition' => 'page < :page',
140
      'params' => [
141
        ':page' => $page
142 3
      ]
143 3
    ]);
144
145 3
    return $this;
146
  }
147
148 2
  public function beforeSave()
149
  {
150 2
    if( parent::beforeSave() )
151 2
    {
152 2
      if( $this->isNewRecord )
153 2
      {
154 2
        $this->date = new CDbExpression('NOW()');
155 2
        $this->page = empty($this->page) || intval($this->page) < 1 ? 1 : $this->page;
156 2
        $this->page = $this->choosePage($this->page);
157 2
        $this->visible = 0;
158 2
      }
159
160 2
      return true;
161
    }
162
163
    return false;
164
  }
165
166
  /**
167
   * Выбирает страницу для новой ссылки.
168
   *
169
   * @param int $page Начальная страница.
170
   *
171
   * @return int Выбранная страница.
172
   */
173 2
  private function choosePage($page)
174
  {
175 2
    $linksOnPage = self::model()->inSection($this->section_id)->onPage($page)->count();
176
177 2
    if( $linksOnPage < self::LINKS_PER_PAGE )
178 2
    {
179 2
      return $page;
180
    }
181
    else
182
    {
183 2
      return $this->choosePage(++$page);
184
    }
185
  }
186
}