Failed Conditions
Pull Request — master (#1325)
by Nick
51:22 queued 41:09
created
www/docs/admin/photos.php 3 patches
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 </form>
140 140
 
141 141
 <p style="clear:both; margin-top: 3em"><a href="/images/mps/photo-status.php">List MPs without photos</a></p>
142
-EOF;
142
+eof;
143 143
 
144 144
     return $out;
145 145
 }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     <span class="formw"><input type="submit" name="submit" value="Update attribution"></span>
194 194
 </div>
195 195
 </form>
196
-EOF;
196
+eof;
197 197
 
198 198
     return $out;
199 199
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
     $houses = array(1 => 'MP', 'Lord', 'MLA', 'MSP');
96 96
 
97
-    for ($i=0; $i<$q->rows(); $i++) {
97
+    for ($i = 0; $i < $q->rows(); $i++) {
98 98
         $p_id = $q->field($i, 'person_id');
99 99
         $house = $q->field($i, 'house');
100 100
         $desc = member_full_name($house, $q->field($i, 'title'), $q->field($i, 'given_name'), $q->field($i, 'family_name'), $q->field($i, 'lordofname')) .
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         } else {
113 113
             $desc .= ' [no photo]';
114 114
         }
115
-        $out .= '<option value="'.$p_id.'">'.$desc.'</option>' . "\n";
115
+        $out .= '<option value="' . $p_id . '">' . $desc . '</option>' . "\n";
116 116
     }
117 117
 
118 118
     $out .= ' </select></span> </div> ';
Please login to merge, or discard this patch.
Braces   +45 added lines, -28 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@  discard block
 block discarded – undo
26 26
 $out = '';
27 27
 if (get_http_var('submit')) {
28 28
     $out = DEVSITE ? submit_photo() : submit_attribution();
29
-} else {
29
+}
30
+else {
30 31
     $out = DEVSITE ? display_photo_form() : display_attribution_form();
31 32
 }
32 33
 print $out;
@@ -36,28 +37,36 @@  discard block
 block discarded – undo
36 37
     $pid = intval(get_http_var('pid'));
37 38
     $errors = array();
38 39
 
39
-    if (!array_key_exists('photo', $_FILES))
40
-        array_push($errors, 'Not got the photo.');
41
-    elseif ($_FILES['photo']['error'] > 0)
42
-        array_push($errors, 'There was an error uploading the photo.');
43
-    elseif (!is_uploaded_file($_FILES['photo']['tmp_name']))
44
-        array_push($errors, 'Did not get an uploaded file.');
40
+    if (!array_key_exists('photo', $_FILES)) {
41
+            array_push($errors, 'Not got the photo.');
42
+    }
43
+    elseif ($_FILES['photo']['error'] > 0) {
44
+            array_push($errors, 'There was an error uploading the photo.');
45
+    }
46
+    elseif (!is_uploaded_file($_FILES['photo']['tmp_name'])) {
47
+            array_push($errors, 'Did not get an uploaded file.');
48
+    }
45 49
     else {
46 50
         $tmp_name = $_FILES['photo']['tmp_name'];
47 51
 
48 52
         $image = new Imagick();
49 53
         $image->readImage($tmp_name);
50
-        if (!$image)
51
-            array_push($errors, 'Failed to read image from uploaded file');
54
+        if (!$image) {
55
+                    array_push($errors, 'Failed to read image from uploaded file');
56
+        }
52 57
             $imageS = clone $image;
53
-        if (!$image->scaleImage(0, 118))
54
-            array_push($errors, 'Scaling large failed');
55
-        if (!$imageS->scaleImage(0, 59))
56
-            array_push($errors, 'Scaling small failed');
57
-        if (!$image->writeImage("$dir/mpsL/$pid.jpeg"))
58
-            array_push($errors, "Saving to $dir/mpsL/$pid.jpeg failed");
59
-        if (!$imageS->writeImage("$dir/mps/$pid.jpeg"))
60
-            array_push($errors, "Saving to $dir/mps/$pid.jpeg failed");
58
+        if (!$image->scaleImage(0, 118)) {
59
+                    array_push($errors, 'Scaling large failed');
60
+        }
61
+        if (!$imageS->scaleImage(0, 59)) {
62
+                    array_push($errors, 'Scaling small failed');
63
+        }
64
+        if (!$image->writeImage("$dir/mpsL/$pid.jpeg")) {
65
+                    array_push($errors, "Saving to $dir/mpsL/$pid.jpeg failed");
66
+        }
67
+        if (!$imageS->writeImage("$dir/mps/$pid.jpeg")) {
68
+                    array_push($errors, "Saving to $dir/mps/$pid.jpeg failed");
69
+        }
61 70
         if (!$errors) {
62 71
             print "<pre>";
63 72
             chdir($dir);
@@ -70,8 +79,9 @@  discard block
 block discarded – undo
70 79
         }
71 80
     }
