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 (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
/**
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']) {
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;
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;
126
        $forum->id = $this->id;
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
}
136