Failed Conditions
Pull Request — master (#1327)
by Nick
11:49
created
www/docs/alert/authed.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,8 +16,9 @@  discard block
 block discarded – undo
16 16
 $email = get_http_var('email');
17 17
 $sign = get_http_var('sign');
18 18
 $pid = get_http_var('pid');
19
-if (!$pid || !ctype_digit($pid)) print 'not valid';
20
-else {
19
+if (!$pid || !ctype_digit($pid)) {
20
+    print 'not valid';
21
+} else {
21 22
     $authed = auth_verify_with_shared_secret($email, OPTION_AUTH_SHARED_SECRET, $sign);
22 23
     if ($authed) {
23 24
         $db = new ParlDB;
@@ -26,10 +27,11 @@  discard block
 block discarded – undo
26 27
             ':criteria' => 'speaker:' . $pid
27 28
             ));
28 29
         $already_signed = $q->rows();
29
-        if ($already_signed)
30
-            print "already signed";
31
-        else
32
-            print "not signed";
30
+        if ($already_signed) {
31
+                    print "already signed";
32
+        } else {
33
+                    print "not signed";
34
+        }
33 35
     } else {
34 36
         print "not authed";
35 37
     }
Please login to merge, or discard this patch.
www/docs/search/rss/index.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,8 +44,9 @@
 block discarded – undo
44 44
         $pagetitle .= " page $pagenum";
45 45
     }
46 46
     $num = get_http_var('n');
47
-    if (!is_numeric($num) || $num <= 0)
48
-        $num = 20;
47
+    if (!is_numeric($num) || $num <= 0) {
48
+            $num = 20;
49
+    }
49 50
 
50 51
     $DATA->set_page_metadata($this_page, 'title', $pagetitle);
51 52
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 # vim:sw=4:ts=4:et:nowrap
3 3
 
4 4
 include_once '../../../includes/easyparliament/init.php';
5
-include_once INCLUDESPATH."easyparliament/member.php";
6
-include_once INCLUDESPATH."easyparliament/glossary.php";
5
+include_once INCLUDESPATH . "easyparliament/member.php";
6
+include_once INCLUDESPATH . "easyparliament/glossary.php";
7 7
 
8 8
 if (!DEVSITE) {
9 9
     header('Cache-Control: max-age=86400'); # Once a day
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     $DATA->set_page_metadata($this_page, 'title', $pagetitle);
51 51
 
52
-    $args = array (
52
+    $args = array(
53 53
         's' => $searchstring,
54 54
         'p' => $pagenum,
55 55
         'pop' => 1,
Please login to merge, or discard this patch.
www/docs/hansardbugs/index.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@  discard block
 block discarded – undo
2 2
 
3 3
 $this_page = 'hansard_bugs';
4 4
 include_once '../../includes/easyparliament/init.php';
5
-$DATA->set_page_metadata($this_page, 'heading','Official Hansard problems');
5
+$DATA->set_page_metadata($this_page, 'heading', 'Official Hansard problems');
6 6
 
7 7
 $PAGE->page_start();
8 8
 $PAGE->stripe_start();
9 9
 
10
-$PAGE->block_start(array ('title'=>'Things currently noticeable to the user'));
10
+$PAGE->block_start(array('title'=>'Things currently noticeable to the user'));
11 11
 ?>
12 12
 
13 13
 <style type="text/css">
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
 <?php
112 112
 $PAGE->block_end();
113
-$PAGE->block_start(array ('title'=>'Things not noticeable to the user'));
113
+$PAGE->block_start(array('title'=>'Things not noticeable to the user'));
114 114
 ?>
115 115
 
116 116
 <ul>
Please login to merge, or discard this patch.
www/docs/departments/index.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,9 @@
 block discarded – undo
33 33
     if (isset($arr[3])) {
34 34
         print '<a href="'.$link.'/questions">Written Questions</a>';
35 35
     }
36
-    if (count($arr)==2)
37
-        print ' | ';
36
+    if (count($arr)==2) {
37
+            print ' | ';
38
+    }
38 39
     if (isset($arr[4])) {
39 40
         print '<a href="'.$link.'/statements">Written Ministerial Statements</a>';
40 41
     }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     group by body, major
17 17
     order by body');
18 18
 $data = array();
19
-for ($i=0; $i<$q->rows(); $i++) {
19
+for ($i = 0; $i < $q->rows(); $i++) {
20 20
     $body = $q->field($i, 'body');
21 21
     $major = $q->field($i, 'major');
22 22
     $data[$body][$major] = true;
@@ -26,17 +26,17 @@  discard block
 block discarded – undo
26 26
 
27 27
 print '<ul>';
28 28
 foreach ($data as $body => $arr) {
29
-    $link = strtolower(str_replace(' ','_',$body));
29
+    $link = strtolower(str_replace(' ', '_', $body));
30 30
     print '<li>';
31 31
     print $body;
32 32
     print ' &mdash; ';
33 33
     if (isset($arr[3])) {
34
-        print '<a href="'.$link.'/questions">Written Questions</a>';
34
+        print '<a href="' . $link . '/questions">Written Questions</a>';
35 35
     }
36
-    if (count($arr)==2)
36
+    if (count($arr) == 2)
37 37
         print ' | ';
38 38
     if (isset($arr[4])) {
39
-        print '<a href="'.$link.'/statements">Written Ministerial Statements</a>';
39
+        print '<a href="' . $link . '/statements">Written Ministerial Statements</a>';
40 40
     }
41 41
     print '</li>';
42 42
 }
Please login to merge, or discard this patch.
www/docs/video/stamps.php 2 patches
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.
Spacing   +7 added lines, -7 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,
@@ -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 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.
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
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.
Spacing   +3 added lines, -3 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
Please login to merge, or discard this patch.
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.