72 81
 
73
-    if ($errors)
74
-        return display_photo_form($errors);
82
+    if ($errors) {
83
+            return display_photo_form($errors);
84
+    }
75 85
     return "<p><em>Photo uploaded and resized for pid $pid</em> &mdash; check how it looks <a href=\"/mp?p=$pid\">on their page</a></p>" . display_photo_form();
76 86
 }
77 87
 
@@ -99,7 +109,9 @@  discard block
 block discarded – undo
99 109
         $house = $q->field($i, 'house');
100 110
         $desc = member_full_name($house, $q->field($i, 'title'), $q->field($i, 'given_name'), $q->field($i, 'family_name'), $q->field($i, 'lordofname')) .
101 111
                 " " . $houses[$house];
102
-        if ($q->field($i, 'party')) $desc .= ' (' . $q->field($i, 'party') . ')';
112
+        if ($q->field($i, 'party')) {
113
+            $desc .= ' (' . $q->field($i, 'party') . ')';
114
+        }
103 115
         if ($q->field($i, 'constituency')) {
104 116
             $desc .= ', ' . $q->field($i, 'constituency');
105 117
         }
@@ -107,9 +119,11 @@  discard block
 block discarded – undo
107 119
         list($dummy, $sz) = MySociety\TheyWorkForYou\Utility\Member::findMemberImage($p_id);
108 120
         if ($sz == 'L') {
109 121
             $desc .= ' [has large photo]';
110
-        } elseif ($sz == 'S') {
122
+        }
123
+        elseif ($sz == 'S') {
111 124
             $desc .= ' [has small photo]';
112
-        } else {
125
+        }
126
+        else {
113 127
             $desc .= ' [no photo]';
114 128
         }
115 129
         $out .= '<option value="'.$p_id.'">'.$desc.'</option>' . "\n";
@@ -150,13 +164,16 @@  discard block
 block discarded – undo
150 164
     $attr_link = get_http_var('attr_link');
151 165
     $errors = array();
152 166
 
153
-    if (!$pid || !$attr_text)
154
-        array_push($errors, 'Missing information');
155
-    elseif ($attr_link && substr($attr_link, 0, 4) != 'http')
156
-        array_push($errors, 'Bad link');
167
+    if (!$pid || !$attr_text) {
168
+            array_push($errors, 'Missing information');
169
+    }
170
+    elseif ($attr_link && substr($attr_link, 0, 4) != 'http') {
171
+            array_push($errors, 'Bad link');
172
+    }
157 173
 
158
-    if ($errors)
159
-        return display_attribution_form($errors);
174
+    if ($errors) {
175
+            return display_attribution_form($errors);
176
+    }
160 177
 
161 178
     # UPDATE
162 179
     global $db;
Please login to merge, or discard this patch.
www/docs/section.php 3 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 }
14 14
 
