Passed
Push — master ( 5f2bd1...7c2064 )
by
unknown
13:34
created
classes/Search/Normal.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
         }
13 13
 
14 14
         $o = get_http_var('o');
15
-        $args = array (
15
+        $args = array(
16 16
             's' => $this->searchstring,
17 17
             'p' => $pagenum,
18 18
             'num' => get_http_var('num'),
19 19
             'pop' => get_http_var('pop'),
20
-            'o' => ($o=='d' || $o=='r' || $o=='o') ? $o : 'd',
20
+            'o' => ($o == 'd' || $o == 'r' || $o == 'o') ? $o : 'd',
21 21
         );
22 22
 
23 23
         return $args;
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
         }
56 56
 
57 57
         $sort_order = 'newest';
58
-        if ( $args['o'] == 'o' ) {
58
+        if ($args['o'] == 'o') {
59 59
             $sort_order = 'oldest';
60
-        } else if ( $args['o'] == 'r' ) {
60
+        } else if ($args['o'] == 'r') {
61 61
             $sort_order = 'relevance';
62 62
         }
63 63
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             return array('error' => $SEARCHENGINE->error);
74 74
         } else {
75 75
             $LIST = new \HANSARDLIST();
76
-            $data = $LIST->display('search', $args , 'none');
76
+            $data = $LIST->display('search', $args, 'none');
77 77
             $data['search_type'] = 'normal';
78 78
             $data['sort_order'] = $sort_order;
79 79
             $data['members'] = $members;
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
             return false;
94 94
         }
95 95
 
96
-        list ($constituencies, ) = \MySociety\TheyWorkForYou\Utility\Search::searchConstituenciesByQuery($searchterm);
96
+        list ($constituencies,) = \MySociety\TheyWorkForYou\Utility\Search::searchConstituenciesByQuery($searchterm);
97 97
 
98 98
         $constituency = "";
