Issues (1020)

Security Analysis    no vulnerabilities found

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.

models/ClubAR.php (6 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
 * This is the model class for table "club".
5
 *
6
 * The followings are the available columns in table 'club':
7
 * @property string $id
8
 * @property integer $owner
9
 * @property string $name
10
 * @property string $created
11
 */
12
class ClubAR extends CActiveRecord
13
{
14
    /**
15
     * Returns the static model of the specified AR class.
16
     * @param string $className active record class name.
17
     * @return Club the static model class
18
     */
19
    public static function model($className = __CLASS__)
20
    {
21
        return parent::model($className);
22
    }
23
24
    /**
25
     * @return string the associated database table name
26
     */
27
    public function tableName()
28
    {
29
        return 'club';
30
    }
31
32
    /**
33
     * @return array validation rules for model attributes.
34
     */
35
    public function rules()
36
    {
37
        // NOTE: you should only define rules for those attributes that
38
        // will receive user inputs.
39
        return array(
40
            ['name', 'clean'],
41
            ['name', 'required'],
42
            ['name', 'length', 'min'=>6, 'max'=>14],
43
            ['name', 'levelRequirement'],
44
            ['name', 'hasOtherClub'],
45
            ['name', 'nameIsFree'],
46
            ['id, owner', 'safe', 'on'=>'search'],
47
        );
48
    }
49
50
    public function clean($attribute)
51
    {
52
        $this->$attribute = trim($this->$attribute);
53
        $this->$attribute = strip_tags($this->$attribute);
54
        $this->$attribute = htmlspecialchars($this->$attribute);
55
    }
56
57
    public function levelRequirement($attribute, $params)
58
    {
59 View Code Duplication
        if (Yii::app()->player->model->level < Yii::app()->params['clubCreateLevelRequirement']) {
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...
60
            $this->addError($attribute, 'Saját klub indításához minimum ' . Yii::app()->params['clubCreateLevelRequirement'] . '. szintre kell fejlődnöd.');
61
        }
62
    }
63
64
    public function hasOtherClub($attribute, $params)
65
    {
66
        if (Yii::app()->player->model->in_club) {
67
            $this->addError($attribute, 'Egy másik klub tagja vagy. Először lépj ki abból.');
68
        }
69
    }
70
71
    public function nameIsFree($attribute, $params)
72
    {
73
        $clubWithSameName = Yii::app()->db->createCommand()
74
            ->select('id')
75
            ->from('club')
76
            ->where('name=:name', [':name'=>$this->$attribute])
77
            ->queryScalar();
78
        if ($clubWithSameName) {
79
            $this->addError($attribute, 'Ez a név már foglalt.');
80
        }
81
    }
82
83
    /**
84
     * @return array customized attribute labels (name=>label)
85
     */
86
    public function attributeLabels()
87
    {
88
        return array(
89
            'id' => 'ID',
90
            'owner' => 'Tulajdonos',
91
            'name' => 'Klub neve',
92
            'created' => 'Létrehozva',
93
        );
94
    }
95
96
    /**
97
     * Retrieves a list of models based on the current search/filter conditions.
98
     * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
99
     */
100
    public function search()
101
    {
102
        // Warning: Please modify the following code to remove attributes that
103
        // should not be searched.
104
105
        $criteria=new CDbCriteria;
0 ignored issues
show
Equals sign not aligned correctly; expected 1 space but found 0 spaces

This check looks for improperly formatted assignments.

Every assignment must have exactly one space before and one space after the equals operator.

To illustrate:

$a = "a";
$ab = "ab";
$abc = "abc";

will have no issues, while

$a   = "a";
$ab  = "ab";
$abc = "abc";

will report issues in lines 1 and 2.

Loading history...
106
107
        $criteria->compare('id', $this->id, true);
108
        $criteria->compare('owner', $this->owner);
109
        $criteria->compare('name', $this->name, true);
110
        $criteria->compare('created', $this->created, true);
111
112
        return new CActiveDataProvider($this, array(
113
            'criteria'=>$criteria,
114
        ));
115
    }
116
117
    protected function beforeSave()
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
118
    {
119
        $this->owner = Yii::app()->player->uid;
120
        return parent::beforeSave();
121
    }
122
123
    protected function afterSave()
124
    {
125
        $forum = new Forum;
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
126
        $forum->id = $this->id;
0 ignored issues
show
The property id cannot be accessed from this context as it is declared private in class Forum.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
127
        $forum->save(Yii::app()->player->model->user . ' megalapĂ­totta a klubot.', true);
128
129
        Yii::app()->badge->model->triggerSimple('club_create');
130
131
        //delete inactive join request
132
        Yii::app()->db->createCommand()->delete('club_members', 'uid=:uid AND approved=0', [':uid'=>Yii::app()->player->model->uid]);
133
        parent::afterSave();
134
    }
135
}
0 ignored issues
show
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
136