Failed Conditions
Pull Request — master (#1325)
by Nick
26:10 queued 21:10
created
www/docs/admin/searchlogs.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
     $host = trim_characters($host, strlen($host) - 25, 100);
19 19
     $time = relative_time($row['query_time']);
20 20
     $time = str_replace(" ago", "", $time);
21
-    $rows[] = array (
22
-        '<a href="'.$row['url'].'">' . _htmlentities($row['query']) . '</a>',
21
+    $rows[] = array(
22
+        '<a href="'.$row['url'].'">'._htmlentities($row['query']).'</a>',
23 23
         $row['page_number'],
24 24
         $row['count_hits'],
25 25
         $host,
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
     );
28 28
 }
29 29
 
30
-$tabledata = array (
31
-    'header' => array (
30
+$tabledata = array(
31
+    'header' => array(
32 32
         'Query',
33 33
         'Page',
34 34
         'Hits',
Please login to merge, or discard this patch.
www/docs/admin/glossary_pending.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
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'];
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
     // Wiki woo!
96 96
     // We need to work out how best to work this...
97
-    $wiki_link = _htmlspecialchars("http://en.wikipedia.org/wiki/" . strtr($title, " ", "_"));
97
+    $wiki_link = _htmlspecialchars("http://en.wikipedia.org/wiki/".strtr($title, " ", "_"));
98 98
 ?>
99 99
         <p>Guessing the wikipedia link - give it a go:<br>
100 100
         <a href="<?php echo $wiki_link; ?>" target="_blank"><?php echo $wiki_link; ?></a></p>
@@ -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')
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     }
127 127
 
128 128
     if ($EDITQUEUE->pending_count) {
129
-        print "<h3>" . $EDITQUEUE->pending_count . " Pending Glossary terms</h3>";
129
+        print "<h3>".$EDITQUEUE->pending_count." Pending Glossary terms</h3>";
130 130
         $EDITQUEUE->display("pending");
131 131
     }
132 132
     else {
Please login to merge, or discard this patch.
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.
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/admin/index.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
 $q = $db->query("SELECT COUNT(*) AS count FROM users WHERE confirmed = '0'");
23 23
 $unconfirmedusers = $q->field(0, 'count');
24 24
 
25
-$olddate = gmdate("Y-m-d H:i:s", time()-86400);
25
+$olddate = gmdate("Y-m-d H:i:s", time() - 86400);
26 26
 $q = $db->query("SELECT COUNT(*) AS count FROM users WHERE lastvisit > '$olddate'");
27 27
 $dayusers = $q->field(0, 'count');
28 28
 
29
-$olddate = gmdate("Y-m-d H:i:s", time()-86400*7);
29
+$olddate = gmdate("Y-m-d H:i:s", time() - 86400 * 7);
30 30
 $q = $db->query("SELECT COUNT(*) AS count FROM users WHERE lastvisit > '$olddate'");
31 31
 $weekusers = $q->field(0, 'count');
32 32
 ?>
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 $rows = array();
62 62
 $USERURL = new URL('userview');
63 63
 
64
-for ($row=0; $row<$q->rows(); $row++) {
64
+for ($row = 0; $row < $q->rows(); $row++) {
65 65
 
66 66
     $user_id = $q->field($row, 'user_id');
67 67
 
@@ -69,23 +69,23 @@  discard block
 block discarded – undo
69 69
 
70 70
     if ($q->field($row, 'confirmed') == 1) {
71 71
         $confirmed = 'Yes';
72
-        $name = '<a href="' . $USERURL->generate() . '">' . _htmlspecialchars($q->field($row, 'firstname'))
73
-            . ' ' . _htmlspecialchars($q->field($row, 'lastname')) . '</a>';
72
+        $name = '<a href="'.$USERURL->generate().'">'._htmlspecialchars($q->field($row, 'firstname'))
73
+            . ' '._htmlspecialchars($q->field($row, 'lastname')).'</a>';
74 74
     } else {
75 75
         $confirmed = 'No';
76
-        $name = _htmlspecialchars($q->field($row, 'firstname') . ' ' . $q->field($row, 'lastname'));
76
+        $name = _htmlspecialchars($q->field($row, 'firstname').' '.$q->field($row, 'lastname'));
77 77
     }
78 78
 
79
-    $rows[] = array (
79
+    $rows[] = array(
80 80
         $name,
81
-        '<a href="mailto:' . $q->field($row, 'email') . '">' . $q->field($row, 'email') . '</a>',
81
+        '<a href="mailto:'.$q->field($row, 'email').'">'.$q->field($row, 'email').'</a>',
82 82
         $confirmed,
83 83
         $q->field($row, 'registrationtime')
84 84
     );
85 85
 }
86 86
 
87
-$tabledata = array (
88
-    'header' => array (
87
+$tabledata = array(
88
+    'header' => array(
89 89
         'Name',
90 90
         'Email',
91 91
         'Confirmed?',
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/report/index.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
     if ($COMMENT->exists() == false || !$COMMENT->visible()) {
22 22
         // This comment id didn't exist in the DB.
23
-        trigger_error("There is no annotation with an ID of '" . _htmlentities($comment_id) . "'.", E_USER_NOTICE);
23
+        trigger_error("There is no annotation with an ID of '"._htmlentities($comment_id)."'.", E_USER_NOTICE);
24 24
     }
25 25
 
26 26
     // OK, we've got a valid comment ID.
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
             $REPORT = new COMMENTREPORT;
58 58
 
59
-            $reportdata = array (
59
+            $reportdata = array(
60 60
                 'body'		=> get_http_var('body'),
61 61
                 'firstname'	=> get_http_var('firstname'),
62 62
                 'lastname'	=> get_http_var('lastname'),
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
 
86 86
             } else {
87
-                $PAGE->error_message ("Sorry, we were unable to add the report to the database.");
87
+                $PAGE->error_message("Sorry, we were unable to add the report to the database.");
88 88
             }
89 89
         }
90 90
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
 
101 101
 
102
-function display_form($COMMENT, $errors=array()) {
102
+function display_form($COMMENT, $errors = array()) {
103 103
     global $this_page, $THEUSER, $PAGE;
104 104
 
105 105
     ?>
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 <?php
123 123
     if ($THEUSER->isloggedin()) {
124 124
         ?>
125
-                <p><br><strong>From:</strong> <?php echo _htmlentities($THEUSER->firstname() . ' ' . $THEUSER->lastname()); ?></p>
125
+                <p><br><strong>From:</strong> <?php echo _htmlentities($THEUSER->firstname().' '.$THEUSER->lastname()); ?></p>
126 126
 <?php
127 127
     } else {
128 128
         // Not-logged-in user, so we want their name and email address.
Please login to merge, or discard this patch.
www/docs/vote/index.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         voteerror("Your browser must be able to accept cookies before you can register a vote.");
32 32
     } else {
33 33
         // Delete the test cookie.
34
-        setcookie ('testcookie', '');
34
+        setcookie('testcookie', '');
35 35
     }
36 36
     // On with the voting...!
37 37
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     // We need to check the user can accept cookies, so...
41 41
 
42 42
     // Set a cookie
43
-    setcookie ('testcookie', 'true');
43
+    setcookie('testcookie', 'true');
44 44
 
45 45
     $ret = get_http_var('ret');
46 46
     $id = get_http_var('id');
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     ));
57 57
 
58 58
     // Redirect to this same URL with 'testing=true' on the end.
59
-    header("Location: " . $URL->generate('none'));
59
+    header("Location: ".$URL->generate('none'));
60 60
     exit;
61 61
 }
62 62
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
     $PAGE->page_start();
69 69
 
70
-    $message = array (
70
+    $message = array(
71 71
         'title'	=> 'Sorry',
72 72
         'text'	=> $text
73 73
     );
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         $prev_epvotes[] = $epobject_id;
159 159
         $new_cookie = implode('+', $prev_epvotes);
160 160
 
161
-        setcookie ("epvotes", $new_cookie, time()+60*60*24*365, "/", COOKIEDOMAIN);
161
+        setcookie("epvotes", $new_cookie, time() + 60 * 60 * 24 * 365, "/", COOKIEDOMAIN);
162 162
 
163 163
 
164 164
     } else {
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 
190 190
 $PAGE->page_start();
191 191
 
192
-$message = array (
192
+$message = array(
193 193
     'title'	=> "Thanks for your vote",
194 194
     'text'	=> "<strong>Would you like to ask a question like this yourself?</strong> Use our <a href=\"http://www.whatdotheyknow.com\">Freedom of Information site</a>."
195 195
 );
Please login to merge, or discard this patch.
www/docs/email/index.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 $this_page = "emailfriend";
4 4
 
5 5
 include_once '../../includes/easyparliament/init.php';
6
-include_once INCLUDESPATH . 'easyparliament/member.php';
6
+include_once INCLUDESPATH.'easyparliament/member.php';
7 7
 
8 8
 $PAGE->page_start();
9 9
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 if (sizeof($errors)) {
33 33
     print '<p>Please correct the following errors:</p>';
34
-    print '<ul><li>' . join('</li> <li>', $errors) . '</li></ul><br>';
34
+    print '<ul><li>'.join('</li> <li>', $errors).'</li></ul><br>';
35 35
 ?>
36 36
 <form action="./" method="post">
37 37
 <p>
@@ -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
-        'subject'       => 'Find out all about ' . $rep_name
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,
Please login to merge, or discard this patch.
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.
www/docs/calendar/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
         }
63 63
     }
64 64
 
65
-    include_once INCLUDESPATH . 'easyparliament/templates/html/calendar_date.php';
65
+    include_once INCLUDESPATH.'easyparliament/templates/html/calendar_date.php';
66 66
 }
67 67
 
68 68
 # ---
Please login to merge, or discard this patch.