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.

backend/protected/components/BModule.php (3 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
 * Base class for all backend`s modules
4
 *
5
 * @author Sergey Glagolev <[email protected]>, Nikita Melnikov <[email protected]>
6
 * @link https://github.com/shogodev/argilla/
7
 * @copyright Copyright &copy; 2003-2014 Shogo
8
 * @license http://argilla.ru/LICENSE
9
 * @package backend.components
10
 */
11
class BModule extends CWebModule
12
{
13
  public $group = 'content';
14
15
  public $name = '[Не задано]';
16
17
  public $position = 0;
18
19
  public $enabled = true;
20
21
  public $autoloaded;
22
23
  public $defaultUploadDir = 'f/';
24
25
  public $thumbsSettings = [];
26
27
  /**
28
   * Список других модулей, от которых зависит текущий модуль
29
   *
30
   * @var array
31
   */
32
  public $moduleDependencies = [];
33
34
  /**
35
   * Подкаталоги модуля для загрузки
36
   *
37
   * @var array
38
   */
39
  public $defaultDirectoriesToImport = array(
40
    'controllers',
41
    'models',
42
    'components',
43
    'exceptions',
44
    'modules',
45
    'behaviors',
46
    '*'
47
  );
48
49 39
  protected function preinit()
50
  {
51 39
    $this->loadControllerMap();
52 39
  }
53
54 39
  public function init()
55
  {
56 39
    $import = CMap::mergeArray($this->getAutomaticImport(), $this->loadExtraDirectoriesToImport());
57 39
    $this->setImport($import);
58 39
  }
59
60
  public function beforeControllerAction($controller, $action)
61
  {
62
    if( !$this->enabled )
63
      throw new CHttpException(404, 'The requested page does not exist.');
64
65
    return parent::beforeControllerAction($controller, $action);
66
  }
67
68 3
  public function getUploadPath()
69
  {
70 3
    return Yii::app()->getFrontendRoot().$this->defaultUploadDir.$this->id.'/';
0 ignored issues
show
The method getFrontendRoot does only exist in BApplication and BTestApplication, but not in FApplication and FTestApplication.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
71
  }
72
73 4
  public function getUploadUrl()
74
  {
75 4
    return Yii::app()->getFrontendUrl().$this->defaultUploadDir.$this->id.'/';
0 ignored issues
show
The method getFrontendUrl does only exist in BApplication and BTestApplication, but not in FApplication and FTestApplication.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
76
  }
77
78
  /**
79
   * Возвращаем значения миниатюр для изображений
80
   * Массив сортируем по убыванию, последним элементом должна быть самая маленькая миниатюра.
81
   * Если в массиве присутствует ключ origin, то оригинальное изображение пережимается до указанных
82
   * по этому ключу размеров.
83
   *
84
   * Пример:
85
   * array(
86
   *   'info' => array(
87
   *     'pre' => array(
88
   *       164, // ширина
89
   *       164, // высота
90
   *       'crop' => true, // обрезать края
91
   *       'jpegQuality' => 97 // качество
92
   *     ),
93
   *   )
94
   * );
95
   *
96
   *
97
   * @return array
98
   */
99
  public function getThumbsSettings()
100
  {
101
    return $this->thumbsSettings;
102
  }
103
104 1
  public function getWatermarkSettings()
105
  {
106 1
    return array();
107
  }
108
109
  public function getHeaderCssClass()
110
  {
111
    return preg_replace('/(\/.*)/', '', $this->getId());
112
  }
113
114
  /**
115
   * @return array
116
   */
117
  public function getParents()
118
  {
119
    $parents = array();
120
    if( $parent = $this->getParentModule() )
121
    {
122
      $parents = CMap::mergeArray(array($parent->getName() => $parent), $parent->getParents($parent));
123
    }
124
125
    return array_reverse($parents);
126
  }
127
128
  public function createUrl($route, $params=array(), $ampersand='&')
129
  {
130
    $parents = CMap::mergeArray(array_keys($this->getParents()), array($this->id));
131
    $route = implode('/', CMap::mergeArray($parents, array($route)));
132
133
    return Yii::app()->createUrl($route, $params, $ampersand);
134
  }
135
136
  /**
137
   * Возвращает массив контроллеров, которые нужно отображать в меню
138
   *
139
   * @return array
140
   */
141
  public function getMenuControllers()
142
  {
143
    return array();
144
  }
145
146
  public function getControllerId($class)
147
  {
148
    if( $id = array_search($class, $this->controllerMap) )
149
      return $id;
150
151
    throw new CHttpException(500, $class.' не найден в controllerMap модуля '.$this->getName() );
0 ignored issues
show
Consider using $this->name. There is an issue with getName() and APC-enabled PHP versions.
Loading history...
152
  }
153
154
  /**
155
   * Загрузка всех контроллеров из модуля в controllerMap
156
   */
157 39
  protected function loadControllerMap()
158
  {
159 39
    if( $this->controllerMap !== [] )
160 39
      return;
161
162 39
    if( file_exists($this->getControllerPath()) )
163 39
    {
164 39
      foreach( CFileHelper::findFiles($this->getControllerPath(), array('fileTypes' => array('php'))) as $controllerFilePath )
165
      {
166 39
        $controllerFilePathParts = explode(DIRECTORY_SEPARATOR, $controllerFilePath);
167 39
        $controllerName = str_replace('.php', '', end($controllerFilePathParts));
168 39
        $controllerAlias = $this->getControllerAlias($controllerName);
169
170 39
        if( empty($this->controllerMap[$controllerAlias]) )
171 39
          $this->controllerMap[$controllerAlias] = $controllerName;
172 39
      }
173 39
    }
174
    else
175
      Yii::log('Невозможно загрузить директорию контроллеров '.get_class($this).' по пути '.$this->getControllerPath());
176 39
  }
177
178
  /**
179
   * Получение синонима контроллера для controllerMap
180
   *
181
   * @param string controller
182
   *
183
   * @return string
184
   */
185 39
  protected function getControllerAlias($controller)
186
  {
187 39
    return lcfirst(str_replace('Controller', '', BApplication::cutClassPrefix($controller)));
188
  }
189
190
  /**
191
   * Получение синонимов для автоматического импорта модуля
192
   *
193
   * @return array
194
   */
195 39
  protected function getAutomaticImport()
196
  {
197 39
    $import = array();
198
199 39
    foreach($this->defaultDirectoriesToImport as $directory)
200
    {
201 39
      $import[] = "{$this->id}.{$directory}.*";
202 39
    }
203
204 39
    return $import;
205
  }
206
207
  /**
208
   * Загрузка дополнительный директорий для импорта
209
   * Синоним пути должен быть полным (backend.modules.somemodule.models.*)
210
   *
211
   * @return array
212
   * @throws CException
213
   */
214 39
  final protected function loadExtraDirectoriesToImport()
215
  {
216 39
    $import = array();
217
218 39
    foreach( $this->getExtraDirectoriesToImport() as $directory )
219
    {
220 6
      if( !preg_match('/backend/', $directory) )
221 6
        throw new CException('Неверный формат импорта для '.$directory.' в '.get_class($this));
222
223 6
      $import[] = $directory;
224 39
    }
225
226 39
    return $import;
227
  }
228
229
  /**
230
   * Получение дополнительных поддиректорий для импорта в модуле
231
   *
232
   * @return array
233
   */
234 34
  protected function getExtraDirectoriesToImport()
235
  {
236 34
    return array();
237
  }
238
}