Failed Conditions
Pull Request — master (#1326)
by Nick
60:22 queued 50:08
created
www/docs/user/logout/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     // So we can send the user back to where they came from.
15 15
     $URL->insert(array("ret"=>get_http_var("ret")));
16 16
 }
17
-$THEUSER->logout( $URL->generate() );
17
+$THEUSER->logout($URL->generate());
18 18
 
19 19
 $message['title'] = 'You are now logged out';
20 20
 
Please login to merge, or discard this patch.
www/docs/admin/edittopic.php 3 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -11,34 +11,34 @@  discard block
 block discarded – undo
11 11
 
12 12
 $slug = get_http_var('id');
13 13
 if ($slug) {
14
-  $topic = $topics->getTopic($slug);
14
+    $topic = $topics->getTopic($slug);
15 15
 } else {
16
-  $topic = new \MySociety\TheyWorkForYou\Topic();
16
+    $topic = new \MySociety\TheyWorkForYou\Topic();
17 17
 }
18 18
 
19 19
 $action = get_http_var('action');
20 20
 switch ($action) {
21 21
     case 'add':
22 22
       $success = add_topic($topic);
23
-      break;
23
+        break;
24 24
     case 'update':
25 25
       $success = update_topic($topic);
26
-      break;
26
+        break;
27 27
     case 'setimage':
28 28
       $success = add_image($topic);
29
-      break;
29
+        break;
30 30
     case 'addcontent':
31 31
       $success = add_content($topic);
32
-      break;
32
+        break;
33 33
     case 'deletecontent':
34 34
       $success = delete_content($topic);
35
-      break;
35
+        break;
36 36
     case 'addpolicysets':
37 37
       $success = add_policy_sets($topic);
38
-      break;
38
+        break;
39 39
     case 'addpolicies':
40 40
       $success = add_policies($topic);
41
-      break;
41
+        break;
42 42
     default:
43 43
       $success = NULL;
44 44
 }
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
             <select name="sets[]" multiple>
126 126
               <option value="">None</option>
127 127
             <?php
128
-              $policies = new \MySociety\TheyWorkForYou\Policies;
129
-              $set_descriptions = $policies->getSetDescriptions();
130
-              $related_sets = $topic->getPolicySets();
131
-              foreach ($set_descriptions as $set => $description) { ?>
128
+                $policies = new \MySociety\TheyWorkForYou\Policies;
129
+                $set_descriptions = $policies->getSetDescriptions();
130
+                $related_sets = $topic->getPolicySets();
131
+                foreach ($set_descriptions as $set => $description) { ?>
132 132
               <option value="<?= $set ?>" <?= in_array($set, $related_sets) ? 'selected' : '' ?>><?= $description ?></option>
133 133
             <?php } ?>
134 134
             <input type="submit" value="Update">
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
             <select name="policies[]" multiple>
144 144
               <option value="">None</option>
145 145
             <?php
146
-              $policies = new \MySociety\TheyWorkForYou\Policies;
147
-              $all_policies = $policies->getPolicies();
148
-              $related_policies = $topic->getPolicies();
149
-              foreach ($all_policies as $number => $description) { ?>
146
+                $policies = new \MySociety\TheyWorkForYou\Policies;
147
+                $all_policies = $policies->getPolicies();
148
+                $related_policies = $topic->getPolicies();
149
+                foreach ($all_policies as $number => $description) { ?>
150 150
               <option value="<?= $number ?>" <?= in_array($number, $related_policies) ? 'selected' : '' ?>><?= $description ?></option>
151 151
             <?php } ?>
152 152
 
@@ -214,9 +214,9 @@  discard block
 block discarded – undo
214 214
             $file_info['tmp_name'],
215 215
             $topic->image_path()
216 216
         );
217
-     } catch (ErrorException $e) {
217
+        } catch (ErrorException $e) {
218 218
         return false;
219
-     }
219
+        }
220 220
 
221 221
     if ($image_saved) {
222 222
         return $topic->save();
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
       $success = add_policies($topic);
41 41
       break;
42 42
     default:
43
-      $success = NULL;
43
+      $success = null;
44 44
 }
