Completed
Pull Request — master (#1450)
by Nick
08:21 queued 03:29
created
www/docs/video/submit.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,11 +18,16 @@
 block discarded – undo
18 18
 $htime = $q['htime'];
19 19
 $atime = $q['atime'];
20 20
 $adate = $q['adate'];
21
-if ($atime) $htime = $atime;
22
-if ($adate) $hdate = $adate;
21
+if ($atime) {
22
+    $htime = $atime;
23
+}
24
+if ($adate) {
25
+    $hdate = $adate;
26
+}
23 27
 
24
-if (!$hdate || !$htime || !$time)
28
+if (!$hdate || !$htime || !$time) {
25 29
     exit;
30
+}
26 31
 
27 32
 $videodb = \MySociety\TheyWorkForYou\Utility\Video::dbConnect();
28 33
 if (!$file) {
Please login to merge, or discard this patch.
www/docs/api/api_getMPsInfo.php 1 patch
Braces   +21 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@  discard block
 block discarded – undo
20 20
     $ids = preg_split('#\s*,\s*#', $ids, -1, PREG_SPLIT_NO_EMPTY);
21 21
     $safe_ids = array(0);
22 22
     foreach ($ids as $id) {
23
-        if (ctype_digit($id)) $safe_ids[] = $id;
23
+        if (ctype_digit($id)) {
24
+            $safe_ids[] = $id;
25
+        }
24 26
     }
25 27
     $ids = join(',', $safe_ids);
26 28
 
@@ -32,13 +34,15 @@  discard block
 block discarded – undo
32 34
         $output = array();
33 35
         foreach ($q as $row) {
34 36
             $data_key = $row['data_key'];
35
-            if (count($fields) && !in_array($data_key, $fields))
36
-                continue;
37
+            if (count($fields) && !in_array($data_key, $fields)) {
38
+                            continue;
39
+            }
37 40
             $pid = $row['person_id'];
38 41
             $output[$pid][$data_key] = $row['data_value'];
39 42
             $time = strtotime($row['lastupdate']);
40
-            if ($time > $last_mod)
41
-                $last_mod = $time;
43
+            if ($time > $last_mod) {
44
+                            $last_mod = $time;
45
+            }
42 46
         }
43 47
         $q = $db->query("select memberinfo.*, person_id from memberinfo, member
44 48
             where memberinfo.member_id=member.member_id and person_id in (" . $ids . ")
@@ -46,16 +50,22 @@  discard block
 block discarded – undo
46 50
         if ($q->rows()) {
47 51
             foreach ($q as $row) {
48 52
                 $data_key = $row['data_key'];
49
-                if (count($fields) && !in_array($data_key, $fields))
50
-                    continue;
53
+                if (count($fields) && !in_array($data_key, $fields)) {
54
+                                    continue;
55
+                }
51 56
                 $mid = $row['member_id'];
52 57
                 $pid = $row['person_id'];
53
-                if (!isset($output[$pid]['by_member_id'])) $output[$pid]['by_member_id'] = array();
54
-                if (!isset($output[$pid]['by_member_id'][$mid])) $output[$pid]['by_member_id'][$mid] = array();
58
+                if (!isset($output[$pid]['by_member_id'])) {
59
+                    $output[$pid]['by_member_id'] = array();
60
+                }
61
+                if (!isset($output[$pid]['by_member_id'][$mid])) {
62
+                    $output[$pid]['by_member_id'][$mid] = array();
63
+                }
55 64
                 $output[$pid]['by_member_id'][$mid][$data_key] = $row['data_value'];
56 65
                 $time = strtotime($row['lastupdate']);
57
-                if ($time > $last_mod)
58
-                    $last_mod = $time;
66
+                if ($time > $last_mod) {
67
+                                    $last_mod = $time;
68
+                }
59 69
             }
60 70
         }
61 71
         ksort($output);
Please login to merge, or discard this patch.
www/docs/api/api_getMembers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
             'person_id' => $pid,
16 16
             'name' => html_entity_decode(member_full_name($row['house'], $row['title'],
17 17
                 $row['given_name'], $row['family_name'],
18
-                $row['lordofname'] )),
18
+                $row['lordofname'])),
19 19
             'party' => isset($parties[$row['party']]) ? $parties[$row['party']] : $row['party'],
20 20
         );
