Failed Conditions
Pull Request — master (#965)
by Nick
34:10
created
classes/SectionView/PbcView.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 
43 43
         if ($bill_id && $id) {
44 44
             return $this->display_section_or_speech(array(
45
-                'gid' => $standingprefix . $id,
45
+                'gid' => $standingprefix.$id,
46 46
             ));
47 47
         } elseif ($bill_id) {
48 48
             # Display the page for a particular bill
49 49
             $this_page = 'pbc_bill';
50
-            $args = array (
50
+            $args = array(
51 51
                 'id' => $bill_id,
52 52
                 'title' => $this->bill,
53 53
                 'session' => $this->session,
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
         } elseif ($this->session && $this->bill) {
61 61
             # Illegal bill title, redirect to session page
62 62
             $URL = new \MySociety\TheyWorkForYou\Url('pbc_session');
63
-            header('Location: ' . $URL->generate() . urlencode($this->session));
63
+            header('Location: '.$URL->generate().urlencode($this->session));
64 64
             exit;
65 65
         } elseif ($this->session) {
66 66
             # Display the bills for a particular session
67 67
             $this_page = 'pbc_session';
68 68
             $DATA->set_page_metadata($this_page, 'title', "Session $this->session");
69
-            $args = array (
69
+            $args = array(
70 70
                 'session' => $this->session,
71 71
             );
72 72
             $data = array();
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
 
89 89
     protected function getSearchSections() {
90 90
         return array(
91
-            array( 'section' => 'pbc' )
91
+            array('section' => 'pbc')
92 92
         );
93 93
     }
94 94
 
95 95
     protected function front_content() {
96
-        return $this->list->display( 'recent_pbc_debates', array( 'num' => 50 ), 'none' );
96
+        return $this->list->display('recent_pbc_debates', array('num' => 50), 'none');
97 97
     }
98 98
 
99 99
     protected function display_front() {
Please login to merge, or discard this patch.
classes/SectionView/NiView.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
     protected function getSearchSections() {
34 34
         return array(
35
-            array( 'section' => 'ni' )
35
+            array('section' => 'ni')
36 36
         );
37 37
     }
38 38
 
@@ -52,23 +52,23 @@  discard block
 block discarded – undo
52 52
 
53 53
         $debates = $DEBATELIST->display('recent_debates', array('days' => 30, 'num' => 6), 'none');
54 54
         $MOREURL = new \MySociety\TheyWorkForYou\Url('nidebatesfront');
55
-        $MOREURL->insert( array( 'more' => 1 ) );
55
+        $MOREURL->insert(array('more' => 1));
56 56
 
57 57
         // this makes sure that we don't repeat this debate in the list below
58 58
         $random_debate = NULL;
59
-        if ( isset($debates['data']) && count($debates['data']) ) {
59
+        if (isset($debates['data']) && count($debates['data'])) {
60 60
             $random_debate = $debates['data'][0];
61 61
         }
62 62
 
63 63
         $recent = array();
64
-        if ( isset($debates['data']) && count($debates['data']) ) {
64
+        if (isset($debates['data']) && count($debates['data'])) {
65 65
             // at the start of a session there may be less than 6
66 66
             // debates
67 67
             $max = 6;
68
-            if ( count($debates['data']) < 6 ) {
68
+            if (count($debates['data']) < 6) {
69 69
                 $max = count($debates['data']);
70 70
             }
71
-            for ( $i = 1; $i < $max; $i++ ) {
71
+            for ($i = 1; $i < $max; $i++) {
72 72
                 $debate = $debates['data'][$i];
73 73
                 $debate['desc'] = "Northern Ireland Assembly debates";
74 74
                 $debate['more_url'] = $MOREURL->generate();
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         }
78 78
 
79 79
         $featured = array();
80
-        if ( $random_debate ) {
80
+        if ($random_debate) {
81 81
             $featured = $random_debate;
82 82
             $featured['more_url'] = $MOREURL->generate();
83 83
             $featured['desc'] = 'Northern Ireland Assembly debate';
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         }
87 87
 
88 88
         $data['featured'] = $featured;
89
-        $data['debates'] = array( 'recent' => $recent);
89
+        $data['debates'] = array('recent' => $recent);
90 90
 
91 91
         $data['regional'] = $this->getMLAList();
92 92
         $data['template'] = 'ni/index';
Please login to merge, or discard this patch.
www/docs/admin/glossary_pending.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 $EDITQUEUE = new \MySociety\TheyWorkForYou\GlossaryEditQueue;
10 10
 
11
-$args = array (
11
+$args = array(
12 12
     'sort' => "regexp_replace"
13 13
 );
14 14
 $GLOSSARY = new GLOSSARY($args);
@@ -23,19 +23,19 @@  discard block
 block discarded – undo
23 23
 if (get_http_var('approve')) {
24 24
     $approve = get_http_var('approve');
25 25
     if (!is_array($approve)) {
26
-        $approve = array ( $approve );
26
+        $approve = array($approve);
27 27
     }
28 28
     // Add all approved items
29
-    $data = array (
29
+    $data = array(
30 30
         'approvals' => $approve,
31 31
         'epobject_type' => 2
32 32
     );
33 33
     $EDITQUEUE->approve($data);
34 34
 }
35 35
 elseif (get_http_var('decline')) {
36
-    $decline = array (get_http_var('decline'));
36
+    $decline = array(get_http_var('decline'));
37 37
     // Dump all declined items
38
-    $data = array (
38
+    $data = array(
39 39
         'declines' => $decline,
40 40
         'epobject_type' => 2
41 41
     );
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 
55 55
     // Mock up a "current term" to send to the display function
56 56
     if (get_http_var('previewterm')) {
57
-        $body	= get_http_var('definition');
58
-        $title	= get_http_var('g');
57
+        $body = get_http_var('definition');
58
+        $title = get_http_var('g');
59 59
     }
60 60
     else {
61 61
         $body = $EDITQUEUE->pending[$glossary_id]['body'];
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
     // Wiki woo!
95 95
     // We need to work out how best to work this...
96
-    $wiki_link = _htmlspecialchars("http://en.wikipedia.org/wiki/" . strtr($title, " ", "_"));
96
+    $wiki_link = _htmlspecialchars("http://en.wikipedia.org/wiki/".strtr($title, " ", "_"));
97 97
 ?>
98 98
         <p>Guessing the wikipedia link - give it a go:<br>
99 99
         <a href="<?php echo $wiki_link; ?>" target="_blank"><?php echo $wiki_link; ?></a></p>
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
     // add a modification to the database
117 117
     if (get_http_var('submitterm') && get_http_var('modify')) {
118
-        $data = array (
118
+        $data = array(
119 119
             'user_id'	=> get_http_var('userid'),
120 120
             'title'		=> get_http_var('g'),
121 121
             'body'		=> get_http_var('definition')
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     }
126 126
 
127 127
     if ($EDITQUEUE->pending_count) {
128
-        print "<h3>" . $EDITQUEUE->pending_count . " Pending Glossary terms</h3>";
128
+        print "<h3>".$EDITQUEUE->pending_count." Pending Glossary terms</h3>";
129 129
         $EDITQUEUE->display("pending");
130 130
     }
131 131
     else {
Please login to merge, or discard this patch.
www/docs/admin/glossary.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 $EDITQUEUE = new \MySociety\TheyWorkForYou\GlossaryEditQueue;
10 10
 
11
-$args = array (
11
+$args = array(
12 12
     'sort' => "regexp_replace"
13 13
 );
14 14
 
@@ -21,19 +21,19 @@  discard block
 block discarded – undo
21 21
 if (get_http_var('approve')) {
22 22
     $approve = get_http_var('approve');
23 23
     if (!is_array($approve)) {
24
-        $approve = array ( $approve );
24
+        $approve = array($approve);
25 25
     }
26 26
     // Add all approved items
27
-    $data = array (
27
+    $data = array(
28 28
         'approvals' => $approve,
29 29
         'epobject_type' => 2
30 30
     );
31 31
     $EDITQUEUE->approve($data);
32 32
 }
33 33
 elseif (get_http_var('decline')) {
34
-    $decline = array (get_http_var('decline'));
34
+    $decline = array(get_http_var('decline'));
35 35
     // Dump all declined items
36
-    $data = array (
36
+    $data = array(
37 37
         'declines' => $decline,
38 38
         'epobject_type' => 2
39 39
     );
Please login to merge, or discard this patch.
classes/EditQueue.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
                         (user_id, edit_type, title, body, submitted)
87 87
                         VALUES
88 88
                         (
89
-                        '" . addslashes($THEUSER->user_id()) . "',
90
-                        '" . $data['edit_type'] . "',
91
-                        '" . addslashes($data['title']) . "',
92
-                        '" . addslashes($data['body']) . "',
93
-                        '" . $data['posted'] . "'
89
+                        '" . addslashes($THEUSER->user_id())."',
90
+                        '" . $data['edit_type']."',
91
+                        '" . addslashes($data['title'])."',
92
+                        '" . addslashes($data['body'])."',
93
+                        '" . $data['posted']."'
94 94
                         );");
95 95
 
96 96
         if ($q->success()) {
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
             $q = $this->db->query("INSERT INTO epobject
138 138
                             (title, body, type, created)
139 139
                             VALUES
140
-                            ('" . addslashes($this->pending[$approval_id]['title']) . "',
141
-                            '" . addslashes($this->pending[$approval_id]['body']) . "',
142
-                            '" . $data['epobject_type'] . "',
143
-                            '" . $timestamp . "');");
140
+                            ('" . addslashes($this->pending[$approval_id]['title'])."',
141
+                            '" . addslashes($this->pending[$approval_id]['body'])."',
142
+                            '" . $data['epobject_type']."',
143
+                            '" . $timestamp."');");
144 144
 
145 145
             // If that didn't work we can't go any further...
146 146
             if (!$q->success()) {
@@ -159,14 +159,14 @@  discard block
 block discarded – undo
159 159
                     $q = $this->db->query("INSERT INTO glossary
160 160
                                     (epobject_id, type, visible)
161 161
                                     VALUES
162
-                                    ('" . $q->insert_id() . "',
162
+                                    ('" . $q->insert_id()."',
163 163
                                     '2',
164 164
                                     '1');");
165 165
                     // Again, no point carrying on if this fails,
166 166
                     // so remove the previous entry
167 167
                     if (!$q->success()) {
168 168
                         print "glossary trouble!";
169
-                        $q = $this->db->query("delete from epobject where epobject_id=" . $previous_insert_id . "");
169
+                        $q = $this->db->query("delete from epobject where epobject_id=".$previous_insert_id."");
170 170
                         return false;
171 171
                     }
172 172
                     break;
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
             // the new epobject id and approval details.
179 179
             $q = $this->db->query("UPDATE editqueue
180 180
                             SET
181
-                            epobject_id_l='" .  $this->current_epobject_id. "',
182
-                            editor_id='" . addslashes($THEUSER->user_id()) . "',
181
+                            epobject_id_l='" .  $this->current_epobject_id."',
182
+                            editor_id='" . addslashes($THEUSER->user_id())."',
183 183
                             approved='1',
184
-                            decided='" . $timestamp . "'
185
-                            WHERE edit_id=" . $approval_id . ";");
184
+                            decided='" . $timestamp."'
185
+                            WHERE edit_id=" . $approval_id.";");
186 186
             if (!$q->success()) {
187 187
                 break;
188 188
             }
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
             // Update the editqueue with setting approved=0
222 222
             $q = $this->db->query("UPDATE editqueue
223 223
                             SET
224
-                            editor_id='" . addslashes($THEUSER->user_id()) . "',
224
+                            editor_id='" . addslashes($THEUSER->user_id())."',
225 225
                             approved='0',
226
-                            decided='" . $timestamp . "'
227
-                            WHERE edit_id=" . $decline_id . ";");
226
+                            decided='" . $timestamp."'
227
+                            WHERE edit_id=" . $decline_id.";");
228 228
             if (!$q->success()) {
229 229
                 break;
230 230
             }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         $q = $this->db->query("SELECT eq.edit_id, eq.user_id, u.firstname, u.lastname, eq.glossary_id, eq.title, eq.body, eq.submitted FROM editqueue AS eq, users AS u WHERE eq.user_id = u.user_id AND eq.approved IS NULL ORDER BY eq.submitted DESC;");
261 261
         if ($q->success() && $q->rows()) {
262 262
             for ($i = 0; $i < ($q->rows()); $i++) {
263
-                $this->pending[ $q->field($i,"edit_id") ] = $q->row($i);
263
+                $this->pending[$q->field($i, "edit_id")] = $q->row($i);
264 264
             }
265 265
 
266 266
             $this->update_pending_count();
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -185,8 +185,7 @@  discard block
 block discarded – undo
185 185
                             WHERE edit_id=" . $approval_id . ";");
186 186
             if (!$q->success()) {
187 187
                 break;
188
-            }
189
-            else {
188
+            } else {
190 189
                 // Now send them an email telling them they've been approved
191 190
 
192 191
 
@@ -227,8 +226,7 @@  discard block
 block discarded – undo
227 226
                             WHERE edit_id=" . $decline_id . ";");
228 227
             if (!$q->success()) {
229 228
                 break;
230
-            }
231
-            else {
229
+            } else {
232 230
                 // Scrub that one from the list of pending items
233 231
                 unset ($this->pending[$decline_id]);
234 232
             }
@@ -266,8 +264,7 @@  discard block
 block discarded – undo
266 264
             $this->update_pending_count();
267 265
 
268 266
             return true;
269
-        }
270
-        else {
267
+        } else {
271 268
             return false;
272 269
         }
273 270
     }
Please login to merge, or discard this patch.
classes/GlossaryEditQueue.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
             $q = $this->db->query("INSERT INTO glossary
45 45
                             (title, body, type, created, visible)
46 46
                             VALUES
47
-                            ('" . addslashes($this->pending[$approval_id]['title']) . "',
48
-                            '" . addslashes($this->pending[$approval_id]['body']) . "',
49
-                            '" . $data['epobject_type'] . "',
50
-                            '" . $timestamp . "',
47
+                            ('" . addslashes($this->pending[$approval_id]['title'])."',
48
+                            '" . addslashes($this->pending[$approval_id]['body'])."',
49
+                            '" . $data['epobject_type']."',
50
+                            '" . $timestamp."',
51 51
                             1);");
52 52
 
53 53
             // If that didn't work we can't go any further...
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
             // the new epobject id and approval details.
62 62
             $q = $this->db->query("UPDATE editqueue
63 63
                             SET
64
-                            glossary_id='" .  $this->current_epobject_id. "',
65
-                            editor_id='" . addslashes($THEUSER->user_id()) . "',
64
+                            glossary_id='" .  $this->current_epobject_id."',
65
+                            editor_id='" . addslashes($THEUSER->user_id())."',
66 66
                             approved='1',
67
-                            decided='" . $timestamp . "'
68
-                            WHERE edit_id=" . $approval_id . ";");
67
+                            decided='" . $timestamp."'
68
+                            WHERE edit_id=" . $approval_id.";");
69 69
             if (!$q->success()) {
70 70
                 break;
71 71
             }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,8 +68,7 @@
 block discarded – undo
68 68
                             WHERE edit_id=" . $approval_id . ";");
69 69
             if (!$q->success()) {
70 70
                 break;
71
-            }
72
-            else {
71
+            } else {
73 72
                 // Scrub that one from the list of pending items
74 73
                 unset ($this->pending[$approval_id]);
75 74
             }
Please login to merge, or discard this patch.
classes/Url.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@
 block discarded – undo
114 114
     /**
115 115
      * Remove Session Key/Value Pair
116 116
      *
117
-     * @param array $arr A list array of key names to remove
117
+     * @param string[] $arr A list array of key names to remove
118 118
      */
119 119
 
120 120
     public function remove($arr) {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
         // These stores an associative array of key/value pairs that
44 44
         // we'll want passed on to other pages.
45
-        $this->session_vars = array ();
45
+        $this->session_vars = array();
46 46
 
47 47
         // Prevent things using $DATA running if it hasn't been set, ie in testing
48 48
         if (isset($DATA)) {
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
     public function reset() {
95 95
         // Call this to remove all the session_vars.
96
-        $this->session_vars = array ();
96
+        $this->session_vars = array();
97 97
     }
98 98
 
99 99
     /**
@@ -162,30 +162,30 @@  discard block
 block discarded – undo
162 162
      *                            override just one or two of them.
163 163
      */
164 164
 
165
-    public function generate($encode = "html", $overrideVars=array()) {
165
+    public function generate($encode = "html", $overrideVars = array()) {
166 166
 
167 167
         global $DATA;
168 168
 
169
-        $url_args = array ();
169
+        $url_args = array();
170 170
 
171 171
         foreach (array_merge($this->session_vars, $overrideVars) as $key => $var) {
172 172
             if (is_array($var)) {
173 173
                 foreach ($var as $v) {
174
-                    $url_args[] = "$key=" . urlencode(stripslashes($v));
174
+                    $url_args[] = "$key=".urlencode(stripslashes($v));
175 175
                 }
176 176
             } elseif ($var != null)
177
-                $url_args[] = "$key=" . urlencode(stripslashes($var));
177
+                $url_args[] = "$key=".urlencode(stripslashes($var));
178 178
         }
179 179
 
180
-        $page_url = WEBPATH . $DATA->page_metadata($this->destinationpage, "url");
180
+        $page_url = WEBPATH.$DATA->page_metadata($this->destinationpage, "url");
181 181
 
182 182
         if (sizeof($url_args) == 0) {
183 183
             return $page_url;
184 184
         } else {
185 185
             if ($encode == "html") {
186
-                return $page_url . "?" . implode("&amp;", $url_args);
186
+                return $page_url."?".implode("&amp;", $url_args);
187 187
             } elseif ($encode == "none" || $encode == "url") {
188
-                return $page_url . "?" . implode("&", $url_args);
188
+                return $page_url."?".implode("&", $url_args);
189 189
             }
190 190
         }
191 191
     }
Please login to merge, or discard this patch.