45 45
 
46 46
 if (!is_null($success)) {
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@  discard block
 block discarded – undo
12 12
 $slug = get_http_var('id');
13 13
 if ($slug) {
14 14
   $topic = $topics->getTopic($slug);
15
-} else {
15
+}
16
+else {
16 17
   $topic = new \MySociety\TheyWorkForYou\Topic();
17 18
 }
18 19
 
@@ -46,7 +47,8 @@  discard block
 block discarded – undo
46 47
 if (!is_null($success)) {
47 48
     if ($success) {
48 49
         $out = "<h4>Update successful</h4>";
49
-    } else {
50
+    }
51
+    else {
50 52
         $out = "<h4>Failed to update Topic</h4>";
51 53
     }
52 54
     print $out;
Please login to merge, or discard this patch.
www/docs/admin/alert_stats.php 2 patches
Spacing   +18 added lines, -18 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');
@@ -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->field('0', 'c') ),
24
-        array( 'Not Confirmed', $q_not_confirmed->field('0', 'c') ),
25
-        array( 'Deleted', $q_deleted->field('0', 'c') ),
26
-        array( 'For a Speaker<sup>*</sup>', $q_speaker->field('0', 'c') ),
27
-        array( 'For a Keyword', $q_keyword->field('0', 'c') ),
23
+        array('Confirmed', $q_confirmed->field('0', 'c')),
24
+        array('Not Confirmed', $q_not_confirmed->field('0', 'c')),
25
+        array('Deleted', $q_deleted->field('0', 'c')),
26
+        array('For a Speaker<sup>*</sup>', $q_speaker->field('0', 'c')),
27
+        array('For a Keyword', $q_keyword->field('0', 'c')),
28 28
     )
29 29
 );
30 30
 
@@ -35,17 +35,17 @@  discard block
 block discarded – undo
35 35
 $q = $db->query('select alert_id, criteria from alerts where criteria not like "%speaker:%" and criteria like "%,%" and confirmed and not deleted');
36 36
 print '<h3>People who probably wanted separate signups</h3>';
37 37
 $rows = array();
