1 | <?php |
||
3 | class ProfileForm extends CFormModel |
||
|
|||
4 | { |
||
5 | /** |
||
6 | * The user's email address |
||
7 | * @var string $email |
||
8 | */ |
||
9 | public $email; |
||
10 | |||
11 | /** |
||
12 | * The user's NEW password |
||
13 | * @var string $password |
||
14 | */ |
||
15 | public $password; |
||
16 | |||
17 | /** |
||
18 | * The repeated password if a NEW password is applied |
||
19 | * @var string $password_repeat |
||
20 | */ |
||
21 | public $password_repeat; |
||
22 | |||
23 | /** |
||
24 | * The user's current password |
||
25 | * This field is required to make any changes to the account |
||
26 | * @var string $currentPassword |
||
27 | */ |
||
28 | public $currentPassword; |
||
29 | |||
30 | /** |
||
31 | * The user's display name |
||
32 | * @var string $username |
||
33 | */ |
||
34 | public $username; |
||
35 | |||
36 | /** |
||
37 | * The user role |
||
38 | * @var int $role |
||
39 | */ |
||
40 | public $user_role; |
||
41 | |||
42 | /** |
||
43 | * The user model |
||
44 | * @var Users $_user |
||
45 | */ |
||
46 | private $_user = NULL; |
||
47 | |||
48 | /** |
||
49 | * This form will likely be reused in admin portals, for re-use purposes authentication is not required to change privileged information |
||
50 | * @var boolean $overridePasswordCheck |
||
51 | */ |
||
52 | private $overridePasswordCheck = false; |
||
53 | |||
54 | |||
55 | private function canOverridePasswordCheck() |
||
65 | |||
66 | /** |
||
67 | * Overload of the __getter method to retrieve the user's ID |
||
68 | * @var int $id |
||
69 | */ |
||
70 | public function getId() |
||
74 | |||
75 | /** |
||
76 | * Retrieves the new email address if it is set |
||
77 | * @return mixed |
||
78 | */ |
||
79 | public function getNewEmail() |
||
91 | |||
92 | /** |
||
93 | * Sets the new email address |
||
94 | * @return boolean |
||
95 | */ |
||
96 | public function setNewEmail() |
||
117 | |||
118 | /** |
||
119 | * Retrieves the new email address if it is set |
||
120 | * @return mixed |
||
121 | */ |
||
122 | public function getNewEmailChangeKey() |
||
134 | |||
135 | /** |
||
136 | * Generates a new change key |
||
137 | * @return boolean |
||
138 | */ |
||
139 | public function setNewEmailChangeKey() |
||
164 | |||
165 | /** |
||
166 | * Validation rules |
||
167 | * @return array |
||
168 | */ |
||
169 | public function rules() |
||
181 | |||
182 | /** |
||
183 | * Retrieves the attributes labels from the Users model and returns them to reduce code redundancy |
||
184 | * @return array |
||
185 | */ |
||
186 | public function attributeLabels() |
||
193 | |||
194 | /** |
||
195 | * Validates the role |
||
196 | * @param array $attributes |
||
197 | * @param array $params |
||
198 | * return array |
||
199 | */ |
||
200 | public function validateUserRole($attributes, $params) |
||
208 | |||
209 | /** |
||
210 | * Ensures that the password entered matches the one provided during registration |
||
211 | * @param array $attributes |
||
212 | * @param array $params |
||
213 | * return array |
||
214 | */ |
||
215 | public function validateUserPassword($attributes, $params) |
||
234 | |||
235 | /** |
||
236 | * Internally loads the user's information before attempting to validate it |
||
237 | * @param int $id The user's ID |
||
238 | * @param bool $override This form may be reused |
||
239 | * @return ProfileForm |
||
240 | */ |
||
241 | public function load($id, $override = false) |
||
260 | |||
261 | /** |
||
262 | * Updates the user's profile information |
||
263 | * @return boolean |
||
264 | */ |
||
265 | public function save() |
||
284 | |||
285 | /** |
||
286 | * Changes the user's email address if necessary |
||
287 | * @return boolean |
||
288 | */ |
||
289 | private function changeEmail() |
||
300 | |||
301 | /** |
||
302 | * Sends the verification email to the user. This is broken to it's own method to allow for the resending email to be resent |
||
303 | * @return boolean |
||
304 | */ |
||
305 | public function sendVerificationEmail() |
||
318 | } |
||
319 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.