@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | if (get_http_var("submitted") == "true") { |
20 | 20 | // Form has been submitted, so check input. |
21 | 21 | |
22 | - $email = get_http_var("email"); |
|
22 | + $email = get_http_var("email"); |
|
23 | 23 | $password = get_http_var("password"); |
24 | 24 | $remember = get_http_var("remember"); |
25 | 25 | |
26 | 26 | // The user may have tried to do something that requires being logged in. |
27 | 27 | // In which case we should arrive here with that page's URL in 'ret'. |
28 | 28 | // We can then send the user there after log in. |
29 | - $returnurl = get_http_var("ret"); |
|
29 | + $returnurl = get_http_var("ret"); |
|
30 | 30 | |
31 | 31 | $errors = array(); |
32 | 32 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | if ($remember == "true") { |
54 | 54 | $expire = "never"; |
55 | 55 | } else { |
56 | - $expire ="session"; |
|
56 | + $expire = "session"; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // $returnurl is the url of where we'll send the user after login. |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | |
99 | -function display_page( $errors=array() ) { |
|
99 | +function display_page($errors = array()) { |
|
100 | 100 | global $PAGE, $this_page, $THEUSER; |
101 | 101 | |
102 | 102 | $PAGE->page_start(); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | <?php |
128 | 128 | |
129 | 129 | $PAGE->stripe_end(array( |
130 | - array ( |
|
130 | + array( |
|
131 | 131 | 'type' => 'include', |
132 | 132 | 'content' => 'userlogin' |
133 | 133 | ) |
@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | public function tearDown() |
27 | 27 | { |
28 | - $this->db = NULL; |
|
28 | + $this->db = null; |
|
29 | 29 | |
30 | 30 | parent::tearDown(); |
31 | 31 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | /** |
10 | 10 | * Test that the Royal edge-case house is correctly defined. |
11 | 11 | */ |
12 | - public function testRoyalHouseDefined() |
|
12 | + public function testRoyalHouseDefined() |
|
13 | 13 | { |
14 | 14 | $this->assertEquals(0, HOUSE_TYPE_ROYAL); |
15 | 15 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * Test that the House of Commons is correctly defined. |
19 | 19 | */ |
20 | - public function testCommonsHouseDefined() |
|
20 | + public function testCommonsHouseDefined() |
|
21 | 21 | { |
22 | 22 | $this->assertEquals(1, HOUSE_TYPE_COMMONS); |
23 | 23 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * Test that the House of Lords is correctly defined. |
27 | 27 | */ |
28 | - public function testLordsHouseDefined() |
|
28 | + public function testLordsHouseDefined() |
|
29 | 29 | { |
30 | 30 | $this->assertEquals(2, HOUSE_TYPE_LORDS); |
31 | 31 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * Test that the Northern Ireland Assembly is correctly defined. |
35 | 35 | */ |
36 | - public function testNIHouseDefined() |
|
36 | + public function testNIHouseDefined() |
|
37 | 37 | { |
38 | 38 | $this->assertEquals(3, HOUSE_TYPE_NI); |
39 | 39 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * Test that the Scottish Parliament is correctly defined. |
43 | 43 | */ |
44 | - public function testScotlandHouseDefined() |
|
44 | + public function testScotlandHouseDefined() |
|
45 | 45 | { |
46 | 46 | $this->assertEquals(4, HOUSE_TYPE_SCOTLAND); |
47 | 47 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | /** |
50 | 50 | * Test that the Assembly for Wales is correctly defined. |
51 | 51 | */ |
52 | - public function testWalesHouseDefined() |
|
52 | + public function testWalesHouseDefined() |
|
53 | 53 | { |
54 | 54 | $this->assertEquals(5, HOUSE_TYPE_WALES); |
55 | 55 | } |
@@ -159,6 +159,9 @@ |
||
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | + /** |
|
163 | + * @param string $type |
|
164 | + */ |
|
162 | 165 | private function getMetadata($args="", $type) { |
163 | 166 | // $type is either 'page' or 'section' |
164 | 167 | global $this_page, $this_section; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | public function __construct() { |
56 | 56 | |
57 | - include_once METADATAPATH; // defined in config.php |
|
57 | + include_once METADATAPATH; // defined in config.php |
|
58 | 58 | |
59 | 59 | } |
60 | 60 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | |
116 | 116 | public function set_page_metadata($page, $key, $value) { |
117 | - $this->setMetadata(array("page"=>$page,"key"=>$key,"value"=>$value)); |
|
117 | + $this->setMetadata(array("page"=>$page, "key"=>$key, "value"=>$value)); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | |
128 | 128 | public function set_section_metadata($section, $key, $value) { |
129 | - $this->setMetadata(array("section"=>$section,"key"=>$key,"value"=>$value)); |
|
129 | + $this->setMetadata(array("section"=>$section, "key"=>$key, "value"=>$value)); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | |
152 | 152 | public function test_for_metadata($type, $item, $key) { |
153 | - $dataarray =& $this->$type; |
|
153 | + $dataarray = & $this->$type; |
|
154 | 154 | |
155 | 155 | if (isset($dataarray[$item][$key])) { |
156 | 156 | return true; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | - private function getMetadata($args="", $type) { |
|
162 | + private function getMetadata($args = "", $type) { |
|
163 | 163 | // $type is either 'page' or 'section' |
164 | 164 | global $this_page, $this_section; |
165 | 165 | |
@@ -167,21 +167,21 @@ discard block |
||
167 | 167 | $item = $args[$type]; |
168 | 168 | $key = $args['key']; |
169 | 169 | } else { |
170 | - $var = "this_".$type; |
|
170 | + $var = "this_" . $type; |
|
171 | 171 | $item = $$var; // $this_page or $this_section. |
172 | 172 | $key = $args; |
173 | 173 | } |
174 | 174 | |
175 | 175 | twfy_debug("DATA", "$type: $item, $key"); |
176 | - $dataarray =& $this->$type; |
|
176 | + $dataarray = & $this->$type; |
|
177 | 177 | |
178 | 178 | if ($this->test_for_metadata($type, $item, $key)) { |
179 | 179 | $return = $dataarray[$item][$key]; |
180 | - $debugtext = "Key: ".$type."[".$item."][".$key."]"; |
|
180 | + $debugtext = "Key: " . $type . "[" . $item . "][" . $key . "]"; |
|
181 | 181 | |
182 | 182 | } elseif ($this->test_for_metadata($type, "default", $key)) { |
183 | 183 | $return = $dataarray["default"][$key]; |
184 | - $debugtext = "Key: ".$type."['default'][".$key."]"; |
|
184 | + $debugtext = "Key: " . $type . "['default'][" . $key . "]"; |
|
185 | 185 | |
186 | 186 | } else { |
187 | 187 | $return = false; |
@@ -206,9 +206,9 @@ discard block |
||
206 | 206 | $key = $args["key"]; |
207 | 207 | $value = $args["value"]; |
208 | 208 | |
209 | - twfy_debug("DATA", "Setting: ".$type."[".$item."][".$key."] = '" . print_r($value, 1) . "'"); |
|
209 | + twfy_debug("DATA", "Setting: " . $type . "[" . $item . "][" . $key . "] = '" . print_r($value, 1) . "'"); |
|
210 | 210 | |
211 | - $dataarray =& $this->$type; |
|
211 | + $dataarray = & $this->$type; |
|
212 | 212 | $dataarray[$item][$key] = $value; |
213 | 213 | } |
214 | 214 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $edittext = $menudata['text']; |
50 | 50 | $edittitle = $menudata['title']; |
51 | 51 | $EDITURL = new \URL('userviewself'); |
52 | - if ($this->page == 'userviewself' || $this->page == 'useredit' ) { |
|
52 | + if ($this->page == 'userviewself' || $this->page == 'useredit') { |
|
53 | 53 | $editclass = 'on'; |
54 | 54 | } else { |
55 | 55 | $editclass = ''; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | // The 'Log out' link. |
59 | 59 | $menudata = $this->pagedata->page_metadata('userlogout', 'menu'); |
60 | 60 | $logouttext = $menudata['text']; |
61 | - $logouttitle= $menudata['title']; |
|
61 | + $logouttitle = $menudata['title']; |
|
62 | 62 | |
63 | 63 | $LOGOUTURL = new \URL('userlogout'); |
64 | 64 | if ($this->page != 'userlogout') { |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | |
27 | 27 | public function set($key, $value, $timeout = 3600) { |
28 | 28 | if (class_exists('\Memcached')) { |
29 | - self::$memcache->set(OPTION_TWFY_DB_NAME.':'.$key, $value, $timeout); |
|
29 | + self::$memcache->set(OPTION_TWFY_DB_NAME . ':' . $key, $value, $timeout); |
|
30 | 30 | } else { |
31 | - self::$memcache->set(OPTION_TWFY_DB_NAME.':'.$key, $value, MEMCACHE_COMPRESSED, $timeout); |
|
31 | + self::$memcache->set(OPTION_TWFY_DB_NAME . ':' . $key, $value, MEMCACHE_COMPRESSED, $timeout); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | // see http://php.net/manual/en/memcache.get.php#112056 for explanation of this |
37 | 37 | $was_found = false; |
38 | 38 | if (class_exists('\Memcached')) { |
39 | - $value = self::$memcache->get(OPTION_TWFY_DB_NAME.':'.$key, null, $was_found); |
|
39 | + $value = self::$memcache->get(OPTION_TWFY_DB_NAME . ':' . $key, null, $was_found); |
|
40 | 40 | } else { |
41 | - $value = self::$memcache->get(OPTION_TWFY_DB_NAME.':'.$key, $was_found); |
|
41 | + $value = self::$memcache->get(OPTION_TWFY_DB_NAME . ':' . $key, $was_found); |
|
42 | 42 | } |
43 | 43 | if ($was_found === false) { |
44 | 44 | return false; // mmmmm |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | if ($hide_question) { |
26 | 26 | $always_ask = 0; |
27 | 27 | $show_survey_qn = $current_question; |
28 | - setcookie('survey', $current_question, time()+60*60*24*365, '/'); |
|
28 | + setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/'); |
|
29 | 29 | } elseif ($has_answered_question == $current_question && !$always_ask) { |
30 | 30 | $show_survey_qn = $current_question; |
31 | - setcookie('survey', $current_question, time()+60*60*24*365, '/'); |
|
31 | + setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/'); |
|
32 | 32 | } elseif (isset($_COOKIE['survey'])) { |
33 | 33 | $show_survey_qn = $_COOKIE['survey']; |
34 | 34 | } |
@@ -38,18 +38,18 @@ discard block |
||
38 | 38 | |
39 | 39 | $page_url = ''; |
40 | 40 | $hide_url = ''; |
41 | - if ( in_array( $this_page, array('mp', 'peer', 'msp', 'mla', 'royal') ) ) { |
|
41 | + if (in_array($this_page, array('mp', 'peer', 'msp', 'mla', 'royal'))) { |
|
42 | 42 | global $MEMBER; |
43 | - if ( $MEMBER ) { |
|
43 | + if ($MEMBER) { |
|
44 | 44 | $page_url = $MEMBER->url(true) . "?answered_survey=$current_question"; |
45 | 45 | $hide_url = $MEMBER->url() . "?hide_survey=$current_question"; |
46 | 46 | } |
47 | 47 | } else { |
48 | 48 | $URL = new \URL($this_page); |
49 | - $URL->insert(array('answered_survey' => $current_question )); |
|
49 | + $URL->insert(array('answered_survey' => $current_question)); |
|
50 | 50 | $page_url = 'https://' . DOMAIN . $URL->generate(); |
51 | 51 | $URL = new \URL($this_page); |
52 | - $URL->insert(array('hide_survey' => $current_question )); |
|
52 | + $URL->insert(array('hide_survey' => $current_question)); |
|
53 | 53 | $hide_url = $URL->generate(); |
54 | 54 | } |
55 | 55 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | if (!empty($details['pid'])) { |
22 | - $criteria[] = 'speaker:'.$details['pid']; |
|
22 | + $criteria[] = 'speaker:' . $details['pid']; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | $criteria = join(' ', $criteria); |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | ':email' => $email |
34 | 34 | )); |
35 | 35 | $out = ''; |
36 | - for ($i=0; $i<$q->rows(); ++$i) { |
|
36 | + for ($i = 0; $i < $q->rows(); ++$i) { |
|
37 | 37 | $row = $q->row($i); |
38 | - $criteria = explode(' ',$row['criteria']); |
|
38 | + $criteria = explode(' ', $row['criteria']); |
|
39 | 39 | $ccc = array(); |
40 | 40 | $current = true; |
41 | 41 | foreach ($criteria as $c) { |
42 | - if (preg_match('#^speaker:(\d+)#',$c,$m)) { |
|
42 | + if (preg_match('#^speaker:(\d+)#', $c, $m)) { |
|
43 | 43 | $MEMBER = new \MEMBER(array('person_id'=>$m[1])); |
44 | 44 | $ccc[] = 'spoken by ' . $MEMBER->full_name(); |
45 | 45 | if (!$MEMBER->current_member_anywhere()) { |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | $ccc[] = $c; |
50 | 50 | } |
51 | 51 | } |
52 | - $criteria = join(' ',$ccc); |
|
52 | + $criteria = join(' ', $ccc); |
|
53 | 53 | $token = $row['alert_id'] . '-' . $row['registrationtoken']; |
54 | - $action = '<form action="/alert/" method="post"><input type="hidden" name="t" value="'.$token.'">'; |
|
54 | + $action = '<form action="/alert/" method="post"><input type="hidden" name="t" value="' . $token . '">'; |
|
55 | 55 | if (!$row['confirmed']) { |
56 | 56 | $action .= '<input type="submit" name="action" value="Confirm">'; |
57 | - } elseif ($row['deleted']==2) { |
|
57 | + } elseif ($row['deleted'] == 2) { |
|
58 | 58 | $action .= '<input type="submit" name="action" value="Resume">'; |
59 | 59 | } else { |
60 | 60 | $action .= '<input type="submit" name="action" value="Suspend"> <input type="submit" name="action" value="Delete">'; |
@@ -91,7 +91,7 @@ |
||
91 | 91 | } else { |
92 | 92 | $title = $e['title']; |
93 | 93 | if ($pid = $e['person_id']) { |
94 | - $MEMBER = new \MEMBER(array( 'person_id' => $pid )); |
|
94 | + $MEMBER = new \MEMBER(array('person_id' => $pid)); |
|
95 | 95 | $name = $MEMBER->full_name(); |
96 | 96 | $title .= " – <a href='/mp/?p=$pid'>$name</a>"; |
97 | 97 | } |