38
-for ($i=0; $i<$q->rows(); $i++) {
38
+for ($i = 0; $i < $q->rows(); $i++) {
39 39
     $id = $q->field($i, 'alert_id');
40 40
     $criteria = $q->field($i, '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');
47 47
 $tots = array(); $name = array();
48
-for ($i=0; $i<$q->rows(); $i++) {
48
+for ($i = 0; $i < $q->rows(); $i++) {
49 49
     $c = $q->field($i, 'c');
50 50
     $criteria = $q->field($i, 'criteria');
51 51
     if (!preg_match('#^speaker:(\d+)#', $criteria, $m)) continue;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 }
60 60
 $q = $db->query('select count(*) as c, criteria from alerts where criteria like "speaker:%" and not confirmed group by criteria order by c desc');
61 61
 $unconfirmed = array();
62
-for ($i=0; $i<$q->rows(); $i++) {
62
+for ($i = 0; $i < $q->rows(); $i++) {
63 63
     $c = $q->field($i, 'c');
64 64
     $criteria = $q->field($i, 'criteria');
65 65
     if (!preg_match('#^speaker:(\d+)#', $criteria, $m)) continue;
@@ -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);
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
 $confirmed = array();
88 88
 $total = array();
89 89
 $q = $db->query("select count(*) as c, criteria from alerts where criteria not like '%speaker:%' and confirmed and not deleted group by criteria having c>1 order by c desc");
90
-for ($i=0; $i<$q->rows(); $i++) {
90
+for ($i = 0; $i < $q->rows(); $i++) {
91 91
     $c = $q->field($i, 'c');
92 92
     $criteria = $q->field($i, 'criteria');
93 93
     $confirmed[$criteria] = $c;
94 94
     $total[$criteria] = 1;
95 95
 }
96 96
 $q = $db->query("select count(*) as c, criteria from alerts where criteria not like '%speaker:%' and not confirmed group by criteria having c>1 order by c desc");
97
-for ($i=0; $i<$q->rows(); $i++) {
97
+for ($i = 0; $i < $q->rows(); $i++) {
98 98
     $c = $q->field($i, 'c');
99 99
     $criteria = $q->field($i, 'criteria');
100 100
     $unconfirmed[$criteria] = $c;
@@ -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.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,11 +48,15 @@  discard block
 block discarded – undo
48 48
 for ($i=0; $i<$q->rows(); $i++) {
49 49
     $c = $q->field($i, 'c');
50 50
     $criteria = $q->field($i, 'criteria');
51
-    if (!preg_match('#^speaker:(\d+)#', $criteria, $m)) continue;
51
+    if (!preg_match('#^speaker:(\d+)#', $criteria, $m)) {
52
+        continue;
53
+    }
52 54
     $person_id = $m[1];
53 55
     $MEMBER = new MEMBER(array('person_id'=>$person_id));
54 56
     if ($MEMBER->valid) {
55
-        if (!array_key_exists($person_id, $tots)) $tots[$person_id] = 0;
57
+        if (!array_key_exists($person_id, $tots)) {
58
+            $tots[$person_id] = 0;
59
+        }
56 60
         $tots[$person_id] += $c;
57 61
         $name[$person_id] = $MEMBER->full_name();
58 62
     }
@@ -62,10 +66,14 @@  discard block
 block discarded – undo
62 66
 for ($i=0; $i<$q->rows(); $i++) {
63 67
     $c = $q->field($i, 'c');
64 68
     $criteria = $q->field($i, 'criteria');
65
-    if (!preg_match('#^speaker:(\d+)#', $criteria, $m)) continue;
69
+    if (!preg_match('#^speaker:(\d+)#', $criteria, $m)) {
70
+        continue;
71
+    }
66 72
     $person_id = $m[1];
67 73
     if (isset($name[$person_id])) {
68
-        if (!array_key_exists($person_id, $unconfirmed)) $unconfirmed[$person_id] = 0;
74
+        if (!array_key_exists($person_id, $unconfirmed)) {
75
+            $unconfirmed[$person_id] = 0;
76
+        }
69 77
         $unconfirmed[$person_id] += $c;
70 78
     }
71 79
 }
Please login to merge, or discard this patch.
www/docs/admin/reporting_stats.php 1 patch
Spacing   +2 added lines, -2 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'=>'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>';
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 print '<thead><tr><th>Year</th><th style="padding-right: 15px;">Month</th><th>Sign Ups</th><tr></thead>';
17 17
 
18 18
 $row_count = $q->rows();
19
-for ($i=0; $i<$row_count; $i++) {
19
+for ($i = 0; $i < $row_count; $i++) {
20 20
     $year = $q->field($i, 'the_year');
21 21
     $month = $q->field($i, 'the_month');
22 22
     $count = $q->field($i, 'c');
Please login to merge, or discard this patch.
www/docs/admin/statistics.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,10 +38,10 @@
 block discarded – undo
38 38
 <p>There are <b><?=number_format($debate_speeches)?></b> debate speeches (<?=number_format($debate_items)?> items including headers).
39 39
 <br>There are <b><?=number_format($wrans_questions)?></b> written questions (<?=number_format($wrans_items)?> items including headers and answers).
40 40
 
41
-<!-- Debate items / in-session day: <?=round($debate_items/$uniquedates,0)?>
42
-Wrans items / in-session day: <?=round($wrans_items/$uniquedates,0)?> -->
41
+<!-- Debate items / in-session day: <?=round($debate_items / $uniquedates, 0)?>
42
+Wrans items / in-session day: <?=round($wrans_items / $uniquedates, 0)?> -->
43 43
 
44
-<p>Per sitting day, MPs are producing <b><?=round($debate_speeches/$uniquedates,0)?></b> speeches, and <b><?=round($wrans_questions/$uniquedates,0)?></b> written answers.
44
+<p>Per sitting day, MPs are producing <b><?=round($debate_speeches / $uniquedates, 0)?></b> speeches, and <b><?=round($wrans_questions / $uniquedates, 0)?></b> written answers.
45 45
 </p>
46 46
 
47 47
 <?php
Please login to merge, or discard this patch.
www/docs/search-hansard/index.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
 $DATA->set_page_metadata($this_page, 'title', 'Hansard');
8 8
 $DATA->set_page_metadata($this_page, 'meta_description',
9
-             'Find the complete Hansard on TheyWorkForYou.com - transcripts from all UK parliamentary debates in easily-searchable form.');
9
+                'Find the complete Hansard on TheyWorkForYou.com - transcripts from all UK parliamentary debates in easily-searchable form.');
10 10
 $DATA->set_page_metadata($this_page, 'meta_keywords', "hansard, search hansard, hansard transcriptions, hansard record, parliamentary transcripts, parliament transcripts, parliament records, uk hansard, hansard uk, house of commons transcript, house of commons debates, house of commons records");
11 11
 
12 12
 $PAGE->supress_heading = true;
Please login to merge, or discard this patch.
www/docs/mps/multiple.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,9 @@
 block discarded – undo
28 28
 
29 29
 function out($h1, $h2, $title) {
30 30
     global $out;
31
-    if (!isset($out[$h1][$h2])) return;
31
+    if (!isset($out[$h1][$h2])) {
32
+        return;
33
+    }
32 34
     print "<h3>$title</h3>\n<ul>\n";
33 35
     foreach ($out[$h1][$h2] as $m) {
34 36
         print '<li><a href="' . $m->url() . '">' . $m->full_name() . "</a></li>\n";
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
     from member as m1, member as m2
13 13
     where m1.person_id = m2.person_id and m1.house != m2.house and m1.house < m2.house
14 14
         and m1.left_house='9999-12-31' and m2.left_house='9999-12-31'");
15
-for ($i=0; $i<$q->rows(); $i++) {
15
+for ($i = 0; $i < $q->rows(); $i++) {
16 16
     $pid = $q->field($i, 'person_id');
17 17
     $member = new MEMBER(array('person_id' => $pid));
18 18
     $h1 = $q->field($i, 'house1');
Please login to merge, or discard this patch.
www/docs/parliament/index.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
 $DATA->set_page_metadata($this_page, 'title', 'Parliament');
8 8
 $DATA->set_page_metadata($this_page, 'meta_description',
9
-             'What goes on in Parliament? Up-to-the-minute records on all MPs, debates, speeches and statements from the House of Commons, House of Lords, Scottish Parliament, and Northern Ireland Assembly.');
9
+                'What goes on in Parliament? Up-to-the-minute records on all MPs, debates, speeches and statements from the House of Commons, House of Lords, Scottish Parliament, and Northern Ireland Assembly.');
10 10
 $DATA->set_page_metadata($this_page, 'meta_keywords', 'parliament, uk parliament, parliamentary, house of commons, house commons, house of lords, house lords, house of parliament, parliment, houses parliament, parliament uk, member of parliament, welsh assembly, scottish parliament, the parliament, house of parliment, houses of parliment, parliment uk, uk parliment, houses of parliament, parliament houses, parliament of uk, parliament in uk, the house of parliament, scottish parliment, members of parliament, parliament members, scotish parliament, parliament scottish, the house of commons, british parliament, what is parliament, the house of lords, the scottish parliament, london parliament, parliament london, the houses of parliament, english parliament, northern ireland parliament, the british parliament, northern ireland assembly, history of parliament, parliament history, parliament of england, england parliament');
11 11
 
12 12
 $PAGE->supress_heading = true;
Please login to merge, or discard this patch.
www/docs/news/home_page_include.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@
 block discarded – undo
7 7
 
8 8
 $c = 0;
9 9
 foreach ($all_news as $id => $news_row) {
10
-    if ($c++ == 2) break;
10
+    if ($c++ == 2) {
11
+        break;
12
+    }
11 13
     list($title, $content, $date) = $news_row;
12 14
     $url = news_individual_link($date, $title);
13 15
     print "<h5><a href=\"$url\">" . $title . "</a></h5>";
Please login to merge, or discard this patch.