Failed Conditions
Pull Request — master (#1327)
by Nick
11:49
created
www/docs/api/api_getMPsInfo.php 2 patches
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
         for ($i=0; $i<$q->rows(); $i++) {
34 36
             $data_key = $q->field($i, '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 = $q->field($i, 'person_id');
38 41
             $output[$pid][$data_key] = $q->field($i, 'data_value');
39 42
             $time = strtotime($q->field($i, '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
             for ($i=0; $i<$q->rows(); $i++) {
48 52
                 $data_key = $q->field($i, '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 = $q->field($i, 'member_id');
52 57
                 $pid = $q->field($i, '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] = $q->field($i, 'data_value');
56 65
                 $time = strtotime($q->field($i, '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.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         where person_id in (" . $ids . ")");
31 31
     if ($q->rows()) {
32 32
         $output = array();
33
-        for ($i=0; $i<$q->rows(); $i++) {
33
+        for ($i = 0; $i < $q->rows(); $i++) {
34 34
             $data_key = $q->field($i, 'data_key');
35 35
             if (count($fields) && !in_array($data_key, $fields))
36 36
                 continue;
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             where memberinfo.member_id=member.member_id and person_id in (" . $ids . ")
45 45
             order by person_id,member_id");
46 46
         if ($q->rows()) {
47
-            for ($i=0; $i<$q->rows(); $i++) {
47
+            for ($i = 0; $i < $q->rows(); $i++) {
48 48
                 $data_key = $q->field($i, 'data_key');
49 49
                 if (count($fields) && !in_array($data_key, $fields))
50 50
                     continue;
Please login to merge, or discard this patch.
www/docs/api/index.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,17 +26,17 @@  discard block
 block discarded – undo
26 26
     $match = 0;
27 27
     foreach ($methods as $method => $data) {
28 28
         if (strtolower($q_method) == strtolower($method)) {
29
-      if (isset($data['superuser']) && $data['superuser']) {
29
+        if (isset($data['superuser']) && $data['superuser']) {
30 30
         $super_check = api_is_superuser_key($key);
31 31
         if (!$super_check) {
32 32
                 if (get_http_var('docs')) {
33
-                  api_front_page();
33
+                    api_front_page();
34 34
                 } else {
35
-                  api_error('Invalid API key.');
36
-                  exit;
37
-              }
35
+                    api_error('Invalid API key.');
36
+                    exit;
37
+                }
38 38
             }
39
-      }
39
+        }
40 40
 
41 41
             api_log_call($key);
42 42
             $match++;
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
             '". Possible functions are: ' .
74 74
             join(', ', array_keys($methods));
75 75
         if (get_http_var('output')) {
76
-          api_error($msg);
76
+            api_error($msg);
77 77
         } else {
78
-          api_front_page($msg);
78
+            api_front_page($msg);
79 79
         }
80 80
     } else {
81 81
         if (get_http_var('docs')) {
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -103,13 +103,15 @@  discard block
 block discarded – undo
103 103
 <p>
104 104
 <?php foreach ($methods[$method]['parameters'] as $parameter) {
105 105
     print $parameter . ': <input type="text" name="'.$parameter.'" value="';
106
-    if ($val = get_http_var($parameter))
107
-        print _htmlspecialchars($val);
106
+    if ($val = get_http_var($parameter)) {
107
+            print _htmlspecialchars($val);
108
+    }
108 109
     print '" size="30"><br>';
109 110
 }
110 111
 ?>
111 112
 Output:
112
-<input id="output_js" type="radio" name="output" value="js"<?php if (get_http_var('output')=='js' || !get_http_var('output')) print ' checked'?>>
113
+<input id="output_js" type="radio" name="output" value="js"<?php if (get_http_var('output')=='js' || !get_http_var('output')) {
114
+    print ' checked'?>>
113 115
 <label for="output_js">JS</label>
114 116
 <input id="output_xml" type="radio" name="output" value="xml"<?php if (get_http_var('output')=='xml') print ' checked'?>>
115 117
 <label for="output_xml">XML</label>
@@ -124,9 +126,11 @@  discard block
 block discarded – undo
124 126
 <?php
125 127
     if ($explorer) {
126 128
         $qs = array();
129
+}
127 130
         foreach ($methods[$method]['parameters'] as $parameter) {
128
-            if (get_http_var($parameter))
129
-                $qs[] = _htmlspecialchars(rawurlencode($parameter) . '=' . urlencode(get_http_var($parameter)));
131
+            if (get_http_var($parameter)) {
132
+                            $qs[] = _htmlspecialchars(rawurlencode($parameter) . '=' . urlencode(get_http_var($parameter)));
133
+            }
130 134
         }
131 135
         print '<h4><a name="output"></a>Output</h4>';
132 136
         print '<p>URL for this: <strong>https://www.theyworkforyou.com/api/';
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             foreach ($data['parameters'] as $parameter) {
48 48
                 if ($q_param = trim(get_http_var($parameter))) {
49 49
                     $match++;
50
-                    include_once 'api_'. $method . '.php';
50
+                    include_once 'api_' . $method . '.php';
51 51
                     api_call_user_func_or_error('api_' . $method . '_' . $parameter, array($q_param), 'API call not yet functional', 'api');
52 52
                     break;
53 53
                 }
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
                     api_error('No parameter provided to function "' .
58 58
                     _htmlspecialchars($q_method) .
59 59
                         '". Possible choices are: ' .
60
-                        join(', ', $data['parameters']) );
60
+                        join(', ', $data['parameters']));
61 61
                 } else {
62
-                    include_once 'api_'. $method . '.php';
62
+                    include_once 'api_' . $method . '.php';
63 63
                     api_call_user_func_or_error('api_' . $method, array(), 'API call not yet functional', 'api');
64 64
                     break;
65 65
                 }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     $DATA->set_page_metadata($this_page, 'title', "$method function");
94 94
     $PAGE->page_start();
95 95
     $PAGE->stripe_start();
96
-    include_once 'api_'. $method . '.php';
96
+    include_once 'api_' . $method . '.php';
97 97
     print '<p align="center"><strong>https://www.theyworkforyou.com/api/' . $method . '</strong></p>';
98 98
     api_call_user_func_or_error('api_' . $method . '_front', array(), 'No documentation yet', 'html');
99 99
 ?>
@@ -102,20 +102,20 @@  discard block
 block discarded – undo
102 102
 <form method="get" action="?#output">
103 103
 <p>
104 104
 <?php foreach ($methods[$method]['parameters'] as $parameter) {
105
-    print $parameter . ': <input type="text" name="'.$parameter.'" value="';
105
+    print $parameter . ': <input type="text" name="' . $parameter . '" value="';
106 106
     if ($val = get_http_var($parameter))
107 107
         print _htmlspecialchars($val);
108 108
     print '" size="30"><br>';
109 109
 }
110 110
 ?>
111 111
 Output:
112
-<input id="output_js" type="radio" name="output" value="js"<?php if (get_http_var('output')=='js' || !get_http_var('output')) print ' checked'?>>
112
+<input id="output_js" type="radio" name="output" value="js"<?php if (get_http_var('output') == 'js' || !get_http_var('output')) print ' checked'?>>
113 113
 <label for="output_js">JS</label>
114
-<input id="output_xml" type="radio" name="output" value="xml"<?php if (get_http_var('output')=='xml') print ' checked'?>>
114
+<input id="output_xml" type="radio" name="output" value="xml"<?php if (get_http_var('output') == 'xml') print ' checked'?>>
115 115
 <label for="output_xml">XML</label>
116
-<input id="output_php" type="radio" name="output" value="php"<?php if (get_http_var('output')=='php') print ' checked'?>>
116
+<input id="output_php" type="radio" name="output" value="php"<?php if (get_http_var('output') == 'php') print ' checked'?>>
117 117
 <label for="output_php">Serialised PHP</label>
118
-<input id="output_rabx" type="radio" name="output" value="rabx"<?php if (get_http_var('output')=='rabx') print ' checked'?>>
118
+<input id="output_rabx" type="radio" name="output" value="rabx"<?php if (get_http_var('output') == 'rabx') print ' checked'?>>
119 119
 <label for="output_rabx">RABX</label>
120 120
 
121 121
 <input type="submit" value="Go">
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         }
131 131
         print '<h4><a name="output"></a>Output</h4>';
132 132
         print '<p>URL for this: <strong>https://www.theyworkforyou.com/api/';
133
-        print $method . '?' . join('&amp;', $qs) . '&amp;output='._htmlspecialchars(get_http_var('output')).'</strong></p>';
133
+        print $method . '?' . join('&amp;', $qs) . '&amp;output=' . _htmlspecialchars(get_http_var('output')) . '</strong></p>';
134 134
         print '<pre>' . _htmlspecialchars($explorer) . '</pre>';
135 135
     }
136 136
     $sidebar = api_sidebar();
Please login to merge, or discard this patch.
www/docs/glossary/index.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,8 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if (isset($term) && $term) {
3 3
     $this_page = 'glossary_item';
4
-}
5
-else {
4
+} else {
6 5
     $this_page = "glossary";
7 6
 }
8 7
 
@@ -50,8 +49,7 @@  discard block
 block discarded – undo
50 49
 if ($term) {
51 50
     $DATA->set_page_metadata($this_page, 'title', $term['title'].': Glossary item');
52 51
     $DATA->set_page_metadata($this_page, 'heading', $term['title']);
53
-}
54
-else {
52
+} else {
55 53
     $DATA->set_page_metadata ($this_page, 'title', $GLOSSARY->current_letter.': Glossary index');
56 54
     $DATA->set_page_metadata ($this_page, 'heading', 'Glossary index');
57 55
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 }
8 8
 
9 9
 include_once '../../includes/easyparliament/init.php';
10
-include_once INCLUDESPATH."easyparliament/glossary.php";
10
+include_once INCLUDESPATH . "easyparliament/glossary.php";
11 11
 
12 12
 $args = array(
13 13
     'sort'				=> "regexp_replace",
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
 }
49 49
 
50 50
 if ($term) {
51
-    $DATA->set_page_metadata($this_page, 'title', $term['title'].': Glossary item');
51
+    $DATA->set_page_metadata($this_page, 'title', $term['title'] . ': Glossary item');
52 52
     $DATA->set_page_metadata($this_page, 'heading', $term['title']);
53 53
 }
54 54
 else {
55
-    $DATA->set_page_metadata ($this_page, 'title', $GLOSSARY->current_letter.': Glossary index');
56
-    $DATA->set_page_metadata ($this_page, 'heading', 'Glossary index');
55
+    $DATA->set_page_metadata($this_page, 'title', $GLOSSARY->current_letter . ': Glossary index');
56
+    $DATA->set_page_metadata($this_page, 'heading', 'Glossary index');
57 57
 }
58 58
 
59 59
 $PAGE->page_start();
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
     $URL->update(array("gl" => $GLOSSARY->next_term['glossary_id']));
73 73
     $next_link = $URL->generate('url');
74 74
 
75
-    $nextprev = array (
76
-        'next'	=> array (
75
+    $nextprev = array(
76
+        'next'	=> array(
77 77
             'url'	=> $next_link,
78 78
             'title'	=> 'Next term',
79 79
             'body'	=> $GLOSSARY->next_term['title']
80 80
         ),
81
-        'prev'	=> array (
81
+        'prev'	=> array(
82 82
             'url'	=> $previous_link,
83 83
             'title'	=> 'Previous term',
84 84
             'body'	=> $GLOSSARY->previous_term['title']
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
     }
112 112
 }
113 113
 
114
-$PAGE->stripe_end(array (
115
-    array (
114
+$PAGE->stripe_end(array(
115
+    array(
116 116
         'type'		=> 'nextprev',
117 117
         'content'	=> ''
118 118
     )
Please login to merge, or discard this patch.
www/docs/bills/2005-06/legislative-and-regulatory-reform/index.php 2 patches
Braces   +14 added lines, -5 removed lines patch added patch discarded remove patch
@@ -96,7 +96,9 @@  discard block
 block discarded – undo
96 96
             }
97 97
             continue;
98 98
         }
99
-        if (substr($r, 0, 8)=='Bill 141') continue;
99
+        if (substr($r, 0, 8)=='Bill 141') {
100
+            continue;
101
+        }
100 102
         if (preg_match('#\s+([1-4]?[05])$#', $r, $m)) {
101 103
             if ($line != $m[1]) {
102 104
                 print "ERROR! $line $m[1] $r";
@@ -224,7 +226,9 @@  discard block
 block discarded – undo
224 226
             $insert = isset($m[4]) ? $m[4] : null;
225 227
             unset($amendments[$num]);
226 228
             $bill[$page][$line] = '<del title="'.$num.'">'.$bill[$page][$line].'</del>';
227
-            if ($insert) $bill[$page][$line] .= '<ins title="'.$num.'">'.$insert.'</ins>';
229
+            if ($insert) {
230
+                $bill[$page][$line] .= '<ins title="'.$num.'">'.$insert.'</ins>';
231
+            }
228 232
         }
229 233
         # Page 8, line 24 [Clause 14], at end insert-- `...'
230 234
         if (preg_match('#Page\s+(\d+), line (\d+) \[Clause (\d+)\], (?:at end|after subsection \(\d+\)) insert--\s+`(.*?)\'#s', $amendment, $m)) {
@@ -302,8 +306,11 @@  discard block
 block discarded – undo
302 306
                     }
303 307
                     if ($finished) {
304 308
                         for ($p = $subsubclause['startP']; $p<=$subsubclause['endP']; $p++) {
305
-                            if ($p>$subsubclause['startP']) $starti = 1;
306
-                            else $starti = $subsubclause['startL'];
309
+                            if ($p>$subsubclause['startP']) {
310
+                                $starti = 1;
311
+                            } else {
312
+                                $starti = $subsubclause['startL'];
313
+                            }
307 314
                             for ($i = $starti; $i<=$subsubclause['endL']; $i++) { # XXX Doesn't really work spanning pages
308 315
                                 $bill[$p][$i] = '<del title="'.$num.'">' . $bill[$p][$i] . '</del>';
309 316
                             }
@@ -321,7 +328,9 @@  discard block
 block discarded – undo
321 328
             foreach ($clauses[$clause] as $subclause_num => $subclause) {
322 329
                 foreach ($subclause as $subsubclause_num => $subsubclause) {
323 330
                     if ($subsubclause['endP'] > $page) { $page = $subsubclause['endP']; $line = 0; }
324
-                    if ($subsubclause['endL'] > $line) $line = $subsubclause['endL'];
331
+                    if ($subsubclause['endL'] > $line) {
332
+                        $line = $subsubclause['endL'];
333
+                    }
325 334
                 }
326 335
             }
327 336
             $bill[$page][$line] .= "<ins title='$num'>$amendment</ins>\n\n";
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@  discard block
 block discarded – undo
2 2
 
3 3
 $this_page = 'bill_index';
4 4
 include_once '../../../../includes/easyparliament/init.php';
5
-$DATA->set_page_metadata($this_page, 'heading','Legislative and Regulatory Reform Bill');
5
+$DATA->set_page_metadata($this_page, 'heading', 'Legislative and Regulatory Reform Bill');
6 6
 $PAGE->page_start();
7 7
 $PAGE->stripe_start();
8
-$PAGE->block_start(array ('title'=>'House of Commons - Normal Run'));
8
+$PAGE->block_start(array('title'=>'House of Commons - Normal Run'));
9 9
 ?>
10 10
 <ul>
11 11
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     parse_bill('2006141.txt');
46 46
     $amendments = read_amendments('amendments.txt'); # The amendments, by number
47 47
     parse_amendments();
48
-    $out = $title."\n\n";
48
+    $out = $title . "\n\n";
49 49
     $out .= "Page,Line\n";
50 50
     foreach ($bill as $page_num => $page) {
51 51
         foreach ($page as $line_num => $line) {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 print '</ul>';
60 60
 $PAGE->block_end();
61 61
 $includes = array(
62
-    array (
62
+    array(
63 63
         'type' => 'include',
64 64
         'content' => 'bills_intro'
65 65
     ),
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     $intitle = true;
78 78
     $title = '';
79 79
     foreach ($f as $r) {
80
-        if ($line<1) {
80
+        if ($line < 1) {
81 81
             $line++;
82 82
             continue;
83 83
         }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             }
97 97
             continue;
98 98
         }
99
-        if (substr($r, 0, 8)=='Bill 141') continue;
99
+        if (substr($r, 0, 8) == 'Bill 141') continue;
100 100
         if (preg_match('#\s+([1-4]?[05])$#', $r, $m)) {
101 101
             if ($line != $m[1]) {
102 102
                 print "ERROR! $line $m[1] $r";
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         if ($r == "\n") {
142 142
             continue;
143 143
         }
144
-        if ($line<1) {
144
+        if ($line < 1) {
145 145
             $line++;
146 146
             continue;
147 147
         }
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
             $number = $m[1];
156 156
             $amendments[$number] = '';
157 157
         } elseif (preg_match('#To move the following Clause#', $r)) {
158
-            preg_match('#\n(.*?)$#', $amendments[$number-1], $m);
159
-            $amendments[$number-1] = preg_replace('#\n(.*?)$#', '', $amendments[$number-1]);
158
+            preg_match('#\n(.*?)$#', $amendments[$number - 1], $m);
159
+            $amendments[$number - 1] = preg_replace('#\n(.*?)$#', '', $amendments[$number - 1]);
160 160
             $amendments[$number] .= '*' . trim($m[1]) . "*\n$r";
161 161
         } else {
162 162
             $amendments[$number] .= $r;
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
             $page = $m[1]; $line = $m[2]; $clause = $m[3];
181 181
             $from_text = $m[4]; $end_line = $m[5]; $insert = $m[6];
182 182
             unset($amendments[$num]);
183
-            $bill[$page][$line] = str_replace($from_text, "$from_text <del title='$num'>", $bill[$page][$line]) . '</del><ins title="'.$num.'">' . $insert . '</ins>';
184
-            for ($i=$line+1; $i<=$end_line; $i++) {
185
-                $bill[$page][$i] = '<del title="'.$num.'">' . $bill[$page][$i] . '</del>';
183
+            $bill[$page][$line] = str_replace($from_text, "$from_text <del title='$num'>", $bill[$page][$line]) . '</del><ins title="' . $num . '">' . $insert . '</ins>';
184
+            for ($i = $line + 1; $i <= $end_line; $i++) {
185
+                $bill[$page][$i] = '<del title="' . $num . '">' . $bill[$page][$i] . '</del>';
186 186
             }
187 187
         }
188 188
         # Page  4, line 9 [Clause 6], leave out from `under' to `creating' and insert `this Part making provision'
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
             $insert = $m[7];
200 200
             unset($amendments[$num]);
201 201
             $bill[$page][$from_line] = str_replace($from_text, "$from_text <del title='$num'>", $bill[$page][$from_line]) . '</del>';
202
-            for ($i=$from_line+1; $i<$to_line; $i++) {
203
-                $bill[$page][$i] = '<del title="'.$num.'">' . $bill[$page][$i] . '</del>';
202
+            for ($i = $from_line + 1; $i < $to_line; $i++) {
203
+                $bill[$page][$i] = '<del title="' . $num . '">' . $bill[$page][$i] . '</del>';
204 204
             }
205
-            $bill[$page][$to_line] = '<del title="'.$num.'">' . str_replace($to_text, "</del><ins title='$num'>$insert</ins> $to_text", $bill[$page][$to_line]);
205
+            $bill[$page][$to_line] = '<del title="' . $num . '">' . str_replace($to_text, "</del><ins title='$num'>$insert</ins> $to_text", $bill[$page][$to_line]);
206 206
         }
207 207
         # Page  3, line 13 [Clause 4], leave out from beginning to `confer' and insert `An order under this Part may not make provision to'
208 208
         if (preg_match('#Page\s+(\d+), line (\d+) \[Clause (\d+)\], leave out from beginning to `(.*?)\' and insert `(.*?)\'#s', $amendment, $m)) {
@@ -223,15 +223,15 @@  discard block
 block discarded – undo
223 223
             $page = $m[1]; $line = $m[3]; $clause = $m[2];
224 224
             $insert = isset($m[4]) ? $m[4] : null;
225 225
             unset($amendments[$num]);
226
-            $bill[$page][$line] = '<del title="'.$num.'">'.$bill[$page][$line].'</del>';
227
-            if ($insert) $bill[$page][$line] .= '<ins title="'.$num.'">'.$insert.'</ins>';
226
+            $bill[$page][$line] = '<del title="' . $num . '">' . $bill[$page][$line] . '</del>';
227
+            if ($insert) $bill[$page][$line] .= '<ins title="' . $num . '">' . $insert . '</ins>';
228 228
         }
229 229
         # Page 8, line 24 [Clause 14], at end insert-- `...'
230 230
         if (preg_match('#Page\s+(\d+), line (\d+) \[Clause (\d+)\], (?:at end|after subsection \(\d+\)) insert--\s+`(.*?)\'#s', $amendment, $m)) {
231 231
             $page = $m[1]; $line = $m[2]; $clause = $m[3];
232 232
             $insert = $m[4];
233 233
             unset($amendments[$num]);
234
-            $bill[$page][$line] .= '<ins title="'.$num.'">'.$insert.'</ins>';
234
+            $bill[$page][$line] .= '<ins title="' . $num . '">' . $insert . '</ins>';
235 235
         }
236 236
         # Title, line    1, leave out `reforming legislation' and insert `...'
237 237
         if (preg_match('#Title, line.*?, leave out `(.*?)\' and insert `(.*?)\'#s', $amendment, $m)) {
@@ -247,14 +247,14 @@  discard block
 block discarded – undo
247 247
             foreach ($clauses[$clause] as $subclause_num => $subclause) {
248 248
                 foreach ($subclause as $subsubclause_num => $subsubclause) {
249 249
                     $startP = $subsubclause['startP'];
250
-                    if ($startP==$page && $subsubclause['startL']==$line) {
250
+                    if ($startP == $page && $subsubclause['startL'] == $line) {
251 251
                         if ($startP == $subsubclause['endP']) {
252 252
                             unset($amendments[$num]);
253
-                            for ($i = $subsubclause['startL']; $i<=$subsubclause['endL']; $i++) {
254
-                                $bill[$page][$i] = '<del title="'.$num.'">' . $bill[$page][$i] . '</del>';
253
+                            for ($i = $subsubclause['startL']; $i <= $subsubclause['endL']; $i++) {
254
+                                $bill[$page][$i] = '<del title="' . $num . '">' . $bill[$page][$i] . '</del>';
255 255
                             }
256 256
                             if ($insert) {
257
-                                $bill[$page][$i-1] .= "<ins title='$num'>$insert</ins>";
257
+                                $bill[$page][$i - 1] .= "<ins title='$num'>$insert</ins>";
258 258
                             }
259 259
                         }
260 260
                     }
@@ -270,21 +270,21 @@  discard block
 block discarded – undo
270 270
             foreach ($clauses[$clause] as $subclause_num => $subclause) {
271 271
                 foreach ($subclause as $subsubclause_num => $subsubclause) {
272 272
                     $startP = $subsubclause['startP'];
273
-                    if ($startP==$page && $subsubclause['startL']==$line) {
273
+                    if ($startP == $page && $subsubclause['startL'] == $line) {
274 274
                         if ($startP == $subsubclause['endP']) {
275 275
                             unset($amendments[$num]);
276 276
                             $finished = true;
277 277
                         }
278 278
                     }
279 279
                     if ($finished) {
280
-                        for ($i = $subsubclause['startL']; $i<=$subsubclause['endL']; $i++) {
281
-                            $bill[$page][$i] = '<del title="'.$num.'">' . $bill[$page][$i] . '</del>';
280
+                        for ($i = $subsubclause['startL']; $i <= $subsubclause['endL']; $i++) {
281
+                            $bill[$page][$i] = '<del title="' . $num . '">' . $bill[$page][$i] . '</del>';
282 282
                         }
283 283
                     }
284 284
                 }
285 285
                 if ($finished) {
286 286
                     if ($insert) {
287
-                        $bill[$page][$i-1] .= "<ins title='$num'>$insert</ins>";
287
+                        $bill[$page][$i - 1] .= "<ins title='$num'>$insert</ins>";
288 288
                     }
289 289
                     break;
290 290
                 }
@@ -296,16 +296,16 @@  discard block
 block discarded – undo
296 296
             $finished = false;
297 297
             foreach ($clauses[$clause] as $subclause_num => $subclause) {
298 298
                 foreach ($subclause as $subsubclause_num => $subsubclause) {
299
-                    if ($subsubclause['startP']==$page && $subsubclause['startL']==$line) {
299
+                    if ($subsubclause['startP'] == $page && $subsubclause['startL'] == $line) {
300 300
                         unset($amendments[$num]);
301 301
                         $finished = true;
302 302
                     }
303 303
                     if ($finished) {
304
-                        for ($p = $subsubclause['startP']; $p<=$subsubclause['endP']; $p++) {
305
-                            if ($p>$subsubclause['startP']) $starti = 1;
304
+                        for ($p = $subsubclause['startP']; $p <= $subsubclause['endP']; $p++) {
305
+                            if ($p > $subsubclause['startP']) $starti = 1;
306 306
                             else $starti = $subsubclause['startL'];
307
-                            for ($i = $starti; $i<=$subsubclause['endL']; $i++) { # XXX Doesn't really work spanning pages
308
-                                $bill[$p][$i] = '<del title="'.$num.'">' . $bill[$p][$i] . '</del>';
307
+                            for ($i = $starti; $i <= $subsubclause['endL']; $i++) { # XXX Doesn't really work spanning pages
308
+                                $bill[$p][$i] = '<del title="' . $num . '">' . $bill[$p][$i] . '</del>';
309 309
                             }
310 310
                         }
311 311
                     }
Please login to merge, or discard this patch.
www/docs/bills/2005-06/identity-cards/index.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@  discard block
 block discarded – undo
2 2
 
3 3
 $this_page = 'bill_index';
4 4
 include_once '../../../../includes/easyparliament/init.php';
5
-$DATA->set_page_metadata($this_page, 'heading','Identity Cards Act 2006');
5
+$DATA->set_page_metadata($this_page, 'heading', 'Identity Cards Act 2006');
6 6
 
7 7
 $PAGE->page_start();
8 8
 $PAGE->stripe_start();
9 9
 
10
-$PAGE->block_start(array ('title'=>'House of Commons - Normal Run'));
10
+$PAGE->block_start(array('title'=>'House of Commons - Normal Run'));
11 11
 ?>
12 12
 <ul> <li>Back on 25th May 2005, a bill was introduced: the <a
13 13
 href="http://www.publications.parliament.uk/pa/cm200506/cmbills/009/2006009.htm">Identity
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 <?php
34 34
 $PAGE->block_end();
35
-$PAGE->block_start(array ('title'=>'House of Lords - Normal Run'));
35
+$PAGE->block_start(array('title'=>'House of Lords - Normal Run'));
36 36
 ?>
37 37
 
38 38
 <ul>
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 <?php
51 51
 $PAGE->block_end();
52
-$PAGE->block_start(array ('title'=>'Ping Pong'));
52
+$PAGE->block_start(array('title'=>'Ping Pong'));
53 53
 ?>
54 54
 
55 55
 <ul>
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 $PAGE->block_end();
95 95
 
96 96
     $includes = array(
97
-        array (
97
+        array(
98 98
             'type' => 'include',
99 99
             'content' => 'bills_intro'
100 100
         ),
Please login to merge, or discard this patch.
www/docs/divisions/division.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@
 block discarded – undo
43 43
             $data['mp_vote']['with_majority'] = true;
44 44
         }
45 45
     } else {
46
-      if ($data['division']['date'] < $MEMBER->entered_house(1)['date']) {
47
-          $data['before_mp'] = true;
48
-      } else if ($data['division']['date'] > $MEMBER->left_house(1)['date']) {
49
-          $data['after_mp'] = true;
50
-      }
46
+        if ($data['division']['date'] < $MEMBER->entered_house(1)['date']) {
47
+            $data['before_mp'] = true;
48
+        } else if ($data['division']['date'] > $MEMBER->left_house(1)['date']) {
49
+            $data['after_mp'] = true;
50
+        }
51 51
     }
52 52
 }
53 53
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
     }
52 52
 }
53 53
 
54
-$data['debate_time_human'] = False;
54
+$data['debate_time_human'] = false;
55 55
 $data['debate_day_human'] = format_date($data['division']['date'], LONGDATEFORMAT);
56 56
 $data['col_country'] = 'UK';
57 57
 $data['location'] = 'in the House of Commons';
Please login to merge, or discard this patch.
www/docs/divisions/index.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@
 block discarded – undo
10 10
 }
11 11
 
12 12
 if (isset($MEMBER)) {
13
-  $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER);
14
-  $data = array('divisions' => $divisions->getRecentMemberDivisions(30, 'Parliament'));
15
-  $data['mp_name'] = ucfirst($MEMBER->full_name());
13
+    $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER);
14
+    $data = array('divisions' => $divisions->getRecentMemberDivisions(30, 'Parliament'));
15
+    $data['mp_name'] = ucfirst($MEMBER->full_name());
16 16
 } else {
17
-  $divisions = new MySociety\TheyWorkForYou\Divisions();
18
-  $data = $divisions->getRecentDivisions(30);
17
+    $divisions = new MySociety\TheyWorkForYou\Divisions();
18
+    $data = $divisions->getRecentDivisions(30);
19 19
 }
20 20
 
21 21
 $data['last_updated'] = MySociety\TheyWorkForYou\Divisions::getMostRecentDivisionDate()['latest'];
Please login to merge, or discard this patch.
www/docs/wikipedia/index.php 2 patches
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -9,8 +9,9 @@  discard block
 block discarded – undo
9 9
     '212.35.252.2' => 'Liberal Democrats',
10 10
 );
11 11
 $ip = get_http_var('ip');
12
-if (!array_key_exists($ip, $site))
12
+if (!array_key_exists($ip, $site)) {
13 13
     $ip = '194.60.38.10';
14
+}
14 15
 
15 16
 $this_page = 'wikipedia';
16 17
 $DATA->set_page_metadata($this_page, 'title', 'Latest 100 changes to Wikipedia by non-logged-in computers in ' . $site[$ip]);
@@ -28,10 +29,11 @@  discard block
 block discarded – undo
28 29
 <p align="center"><?php
29 30
 $out = array();
30 31
 foreach ($site as $k => $v) {
31
-    if ($k == $ip)
32
-        $o = "<strong>$v</strong>";
33
-    else
34
-        $o = "<a href=\"./?ip=$k\">$v</a>";
32
+    if ($k == $ip) {
33
+            $o = "<strong>$v</strong>";
34
+    } else {
35
+            $o = "<a href=\"./?ip=$k\">$v</a>";
36
+    }
35 37
     $out[] = $o;
36 38
 }
37 39
 print join(' | ', $out);
@@ -53,11 +55,12 @@  discard block
 block discarded – undo
53 55
     $file = file_get_contents("cache/$row[1].$row[2]");
54 56
     $file = str_replace(array("\xe2\x86\x90","\xe2\x86\x92"), array('&larr;', '&rarr;'), $file);
55 57
     print "<h3>$row[3]</h3>";
56
-    if (preg_match('#<table.*?</table>#s', $file, $m))
57
-        print preg_replace('#href=(\'|")(.*?)\1#', 'href=\1http://en.wikipedia.org\2\1', $m[0]);
58
-    elseif (preg_match('#<div class="firstrevisionheader.*?</div>#s', $file, $m))
59
-        print preg_replace('#href=(\'|")(.*?)\1#', 'href=\1http://en.wikipedia.org\2\1', $m[0]);
60
-}
58
+    if (preg_match('#<table.*?</table>#s', $file, $m)) {
59
+            print preg_replace('#href=(\'|")(.*?)\1#', 'href=\1http://en.wikipedia.org\2\1', $m[0]);
60
+    } elseif (preg_match('#<div class="firstrevisionheader.*?</div>#s', $file, $m)) {
61
+            print preg_replace('#href=(\'|")(.*?)\1#', 'href=\1http://en.wikipedia.org\2\1', $m[0]);
62
+    }
63
+    }
61 64
 
62 65
 $PAGE->stripe_end();
63 66
 $PAGE->page_end();
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 preg_match_all('#<li>.*? \(<a[^>]*>hist</a>\) \(<a href=".*?title=(.*?)&.*?oldid=(.*?)"[^>]*>diff</a>\)  <a[^>]*>(.*?)</a> .*?</li>#', $file, $m, PREG_SET_ORDER);
52 52
 foreach ($m as $row) {
53 53
     $file = file_get_contents("cache/$row[1].$row[2]");
54
-    $file = str_replace(array("\xe2\x86\x90","\xe2\x86\x92"), array('&larr;', '&rarr;'), $file);
54
+    $file = str_replace(array("\xe2\x86\x90", "\xe2\x86\x92"), array('&larr;', '&rarr;'), $file);
55 55
     print "<h3>$row[3]</h3>";
56 56
     if (preg_match('#<table.*?</table>#s', $file, $m))
57 57
         print preg_replace('#href=(\'|")(.*?)\1#', 'href=\1http://en.wikipedia.org\2\1', $m[0]);
Please login to merge, or discard this patch.
scripts/wikipedia-cron.php 3 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -16,39 +16,39 @@  discard block
 block discarded – undo
16 16
 contributions('212.35.252.2'); # LibDem
17 17
 
18 18
 function contributions($ip) {
19
-	global $dir;
19
+    global $dir;
20 20
 
21
-	$file = fetch("/w/index.php?title=Special:Contributions&limit=100&target=$ip");
22
-	if (!$file) return;
23
-	$fp = fopen($dir . $ip, 'w');
24
-	fwrite($fp, $file['body']);
25
-	fclose($fp);
26
-	preg_match_all('#<li>(.*?) \(<a[^>]*>hist</a>\) \(<a href="(.*?title=(.*?)&.*?oldid=(.*?))"[^>]*>diff</a>\)  <a[^>]*>(.*?)</a> .*?</li>#', $file['body'], $m, PREG_SET_ORDER);
27
-	foreach ($m as $row) {
28
-		# print "$row[3] / $row[4]";
29
-		$filename = html_entity_decode("$row[3].$row[4]");
30
-		$path = $dir;
31
-		if (strstr($filename, '/')) {
32
-			$bits = explode('/', $filename);
33
-			array_pop($bits);
34
-			foreach ($bits as $bit) {
35
-				@mkdir($path . $bit);
36
-				$path .= "$bit/";
37
-			}
38
-		}
39
-		$cache = $dir . $filename;
40
-		if (!is_file($cache)) {
41
-			# print " - fetching";
42
-			$file = fetch(html_entity_decode($row[2]));
43
-			if (!$file) continue;
44
-			$fp = fopen($cache, 'w');
45
-			if ($fp) {
46
-				fwrite($fp, $file['body']);
47
-				fclose($fp);
48
-			}
49
-		}
50
-		# print "\n";
51
-	}
21
+    $file = fetch("/w/index.php?title=Special:Contributions&limit=100&target=$ip");
22
+    if (!$file) return;
23
+    $fp = fopen($dir . $ip, 'w');
24
+    fwrite($fp, $file['body']);
25
+    fclose($fp);
26
+    preg_match_all('#<li>(.*?) \(<a[^>]*>hist</a>\) \(<a href="(.*?title=(.*?)&.*?oldid=(.*?))"[^>]*>diff</a>\)  <a[^>]*>(.*?)</a> .*?</li>#', $file['body'], $m, PREG_SET_ORDER);
27
+    foreach ($m as $row) {
28
+        # print "$row[3] / $row[4]";
29
+        $filename = html_entity_decode("$row[3].$row[4]");
30
+        $path = $dir;
31
+        if (strstr($filename, '/')) {
32
+            $bits = explode('/', $filename);
33
+            array_pop($bits);
34
+            foreach ($bits as $bit) {
35
+                @mkdir($path . $bit);
36
+                $path .= "$bit/";
37
+            }
38
+        }
39
+        $cache = $dir . $filename;
40
+        if (!is_file($cache)) {
41
+            # print " - fetching";
42
+            $file = fetch(html_entity_decode($row[2]));
43
+            if (!$file) continue;
44
+            $fp = fopen($cache, 'w');
45
+            if ($fp) {
46
+                fwrite($fp, $file['body']);
47
+                fclose($fp);
48
+            }
49
+        }
50
+        # print "\n";
51
+    }
52 52
 }
53 53
 
54 54
 function fetch($url) {
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     $host = 'en.wikipedia.org';
57 57
     $fp = @fsockopen($host, 80, $errno, $errstr, 10);
58 58
     if (!$fp) {
59
-	    #print "$errstr ($errno)\n";
59
+        #print "$errstr ($errno)\n";
60 60
             return '';
61 61
         }
62 62
     $out = "GET $url HTTP/1.1\r\n";
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@  discard block
 block discarded – undo
19 19
 	global $dir;
20 20
 
21 21
 	$file = fetch("/w/index.php?title=Special:Contributions&limit=100&target=$ip");
22
-	if (!$file) return;
22
+	if (!$file) {
23
+	    return;
24
+	}
23 25
 	$fp = fopen($dir . $ip, 'w');
24 26
 	fwrite($fp, $file['body']);
25 27
 	fclose($fp);
@@ -40,7 +42,9 @@  discard block
 block discarded – undo
40 42
 		if (!is_file($cache)) {
41 43
 			# print " - fetching";
42 44
 			$file = fetch(html_entity_decode($row[2]));
43
-			if (!$file) continue;
45
+			if (!$file) {
46
+			    continue;
47
+			}
44 48
 			$fp = fopen($cache, 'w');
45 49
 			if ($fp) {
46 50
 				fwrite($fp, $file['body']);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 	    #print "$errstr ($errno)\n";
60 60
             return '';
61 61
         }
62
-    $out = "GET $url HTTP/1.1\r\n";
62
+    $out = "get $url HTTP/1.1\r\n";
63 63
     $out .= "Host: $host\r\n";
64 64
     $out .= "User-Agent: $ua\r\n";
65 65
     $out .= "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9;text/plain;q=0.8,image/png,*/*;q=0.5\r\n";
Please login to merge, or discard this patch.