This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | class BackgroundController extends CronController |
||
3 | { |
||
4 | public function actionFinishChallenges() |
||
5 | { |
||
6 | $mc = new MaintenanceChallenge; |
||
7 | $mc->fetchFinishable(); |
||
8 | $mc->process(); |
||
9 | |||
10 | echo 'ok'; |
||
11 | } |
||
12 | |||
13 | public function actionReset() |
||
14 | { |
||
15 | $mp = new MaintenancePlayer; |
||
16 | |||
17 | $user = Yii::app()->request->getParam('user', 'x'); |
||
18 | echo $user . '<br/>'; |
||
19 | |||
20 | if ($user) { |
||
21 | $mp->setUid($user); |
||
22 | } |
||
23 | $mp->reset(); |
||
24 | |||
25 | $this->render('//site/dummy', ['log'=>$mp->log]); |
||
26 | } |
||
27 | |||
28 | public function actionContestStart($addPoints = 0) |
||
29 | { |
||
30 | $contest = new Contest; |
||
31 | if ($contest->activeId) { |
||
0 ignored issues
–
show
|
|||
32 | return true; |
||
33 | } |
||
34 | echo 'started, '; |
||
35 | |||
36 | $contest->create(); |
||
37 | |||
38 | if ($addPoints) { |
||
39 | for ($i=0; $i<1000; $i++) { |
||
40 | $contest->addPoints(rand(1981, 2100), Contest::ACT_MISSION, 1, 1, 1); |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 | |||
45 | public function actionContestStop() |
||
46 | { |
||
47 | $contest = new Contest; |
||
48 | if (time() > $contest->activeId + CONTEST::LIFETIME) { |
||
0 ignored issues
–
show
The property
activeId cannot be accessed from this context as it is declared private in class Contest .
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. ![]() |
|||
49 | echo 'stopped:'. $contest->activeId; |
||
0 ignored issues
–
show
The property
activeId cannot be accessed from this context as it is declared private in class Contest .
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. ![]() |
|||
50 | $contest->complete(); |
||
51 | } |
||
52 | } |
||
53 | |||
54 | public function actionContestStartStop($addPoints = 0) |
||
55 | { |
||
56 | $this->actionContestStart($addPoints); |
||
57 | $this->actionContestStop(); |
||
58 | } |
||
59 | |||
60 | public function actionNewLevelRevards() |
||
61 | { |
||
62 | $res = Yii::app()->db->createCommand() |
||
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. ![]() |
|||
63 | ->select('uid, routine') |
||
64 | ->from('visited') |
||
65 | ->where('routine >= 9') |
||
66 | ->order('uid') |
||
67 | ->queryAll(); |
||
68 | $users = []; |
||
69 | foreach ($res as $d) { |
||
70 | //pay for gold routine |
||
71 | @$users[$d['uid']]['gold'] += 30; |
||
0 ignored issues
–
show
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.
If you suppress an error, we recommend checking for the error condition explicitly: // For example instead of
@mkdir($dir);
// Better use
if (@mkdir($dir) === false) {
throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
![]() |
|||
72 | @$users[$d['uid']]['r_gold']++; |
||
0 ignored issues
–
show
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.
If you suppress an error, we recommend checking for the error condition explicitly: // For example instead of
@mkdir($dir);
// Better use
if (@mkdir($dir) === false) {
throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
![]() |
|||
73 | |||
74 | //pay for diamand |
||
75 | if ($d['routine'] >= 81) { |
||
76 | $users[$d['uid']]['gold'] += 70; |
||
77 | @$users[$d['uid']]['r_diamant']++; |
||
0 ignored issues
–
show
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.
If you suppress an error, we recommend checking for the error condition explicitly: // For example instead of
@mkdir($dir);
// Better use
if (@mkdir($dir) === false) {
throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
![]() |
|||
78 | } |
||
79 | } |
||
80 | |||
81 | $log = print_r($users, true); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 2 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. ![]() |
|||
82 | $wall = new Wall(); |
||
83 | foreach ($users as $uid => $award) { |
||
84 | Yii::app()->db->createCommand("UPDATE main SET gold=gold+{$award['gold']} WHERE uid={$uid}")->execute(); |
||
0 ignored issues
–
show
As per coding-style, please use concatenation or
sprintf for the variable $award instead of interpolation.
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings. // Instead of
$x = "foo $bar $baz";
// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
![]() As per coding-style, please use concatenation or
sprintf for the variable $uid instead of interpolation.
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings. // Instead of
$x = "foo $bar $baz";
// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
![]() |
|||
85 | |||
86 | $wall->content_type = Wall::TYPE_NEW_AWARD; |
||
0 ignored issues
–
show
The property
content_type cannot be accessed from this context as it is declared private in class Wall .
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. ![]() |
|||
87 | $wall->uid = $uid; |
||
0 ignored issues
–
show
The property
uid cannot be accessed from this context as it is declared private in class Wall .
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. ![]() Equals sign not aligned with surrounding assignments; expected 10 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. ![]() |
|||
88 | $wall->add([ |
||
89 | 'award'=>$award['gold'], |
||
90 | 'r_gold'=>$award['r_gold'], |
||
91 | 'r_diamant'=>(int)@$award['r_diamant'] |
||
92 | ]); |
||
93 | } |
||
94 | $this->render('//site/dummy', ['log'=>$log]); |
||
95 | } |
||
96 | } |
||
0 ignored issues
–
show
|
|||
97 |
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.