@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | $data['email'] = $user->email(); |
34 | 34 | $data['emailpublic'] = $user->emailpublic() == true ? "Yes" : "No"; |
35 | 35 | $data['optin'] = $user->optin() == true ? "Yes" : "No"; |
36 | - $data['postcode'] = $user->postcode(); |
|
36 | + $data['postcode'] = $user->postcode(); |
|
37 | 37 | $data['website'] = $user->url(); |
38 | - $data['registrationtime'] = $user->registrationtime(); |
|
39 | - $data['status']= $user->status(); |
|
38 | + $data['registrationtime'] = $user->registrationtime(); |
|
39 | + $data['status'] = $user->status(); |
|
40 | 40 | $data["deleted"] = $user->deleted(); |
41 | 41 | $data["confirmed"] = $user->confirmed(); |
42 | 42 | $data["status"] = $user->status(); |
@@ -243,10 +243,10 @@ discard block |
||
243 | 243 | // Who are we updating? $THEUSER or someone else? |
244 | 244 | if ($this_page == "otheruseredit") { |
245 | 245 | $who = 'the user’s'; |
246 | - $success = $THEUSER->update_other_user ( $details ); |
|
246 | + $success = $THEUSER->update_other_user($details); |
|
247 | 247 | } else { |
248 | 248 | $who = 'your'; |
249 | - $success = $THEUSER->update_self ( $details ); |
|
249 | + $success = $THEUSER->update_self($details); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
@@ -278,12 +278,12 @@ discard block |
||
278 | 278 | // If this goes well, the user will have their data |
279 | 279 | // added to the database and a confirmation email |
280 | 280 | // will be sent to them. |
281 | - $success = $THEUSER->add ( $details ); |
|
281 | + $success = $THEUSER->add($details); |
|
282 | 282 | |
283 | 283 | $errors = array(); |
284 | 284 | |
285 | 285 | if (!$success) { |
286 | - $errors["db"] = "Sorry, we were unable to create an account for you. Please <a href=\"mailto:". str_replace('@', '@', CONTACTEMAIL) . "\">let us know</a>. Thanks."; |
|
286 | + $errors["db"] = "Sorry, we were unable to create an account for you. Please <a href=\"mailto:" . str_replace('@', '@', CONTACTEMAIL) . "\">let us know</a>. Thanks."; |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | return $errors; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | |
292 | 292 | public function getRep($cons_type, $mp_house) { |
293 | 293 | global $THEUSER; |
294 | - if ( !$THEUSER->has_postcode() ) { |
|
294 | + if (!$THEUSER->has_postcode()) { |
|
295 | 295 | return array(); |
296 | 296 | } |
297 | 297 | |
@@ -304,11 +304,11 @@ discard block |
||
304 | 304 | // Scottish homepage |
305 | 305 | try { |
306 | 306 | $constituencies = \MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituencies($THEUSER->postcode()); |
307 | - if ( isset($constituencies[$cons_type]) ) { |
|
307 | + if (isset($constituencies[$cons_type])) { |
|
308 | 308 | $constituency = $constituencies[$cons_type]; |
309 | 309 | $MEMBER = new Member(array('constituency'=>$constituency, 'house'=> $mp_house)); |
310 | 310 | } |
311 | - } catch ( MemberException $e ) { |
|
311 | + } catch (MemberException $e) { |
|
312 | 312 | return array(); |
313 | 313 | } |
314 | 314 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | $mreg = array(); |
346 | 346 | if ($THEUSER->isloggedin() && $THEUSER->postcode() != '' || $THEUSER->postcode_is_set()) { |
347 | 347 | $reps = \MySociety\TheyWorkForYou\Member::getRegionalList($THEUSER->postcode, $mp_house, $cons_type); |
348 | - foreach ( $reps as $rep ) { |
|
348 | + foreach ($reps as $rep) { |
|
349 | 349 | $member = new \MySociety\TheyWorkForYou\Member(array('person_id' => $rep['person_id'])); |
350 | 350 | $mreg[$rep['person_id']] = $this->constructMPData($member, $THEUSER, $mp_house); |
351 | 351 | } |
@@ -62,7 +62,8 @@ discard block |
||
62 | 62 | $details = $this->getUserDetails(); |
63 | 63 | $details["password"] = ''; |
64 | 64 | $details["emailpublic"] = false; |
65 | - } else { |
|
65 | + } |
|
66 | + else { |
|
66 | 67 | $details["firstname"] = trim(get_http_var("firstname")); |
67 | 68 | $details["lastname"] = trim(get_http_var("lastname")); |
68 | 69 | |
@@ -96,14 +97,16 @@ discard block |
||
96 | 97 | if (get_http_var("deleted") != "") { |
97 | 98 | $deleted = get_http_var("deleted"); |
98 | 99 | $details["deleted"] = $deleted[0] == "true" ? true : false; |
99 | - } else { |
|
100 | + } |
|
101 | + else { |
|
100 | 102 | $details['deleted'] = false; |
101 | 103 | } |
102 | 104 | |
103 | 105 | if (get_http_var("confirmed") != "") { |
104 | 106 | $confirmed = get_http_var("confirmed"); |
105 | 107 | $details["confirmed"] = $confirmed[0] == "true" ? true : false; |
106 | - } else { |
|
108 | + } |
|
109 | + else { |
|
107 | 110 | $details['confirmed'] = false; |
108 | 111 | } |
109 | 112 | } |
@@ -139,11 +142,13 @@ discard block |
||
139 | 142 | if ($details["email"] == "") { |
140 | 143 | $errors["email"] = "Please enter an email address"; |
141 | 144 | |
142 | - } elseif (!validate_email($details["email"])) { |
|
145 | + } |
|
146 | + elseif (!validate_email($details["email"])) { |
|
143 | 147 | // validate_email() is in includes/utilities.php |
144 | 148 | $errors["email"] = "Please enter a valid email address"; |
145 | 149 | |
146 | - } else { |
|
150 | + } |
|
151 | + else { |
|
147 | 152 | |
148 | 153 | $USER = new \USER; |
149 | 154 | $id_of_user_with_this_addresss = $USER->email_exists($details["email"], true); |
@@ -159,7 +164,8 @@ discard block |
||
159 | 164 | $errors["email"] = "Someone else has already joined with this email address"; |
160 | 165 | } |
161 | 166 | |
162 | - } else { |
|
167 | + } |
|
168 | + else { |
|
163 | 169 | // User is joining. Check no one is already here with this email. |
164 | 170 | if ($this_page == "userjoin" && $id_of_user_with_this_addresss) { |
165 | 171 | $errors["email"] = "There is already a user with this email address"; |
@@ -175,7 +181,8 @@ discard block |
||
175 | 181 | if ($details["password"] == "") { |
176 | 182 | $errors["password"] = "Please enter a password"; |
177 | 183 | |
178 | - } elseif (strlen($details["password"]) < 6) { |
|
184 | + } |
|
185 | + elseif (strlen($details["password"]) < 6) { |
|
179 | 186 | $errors["password"] = "Please enter at least six characters"; |
180 | 187 | } |
181 | 188 | |
@@ -187,7 +194,8 @@ discard block |
||
187 | 194 | $errors["password"] = "The passwords did not match. Please try again."; |
188 | 195 | } |
189 | 196 | |
190 | - } else { |
|
197 | + } |
|
198 | + else { |
|
191 | 199 | |
192 | 200 | // Update details pages. |
193 | 201 | |
@@ -205,7 +213,8 @@ discard block |
||
205 | 213 | if ($details["postcode"] != "") { |
206 | 214 | if (!validate_postcode($details["postcode"])) { |
207 | 215 | $errors["postcode"] = "Sorry, this isn't a valid UK postcode."; |
208 | - } else { |
|
216 | + } |
|
217 | + else { |
|
209 | 218 | try { |
210 | 219 | $mp = new \MySociety\TheyWorkForYou\Member(array( |
211 | 220 | 'postcode' => $details['postcode'], |
@@ -244,7 +253,8 @@ discard block |
||
244 | 253 | if ($this_page == "otheruseredit") { |
245 | 254 | $who = 'the user’s'; |
246 | 255 | $success = $THEUSER->update_other_user ( $details ); |
247 | - } else { |
|
256 | + } |
|
257 | + else { |
|
248 | 258 | $who = 'your'; |
249 | 259 | $success = $THEUSER->update_self ( $details ); |
250 | 260 | } |
@@ -255,7 +265,8 @@ discard block |
||
255 | 265 | |
256 | 266 | if ($this_page == 'otheruseredit') { |
257 | 267 | $this_page = "userview"; |
258 | - } else { |
|
268 | + } |
|
269 | + else { |
|
259 | 270 | $this_page = "userviewself"; |
260 | 271 | } |
261 | 272 | |
@@ -264,7 +275,8 @@ discard block |
||
264 | 275 | } |
265 | 276 | |
266 | 277 | |
267 | - } else { |
|
278 | + } |
|
279 | + else { |
|
268 | 280 | $results['errors'] = array("db" => "Sorry, we were unable to update $who details. Please <a href=\"mailto:" . str_replace('@', '@', CONTACTEMAIL) . "\">let us know</a> what you were trying to change. Thanks."); |
269 | 281 | } |
270 | 282 |