@@ -92,7 +92,7 @@ |
||
| 92 | 92 | include_once (INCLUDESPATH."easyparliament/user.php"); |
| 93 | 93 | |
| 94 | 94 | // Test to see if this is a new-style template using the renderer class. |
| 95 | -if (! isset($new_style_template) OR $new_style_template !== TRUE) { |
|
| 95 | +if (! isset($new_style_template) or $new_style_template !== true) { |
|
| 96 | 96 | |
| 97 | 97 | // This is an old-style page. Use the old page classes. |
| 98 | 98 | include_once (INCLUDESPATH."easyparliament/page.php"); |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | First some things to help make our PHP nicer and betterer |
| 5 | 5 | ********************************************************************************/ |
| 6 | 6 | |
| 7 | -error_reporting (E_ALL); |
|
| 7 | +error_reporting(E_ALL); |
|
| 8 | 8 | |
| 9 | 9 | /******************************************************************************** |
| 10 | 10 | Now some constants that are the same for live and dev versions |
@@ -12,22 +12,22 @@ discard block |
||
| 12 | 12 | ********************************************************************************/ |
| 13 | 13 | |
| 14 | 14 | // In case we need to switch these off globally at some point... |
| 15 | -define ("ALLOWCOMMENTS", true); |
|
| 16 | -define ("ALLOWTRACKBACKS", true); |
|
| 15 | +define("ALLOWCOMMENTS", true); |
|
| 16 | +define("ALLOWTRACKBACKS", true); |
|
| 17 | 17 | |
| 18 | 18 | // These variables are so we can keep date/time formats consistent across the site |
| 19 | 19 | // and change them easily. |
| 20 | 20 | // Formats here: http://www.php.net/manual/en/function.date.php |
| 21 | -define ("LONGERDATEFORMAT", "l, j F Y");// Monday, 31 December 2003 |
|
| 22 | -define ("LONGDATEFORMAT", "j F Y"); // 31 December 2003 |
|
| 23 | -define ("SHORTDATEFORMAT", "j M Y"); // 31 Dec 2003 |
|
| 24 | -define ("TIMEFORMAT", "g:i a"); // 11:59 pm |
|
| 21 | +define("LONGERDATEFORMAT", "l, j F Y"); // Monday, 31 December 2003 |
|
| 22 | +define("LONGDATEFORMAT", "j F Y"); // 31 December 2003 |
|
| 23 | +define("SHORTDATEFORMAT", "j M Y"); // 31 Dec 2003 |
|
| 24 | +define("TIMEFORMAT", "g:i a"); // 11:59 pm |
|
| 25 | 25 | |
| 26 | -define ("SHORTDATEFORMAT_SQL", "%e %b %Y"); // 31 Dec 2003 |
|
| 27 | -define ("TIMEFORMAT_SQL", "%l:%i %p"); // 11:59 PM |
|
| 26 | +define("SHORTDATEFORMAT_SQL", "%e %b %Y"); // 31 Dec 2003 |
|
| 27 | +define("TIMEFORMAT_SQL", "%l:%i %p"); // 11:59 PM |
|
| 28 | 28 | |
| 29 | 29 | // Where we store the postcode of users if they search for an MP by postcode. |
| 30 | -define ('POSTCODE_COOKIE', 'eppc'); |
|
| 30 | +define('POSTCODE_COOKIE', 'eppc'); |
|
| 31 | 31 | |
| 32 | 32 | /******************************************************************************** |
| 33 | 33 | And now all the files we'll include on every page. |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | twfy_debug_timestamp("after including utility.php"); |
| 42 | 42 | |
| 43 | 43 | // Set the default timezone |
| 44 | -if(function_exists('date_default_timezone_set')) date_default_timezone_set(TIMEZONE); |
|
| 44 | +if (function_exists('date_default_timezone_set')) date_default_timezone_set(TIMEZONE); |
|
| 45 | 45 | |
| 46 | 46 | // Only do clever things with errors if we're not testing, otherwise show as default |
| 47 | 47 | |
@@ -70,42 +70,42 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | // The time the page starts, so we can display the total at the end. |
| 72 | 72 | // getmicrotime() is in utiltity.php. |
| 73 | -define ("STARTTIME", getmicrotime()); |
|
| 73 | +define("STARTTIME", getmicrotime()); |
|
| 74 | 74 | if (!isset($_SERVER['WINDIR'])) { |
| 75 | 75 | $rusage = getrusage(); |
| 76 | - define ('STARTTIMES', $rusage['ru_stime.tv_sec']*1000000 + $rusage['ru_stime.tv_usec']); |
|
| 77 | - define ('STARTTIMEU', $rusage['ru_utime.tv_sec']*1000000 + $rusage['ru_utime.tv_usec']); |
|
| 76 | + define('STARTTIMES', $rusage['ru_stime.tv_sec'] * 1000000 + $rusage['ru_stime.tv_usec']); |
|
| 77 | + define('STARTTIMEU', $rusage['ru_utime.tv_sec'] * 1000000 + $rusage['ru_utime.tv_usec']); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $DATA = new \MySociety\TheyWorkForYou\Data; |
| 81 | 81 | |
| 82 | 82 | class ParlDB extends \MySociety\TheyWorkForYou\Db\Connection { |
| 83 | 83 | public function __construct() { |
| 84 | - $this->init (OPTION_TWFY_DB_HOST, OPTION_TWFY_DB_USER, OPTION_TWFY_DB_PASS, OPTION_TWFY_DB_NAME); |
|
| 84 | + $this->init(OPTION_TWFY_DB_HOST, OPTION_TWFY_DB_USER, OPTION_TWFY_DB_PASS, OPTION_TWFY_DB_NAME); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | -include_once (INCLUDESPATH."url.php"); |
|
| 88 | +include_once (INCLUDESPATH . "url.php"); |
|
| 89 | 89 | |
| 90 | 90 | $filter = new \MySociety\TheyWorkForYou\Utility\LibFilter; |
| 91 | 91 | |
| 92 | -include_once (INCLUDESPATH."easyparliament/user.php"); |
|
| 92 | +include_once (INCLUDESPATH . "easyparliament/user.php"); |
|
| 93 | 93 | |
| 94 | 94 | // Test to see if this is a new-style template using the renderer class. |
| 95 | -if (! isset($new_style_template) OR $new_style_template !== TRUE) { |
|
| 95 | +if (!isset($new_style_template) OR $new_style_template !== TRUE) { |
|
| 96 | 96 | |
| 97 | 97 | // This is an old-style page. Use the old page classes. |
| 98 | - include_once (INCLUDESPATH."easyparliament/page.php"); |
|
| 98 | + include_once (INCLUDESPATH . "easyparliament/page.php"); |
|
| 99 | 99 | |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | -include_once (INCLUDESPATH."easyparliament/hansardlist.php"); |
|
| 103 | -include_once (INCLUDESPATH."dbtypes.php"); |
|
| 104 | -include_once (INCLUDESPATH."easyparliament/commentlist.php"); |
|
| 105 | -include_once (INCLUDESPATH."easyparliament/comment.php"); |
|
| 106 | -include_once (INCLUDESPATH."easyparliament/trackback.php"); |
|
| 102 | +include_once (INCLUDESPATH . "easyparliament/hansardlist.php"); |
|
| 103 | +include_once (INCLUDESPATH . "dbtypes.php"); |
|
| 104 | +include_once (INCLUDESPATH . "easyparliament/commentlist.php"); |
|
| 105 | +include_once (INCLUDESPATH . "easyparliament/comment.php"); |
|
| 106 | +include_once (INCLUDESPATH . "easyparliament/trackback.php"); |
|
| 107 | 107 | |
| 108 | 108 | // Added in as new module by Richard Allan MP |
| 109 | -include_once (INCLUDESPATH."easyparliament/alert.php"); |
|
| 109 | +include_once (INCLUDESPATH . "easyparliament/alert.php"); |
|
| 110 | 110 | |
| 111 | 111 | twfy_debug_timestamp("at end of init.php"); |
@@ -130,7 +130,9 @@ discard block |
||
| 130 | 130 | $this->error($this->conn->errorCode() . ': ' . $this->conn->errorInfo()[2]); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - if (!$this->success) return; |
|
| 133 | + if (!$this->success) { |
|
| 134 | + return; |
|
| 135 | + } |
|
| 134 | 136 | |
| 135 | 137 | if ((!$pdoStatement) or (empty($pdoStatement))) { |
| 136 | 138 | // A failed query. |
@@ -180,8 +182,9 @@ discard block |
||
| 180 | 182 | * @param string $column_name |
| 181 | 183 | */ |
| 182 | 184 | public function field($row_index, $column_name) { |
| 183 | - if ($this->rows > 0) |
|
| 184 | - return $this->data[$row_index][$column_name]; |
|
| 185 | + if ($this->rows > 0) { |
|
| 186 | + return $this->data[$row_index][$column_name]; |
|
| 187 | + } |
|
| 185 | 188 | return ""; |
| 186 | 189 | } |
| 187 | 190 | |
@@ -196,8 +199,9 @@ discard block |
||
| 196 | 199 | * @param integer $row_index |
| 197 | 200 | */ |
| 198 | 201 | public function row($row_index) { |
| 199 | - if ($this->success && $this->rows > 0) |
|
| 200 | - return $this->data[$row_index]; |
|
| 202 | + if ($this->success && $this->rows > 0) { |
|
| 203 | + return $this->data[$row_index]; |
|
| 204 | + } |
|
| 201 | 205 | return array(); |
| 202 | 206 | } |
| 203 | 207 | |