Failed Conditions
Pull Request — master (#1327)
by Nick
11:49
created
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/glossary.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
30 30
         'epobject_type' => 2
31 31
     );
32 32
     $EDITQUEUE->approve($data);
33
-}
34
-elseif (get_http_var('decline')) {
33
+} elseif (get_http_var('decline')) {
35 34
     $decline = array (get_http_var('decline'));
36 35
     // Dump all declined items
37 36
     $data = array (
@@ -39,8 +38,7 @@  discard block
 block discarded – undo
39 38
         'epobject_type' => 2
40 39
     );
41 40
     $EDITQUEUE->decline($data);
42
-}
43
-elseif (get_http_var('delete_confirm')) {
41
+} elseif (get_http_var('delete_confirm')) {
44 42
     $delete_id = get_http_var('delete_confirm');
45 43
     // Delete the existing glossary entry
46 44
     $GLOSSARY->delete($delete_id);
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,14 +2,14 @@  discard block
 block discarded – undo
2 2
 // Some sketchy crap for displaying pending glossary additions
3 3
 
4 4
 include_once '../../includes/easyparliament/init.php';
5
-include_once (INCLUDESPATH."easyparliament/editqueue.php");
6
-include_once (INCLUDESPATH."easyparliament/glossary.php");
5
+include_once (INCLUDESPATH . "easyparliament/editqueue.php");
6
+include_once (INCLUDESPATH . "easyparliament/glossary.php");
7 7
 
8 8
 $this_page = "admin_glossary";
9 9
 
10 10
 $EDITQUEUE = new GLOSSEDITQUEUE();
11 11
 
12
-$args = array (
12
+$args = array(
13 13
     'sort' => "regexp_replace"
14 14
 );
15 15
 
@@ -22,19 +22,19 @@  discard block
 block discarded – undo
22 22
 if (get_http_var('approve')) {
23 23
     $approve = get_http_var('approve');
24 24
     if (!is_array($approve)) {
25
-        $approve = array ( $approve );
25
+        $approve = array($approve);
26 26
     }
27 27
     // Add all approved items
28
-    $data = array (
28
+    $data = array(
29 29
         'approvals' => $approve,
30 30
         'epobject_type' => 2
31 31
     );
32 32
     $EDITQUEUE->approve($data);
33 33
 }
34 34
 elseif (get_http_var('decline')) {
35
-    $decline = array (get_http_var('decline'));
35
+    $decline = array(get_http_var('decline'));
36 36
     // Dump all declined items
37
-    $data = array (
37
+    $data = array(
38 38
         'declines' => $decline,
39 39
         'epobject_type' => 2
40 40
     );
Please login to merge, or discard this patch.
www/docs/admin/photos.php 3 patches
Braces   +36 added lines, -26 removed lines patch added patch discarded remove patch
@@ -36,28 +36,33 @@  discard block
 block discarded – undo
36 36
     $pid = intval(get_http_var('pid'));
37 37
     $errors = array();
38 38
 
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.');
45
-    else {
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.');
45
+    } else {
46 46
         $tmp_name = $_FILES['photo']['tmp_name'];
47 47
 
48 48
         $image = new Imagick();
49 49
         $image->readImage($tmp_name);
50
-        if (!$image)
51
-            array_push($errors, 'Failed to read image from uploaded file');
50
+        if (!$image) {
51
+                    array_push($errors, 'Failed to read image from uploaded file');
52
+        }
52 53
             $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");
54
+        if (!$image->scaleImage(0, 118)) {
55
+                    array_push($errors, 'Scaling large failed');
56
+        }
57
+        if (!$imageS->scaleImage(0, 59)) {
58
+                    array_push($errors, 'Scaling small failed');
59
+        }
60
+        if (!$image->writeImage("$dir/mpsL/$pid.jpeg")) {
61
+                    array_push($errors, "Saving to $dir/mpsL/$pid.jpeg failed");
62
+        }
63
+        if (!$imageS->writeImage("$dir/mps/$pid.jpeg")) {
64
+                    array_push($errors, "Saving to $dir/mps/$pid.jpeg failed");
65
+        }
61 66
         if (!$errors) {
62 67
             print "<pre>";
63 68
             chdir($dir);
@@ -70,8 +75,9 @@  discard block
 block discarded – undo
70 75
         }
71 76
     }
72 77
 
73
-    if ($errors)
74
-        return display_photo_form($errors);
78
+    if ($errors) {
79
+            return display_photo_form($errors);
80
+    }
75 81
     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 82
 }
77 83
 
@@ -99,7 +105,9 @@  discard block
 block discarded – undo
99 105
         $house = $q->field($i, 'house');
100 106
         $desc = member_full_name($house, $q->field($i, 'title'), $q->field($i, 'given_name'), $q->field($i, 'family_name'), $q->field($i, 'lordofname')) .
101 107
                 " " . $houses[$house];
102
-        if ($q->field($i, 'party')) $desc .= ' (' . $q->field($i, 'party') . ')';
108
+        if ($q->field($i, 'party')) {
109
+            $desc .= ' (' . $q->field($i, 'party') . ')';
110
+        }
103 111
         if ($q->field($i, 'constituency')) {
104 112
             $desc .= ', ' . $q->field($i, 'constituency');
105 113
         }
@@ -150,13 +158,15 @@  discard block
 block discarded – undo
150 158
     $attr_link = get_http_var('attr_link');
151 159
     $errors = array();
152 160
 
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');
161
+    if (!$pid || !$attr_text) {
162
+            array_push($errors, 'Missing information');
163
+    } elseif ($attr_link && substr($attr_link, 0, 4) != 'http') {
164
+            array_push($errors, 'Bad link');
165
+    }
157 166
 
158
-    if ($errors)
159
-        return display_attribution_form($errors);
167
+    if ($errors) {
168
+            return display_attribution_form($errors);
169
+    }
160 170
 
161 171
     # UPDATE
162 172
     global $db;
Please login to merge, or discard this patch.
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.
www/docs/admin/glossary_pending.php 2 patches
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,8 +32,7 @@  discard block
 block discarded – undo
32 32
         'epobject_type' => 2
33 33
     );
34 34
     $EDITQUEUE->approve($data);
35
-}
36
-elseif (get_http_var('decline')) {
35
+} elseif (get_http_var('decline')) {
37 36
     $decline = array (get_http_var('decline'));
38 37
     // Dump all declined items
39 38
     $data = array (
@@ -57,15 +56,13 @@  discard block
 block discarded – undo
57 56
     if (get_http_var('previewterm')) {
58 57
         $body	= get_http_var('definition');
59 58
         $title	= get_http_var('g');
60
-    }
61
-    else {
59
+    } else {
62 60
         $body = $EDITQUEUE->pending[$glossary_id]['body'];
63 61
         $title = $EDITQUEUE->pending[$glossary_id]['title'];
64 62
     }
65 63
     if (get_http_var('wikiguess')) {
66 64
         $checked = " checked";
67
-    }
68
-    else {
65
+    } else {
69 66
         $checked = "";
70 67
     }
71 68
 
@@ -111,8 +108,7 @@  discard block
 block discarded – undo
111 108
 
112 109
     $PAGE->glossary_display_term($GLOSSARY);
113 110
 
114
-}
115
-else {
111
+} else {
116 112
 
117 113
     // add a modification to the database
118 114
     if (get_http_var('submitterm') && get_http_var('modify')) {
@@ -128,8 +124,7 @@  discard block
 block discarded – undo
128 124
     if ($EDITQUEUE->pending_count) {
129 125
         print "<h3>" . $EDITQUEUE->pending_count . " Pending Glossary terms</h3>";
130 126
         $EDITQUEUE->display("pending");
131
-    }
132
-    else {
127
+    } else {
133 128
         print "<h3>Nothing pending, tap your fingers awhile.</h3>";
134 129
     }
135 130
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2,14 +2,14 @@  discard block
 block discarded – undo
2 2
 // Some sketchy crap for displaying pending glossary additions
3 3
 
4 4
 include_once '../../includes/easyparliament/init.php';
5
-include_once (INCLUDESPATH."easyparliament/editqueue.php");
6
-include_once (INCLUDESPATH."easyparliament/glossary.php");
5
+include_once (INCLUDESPATH . "easyparliament/editqueue.php");
6
+include_once (INCLUDESPATH . "easyparliament/glossary.php");
7 7
 
8 8
 $this_page = "admin_glossary_pending";
9 9
 
10 10
 $EDITQUEUE = new GLOSSEDITQUEUE();
11 11
 
12
-$args = array (
12
+$args = array(
13 13
     'sort' => "regexp_replace"
14 14
 );
15 15
 $GLOSSARY = new GLOSSARY($args);
@@ -24,19 +24,19 @@  discard block
 block discarded – undo
24 24
 if (get_http_var('approve')) {
25 25
     $approve = get_http_var('approve');
26 26
     if (!is_array($approve)) {
27
-        $approve = array ( $approve );
27
+        $approve = array($approve);
28 28
     }
29 29
     // Add all approved items
30
-    $data = array (
30
+    $data = array(
31 31
         'approvals' => $approve,
32 32
         'epobject_type' => 2
33 33
     );
34 34
     $EDITQUEUE->approve($data);
35 35
 }
36 36
 elseif (get_http_var('decline')) {
37
-    $decline = array (get_http_var('decline'));
37
+    $decline = array(get_http_var('decline'));
38 38
     // Dump all declined items
39
-    $data = array (
39
+    $data = array(
40 40
         'declines' => $decline,
41 41
         'epobject_type' => 2
42 42
     );
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 
56 56
     // Mock up a "current term" to send to the display function
57 57
     if (get_http_var('previewterm')) {
58
-        $body	= get_http_var('definition');
59
-        $title	= get_http_var('g');
58
+        $body = get_http_var('definition');
59
+        $title = get_http_var('g');
60 60
     }
61 61
     else {
62 62
         $body = $EDITQUEUE->pending[$glossary_id]['body'];
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
     // add a modification to the database
118 118
     if (get_http_var('submitterm') && get_http_var('modify')) {
119
-        $data = array (
119
+        $data = array(
120 120
             'user_id'	=> get_http_var('userid'),
121 121
             'title'		=> get_http_var('g'),
122 122
             'body'		=> get_http_var('definition')
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/email/index.php 2 patches
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,20 +14,25 @@  discard block
 block discarded – undo
14 14
 $sender_email = get_http_var('sender_mail');
15 15
 $sender_name = get_http_var('sender_name');
16 16
 $pid = intval(get_http_var('pid'));
17
-if ($pid)
17
+if ($pid) {
18 18
     $MEMBER = new MEMBER(array('person_id' => $pid));
19
+}
19 20
 
20 21
 //validate them
21 22
 $errors = array();
22 23
 
23
-if (!$pid)
24
+if (!$pid) {
24 25
     $errors[] = 'You did not get to this page from an MP or Peer page. Please go back and try again.';
25
-if (!preg_match('#^[^@]+@#', $recipient_email))
26
+}
27
+if (!preg_match('#^[^@]+@#', $recipient_email)) {
26 28
     $errors[] = "'$recipient_email' is not a valid recipient email address. Please have another go.";
27
-if (!validate_email($sender_email))
29
+}
30
+if (!validate_email($sender_email)) {
28 31
     $errors[] = "'$sender_email' is not a valid sender email address. Please have another go.";
29
-if (!$sender_name)
32
+}
33
+if (!$sender_name) {
30 34
     $errors[] = "If you don't give us your name, we can't tell the recipient who sent them the link. We won't store it or use for any other purpose than sending this email.";
35
+}
31 36
 
32 37
 if (sizeof($errors)) {
33 38
     print '<p>Please correct the following errors:</p>';
@@ -45,8 +50,11 @@  discard block
 block discarded – undo
45 50
 <?php
46 51
 } else {
47 52
     $rep_name = $MEMBER->full_name();
48
-    if ($MEMBER->house_disp==1) $rep_name .= ' MP';
49
-    elseif ($MEMBER->house_disp==3) $rep_name .= ' MLA';
53
+    if ($MEMBER->house_disp==1) {
54
+        $rep_name .= ' MP';
55
+    } elseif ($MEMBER->house_disp==3) {
56
+        $rep_name .= ' MLA';
57
+    }
50 58
     $data = array (
51 59
         'template'      => 'email_a_friend',
52 60
         'to'            => $recipient_email,
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,15 +45,15 @@  discard block
 block discarded – undo
45 45
 <?php
46 46
 } else {
47 47
     $rep_name = $MEMBER->full_name();
48
-    if ($MEMBER->house_disp==1) $rep_name .= ' MP';
49
-    elseif ($MEMBER->house_disp==3) $rep_name .= ' MLA';
50
-    $data = array (
48
+    if ($MEMBER->house_disp == 1) $rep_name .= ' MP';
49
+    elseif ($MEMBER->house_disp == 3) $rep_name .= ' MLA';
50
+    $data = array(
51 51
         'template'      => 'email_a_friend',
52 52
         'to'            => $recipient_email,
53 53
         'subject'       => 'Find out all about ' . $rep_name
54 54
     );
55 55
     $url = $MEMBER->url(true);
56
-    $merge = array (
56
+    $merge = array(
57 57
         'NAME' => $sender_name,
58 58
         'EMAIL' => $sender_email,
59 59
         'REP_NAME' => $rep_name,
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
     $success = send_template_email($data, $merge);
64 64
     if ($success) {
65
-        print "<p>Your email has been sent successfully. Thank you for using TheyWorkForYou.</p> <p><a href=\"$url\">Return to ".$MEMBER->full_name()."'s page</a></p>";
65
+        print "<p>Your email has been sent successfully. Thank you for using TheyWorkForYou.</p> <p><a href=\"$url\">Return to " . $MEMBER->full_name() . "'s page</a></p>";
66 66
     } else {
67 67
         print "<p>Sorry, something went wrong trying to send an email. Please wait a few minutes and try again.</p>";
68 68
     }
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.