21 21
         if ($row['house'] != HOUSE_TYPE_LORDS) {
Please login to merge, or discard this patch.
www/docs/api/api_convertURL.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     $LISTURL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$id_data['major']]['page_all']);
41 41
     $fragment = '';
42 42
     if ($id_data['htype'] == '11' || $id_data['htype'] == '10') {
43
-        $LISTURL->insert( array( 'id' => $id_data['gid'] ) );
43
+        $LISTURL->insert(array('id' => $id_data['gid']));
44 44
     } else {
45 45
         $parent_epobject_id = $id_data['subsection_id'];
46 46
         $parent_gid = '';
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             $parent_gid = fix_gid_from_db($r['gid']);
54 54
         }
55 55
         if ($parent_gid != '') {
56
-            $LISTURL->insert( array( 'id' => $parent_gid ) );
56
+            $LISTURL->insert(array('id' => $parent_gid));
57 57
             $fragment = '#g' . gid_to_anchor($id_data['gid']);
58 58
         }
59 59
     }
Please login to merge, or discard this patch.
www/docs/images/mps/photo-status.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
         array_push($out['none'], '<li>' . $row['person_id'] . ' (' . $row['party'] . ')' . ', ' . $row['constituency']);
23 23
     }
24 24
 }
25
-print '<h3>Missing completely ('.count($out['none']).')</h3> <ul>';
25
+print '<h3>Missing completely (' . count($out['none']) . ')</h3> <ul>';
26 26
 print join($out['none'], "\n");
27 27
 print '</ul>';
28 28
 print '<h3>Large and small</h3> <p>';
