Passed
Pull Request — master (#1428)
by Nick
06:09
created
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 2 patches
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.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,11 +48,15 @@  discard block
 block discarded – undo
48 48
 foreach ($q as $row) {
49 49
     $c = $row['c'];
50 50
     $criteria = $row['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
 foreach ($q as $row) {
63 67
     $c = $row['c'];
64 68
     $criteria = $row['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/video/stamps.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 $video = \MySociety\TheyWorkForYou\Utility\Video::fromTimestamp($videodb, $adate, $atime);
20 20
 if (!$video) exit;
21 21
 
22
-$start = date('H:i:s', strtotime($video['broadcast_start']. ' GMT'));
22
+$start = date('H:i:s', strtotime($video['broadcast_start'] . ' GMT'));
23 23
 $end = date('H:i:s', strtotime($video['broadcast_end'] . ' GMT'));
24 24
 
25 25
 $q = $db->query("select video_timestamps.gid, adate, atime, time_to_sec(timediff(atime, '$start')) as timediff,
@@ -37,22 +37,22 @@  discard block
 block discarded – undo
37 37
     $gid = str_replace('uk.org.publicwhip/', '', $row['gid']);
38 38
     if (isset($gids[$gid])) continue;
39 39
     $timetoend = $row['timetoend'] - $file_offset;
40
-    if ($timetoend>0) {
40
+    if ($timetoend > 0) {
41 41
         $video = \MySociety\TheyWorkForYou\Utility\Video::fromTimestamp($videodb, $row['adate'], $row['atime']);
42
-        $new_start = date('H:i:s', strtotime($video['broadcast_start']. ' GMT'));
42
+        $new_start = date('H:i:s', strtotime($video['broadcast_start'] . ' GMT'));
43 43
         $file_offset += timediff($new_start, $start);
44 44
         $start = $new_start;
45 45
         $end = date('H:i:s', strtotime($video['broadcast_end'] . ' GMT'));
46 46
     }
47 47
     $timediff = $row['timediff'] - $file_offset;
48
-    if ($timediff>=0)
48
+    if ($timediff >= 0)
49 49
         print "<stamp><gid>$gid</gid><file>$video[id]</file><time>$timediff</time></stamp>\n";
50 50
     $gids[$gid] = true;
51 51
 }
52 52
 print '</stamps>';
53 53
 
54 54
 function timediff($a, $b) {
55
-    return substr($a, 0, 2)*3600 + substr($a, 3, 2)*60 + substr($a, 6, 2)
56
-        - substr($b, 0, 2)*3600 - substr($b, 3, 2)*60 - substr($b, 6, 2);
55
+    return substr($a, 0, 2) * 3600 + substr($a, 3, 2) * 60 + substr($a, 6, 2)
56
+        - substr($b, 0, 2) * 3600 - substr($b, 3, 2) * 60 - substr($b, 6, 2);
57 57
 
58 58
 }
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@  discard block
 block discarded – undo
17 17
 $adate = $q['adate'];
18 18
 $atime = $q['atime'];
19 19
 $video = \MySociety\TheyWorkForYou\Utility\Video::fromTimestamp($videodb, $adate, $atime);
20
-if (!$video) exit;
20
+if (!$video) {
21
+    exit;
22
+}
21 23
 
22 24
 $start = date('H:i:s', strtotime($video['broadcast_start']. ' GMT'));
23 25
 $end = date('H:i:s', strtotime($video['broadcast_end'] . ' GMT'));
@@ -35,7 +37,9 @@  discard block
 block discarded – undo
35 37
 print '<stamps>';
36 38
 foreach ($q as $row) {
37 39
     $gid = str_replace('uk.org.publicwhip/', '', $row['gid']);
38
-    if (isset($gids[$gid])) continue;
40
+    if (isset($gids[$gid])) {
41
+        continue;
42
+    }
39 43
     $timetoend = $row['timetoend'] - $file_offset;
40 44
     if ($timetoend>0) {
41 45
         $video = \MySociety\TheyWorkForYou\Utility\Video::fromTimestamp($videodb, $row['adate'], $row['atime']);
@@ -45,8 +49,9 @@  discard block
 block discarded – undo
45 49
         $end = date('H:i:s', strtotime($video['broadcast_end'] . ' GMT'));
46 50
     }
47 51
     $timediff = $row['timediff'] - $file_offset;
48
-    if ($timediff>=0)
49
-        print "<stamp><gid>$gid</gid><file>$video[id]</file><time>$timediff</time></stamp>\n";
52
+    if ($timediff>=0) {
53
+            print "<stamp><gid>$gid</gid><file>$video[id]</file><time>$timediff</time></stamp>\n";
54
+    }
50 55
     $gids[$gid] = true;
51 56
 }
52 57
 print '</stamps>';
Please login to merge, or discard this patch.
www/docs/video/index.php 2 patches
Braces   +80 added lines, -33 removed lines patch added patch discarded remove patch
@@ -47,8 +47,12 @@  discard block
 block discarded – undo
47 47
 $htime = $q['htime'];
48 48
 $atime = $q['atime'];
49 49
 $adate = $q['adate'];
50
-if ($atime) $htime = $atime;
51
-if ($adate) $hdate = $adate;
50
+if ($atime) {
51
+    $htime = $atime;
52
+}
53
+if ($adate) {
54
+    $hdate = $adate;
55
+}
52 56
 $parent_gid = str_replace('uk.org.publicwhip/debate/', '/debates/?id=', $q['parent_gid']);
53 57
 $parent_gid = str_replace('uk.org.publicwhip/lords/', '/lords/?gid=', $parent_gid);
54 58
 $parent_body = $q['parent_body'];
@@ -88,8 +92,12 @@  discard block
 block discarded – undo
88 92
 $gids_following = array();
89 93
 $gid_actual = array();
90 94
 foreach ($q as $row) {
91
-    if ($row['adate']) $row['hdate'] = $row['adate'];
92
-    if ($row['atime']) $row['htime'] = $row['atime'];
95
+    if ($row['adate']) {
96
+        $row['hdate'] = $row['adate'];
97
+    }
98
+    if ($row['atime']) {
99
+        $row['htime'] = $row['atime'];
100
+    }
93 101
     if ($row['hpos'] < $hpos) {
94 102
         $gids_previous[] = $row;
95 103
     } elseif ($row['hpos'] > $hpos) {
@@ -132,14 +140,20 @@  discard block
 block discarded – undo
132 140
 }
133 141
 $video = \MySociety\TheyWorkForYou\Utility\Video::fromTimestamp($videodb, $hdate, $htime);
134 142
 
135
-if (!$start)
143
+if (!$start) {
136 144
     $start = $video['offset'] - $offset;
137
-if ($start < 0) $start = 0;
145
+}
146
+if ($start < 0) {
147
+    $start = 0;
148
+}
138 149
 
139
-if (get_http_var('barcamp'))
150
+if (get_http_var('barcamp')) {
140 151
     $video['id'] -= 4000;
152
+}
141 153
 
142
-if (!$file) $file = $video['id'];
154
+if (!$file) {
155
+    $file = $video['id'];
156
+}
143 157
 
144 158
 # Start displaying
145 159
 
@@ -273,14 +287,26 @@  discard block
 block discarded – undo
273 287
     global $THEUSER;
274 288
     if ($THEUSER->user_id() && ($rank_today || $rank_week || $rank_overall)) {
275 289
         echo '<p align="center"><big>You are ';
276
-        if ($rank_today) echo make_ranking($rank_today), ' today, ';
277
-        if ($rank_week) echo make_ranking($rank_week), ' last 4 weeks, ';
278
-        if ($rank_overall) echo make_ranking($rank_overall), ' overall';
290
+        if ($rank_today) {
291
+            echo make_ranking($rank_today), ' today, ';
292
+        }
293
+        if ($rank_week) {
294
+            echo make_ranking($rank_week), ' last 4 weeks, ';
295
+        }
296
+        if ($rank_overall) {
297
+            echo make_ranking($rank_overall), ' overall';
298
+        }
279 299
         echo '</big></p>';
280 300
     }
281
-    if ($out_today) echo "<h3>Top timestampers (today)</h3> <ol>$out_today</ol>";
282
-    if ($out_week) echo "<h3>Top timestampers (last 4 weeks)</h3> <ol>$out_week</ol>";
283
-    if ($out_overall) echo "<h3>Top timestampers (overall)</h3> <ol>$out_overall</ol>";
301
+    if ($out_today) {
302
+        echo "<h3>Top timestampers (today)</h3> <ol>$out_today</ol>";
303
+    }
304
+    if ($out_week) {
305
+        echo "<h3>Top timestampers (last 4 weeks)</h3> <ol>$out_week</ol>";
306
+    }
307
+    if ($out_overall) {
308
+        echo "<h3>Top timestampers (overall)</h3> <ol>$out_overall</ol>";
309
+    }
284 310
     echo '</div>';
285 311
 ?>
286 312
 <div style="float: right; width: 50%">
@@ -347,18 +373,24 @@  discard block
 block discarded – undo
347 373
         $name = $row['firstname'] . ' ' . $row['lastname'];
348 374
         $user_id = $row['user_id'];
349 375
         #if ($user_id == -1) continue; # $name = 'CaptionerBot';
350
-        if ($user_id == 0) $name = 'Anonymous';
376
+        if ($user_id == 0) {
377
+            $name = 'Anonymous';
378
+        }
351 379
         $count = $row['c'];
352 380
         if ($THEUSER->user_id() == $user_id) {
353 381
             $rank = $i+1;
354 382
         }
355
-        if ($i>=$limit) continue;
383
+        if ($i>=$limit) {
384
+            continue;
385
+        }
356 386
         $out .= '<li>';
357
-        if ($THEUSER->user_id() == $user_id)
358
-            $out .= '<strong>';
387
+        if ($THEUSER->user_id() == $user_id) {
388
+                    $out .= '<strong>';
389
+        }
359 390
         $out .= "$name : $count";
360
-        if ($THEUSER->user_id() == $user_id)
361
-            $out .= '</strong>';
391
+        if ($THEUSER->user_id() == $user_id) {
392
+                    $out .= '</strong>';
393
+        }
362 394
         #if ($user_id == -1) {
363 395
         #	echo ' <small>(initial run program that tries to guess timestamp from captions, wildly variable)</small>';
364 396
         #}
@@ -377,8 +409,10 @@  discard block
 block discarded – undo
377 409
 
378 410
 function basic_instructions($pid) {
379 411
     $pid_url = '';
380
-    if ($pid) $pid_url = "&amp;pid=$pid";
381
-?>
412
+    if ($pid) {
413
+        $pid_url = "&amp;pid=$pid";
414
+    }
415
+    ?>
382 416
 <ol style="font-size: 150%;">
383 417
 <li>Have a quick scan of the speech under the video, then press &ldquo;Play&rdquo;.
384 418
 <li>When you hear the start of that speech, press &ldquo;Now!&rdquo;.
@@ -396,8 +430,10 @@  discard block
 block discarded – undo
396 430
 function basic_hints($gid_safe, $file, $pid) {
397 431
     global $THEUSER;
398 432
     $pid_url = '';
399
-    if ($pid) $pid_url = "&amp;pid=$pid";
400
-?>
433
+    if ($pid) {
434
+        $pid_url = "&amp;pid=$pid";
435
+    }
436
+    ?>
401 437
 
402 438
 <ul>
403 439
 <?php	if (!$THEUSER->loggedin()) { ?>
@@ -427,8 +463,10 @@  discard block
 block discarded – undo
427 463
 function advanced_hints($gid_safe, $file, $pid) {
428 464
     global $THEUSER;
429 465
     $pid_url = '';
430
-    if ($pid) $pid_url = "&amp;pid=$pid";
431
-?>
466
+    if ($pid) {
467
+        $pid_url = "&amp;pid=$pid";
468
+    }
469
+    ?>
432 470
 
433 471
 <p align="center">Actions:
434 472
 <a href="/video/next.php?action=random">Skip</a> |
@@ -463,14 +501,23 @@  discard block
 block discarded – undo
463 501
 
464 502
 function disp_speech($row, $count) {
465 503
     echo '<li';
466
-    if ($row['htype']==13 || $row['htype']==14) echo ' class="unspoken"';
467
-    elseif ($row['htype']<12) echo ' class="heading"';
468
-    if (!($count%2)) echo ' style="background-color: #F5FDEA;"';
469
-    else echo ' style="background-color: #E8FDCB;"';
504
+    if ($row['htype']==13 || $row['htype']==14) {
505
+        echo ' class="unspoken"';
506
+    } elseif ($row['htype']<12) {
507
+        echo ' class="heading"';
508
+    }
509
+    if (!($count%2)) {
510
+        echo ' style="background-color: #F5FDEA;"';
511
+    } else {
512
+        echo ' style="background-color: #E8FDCB;"';
513
+    }
470 514
     echo '>';
471
-    if ($count) echo "<em>$count earlier:</em> ";
472
-    if ($row['htype']==12)
473
-        echo '<span class="video_name">' . $row['given_name'] . ' ' . $row['family_name'] . '</span> ';
515
+    if ($count) {
516
+        echo "<em>$count earlier:</em> ";
517
+    }
518
+    if ($row['htype']==12) {
519
+            echo '<span class="video_name">' . $row['given_name'] . ' ' . $row['family_name'] . '</span> ';
520
+    }
474 521
     echo $row['body'];
475 522
     echo '</li>';
476 523
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 $parent_body = $q['parent_body'];
55 55
 $parent_epid = $q['subsection_id'];
56 56
 
57
-if (!($video_status&1) || ($video_status&8)) {
57
+if (!($video_status & 1) || ($video_status & 8)) {
58 58
     $PAGE->error_message('That GID does not appear to have any video. Please visit the <a href="/video/">video front page</a>.', true, 404);
59 59
     exit;
60 60
 }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 <?php
178 178
     $hidden_int = (isset($_COOKIE['hideVideoInt']) && $_COOKIE['hideVideoInt']);
179 179
     echo '<table id="video_table" border="0" cellspacing="0" cellpadding="5"><tr valign="top"><td width="50%">';
180
-    if ($gid_actual['video_status']&4) {
180
+    if ($gid_actual['video_status'] & 4) {
181 181
         $max = $db->query("select timediff(current_timestamp,max(whenstamped)) as ws from video_timestamps where gid='$q_gid' and (user_id is null or user_id != -1) and deleted=0")->first()['ws'];
182 182
         echo '<p class="informational">Thanks, but this speech has <strong>already been stamped</strong>';
183 183
         if ($max < '00:15:00') {
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
         $count = $row['c'];
239 239
         $totaliser[$status] = $count;
240 240
     }
241
-    $percentage = round($totaliser[4] / ($totaliser[0]+$totaliser[4]) * 10000) / 100;
241
+    $percentage = round($totaliser[4] / ($totaliser[0] + $totaliser[4]) * 10000) / 100;
242 242
     $out = "$totaliser[4] timestamped out of " . ($totaliser[0] + $totaliser[4]) . " ($percentage%)"
243 243
 ?>
244 244
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
     $q = $db->query('select firstname,lastname,video_timestamps.user_id,count(*) as c
342 342
         from video_timestamps left join users on video_timestamps.user_id=users.user_id
343 343
         where video_timestamps.deleted=0 and (video_timestamps.user_id is null or video_timestamps.user_id!=-1) '
344
-        . $q . ' group by user_id order by c desc' . ($THEUSER->user_id() ? '' : " limit $limit") );
344
+        . $q . ' group by user_id order by c desc' . ($THEUSER->user_id() ? '' : " limit $limit"));
345 345
     $out = ''; $rank = 0;
346 346
     $i = 0;
347 347
     foreach ($q as $row) {
@@ -351,9 +351,9 @@  discard block
 block discarded – undo
351 351
         if ($user_id == 0) $name = 'Anonymous';
352 352
         $count = $row['c'];
353 353
         if ($THEUSER->user_id() == $user_id) {
354
-            $rank = $i+1;
354
+            $rank = $i + 1;
355 355
         }
356
-        if ($i>=$limit) continue;
356
+        if ($i >= $limit) continue;
357 357
         $out .= '<li>';
358 358
         if ($THEUSER->user_id() == $user_id)
359 359
             $out .= '<strong>';
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 <?php	} ?>
408 408
 <li>If the video suddenly <strong>jumps</strong> a couple of hours, or otherwise appears broken, <a href="mailto:<?=str_replace('@', '&#64;', CONTACTEMAIL) ?>?subject=Video%20<?=$file?>%20for%20ID%20<?=$gid_safe?>%20broken">let us know</a>.
409 409
 <li>If the speech you're looking for is <strong>beyond the end</strong> of the video,
410
-<a href="/video/?gid=<?=$gid_safe?>&amp;file=<?=$file+1?>&amp;start=1<?=$pid_url?>">move on to the next video chunk</a>.
410
+<a href="/video/?gid=<?=$gid_safe?>&amp;file=<?=$file + 1?>&amp;start=1<?=$pid_url?>">move on to the next video chunk</a>.
411 411
 <li>If you're right at the start of a day, it's quite possible the start of the video
412 412
 will be the end of the previous programme on BBC Parliament, skip ahead some minutes
413 413
 to check :)
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 <a href="/user/login/?ret=/video/">Log in</a> |
439 439
 <?php	} ?>
440 440
 <a href="mailto:<?=str_replace('@', '&#64;', CONTACTEMAIL) ?>?subject=Video%20<?=$file?>%20for%20ID%20<?=$gid_safe?>%20broken">Broken video</a> |
441
-<a href="/video/?gid=<?=$gid_safe?>&amp;file=<?=$file+1?>&amp;start=1<?=$pid_url?>" title="Loads the next video chunk">Speech past end of video</a>
441
+<a href="/video/?gid=<?=$gid_safe?>&amp;file=<?=$file + 1?>&amp;start=1<?=$pid_url?>" title="Loads the next video chunk">Speech past end of video</a>
442 442
 </p>
443 443
 
444 444
 <p align="right"><small><!-- <b>Credits:</b> Video from <a href='http://www.bbc.co.uk/parliament/'>BBC Parliament</a> and mySociety. -->
@@ -465,13 +465,13 @@  discard block
 block discarded – undo
465 465
 
466 466
 function disp_speech($row, $count) {
467 467
     echo '<li';
468
-    if ($row['htype']==13 || $row['htype']==14) echo ' class="unspoken"';
469
-    elseif ($row['htype']<12) echo ' class="heading"';
470
-    if (!($count%2)) echo ' style="background-color: #F5FDEA;"';
468
+    if ($row['htype'] == 13 || $row['htype'] == 14) echo ' class="unspoken"';
469
+    elseif ($row['htype'] < 12) echo ' class="heading"';
470
+    if (!($count % 2)) echo ' style="background-color: #F5FDEA;"';
471 471
     else echo ' style="background-color: #E8FDCB;"';
472 472
     echo '>';
473 473
     if ($count) echo "<em>$count earlier:</em> ";
474
-    if ($row['htype']==12)
474
+    if ($row['htype'] == 12)
475 475
         echo '<span class="video_name">' . $row['given_name'] . ' ' . $row['family_name'] . '</span> ';
476 476
     echo $row['body'];
477 477
     echo '</li>';
Please login to merge, or discard this patch.
www/docs/video/distance.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
     $want['hpos'] = $q['hpos'];
56 56
 
57 57
     $LIST = new DEBATELIST;
58
-        $args = array (
58
+        $args = array(
59 59
             's' => $search,
60 60
             'p' => 1,
61 61
             'num' => 200,
Please login to merge, or discard this patch.
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.