Failed Conditions
Pull Request — master (#1326)
by Nick
26:02 queued 20:44
created
www/includes/easyparliament/commentreportlist.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         // available for editing, it's accurate.
25 25
         $this->_update_locked();
26 26
 
27
-        $data = $this->_get_data_by_recent ();
27
+        $data = $this->_get_data_by_recent();
28 28
 
29 29
         $this->render($data);
30 30
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $q = $this->db->query("SELECT comments.comment_id,
68 68
                                 commentreports.report_id,
69 69
                                 commentreports.body,
70
-                                DATE_FORMAT(commentreports.reported, '" . SHORTDATEFORMAT_SQL . ' ' . TIMEFORMAT_SQL . "') AS reported,
70
+                                DATE_FORMAT(commentreports.reported, '" . SHORTDATEFORMAT_SQL.' '.TIMEFORMAT_SQL."') AS reported,
71 71
                                 commentreports.locked,
72 72
                                 users.firstname,
73 73
                                 users.lastname
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         $r = $this->db->query("SELECT comments.comment_id,
85 85
         commentreports.report_id,
86 86
         commentreports.body,
87
-        DATE_FORMAT(commentreports.reported, '". SHORTDATEFORMAT_SQL . ' ' . TIMEFORMAT_SQL . "') AS reported,
87
+        DATE_FORMAT(commentreports.reported, '". SHORTDATEFORMAT_SQL.' '.TIMEFORMAT_SQL."') AS reported,
88 88
         commentreports.locked,
89 89
         commentreports.firstname,
90 90
         commentreports.lastname
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 
100 100
         if ($q->rows() > 0) {
101 101
 
102
-            for ($n=0; $n<$q->rows(); $n++) {
102
+            for ($n = 0; $n < $q->rows(); $n++) {
103 103
 
104
-                $data[] = array (
105
-                    'report_id'		=> $q->field($n,'report_id'),
106
-                    'comment_id' 	=> $q->field($n,'comment_id'),
104
+                $data[] = array(
105
+                    'report_id'		=> $q->field($n, 'report_id'),
106
+                    'comment_id' 	=> $q->field($n, 'comment_id'),
107 107
                     'firstname'		=> $q->field($n, 'firstname'),
108 108
                     'lastname'		=> $q->field($n, 'lastname'),
109 109
                     'body'			=> $q->field($n, 'body'),
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
 
115 115
         }
116 116
         if ($r->rows() > 0) {
117
-            for ($n=0; $n<$r->rows(); $n++) {
118
-                $data[] = array (
119
-                    'report_id'		=> $r->field($n,'report_id'),
120
-                    'comment_id' 	=> $r->field($n,'comment_id'),
117
+            for ($n = 0; $n < $r->rows(); $n++) {
118
+                $data[] = array(
119
+                    'report_id'		=> $r->field($n, 'report_id'),
120
+                    'comment_id' 	=> $r->field($n, 'comment_id'),
121 121
                     'firstname'		=> $r->field($n, 'firstname'),
122 122
                     'lastname'		=> $r->field($n, 'lastname'),
123 123
                     'body'			=> $r->field($n, 'body'),
Please login to merge, or discard this patch.
www/includes/easyparliament/trackback.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     public function moderate_trackbacks() { return $this->moderate_trackbacks; }
52 52
 
53 53
 
54
-    public function display ($view, $args=array(), $format='html') {
54
+    public function display($view, $args = array(), $format = 'html') {
55 55
         // $view is one of:
56 56
         //	'epobject_id' - display the pings for one epobject.
57 57
         // 	'recent' - to get the most recent pings to anywhere.
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
             $trackbackdata = $this->$function($args);
70 70
 
71 71
         } else {
72
-            $PAGE->error_message ("You haven't specified a valid view type.");
72
+            $PAGE->error_message("You haven't specified a valid view type.");
73 73
             return false;
74 74
         }
75 75
 
76
-        $data = array (
76
+        $data = array(
77 77
             'data' 	=> $trackbackdata,
78
-            'info'	=> array (
78
+            'info'	=> array(
79 79
                 'view' => $view
80 80
             )
81 81
         );
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $this->render($view, $data, $format);
87 87
     }
88 88
 
89
-    public function render($view, $data, $format='html') {
89
+    public function render($view, $data, $format = 'html') {
90 90
 
91 91
         if ($format != 'html') {
92 92
             $format = 'html';
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         // We currently only have one kind of trackback template, so
96 96
         // we're ignoring $view here I'm afraid...
97 97
 
98
-        include (INCLUDESPATH."easyparliament/templates/$format/trackbacks" . ".php");
98
+        include (INCLUDESPATH."easyparliament/templates/$format/trackbacks".".php");
99 99
 
100 100
     }
101 101
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         // Check this epobject_id exists.
124 124
         $q = $this->db->query("SELECT epobject_id
125 125
                         FROM	epobject
126
-                        WHERE	epobject_id = '" . addslashes($epobject_id) . "'");
126
+                        WHERE	epobject_id = '" . addslashes($epobject_id)."'");
127 127
 
128 128
         if ($q->rows() == 0) {
129 129
             $this->_trackback_response(1, "Sorry, we don't have a valid epobject_id.");
@@ -131,24 +131,24 @@  discard block
 block discarded – undo
131 131
 
132 132
 
133 133
         // Still here? Then we're trackbacking to a valid hansard item.
134
-        $url 		= $trackbackdata['url'];
135
-        $source_ip	= $trackbackdata['source_ip'];
134
+        $url = $trackbackdata['url'];
135
+        $source_ip = $trackbackdata['source_ip'];
136 136
         // These all strip_tags too.
137
-        $title 		= trim_characters(html_entity_decode($trackbackdata['title']), 0, 255);
138
-        $excerpt 	= trim_characters(html_entity_decode($trackbackdata['excerpt']), 0, 255);
139
-        $blog_name 	= trim_characters(html_entity_decode($trackbackdata['blog_name']), 0, 255);
137
+        $title = trim_characters(html_entity_decode($trackbackdata['title']), 0, 255);
138
+        $excerpt = trim_characters(html_entity_decode($trackbackdata['excerpt']), 0, 255);
139
+        $blog_name = trim_characters(html_entity_decode($trackbackdata['blog_name']), 0, 255);
140 140
 
141
-        $visible 		= $this->moderate_trackbacks ? 0 : 1;
141
+        $visible = $this->moderate_trackbacks ? 0 : 1;
142 142
 
143 143
         $q = $this->db->query("INSERT INTO trackbacks
144 144
                         (epobject_id, blog_name, title, excerpt, url, source_ip, posted, visible)
145 145
                         VALUES
146
-                        ('" . addslashes($epobject_id) . "',
147
-                        '" . addslashes($blog_name) . "',
148
-                        '" . addslashes($title) . "',
149
-                        '" . addslashes($excerpt) . "',
150
-                        '" . addslashes($url) . "',
151
-                        '" . addslashes($source_ip) . "',
146
+                        ('" . addslashes($epobject_id)."',
147
+                        '" . addslashes($blog_name)."',
148
+                        '" . addslashes($title)."',
149
+                        '" . addslashes($excerpt)."',
150
+                        '" . addslashes($url)."',
151
+                        '" . addslashes($source_ip)."',
152 152
                         NOW(),
153 153
                         '$visible')
154 154
                         ");
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
             $this->_trackback_response(0);
159 159
 
160 160
         } else {
161
-            die ("Sorry, we could not save the trackback to the database. Please <a href=\"mailto:" . CONTACTEMAIL . "\">email us</a> to let us know. Thanks.");
161
+            die ("Sorry, we could not save the trackback to the database. Please <a href=\"mailto:".CONTACTEMAIL."\">email us</a> to let us know. Thanks.");
162 162
         }
163 163
     }
164 164
 
@@ -192,14 +192,14 @@  discard block
 block discarded – undo
192 192
                                 url,
193 193
                                 posted
194 194
                         FROM 	trackbacks
195
-                        WHERE 	epobject_id = '" . addslashes($epobject_id) . "'
195
+                        WHERE 	epobject_id = '" . addslashes($epobject_id)."'
196 196
                         AND 	visible = 1
197 197
                         ORDER BY posted ASC
198 198
                         ");
199 199
 
200 200
         if ($q->rows() > 0) {
201
-            for ($row=0; $row<$q->rows(); $row++) {
202
-                $trackbackdata[] = array (
201
+            for ($row = 0; $row < $q->rows(); $row++) {
202
+                $trackbackdata[] = array(
203 203
                     'trackback_id' 	=> $q->field($row, 'trackback_id'),
204 204
                     'epobject_id'	=> $q->field($row, 'epobject_id'),
205 205
                     'blog_name' 	=> $q->field($row, 'blog_name'),
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
                         ");
248 248
 
249 249
         if ($q->rows() > 0) {
250
-            for ($row=0; $row<$q->rows(); $row++) {
251
-                $trackbackdata[] = array (
250
+            for ($row = 0; $row < $q->rows(); $row++) {
251
+                $trackbackdata[] = array(
252 252
                     'trackback_id' 	=> $q->field($row, 'trackback_id'),
253 253
                     'epobject_id'	=> $q->field($row, 'epobject_id'),
254 254
                     'blog_name' 	=> $q->field($row, 'blog_name'),
Please login to merge, or discard this patch.
www/includes/easyparliament/editqueue.php 2 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -75,19 +75,19 @@  discard block
 block discarded – undo
75 75
                         (user_id, edit_type, title, body, submitted)
76 76
                         VALUES
77 77
                         (
78
-                        '" . addslashes($THEUSER->user_id()) . "',
79
-                        '" . $data['edit_type'] . "',
80
-                        '" . addslashes($data['title']) . "',
81
-                        '" . addslashes($data['body']) . "',
82
-                        '" . $data['posted'] . "'
78
+                        '" . addslashes($THEUSER->user_id())."',
79
+                        '" . $data['edit_type']."',
80
+                        '" . addslashes($data['title'])."',
81
+                        '" . addslashes($data['body'])."',
82
+                        '" . $data['posted']."'
83 83
                         );");
84 84
 
85 85
         if ($q->success()) {
86 86
             // Set the object variables up.
87
-            $this->editqueue_id 	= $q->insert_id();
87
+            $this->editqueue_id = $q->insert_id();
88 88
             $this->title			= $data['title'];
89 89
             $this->body				= $data['body'];
90
-            $this->posted			= $data['posted'];
90
+            $this->posted = $data['posted'];
91 91
 
92 92
             return $this->editqueue_id;
93 93
 
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
             $q = $this->db->query("INSERT INTO epobject
127 127
                             (title, body, type, created)
128 128
                             VALUES
129
-                            ('" . addslashes($this->pending[$approval_id]['title']) . "',
130
-                            '" . addslashes($this->pending[$approval_id]['body']) . "',
131
-                            '" . $data['epobject_type'] . "',
132
-                            '" . $timestamp . "');");
129
+                            ('" . addslashes($this->pending[$approval_id]['title'])."',
130
+                            '" . addslashes($this->pending[$approval_id]['body'])."',
131
+                            '" . $data['epobject_type']."',
132
+                            '" . $timestamp."');");
133 133
 
134 134
             // If that didn't work we can't go any further...
135 135
             if (!$q->success()) {
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
                     $q = $this->db->query("INSERT INTO glossary
149 149
                                     (epobject_id, type, visible)
150 150
                                     VALUES
151
-                                    ('" . $q->insert_id() . "',
151
+                                    ('" . $q->insert_id()."',
152 152
                                     '2',
153 153
                                     '1');");
154 154
                     // Again, no point carrying on if this fails,
155 155
                     // so remove the previous entry
156 156
                     if (!$q->success()) {
157 157
                         print "glossary trouble!";
158
-                        $q = $this->db->query("delete from epobject where epobject_id=" . $previous_insert_id . "");
158
+                        $q = $this->db->query("delete from epobject where epobject_id=".$previous_insert_id."");
159 159
                         return false;
160 160
                     }
161 161
                     break;
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
             // the new epobject id and approval details.
168 168
             $q = $this->db->query("UPDATE editqueue
169 169
                             SET
170
-                            epobject_id_l='" .  $this->current_epobject_id. "',
171
-                            editor_id='" . addslashes($THEUSER->user_id()) . "',
170
+                            epobject_id_l='" .  $this->current_epobject_id."',
171
+                            editor_id='" . addslashes($THEUSER->user_id())."',
172 172
                             approved='1',
173
-                            decided='" . $timestamp . "'
174
-                            WHERE edit_id=" . $approval_id . ";");
173
+                            decided='" . $timestamp."'
174
+                            WHERE edit_id=" . $approval_id.";");
175 175
             if (!$q->success()) {
176 176
                 break;
177 177
             }
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
             // Update the editqueue with setting approved=0
211 211
             $q = $this->db->query("UPDATE editqueue
212 212
                             SET
213
-                            editor_id='" . addslashes($THEUSER->user_id()) . "',
213
+                            editor_id='" . addslashes($THEUSER->user_id())."',
214 214
                             approved='0',
215
-                            decided='" . $timestamp . "'
216
-                            WHERE edit_id=" . $decline_id . ";");
215
+                            decided='" . $timestamp."'
216
+                            WHERE edit_id=" . $decline_id.";");
217 217
             if (!$q->success()) {
218 218
                 break;
219 219
             }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
         $q = $this->db->query("SELECT eq.edit_id, eq.user_id, u.firstname, u.lastname, eq.glossary_id, eq.title, eq.body, eq.submitted FROM editqueue AS eq, users AS u WHERE eq.user_id = u.user_id AND eq.approved IS NULL ORDER BY eq.submitted DESC;");
250 250
         if ($q->success() && $q->rows()) {
251 251
             for ($i = 0; $i < ($q->rows()); $i++) {
252
-                $this->pending[	$q->field($i,"edit_id") ] = $q->row($i);
252
+                $this->pending[$q->field($i, "edit_id")] = $q->row($i);
253 253
             }
254 254
 
255 255
             $this->update_pending_count();
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
             $q = $this->db->query("INSERT INTO glossary
345 345
                             (title, body, type, created, visible)
346 346
                             VALUES
347
-                            ('" . addslashes($this->pending[$approval_id]['title']) . "',
348
-                            '" . addslashes($this->pending[$approval_id]['body']) . "',
349
-                            '" . $data['epobject_type'] . "',
350
-                            '" . $timestamp . "',
347
+                            ('" . addslashes($this->pending[$approval_id]['title'])."',
348
+                            '" . addslashes($this->pending[$approval_id]['body'])."',
349
+                            '" . $data['epobject_type']."',
350
+                            '" . $timestamp."',
351 351
                             1);");
352 352
 
353 353
             // If that didn't work we can't go any further...
@@ -361,11 +361,11 @@  discard block
 block discarded – undo
361 361
             // the new epobject id and approval details.
362 362
             $q = $this->db->query("UPDATE editqueue
363 363
                             SET
364
-                            glossary_id='" .  $this->current_epobject_id. "',
365
-                            editor_id='" . addslashes($THEUSER->user_id()) . "',
364
+                            glossary_id='" .  $this->current_epobject_id."',
365
+                            editor_id='" . addslashes($THEUSER->user_id())."',
366 366
                             approved='1',
367
-                            decided='" . $timestamp . "'
368
-                            WHERE edit_id=" . $approval_id . ";");
367
+                            decided='" . $timestamp."'
368
+                            WHERE edit_id=" . $approval_id.";");
369 369
             if (!$q->success()) {
370 370
                 break;
371 371
             }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -174,8 +174,7 @@  discard block
 block discarded – undo
174 174
                             WHERE edit_id=" . $approval_id . ";");
175 175
             if (!$q->success()) {
176 176
                 break;
177
-            }
178
-            else {
177
+            } else {
179 178
                 // Now send them an email telling them they've been approved
180 179
 
181 180
 
@@ -216,8 +215,7 @@  discard block
 block discarded – undo
216 215
                             WHERE edit_id=" . $decline_id . ";");
217 216
             if (!$q->success()) {
218 217
                 break;
219
-            }
220
-            else {
218
+            } else {
221 219
                 // Scrub that one from the list of pending items
222 220
                 unset ($this->pending[$decline_id]);
223 221
             }
@@ -255,8 +253,7 @@  discard block
 block discarded – undo
255 253
             $this->update_pending_count();
256 254
 
257 255
             return true;
258
-        }
259
-        else {
256
+        } else {
260 257
             return false;
261 258
         }
262 259
     }
@@ -368,8 +365,7 @@  discard block
 block discarded – undo
368 365
                             WHERE edit_id=" . $approval_id . ";");
369 366
             if (!$q->success()) {
370 367
                 break;
371
-            }
372
-            else {
368
+            } else {
373 369
                 // Scrub that one from the list of pending items
374 370
                 unset ($this->pending[$approval_id]);
375 371
             }
Please login to merge, or discard this patch.
www/includes/easyparliament/glossarylist.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 class GLOSSARYLIST {
4 4
 
5
-    public function render($data, $format='html', $template='glossary') {
5
+    public function render($data, $format = 'html', $template = 'glossary') {
6 6
         // Once we have the data that's to be rendered,
7 7
         // include the template.
8 8
 
Please login to merge, or discard this patch.
www/includes/easyparliament/glossary.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
 
28 28
 class GLOSSARY {
29 29
 
30
-    public $num_terms;			// how many glossary entries do we have
30
+    public $num_terms; // how many glossary entries do we have
31 31
                             // (changes depending on how GLOSSARY is called
32
-    public $hansard_count;		// how many times does the phrase appear in hansard?
33
-    public $query;				// search term
34
-    public $glossary_id;		// if this is set then we only have 1 glossary term
35
-    public $current_term;		// will only be set if we have a valid epobject_id
32
+    public $hansard_count; // how many times does the phrase appear in hansard?
33
+    public $query; // search term
34
+    public $glossary_id; // if this is set then we only have 1 glossary term
35
+    public $current_term; // will only be set if we have a valid epobject_id
36 36
     public $current_letter;
37 37
 
38 38
     // constructor...
39
-    public function __construct($args=array()) {
39
+    public function __construct($args = array()) {
40 40
     // We can optionally start the glossary with one of several arguments
41 41
     //		1. glossary_id - treat the glossary as a single term
42 42
     //		2. glossary_term - search within glossary for a term
@@ -75,16 +75,16 @@  discard block
 block discarded – undo
75 75
 
76 76
             // These stop stupid submissions.
77 77
             // everything should be lowercase.
78
-            $this->stopwords = array( "the", "of", "to", "and", "for", "in", "a", "on", "is", "that", "will", "secretary", "are", "ask", "state", "have", "be", "has", "by", "with", "i", "not", "what", "as", "it", "hon", "he", "which", "from", "if", "been", "this", "s", "we", "at", "government", "was", "my", "an", "department", "there", "make", "or", "made", "their", "all", "but", "they", "how", "debate" );
78
+            $this->stopwords = array("the", "of", "to", "and", "for", "in", "a", "on", "is", "that", "will", "secretary", "are", "ask", "state", "have", "be", "has", "by", "with", "i", "not", "what", "as", "it", "hon", "he", "which", "from", "if", "been", "this", "s", "we", "at", "government", "was", "my", "an", "department", "there", "make", "or", "made", "their", "all", "but", "they", "how", "debate");
79 79
 
80 80
     }
81 81
 
82
-    public function get_glossary_item($args=array()) {
82
+    public function get_glossary_item($args = array()) {
83 83
         // Search for and fetch glossary item with title or glossary_id
84 84
         // We could also search glossary text that contains the title text, for cross references
85 85
 
86 86
         $this->alphabet = array();
87
-        foreach (range ("A", "Z") as $letter) {
87
+        foreach (range("A", "Z") as $letter) {
88 88
             $this->alphabet[$letter] = array();
89 89
         }
90 90
 
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
             WHERE g.glossary_id=eq.glossary_id AND u.user_id=eq.user_id AND g.visible=1 AND eq.approved=1
94 94
             ORDER by g.title");
95 95
         if ($q->success() && $q->rows()) {
96
-            for ($i=0; $i < $q->rows(); $i++) {
97
-                $this->terms[ $q->field($i,"glossary_id") ] = $q->row($i);
96
+            for ($i = 0; $i < $q->rows(); $i++) {
97
+                $this->terms[$q->field($i, "glossary_id")] = $q->row($i);
98 98
                 // Now add the epobject to the alphabet navigation.
99
-                $first_letter = strtoupper(substr($q->field($i,"title"),0,1));
100
-                $this->alphabet[$first_letter][] = $q->field($i,"glossary_id");
99
+                $first_letter = strtoupper(substr($q->field($i, "title"), 0, 1));
100
+                $this->alphabet[$first_letter][] = $q->field($i, "glossary_id");
101 101
             }
102 102
 
103 103
             $this->num_terms = $q->rows();
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         }
141 141
     }
142 142
 
143
-    public function search_glossary($args=array()) {
143
+    public function search_glossary($args = array()) {
144 144
         // Search for and fetch glossary item with a title
145 145
         // Useful for the search page, and nowhere else (so far)
146 146
 
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
         $query = "SELECT g.glossary_id, g.title, g.body, u.user_id, u.firstname, u.lastname
152 152
             FROM editqueue AS eq, glossary AS g, users AS u
153 153
             WHERE g.glossary_id=eq.glossary_id AND u.user_id=eq.user_id AND g.visible=1
154
-                AND g.title LIKE '%" . $this->query . "%'
154
+                AND g.title LIKE '%" . $this->query."%'
155 155
             ORDER by g.title";
156 156
         $q = $this->db->query($query);
157 157
         if ($q->success() && $q->rows()) {
158
-            for ($i=0; $i < $q->rows(); $i++) {
159
-                $this->search_matches[ $q->field($i,"glossary_id") ] = $q->row($i);
158
+            for ($i = 0; $i < $q->rows(); $i++) {
159
+                $this->search_matches[$q->field($i, "glossary_id")] = $q->row($i);
160 160
             }
161 161
             $this->num_search_matches = $q->rows();
162 162
         }
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
         global $THEUSER;
193 193
 
194 194
         if ($data['title'] == '') {
195
-            error ("Sorry, you can't define a term without a title");
195
+            error("Sorry, you can't define a term without a title");
196 196
             return false;
197 197
         }
198 198
 
199 199
         if ($data['body'] == '') {
200
-            error ("You haven't entered a definition!");
200
+            error("You haven't entered a definition!");
201 201
             return false;
202 202
         }
203 203
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
             $q = $this->db->query("SELECT glossary_id
211 211
                             FROM	editqueue
212
-                            WHERE	user_id = '" . $THEUSER->user_id() . "'
212
+                            WHERE	user_id = '" . $THEUSER->user_id()."'
213 213
                             AND		submitted + 0 > NOW() - $flood_time_limit");
214 214
 
215 215
             if ($q->rows() > 0) {
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         }
251 251
     }
252 252
 
253
-    public function glossarise($body, $tokenize=0, $urlize=0) {
253
+    public function glossarise($body, $tokenize = 0, $urlize = 0) {
254 254
     // Turn a body of text into a link-up wonderland of glossary joy
255 255
 
256 256
         global $this_page;
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
         // should be the complete and linked url.
265 265
         // NB. This should only match when $body is a definition beginning with "http:"
266 266
         if (is_string($body) && preg_match("/^(http:*[^\s])$/i", $body)) {
267
-            $body = "<a href=\"" . $body . "\" title=\"External link to " . $body . "\">" . $body . "</a>";
267
+            $body = "<a href=\"".$body."\" title=\"External link to ".$body."\">".$body."</a>";
268 268
             return ($body);
269 269
         }
270 270
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
             $URL->update(array("gl" => $glossary_id));
288 288
             # The regex here ensures that the phrase is only matched if it's not already within <a> tags, preventing double-linking. Kudos to http://stackoverflow.com/questions/7798829/php-regular-expression-to-match-keyword-outside-html-tag-a
289
-            $findwords[$glossary_id] = "/\b(" . $term_title . ")\b(?!(?>[^<]*(?:<(?!\/?a\b)[^<]*)*)<\/a>)/i";
289
+            $findwords[$glossary_id] = "/\b(".$term_title.")\b(?!(?>[^<]*(?:<(?!\/?a\b)[^<]*)*)<\/a>)/i";
290 290
             // catch glossary terms within their own definitions
291 291
             if ($glossary_id == $this->glossary_id) {
292 292
                 $replacewords[] = "<strong>\\1</strong>";
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
         // Highlight all occurrences of another glossary term in the definition.
306 306
         $body = preg_replace($findwords, $replacewords, $body, 1);
307 307
         if (isset($this->glossary_id))
308
-            $body = preg_replace("/(?<![>\.\'\/])\b(" . $this->terms[$this->glossary_id]['title'] . ")\b(?![<\'])/i", '<strong>\\1</strong>', $body, 1);
308
+            $body = preg_replace("/(?<![>\.\'\/])\b(".$this->terms[$this->glossary_id]['title'].")\b(?![<\'])/i", '<strong>\\1</strong>', $body, 1);
309 309
 
310 310
         // Replace any phrases in wikipedia
311 311
         // TODO: Merge this code into above, so our gloss and wikipedia
Please login to merge, or discard this patch.
Braces   +14 added lines, -15 removed lines patch added patch discarded remove patch
@@ -107,19 +107,19 @@  discard block
 block discarded – undo
107 107
             if (isset($args['glossary_id']) && ($args['glossary_id'] != "")) {
108 108
                 $next = 0; $first_term = null;
109 109
                 foreach ($this->terms as $term) {
110
-                    if (!$first_term) $first_term = $term;
110
+                    if (!$first_term) {
111
+                        $first_term = $term;
112
+                    }
111 113
                     $last_term = $term;
112 114
                     if ($next == 1) {
113 115
                         $this->next_term = $term;
114 116
                         break;
115
-                    }
116
-                    elseif ($term['glossary_id'] == $args['glossary_id']) {
117
+                    } elseif ($term['glossary_id'] == $args['glossary_id']) {
117 118
                         $this->glossary_id = $args['glossary_id'];
118 119
                         $this->current_term = $term;
119 120
                         $next = 1;
120 121
 
121
-                    }
122
-                    else {
122
+                    } else {
123 123
                         $this->previous_term = $term;
124 124
                     }
125 125
                 }
@@ -134,8 +134,7 @@  discard block
 block discarded – undo
134 134
             }
135 135
 
136 136
             return ($this->num_terms);
137
-        }
138
-        else {
137
+        } else {
139 138
             return false;
140 139
         }
141 140
     }
@@ -278,8 +277,9 @@  discard block
 block discarded – undo
278 277
 
279 278
         // check for any glossary terms to replace
280 279
         foreach ($this->replace_order as $glossary_id => $count) {
281
-            if ($glossary_id == $this->glossary_id)
282
-                continue;
280
+            if ($glossary_id == $this->glossary_id) {
281
+                            continue;
282
+            }
283 283
 
284 284
             $term_body = $this->terms[$glossary_id]['body'];
285 285
             $term_title = $this->terms[$glossary_id]['title'];
@@ -290,12 +290,10 @@  discard block
 block discarded – undo
290 290
             // catch glossary terms within their own definitions
291 291
             if ($glossary_id == $this->glossary_id) {
292 292
                 $replacewords[] = "<strong>\\1</strong>";
293
-            }
294
-            else {
293
+            } else {
295 294
                 if ($this_page == "admin_glossary") {
296 295
                     $link_url = "#gl".$glossary_id;
297
-                }
298
-                else {
296
+                } else {
299 297
                     $link_url = $URL->generate('url');
300 298
                 }
301 299
                 $title = _htmlentities(trim_characters($term_body, 0, 80));
@@ -304,8 +302,9 @@  discard block
 block discarded – undo
304 302
         }
305 303
         // Highlight all occurrences of another glossary term in the definition.
306 304
         $body = preg_replace($findwords, $replacewords, $body, 1);
307
-        if (isset($this->glossary_id))
308
-            $body = preg_replace("/(?<![>\.\'\/])\b(" . $this->terms[$this->glossary_id]['title'] . ")\b(?![<\'])/i", '<strong>\\1</strong>', $body, 1);
305
+        if (isset($this->glossary_id)) {
306
+                    $body = preg_replace("/(?<![>\.\'\/])\b(" . $this->terms[$this->glossary_id]['title'] . ")\b(?![<\'])/i", '<strong>\\1</strong>', $body, 1);
307
+        }
309 308
 
310 309
         // Replace any phrases in wikipedia
311 310
         // TODO: Merge this code into above, so our gloss and wikipedia
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/rss/hansard_search.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 twfy_debug("TEMPLATE", "rss/hansard_search.php");
22 22
 
23 23
 if (isset ($data['rows']) && count($data['rows']) > 0) {
24
-    for ($i=0; $i<count($data['rows']); $i++) {
24
+    for ($i = 0; $i < count($data['rows']); $i++) {
25 25
         $row = $data['rows'][$i];
26 26
 
27 27
         $hdate = format_date($row['hdate'], 'D, d M Y');
@@ -37,16 +37,16 @@  discard block
 block discarded – undo
37 37
         if (isset($row['parent']) && count($row['parent']) > 0) {
38 38
             echo strip_tags($row['parent']['body']);
39 39
         }
40
-        echo (' (' . format_date($row['hdate'], SHORTDATEFORMAT) . ')');
40
+        echo (' ('.format_date($row['hdate'], SHORTDATEFORMAT).')');
41 41
 ?></title>
42 42
 <link>https://www.theyworkforyou.com<?=$row['listurl'] ?></link>
43 43
 <pubDate><?=$date ?></pubDate>
44 44
 <description><?php
45 45
         if (isset($row['speaker']) && count($row['speaker'])) {
46 46
             $name = ucfirst($row['speaker']['name']);
47
-            echo entities_to_numbers($name) . ': ';
47
+            echo entities_to_numbers($name).': ';
48 48
         }
49
-        echo _htmlspecialchars(str_replace(array('&#8212;', '<span class="hi">', '</span>'), array('-', '<b>', '</b>'), $row['extract'])) . "</description>\n</item>\n";
49
+        echo _htmlspecialchars(str_replace(array('&#8212;', '<span class="hi">', '</span>'), array('-', '<b>', '</b>'), $row['extract']))."</description>\n</item>\n";
50 50
     }
51 51
 }
52 52
 ?>
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
         $row = $data['rows'][$i];
26 26
 
27 27
         $hdate = format_date($row['hdate'], 'D, d M Y');
28
-        if (isset($row['htime']) && $row['htime'] != NULL) {
28
+        if (isset($row['htime']) && $row['htime'] != null) {
29 29
             $htime = format_time($row['htime'], 'H:i:s');
30 30
         } else {
31 31
             $htime = '00:00:00';
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/mp/error.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
             <p><?= $error ?></p>
8 8
 
9
-        <?php if ( $rep_search_url ) { ?>
9
+        <?php if ($rep_search_url) { ?>
10 10
         </div>
11 11
 
12 12
         <div class="full-page__unit">
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/mp/votes.php 4 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                               <?php foreach ($segment['votes']->positions as $key_vote) {
61 61
 
62 62
                                 if (isset($policy_last_update[$key_vote['policy_id']]) && $policy_last_update[$key_vote['policy_id']] > $most_recent) {
63
-                                  $most_recent = $policy_last_update[$key_vote['policy_id']];
63
+                                    $most_recent = $policy_last_update[$key_vote['policy_id']];
64 64
                                 }
65 65
 
66 66
                                 if ( $key_vote['has_strong'] || $key_vote['position'] == 'has never voted on' ) {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
                                 include '_vote_description.php';
83 83
 
84
-                              } ?>
84
+                                } ?>
85 85
                             </ul>
86 86
 
87 87
                             <div class="share-vote-descriptions">
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-include_once INCLUDESPATH . "easyparliament/templates/html/mp/header.php";
2
+include_once INCLUDESPATH."easyparliament/templates/html/mp/header.php";
3 3
 ?>
4 4
 
5 5
 <div class="full-page">
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
                                   $most_recent = $policy_last_update[$key_vote['policy_id']];
64 64
                                 }
65 65
 
66
-                                if ( $key_vote['has_strong'] || $key_vote['position'] == 'has never voted on' ) {
66
+                                if ($key_vote['has_strong'] || $key_vote['position'] == 'has never voted on') {
67 67
                                     $description = ucfirst($key_vote['desc']);
68 68
                                 } else {
69 69
                                     $description = sprintf(
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                             <div class="share-vote-descriptions">
88 88
                                 <p>Share a screenshot of these votes:</p>
89 89
 
90
-                                <a href="#" class="fb-share-button-tracked" data-title="<?= $single_policy_page ? '' : $segment['title'] . ' ' ?><?= $page_title ?>" data-href="<?= $abs_member_url ?>/votes?policy=<?= $segment['key'] ?>" data-image="<?= $abs_member_url ?>/policy_set_png?policy_set=<?= $segment['key'] ?>" "See how <?= $full_name ?> voted on <?= $segment["title"] ?>">Share</a>
90
+                                <a href="#" class="fb-share-button-tracked" data-title="<?= $single_policy_page ? '' : $segment['title'].' ' ?><?= $page_title ?>" data-href="<?= $abs_member_url ?>/votes?policy=<?= $segment['key'] ?>" data-image="<?= $abs_member_url ?>/policy_set_png?policy_set=<?= $segment['key'] ?>" "See how <?= $full_name ?> voted on <?= $segment["title"] ?>">Share</a>
91 91
 
92 92
                                 <a class="twitter-share-button" href="https://twitter.com/share" data-size="small" data-url="<?= $abs_member_url ?>/votes?policy=<?= $segment['key'] ?>">Tweet</a>
93 93
                                 </div>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -110,13 +110,16 @@
 block discarded – undo
110 110
 
111 111
                         <?php endif; ?>
112 112
 
113
-                    <?php else: ?>
113
+                    <?php else {
114
+    : ?>
114 115
 
115 116
                         <div class="panel">
116 117
                             <p>This person has not voted on any of the key issues which we keep track of.</p>
117 118
                         </div>
118 119
 
119
-                    <?php endif; ?>
120
+                    <?php endif;
121
+}
122
+?>
120 123
 
121 124
                 <?php endif; ?>
122 125
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
                 <?php if ($has_voting_record): ?>
44 44
 
45
-                    <?php $displayed_votes = FALSE; ?>
45
+                    <?php $displayed_votes = false; ?>
46 46
 
47 47
                     <?php foreach ($key_votes_segments as $segment): ?>
48 48
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
                                 <small>Last updated: <?= format_date($most_recent, LONGDATEFORMAT) ?></small>
95 95
                             </div>
96 96
 
97
-                            <?php $displayed_votes = TRUE; ?>
97
+                            <?php $displayed_votes = true; ?>
98 98
 
99 99
                         <?php endif; ?>
100 100
 
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/mp/recent.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
                 if ( isset($divisions) && $divisions ) {
39 39
                     if ($has_voting_record) {
40 40
                         foreach ($divisions as $division) {
41
-                          $displayed_votes = TRUE;
41
+                            $displayed_votes = TRUE;
42 42
 
43
-                          if ($current_date != $division['date']) {
43
+                            if ($current_date != $division['date']) {
44 44
                             if ($current_date != '' ) {
45
-                              print('</ul></div>');
45
+                                print('</ul></div>');
46 46
                             }
47 47
                             $current_date = $division['date'];
48 48
                             $sidebar_links[] = $division['date'];
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
                             <h2><?= strftime('%e %b %Y', strtotime($division['date'])) ?></h2>
52 52
                              <ul class="vote-descriptions policy-votes">
53 53
                           <?php }
54
-                          include('_division_description.php');
54
+                            include('_division_description.php');
55 55
                         }
56 56
                         echo('</div>');
57 57
                     }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-include_once INCLUDESPATH . "easyparliament/templates/html/mp/header.php";
2
+include_once INCLUDESPATH."easyparliament/templates/html/mp/header.php";
3 3
 ?>
4 4
 
5 5
 <div class="full-page">
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
                 $current_date = '';
36 36
                 $sidebar_links = array();
37 37
 
38
-                if ( isset($divisions) && $divisions ) {
38
+                if (isset($divisions) && $divisions) {
39 39
                     if ($has_voting_record) {
40 40
                         foreach ($divisions as $division) {
41 41
                           $displayed_votes = TRUE;
42 42
 
43 43
                           if ($current_date != $division['date']) {
44
-                            if ($current_date != '' ) {
44
+                            if ($current_date != '') {
45 45
                               print('</ul></div>');
46 46
                             }
47 47
                             $current_date = $division['date'];
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
             <div class="sidebar__unit in-page-nav">
69 69
                 <ul data-magellan-expedition="fixed">
70
-                  <?php foreach($sidebar_links as $date) { ?>
70
+                  <?php foreach ($sidebar_links as $date) { ?>
71 71
                     <li data-magellan-arrival="<?= strftime('%Y-%m-%d', strtotime($date)) ?>">
72 72
                         <a href="#<?= strftime('%Y-%m-%d', strtotime($date)) ?>">
73 73
                             <?= strftime('%e %b %Y', strtotime($date)) ?>
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,15 +30,15 @@
 block discarded – undo
30 30
 
31 31
                 <?php
32 32
 
33
-                $displayed_votes = FALSE;
34
-                $show_all = TRUE;
33
+                $displayed_votes = false;
34
+                $show_all = true;
35 35
                 $current_date = '';
36 36
                 $sidebar_links = array();
37 37
 
38 38
                 if ( isset($divisions) && $divisions ) {
39 39
                     if ($has_voting_record) {
40 40
                         foreach ($divisions as $division) {
41
-                          $displayed_votes = TRUE;
41
+                          $displayed_votes = true;
42 42
 
43 43
                           if ($current_date != $division['date']) {
44 44
                             if ($current_date != '' ) {
Please login to merge, or discard this patch.