Completed
Pull Request — master (#1322)
by Nick
07:54 queued 02:46
created
www/docs/random/index.php 1 patch
Spacing   +2 added lines, -2 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/glossary.php";
4
+include_once INCLUDESPATH."easyparliament/glossary.php";
5 5
 
6 6
 $this_page = "debate";
7 7
 $this_page = "debates";
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 $q = $db->query("select gid from hansard where htype in (10,11) and major=1 and hdate='$date' order by rand() limit 1");
15 15
 $gid = $q->field(0, 'gid');
16 16
 
17
-$args = array (
17
+$args = array(
18 18
     'gid' => fix_gid_from_db($gid),
19 19
     'sort' => 'regexp_replace',
20 20
 );
Please login to merge, or discard this patch.
www/docs/video/stamps.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  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'));
23
-$end = date('H:i:s', strtotime($video['broadcast_end'] . ' GMT'));
22
+$start = date('H:i:s', strtotime($video['broadcast_start'].' GMT'));
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,
26 26
         time_to_sec(timediff(atime, '$end')) as timetoend
@@ -33,26 +33,26 @@  discard block
 block discarded – undo
33 33
 $gids = array();
34 34
 $file_offset = 0;
35 35
 print '<stamps>';
36
-for ($i=0; $i<$q->rows(); $i++) {
36
+for ($i = 0; $i < $q->rows(); $i++) {
37 37
     $gid = str_replace('uk.org.publicwhip/', '', $q->field($i, 'gid'));
38 38
     if (isset($gids[$gid])) continue;
39 39
     $timetoend = $q->field($i, 'timetoend') - $file_offset;
40
-    if ($timetoend>0) {
40
+    if ($timetoend > 0) {
41 41
         $video = \MySociety\TheyWorkForYou\Utility\Video::fromTimestamp($videodb, $q->field($i, 'adate'), $q->field($i, '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
-        $end = date('H:i:s', strtotime($video['broadcast_end'] . ' GMT'));
45
+        $end = date('H:i:s', strtotime($video['broadcast_end'].' GMT'));
46 46
     }
47 47
     $timediff = $q->field($i, '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->field(0, 'adate');
18 18
 $atime = $q->field(0, '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
 for ($i=0; $i<$q->rows(); $i++) {
37 39
     $gid = str_replace('uk.org.publicwhip/', '', $q->field($i, 'gid'));
38
-    if (isset($gids[$gid])) continue;
40
+    if (isset($gids[$gid])) {
41
+        continue;
42
+    }
39 43
     $timetoend = $q->field($i, 'timetoend') - $file_offset;
40 44
     if ($timetoend>0) {
41 45
         $video = \MySociety\TheyWorkForYou\Utility\Video::fromTimestamp($videodb, $q->field($i, 'adate'), $q->field($i, '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 = $q->field($i, '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/distance.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,12 +50,12 @@
 block discarded – undo
50 50
 
51 51
     $db = new ParlDB;
52 52
     $q = $db->query("select hpos from hansard where gid = :gid", array(
53
-        ':gid' => 'uk.org.publicwhip/' . $want['gid']
53
+        ':gid' => 'uk.org.publicwhip/'.$want['gid']
54 54
         ));
55 55
     $want['hpos'] = $q->field(0, '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/delete.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@  discard block
 block discarded – undo
5 5
 $gid = get_http_var('gid');
6 6
 $oops = get_http_var('oops');
7 7
 
8
-if (!$oops || !$gid) exit;
8
+if (!$oops || !$gid) {
9
+    exit;
10
+}
9 11
 
10 12
 $gid = "uk.org.publicwhip/$gid";
11 13
 
@@ -16,7 +18,8 @@  discard block
 block discarded – undo
16 18
 
17 19
 $db = new ParlDB;
18 20
 $q = $db->query("update video_timestamps set deleted=1 where id = :oops and gid = :gid and current_timestamp<whenstamped+interval 30 second", $params);
19
-if ($q->affected_rows())
21
+if ($q->affected_rows()) {
20 22
     $db->query("update hansard set video_status = video_status & 11 where gid = :gid", $params);
23
+}
21 24
 
22 25
 print "<status>OK</status>";
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->field(0, 'htime');
19 19
 $atime = $q->field(0, 'atime');
20 20
 $adate = $q->field(0, '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/video/next.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 $major = intval(get_http_var('major'));
8 8
 if (!$major) $major = 1;
9 9
 
10
-if ($action == 'next' || $action=='nextneeded') {
10
+if ($action == 'next' || $action == 'nextneeded') {
11 11
     $gid = get_http_var('gid');
12 12
     $file = intval(get_http_var('file'));
13 13
     $time = intval(get_http_var('time'));
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     $q = $db->query("select gid, hpos from hansard
28 28
         where hpos>$hpos and hdate='$hdate' and major=$major
29 29
         and (htype=12 or htype=13) "
30
-        . ($action=='nextneeded'?'and video_status in (1,3)':'') . "
30
+        . ($action == 'nextneeded' ? 'and video_status in (1,3)' : '')."
31 31
         ORDER BY hpos LIMIT 1");
32 32
     if (!$q->rows()) {
33 33
         $PAGE->page_start();
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     } else {
42 42
         $new_gid = $q->field(0, 'gid');
43 43
         $new_hpos = $q->field(0, 'hpos');
44
-        if ($action=='nextneeded') {
44
+        if ($action == 'nextneeded') {
45 45
             $q = $db->query("select adate, atime from hansard, video_timestamps
46 46
                 where hansard.gid = video_timestamps.gid and deleted=0
47 47
                     and hpos<$new_hpos and hdate='$hdate' and major=$major
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             }
58 58
         }
59 59
         $new_gid = fix_gid_but_leave_section($new_gid);
60
-        header('Location: /video/?from=next&file=' . $file . '&gid=' . $new_gid . '&start=' . $time);
60
+        header('Location: /video/?from=next&file='.$file.'&gid='.$new_gid.'&start='.$time);
61 61
     }
62 62
 } elseif ($action == 'random' && $pid) {
63 63
     $db = new ParlDB;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         and hansard.person_id=:pid
68 68
         ORDER BY RAND() LIMIT 1", array(':major' => $major, ':pid' => $pid));
69 69
     $new_gid = fix_gid_but_leave_section($q->field(0, 'gid'));
70
-    header('Location: /video/?from=random&pid=' . $pid . '&gid=' . $new_gid);
70
+    header('Location: /video/?from=random&pid='.$pid.'&gid='.$new_gid);
71 71
 } elseif ($action == 'random') {
72 72
     $db = new ParlDB;
73 73
     $q = $db->query("select gid, hpos, hdate from hansard
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     }
96 96
     */
97 97
     $gid = fix_gid_but_leave_section($gid);
98
-    header('Location: /video/?from=random&gid=' . $gid);
98
+    header('Location: /video/?from=random&gid='.$gid);
99 99
 } else {
100 100
     # Illegal action
101 101
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
 $action = get_http_var('action');
6 6
 $pid = intval(get_http_var('pid'));
7 7
 $major = intval(get_http_var('major'));
8
-if (!$major) $major = 1;
8
+if (!$major) {
9
+    $major = 1;
10
+}
9 11
 
10 12
 if ($action == 'next' || $action=='nextneeded') {
11 13
     $gid = get_http_var('gid');
Please login to merge, or discard this patch.
www/docs/user/changepc/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 if ($THEUSER->isloggedin()) {
10 10
     // They can't change their postcode here, so send them to the editing page.
11 11
     $URL = new URL('useredit');
12
-    header("Location: " . $URL->generate());
12
+    header("Location: ".$URL->generate());
13 13
 }
14 14
 
15 15
 if (get_http_var('forget') == 't') {
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
     // The cookie will have already been read for this page, so we need to reload.
20 20
     $URL = new URL($this_page);
21
-    header("Location: " . $URL->generate());
21
+    header("Location: ".$URL->generate());
22 22
 }
23 23
 
24 24
 if (!$THEUSER->postcode_is_set()) {
Please login to merge, or discard this patch.
www/docs/user/confirm/index.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 // We then print a nice welcome message.
12 12
 
13 13
 include_once '../../../includes/easyparliament/init.php';
14
-include_once INCLUDESPATH . "easyparliament/member.php";
14
+include_once INCLUDESPATH."easyparliament/member.php";
15 15
 
16 16
 if (get_http_var('welcome') == 't') {
17 17
     // The user has successfully clicked the link, been logged in, and
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         }
69 69
 
70 70
         $PAGE->stripe_end(array(
71
-            array (
71
+            array(
72 72
                 'type'		=> 'include',
73 73
                 'content'	=> 'userconfirmed'
74 74
             )
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
     // The user's first visit to this page, and they have a registration token.
81 81
     // So let's confirm them and hope they get logged in...
82 82
 
83
-    if (get_http_var('c') == 'email' ) {
84
-        $success = $THEUSER->confirm_email( get_http_var('t') );
83
+    if (get_http_var('c') == 'email') {
84
+        $success = $THEUSER->confirm_email(get_http_var('t'));
85 85
     } else {
86
-        $success = $THEUSER->confirm( get_http_var('t') );
86
+        $success = $THEUSER->confirm(get_http_var('t'));
87 87
     }
88 88
 
89 89
     if (!$success) {
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
     $this_page = 'userconfirmfailed';
104 104
 
105
-    if ( !$PAGE->page_started() ) {
105
+    if (!$PAGE->page_started()) {
106 106
         $PAGE->page_start();
107 107
 
108 108
         $PAGE->stripe_start();
Please login to merge, or discard this patch.
www/docs/user/password/index.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
             if ($success) {
63 63
 
64
-                print "<p>A new password has been sent to " . _htmlentities($email) . "</p>\n";
64
+                print "<p>A new password has been sent to "._htmlentities($email)."</p>\n";
65 65
 
66 66
             } else {
67 67
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         } else {
75 75
             // This email address isn't in the DB.
76 76
 
77
-            $errors["passwordchange"] = "Sorry, there was a problem and we couldn't set a new password for " . _htmlentities($email);
77
+            $errors["passwordchange"] = "Sorry, there was a problem and we couldn't set a new password for "._htmlentities($email);
78 78
 
79 79
 
80 80
             display_page($errors);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
 
92 92
 
93
-function display_page ($errors=array()) {
93
+function display_page($errors = array()) {
94 94
     global $this_page, $PAGE;
95 95
 
96 96
     if (isset($errors["sending"])) {
Please login to merge, or discard this patch.