Please login to merge, or discard this patch.
www/docs/departments/questions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 if (!$dept) {
13 13
 } else {
14
-    $dept = strtolower(str_replace('_',' ',$dept));
14
+    $dept = strtolower(str_replace('_', ' ', $dept));
15 15
     $q = $db->query('select epobject.epobject_id from hansard,epobject
16 16
         where hansard.epobject_id=epobject.epobject_id and major=3 and section_id=0
17 17
         and hdate>(select max(hdate) from hansard where major=3) - interval 7 day
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         order by body');
32 32
     print '<ul>';
33 33
     foreach ($q as $row) {
34
-        print '<li><a href="/wrans/?id=' . fix_gid_from_db($row['gid']). '">' . $row['body']. '</a>';
34
+        print '<li><a href="/wrans/?id=' . fix_gid_from_db($row['gid']) . '">' . $row['body'] . '</a>';
35 35
         print '</li>';
36 36
     }
37 37
     print '</ul>';
Please login to merge, or discard this patch.
www/docs/departments/statements.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 if (!$dept) {
13 13
 } else {
14
-    $dept = strtolower(str_replace('_',' ',$dept));
14
+    $dept = strtolower(str_replace('_', ' ', $dept));
15 15
     $q = $db->query('select epobject.epobject_id from hansard,epobject
16 16
         where hansard.epobject_id=epobject.epobject_id and major=4 and section_id=0
17 17
         and hdate>(select max(hdate) from hansard where major=4) - interval 7 day
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         order by body');
32 32
     print '<ul>';
33 33
     foreach ($q as $row) {
34
-        print '<li><a href="/wms/?id=' . fix_gid_from_db($row['gid']). '">' . $row['body']. '</a>';
34
+        print '<li><a href="/wms/?id=' . fix_gid_from_db($row['gid']) . '">' . $row['body'] . '</a>';
35 35
         print '</li>';
36 36
     }
37 37
     print '</ul>';
Please login to merge, or discard this patch.
www/docs/random/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,5 +11,5 @@
 block discarded – undo
11 11
 $gid = fix_gid_from_db($gid);
12 12
 
13 13
 $URL = new \MySociety\TheyWorkForYou\Url('debates');
14
-$URL->insert( array( 'id' => $gid ) );
14
+$URL->insert(array('id' => $gid));
15 15
 header('Location: ' . $URL->generate());
Please login to merge, or discard this patch.
www/docs/postcode/index.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 $pc = preg_replace('#[^a-z0-9]#i', '', $pc);
16 16
 if (!validate_postcode($pc)) {
17
-    twfy_debug ('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
17
+    twfy_debug('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
18 18
     postcode_error("Sorry, " . _htmlentities($pc) . " isn't a valid postcode");
19 19
 }
20 20
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     exit;
58 58
 }
59 59
 
60
-function fetch_mp($pc, $constituencies, $house=null) {
60
+function fetch_mp($pc, $constituencies, $house = null) {
61 61
     global $THEUSER;
62 62
     $args = array('constituency' => $constituencies['WMC']);
63 63
     if ($house) {
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     }
66 66
     try {
67 67
         $MEMBER = new MEMBER($args);
68
-    } catch (MySociety\TheyWorkForYou\MemberException $e){
68
+    } catch (MySociety\TheyWorkForYou\MemberException $e) {
69 69
         postcode_error($e->getMessage());
70 70
     }
71 71
     if ($MEMBER->person_id()) {
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
     foreach ($q as $row) {
112 112
         $house = $row['house'];
113 113
         $cons = $row['constituency'];
114
-        if ($house==3) {
114
+        if ($house == 3) {
115 115
             $mreg[] = $row;
116
-        } elseif ($house==4) {
116
+        } elseif ($house == 4) {
117 117
             if ($cons == $areas['SPC']) {
118 118
                 $mcon = $row;
119 119
             } elseif ($cons == $areas['SPE']) {
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         $out .= $mcon['given_name'] . ' ' . $mcon['family_name'] . '</a>, ' . $mcon['constituency'] . '</li>';
139 139
     }
140 140
     $out .= '<li>Your <strong>' . $areas[$area_type] . ' ' . $rep_type . 's</strong> ';
141
-    if ($rep_type=='MLA') $out .= '(Members of the Legislative Assembly)';
141
+    if ($rep_type == 'MLA') $out .= '(Members of the Legislative Assembly)';
142 142
     $out .= ' ' . ($current ? 'are' : 'were') . ':';
143 143
     $out .= '<ul>';
144 144
     foreach ($mreg as $reg) {
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -89,7 +89,9 @@  discard block
 block discarded – undo
89 89
     $mp = array();
90 90
     if ($q) {
91 91
         $mp = $q;
92
-        if ($mp['left_house'] != '9999-12-31') $mp['former'] = true;
92
+        if ($mp['left_house'] != '9999-12-31') {
93
+            $mp['former'] = true;
94
+        }
93 95
     }
94 96
 
95 97
     $a = array_values($areas);
@@ -128,7 +130,9 @@  discard block
 block discarded – undo
128 130
     $out = '';
129 131
     $out .= '<p>That postcode has multiple results, please pick who you are interested in:</p>';
130 132
     $out .= '<ul><li>Your ';
131
-    if (isset($mp['former'])) $out .= 'former ';
133
+    if (isset($mp['former'])) {
134
+        $out .= 'former ';
135
+    }
132 136
     $out .= '<strong>MP</strong> (Member of Parliament) is <a href="/mp/?p=' . $mp['person_id'] . '">';
133 137
     $out .= $mp['given_name'] . ' ' . $mp['family_name'] . '</a>, ' . $mp['constituency'] . '</li>';
134 138
     if ($mcon) {
@@ -138,7 +142,9 @@  discard block
 block discarded – undo
138 142
         $out .= $mcon['given_name'] . ' ' . $mcon['family_name'] . '</a>, ' . $mcon['constituency'] . '</li>';
139 143
     }
140 144
     $out .= '<li>Your <strong>' . $areas[$area_type] . ' ' . $rep_type . 's</strong> ';
141
-    if ($rep_type=='MLA') $out .= '(Members of the Legislative Assembly)';
145
+    if ($rep_type=='MLA') {
146
+        $out .= '(Members of the Legislative Assembly)';
147
+    }
142 148
     $out .= ' ' . ($current ? 'are' : 'were') . ':';
143 149
     $out .= '<ul>';
144 150
     foreach ($mreg as $reg) {
Please login to merge, or discard this patch.