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/Store.php (14 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
 * @property integer $uid
4
 * @property array $blackBait
5
 * @property array $packagesSms
6
 */
7
class Store extends CModel
8
{
9
    private $uid;
10
    private $missingSetItemPrice = 100;
11
12
    public function attributeNames()
13
    {
14
        return [];
15
    }
16
17
    public function getUid()
18
    {
19
        return $this->uid;
20
    }
21
22
    public function getPackagesSms()
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...
23
    {
24
        return Yii::app()->params['packagesSms'];
25
    }
26
27
    public function getMissingSetItemPrice()
28
    {
29
        return $this->missingSetItemPrice;
30
    }
31
    public function setUid($uid)
32
    {
33
        $this->uid = (int)$uid;
34
    }
35
36
    public function refillEnergy()
37
    {
38
        $player = Yii::app()->player->model;
39
40
        $logger = new Logger;
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 6 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...
41
        $logger->key = 'refillEnergy:'.date('Y-m-d').':'.$this->uid;
0 ignored issues
show
The property key cannot be accessed from this context as it is declared private in class Logger.

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...
42
        $logger->addToSet('----start: '.date('H:i:s').'----');
43
        $logger->addToSet('gold:'.$player->gold.', energy: ' . $player->energy.'/'.$player->energy_max);
44
45
        if ($player->gold < 20) {
46
            throw new CFlashException('Nincs elég aranyad az energiaital kifizetésére.');
47
        }
48
49
        $logger->addToSet('gold > 20');
50
        if ($player->energy_missing < 3) {
51
            throw new CFlashException('Kevesebb, mint 3 energiára van szükséged. Emiatt nem érdemes energiaitalt innod.');
52
        }
53
54
        $logger->addToSet('energy_missing > 3');
55
56
        $player->updateAttributes(['energy'=>$player->energy_missing], ['gold'=>20]);
57
        $logger->addToSet('energy increased, gold decreased');
58
59
        $logger->addToSet('---- end: '.date('H:i:s').'----');
60
61
        Yii::app()->badge->model->triggerSimple('energy_drink');
62
        return true;
63
    }
64
65
    public function listMissingSetItems()
66
    {
67
        $shop = new Shop;
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 12 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...
68
        $shop->item_type = Shop::TYPE_PART;
0 ignored issues
show
The property item_type cannot be accessed from this context as it is declared private in class Shop.

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...
69
        $shop->fetchSets();
70
        $sets = $shop->items;
0 ignored issues
show
The property items cannot be accessed from this context as it is declared private in class Shop.

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...
71
72
        $missing = [];
73
        foreach ($sets as $set) {
74
            foreach ($set['items'] as $item) {
75
                if (!$item->owned) {
76
                    $missing[] = $item;
77
                }
78
            }
79
        }
80
81
        return $missing;
82
    }
83
    public function buySetItem($id)
84
    {
85
        $player = Yii::app()->player->model;
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 3 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...
86
        $userName = $player->user;
87
88
        //check is we have the selected item in the missing list
89
        $missingList = $this->listMissingSetItems();
90
        $buyItem = null;
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...
91
        foreach ($missingList as $item) {
92
            if ($item['id'] == $id) {
93
                $buyItem = $item;
94
                break;
95
            }
96
        }
97
        //check it it is an existing item
98
        if ($buyItem == null) {
99
            throw new CFlashException('A keresett elem nem létezik.');
100
        }
101
        //check the amount of gold
102
        if ($player->gold < $this->missingSetItemPrice) {
103
            throw new CFlashException('Nincs elég aranyad a szett elem kifizetésére.');
104
        }
105
106
        //check is we bought one this week of this type
107
        $setItemType = strtok($buyItem['title'], ' ');
108
        $logKey = 'debug:buySetItem:' . date('Y:W') . ':' . strtolower($setItemType);
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 6 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...
109
110
        $hash = new ARedisHash($logKey);
111
        if ($hash->offsetExists($userName)) {
112
            throw new CFlashException($setItemType .' típusú szett elemet már vettél a héten. Jövő héten vásárolhatsz belőle újból.');
113
        }
114
115
        //buy the item
116
        $i = new Item;
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 12 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...
117
        $i->id = $buyItem['id'];
0 ignored issues
show
The property id cannot be accessed from this context as it is declared private in class Item.

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...
Equals sign not aligned with surrounding assignments; expected 8 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...
118
        $i->item_type = Item::TYPE_PART;
0 ignored issues
show
The property item_type cannot be accessed from this context as it is declared private in class Item.

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...
119
        $i->fetch();
120
        $i->buy(1);
121
122
        //pay the price
123
        $player->updateAttributes([], ['gold'=>$this->missingSetItemPrice]);
124
125
        //log the purchase
126
        $hash->add($userName, date('H:i:s') . ', ' . $buyItem['title']);
127
128
        return true;
129
    }
130
}
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...
131