99
-        if (count($constituencies)==1) {
99
+        if (count($constituencies) == 1) {
100 100
             $constituency = $constituencies[0];
101 101
         }
102 102
 
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
 
113 113
                 $MEMBER = new \MySociety\TheyWorkForYou\Member(array('constituency'=>$constituency, 'house' => 1));
114 114
                 $cons[] = $MEMBER;
115
-                if ( $MEMBER->current_member(1) ) {
115
+                if ($MEMBER->current_member(1)) {
116 116
                     $mp_types['mp']++;
117 117
                 } else {
118 118
                     $mp_types['former']++;
119 119
                 }
120
-            } catch ( \MySociety\TheyWorkForYou\MemberException $e ) {
120
+            } catch (\MySociety\TheyWorkForYou\MemberException $e) {
121 121
                 $cons = array();
122 122
             }
123 123
         } elseif (count($constituencies)) {
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
                 try {
126 126
                     $MEMBER = new \MySociety\TheyWorkForYou\Member(array('constituency'=>$constituency, 'house' => 1));
127 127
                     $cons[] = $MEMBER;
128
-                    if ( $MEMBER->current_member(1) ) {
128
+                    if ($MEMBER->current_member(1)) {
129 129
                         $mp_types['mp']++;
130 130
                     } else {
131 131
                         $mp_types['former']++;
132 132
                     }
133
-                } catch ( \MySociety\TheyWorkForYou\MemberException $e ) {
133
+                } catch (\MySociety\TheyWorkForYou\MemberException $e) {
134 134
                     continue;
135 135
                 }
136 136
             }
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
             $link = array(
202 202
                 'url' => $url->generate(),
203 203
                 'page' => $n,
204
-                'current' => ( $n == $data['page'] )
204
+                'current' => ($n == $data['page'])
205 205
             );
206 206
 
207 207
             $links[] = $link;
@@ -242,27 +242,27 @@  discard block
 block discarded – undo
242 242
             $numlinks = $this->generate_pagination_links($data, $URL, $firstpage, $lastpage);
243 243
 
244 244
             $pagelinks['nums'] = $numlinks;
245
-            $pagelinks['first_result'] = $page == 1 ? 1 : ( ( $page - 1 ) * $results_per_page ) + 1;
246
-            $pagelinks['last_result'] = $page == $numpages ? $total_results : $pagelinks['first_result'] + ( $results_per_page - 1 );
245
+            $pagelinks['first_result'] = $page == 1 ? 1 : (($page - 1) * $results_per_page) + 1;
246
+            $pagelinks['last_result'] = $page == $numpages ? $total_results : $pagelinks['first_result'] + ($results_per_page - 1);
247 247
 
248
-            if ( $page != 1 ) {
248
+            if ($page != 1) {
249 249
                 $prev_page = $page - 1;
250
-                $URL->insert(array( 'p' => $prev_page ) );
250
+                $URL->insert(array('p' => $prev_page));
251 251
                 $pagelinks['prev'] = array(
252 252
                     'url' => $URL->generate()
253 253
                 );
254
-                $URL->insert(array( 'p' => 1 ) );
254
+                $URL->insert(array('p' => 1));
255 255
                 $pagelinks['firstpage'] = array(
256 256
                     'url' => $URL->generate()
257 257
                 );
258 258
             }
259 259
             if ($page != $numpages) {
260 260
                 $next_page = $page + 1;
261
-                $URL->insert(array( 'p' => $next_page ) );
261
+                $URL->insert(array('p' => $next_page));
262 262
                 $pagelinks['next'] = array(
263 263
                     'url' => $URL->generate()
264 264
                 );
265
-                $URL->insert(array( 'p' => $numpages ) );
265
+                $URL->insert(array('p' => $numpages));
266 266
                 $pagelinks['lastpage'] = array(
267 267
                     'url' => $URL->generate()
268 268
                 );
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
         $links['rss'] = $DATA->page_metadata($this_page, 'rss');
280 280
 
281 281
         if ($SEARCHENGINE) {
282
-            $links['email'] = '/alert/?' . ($this->searchstring ? 'alertsearch='.urlencode($this->searchstring) : '');
282
+            $links['email'] = '/alert/?' . ($this->searchstring ? 'alertsearch=' . urlencode($this->searchstring) : '');
283 283
             $links['email_desc'] = $SEARCHENGINE->query_description_long();
284 284
         }
285 285
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
             $search_engine = new \SEARCHENGINE($filter_ss);
294 294
             $links['email_section'] = $links['email'];
295 295
             $links['email_desc_section'] = $links['email_desc'];
296
-            $links['email'] = '/alert/?' . ($filter_ss ? 'alertsearch='.urlencode($filter_ss) : '');
296
+            $links['email'] = '/alert/?' . ($filter_ss ? 'alertsearch=' . urlencode($filter_ss) : '');
297 297
             $links['email_desc'] = $search_engine->query_description_long();
298 298
         }
299 299
 
Please login to merge, or discard this patch.
classes/Utility/Hansard.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
         $parts = parse_url($url);
16 16
         parse_str($parts['query'], $query);
17 17
 
18
-        if ( $query['id'] ) {
18
+        if ($query['id']) {
19 19
             if (strpos($parts['path'], 'lords') !== false) {
20 20
                 $gid = 'uk.org.publicwhip/lords/';
21 21
             } elseif (strpos($parts['path'], 'whall') !== false) {
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
 
31 31
 
32 32
     public static function gid_to_url($gid) {
33
-        if ( !$gid ) {
33
+        if (!$gid) {
34 34
             return '';
35 35
         }
36 36
         global $hansardmajors;
37 37
         $db = new \ParlDB();
38 38
 
39
-        $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array( ':gid' => $gid ))->first();
39
+        $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array(':gid' => $gid))->first();
40 40
         $url_gid = fix_gid_from_db($gid);
41 41
         $url = new \MySociety\TheyWorkForYou\Url($hansardmajors[$q['major']]['page']);
42 42
         $url->insert(array('id' => $url_gid));
Please login to merge, or discard this patch.
www/docs/admin/index.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 include_once '../../includes/easyparliament/init.php';
4
-include_once (INCLUDESPATH."easyparliament/commentreportlist.php");
4
+include_once (INCLUDESPATH . "easyparliament/commentreportlist.php");
5 5
 
6 6
 $this_page = "admin_home";
7 7
 
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 
19 19
 $confirmedusers = $db->query("SELECT COUNT(*) AS count FROM users WHERE confirmed = '1'")->first()['count'];
20 20
 $unconfirmedusers = $db->query("SELECT COUNT(*) AS count FROM users WHERE confirmed = '0'")->first()['count'];
21
-$olddate = gmdate("Y-m-d H:i:s", time()-86400);
21
+$olddate = gmdate("Y-m-d H:i:s", time() - 86400);
22 22
 $dayusers = $db->query("SELECT COUNT(*) AS count FROM users WHERE lastvisit > '$olddate'")->first()['count'];
23
-$olddate = gmdate("Y-m-d H:i:s", time()-86400*7);
23
+$olddate = gmdate("Y-m-d H:i:s", time() - 86400 * 7);
24 24
 $weekusers = $db->query("SELECT COUNT(*) AS count FROM users WHERE lastvisit > '$olddate'")->first()['count'];
25 25
 ?>
26 26
 <ul>
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $name = _htmlspecialchars($row['firstname'] . ' ' . $row['lastname']);
74 74
     }
75 75
 
76
-    $rows[] = array (
76
+    $rows[] = array(
77 77
         $name,
78 78
         '<a href="mailto:' . $row['email'] . '">' . $row['email'] . '</a>',
79 79
         $confirmed,
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
     );
82 82
 }
83 83
 
84
-$tabledata = array (
85
-    'header' => array (
84
+$tabledata = array(
85
+    'header' => array(
86 86
         'Name',
87 87
         'Email',
88 88
         'Confirmed?',
Please login to merge, or discard this patch.
www/docs/admin/badusers.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 include_once '../../includes/easyparliament/init.php';
4
-include_once (INCLUDESPATH."easyparliament/commentreportlist.php");
4
+include_once (INCLUDESPATH . "easyparliament/commentreportlist.php");
5 5
 
6 6
 $this_page = "admin_badusers";
7 7
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
     $totalcomments = $r['totalcount'];
44 44
 
45
-    $percentagedeleted = ( $row['deletedcount'] / $totalcomments ) * 100;
45
+    $percentagedeleted = ($row['deletedcount'] / $totalcomments) * 100;
46 46
 
47 47
 
48 48
     // Get complaints made about this user's comments, but not upheld.
@@ -57,17 +57,17 @@  discard block
 block discarded – undo
57 57
 
58 58
     $USERURL->insert(array('u'=>$user_id));
59 59
 
60
-    $rows[] = array (
60
+    $rows[] = array(
61 61
         '<a href="' . $USERURL->generate() . '">' . $row['firstname'] . ' ' . $row['lastname'] . '</a>',
62 62
         $totalcomments,
63 63
         $row['deletedcount'],
64
-        $percentagedeleted.'%',
64
+        $percentagedeleted . '%',
65 65
         $notupheldcount
66 66
     );
67 67
 }
68 68
 
69
-$tabledata = array (
70
-    'header' => array (
69
+$tabledata = array(
70
+    'header' => array(
71 71
         'Name',
72 72
         'Total comments',
73 73
         'Number deleted',
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
                     WHERE	user_id = '$user_id'
115 115
                     AND		upheld = '1'")->first();
116 116
 
117
-    $rows[] = array (
117
+    $rows[] = array(
118 118
         '<a href="' . $USERURL->generate() . '">' . $row['firstname'] . ' ' . $row['lastname'] . '</a>',
119 119
         $row['rejectedcount'],
120 120
         $r['upheldcount']
121 121
     );
122 122
 
123 123
 }
124
-$tabledata = array (
125
-    'header' => array (
124
+$tabledata = array(
125
+    'header' => array(
126 126
         'Name',
127 127
         'Reports not upheld',
128 128
         'Reports upheld'
Please login to merge, or discard this patch.
www/docs/admin/reporting_stats.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 
8 8
 $PAGE->page_start();
9 9
 $PAGE->stripe_start();
10
-$PAGE->block_start(array ('id'=>'alerts', 'title'=>'Reporting Statistics'));
10
+$PAGE->block_start(array('id'=>'alerts', 'title'=>'Reporting Statistics'));
11 11
 $db = new ParlDB;
12 12
 $q = $db->query('select year(created) as the_year, month(created) as the_month, count(*) as c from alerts where confirmed and not deleted group by year(created) desc, month(created) desc');
13 13
 print '<h3>Alert signups per month</h3> <table>';
Please login to merge, or discard this patch.
www/docs/admin/alert_stats.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 $PAGE->page_start();
9 9
 $PAGE->stripe_start();
10
-$PAGE->block_start(array ('id'=>'alerts', 'title'=>'Alert Statistics'));
10
+$PAGE->block_start(array('id'=>'alerts', 'title'=>'Alert Statistics'));
11 11
 $db = new ParlDB;
12 12
 
13 13
 $q_confirmed = $db->query('select count(*) as c from alerts where confirmed and not deleted')->first()['c'];
@@ -18,13 +18,13 @@  discard block
 block discarded – undo
18 18
 
19 19
 print '<h3>Headline stats</h3> <table>';
20 20
 $data = array(
21
-    'header' => array( 'Alert Type', 'Count' ),
21
+    'header' => array('Alert Type', 'Count'),
22 22
     'rows' => array(
23
-        array( 'Confirmed', $q_confirmed ),
24
-        array( 'Not Confirmed', $q_not_confirmed ),
25
-        array( 'Deleted', $q_deleted ),
26
-        array( 'For a Speaker<sup>*</sup>', $q_speaker ),
27
-        array( 'For a Keyword', $q_keyword ),
23
+        array('Confirmed', $q_confirmed),
24
+        array('Not Confirmed', $q_not_confirmed),
25
+        array('Deleted', $q_deleted),
26
+        array('For a Speaker<sup>*</sup>', $q_speaker),
27
+        array('For a Keyword', $q_keyword),
28 28
     )
29 29
 );
30 30
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     $criteria = $row['criteria'];
41 41
     $rows[] = array($id, $critera);
42 42
 }
43
-$data = array( 'rows' => $rows );
43
+$data = array('rows' => $rows);
44 44
 $PAGE->display_table($data);
45 45
 
46 46
 $q = $db->query('select count(*) as c, criteria from alerts where criteria like "speaker:%" and confirmed and not deleted group by criteria order by c desc');
@@ -70,15 +70,15 @@  discard block
 block discarded – undo
70 70
     }
71 71
 }
72 72
 
73
-$people_header = array( 'Name', 'Confirmed', 'Unconfirmed');
73
+$people_header = array('Name', 'Confirmed', 'Unconfirmed');
74 74
 print '<h3>Alert signups by MP/Peer</h3>';
75 75
 $rows = array();
76 76
 foreach ($tots as $person_id => $c) {
77 77
     $u = isset($unconfirmed[$person_id]) ? $unconfirmed[$person_id] : 0;
78
-    $rows[] = array( $name[$person_id], $c, $u );
78
+    $rows[] = array($name[$person_id], $c, $u);
79 79
 }
80 80
 $data = array(
81
-    'header' => array( 'Name', 'Confirmed', 'Unconfirmed'),
81
+    'header' => array('Name', 'Confirmed', 'Unconfirmed'),
82 82
     'rows' => $rows
83 83
 );
84 84
 $PAGE->display_table($data);
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
 foreach ($total as $criteria => $tot) {
106 106
     $c = isset($confirmed[$criteria]) ? $confirmed[$criteria] : 0;
107 107
     $u = isset($unconfirmed[$criteria]) ? $unconfirmed[$criteria] : 0;
108
-    $rows[] = array( $criteria, $c, $u );
108
+    $rows[] = array($criteria, $c, $u);
109 109
 }
110 110
 $data = array(
111
-    'header' => array( 'Criteria', 'Confirmed', 'Unconfirmed'),
111
+    'header' => array('Criteria', 'Confirmed', 'Unconfirmed'),
112 112
     'rows' => $rows
113 113
 );
114 114
 $PAGE->display_table($data);
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.