@@ -6,6 +6,6 @@ |
||
6 | 6 | 'title' => "Search Tips" |
7 | 7 | )); |
8 | 8 | |
9 | -include INCLUDESPATH . 'easyparliament/staticpages/search_help.php'; |
|
9 | +include INCLUDESPATH.'easyparliament/staticpages/search_help.php'; |
|
10 | 10 | |
11 | 11 | $this->block_end(); |
@@ -33,19 +33,19 @@ discard block |
||
33 | 33 | list($firstyear, $firstmonth, $day) = explode('-', $min_future_date); |
34 | 34 | list($finalyear, $finalmonth, $day) = explode('-', $max_future_date); |
35 | 35 | |
36 | -$q = $db->query("SELECT DISTINCT(event_date) AS event_date FROM future |
|
36 | +$q = $db->query("SELECT DISTINCT(event_date) AS event_date FROM future |
|
37 | 37 | WHERE event_date >= :firstdate |
38 | 38 | AND event_date <= :finaldate |
39 | 39 | AND deleted = 0 |
40 | 40 | ORDER BY event_date ASC |
41 | 41 | ", array( |
42 | - ':firstdate' => $firstyear . '-' . $firstmonth . '-01', |
|
43 | - ':finaldate' => $finalyear . '-' . $finalmonth . '-31' |
|
42 | + ':firstdate' => $firstyear.'-'.$firstmonth.'-01', |
|
43 | + ':finaldate' => $finalyear.'-'.$finalmonth.'-31' |
|
44 | 44 | )); |
45 | 45 | |
46 | 46 | if ($q->rows() > 0) { |
47 | 47 | $years = array(); |
48 | - for ($row=0; $row<$q->rows(); $row++) { |
|
48 | + for ($row = 0; $row < $q->rows(); $row++) { |
|
49 | 49 | list($year, $month, $day) = explode('-', $q->field($row, 'event_date')); |
50 | 50 | $month = intval($month); |
51 | 51 | $years[$year][$month][] = intval($day); |
@@ -77,6 +77,6 @@ discard block |
||
77 | 77 | $data['years'] = $years; |
78 | 78 | } |
79 | 79 | |
80 | -include INCLUDESPATH . 'easyparliament/templates/html/hansard_calendar.php'; |
|
80 | +include INCLUDESPATH.'easyparliament/templates/html/hansard_calendar.php'; |
|
81 | 81 | |
82 | 82 | $PAGE->block_end(); |
@@ -9,7 +9,7 @@ |
||
9 | 9 | |
10 | 10 | $this->block_start(array('title'=>"Site news", 'url'=>$sitenewsurl)); |
11 | 11 | |
12 | -include BASEDIR . '/news/home_page_include.php'; |
|
12 | +include BASEDIR.'/news/home_page_include.php'; |
|
13 | 13 | ?> |
14 | 14 | |
15 | 15 | <p><a href="<?php echo $archiveurl; ?>">Archive</a></p> |
@@ -210,8 +210,8 @@ |
||
210 | 210 | array(':epobject_id' => $this->epobject_id)); |
211 | 211 | |
212 | 212 | if ($q->rows() > 0) { |
213 | - // If you change stuff here, you might have to change it in |
|
214 | - // $COMMENTLIST->_get_comment_data() too... |
|
213 | + // If you change stuff here, you might have to change it in |
|
214 | + // $COMMENTLIST->_get_comment_data() too... |
|
215 | 215 | |
216 | 216 | $gid = fix_gid_from_db($q->field(0, 'gid')); // In includes/utility.php |
217 | 217 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public $body = ''; |
32 | 32 | public $posted = ''; |
33 | 33 | public $visible = false; |
34 | - public $modflagged = NULL; // Is a datetime when set. |
|
34 | + public $modflagged = null; // Is a datetime when set. |
|
35 | 35 | public $firstname = ''; // Of the person who posted it. |
36 | 36 | public $lastname = ''; |
37 | 37 | public $url = ''; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $flag = "'$date'"; |
139 | 139 | |
140 | 140 | } elseif ($switch == 'off') { |
141 | - $date = NULL; |
|
141 | + $date = null; |
|
142 | 142 | $flag = 'NULL'; |
143 | 143 | |
144 | 144 | } else { |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | public $body = ''; |
32 | 32 | public $posted = ''; |
33 | 33 | public $visible = false; |
34 | - public $modflagged = NULL; // Is a datetime when set. |
|
35 | - public $firstname = ''; // Of the person who posted it. |
|
34 | + public $modflagged = NULL; // Is a datetime when set. |
|
35 | + public $firstname = ''; // Of the person who posted it. |
|
36 | 36 | public $lastname = ''; |
37 | 37 | public $url = ''; |
38 | 38 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public $exists = false; |
42 | 42 | |
43 | 43 | |
44 | - public function __construct($comment_id='') { |
|
44 | + public function __construct($comment_id = '') { |
|
45 | 45 | |
46 | 46 | $this->db = new ParlDB; |
47 | 47 | |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | if ($q->rows() > 0) { |
70 | 70 | |
71 | 71 | $this->comment_id = $comment_id; |
72 | - $this->user_id = $q->field(0, 'user_id'); |
|
72 | + $this->user_id = $q->field(0, 'user_id'); |
|
73 | 73 | $this->epobject_id = $q->field(0, 'epobject_id'); |
74 | - $this->body = $q->field(0, 'body'); |
|
75 | - $this->posted = $q->field(0, 'posted'); |
|
76 | - $this->visible = $q->field(0, 'visible'); |
|
77 | - $this->modflagged = $q->field(0, 'modflagged'); |
|
74 | + $this->body = $q->field(0, 'body'); |
|
75 | + $this->posted = $q->field(0, 'posted'); |
|
76 | + $this->visible = $q->field(0, 'visible'); |
|
77 | + $this->modflagged = $q->field(0, 'modflagged'); |
|
78 | 78 | |
79 | 79 | // Sets the URL and username for this comment. Duh. |
80 | 80 | $this->_set_url(); |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | public function comments_enabled() { return $this->comments_enabled; } |
105 | 105 | |
106 | 106 | |
107 | - public function display($format='html', $template='comments') { |
|
107 | + public function display($format = 'html', $template = 'comments') { |
|
108 | 108 | |
109 | - $data['comments'][0] = array ( |
|
109 | + $data['comments'][0] = array( |
|
110 | 110 | 'comment_id' => $this->comment_id, |
111 | 111 | 'user_id' => $this->user_id, |
112 | 112 | 'epobject_id' => $this->epobject_id, |
@@ -142,19 +142,19 @@ discard block |
||
142 | 142 | $flag = 'NULL'; |
143 | 143 | |
144 | 144 | } else { |
145 | - $PAGE->error_message ("Why are you trying to switch this comment's modflag to '" . _htmlentities($switch) . "'!"); |
|
145 | + $PAGE->error_message("Why are you trying to switch this comment's modflag to '"._htmlentities($switch)."'!"); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | $q = $this->db->query("UPDATE comments |
149 | 149 | SET modflagged = $flag |
150 | - WHERE comment_id = '" . $this->comment_id . "' |
|
150 | + WHERE comment_id = '".$this->comment_id."' |
|
151 | 151 | "); |
152 | 152 | |
153 | 153 | if ($q->success()) { |
154 | 154 | $this->modflagged = $date; |
155 | 155 | return true; |
156 | 156 | } else { |
157 | - $message = array ( |
|
157 | + $message = array( |
|
158 | 158 | 'title' => 'Sorry', |
159 | 159 | 'text' => "We couldn't update the annotation's modflag." |
160 | 160 | ); |
@@ -171,12 +171,12 @@ discard block |
||
171 | 171 | global $THEUSER, $PAGE; |
172 | 172 | |
173 | 173 | if ($THEUSER->is_able_to('deletecomment')) { |
174 | - $q = $this->db->query("UPDATE comments SET visible = '0' WHERE comment_id = '" . $this->comment_id . "'"); |
|
174 | + $q = $this->db->query("UPDATE comments SET visible = '0' WHERE comment_id = '".$this->comment_id."'"); |
|
175 | 175 | |
176 | 176 | if ($q->success()) { |
177 | 177 | return true; |
178 | 178 | } else { |
179 | - $message = array ( |
|
179 | + $message = array( |
|
180 | 180 | 'title' => 'Sorry', |
181 | 181 | 'text' => "We were unable to delete the annotation." |
182 | 182 | ); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | } else { |
188 | - $message = array ( |
|
188 | + $message = array( |
|
189 | 189 | 'title' => 'Sorry', |
190 | 190 | 'text' => "You are not authorised to delete annotations." |
191 | 191 | ); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | |
221 | 221 | $URL = new \MySociety\TheyWorkForYou\Url($page); |
222 | 222 | $URL->insert(array('id'=>$gid)); |
223 | - $this->url = $URL->generate() . '#c' . $this->comment_id; |
|
223 | + $this->url = $URL->generate().'#c'.$this->comment_id; |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | } |
@@ -12,20 +12,20 @@ discard block |
||
12 | 12 | ), |
13 | 13 | 2001 => array( |
14 | 14 | 1=>array('less'=>8), |
15 | - 2=>array('between'=>array(15,26)), |
|
16 | - 4=>array('between'=>array(10,23)), |
|
15 | + 2=>array('between'=>array(15, 26)), |
|
16 | + 4=>array('between'=>array(10, 23)), |
|
17 | 17 | 5=>array('more'=>13), |
18 | 18 | 6=>array('less'=>13), |
19 | 19 | 7=>array('more'=>20), |
20 | 20 | 8=>array('all'=>1), |
21 | 21 | 9=>array('less'=>14, 'more'=>14), |
22 | - 10=>array('less'=>4, 'between'=>array(4,8, 8,15)), |
|
22 | + 10=>array('less'=>4, 'between'=>array(4, 8, 8, 15)), |
|
23 | 23 | 12=>array('more'=>19) ), |
24 | 24 | 2002 => array( |
25 | 25 | 1=>array('less'=>8), |
26 | - 2=>array('between'=>array(14,25)), |
|
26 | + 2=>array('between'=>array(14, 25)), |
|
27 | 27 | 3=>array('more'=>26), |
28 | - 4=>array('less'=>3, 'between'=>array(3,10)), |
|
28 | + 4=>array('less'=>3, 'between'=>array(3, 10)), |
|
29 | 29 | 5=>array('more'=>24), |
30 | 30 | 6=>array('less'=>10), |
31 | 31 | 7=>array('more'=>24), |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | 12=>array('more'=>19) ), |
36 | 36 | 2003 => array( |
37 | 37 | 1=>array('less'=>7), |
38 | - 2=>array('between'=>array(13,24)), |
|
39 | - 4=>array('between'=>array(14,28)), |
|
38 | + 2=>array('between'=>array(13, 24)), |
|
39 | + 4=>array('between'=>array(14, 28)), |
|
40 | 40 | 5=>array('more'=>22), |
41 | 41 | 6=>array('less'=>3), |
42 | 42 | 7=>array('more'=>17), |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | 12=>array('more'=>18)), |
47 | 47 | 2004 => array( |
48 | 48 | 1=>array('less'=>5), |
49 | - 2=>array('between'=>array(12,23)), |
|
50 | - 4=>array('between'=>array(1,19)), |
|
49 | + 2=>array('between'=>array(12, 23)), |
|
50 | + 4=>array('between'=>array(1, 19)), |
|
51 | 51 | 5=>array('more'=>27), |
52 | 52 | 6=>array('less'=>7), |
53 | 53 | 7=>array('more'=>22), |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | 12=>array('more'=>21) ), |
58 | 58 | 2005 => array( |
59 | 59 | 1=>array('less'=>10), |
60 | - 2=>array('between'=>array(10,21)), |
|
60 | + 2=>array('between'=>array(10, 21)), |
|
61 | 61 | 3=>array('more'=>24), |
62 | 62 | 4=>array('less'=>4, 'more'=>10), |
63 | 63 | 5=>array('less'=>11, 'more'=>26), |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | 12=>array('more'=>20) ), |
70 | 70 | 2006 => array( |
71 | 71 | 1=>array('less'=>9), |
72 | - 2=>array('between'=>array(16,27)), |
|
72 | + 2=>array('between'=>array(16, 27)), |
|
73 | 73 | 3=>array('more'=>30), |
74 | 74 | 4=>array('less'=>18), |
75 | 75 | 5=>array('more'=>25), |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | ), |
83 | 83 | 2007 => array( |
84 | 84 | 1=>array('less'=>8), |
85 | - 2=>array('between'=>array(8,19)), |
|
85 | + 2=>array('between'=>array(8, 19)), |
|
86 | 86 | 3=>array('more'=>29), |
87 | 87 | 4=>array('less'=>16), |
88 | 88 | 5=>array('more'=>24), |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | ), |
96 | 96 | 2008 => array( |
97 | 97 | 1=>array('less'=>7), |
98 | - 2=>array('between'=>array(7,18)), |
|
99 | - 4=>array('between'=>array(3,21)), |
|
98 | + 2=>array('between'=>array(7, 18)), |
|
99 | + 4=>array('between'=>array(3, 21)), |
|
100 | 100 | 5=>array('more'=>22), |
101 | 101 | 6=>array('less'=>2), |
102 | 102 | 7=>array('more'=>22), |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | ), |
108 | 108 | 2009 => array( |
109 | 109 | 1=>array('less'=>12), |
110 | - 2=>array('between'=>array(12,23)), |
|
111 | - 4=>array('between'=>array(2,20)), |
|
110 | + 2=>array('between'=>array(12, 23)), |
|
111 | + 4=>array('between'=>array(2, 20)), |
|
112 | 112 | 5=>array('more'=>21), |
113 | 113 | 6=>array('less'=>1), |
114 | 114 | 7=>array('more'=>21), |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | ), |
120 | 120 | 2010 => array( |
121 | 121 | 1=>array('less'=>5), |
122 | - 2=>array('between'=>array(10,22)), |
|
122 | + 2=>array('between'=>array(10, 22)), |
|
123 | 123 | 3=>array('more'=>30), |
124 | 124 | 4=>array('less'=>6, 'more'=>8), |
125 | 125 | 5=>array('less'=>18, 'more'=>27), |
@@ -132,62 +132,62 @@ discard block |
||
132 | 132 | ), |
133 | 133 | 2011 => array( |
134 | 134 | 1=>array('less'=>10), |
135 | - 2=>array('between'=>array(17,28)), |
|
136 | - 4=>array('between'=>array(5,26)), |
|
135 | + 2=>array('between'=>array(17, 28)), |
|
136 | + 4=>array('between'=>array(5, 26)), |
|
137 | 137 | 5=>array('more'=>24), |
138 | 138 | 6=>array('less'=>7), |
139 | 139 | 7=>array('more'=>19), |
140 | 140 | 8=>array('all'=>1), |
141 | 141 | 9=>array('less'=>5, 'more'=>15), |
142 | 142 | 10=>array('less'=>10), |
143 | - 11=>array('between'=>array(15,21)), |
|
143 | + 11=>array('between'=>array(15, 21)), |
|
144 | 144 | 12=>array('more'=>20), |
145 | 145 | ), |
146 | 146 | 2012 => array( |
147 | 147 | 1=>array('less'=>10), |
148 | - 2=>array('between'=>array(9,20)), |
|
148 | + 2=>array('between'=>array(9, 20)), |
|
149 | 149 | 3=>array('more'=>27), |
150 | 150 | 4=>array('less'=>16), |
151 | 151 | 5=>array('more'=>24), |
152 | 152 | 6=>array('less'=>11), |
153 | 153 | 7=>array('more'=>17), |
154 | 154 | 8=>array('all'=>1), |
155 | - 9=>array('less'=>3,'more'=>18), |
|
155 | + 9=>array('less'=>3, 'more'=>18), |
|
156 | 156 | 10=>array('less'=>15), |
157 | - 11=>array('between'=>array(13,19)), |
|
157 | + 11=>array('between'=>array(13, 19)), |
|
158 | 158 | 12=>array('more'=>20) |
159 | 159 | ), |
160 | 160 | 2013 => array( |
161 | 161 | 1=>array('less'=>7), |
162 | - 2=>array('between'=>array(14,25)), |
|
162 | + 2=>array('between'=>array(14, 25)), |
|
163 | 163 | 3=>array('more'=>26), |
164 | 164 | 4=>array('less'=>15), |
165 | 165 | 5=>array('more'=>21), |
166 | 166 | 6=>array('less'=>3), |
167 | 167 | 7=>array('more'=>18), |
168 | 168 | 8=>array('all'=>1), |
169 | - 9=>array('less'=>2,'more'=>13), |
|
169 | + 9=>array('less'=>2, 'more'=>13), |
|
170 | 170 | 10=>array('less'=>8), |
171 | - 11=>array('between'=>array(12,18)), |
|
171 | + 11=>array('between'=>array(12, 18)), |
|
172 | 172 | 12=>array('more'=>19) |
173 | 173 | ), |
174 | 174 | 2014 => array( |
175 | 175 | 1=>array('less'=>6), |
176 | - 2=>array('between'=>array(13,24)), |
|
177 | - 4=>array('between'=>array(10,28)), |
|
178 | - 5=>array('between'=>array(1,6)) |
|
176 | + 2=>array('between'=>array(13, 24)), |
|
177 | + 4=>array('between'=>array(10, 28)), |
|
178 | + 5=>array('between'=>array(1, 6)) |
|
179 | 179 | ), |
180 | 180 | 2015 => array( |
181 | 181 | 7=>array('more'=>21), |
182 | 182 | 8=>array('all'=>1), |
183 | 183 | 9=>array('less'=>7, 'more'=>17), |
184 | 184 | 10=>array('less'=>12), |
185 | - 11=>array('between'=>array(10,16)), |
|
185 | + 11=>array('between'=>array(10, 16)), |
|
186 | 186 | 12=>array('more'=>17) |
187 | 187 | ), |
188 | 188 | 2016 => array( |
189 | 189 | 1=>array('less'=>5), |
190 | - 2=>array('between'=>array(11,22)) |
|
190 | + 2=>array('between'=>array(11, 22)) |
|
191 | 191 | ) |
192 | 192 | ); |
193 | 193 | # Lords differences |
@@ -199,15 +199,15 @@ discard block |
||
199 | 199 | $GLOBALS['recessdates'][101][2010][12]['more'] = 22; |
200 | 200 | $GLOBALS['recessdates'][101][2011] = array( |
201 | 201 | 1 => array('less'=>10), |
202 | - 2 => array('between'=>array(16,28)), |
|
203 | - 4 => array('between'=>array(6,26)), |
|
202 | + 2 => array('between'=>array(16, 28)), |
|
203 | + 4 => array('between'=>array(6, 26)), |
|
204 | 204 | 5 => array('more'=>25), |
205 | 205 | 6 => array('less'=>6), |
206 | 206 | 7 => array('more'=>20), |
207 | 207 | 8 => array('all'=>1), |
208 | 208 | 9 => array('less'=>5, 'more'=>15), |
209 | 209 | 10 => array('less'=>3), |
210 | - 11=>array('between'=>array(16,21)), |
|
210 | + 11=>array('between'=>array(16, 21)), |
|
211 | 211 | 12 => array('more'=>21), |
212 | 212 | ); |
213 | 213 | |
@@ -216,74 +216,74 @@ discard block |
||
216 | 216 | 1999 => array( |
217 | 217 | 7 => array('more' => 2), |
218 | 218 | 8 => array('less' => 31), |
219 | - 10 => array('between' => array(8,25)), |
|
219 | + 10 => array('between' => array(8, 25)), |
|
220 | 220 | 12 => array('more' => 17) |
221 | 221 | ), |
222 | 222 | 2000 => array( |
223 | 223 | 1 => array('less' => 10), |
224 | - 4 => array('between' => array(7,25)), |
|
224 | + 4 => array('between' => array(7, 25)), |
|
225 | 225 | 7 => array('more' => 7), |
226 | 226 | 8 => array('all' => 1), |
227 | 227 | 9 => array('less' => 4), |
228 | - 10 => array('between' => array(6,23)), |
|
228 | + 10 => array('between' => array(6, 23)), |
|
229 | 229 | 12 => array('more' => 20) |
230 | 230 | ), |
231 | 231 | 2001 => array( |
232 | 232 | 1=>array('less'=>8), |
233 | - 2=>array('between'=>array(16,26)), |
|
234 | - 4=>array('between'=>array(6,23)), |
|
233 | + 2=>array('between'=>array(16, 26)), |
|
234 | + 4=>array('between'=>array(6, 23)), |
|
235 | 235 | 6=>array('more'=>29), |
236 | 236 | 7=>array('all'=>1), |
237 | 237 | 8=>array('all'=>1), |
238 | 238 | 9=>array('less'=>3), |
239 | - 10=>array('between'=>array(5,22)), |
|
239 | + 10=>array('between'=>array(5, 22)), |
|
240 | 240 | 12=>array('more'=>21) ), |
241 | 241 | 2002 => array( |
242 | 242 | 1=>array('less'=>7), |
243 | - 2=>array('between'=>array(15,25)), |
|
243 | + 2=>array('between'=>array(15, 25)), |
|
244 | 244 | 3=>array('more'=>28), |
245 | 245 | 4=>array('less'=>15), |
246 | 246 | 7=>array('more'=>10), |
247 | 247 | 8=>array('all'=>1), |
248 | 248 | 9=>array('less'=>2), |
249 | - 10=>array('between'=>array(11,28)), |
|
249 | + 10=>array('between'=>array(11, 28)), |
|
250 | 250 | 12=>array('more'=>20) ), |
251 | 251 | 2003 => array( |
252 | 252 | 1=>array('less'=>6), |
253 | - 4=>array('between'=>array(0,31)), |
|
253 | + 4=>array('between'=>array(0, 31)), |
|
254 | 254 | 5=>array('less'=>2), |
255 | 255 | 6=>array('more'=>27), |
256 | 256 | 7=>array('all'=>1), |
257 | 257 | 8=>array('all'=>1), |
258 | - 10=>array('between'=>array(10,27)), |
|
258 | + 10=>array('between'=>array(10, 27)), |
|
259 | 259 | 12=>array('more'=>19)), |
260 | 260 | 2004 => array( |
261 | 261 | 1=>array('less'=>5), |
262 | - 2=>array('between'=>array(13,23)), |
|
263 | - 4=>array('between'=>array(2,19)), |
|
262 | + 2=>array('between'=>array(13, 23)), |
|
263 | + 4=>array('between'=>array(2, 19)), |
|
264 | 264 | 6=>array('more'=>25), |
265 | 265 | 7=>array('all'=>1), |
266 | 266 | 8=>array('less'=>30), |
267 | - 10=>array('between'=>array(10,23)), |
|
267 | + 10=>array('between'=>array(10, 23)), |
|
268 | 268 | 12=>array('more'=>26) ), |
269 | 269 | 2005 => array( |
270 | 270 | 1=>array('less'=>8), |
271 | - 2=>array('between'=>array(11,21)), |
|
271 | + 2=>array('between'=>array(11, 21)), |
|
272 | 272 | 3=>array('more'=>24), |
273 | 273 | 4=>array('less'=>11), |
274 | 274 | 7=>array('more'=>1), |
275 | 275 | 8=>array('all'=>1), |
276 | 276 | 9=>array('less'=>5), |
277 | - 10=>array('between'=>array(7,24)), |
|
277 | + 10=>array('between'=>array(7, 24)), |
|
278 | 278 | 12=>array('more'=>23) ), |
279 | 279 | 2006 => array( |
280 | 280 | 1=>array('less'=>9), |
281 | - 2=>array('between'=>array(10,20)), |
|
281 | + 2=>array('between'=>array(10, 20)), |
|
282 | 282 | 4=>array('less'=>18), |
283 | 283 | 7=>array('more'=>0), |
284 | 284 | 8=>array('all'=>1), |
285 | 285 | 9=>array('less'=>4), |
286 | - 10=>array('between'=>array(6,23)), |
|
286 | + 10=>array('between'=>array(6, 23)), |
|
287 | 287 | 12=>array('more'=>22), |
288 | 288 | ), |
289 | 289 | 2007 => array( |
@@ -293,18 +293,18 @@ discard block |
||
293 | 293 | 7=>array('all'=>1), |
294 | 294 | 8=>array('all'=>1), |
295 | 295 | 9=>array('less'=>3), |
296 | - 10=>array('between'=>array(5,22)), |
|
296 | + 10=>array('between'=>array(5, 22)), |
|
297 | 297 | 12=>array('more'=>21), |
298 | 298 | ), |
299 | 299 | 2008 => array( |
300 | 300 | 1=>array('less'=>5), |
301 | - 2=>array('between'=>array(8,18)), |
|
301 | + 2=>array('between'=>array(8, 18)), |
|
302 | 302 | 3=>array('more'=>28), |
303 | 303 | 4=>array('less'=>14), |
304 | 304 | 6=>array('more'=>27), |
305 | 305 | 7=>array('all'=>1), |
306 | 306 | 8=>array('all'=>1), |
307 | - 10=>array('between'=>array(10,27)), |
|
307 | + 10=>array('between'=>array(10, 27)), |
|
308 | 308 | ), |
309 | 309 | ); |
310 | 310 | |
@@ -358,50 +358,50 @@ discard block |
||
358 | 358 | if (isset($dates[$year][$month]['all'])) { |
359 | 359 | $recess = 'Summer Recess'; |
360 | 360 | if (isset($dates[$year][7]['all'])) { |
361 | - $from = "$year-6-" . $dates[$year][6]['more']; |
|
361 | + $from = "$year-6-".$dates[$year][6]['more']; |
|
362 | 362 | } else { |
363 | - $from = "$year-7-" . $dates[$year][7]['more']; |
|
363 | + $from = "$year-7-".$dates[$year][7]['more']; |
|
364 | 364 | } |
365 | 365 | if (!isset($dates[$year][9])) |
366 | 366 | $to = "$year-08-31"; |
367 | 367 | elseif (isset($dates[$year][9]['all'])) |
368 | - $to = "$year-10-" . $dates[$year][10]['less']; |
|
368 | + $to = "$year-10-".$dates[$year][10]['less']; |
|
369 | 369 | else |
370 | - $to = "$year-9-" . $dates[$year][9]['less']; |
|
370 | + $to = "$year-9-".$dates[$year][9]['less']; |
|
371 | 371 | } |
372 | - if ( (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less']) |
|
372 | + if ((isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less']) |
|
373 | 373 | || (isset($dates[$year][$month]['more']) && $day > $dates[$year][$month]['more']) |
374 | 374 | || (isset($dates[$year][$month]['between']) && $day > $dates[$year][$month]['between'][0] && $day < $dates[$year][$month]['between'][1]) |
375 | - || (isset($dates[$year][$month]['between'][2]) && $day > $dates[$year][$month]['between'][2] && $day < $dates[$year][$month]['between'][3]) ) { |
|
375 | + || (isset($dates[$year][$month]['between'][2]) && $day > $dates[$year][$month]['between'][2] && $day < $dates[$year][$month]['between'][3])) { |
|
376 | 376 | switch ($month) { |
377 | 377 | case 1: case 12: $recess = 'Christmas Recess'; break; |
378 | - case 2: if ($body==1 || $body==101) $recess = 'Half Term Week'; |
|
379 | - elseif ($body==4) $recess = 'February Recess'; |
|
378 | + case 2: if ($body == 1 || $body == 101) $recess = 'Half Term Week'; |
|
379 | + elseif ($body == 4) $recess = 'February Recess'; |
|
380 | 380 | break; |
381 | - case 3: if ($body==1 || $body==101) $recess = 'Easter Recess'; |
|
382 | - elseif ($body==4) $recess = 'Spring Recess'; |
|
381 | + case 3: if ($body == 1 || $body == 101) $recess = 'Easter Recess'; |
|
382 | + elseif ($body == 4) $recess = 'Spring Recess'; |
|
383 | 383 | break; |
384 | 384 | case 4: if (isset($dates[$year][$month]['more']) && $day > $dates[$year][$month]['more']) { |
385 | 385 | $recess = 'Election Recess'; |
386 | - } elseif ($body==4 && $year==2003) { |
|
386 | + } elseif ($body == 4 && $year == 2003) { |
|
387 | 387 | $recess = 'Election Recess'; |
388 | - } elseif ($body==1 || $body==101) { |
|
388 | + } elseif ($body == 1 || $body == 101) { |
|
389 | 389 | $recess = 'Easter Recess'; |
390 | - } elseif ($body==4) { |
|
390 | + } elseif ($body == 4) { |
|
391 | 391 | $recess = 'Spring Recess'; |
392 | 392 | } |
393 | 393 | break; |
394 | - case 5: if ($year==2001 || (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less'])) { |
|
394 | + case 5: if ($year == 2001 || (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less'])) { |
|
395 | 395 | $recess = 'Election Recess'; |
396 | 396 | } else { |
397 | 397 | $recess = 'Whit Recess'; |
398 | 398 | } |
399 | 399 | break; |
400 | - case 6: if ($year==2001) { |
|
400 | + case 6: if ($year == 2001) { |
|
401 | 401 | $recess = 'Election Recess'; |
402 | - } elseif ($body==1 || $body==101) { |
|
402 | + } elseif ($body == 1 || $body == 101) { |
|
403 | 403 | $recess = 'Whit Recess'; |
404 | - } elseif ($body==4) { |
|
404 | + } elseif ($body == 4) { |
|
405 | 405 | $recess = 'Summer Recess'; |
406 | 406 | } else { |
407 | 407 | trigger_error("Argh6"); |
@@ -411,53 +411,53 @@ discard block |
||
411 | 411 | break; |
412 | 412 | case 9: if (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less']) { |
413 | 413 | $recess = 'Summer Recess'; |
414 | - } elseif ($body==1 || $body==101) { |
|
414 | + } elseif ($body == 1 || $body == 101) { |
|
415 | 415 | $recess = 'Conference Recess'; |
416 | 416 | } else { |
417 | 417 | trigger_error("Argh9"); |
418 | 418 | } |
419 | 419 | break; |
420 | - case 10: if ($body==1 || $body==101) $recess = 'Conference Recess'; |
|
421 | - elseif ($body==4) $recess = 'Autumn Recess'; |
|
422 | - elseif ($body==5) $recess = 'Halloween Recess'; |
|
420 | + case 10: if ($body == 1 || $body == 101) $recess = 'Conference Recess'; |
|
421 | + elseif ($body == 4) $recess = 'Autumn Recess'; |
|
422 | + elseif ($body == 5) $recess = 'Halloween Recess'; |
|
423 | 423 | break; |
424 | 424 | case 11: $recess = 'Autumn Recess'; |
425 | 425 | break; |
426 | 426 | default: $recess = 1; |
427 | 427 | } |
428 | 428 | if (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less']) { |
429 | - $to = "$year-$month-" . $dates[$year][$month]['less']; |
|
430 | - if ($month==1) |
|
431 | - $from = ($year-1)."-12-" . $dates[$year-1][12]['more']; |
|
429 | + $to = "$year-$month-".$dates[$year][$month]['less']; |
|
430 | + if ($month == 1) |
|
431 | + $from = ($year - 1)."-12-".$dates[$year - 1][12]['more']; |
|
432 | 432 | else { |
433 | - for ($newmonth = $month-1; $newmonth>=1; $newmonth--) { |
|
433 | + for ($newmonth = $month - 1; $newmonth >= 1; $newmonth--) { |
|
434 | 434 | if (isset($dates[$year][$newmonth]['more'])) { |
435 | - $from = "$year-".($newmonth)."-" . $dates[$year][$newmonth]['more']; |
|
435 | + $from = "$year-".($newmonth)."-".$dates[$year][$newmonth]['more']; |
|
436 | 436 | break; |
437 | 437 | } |
438 | 438 | } |
439 | 439 | } |
440 | 440 | } |
441 | 441 | if (isset($dates[$year][$month]['more']) && $day > $dates[$year][$month]['more']) { |
442 | - $from = "$year-$month-" . $dates[$year][$month]['more']; |
|
443 | - if ($month==12) |
|
444 | - $to = ($year+1)."-01-" . $dates[$year+1][1]['less']; |
|
442 | + $from = "$year-$month-".$dates[$year][$month]['more']; |
|
443 | + if ($month == 12) |
|
444 | + $to = ($year + 1)."-01-".$dates[$year + 1][1]['less']; |
|
445 | 445 | else { |
446 | - for ($newmonth = $month+1; $newmonth<=12; $newmonth++) { |
|
446 | + for ($newmonth = $month + 1; $newmonth <= 12; $newmonth++) { |
|
447 | 447 | if (isset($dates[$year][$newmonth]['less'])) { |
448 | - $to = "$year-".($newmonth)."-" . $dates[$year][$newmonth]['less']; |
|
448 | + $to = "$year-".($newmonth)."-".$dates[$year][$newmonth]['less']; |
|
449 | 449 | break; |
450 | 450 | } |
451 | 451 | } |
452 | 452 | } |
453 | 453 | } |
454 | 454 | if (isset($dates[$year][$month]['between']) && $day > $dates[$year][$month]['between'][0] && $day < $dates[$year][$month]['between'][1]) { |
455 | - $from = "$year-$month-" . $dates[$year][$month]['between'][0]; |
|
456 | - $to = "$year-$month-" . $dates[$year][$month]['between'][1]; |
|
455 | + $from = "$year-$month-".$dates[$year][$month]['between'][0]; |
|
456 | + $to = "$year-$month-".$dates[$year][$month]['between'][1]; |
|
457 | 457 | } |
458 | 458 | if (isset($dates[$year][$month]['between'][2]) && $day > $dates[$year][$month]['between'][2] && $day < $dates[$year][$month]['between'][3]) { |
459 | - $from = "$year-$month-" . $dates[$year][$month]['between'][2]; |
|
460 | - $to = "$year-$month-" . $dates[$year][$month]['between'][3]; |
|
459 | + $from = "$year-$month-".$dates[$year][$month]['between'][2]; |
|
460 | + $to = "$year-$month-".$dates[$year][$month]['between'][3]; |
|
461 | 461 | } |
462 | 462 | } |
463 | 463 | return array($recess, $from, $to); |
@@ -362,12 +362,13 @@ discard block |
||
362 | 362 | } else { |
363 | 363 | $from = "$year-7-" . $dates[$year][7]['more']; |
364 | 364 | } |
365 | - if (!isset($dates[$year][9])) |
|
366 | - $to = "$year-08-31"; |
|
367 | - elseif (isset($dates[$year][9]['all'])) |
|
368 | - $to = "$year-10-" . $dates[$year][10]['less']; |
|
369 | - else |
|
370 | - $to = "$year-9-" . $dates[$year][9]['less']; |
|
365 | + if (!isset($dates[$year][9])) { |
|
366 | + $to = "$year-08-31"; |
|
367 | + } elseif (isset($dates[$year][9]['all'])) { |
|
368 | + $to = "$year-10-" . $dates[$year][10]['less']; |
|
369 | + } else { |
|
370 | + $to = "$year-9-" . $dates[$year][9]['less']; |
|
371 | + } |
|
371 | 372 | } |
372 | 373 | if ( (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less']) |
373 | 374 | || (isset($dates[$year][$month]['more']) && $day > $dates[$year][$month]['more']) |
@@ -375,11 +376,17 @@ discard block |
||
375 | 376 | || (isset($dates[$year][$month]['between'][2]) && $day > $dates[$year][$month]['between'][2] && $day < $dates[$year][$month]['between'][3]) ) { |
376 | 377 | switch ($month) { |
377 | 378 | case 1: case 12: $recess = 'Christmas Recess'; break; |
378 | - case 2: if ($body==1 || $body==101) $recess = 'Half Term Week'; |
|
379 | - elseif ($body==4) $recess = 'February Recess'; |
|
379 | + case 2: if ($body==1 || $body==101) { |
|
380 | + $recess = 'Half Term Week'; |
|
381 | + } elseif ($body==4) { |
|
382 | + $recess = 'February Recess'; |
|
383 | + } |
|
380 | 384 | break; |
381 | - case 3: if ($body==1 || $body==101) $recess = 'Easter Recess'; |
|
382 | - elseif ($body==4) $recess = 'Spring Recess'; |
|
385 | + case 3: if ($body==1 || $body==101) { |
|
386 | + $recess = 'Easter Recess'; |
|
387 | + } elseif ($body==4) { |
|
388 | + $recess = 'Spring Recess'; |
|
389 | + } |
|
383 | 390 | break; |
384 | 391 | case 4: if (isset($dates[$year][$month]['more']) && $day > $dates[$year][$month]['more']) { |
385 | 392 | $recess = 'Election Recess'; |
@@ -417,9 +424,13 @@ discard block |
||
417 | 424 | trigger_error("Argh9"); |
418 | 425 | } |
419 | 426 | break; |
420 | - case 10: if ($body==1 || $body==101) $recess = 'Conference Recess'; |
|
421 | - elseif ($body==4) $recess = 'Autumn Recess'; |
|
422 | - elseif ($body==5) $recess = 'Halloween Recess'; |
|
427 | + case 10: if ($body==1 || $body==101) { |
|
428 | + $recess = 'Conference Recess'; |
|
429 | + } elseif ($body==4) { |
|
430 | + $recess = 'Autumn Recess'; |
|
431 | + } elseif ($body==5) { |
|
432 | + $recess = 'Halloween Recess'; |
|
433 | + } |
|
423 | 434 | break; |
424 | 435 | case 11: $recess = 'Autumn Recess'; |
425 | 436 | break; |
@@ -427,9 +438,9 @@ discard block |
||
427 | 438 | } |
428 | 439 | if (isset($dates[$year][$month]['less']) && $day < $dates[$year][$month]['less']) { |
429 | 440 | $to = "$year-$month-" . $dates[$year][$month]['less']; |
430 | - if ($month==1) |
|
431 | - $from = ($year-1)."-12-" . $dates[$year-1][12]['more']; |
|
432 | - else { |
|
441 | + if ($month==1) { |
|
442 | + $from = ($year-1)."-12-" . $dates[$year-1][12]['more']; |
|
443 | + } else { |
|
433 | 444 | for ($newmonth = $month-1; $newmonth>=1; $newmonth--) { |
434 | 445 | if (isset($dates[$year][$newmonth]['more'])) { |
435 | 446 | $from = "$year-".($newmonth)."-" . $dates[$year][$newmonth]['more']; |
@@ -440,9 +451,9 @@ discard block |
||
440 | 451 | } |
441 | 452 | if (isset($dates[$year][$month]['more']) && $day > $dates[$year][$month]['more']) { |
442 | 453 | $from = "$year-$month-" . $dates[$year][$month]['more']; |
443 | - if ($month==12) |
|
444 | - $to = ($year+1)."-01-" . $dates[$year+1][1]['less']; |
|
445 | - else { |
|
454 | + if ($month==12) { |
|
455 | + $to = ($year+1)."-01-" . $dates[$year+1][1]['less']; |
|
456 | + } else { |
|
446 | 457 | for ($newmonth = $month+1; $newmonth<=12; $newmonth++) { |
447 | 458 | if (isset($dates[$year][$newmonth]['less'])) { |
448 | 459 | $to = "$year-".($newmonth)."-" . $dates[$year][$newmonth]['less']; |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | # Ignore errors we've asked to ignore |
68 | 68 | if (error_reporting()==0) return; |
69 | 69 | |
70 | - // define an assoc array of error string |
|
71 | - // in reality the only entries we should |
|
72 | - // consider are E_WARNING, E_NOTICE, E_USER_ERROR, |
|
73 | - // E_USER_WARNING and E_USER_NOTICE |
|
74 | - # Commented out are ones that a user function cannot handle. |
|
70 | + // define an assoc array of error string |
|
71 | + // in reality the only entries we should |
|
72 | + // consider are E_WARNING, E_NOTICE, E_USER_ERROR, |
|
73 | + // E_USER_WARNING and E_USER_NOTICE |
|
74 | + # Commented out are ones that a user function cannot handle. |
|
75 | 75 | $errortype = array ( |
76 | 76 | #E_ERROR => "Error", |
77 | 77 | E_WARNING => "Warning", |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | // pretty prints the backtrace, copied from http://uk.php.net/manual/en/function.debug-backtrace.php |
201 | 201 | function adodb_backtrace($print=true) |
202 | 202 | { |
203 | - $s = ''; |
|
204 | - if (PHPVERSION() >= 4.3) { |
|
203 | + $s = ''; |
|
204 | + if (PHPVERSION() >= 4.3) { |
|
205 | 205 | |
206 | 206 | $MAXSTRLEN = 64; |
207 | 207 | |
@@ -209,33 +209,33 @@ discard block |
||
209 | 209 | array_shift($traceArr); |
210 | 210 | $tabs = sizeof($traceArr)-1; |
211 | 211 | foreach ($traceArr as $arr) { |
212 | - for ($i=0; $i < $tabs; $i++) $s .= ' '; |
|
213 | - $tabs -= 1; |
|
214 | - if (isset($arr['class'])) $s .= $arr['class'].'.'; |
|
215 | - $args = array(); |
|
216 | - if (isset($arr['args'])) foreach ($arr['args'] as $v) { |
|
212 | + for ($i=0; $i < $tabs; $i++) $s .= ' '; |
|
213 | + $tabs -= 1; |
|
214 | + if (isset($arr['class'])) $s .= $arr['class'].'.'; |
|
215 | + $args = array(); |
|
216 | + if (isset($arr['args'])) foreach ($arr['args'] as $v) { |
|
217 | 217 | if (is_null($v)) $args[] = 'null'; |
218 | 218 | elseif (is_array($v)) $args[] = 'Array['.sizeof($v).']'; |
219 | 219 | elseif (is_object($v)) $args[] = 'Object:'.get_class($v); |
220 | 220 | elseif (is_bool($v)) $args[] = $v ? 'true' : 'false'; |
221 | 221 | else { |
222 | - $v = (string) @$v; |
|
223 | - $str = _htmlspecialchars(substr($v,0,$MAXSTRLEN)); |
|
224 | - if (strlen($v) > $MAXSTRLEN) $str .= '...'; |
|
225 | - $args[] = $str; |
|
222 | + $v = (string) @$v; |
|
223 | + $str = _htmlspecialchars(substr($v,0,$MAXSTRLEN)); |
|
224 | + if (strlen($v) > $MAXSTRLEN) $str .= '...'; |
|
225 | + $args[] = $str; |
|
226 | 226 | } |
227 | - } |
|
227 | + } |
|
228 | 228 | |
229 | - $s .= $arr['function'].'('.implode(', ',$args).')'; |
|
230 | - // $s .= sprintf("</font><font color=#808080 size=-1> # line %4d,". |
|
231 | - // " file: <a href=\"file:/%s\">%s</a></font>", |
|
232 | - // $arr['line'],$arr['file'],$arr['file']); |
|
233 | - $s .= "\n"; |
|
229 | + $s .= $arr['function'].'('.implode(', ',$args).')'; |
|
230 | + // $s .= sprintf("</font><font color=#808080 size=-1> # line %4d,". |
|
231 | + // " file: <a href=\"file:/%s\">%s</a></font>", |
|
232 | + // $arr['line'],$arr['file'],$arr['file']); |
|
233 | + $s .= "\n"; |
|
234 | 234 | } |
235 | 235 | if ($print) print $s; |
236 | - } |
|
236 | + } |
|
237 | 237 | |
238 | - return $s; |
|
238 | + return $s; |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | // Far from foolproof, but better than nothing. |
@@ -567,14 +567,14 @@ discard block |
||
567 | 567 | //$tbl["»"] = "»"; |
568 | 568 | //$tbl["«"] = "«"; |
569 | 569 | |
570 | - // lib_filter will replace unmatched < and > with entities so |
|
571 | - // we abuse strtr's only replace once behaviour to not double |
|
572 | - // encode them. May not be robust. |
|
573 | - // This does mean if anyone actually wants to put > or < |
|
574 | - // in a comment they can't but that's a lot less likely than |
|
575 | - // < or > for less than and greater than. |
|
576 | - $tbl['<'] = "<"; |
|
577 | - $tbl['>'] = ">"; |
|
570 | + // lib_filter will replace unmatched < and > with entities so |
|
571 | + // we abuse strtr's only replace once behaviour to not double |
|
572 | + // encode them. May not be robust. |
|
573 | + // This does mean if anyone actually wants to put > or < |
|
574 | + // in a comment they can't but that's a lot less likely than |
|
575 | + // < or > for less than and greater than. |
|
576 | + $tbl['<'] = "<"; |
|
577 | + $tbl['>'] = ">"; |
|
578 | 578 | |
579 | 579 | // Don't want to encode these things |
580 | 580 | unset ($tbl["<"]); |
@@ -764,16 +764,16 @@ discard block |
||
764 | 764 | if (!$from) $from = CONTACTEMAIL; |
765 | 765 | |
766 | 766 | $headers = |
767 | - "From: TheyWorkForYou <$from>\r\n" . |
|
768 | - "Content-Type: text/plain; charset=utf-8\r\n" . |
|
769 | - "MIME-Version: 1.0\r\n" . |
|
770 | - "Content-Transfer-Encoding: 8bit\r\n" . |
|
771 | - ($bulk ? "Precedence: bulk\r\nAuto-Submitted: auto-generated\r\n" : "" ). |
|
772 | - "X-Mailer: PHP/" . phpversion(); |
|
767 | + "From: TheyWorkForYou <$from>\r\n" . |
|
768 | + "Content-Type: text/plain; charset=utf-8\r\n" . |
|
769 | + "MIME-Version: 1.0\r\n" . |
|
770 | + "Content-Transfer-Encoding: 8bit\r\n" . |
|
771 | + ($bulk ? "Precedence: bulk\r\nAuto-Submitted: auto-generated\r\n" : "" ). |
|
772 | + "X-Mailer: PHP/" . phpversion(); |
|
773 | 773 | twfy_debug('EMAIL', "Sending email to $to with subject of '$subject'"); |
774 | 774 | |
775 | 775 | if ($want_bounces) { |
776 | - $envelope_sender = twfy_verp_envelope_sender($to); |
|
776 | + $envelope_sender = twfy_verp_envelope_sender($to); |
|
777 | 777 | $success = mail ($to, $subject, $message, $headers, '-f ' . $envelope_sender); |
778 | 778 | } else { |
779 | 779 | $success = mail ($to, $subject, $message, $headers); |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | |
1064 | 1064 | $return = '<h4>'; |
1065 | 1065 | if (isset($daytext[$major])) { |
1066 | - $return .= $daytext[$major] . ' '; |
|
1066 | + $return .= $daytext[$major] . ' '; |
|
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | $return .= '<a href="'; |
@@ -49,7 +49,9 @@ discard block |
||
49 | 49 | |
50 | 50 | // If we can show this header, then, er, show it. |
51 | 51 | if ( in_array($header, $allowed_headers) || $debug_level >= 4) { |
52 | - if (is_array($text)) $text = call_user_func($text); |
|
52 | + if (is_array($text)) { |
|
53 | + $text = call_user_func($text); |
|
54 | + } |
|
53 | 55 | print "<p><span style=\"color:#039;\"><strong>$header</strong></span> $text</p>\n"; |
54 | 56 | } |
55 | 57 | } |
@@ -65,7 +67,9 @@ discard block |
||
65 | 67 | global $PAGE; |
66 | 68 | |
67 | 69 | # Ignore errors we've asked to ignore |
68 | - if (error_reporting()==0) return; |
|
70 | + if (error_reporting()==0) { |
|
71 | + return; |
|
72 | + } |
|
69 | 73 | |
70 | 74 | // define an assoc array of error string |
71 | 75 | // in reality the only entries we should |
@@ -209,19 +213,29 @@ discard block |
||
209 | 213 | array_shift($traceArr); |
210 | 214 | $tabs = sizeof($traceArr)-1; |
211 | 215 | foreach ($traceArr as $arr) { |
212 | - for ($i=0; $i < $tabs; $i++) $s .= ' '; |
|
216 | + for ($i=0; $i < $tabs; $i++) { |
|
217 | + $s .= ' '; |
|
218 | + } |
|
213 | 219 | $tabs -= 1; |
214 | - if (isset($arr['class'])) $s .= $arr['class'].'.'; |
|
220 | + if (isset($arr['class'])) { |
|
221 | + $s .= $arr['class'].'.'; |
|
222 | + } |
|
215 | 223 | $args = array(); |
216 | - if (isset($arr['args'])) foreach ($arr['args'] as $v) { |
|
224 | + if (isset($arr['args'])) { |
|
225 | + foreach ($arr['args'] as $v) { |
|
217 | 226 | if (is_null($v)) $args[] = 'null'; |
218 | - elseif (is_array($v)) $args[] = 'Array['.sizeof($v).']'; |
|
219 | - elseif (is_object($v)) $args[] = 'Object:'.get_class($v); |
|
220 | - elseif (is_bool($v)) $args[] = $v ? 'true' : 'false'; |
|
221 | - else { |
|
227 | + } elseif (is_array($v)) { |
|
228 | + $args[] = 'Array['.sizeof($v).']'; |
|
229 | + } elseif (is_object($v)) { |
|
230 | + $args[] = 'Object:'.get_class($v); |
|
231 | + } elseif (is_bool($v)) { |
|
232 | + $args[] = $v ? 'true' : 'false'; |
|
233 | + } else { |
|
222 | 234 | $v = (string) @$v; |
223 | 235 | $str = _htmlspecialchars(substr($v,0,$MAXSTRLEN)); |
224 | - if (strlen($v) > $MAXSTRLEN) $str .= '...'; |
|
236 | + if (strlen($v) > $MAXSTRLEN) { |
|
237 | + $str .= '...'; |
|
238 | + } |
|
225 | 239 | $args[] = $str; |
226 | 240 | } |
227 | 241 | } |
@@ -232,7 +246,9 @@ discard block |
||
232 | 246 | // $arr['line'],$arr['file'],$arr['file']); |
233 | 247 | $s .= "\n"; |
234 | 248 | } |
235 | - if ($print) print $s; |
|
249 | + if ($print) { |
|
250 | + print $s; |
|
251 | + } |
|
236 | 252 | } |
237 | 253 | |
238 | 254 | return $s; |
@@ -761,7 +777,9 @@ discard block |
||
761 | 777 | // easily to all the emails we send out from the site. |
762 | 778 | // eg, we might want to add a .sig to everything here... |
763 | 779 | |
764 | - if (!$from) $from = CONTACTEMAIL; |
|
780 | + if (!$from) { |
|
781 | + $from = CONTACTEMAIL; |
|
782 | + } |
|
765 | 783 | |
766 | 784 | $headers = |
767 | 785 | "From: TheyWorkForYou <$from>\r\n" . |
@@ -853,17 +871,21 @@ discard block |
||
853 | 871 | $rank = $rank + 0; |
854 | 872 | |
855 | 873 | # 11th, 12th, 13th use "th" not "st", "nd", "rd" |
856 | - if (floor(($rank % 100) / 10) == 1) |
|
857 | - return $rank . "th"; |
|
874 | + if (floor(($rank % 100) / 10) == 1) { |
|
875 | + return $rank . "th"; |
|
876 | + } |
|
858 | 877 | # 1st |
859 | - if ($rank % 10 == 1) |
|
860 | - return $rank . "st"; |
|
878 | + if ($rank % 10 == 1) { |
|
879 | + return $rank . "st"; |
|
880 | + } |
|
861 | 881 | # 2nd |
862 | - if ($rank % 10 == 2) |
|
863 | - return $rank . "nd"; |
|
882 | + if ($rank % 10 == 2) { |
|
883 | + return $rank . "nd"; |
|
884 | + } |
|
864 | 885 | # 3rd |
865 | - if ($rank % 10 == 3) |
|
866 | - return $rank . "rd"; |
|
886 | + if ($rank % 10 == 3) { |
|
887 | + return $rank . "rd"; |
|
888 | + } |
|
867 | 889 | # Everything else use th |
868 | 890 | |
869 | 891 | return $rank . "th"; |
@@ -871,8 +893,9 @@ discard block |
||
871 | 893 | |
872 | 894 | function make_plural($word, $number) |
873 | 895 | { |
874 | - if ($number == 1) |
|
875 | - return $word; |
|
896 | + if ($number == 1) { |
|
897 | + return $word; |
|
898 | + } |
|
876 | 899 | return $word . "s"; |
877 | 900 | } |
878 | 901 | |
@@ -929,10 +952,16 @@ discard block |
||
929 | 952 | } |
930 | 953 | } elseif ($house == HOUSE_TYPE_LORDS) { |
931 | 954 | $s = ''; |
932 | - if (!$family_name) $s = 'the '; |
|
955 | + if (!$family_name) { |
|
956 | + $s = 'the '; |
|
957 | + } |
|
933 | 958 | $s .= $title; |
934 | - if ($family_name) $s .= ' ' . $family_name; |
|
935 | - if ($lordofname) $s .= ' of ' . $lordofname; |
|
959 | + if ($family_name) { |
|
960 | + $s .= ' ' . $family_name; |
|
961 | + } |
|
962 | + if ($lordofname) { |
|
963 | + $s .= ' of ' . $lordofname; |
|
964 | + } |
|
936 | 965 | } elseif ($house == HOUSE_TYPE_ROYAL) { # Queen |
937 | 966 | $s = "$given_name $family_name"; |
938 | 967 | } |
@@ -964,9 +993,12 @@ discard block |
||
964 | 993 | ); |
965 | 994 | if ($pos) { # Government post, or Chairman of Select Committee |
966 | 995 | $pretty = $pos; |
967 | - if ($dept && $dept != 'No Department') $pretty .= ", $dept"; |
|
968 | - if (array_key_exists($pretty, $lookup)) |
|
969 | - $pretty = $lookup[$pretty]; |
|
996 | + if ($dept && $dept != 'No Department') { |
|
997 | + $pretty .= ", $dept"; |
|
998 | + } |
|
999 | + if (array_key_exists($pretty, $lookup)) { |
|
1000 | + $pretty = $lookup[$pretty]; |
|
1001 | + } |
|
970 | 1002 | } else { # Member of Select Committee |
971 | 1003 | $pretty = "Member, $dept"; |
972 | 1004 | } |
@@ -985,13 +1017,16 @@ discard block |
||
985 | 1017 | } |
986 | 1018 | |
987 | 1019 | // single date? |
988 | - if (isset($data['date'])) $one_date = true; |
|
1020 | + if (isset($data['date'])) { |
|
1021 | + $one_date = true; |
|
1022 | + } |
|
989 | 1023 | |
990 | 1024 | // remove empty entries, so they don't produce errors |
991 | 1025 | foreach (array_keys($hansardmajors) as $major) { |
992 | 1026 | if (array_key_exists($major, $data)) { |
993 | - if (count($data[$major]) == 0) |
|
994 | - unset($data[$major]); |
|
1027 | + if (count($data[$major]) == 0) { |
|
1028 | + unset($data[$major]); |
|
1029 | + } |
|
995 | 1030 | } |
996 | 1031 | } |
997 | 1032 | |
@@ -1000,22 +1035,29 @@ discard block |
||
1000 | 1035 | if (!$one_date) { |
1001 | 1036 | $todaystime = gmmktime(0, 0, 0, date('m'), date('d'), date('Y')); |
1002 | 1037 | foreach ($data as $major => $array) { |
1003 | - if (!in_array('timestamp', $array)) $daytext[$major] = "The most recent "; |
|
1004 | - elseif ($todaystime - $array['timestamp'] == 86400) $daytext[$major] = "Yesterday’s"; |
|
1005 | - elseif ($todaystime - $array['timestamp'] <= (6 * 86400)) $daytext[$major] = gmdate('l', $array['timestamp']) . "’s"; |
|
1006 | - else $daytext[$major] = "The most recent "; |
|
1038 | + if (!in_array('timestamp', $array)) { |
|
1039 | + $daytext[$major] = "The most recent "; |
|
1040 | + } elseif ($todaystime - $array['timestamp'] == 86400) { |
|
1041 | + $daytext[$major] = "Yesterday’s"; |
|
1042 | + } elseif ($todaystime - $array['timestamp'] <= (6 * 86400)) { |
|
1043 | + $daytext[$major] = gmdate('l', $array['timestamp']) . "’s"; |
|
1044 | + } else { |
|
1045 | + $daytext[$major] = "The most recent "; |
|
1046 | + } |
|
1007 | 1047 | } |
1008 | 1048 | } |
1009 | 1049 | |
1010 | 1050 | //build html |
1011 | 1051 | foreach ($printed_majors as $p_major) { |
1012 | - if (!array_key_exists($p_major, $data)) |
|
1013 | - continue; |
|
1052 | + if (!array_key_exists($p_major, $data)) { |
|
1053 | + continue; |
|
1054 | + } |
|
1014 | 1055 | |
1015 | - if ($one_date) |
|
1016 | - $date = $data['date']; |
|
1017 | - else |
|
1018 | - $date = $data[$p_major]['hdate']; |
|
1056 | + if ($one_date) { |
|
1057 | + $date = $data['date']; |
|
1058 | + } else { |
|
1059 | + $date = $data[$p_major]['hdate']; |
|
1060 | + } |
|
1019 | 1061 | $q = $db->query('SELECT section_id, body, gid |
1020 | 1062 | FROM hansard, epobject |
1021 | 1063 | WHERE hansard.epobject_id = epobject.epobject_id ' |
@@ -1067,14 +1109,16 @@ discard block |
||
1067 | 1109 | } |
1068 | 1110 | |
1069 | 1111 | $return .= '<a href="'; |
1070 | - if (isset($data[$major]['listurl'])) |
|
1071 | - $return .= $data[$major]['listurl']; |
|
1072 | - else { |
|
1112 | + if (isset($data[$major]['listurl'])) { |
|
1113 | + $return .= $data[$major]['listurl']; |
|
1114 | + } else { |
|
1073 | 1115 | $LISTURL->reset(); |
1074 | 1116 | $return .= $LISTURL->generate(); |
1075 | 1117 | } |
1076 | 1118 | $return .= '">' . $hansardmajors[$major]['title'] . '</a>'; |
1077 | - if (isset($daytext[$major])) $return; |
|
1119 | + if (isset($daytext[$major])) { |
|
1120 | + $return; |
|
1121 | + } |
|
1078 | 1122 | $return .= '</h4>'; |
1079 | 1123 | |
1080 | 1124 | return $return; |
@@ -1082,20 +1126,21 @@ discard block |
||
1082 | 1126 | |
1083 | 1127 | function score_to_strongly($dmpscore) { |
1084 | 1128 | $dmpdesc = "unknown about"; |
1085 | - if ($dmpscore > 0.95 && $dmpscore <= 1.0) |
|
1086 | - $dmpdesc = "consistently voted against"; |
|
1087 | - elseif ($dmpscore > 0.85) |
|
1088 | - $dmpdesc = "almost always voted against"; |
|
1089 | - elseif ($dmpscore > 0.6) |
|
1090 | - $dmpdesc = "generally voted against"; |
|
1091 | - elseif ($dmpscore > 0.4) |
|
1092 | - $dmpdesc = "voted a mixture of for and against"; |
|
1093 | - elseif ($dmpscore > 0.15) |
|
1094 | - $dmpdesc = "generally voted for"; |
|
1095 | - elseif ($dmpscore > 0.05) |
|
1096 | - $dmpdesc = "almost always voted for"; |
|
1097 | - elseif ($dmpscore >= 0.0) |
|
1098 | - $dmpdesc = "consistently voted for"; |
|
1129 | + if ($dmpscore > 0.95 && $dmpscore <= 1.0) { |
|
1130 | + $dmpdesc = "consistently voted against"; |
|
1131 | + } elseif ($dmpscore > 0.85) { |
|
1132 | + $dmpdesc = "almost always voted against"; |
|
1133 | + } elseif ($dmpscore > 0.6) { |
|
1134 | + $dmpdesc = "generally voted against"; |
|
1135 | + } elseif ($dmpscore > 0.4) { |
|
1136 | + $dmpdesc = "voted a mixture of for and against"; |
|
1137 | + } elseif ($dmpscore > 0.15) { |
|
1138 | + $dmpdesc = "generally voted for"; |
|
1139 | + } elseif ($dmpscore > 0.05) { |
|
1140 | + $dmpdesc = "almost always voted for"; |
|
1141 | + } elseif ($dmpscore >= 0.0) { |
|
1142 | + $dmpdesc = "consistently voted for"; |
|
1143 | + } |
|
1099 | 1144 | return $dmpdesc; |
1100 | 1145 | } |
1101 | 1146 |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | return $string; |
888 | 888 | } |
889 | 889 | |
890 | -function make_member_url($name, $const = '', $house = HOUSE_TYPE_COMMONS, $pid = NULL) { |
|
890 | +function make_member_url($name, $const = '', $house = HOUSE_TYPE_COMMONS, $pid = null) { |
|
891 | 891 | |
892 | 892 | // Case for Elizabeth II |
893 | 893 | if ($house == HOUSE_TYPE_ROYAL) |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | $out = ''; |
904 | 904 | |
905 | 905 | // Insert the Person ID if known. |
906 | - if ($pid !== NULL) |
|
906 | + if ($pid !== null) |
|
907 | 907 | { |
908 | 908 | $out .= $pid . '/'; |
909 | 909 | } |
@@ -5,12 +5,12 @@ discard block |
||
5 | 5 | |
6 | 6 | */ |
7 | 7 | |
8 | -include_once INCLUDESPATH . '../../commonlib/phplib/email.php'; |
|
9 | -include_once INCLUDESPATH . '../../commonlib/phplib/datetime.php'; |
|
8 | +include_once INCLUDESPATH.'../../commonlib/phplib/email.php'; |
|
9 | +include_once INCLUDESPATH.'../../commonlib/phplib/datetime.php'; |
|
10 | 10 | |
11 | 11 | # Pass it a brief header word and some debug text and it'll be output. |
12 | 12 | # If TEXT is an array, call the user function, assuming it's a class. |
13 | -function twfy_debug($header, $text="") { |
|
13 | +function twfy_debug($header, $text = "") { |
|
14 | 14 | |
15 | 15 | // We set ?DEBUGTAG=n in the URL. |
16 | 16 | // (DEBUGTAG is set in config.php). |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | if ($debug_level != '') { |
28 | 28 | |
29 | 29 | // Set which level shows which types of debug info. |
30 | - $levels = array ( |
|
31 | - 1 => array ('THEUSER', 'TIME', 'SQLERROR', 'PAGE', 'TEMPLATE', 'SEARCH', 'ALERTS', 'MP'), |
|
32 | - 2 => array ('SQL', 'EMAIL', 'WIKIPEDIA', 'hansardlist', 'debatelist', 'wranslist', 'whalllist'), |
|
33 | - 3 => array ('SQLRESULT') |
|
30 | + $levels = array( |
|
31 | + 1 => array('THEUSER', 'TIME', 'SQLERROR', 'PAGE', 'TEMPLATE', 'SEARCH', 'ALERTS', 'MP'), |
|
32 | + 2 => array('SQL', 'EMAIL', 'WIKIPEDIA', 'hansardlist', 'debatelist', 'wranslist', 'whalllist'), |
|
33 | + 3 => array('SQLRESULT') |
|
34 | 34 | // Higher than this: 'DATA', etc. |
35 | 35 | ); |
36 | 36 | |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | for ($n = 1; $n <= $max_level_to_show; $n++) { |
47 | - $allowed_headers = array_merge ($allowed_headers, $levels[$n] ); |
|
47 | + $allowed_headers = array_merge($allowed_headers, $levels[$n]); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | // If we can show this header, then, er, show it. |
51 | - if ( in_array($header, $allowed_headers) || $debug_level >= 4) { |
|
51 | + if (in_array($header, $allowed_headers) || $debug_level >= 4) { |
|
52 | 52 | if (is_array($text)) $text = call_user_func($text); |
53 | 53 | print "<p><span style=\"color:#039;\"><strong>$header</strong></span> $text</p>\n"; |
54 | 54 | } |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | global $PAGE; |
66 | 66 | |
67 | 67 | # Ignore errors we've asked to ignore |
68 | - if (error_reporting()==0) return; |
|
68 | + if (error_reporting() == 0) return; |
|
69 | 69 | |
70 | 70 | // define an assoc array of error string |
71 | 71 | // in reality the only entries we should |
72 | 72 | // consider are E_WARNING, E_NOTICE, E_USER_ERROR, |
73 | 73 | // E_USER_WARNING and E_USER_NOTICE |
74 | 74 | # Commented out are ones that a user function cannot handle. |
75 | - $errortype = array ( |
|
75 | + $errortype = array( |
|
76 | 76 | #E_ERROR => "Error", |
77 | 77 | E_WARNING => "Warning", |
78 | 78 | #E_PARSE => "Parsing Error", |
@@ -91,22 +91,22 @@ discard block |
||
91 | 91 | |
92 | 92 | $err = ''; |
93 | 93 | if (isset($_SERVER['REQUEST_URI'])) { |
94 | - $err .= "URL:\t\thttps://" . DOMAIN . $_SERVER['REQUEST_URI'] . "\n"; |
|
94 | + $err .= "URL:\t\thttps://".DOMAIN.$_SERVER['REQUEST_URI']."\n"; |
|
95 | 95 | } else { |
96 | 96 | $err .= "URL:\t\tNone - running from command line?\n"; |
97 | 97 | } |
98 | 98 | if (isset($_SERVER['HTTP_REFERER'])) { |
99 | - $err .= "Referer:\t" . $_SERVER['HTTP_REFERER'] . "\n"; |
|
99 | + $err .= "Referer:\t".$_SERVER['HTTP_REFERER']."\n"; |
|
100 | 100 | } else { |
101 | 101 | $err .= "Referer:\tNone\n"; |
102 | 102 | } |
103 | 103 | if (isset($_SERVER['HTTP_USER_AGENT'])) { |
104 | - $err .= "User-Agent:\t" . $_SERVER['HTTP_USER_AGENT'] . "\n"; |
|
104 | + $err .= "User-Agent:\t".$_SERVER['HTTP_USER_AGENT']."\n"; |
|
105 | 105 | } else { |
106 | 106 | $err .= "User-Agent:\tNone\n"; |
107 | 107 | } |
108 | 108 | $err .= "Number:\t\t$errno\n"; |
109 | - $err .= "Type:\t\t" . $errortype[$errno] . "\n"; |
|
109 | + $err .= "Type:\t\t".$errortype[$errno]."\n"; |
|
110 | 110 | $err .= "Message:\t$errmsg\n"; |
111 | 111 | $err .= "File:\t\t$filename\n"; |
112 | 112 | $err .= "Line:\t\t$linenum\n"; |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | $source = file($filename); |
132 | 132 | $err .= "\nSource:\n\n"; |
133 | 133 | // Show the line, plus prev and next, with line numbers. |
134 | - $err .= $linenum-2 . " " . $source[$linenum-3]; |
|
135 | - $err .= $linenum-1 . " " . $source[$linenum-2]; |
|
136 | - $err .= $linenum . " " . $source[$linenum-1]; |
|
137 | - $err .= $linenum+1 . " " . $source[$linenum]; |
|
138 | - $err .= $linenum+2 . " " . $source[$linenum+1]; |
|
134 | + $err .= $linenum - 2." ".$source[$linenum - 3]; |
|
135 | + $err .= $linenum - 1." ".$source[$linenum - 2]; |
|
136 | + $err .= $linenum." ".$source[$linenum - 1]; |
|
137 | + $err .= $linenum + 1." ".$source[$linenum]; |
|
138 | + $err .= $linenum + 2." ".$source[$linenum + 1]; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | |
152 | 152 | if (DEVSITE || get_http_var(DEBUGTAG)) { |
153 | 153 | // On a devsite we just display the problem. |
154 | - $errtxt = nl2br($err) . "\n"; |
|
154 | + $errtxt = nl2br($err)."\n"; |
|
155 | 155 | if (!strstr($errmsg, 'mysql_connect')) { |
156 | - $errtxt .= "<br><br>Backtrace:<br>" . nl2br(adodb_backtrace(false)); |
|
156 | + $errtxt .= "<br><br>Backtrace:<br>".nl2br(adodb_backtrace(false)); |
|
157 | 157 | } |
158 | 158 | $message = array( |
159 | 159 | 'title' => "Error", |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | header('HTTP/1.0 500 Internal Server Error'); |
180 | 180 | print "<p>Oops, sorry, an error has occurred!</p>\n"; |
181 | 181 | } |
182 | - if (!($errno & E_USER_NOTICE) && strpos($errmsg, 'pg_connect')===false && strpos($errmsg, 'mysql_connect')===false) { |
|
183 | - mail(BUGSLIST, "[TWFYBUG]: $errmsg", $err, "From: Bug <" . CONTACTEMAIL . ">\n". "X-Mailer: PHP/" . phpversion() ); |
|
182 | + if (!($errno & E_USER_NOTICE) && strpos($errmsg, 'pg_connect') === false && strpos($errmsg, 'mysql_connect') === false) { |
|
183 | + mail(BUGSLIST, "[TWFYBUG]: $errmsg", $err, "From: Bug <".CONTACTEMAIL.">\n"."X-Mailer: PHP/".phpversion()); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | } |
199 | 199 | |
200 | 200 | // pretty prints the backtrace, copied from http://uk.php.net/manual/en/function.debug-backtrace.php |
201 | -function adodb_backtrace($print=true) |
|
201 | +function adodb_backtrace($print = true) |
|
202 | 202 | { |
203 | 203 | $s = ''; |
204 | 204 | if (PHPVERSION() >= 4.3) { |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | |
208 | 208 | $traceArr = debug_backtrace(); |
209 | 209 | array_shift($traceArr); |
210 | - $tabs = sizeof($traceArr)-1; |
|
210 | + $tabs = sizeof($traceArr) - 1; |
|
211 | 211 | foreach ($traceArr as $arr) { |
212 | - for ($i=0; $i < $tabs; $i++) $s .= ' '; |
|
212 | + for ($i = 0; $i < $tabs; $i++) $s .= ' '; |
|
213 | 213 | $tabs -= 1; |
214 | 214 | if (isset($arr['class'])) $s .= $arr['class'].'.'; |
215 | 215 | $args = array(); |
@@ -220,13 +220,13 @@ discard block |
||
220 | 220 | elseif (is_bool($v)) $args[] = $v ? 'true' : 'false'; |
221 | 221 | else { |
222 | 222 | $v = (string) @$v; |
223 | - $str = _htmlspecialchars(substr($v,0,$MAXSTRLEN)); |
|
223 | + $str = _htmlspecialchars(substr($v, 0, $MAXSTRLEN)); |
|
224 | 224 | if (strlen($v) > $MAXSTRLEN) $str .= '...'; |
225 | 225 | $args[] = $str; |
226 | 226 | } |
227 | 227 | } |
228 | 228 | |
229 | - $s .= $arr['function'].'('.implode(', ',$args).')'; |
|
229 | + $s .= $arr['function'].'('.implode(', ', $args).')'; |
|
230 | 230 | // $s .= sprintf("</font><font color=#808080 size=-1> # line %4d,". |
231 | 231 | // " file: <a href=\"file:/%s\">%s</a></font>", |
232 | 232 | // $arr['line'],$arr['file'],$arr['file']); |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $nom = '0123456789'; |
265 | 265 | $gap = '\s\.'; |
266 | 266 | |
267 | - if ( preg_match("/^[$fst][$num][$gap]*[$nom][$in][$in]$/i", $postcode) || |
|
267 | + if (preg_match("/^[$fst][$num][$gap]*[$nom][$in][$in]$/i", $postcode) || |
|
268 | 268 | preg_match("/^[$fst][$num][$num][$gap]*[$nom][$in][$in]$/i", $postcode) || |
269 | 269 | preg_match("/^[$fst][$sec][$num][$gap]*[$nom][$in][$in]$/i", $postcode) || |
270 | 270 | preg_match("/^[$fst][$sec][$num][$num][$gap]*[$nom][$in][$in]$/i", $postcode) || |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | // Returns the unixtime in microseconds. |
281 | 281 | function getmicrotime() { |
282 | 282 | $mtime = microtime(); |
283 | - $mtime = explode(" ",$mtime); |
|
283 | + $mtime = explode(" ", $mtime); |
|
284 | 284 | $mtime = $mtime[1] + $mtime[0]; |
285 | 285 | |
286 | 286 | return $mtime; |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | global $timestamp_last, $timestamp_start; |
294 | 294 | $t = getmicrotime(); |
295 | 295 | twfy_debug("TIME", sprintf("%f msecs since start; %f msecs since last; %s", |
296 | - ($t - $timestamp_start)*1000.0, ($t - $timestamp_last)*1000.0, $label)); |
|
296 | + ($t - $timestamp_start) * 1000.0, ($t - $timestamp_last) * 1000.0, $label)); |
|
297 | 297 | $timestamp_last = $t; |
298 | 298 | } |
299 | 299 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | if (preg_match("/^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/", $timestamp, $matches)) { |
308 | 308 | list($string, $year, $month, $day, $hour, $min, $sec) = $matches; |
309 | 309 | |
310 | - return gmdate ($format, gmmktime($hour, $min, $sec, $month, $day, $year)); |
|
310 | + return gmdate($format, gmmktime($hour, $min, $sec, $month, $day, $year)); |
|
311 | 311 | } else { |
312 | 312 | return ""; |
313 | 313 | } |
@@ -328,13 +328,13 @@ discard block |
||
328 | 328 | list($string, $year, $month, $day) = $matches; |
329 | 329 | if ($year < 1902) { # gmdate fns only go back to Dec. 1901 |
330 | 330 | if ($format == SHORTDATEFORMAT) { |
331 | - return ($day+0) . ' ' . $format_date_months_short[$month+0] . " $year"; |
|
331 | + return ($day + 0).' '.$format_date_months_short[$month + 0]." $year"; |
|
332 | 332 | } else { |
333 | - return ($day+0) . ' ' . $format_date_months[$month+0] . " $year"; |
|
333 | + return ($day + 0).' '.$format_date_months[$month + 0]." $year"; |
|
334 | 334 | } |
335 | 335 | } |
336 | 336 | |
337 | - return gmdate ($format, gmmktime(0, 0, 0, $month, $day, $year)); |
|
337 | + return gmdate($format, gmmktime(0, 0, 0, $month, $day, $year)); |
|
338 | 338 | } else { |
339 | 339 | return ""; |
340 | 340 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | if (preg_match("/^(\d\d):(\d\d):(\d\d)$/", $time, $matches)) { |
351 | 351 | list($string, $hour, $min, $sec) = $matches; |
352 | 352 | |
353 | - return gmdate ($format, gmmktime($hour, $min, $sec)); |
|
353 | + return gmdate($format, gmmktime($hour, $min, $sec)); |
|
354 | 354 | } else { |
355 | 355 | return ""; |
356 | 356 | } |
@@ -371,16 +371,16 @@ discard block |
||
371 | 371 | $in_seconds = strtotime($datetime); |
372 | 372 | $now = time(); |
373 | 373 | |
374 | - $diff = $now - $in_seconds; |
|
375 | - $months = floor($diff/2419200); |
|
374 | + $diff = $now - $in_seconds; |
|
375 | + $months = floor($diff / 2419200); |
|
376 | 376 | $diff -= $months * 2419200; |
377 | - $weeks = floor($diff/604800); |
|
378 | - $diff -= $weeks*604800; |
|
379 | - $days = floor($diff/86400); |
|
377 | + $weeks = floor($diff / 604800); |
|
378 | + $diff -= $weeks * 604800; |
|
379 | + $days = floor($diff / 86400); |
|
380 | 380 | $diff -= $days * 86400; |
381 | - $hours = floor($diff/3600); |
|
381 | + $hours = floor($diff / 3600); |
|
382 | 382 | $diff -= $hours * 3600; |
383 | - $minutes = floor($diff/60); |
|
383 | + $minutes = floor($diff / 60); |
|
384 | 384 | $diff -= $minutes * 60; |
385 | 385 | $seconds = $diff; |
386 | 386 | |
@@ -394,22 +394,22 @@ discard block |
||
394 | 394 | $relative_date = ''; |
395 | 395 | if ($weeks > 0) { |
396 | 396 | // Weeks and days |
397 | - $relative_date .= ($relative_date?', ':'').$weeks.' week'.($weeks>1?'s':''); |
|
398 | - $relative_date .= $days>0?($relative_date?', ':'').$days.' day'.($days>1?'s':''):''; |
|
397 | + $relative_date .= ($relative_date ? ', ' : '').$weeks.' week'.($weeks > 1 ? 's' : ''); |
|
398 | + $relative_date .= $days > 0 ? ($relative_date ? ', ' : '').$days.' day'.($days > 1 ? 's' : '') : ''; |
|
399 | 399 | } elseif ($days > 0) { |
400 | 400 | // days and hours |
401 | - $relative_date .= ($relative_date?', ':'').$days.' day'.($days>1?'s':''); |
|
402 | - $relative_date .= $hours>0?($relative_date?', ':'').$hours.' hour'.($hours>1?'s':''):''; |
|
401 | + $relative_date .= ($relative_date ? ', ' : '').$days.' day'.($days > 1 ? 's' : ''); |
|
402 | + $relative_date .= $hours > 0 ? ($relative_date ? ', ' : '').$hours.' hour'.($hours > 1 ? 's' : '') : ''; |
|
403 | 403 | } elseif ($hours > 0) { |
404 | 404 | // hours and minutes |
405 | - $relative_date .= ($relative_date?', ':'').$hours.' hour'.($hours>1?'s':''); |
|
406 | - $relative_date .= $minutes>0?($relative_date?', ':'').$minutes.' minute'.($minutes>1?'s':''):''; |
|
405 | + $relative_date .= ($relative_date ? ', ' : '').$hours.' hour'.($hours > 1 ? 's' : ''); |
|
406 | + $relative_date .= $minutes > 0 ? ($relative_date ? ', ' : '').$minutes.' minute'.($minutes > 1 ? 's' : '') : ''; |
|
407 | 407 | } elseif ($minutes > 0) { |
408 | 408 | // minutes only |
409 | - $relative_date .= ($relative_date?', ':'').$minutes.' minute'.($minutes>1?'s':''); |
|
409 | + $relative_date .= ($relative_date ? ', ' : '').$minutes.' minute'.($minutes > 1 ? 's' : ''); |
|
410 | 410 | } else { |
411 | 411 | // seconds only |
412 | - $relative_date .= ($relative_date?', ':'').$seconds.' second'.($seconds>1?'s':''); |
|
412 | + $relative_date .= ($relative_date ? ', ' : '').$seconds.' second'.($seconds > 1 ? 's' : ''); |
|
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | |
446 | 446 | // Split long strings up so they don't go too long. |
447 | 447 | // Mainly for URLs which are displayed, but aren't links when trimmed. |
448 | - $text = preg_replace('/(\S{' . $url_length . '})/', "\$1 ", $text); |
|
448 | + $text = preg_replace('/(\S{'.$url_length.'})/', "\$1 ", $text); |
|
449 | 449 | |
450 | 450 | // Otherwise the word boundary matching goes odd... |
451 | 451 | $text = preg_replace("/[\n\r]/", " ", $text); |
@@ -455,12 +455,12 @@ discard block |
||
455 | 455 | $text = substr($text, $start); |
456 | 456 | |
457 | 457 | // Word boundary. |
458 | - if (preg_match ("/.+?\b(.*)/", $text, $matches)) { |
|
458 | + if (preg_match("/.+?\b(.*)/", $text, $matches)) { |
|
459 | 459 | $text = $matches[1]; |
460 | 460 | // Strip spare space at the start. |
461 | - $text = preg_replace ("/^\s/", '', $text); |
|
461 | + $text = preg_replace("/^\s/", '', $text); |
|
462 | 462 | } |
463 | - $text = '...' . $text; |
|
463 | + $text = '...'.$text; |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | // Trim end. |
@@ -470,10 +470,10 @@ discard block |
||
470 | 470 | $text = substr($text, 0, $length - 3); |
471 | 471 | |
472 | 472 | // Word boundary. |
473 | - if (preg_match ("/(.*)\s.+/", $text, $matches)) { |
|
473 | + if (preg_match("/(.*)\s.+/", $text, $matches)) { |
|
474 | 474 | $text = $matches[1]; |
475 | 475 | // Strip spare space at the end. |
476 | - $text = preg_replace ("/\s$/", '', $text); |
|
476 | + $text = preg_replace("/\s$/", '', $text); |
|
477 | 477 | } |
478 | 478 | // We don't want to use the HTML entity for an ellipsis (…), because then |
479 | 479 | // it screws up when we subsequently use htmlentities() to print the returned |
@@ -505,11 +505,11 @@ discard block |
||
505 | 505 | |
506 | 506 | if ($filter_type == 'strict') { |
507 | 507 | // No tags allowed at all! |
508 | - $filter->allowed = array (); |
|
508 | + $filter->allowed = array(); |
|
509 | 509 | } else { |
510 | 510 | // Comment. |
511 | 511 | // Only allowing <a href>, <b>, <strong>, <i> and <em> |
512 | - $filter->allowed = array ( |
|
512 | + $filter->allowed = array( |
|
513 | 513 | 'a' => array('href'), |
514 | 514 | 'strong' => array(), |
515 | 515 | 'em' => array(), |
@@ -540,9 +540,9 @@ discard block |
||
540 | 540 | "/(?<!\"|\/)((http(s?):\/\/)|(www\.))([a-zA-Z\d_.+,;:?%~\-\/#='*$!()&[\]]+)([a-zA-Z\d_?%~\-\/#='*$!&])/", |
541 | 541 | function($matches) use ($link_length) { |
542 | 542 | if (strlen($matches[0]) > $link_length) { |
543 | - return '<a href="' . $matches[0] . '" rel="nofollow">' . substr($matches[0], 0, $link_length) . "...</a>"; |
|
543 | + return '<a href="'.$matches[0].'" rel="nofollow">'.substr($matches[0], 0, $link_length)."...</a>"; |
|
544 | 544 | } else { |
545 | - return '<a href="' . $matches[0] . '" rel="nofollow">' . $matches[0] . '</a>'; |
|
545 | + return '<a href="'.$matches[0].'" rel="nofollow">'.$matches[0].'</a>'; |
|
546 | 546 | } |
547 | 547 | }, |
548 | 548 | $text); |
@@ -630,10 +630,10 @@ discard block |
||
630 | 630 | // This returns 'debate_2003-02-28.475.3'. |
631 | 631 | |
632 | 632 | if ($keepmajor) { |
633 | - $newgid = substr($gid, strpos($gid, '/')+1 ); |
|
633 | + $newgid = substr($gid, strpos($gid, '/') + 1); |
|
634 | 634 | $newgid = str_replace('/', '_', $newgid); |
635 | 635 | } else { |
636 | - $newgid = substr($gid, strrpos($gid, '/')+1 ); |
|
636 | + $newgid = substr($gid, strrpos($gid, '/') + 1); |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | return $newgid; |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | // will be like 2003-11-20.966.0 |
648 | 648 | // This function returns 966.0 |
649 | 649 | |
650 | - return substr( $gid, (strpos($gid, '.') + 1) ); |
|
650 | + return substr($gid, (strpos($gid, '.') + 1)); |
|
651 | 651 | } |
652 | 652 | |
653 | 653 | function preg_replacement_quote($s) { |
@@ -691,14 +691,14 @@ discard block |
||
691 | 691 | global $PAGE; |
692 | 692 | |
693 | 693 | if (!isset($data['to']) || $data['to'] == '') { |
694 | - $PAGE->error_message ("We need an email address to send to."); |
|
694 | + $PAGE->error_message("We need an email address to send to."); |
|
695 | 695 | return false; |
696 | 696 | } |
697 | 697 | |
698 | - $filename = INCLUDESPATH . "easyparliament/templates/emails/" . $data['template'] . ".txt"; |
|
698 | + $filename = INCLUDESPATH."easyparliament/templates/emails/".$data['template'].".txt"; |
|
699 | 699 | |
700 | 700 | if (!file_exists($filename)) { |
701 | - $PAGE->error_message("Sorry, we could not find the email template '" . _htmlentities($data['template']) . "'."); |
|
701 | + $PAGE->error_message("Sorry, we could not find the email template '"._htmlentities($data['template'])."'."); |
|
702 | 702 | return false; |
703 | 703 | } |
704 | 704 | |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | if (isset($data['subject'])) { |
716 | 716 | $subject = trim($data['subject']); |
717 | 717 | } else { |
718 | - $subject = trim( substr($firstline, 8) ); |
|
718 | + $subject = trim(substr($firstline, 8)); |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | // Either way, remove this subject line from the template. |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | } elseif (isset($data['subject'])) { |
725 | 725 | $subject = $data['subject']; |
726 | 726 | } else { |
727 | - $PAGE->error_message ("We don't have a subject line for the email, so it wasn't sent."); |
|
727 | + $PAGE->error_message("We don't have a subject line for the email, so it wasn't sent."); |
|
728 | 728 | return false; |
729 | 729 | } |
730 | 730 | |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | $emailtext = preg_replace($search, $replace, $emailtext); |
742 | 742 | |
743 | 743 | // Send it! |
744 | - $success = send_email ($data['to'], $subject, $emailtext, $bulk, 'twfy-DO-NOT-REPLY@' . EMAILDOMAIN, $want_bounces); |
|
744 | + $success = send_email($data['to'], $subject, $emailtext, $bulk, 'twfy-DO-NOT-REPLY@'.EMAILDOMAIN, $want_bounces); |
|
745 | 745 | |
746 | 746 | return $success; |
747 | 747 | |
@@ -764,19 +764,19 @@ discard block |
||
764 | 764 | if (!$from) $from = CONTACTEMAIL; |
765 | 765 | |
766 | 766 | $headers = |
767 | - "From: TheyWorkForYou <$from>\r\n" . |
|
768 | - "Content-Type: text/plain; charset=utf-8\r\n" . |
|
769 | - "MIME-Version: 1.0\r\n" . |
|
770 | - "Content-Transfer-Encoding: 8bit\r\n" . |
|
771 | - ($bulk ? "Precedence: bulk\r\nAuto-Submitted: auto-generated\r\n" : "" ). |
|
772 | - "X-Mailer: PHP/" . phpversion(); |
|
767 | + "From: TheyWorkForYou <$from>\r\n". |
|
768 | + "Content-Type: text/plain; charset=utf-8\r\n". |
|
769 | + "MIME-Version: 1.0\r\n". |
|
770 | + "Content-Transfer-Encoding: 8bit\r\n". |
|
771 | + ($bulk ? "Precedence: bulk\r\nAuto-Submitted: auto-generated\r\n" : ""). |
|
772 | + "X-Mailer: PHP/".phpversion(); |
|
773 | 773 | twfy_debug('EMAIL', "Sending email to $to with subject of '$subject'"); |
774 | 774 | |
775 | 775 | if ($want_bounces) { |
776 | 776 | $envelope_sender = twfy_verp_envelope_sender($to); |
777 | - $success = mail ($to, $subject, $message, $headers, '-f ' . $envelope_sender); |
|
777 | + $success = mail($to, $subject, $message, $headers, '-f '.$envelope_sender); |
|
778 | 778 | } else { |
779 | - $success = mail ($to, $subject, $message, $headers); |
|
779 | + $success = mail($to, $subject, $message, $headers); |
|
780 | 780 | } |
781 | 781 | |
782 | 782 | return $success; |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | // http://www.iamcal.com/publish/article.php?id=13 |
789 | 789 | |
790 | 790 | // Call this with a key name to get a GET or POST variable. |
791 | -function get_http_var($name, $default='') { |
|
791 | +function get_http_var($name, $default = '') { |
|
792 | 792 | if (array_key_exists($name, $_GET)) { |
793 | 793 | return clean_var($_GET[$name]); |
794 | 794 | } |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | } |
815 | 815 | |
816 | 816 | // Call this with a key name to get a COOKIE variable. |
817 | -function get_cookie_var($name, $default='') { |
|
817 | +function get_cookie_var($name, $default = '') { |
|
818 | 818 | if (array_key_exists($name, $_COOKIE)) { |
819 | 819 | return clean_var($_COOKIE[$name]); |
820 | 820 | } |
@@ -825,25 +825,25 @@ discard block |
||
825 | 825 | // Pass it an array of key names that should not be generated as |
826 | 826 | // hidden form variables. It then outputs hidden form variables |
827 | 827 | // based on the session_vars for this page. |
828 | -function hidden_form_vars ($omit = array()) { |
|
828 | +function hidden_form_vars($omit = array()) { |
|
829 | 829 | global $DATA, $this_page; |
830 | 830 | |
831 | 831 | $session_vars = $DATA->page_metadata($this_page, "session_vars"); |
832 | 832 | |
833 | 833 | foreach ($session_vars as $n => $key) { |
834 | 834 | if (!in_array($key, $omit)) { |
835 | - print "<input type=\"hidden\" name=\"$key\" value=\"" . _htmlentities(get_http_var($key)) . "\">\n"; |
|
835 | + print "<input type=\"hidden\" name=\"$key\" value=\""._htmlentities(get_http_var($key))."\">\n"; |
|
836 | 836 | } |
837 | 837 | } |
838 | 838 | } |
839 | 839 | |
840 | 840 | // Deprecated. Use hidden_form_vars, above, instead. |
841 | -function hidden_vars ($omit = array()) { |
|
841 | +function hidden_vars($omit = array()) { |
|
842 | 842 | global $DATA; |
843 | 843 | |
844 | 844 | foreach ($args as $key => $val) { |
845 | 845 | if (!in_array($key, $omit)) { |
846 | - print "<input type=\"hidden\" name=\"$key\" value=\"" . _htmlspecialchars($val) . "\">\n"; |
|
846 | + print "<input type=\"hidden\" name=\"$key\" value=\""._htmlspecialchars($val)."\">\n"; |
|
847 | 847 | } |
848 | 848 | } |
849 | 849 | } |
@@ -854,26 +854,26 @@ discard block |
||
854 | 854 | |
855 | 855 | # 11th, 12th, 13th use "th" not "st", "nd", "rd" |
856 | 856 | if (floor(($rank % 100) / 10) == 1) |
857 | - return $rank . "th"; |
|
857 | + return $rank."th"; |
|
858 | 858 | # 1st |
859 | 859 | if ($rank % 10 == 1) |
860 | - return $rank . "st"; |
|
860 | + return $rank."st"; |
|
861 | 861 | # 2nd |
862 | 862 | if ($rank % 10 == 2) |
863 | - return $rank . "nd"; |
|
863 | + return $rank."nd"; |
|
864 | 864 | # 3rd |
865 | 865 | if ($rank % 10 == 3) |
866 | - return $rank . "rd"; |
|
866 | + return $rank."rd"; |
|
867 | 867 | # Everything else use th |
868 | 868 | |
869 | - return $rank . "th"; |
|
869 | + return $rank."th"; |
|
870 | 870 | } |
871 | 871 | |
872 | 872 | function make_plural($word, $number) |
873 | 873 | { |
874 | 874 | if ($number == 1) |
875 | 875 | return $word; |
876 | - return $word . "s"; |
|
876 | + return $word."s"; |
|
877 | 877 | } |
878 | 878 | |
879 | 879 | # Can't have the entities in XML so replace all theones we currently have with numerical entities |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | function entities_to_numbers($string) { |
882 | 882 | $string = str_replace( |
883 | 883 | array('Ö', 'â', 'ú', 'á', 'í', 'ô', 'é'), |
884 | - array('Ö', 'â', 'ú', 'á', 'í', 'ô', 'é' ), |
|
884 | + array('Ö', 'â', 'ú', 'á', 'í', 'ô', 'é'), |
|
885 | 885 | $string |
886 | 886 | ); |
887 | 887 | return $string; |
@@ -895,9 +895,9 @@ discard block |
||
895 | 895 | return 'elizabeth_the_second'; |
896 | 896 | } |
897 | 897 | |
898 | - $s = array(' ', '&', 'ô', 'Ö', 'ö', 'â', 'í', 'á', 'ú', 'é', 'ó', 'Ó'); |
|
899 | - $s2 = array(" ", "&", "\xc3\xb4", "\xc3\96", "\xc3\xb6", "\xc3\xa5", "\xc3\xad", "\xc3\xa1", "\xc3\xba", "\xc3\xa9", "\xc3\xb3", "\xc3\x93"); |
|
900 | - $r = array('_', 'and', 'o', 'o', 'o', 'a', 'i', 'a', 'u', 'e', 'o', 'o'); |
|
898 | + $s = array(' ', '&', 'ô', 'Ö', 'ö', 'â', 'í', 'á', 'ú', 'é', 'ó', 'Ó'); |
|
899 | + $s2 = array(" ", "&", "\xc3\xb4", "\xc3\96", "\xc3\xb6", "\xc3\xa5", "\xc3\xad", "\xc3\xa1", "\xc3\xba", "\xc3\xa9", "\xc3\xb3", "\xc3\x93"); |
|
900 | + $r = array('_', 'and', 'o', 'o', 'o', 'a', 'i', 'a', 'u', 'e', 'o', 'o'); |
|
901 | 901 | $name = preg_replace('#^the #', '', strtolower($name)); |
902 | 902 | |
903 | 903 | $out = ''; |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | // Insert the Person ID if known. |
906 | 906 | if ($pid !== NULL) |
907 | 907 | { |
908 | - $out .= $pid . '/'; |
|
908 | + $out .= $pid.'/'; |
|
909 | 909 | } |
910 | 910 | |
911 | 911 | // Always inject the person's name |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | // If there is a constituency, inject that too |
915 | 915 | if ($const && $house == HOUSE_TYPE_COMMONS) |
916 | 916 | { |
917 | - $out .= '/' . urlencode(str_replace($s2, $r, str_replace($s, $r, strtolower($const)))); |
|
917 | + $out .= '/'.urlencode(str_replace($s2, $r, str_replace($s, $r, strtolower($const)))); |
|
918 | 918 | } |
919 | 919 | |
920 | 920 | return $out; |
@@ -925,14 +925,14 @@ discard block |
||
925 | 925 | if ($house == HOUSE_TYPE_COMMONS || $house == HOUSE_TYPE_NI || $house == HOUSE_TYPE_SCOTLAND) { |
926 | 926 | $s = "$given_name $family_name"; |
927 | 927 | if ($title) { |
928 | - $s = $title . ' ' . $s; |
|
928 | + $s = $title.' '.$s; |
|
929 | 929 | } |
930 | 930 | } elseif ($house == HOUSE_TYPE_LORDS) { |
931 | 931 | $s = ''; |
932 | 932 | if (!$family_name) $s = 'the '; |
933 | 933 | $s .= $title; |
934 | - if ($family_name) $s .= ' ' . $family_name; |
|
935 | - if ($lordofname) $s .= ' of ' . $lordofname; |
|
934 | + if ($family_name) $s .= ' '.$family_name; |
|
935 | + if ($lordofname) $s .= ' of '.$lordofname; |
|
936 | 936 | } elseif ($house == HOUSE_TYPE_ROYAL) { # Queen |
937 | 937 | $s = "$given_name $family_name"; |
938 | 938 | } |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | foreach ($data as $major => $array) { |
1003 | 1003 | if (!in_array('timestamp', $array)) $daytext[$major] = "The most recent "; |
1004 | 1004 | elseif ($todaystime - $array['timestamp'] == 86400) $daytext[$major] = "Yesterday’s"; |
1005 | - elseif ($todaystime - $array['timestamp'] <= (6 * 86400)) $daytext[$major] = gmdate('l', $array['timestamp']) . "’s"; |
|
1005 | + elseif ($todaystime - $array['timestamp'] <= (6 * 86400)) $daytext[$major] = gmdate('l', $array['timestamp'])."’s"; |
|
1006 | 1006 | else $daytext[$major] = "The most recent "; |
1007 | 1007 | } |
1008 | 1008 | } |
@@ -1019,9 +1019,9 @@ discard block |
||
1019 | 1019 | $q = $db->query('SELECT section_id, body, gid |
1020 | 1020 | FROM hansard, epobject |
1021 | 1021 | WHERE hansard.epobject_id = epobject.epobject_id ' |
1022 | - . ($p_major == 4 ? 'AND subsection_id=0' : 'AND section_id=0') . |
|
1023 | - ' AND hdate = "' . $date . '" |
|
1024 | - AND major = ' . $p_major . ' |
|
1022 | + . ($p_major == 4 ? 'AND subsection_id=0' : 'AND section_id=0'). |
|
1023 | + ' AND hdate = "'.$date.'" |
|
1024 | + AND major = ' . $p_major.' |
|
1025 | 1025 | ORDER BY hpos'); |
1026 | 1026 | $out = ''; |
1027 | 1027 | $LISTURL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$p_major]['page_all']); |
@@ -1035,11 +1035,11 @@ discard block |
||
1035 | 1035 | if ($current_sid++) { |
1036 | 1036 | $out .= '</ul>'; |
1037 | 1037 | } |
1038 | - $out .= '<li>' . $body . '<ul>'; |
|
1038 | + $out .= '<li>'.$body.'<ul>'; |
|
1039 | 1039 | } else { |
1040 | - $LISTURL->insert( array( 'id' => $gid ) ); |
|
1040 | + $LISTURL->insert(array('id' => $gid)); |
|
1041 | 1041 | $out .= '<li><a href="'.$LISTURL->generate().'">'; |
1042 | - $out .= $body . '</a>'; |
|
1042 | + $out .= $body.'</a>'; |
|
1043 | 1043 | } |
1044 | 1044 | } |
1045 | 1045 | if ($out) { |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | |
1064 | 1064 | $return = '<h4>'; |
1065 | 1065 | if (isset($daytext[$major])) { |
1066 | - $return .= $daytext[$major] . ' '; |
|
1066 | + $return .= $daytext[$major].' '; |
|
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | $return .= '<a href="'; |
@@ -1073,7 +1073,7 @@ discard block |
||
1073 | 1073 | $LISTURL->reset(); |
1074 | 1074 | $return .= $LISTURL->generate(); |
1075 | 1075 | } |
1076 | - $return .= '">' . $hansardmajors[$major]['title'] . '</a>'; |
|
1076 | + $return .= '">'.$hansardmajors[$major]['title'].'</a>'; |
|
1077 | 1077 | if (isset($daytext[$major])) $return; |
1078 | 1078 | $return .= '</h4>'; |
1079 | 1079 | |
@@ -1118,10 +1118,10 @@ discard block |
||
1118 | 1118 | |
1119 | 1119 | function cache_version($file) { |
1120 | 1120 | static $version_hash = array(); |
1121 | - $path = BASEDIR . "/$file"; |
|
1121 | + $path = BASEDIR."/$file"; |
|
1122 | 1122 | if (is_file($path) && (!isset($version_hash[$file]) || DEVSITE)) { |
1123 | 1123 | $version_hash[$file] = stat($path)[9]; |
1124 | - $file .= '?' . $version_hash[$file]; |
|
1124 | + $file .= '?'.$version_hash[$file]; |
|
1125 | 1125 | } |
1126 | - return WEBPATH . $file; |
|
1126 | + return WEBPATH.$file; |
|
1127 | 1127 | } |
@@ -318,6 +318,9 @@ discard block |
||
318 | 318 | $format_date_months = array('', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); |
319 | 319 | $format_date_months_short = array('', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); |
320 | 320 | |
321 | +/** |
|
322 | + * @param string $format |
|
323 | + */ |
|
321 | 324 | function format_date($date, $format) { |
322 | 325 | global $format_date_months, $format_date_months_short; |
323 | 326 | // Pass it a date (YYYY-MM-DD) and a |
@@ -342,6 +345,9 @@ discard block |
||
342 | 345 | } |
343 | 346 | |
344 | 347 | |
348 | +/** |
|
349 | + * @param string $format |
|
350 | + */ |
|
345 | 351 | function format_time($time, $format) { |
346 | 352 | // Pass it a time (HH:MM:SS) and a |
347 | 353 | // PHP date format string (eg, "H:i") |
@@ -486,6 +492,7 @@ discard block |
||
486 | 492 | |
487 | 493 | /** |
488 | 494 | * Filters user input to remove unwanted HTML tags etc |
495 | + * @param string $filter_type |
|
489 | 496 | */ |
490 | 497 | function filter_user_input($text, $filter_type) { |
491 | 498 | // We use this to filter any major user input, especially comments. |
@@ -750,12 +757,18 @@ discard block |
||
750 | 757 | /* verp_envelope_sender RECIPIENT |
751 | 758 | * Construct a VERP envelope sender for an email to RECIPIENT |
752 | 759 | */ |
760 | +/** |
|
761 | + * @return string|null |
|
762 | + */ |
|
753 | 763 | function twfy_verp_envelope_sender($recipient) { |
754 | 764 | $envelope_sender = verp_envelope_sender($recipient, 'twfy', EMAILDOMAIN); |
755 | 765 | |
756 | 766 | return $envelope_sender; |
757 | 767 | } |
758 | 768 | |
769 | +/** |
|
770 | + * @param string $message |
|
771 | + */ |
|
759 | 772 | function send_email($to, $subject, $message, $bulk = false, $from = '', $want_bounces = false) { |
760 | 773 | // Use this rather than PHP's mail() direct, so we can make alterations |
761 | 774 | // easily to all the emails we send out from the site. |
@@ -814,6 +827,9 @@ discard block |
||
814 | 827 | } |
815 | 828 | |
816 | 829 | // Call this with a key name to get a COOKIE variable. |
830 | +/** |
|
831 | + * @param string $name |
|
832 | + */ |
|
817 | 833 | function get_cookie_var($name, $default='') { |
818 | 834 | if (array_key_exists($name, $_COOKIE)) { |
819 | 835 | return clean_var($_COOKIE[$name]); |
@@ -1058,6 +1074,10 @@ discard block |
||
1058 | 1074 | } |
1059 | 1075 | } |
1060 | 1076 | |
1077 | +/** |
|
1078 | + * @param integer $major |
|
1079 | + * @param MySociety\TheyWorkForYou\Url $LISTURL |
|
1080 | + */ |
|
1061 | 1081 | function _major_summary_title($major, $data, $LISTURL, $daytext) { |
1062 | 1082 | global $hansardmajors; |
1063 | 1083 | |
@@ -1107,6 +1127,9 @@ discard block |
||
1107 | 1127 | return $return; |
1108 | 1128 | } |
1109 | 1129 | |
1130 | +/** |
|
1131 | + * @param string|null $url |
|
1132 | + */ |
|
1110 | 1133 | function redirect($url) { |
1111 | 1134 | if (defined('TESTING')) { |
1112 | 1135 | print "Location: $url"; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | ); |
125 | 125 | $hansardmajors[104] = $hansardmajors[4]; |
126 | 126 | |
127 | -$parties = array ( |
|
127 | +$parties = array( |
|
128 | 128 | 'Bp' => 'Bishop', |
129 | 129 | 'Con' => 'Conservative', |
130 | 130 | 'CWM' => 'Deputy Speaker', |
@@ -166,9 +166,9 @@ discard block |
||
166 | 166 | */ |
167 | 167 | |
168 | 168 | // Constants for various house types |
169 | -define ('HOUSE_TYPE_ROYAL', 0); |
|
170 | -define ('HOUSE_TYPE_COMMONS', 1); |
|
171 | -define ('HOUSE_TYPE_LORDS', 2); |
|
172 | -define ('HOUSE_TYPE_NI', 3); |
|
173 | -define ('HOUSE_TYPE_SCOTLAND', 4); |
|
174 | -define ('HOUSE_TYPE_WALES', 5); |
|
169 | +define('HOUSE_TYPE_ROYAL', 0); |
|
170 | +define('HOUSE_TYPE_COMMONS', 1); |
|
171 | +define('HOUSE_TYPE_LORDS', 2); |
|
172 | +define('HOUSE_TYPE_NI', 3); |
|
173 | +define('HOUSE_TYPE_SCOTLAND', 4); |
|
174 | +define('HOUSE_TYPE_WALES', 5); |
@@ -3,15 +3,15 @@ |
||
3 | 3 | # Index page for written answers/statements. |
4 | 4 | |
5 | 5 | include_once '../../includes/easyparliament/init.php'; |
6 | -include_once INCLUDESPATH . "easyparliament/glossary.php"; |
|
7 | -include_once INCLUDESPATH . "easyparliament/member.php"; |
|
8 | -include_once INCLUDESPATH . "easyparliament/recess.php"; |
|
6 | +include_once INCLUDESPATH."easyparliament/glossary.php"; |
|
7 | +include_once INCLUDESPATH."easyparliament/member.php"; |
|
8 | +include_once INCLUDESPATH."easyparliament/recess.php"; |
|
9 | 9 | |
10 | 10 | $this_page = 'wranswmsfront'; |
11 | 11 | $view = new MySociety\TheyWorkForYou\SectionView\WransView(); |
12 | 12 | $data = $view->display(); |
13 | 13 | if ($data) { |
14 | - if ( $data['template'] ) { |
|
14 | + if ($data['template']) { |
|
15 | 15 | $template = $data['template']; |
16 | 16 | } else { |
17 | 17 | $template = 'section/section'; |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $this_page = '404'; |
4 | -include_once dirname(__FILE__) . '/../includes/easyparliament/init.php'; |
|
5 | -include_once INCLUDESPATH . 'easyparliament/member.php'; |
|
4 | +include_once dirname(__FILE__).'/../includes/easyparliament/init.php'; |
|
5 | +include_once INCLUDESPATH.'easyparliament/member.php'; |
|
6 | 6 | |
7 | 7 | $PAGE->page_start(); |
8 | 8 | $PAGE->stripe_start(); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | <?php |
33 | 33 | |
34 | 34 | $includes = array( |
35 | - array ( |
|
35 | + array( |
|
36 | 36 | 'type' => 'include', |
37 | 37 | 'content' => 'whatisthissite' |
38 | 38 | ), |