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 AccountController extends Controller |
||
3 | { |
||
4 | public $layout='//layouts/columnGuest'; |
||
0 ignored issues
–
show
|
|||
5 | |||
6 | /** |
||
7 | * Registers a new account. |
||
8 | * If registration is successful, the browser will be redirected to the to the previous page. |
||
9 | */ |
||
10 | public function actionSignup() |
||
11 | { |
||
12 | $this->signupNoMail(); |
||
13 | } |
||
14 | |||
15 | private function signupNoMail() |
||
0 ignored issues
–
show
signupNoMail uses the super-global variable $_POST which is generally not recommended.
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: // Bad
class Router
{
public function generate($path)
{
return $_SERVER['HOST'].$path;
}
}
// Better
class Router
{
private $host;
public function __construct($host)
{
$this->host = $host;
}
public function generate($path)
{
return $this->host.$path;
}
}
class Controller
{
public function myAction(Request $request)
{
// Instead of
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
// Better (assuming you use the Symfony2 request)
$page = $request->query->get('page', 1);
}
}
![]() |
|||
16 | { |
||
17 | $model=new Account('signupNoMail'); |
||
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. ![]() |
|||
18 | |||
19 | if (isset($_POST['Account'])) { |
||
20 | $model->attributes=$_POST['Account']; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 1 space but found 0 spaces
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. ![]() |
|||
21 | $originalPassword = $model->password; |
||
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. ![]() |
|||
22 | $valid = $model->validate(); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 13 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. ![]() |
|||
23 | |||
24 | if ($valid) { |
||
25 | $hash = password_hash($model->password, PASSWORD_BCRYPT); |
||
26 | |||
27 | if (password_verify($model->password, $hash)) { |
||
28 | $model->password = $hash; |
||
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. ![]() |
|||
29 | $model->verifyCode = null; |
||
30 | $model->verified = new CDbExpression('NOW()'); |
||
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. ![]() |
|||
31 | |||
32 | $transaction = $model->getDbConnection()->beginTransaction(); |
||
33 | try { |
||
34 | $model->save(false); |
||
35 | $model->refresh(); |
||
36 | |||
37 | $this->createPlayer($model); |
||
38 | |||
39 | $transaction->commit(); |
||
40 | |||
41 | Yii::app()->user->setFlash('success', $model->username . ', a regisztrációd elkészült! Bejelentkezhetsz.'); |
||
42 | $this->redirect('/'); |
||
43 | } catch (Exception $e) { |
||
44 | $transaction->rollback(); |
||
45 | Yii::app()->user->setFlash('error', 'Hiba lépett fel a játékos mentése során.'); |
||
46 | } |
||
47 | $model->password = $originalPassword; |
||
48 | |||
49 | } else { |
||
50 | Yii::app()->user->setFlash('error', 'Hiba lépett fel a jelszó titkosítása során..'); |
||
51 | } |
||
52 | } |
||
53 | } |
||
54 | |||
55 | $this->render('signupNoMail', array( |
||
56 | 'model'=>$model, |
||
57 | )); |
||
58 | } |
||
59 | private function signupWithMail() |
||
0 ignored issues
–
show
signupWithMail uses the super-global variable $_POST which is generally not recommended.
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: // Bad
class Router
{
public function generate($path)
{
return $_SERVER['HOST'].$path;
}
}
// Better
class Router
{
private $host;
public function __construct($host)
{
$this->host = $host;
}
public function generate($path)
{
return $this->host.$path;
}
}
class Controller
{
public function myAction(Request $request)
{
// Instead of
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
// Better (assuming you use the Symfony2 request)
$page = $request->query->get('page', 1);
}
}
![]() |
|||
60 | { |
||
61 | $model=new Account('signupWithMail'); |
||
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. ![]() |
|||
62 | |||
63 | if (isset($_POST['Account'])) { |
||
64 | $model->attributes=$_POST['Account']; |
||
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. ![]() |
|||
65 | if ($model->validate()) { |
||
66 | // Create account |
||
67 | $model->save(false); |
||
68 | $model->verifyCode = $model->generateCode(); |
||
69 | |||
70 | // Send verification mail |
||
71 | $mail=Yii::app()->smtpmail; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 10 spaces but found 0 spaces
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. ![]() |
|||
72 | $mail->CharSet = 'utf-8'; |
||
73 | $mail->SetFrom('[email protected]', 'ced.local'); //todo: activate sender |
||
0 ignored issues
–
show
|
|||
74 | $mail->Subject = "Carp-e Diem regisztráció"; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 1 space but found 4 spaces
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. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
Carp-e Diem regisztráció does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
75 | $message = $this->renderPartial('_verification', ['model'=>$model], true); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 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. ![]() |
|||
76 | $mail->MsgHTML($message); |
||
77 | $mail->AddAddress($model->email, ""); |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
78 | $sent = $mail->Send(); |
||
79 | if (!$sent) { |
||
80 | Yii::app()->user->setFlash('error', 'A regisztráció befejezéséhez szükséges információkat nem sikerült elküldeni. Kérlek próbálkozz később.'); |
||
81 | } else { |
||
82 | $model->save(false); |
||
83 | Yii::app()->user->setFlash('success', 'A regisztráció befejezéséhez szükséges teendőket elküldtük e-mailben.'); |
||
84 | $this->redirect('/'); |
||
85 | } |
||
86 | |||
87 | } |
||
88 | } |
||
89 | |||
90 | $this->render('signup', array( |
||
91 | 'model'=>$model, |
||
92 | )); |
||
93 | } |
||
94 | |||
95 | /** |
||
96 | * Completes an account registration |
||
97 | * @param string $id Account id |
||
98 | * @param string $code Verification code |
||
99 | */ |
||
100 | public function actionCompleteSignup($id, $code) |
||
0 ignored issues
–
show
actionCompleteSignup uses the super-global variable $_POST which is generally not recommended.
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: // Bad
class Router
{
public function generate($path)
{
return $_SERVER['HOST'].$path;
}
}
// Better
class Router
{
private $host;
public function __construct($host)
{
$this->host = $host;
}
public function generate($path)
{
return $this->host.$path;
}
}
class Controller
{
public function myAction(Request $request)
{
// Instead of
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
// Better (assuming you use the Symfony2 request)
$page = $request->query->get('page', 1);
}
}
![]() |
|||
101 | { |
||
102 | $model = $this->loadModel($id); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 11 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. ![]() |
|||
103 | $model->scenario = 'completeSignup'; |
||
104 | |||
105 | if (!$model->verifyCode || $model->username) { |
||
106 | Yii::app()->user->setFlash('info', 'Már állítottál be magadnak felhasználónevet. Kérlek jelentkezz be.'); |
||
107 | $this->redirect('/'); |
||
108 | } |
||
109 | |||
110 | if ($model->verifyCode !== $code) { |
||
111 | Yii::app()->user->setFlash('error', 'Az első belépéshez szükséges oldal címe nem érvényes. Pontosan másoltad be az e-mailből?'); |
||
112 | $this->redirect('/'); |
||
113 | } |
||
114 | |||
115 | if (isset($_POST['Account'])) { |
||
116 | $model->attributes=$_POST['Account']; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 1 space but found 0 spaces
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. ![]() |
|||
117 | $originalPassword = $model->password; |
||
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. ![]() |
|||
118 | $valid = $model->validate(); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 13 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. ![]() |
|||
119 | |||
120 | if ($valid) { |
||
121 | $hash = password_hash($model->password, PASSWORD_BCRYPT); |
||
122 | |||
123 | if (password_verify($model->password, $hash)) { |
||
124 | $model->password = $hash; |
||
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. ![]() |
|||
125 | $model->verifyCode = null; |
||
126 | $model->verified = new CDbExpression('NOW()'); |
||
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. ![]() |
|||
127 | |||
128 | $transaction = $model->getDbConnection()->beginTransaction(); |
||
129 | try { |
||
130 | $model->save(false); |
||
131 | $model->refresh(); |
||
132 | |||
133 | $this->createPlayer($model); |
||
134 | |||
135 | $transaction->commit(); |
||
136 | |||
137 | Yii::app()->user->setFlash('success', $model->username . ', üdvözöllek a játékban!'); |
||
138 | Yii::app()->session->open(); |
||
139 | |||
140 | $model->password = $originalPassword; |
||
141 | $model->login(); |
||
142 | $this->redirect('/site'); |
||
143 | } catch (Exception $e) { |
||
144 | $transaction->rollback(); |
||
145 | Yii::app()->user->setFlash('error', 'Hiba lépett fel a játékos mentése során.'); |
||
146 | } |
||
147 | $model->password = $originalPassword; |
||
148 | |||
149 | } else { |
||
150 | Yii::app()->user->setFlash('error', 'Hiba lépett fel a jelszó titkosítása során.'); |
||
151 | } |
||
152 | } |
||
153 | } |
||
154 | |||
155 | $this->render('completeSignup', ['model' => $model]); |
||
156 | } |
||
157 | |||
158 | public function actionResetPassword() |
||
0 ignored issues
–
show
actionResetPassword uses the super-global variable $_POST which is generally not recommended.
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: // Bad
class Router
{
public function generate($path)
{
return $_SERVER['HOST'].$path;
}
}
// Better
class Router
{
private $host;
public function __construct($host)
{
$this->host = $host;
}
public function generate($path)
{
return $this->host.$path;
}
}
class Controller
{
public function myAction(Request $request)
{
// Instead of
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
// Better (assuming you use the Symfony2 request)
$page = $request->query->get('page', 1);
}
}
![]() |
|||
159 | { |
||
160 | $model = new Account('resetPassword'); |
||
161 | |||
162 | if (isset($_POST['Account'])) { |
||
163 | $model->attributes=$_POST['Account']; |
||
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. ![]() |
|||
164 | |||
165 | if ($model->validate()) { |
||
166 | // Find account |
||
167 | $model = Account::model()->findByEmail($model->email); |
||
168 | |||
169 | if (!$model->password) { |
||
170 | $model->addError('email', 'A megadott e-mail címhez tartozó játékost még nem regisztráltad.'); |
||
171 | } else { |
||
172 | $this->sendResetLink($model); |
||
173 | } |
||
174 | } |
||
175 | } |
||
176 | |||
177 | $this->render('resetPassword', array( |
||
178 | 'model'=>$model, |
||
179 | )); |
||
180 | } |
||
181 | |||
182 | public function actionCompleteResetPassword($id, $code) |
||
0 ignored issues
–
show
actionCompleteResetPassword uses the super-global variable $_POST which is generally not recommended.
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: // Bad
class Router
{
public function generate($path)
{
return $_SERVER['HOST'].$path;
}
}
// Better
class Router
{
private $host;
public function __construct($host)
{
$this->host = $host;
}
public function generate($path)
{
return $this->host.$path;
}
}
class Controller
{
public function myAction(Request $request)
{
// Instead of
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
// Better (assuming you use the Symfony2 request)
$page = $request->query->get('page', 1);
}
}
![]() |
|||
183 | { |
||
184 | $model = $this->loadModel($id); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 11 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. ![]() |
|||
185 | $model->password = false; |
||
186 | $model->scenario = 'completeResetPassword'; |
||
187 | |||
188 | if (!$model->resetPasswordCode) { |
||
189 | Yii::app()->user->setFlash('error', 'A jelszó visszaállításához szükséges oldal címe nem érvényes. Pontosan másoltad be az e-mailből?'); |
||
190 | $this->redirect('/'); |
||
191 | } |
||
192 | |||
193 | if ($model->resetPasswordCode !== $code) { |
||
194 | Yii::app()->user->setFlash('error', 'A jelszó visszaállításához szükséges oldal címe nem érvényes. Pontosan másoltad be az e-mailből?'); |
||
195 | $this->redirect('/'); |
||
196 | } |
||
197 | |||
198 | if (isset($_POST['Account'])) { |
||
199 | $model->attributes=$_POST['Account']; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 1 space but found 0 spaces
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. ![]() |
|||
200 | $originalPassword = $model->password; |
||
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. ![]() |
|||
201 | |||
202 | if ($model->validate()) { |
||
203 | $hash = password_hash($model->password, PASSWORD_BCRYPT); |
||
204 | |||
205 | if (password_verify($model->password, $hash)) { |
||
206 | //delete passwordCode |
||
207 | $model->resetPasswordCode = null; |
||
208 | |||
209 | //set new password |
||
210 | $model->password = $hash; |
||
211 | $model->save(false); |
||
212 | $model->refresh(); |
||
213 | |||
214 | Yii::app()->user->setFlash('success', $model->username . ', a jelszó mentése sikerült!'); |
||
215 | Yii::app()->session->open(); |
||
216 | |||
217 | $model->password = $originalPassword; |
||
218 | $model->login(); |
||
219 | $this->redirect('/site'); |
||
220 | |||
221 | } else { |
||
222 | Yii::app()->user->setFlash('error', 'Hiba lépett fel a jelszó titkosítása során.'); |
||
223 | } |
||
224 | } |
||
225 | } |
||
226 | |||
227 | $this->render('completeResetPassword', ['model' => $model]); |
||
228 | } |
||
229 | |||
230 | public function actionCompleteChangeEmail($id, $code) |
||
231 | { |
||
232 | $model = $this->loadModel($id); |
||
233 | if (!$model->changeMailCode) { |
||
234 | Yii::app()->user->setFlash('error', 'A beállított e-mail címed már aktiválva van.'); |
||
235 | $this->redirect('/'); |
||
236 | } |
||
237 | |||
238 | if ($model->changeMailCode !== $code) { |
||
239 | Yii::app()->user->setFlash('error', 'Az e-mail aktiválásához szükséges oldal címe nem érvényes.'); |
||
240 | $this->redirect('/'); |
||
241 | } |
||
242 | |||
243 | $account=$this->loadModel($id); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 17 spaces but found 0 spaces
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. ![]() |
|||
244 | $account->email = $account->emailTemp; |
||
0 ignored issues
–
show
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. ![]() |
|||
245 | $account->emailTemp = ''; |
||
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. ![]() |
|||
246 | $account->changeMailCode = ''; |
||
247 | $account->save(); |
||
248 | |||
249 | Yii::app()->user->setFlash('success', 'Sikeresen aktiváltuk az e-mail címedet.'); |
||
250 | $this->redirect('/'); |
||
251 | } |
||
252 | |||
253 | /** |
||
254 | * @param Account $model |
||
255 | */ |
||
256 | private function sendResetLink($model) |
||
257 | { |
||
258 | // New verification if not exists |
||
259 | if (!$model->resetPasswordCode) { |
||
260 | $model->resetPasswordCode = $model->generateCode(); |
||
261 | $model->save(false); |
||
262 | } |
||
263 | |||
264 | // Send verification mail |
||
265 | $mail=Yii::app()->smtpmail; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 10 spaces but found 0 spaces
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. ![]() |
|||
266 | $mail->CharSet = 'utf-8'; |
||
267 | $mail->SetFrom('[email protected]', 'ced.local'); //todo: activate sender |
||
0 ignored issues
–
show
|
|||
268 | $mail->Subject = "Carp-e Diem elfelejtett jelszó"; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 1 space but found 4 spaces
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. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
Carp-e Diem elfelejtett jelszó does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
269 | $message = $this->renderPartial('_resetPassword', ['model'=>$model], true); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 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. ![]() |
|||
270 | $mail->MsgHTML($message); |
||
271 | $mail->AddAddress($model->email, ""); |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
272 | $sent = $mail->Send(); |
||
273 | if (!$sent) { |
||
274 | Yii::app()->user->setFlash('error', 'A jelszó visszaállításához szükséges információkat nem sikerült elküldeni. Kérlek próbálkozz később.'); |
||
275 | } else { |
||
276 | Yii::app()->user->setFlash('success', 'A jelszó visszaállításához szükséges teendőket elküldtük e-mailben.'); |
||
277 | $this->redirect('/'); |
||
278 | } |
||
279 | } |
||
280 | |||
281 | /** |
||
282 | * @param Account $model |
||
283 | */ |
||
284 | private function createPlayer($model) |
||
285 | { |
||
286 | $command = Yii::app()->db->createCommand(); |
||
287 | $command->insert('main', [ |
||
288 | 'uid'=>$model->id, |
||
289 | 'user'=>$model->username, |
||
290 | ]); |
||
291 | |||
292 | $command->insert('users_items', [ |
||
293 | 'uid'=>$model->id, |
||
294 | 'item_id'=>1, |
||
295 | 'skill'=>1, |
||
296 | 'item_count'=>1, |
||
297 | ]); |
||
298 | |||
299 | $command->insert('users_baits', [ |
||
300 | 'uid'=>$model->id, |
||
301 | 'item_id'=>1, |
||
302 | 'skill'=>1, |
||
303 | 'item_count'=>1, |
||
304 | ]); |
||
305 | } |
||
306 | |||
307 | /** |
||
308 | * Returns the data model based on the primary key given in the GET variable. |
||
309 | * If the data model is not found, an HTTP exception will be raised. |
||
310 | * @param integer $id the ID of the model to be loaded |
||
311 | * @return Account the loaded model |
||
312 | * @throws CHttpException |
||
313 | */ |
||
314 | View Code Duplication | public function loadModel($id) |
|
0 ignored issues
–
show
This method seems to be duplicated in 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. ![]() |
|||
315 | { |
||
316 | $model=Account::model()->findByPk((int)$id); |
||
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. ![]() |
|||
317 | |||
318 | if ($model===null) { |
||
319 | throw new CHttpException(1, 'A keresett játékos nem található. Ezen könnyen segíthetsz: ' . CHtml::link('regisztráld be.', ['signup'])); |
||
320 | } |
||
321 | |||
322 | return $model; |
||
323 | } |
||
324 | |||
325 | View Code Duplication | protected function beforeAction($action) |
|
0 ignored issues
–
show
This method seems to be duplicated in 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. ![]() |
|||
326 | { |
||
327 | if (Yii::app()->params['isPartOfWline']) { |
||
328 | throw new CHttpException(1, 'Ez az aloldal nem használható. ' . CHtml::link('főoldal', ['/site'])); //own nick |
||
329 | } |
||
330 | |||
331 | return true; |
||
332 | } |
||
333 | } |
||
0 ignored issues
–
show
|
|||
334 |
This check looks for improperly formatted assignments.
Every assignment must have exactly one space before and one space after the equals operator.
To illustrate:
will have no issues, while
will report issues in lines 1 and 2.