@@ -185,8 +185,7 @@ discard block |
||
185 | 185 | WHERE edit_id=" . $approval_id . ";"); |
186 | 186 | if (!$q->success()) { |
187 | 187 | break; |
188 | - } |
|
189 | - else { |
|
188 | + } else { |
|
190 | 189 | // Now send them an email telling them they've been approved |
191 | 190 | |
192 | 191 | |
@@ -227,8 +226,7 @@ discard block |
||
227 | 226 | WHERE edit_id=" . $decline_id . ";"); |
228 | 227 | if (!$q->success()) { |
229 | 228 | break; |
230 | - } |
|
231 | - else { |
|
229 | + } else { |
|
232 | 230 | // Scrub that one from the list of pending items |
233 | 231 | unset ($this->pending[$decline_id]); |
234 | 232 | } |
@@ -266,8 +264,7 @@ discard block |
||
266 | 264 | $this->update_pending_count(); |
267 | 265 | |
268 | 266 | return true; |
269 | - } |
|
270 | - else { |
|
267 | + } else { |
|
271 | 268 | return false; |
272 | 269 | } |
273 | 270 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | // the new epobject id and approval details. |
179 | 179 | $q = $this->db->query("UPDATE editqueue |
180 | 180 | SET |
181 | - epobject_id_l='" . $this->current_epobject_id. "', |
|
181 | + epobject_id_l='" . $this->current_epobject_id . "', |
|
182 | 182 | editor_id='" . addslashes($THEUSER->user_id()) . "', |
183 | 183 | approved='1', |
184 | 184 | decided='" . $timestamp . "' |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | $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;"); |
261 | 261 | if ($q->success() && $q->rows()) { |
262 | 262 | for ($i = 0; $i < ($q->rows()); $i++) { |
263 | - $this->pending[ $q->field($i,"edit_id") ] = $q->row($i); |
|
263 | + $this->pending[$q->field($i, "edit_id")] = $q->row($i); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | $this->update_pending_count(); |
@@ -68,8 +68,7 @@ |
||
68 | 68 | WHERE edit_id=" . $approval_id . ";"); |
69 | 69 | if (!$q->success()) { |
70 | 70 | break; |
71 | - } |
|
72 | - else { |
|
71 | + } else { |
|
73 | 72 | // Scrub that one from the list of pending items |
74 | 73 | unset ($this->pending[$approval_id]); |
75 | 74 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | // the new epobject id and approval details. |
62 | 62 | $q = $this->db->query("UPDATE editqueue |
63 | 63 | SET |
64 | - glossary_id='" . $this->current_epobject_id. "', |
|
64 | + glossary_id='" . $this->current_epobject_id . "', |
|
65 | 65 | editor_id='" . addslashes($THEUSER->user_id()) . "', |
66 | 66 | approved='1', |
67 | 67 | decided='" . $timestamp . "' |
@@ -2,13 +2,13 @@ discard block |
||
2 | 2 | // Some sketchy crap for displaying pending glossary additions |
3 | 3 | |
4 | 4 | include_once '../../includes/easyparliament/init.php'; |
5 | -include_once (INCLUDESPATH."easyparliament/glossary.php"); |
|
5 | +include_once (INCLUDESPATH . "easyparliament/glossary.php"); |
|
6 | 6 | |
7 | 7 | $this_page = "admin_glossary_pending"; |
8 | 8 | |
9 | 9 | $EDITQUEUE = new \MySociety\TheyWorkForYou\GlossaryEditQueue; |
10 | 10 | |
11 | -$args = array ( |
|
11 | +$args = array( |
|
12 | 12 | 'sort' => "regexp_replace" |
13 | 13 | ); |
14 | 14 | $GLOSSARY = new GLOSSARY($args); |
@@ -23,19 +23,19 @@ discard block |
||
23 | 23 | if (get_http_var('approve')) { |
24 | 24 | $approve = get_http_var('approve'); |
25 | 25 | if (!is_array($approve)) { |
26 | - $approve = array ( $approve ); |
|
26 | + $approve = array($approve); |
|
27 | 27 | } |
28 | 28 | // Add all approved items |
29 | - $data = array ( |
|
29 | + $data = array( |
|
30 | 30 | 'approvals' => $approve, |
31 | 31 | 'epobject_type' => 2 |
32 | 32 | ); |
33 | 33 | $EDITQUEUE->approve($data); |
34 | 34 | } |
35 | 35 | elseif (get_http_var('decline')) { |
36 | - $decline = array (get_http_var('decline')); |
|
36 | + $decline = array(get_http_var('decline')); |
|
37 | 37 | // Dump all declined items |
38 | - $data = array ( |
|
38 | + $data = array( |
|
39 | 39 | 'declines' => $decline, |
40 | 40 | 'epobject_type' => 2 |
41 | 41 | ); |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | |
55 | 55 | // Mock up a "current term" to send to the display function |
56 | 56 | if (get_http_var('previewterm')) { |
57 | - $body = get_http_var('definition'); |
|
58 | - $title = get_http_var('g'); |
|
57 | + $body = get_http_var('definition'); |
|
58 | + $title = get_http_var('g'); |
|
59 | 59 | } |
60 | 60 | else { |
61 | 61 | $body = $EDITQUEUE->pending[$glossary_id]['body']; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | // add a modification to the database |
117 | 117 | if (get_http_var('submitterm') && get_http_var('modify')) { |
118 | - $data = array ( |
|
118 | + $data = array( |
|
119 | 119 | 'user_id' => get_http_var('userid'), |
120 | 120 | 'title' => get_http_var('g'), |
121 | 121 | 'body' => get_http_var('definition') |
@@ -2,13 +2,13 @@ discard block |
||
2 | 2 | // Some sketchy crap for displaying pending glossary additions |
3 | 3 | |
4 | 4 | include_once '../../includes/easyparliament/init.php'; |
5 | -include_once (INCLUDESPATH."easyparliament/glossary.php"); |
|
5 | +include_once (INCLUDESPATH . "easyparliament/glossary.php"); |
|
6 | 6 | |
7 | 7 | $this_page = "admin_glossary"; |
8 | 8 | |
9 | 9 | $EDITQUEUE = new \MySociety\TheyWorkForYou\GlossaryEditQueue; |
10 | 10 | |
11 | -$args = array ( |
|
11 | +$args = array( |
|
12 | 12 | 'sort' => "regexp_replace" |
13 | 13 | ); |
14 | 14 | |
@@ -21,19 +21,19 @@ discard block |
||
21 | 21 | if (get_http_var('approve')) { |
22 | 22 | $approve = get_http_var('approve'); |
23 | 23 | if (!is_array($approve)) { |
24 | - $approve = array ( $approve ); |
|
24 | + $approve = array($approve); |
|
25 | 25 | } |
26 | 26 | // Add all approved items |
27 | - $data = array ( |
|
27 | + $data = array( |
|
28 | 28 | 'approvals' => $approve, |
29 | 29 | 'epobject_type' => 2 |
30 | 30 | ); |
31 | 31 | $EDITQUEUE->approve($data); |
32 | 32 | } |
33 | 33 | elseif (get_http_var('decline')) { |
34 | - $decline = array (get_http_var('decline')); |
|
34 | + $decline = array(get_http_var('decline')); |
|
35 | 35 | // Dump all declined items |
36 | - $data = array ( |
|
36 | + $data = array( |
|
37 | 37 | 'declines' => $decline, |
38 | 38 | 'epobject_type' => 2 |
39 | 39 | ); |
@@ -21,20 +21,20 @@ discard block |
||
21 | 21 | */ |
22 | 22 | |
23 | 23 | // This handles basic insertion and approval functions for all epobjects |
24 | -include_once INCLUDESPATH."easyparliament/searchengine.php"; |
|
24 | +include_once INCLUDESPATH . "easyparliament/searchengine.php"; |
|
25 | 25 | |
26 | 26 | class GLOSSARY { |
27 | 27 | |
28 | - public $num_terms; // how many glossary entries do we have |
|
28 | + public $num_terms; // how many glossary entries do we have |
|
29 | 29 | // (changes depending on how GLOSSARY is called |
30 | - public $hansard_count; // how many times does the phrase appear in hansard? |
|
31 | - public $query; // search term |
|
32 | - public $glossary_id; // if this is set then we only have 1 glossary term |
|
33 | - public $current_term; // will only be set if we have a valid epobject_id |
|
30 | + public $hansard_count; // how many times does the phrase appear in hansard? |
|
31 | + public $query; // search term |
|
32 | + public $glossary_id; // if this is set then we only have 1 glossary term |
|
33 | + public $current_term; // will only be set if we have a valid epobject_id |
|
34 | 34 | public $current_letter; |
35 | 35 | |
36 | 36 | // constructor... |
37 | - public function __construct($args=array()) { |
|
37 | + public function __construct($args = array()) { |
|
38 | 38 | // We can optionally start the glossary with one of several arguments |
39 | 39 | // 1. glossary_id - treat the glossary as a single term |
40 | 40 | // 2. glossary_term - search within glossary for a term |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | |
74 | 74 | // These stop stupid submissions. |
75 | 75 | // everything should be lowercase. |
76 | - $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" ); |
|
76 | + $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"); |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | |
80 | - public function get_glossary_item($args=array()) { |
|
80 | + public function get_glossary_item($args = array()) { |
|
81 | 81 | // Search for and fetch glossary item with title or glossary_id |
82 | 82 | // We could also search glossary text that contains the title text, for cross references |
83 | 83 | |
84 | 84 | $this->alphabet = array(); |
85 | - foreach (range ("A", "Z") as $letter) { |
|
85 | + foreach (range("A", "Z") as $letter) { |
|
86 | 86 | $this->alphabet[$letter] = array(); |
87 | 87 | } |
88 | 88 | |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | WHERE g.glossary_id=eq.glossary_id AND u.user_id=eq.user_id AND g.visible=1 AND eq.approved=1 |
92 | 92 | ORDER by g.title"); |
93 | 93 | if ($q->success() && $q->rows()) { |
94 | - for ($i=0; $i < $q->rows(); $i++) { |
|
95 | - $this->terms[ $q->field($i,"glossary_id") ] = $q->row($i); |
|
94 | + for ($i = 0; $i < $q->rows(); $i++) { |
|
95 | + $this->terms[$q->field($i, "glossary_id")] = $q->row($i); |
|
96 | 96 | // Now add the epobject to the alphabet navigation. |
97 | - $first_letter = strtoupper(substr($q->field($i,"title"),0,1)); |
|
98 | - $this->alphabet[$first_letter][] = $q->field($i,"glossary_id"); |
|
97 | + $first_letter = strtoupper(substr($q->field($i, "title"), 0, 1)); |
|
98 | + $this->alphabet[$first_letter][] = $q->field($i, "glossary_id"); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | $this->num_terms = $q->rows(); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | - public function search_glossary($args=array()) { |
|
141 | + public function search_glossary($args = array()) { |
|
142 | 142 | // Search for and fetch glossary item with a title |
143 | 143 | // Useful for the search page, and nowhere else (so far) |
144 | 144 | |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | ORDER by g.title"; |
154 | 154 | $q = $this->db->query($query); |
155 | 155 | if ($q->success() && $q->rows()) { |
156 | - for ($i=0; $i < $q->rows(); $i++) { |
|
157 | - $this->search_matches[ $q->field($i,"glossary_id") ] = $q->row($i); |
|
156 | + for ($i = 0; $i < $q->rows(); $i++) { |
|
157 | + $this->search_matches[$q->field($i, "glossary_id")] = $q->row($i); |
|
158 | 158 | } |
159 | 159 | $this->num_search_matches = $q->rows(); |
160 | 160 | } |
@@ -190,12 +190,12 @@ discard block |
||
190 | 190 | global $THEUSER; |
191 | 191 | |
192 | 192 | if ($data['title'] == '') { |
193 | - error ("Sorry, you can't define a term without a title"); |
|
193 | + error("Sorry, you can't define a term without a title"); |
|
194 | 194 | return false; |
195 | 195 | } |
196 | 196 | |
197 | 197 | if ($data['body'] == '') { |
198 | - error ("You haven't entered a definition!"); |
|
198 | + error("You haven't entered a definition!"); |
|
199 | 199 | return false; |
200 | 200 | } |
201 | 201 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | } |
249 | 249 | } |
250 | 250 | |
251 | - public function glossarise($body, $tokenize=0, $urlize=0) { |
|
251 | + public function glossarise($body, $tokenize = 0, $urlize = 0) { |
|
252 | 252 | // Turn a body of text into a link-up wonderland of glossary joy |
253 | 253 | |
254 | 254 | global $this_page; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | } |
292 | 292 | else { |
293 | 293 | if ($this_page == "admin_glossary") { |
294 | - $link_url = "#gl".$glossary_id; |
|
294 | + $link_url = "#gl" . $glossary_id; |
|
295 | 295 | } |
296 | 296 | else { |
297 | 297 | $link_url = $URL->generate('url'); |