15 15
 if ($type = ucfirst(get_http_var('type'))) {
16
-    $class_name = "MySociety\TheyWorkForYou\SectionView\\${type}View";
16
+    $class_name = "MySociety\TheyWorkForYou\SectionView\\${type}view";
17 17
     $view = new $class_name();
18 18
     $data = $view->display();
19 19
     if ($data) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     $view = new $class_name();
18 18
     $data = $view->display();
19 19
     if ($data) {
20
-        if ( !empty($data['template']) ) {
20
+        if (!empty($data['template'])) {
21 21
             $template = $data['template'];
22 22
         } else {
23 23
             $template = 'section/section';
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,8 @@
 block discarded – undo
19 19
     if ($data) {
20 20
         if ( !empty($data['template']) ) {
21 21
             $template = $data['template'];
22
-        } else {
22
+        }
23
+        else {
23 24
             $template = 'section/section';
24 25
         }
25 26
         MySociety\TheyWorkForYou\Renderer::output($template, $data);
Please login to merge, or discard this patch.
scripts/populate-policy-images.php 3 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 }
47 47
 
48 48
 $count = 0;
49
-while ( ( $policy = fgetcsv($file) ) !== FALSE ) {
49
+while ( ( $policy = fgetcsv($file) ) !== false ) {
50 50
     if ( intval($policy[0]) ) {
51 51
         $policy_id = $policy[0];
52 52
         $img_id = $policy[1] ? $policy[1] : $policy_id;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     exit(1);
34 34
 }
35 35
 
36
-if ( !file_exists($csvfile) ) {
36
+if (!file_exists($csvfile)) {
37 37
     print "$csvfile cannot be found\n";
38 38
     exit(1);
39 39
 }
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 }
47 47
 
48 48
 $count = 0;
49
-while ( ( $policy = fgetcsv($file) ) !== FALSE ) {
50
-    if ( intval($policy[0]) ) {
49
+while (($policy = fgetcsv($file)) !== FALSE) {
50
+    if (intval($policy[0])) {
51 51
         $policy_id = $policy[0];
52 52
         $img_id = $policy[1] ? $policy[1] : $policy_id;
53 53
         $title = $policy[2];
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
                 ':image_attribution' => $attribution,
70 70
                 ':license_url' => $licence_url)
71 71
         );
72
-        if ( $q->success() ) {
72
+        if ($q->success()) {
73 73
             $count += $q->affected_rows();
74 74
         } else {
75 75
             print "failed to update data for $policy_id\n";
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,8 @@
 block discarded – undo
71 71
         );
72 72
         if ( $q->success() ) {
73 73
             $count += $q->affected_rows();
74
-        } else {
74
+        }
75
+        else {
75 76
             print "failed to update data for $policy_id\n";
76 77
         }
77 78
     }
Please login to merge, or discard this patch.
tests/Bootstrap.php 3 patches
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@  discard block
 block discarded – undo
8 8
 // Test to make sure we have the test DB environment variables. If not, this isn't testing, so abort.
9 9
 // Define the DB connection constants before we do anything else.
10 10
 if (
11
-    isset($_SERVER['TWFY_TEST_DB_HOST']) AND
12
-    isset($_SERVER['TWFY_TEST_DB_USER']) AND
13
-    isset($_SERVER['TWFY_TEST_DB_PASS']) AND
11
+    isset($_SERVER['TWFY_TEST_DB_HOST']) and
12
+    isset($_SERVER['TWFY_TEST_DB_USER']) and
13
+    isset($_SERVER['TWFY_TEST_DB_PASS']) and
14 14
     isset($_SERVER['TWFY_TEST_DB_NAME'])
15 15
 ) {
16 16
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 }
38 38
 
39 39
 // Explicitly declare we're in testing (avoids trying deploy-only things)
40
-define('TESTING', TRUE);
40
+define('TESTING', true);
41 41
 
42 42
 // Load up the init script (handles the rest of the config, DB connection etc)
43 43
 include_once('www/includes/easyparliament/init.php');
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@
 block discarded – undo
21 21
     define('OPTION_TWFY_DB_NAME', $_SERVER['TWFY_TEST_DB_NAME']);
22 22
     
23 23
     // Define the base directory
24
-    define ("BASEDIR", dirname(__FILE__) . '/../www/docs'); 
24
+    define("BASEDIR", dirname(__FILE__) . '/../www/docs'); 
25 25
 
26 26
     # point to the default mapit
27 27
     define('OPTION_MAPIT_URL', 'https://mapit.mysociety.org/');
28 28
 
29 29
     // If there isn't a config file (most likely this is running an automated test) copy one in.
30
-    if ( ! file_exists(dirname(__FILE__) . '/../conf/general')) {
30
+    if (!file_exists(dirname(__FILE__) . '/../conf/general')) {
31 31
         copy(dirname(__FILE__) . '/../conf/general-example', dirname(__FILE__) . '/../conf/general');
32 32
     }
33 33
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@
 block discarded – undo
31 31
         copy(dirname(__FILE__) . '/../conf/general-example', dirname(__FILE__) . '/../conf/general');
32 32
     }
33 33
 
34
-} else {
34
+}
35
+else {
35 36
     echo "Testing environment variables not set. This will cause bad things to happen if testing happens on production. Aborting.\n";
36 37
     exit(1);
37 38
 }
Please login to merge, or discard this patch.
www/docs/alert/update-mp/index.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-$new_style_template = TRUE;
3
+$new_style_template = true;
4 4
 
5 5
 include_once '../../../includes/easyparliament/init.php';
6 6
 include_once INCLUDESPATH . 'easyparliament/member.php';
Please login to merge, or discard this patch.
www/docs/user/login/fb.php 3 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
     If the input is not OK, the form is displayed again with error messages.
10 10
 */
11 11
 
12
-$new_style_template = TRUE;
12
+$new_style_template = true;
13 13
 
14 14
 include_once '../../../includes/easyparliament/init.php';
15 15
 # need to include this as login code uses error_message
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@
 block discarded – undo
27 27
 
28 28
 $data['fb_login_url'] = $login->getLoginURL();
29 29
 if (isset($data['token'])) {
30
-  $success = $login->loginUser($data['token']);
31
-  if (!$success) {
30
+    $success = $login->loginUser($data['token']);
31
+    if (!$success) {
32 32
     $data['error'] = 'Could not login using Facebook token';
33 33
     \MySociety\TheyWorkForYou\Renderer::output('login/facebook', $data);
34
-  }
34
+    }
35 35
 } else {
36 36
     \MySociety\TheyWorkForYou\Renderer::output('login/facebook', $data);
37 37
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,6 +32,7 @@
 block discarded – undo
32 32
     $data['error'] = 'Could not login using Facebook token';
33 33
     \MySociety\TheyWorkForYou\Renderer::output('login/facebook', $data);
34 34
   }
35
-} else {
35
+}
36
+else {
36 37
     \MySociety\TheyWorkForYou\Renderer::output('login/facebook', $data);
37 38
 }
Please login to merge, or discard this patch.
classes/User.php 4 patches
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 class User {
15
-    public function getUserDetails($user_id = False) {
15
+    public function getUserDetails($user_id = false) {
16 16
         global $THEUSER;
17 17
 
18 18
         $user = $THEUSER;
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
             }
251 251
 
252 252
             if ($details['email'] != $THEUSER->email()) {
253
-                $results['email_changed'] = True;
253
+                $results['email_changed'] = true;
254 254
             }
255 255
 
256 256
 
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -321,6 +321,9 @@
 block discarded – undo
321 321
         return array();
322 322
     }
323 323
 
324
+    /**
325
+     * @param Member $member
326
+     */
324 327
     private function constructMPData($member, $user, $mp_house) {
325 328
         $mp_data = array();
326 329
         $mp_data['name'] = $member->full_name();
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
243 243
         // Who are we updating? $THEUSER or someone else?
244 244
         if ($this_page == "otheruseredit") {
245 245
             $who = 'the user&rsquo;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
 block discarded – undo
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('@', '&#64;', 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('@', '&#64;', CONTACTEMAIL) . "\">let us know</a>. Thanks.";
287 287
         }
288 288
 
289 289
         return $errors;
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
Braces   +24 added lines, -12 removed lines patch added patch discarded remove patch
@@ -62,7 +62,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
244 253
         if ($this_page == "otheruseredit") {
245 254
             $who = 'the user&rsquo;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
 block discarded – undo
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
 block discarded – undo
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('@', '&#64;', CONTACTEMAIL) . "\">let us know</a> what you were trying to change. Thanks.");
269 281
         }
270 282
 
Please login to merge, or discard this patch.
www/docs/user/index.php 4 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
         // And make sure the user is allowed to do this!
33 33
 
34 34
         $template = 'user/form';
35
-        if (is_numeric( get_http_var("u") ) && $THEUSER->is_able_to("edituser")) {
35
+        if (is_numeric(get_http_var("u")) && $THEUSER->is_able_to("edituser")) {
36 36
 
37 37
             $data = $user->getUserDetails(get_http_var('u'));
38 38
             $data['showall'] = true;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * page so leave it like that for now.
6 6
  */
7 7
 
8
-$new_style_template = TRUE;
8
+$new_style_template = true;
9 9
 
10 10
 include_once '../../includes/easyparliament/init.php';
11 11
 # need to include this as login code uses error_message
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                 $data['errors'] = $results['errors'];
128 128
                 $template = 'user/form';
129 129
             } else {
130
-                $data['edited'] = True;
130
+                $data['edited'] = true;
131 131
                 if (isset($results['email_changed'])) {
132 132
                     $data['email_changed'] = $results['email_changed'];
133 133
                 }
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -106,12 +106,12 @@
 block discarded – undo
106 106
 
107 107
 // if data has been submitted then handle that
108 108
 if (
109
-      get_http_var("submitted") == "true" && (
109
+        get_http_var("submitted") == "true" && (
110 110
         $this_page == 'useredit' || $this_page == 'otheruseredit' || $this_page == 'userjoin'
111
-      )
112
-   ) {
111
+        )
112
+    ) {
113 113
     // Put all the user-submitted data in an array.
114
-     $data = $user->getUpdateDetails($this_page, $THEUSER);
114
+        $data = $user->getUpdateDetails($this_page, $THEUSER);
115 115
 
116 116
     if ($this_page == 'useredit') {
117 117
         $data['facebook_user'] = $THEUSER->facebook_user();
Please login to merge, or discard this patch.
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -41,7 +41,8 @@  discard block
 block discarded – undo
41 41
             $data['pg'] = 'editother';
42 42
             $this_page = "otheruseredit";
43 43
 
44
-        } else if ($THEUSER->isloggedin()) {
44
+        }
45
+        else if ($THEUSER->isloggedin()) {
45 46
             // Revert to editing THEUSER's own info.
46 47
             $data = $user->getUserDetails();
47 48
             $data['pg'] = 'edit';
@@ -52,7 +53,8 @@  discard block
 block discarded – undo
52 53
                 $this_page = 'userviewself';
53 54
             }
54 55
 
55
-        } else {
56
+        }
57
+        else {
56 58
             $this_page = "userjoin";
57 59
             $template = 'user/join';
58 60
         }
@@ -71,7 +73,8 @@  discard block
 block discarded – undo
71 73
                 $this_page = 'userviewself';
72 74
             }
73 75
             $data['pg'] = 'edit';
74
-        } else {
76
+        }
77
+        else {
75 78
             // Unlikely to get to this page without being logged in,
76 79
             // but just in case, show them the blank form.
77 80
             $this_page = "userjoin";
@@ -89,12 +92,14 @@  discard block
 block discarded – undo
89 92
             $template = 'user/index';
90 93
             $data = $user->getUserDetails();
91 94
             $this_page = 'userviewself';
92
-        } else if (is_numeric(get_http_var('u'))) {
95
+        }
96
+        else if (is_numeric(get_http_var('u'))) {
93 97
             // Viewing someone else's details.
94 98
             $template = 'user/view_user';
95 99
             $data = $user->getUserDetails(get_http_var('u'));
96 100
             $this_page = "userview";
97
-        } else {
101
+        }
102
+        else {
98 103
             // probably want to login
99 104
             $URL = new URL('userlogin');
100 105
             $URL->insert(array('ret'=>'/user/'));
@@ -129,25 +134,29 @@  discard block
 block discarded – undo
129 134
         if ($this_page == 'userjoin') {
130 135
             $template = 'user/join';
131 136
         }
132
-    } else {
137
+    }
138
+    else {
133 139
         if ($this_page == 'useredit' || $this_page == 'otheruseredit') {
134 140
             $results = $user->update($data);
135 141
             if (isset($results['errors'])) {
136 142
                 $data['errors'] = $results['errors'];
137 143
                 $template = 'user/form';
138
-            } else {
144
+            }
145
+            else {
139 146
                 $data['edited'] = True;
140 147
                 if (isset($results['email_changed'])) {
141 148
                     $data['email_changed'] = $results['email_changed'];
142 149
                 }
143 150
                 $template = 'user/index';
144 151
             }
145
-        } else {
152
+        }
153
+        else {
146 154
             $errors = $user->add($data);
147 155
             if (sizeof($errors) > 0) {
148 156
                 $data['errors'] = $errors;
149 157
                 $template = 'user/join';
150
-            } else {
158
+            }
159
+            else {
151 160
                 $template = 'user/welcome';
152 161
             }
153 162
         }
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/user/form.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@
 block discarded – undo
125 125
                   <span class="label">Security status:</span>
126 126
                   <span class="formw"><select name="status">
127 127
                   <?php
128
-                  foreach ($statuses as $n => $status_name) { ?>
128
+                    foreach ($statuses as $n => $status_name) { ?>
129 129
                     <option value="<?= $status_name ?>"<?= $status_name == $status ? ' selected' : '' ?>>
130 130
                       <?= $status_name ?>
131 131
                     </option>
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@
 block discarded – undo
174 174
 
175 175
                 <input type="hidden" name="submitted" value="true">
176 176
 
177
-                <?php if (isset($ret) && $ret != '' ) { ?>
177
+                <?php if (isset($ret) && $ret != '') { ?>
178 178
                     <input type="hidden" name="ret" value="<?= _htmlentities($ret) ?>">
179 179
                 <?php } ?>
180 180
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
                 <input type="hidden" name="pg" value="edit">
35 35
               </form>
36 36
             <?php } else { ?>
37
-              <?php if (isset($showall) && $showall == True && isset($user_id)) { ?>
37
+              <?php if (isset($showall) && $showall == true && isset($user_id)) { ?>
38 38
               <h1>Edit the user&rsquo;s details</h1>
39 39
               <?php } else { ?>
40 40
               <h1>Edit your details</h1>
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
                     <input type="radio" name="emailpublic" id="emailpublicfalse" value="false" <?= $emailpublic == 'No' ? ' checked' : '' ?>> <label for="emailpublicfalse">No</label></span>
143 143
                 </div>
144 144
 
145
-                <?php if (isset($showall) && $showall == True) { ?>
145
+                <?php if (isset($showall) && $showall == true) { ?>
146 146
                   <?php if (isset($errors['status'])) { ?>
147 147
                   <p class="error">
148 148
                       <?= $errors['status'] ?>
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
                     <input type="hidden" name="pg" value="<?= $pg ?>">
211 211
                 <?php } ?>
212 212
 
213
-                <?php if (isset($showall) && $showall == True && isset($user_id)) { ?>
213
+                <?php if (isset($showall) && $showall == true && isset($user_id)) { ?>
214 214
                     <input type="hidden" name="u" value="<?= _htmlentities($user_id) ?>">
215 215
                 <?php } ?>
216 216
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,10 +37,12 @@
 block discarded – undo
37 37
 
38 38
                 <input type="hidden" name="pg" value="edit">
39 39
               </form>
40
-            <?php } else { ?>
40
+            <?php }
41
+else { ?>
41 42
               <?php if (isset($showall) && $showall == True && isset($user_id)) { ?>
42 43
               <h1>Edit the user&rsquo;s details</h1>
43
-              <?php } else { ?>
44
+              <?php }
45
+else { ?>
44 46
               <h1>Edit your details</h1>
45 47
               <?php } ?>
46 48
 
Please login to merge, or discard this patch.