Failed Conditions
Pull Request — master (#1327)
by Nick
69:15 queued 59:17
created
www/includes/easyparliament/sidebars/minisurvey.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 if ($hide_question) {
34 34
     $always_ask = 0;
35 35
     $show_survey_qn = $current_question;
36
-    setcookie('survey', $current_question, time()+60*60*24*365, '/');
36
+    setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/');
37 37
 } elseif ($has_answered_question == $current_question && !$always_ask) {
38 38
     $show_survey_qn = $current_question;
39
-    setcookie('survey', $current_question, time()+60*60*24*365, '/');
39
+    setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/');
40 40
 } elseif (isset($_COOKIE['survey'])) {
41 41
     $show_survey_qn = $_COOKIE['survey'];
42 42
 }
@@ -49,16 +49,16 @@  discard block
 block discarded – undo
49 49
 if ($show_survey_qn < $current_question && !$has_answered_question) {
50 50
     $page_url = '';
51 51
     $hide_url = '';
52
-    if ( in_array( $this_page, array('mp', 'peer', 'msp', 'mla', 'royal') ) ) {
52
+    if (in_array($this_page, array('mp', 'peer', 'msp', 'mla', 'royal'))) {
53 53
         global $MEMBER;
54 54
         $page_url = $MEMBER->url(true) . "?answered_survey=$current_question";
55 55
         $hide_url = $MEMBER->url() . "?hide_survey=$current_question";
56 56
     } else {
57 57
         $URL = new \MySociety\TheyWorkForYou\Url($this_page);
58
-        $URL->insert(array('answered_survey' => $current_question ));
58
+        $URL->insert(array('answered_survey' => $current_question));
59 59
         $page_url = 'https://' . DOMAIN . $URL->generate();
60 60
         $URL = new \MySociety\TheyWorkForYou\Url($this_page);
61
-        $URL->insert(array('hide_survey' => $current_question ));
61
+        $URL->insert(array('hide_survey' => $current_question));
62 62
         $hide_url = $URL->generate();
63 63
     }
64 64
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,10 +34,12 @@  discard block
 block discarded – undo
34 34
     $always_ask = 0;
35 35
     $show_survey_qn = $current_question;
36 36
     setcookie('survey', $current_question, time()+60*60*24*365, '/');
37
-} elseif ($has_answered_question == $current_question && !$always_ask) {
37
+}
38
+elseif ($has_answered_question == $current_question && !$always_ask) {
38 39
     $show_survey_qn = $current_question;
39 40
     setcookie('survey', $current_question, time()+60*60*24*365, '/');
40
-} elseif (isset($_COOKIE['survey'])) {
41
+}
42
+elseif (isset($_COOKIE['survey'])) {
41 43
     $show_survey_qn = $_COOKIE['survey'];
42 44
 }
43 45
 
@@ -53,7 +55,8 @@  discard block
 block discarded – undo
53 55
         global $MEMBER;
54 56
         $page_url = $MEMBER->url(true) . "?answered_survey=$current_question";
55 57
         $hide_url = $MEMBER->url() . "?hide_survey=$current_question";
56
-    } else {
58
+    }
59
+    else {
57 60
         $URL = new \MySociety\TheyWorkForYou\Url($this_page);
58 61
         $URL->insert(array('answered_survey' => $current_question ));
59 62
         $page_url = 'https://' . DOMAIN . $URL->generate();
@@ -105,7 +108,8 @@  discard block
 block discarded – undo
105 108
 
106 109
 <?php
107 110
     $this->block_end();
108
-} elseif ($has_answered_question) {
111
+}
112
+elseif ($has_answered_question) {
109 113
     $this->block_start(array('id'=>'survey', 'title'=>"Mini survey"));
110 114
 ?>
111 115
     Thanks for answering.
Please login to merge, or discard this patch.
www/docs/admin/badusers.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 include_once '../../includes/easyparliament/init.php';
4
-include_once (INCLUDESPATH."easyparliament/commentreportlist.php");
4
+include_once (INCLUDESPATH . "easyparliament/commentreportlist.php");
5 5
 
6 6
 $this_page = "admin_badusers";
7 7
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 $rows = array();
33 33
 $USERURL = new \MySociety\TheyWorkForYou\Url('userview');
34 34
 
35
-for ($row=0; $row<$q->rows(); $row++) {
35
+for ($row = 0; $row < $q->rows(); $row++) {
36 36
 
37 37
     $user_id = $q->field($row, 'user_id');
38 38
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
     $totalcomments = $r->field(0, 'totalcount');
45 45
 
46
-    $percentagedeleted = ( $q->field($row, 'deletedcount') / $totalcomments ) * 100;
46
+    $percentagedeleted = ($q->field($row, 'deletedcount') / $totalcomments) * 100;
47 47
 
48 48
 
49 49
     // Get complaints made about this user's comments, but not upheld.
@@ -59,17 +59,17 @@  discard block
 block discarded – undo
59 59
 
60 60
     $USERURL->insert(array('u'=>$user_id));
61 61
 
62
-    $rows[] = array (
62
+    $rows[] = array(
63 63
         '<a href="' . $USERURL->generate() . '">' . $q->field($row, 'firstname') . ' ' . $q->field($row, 'lastname') . '</a>',
64 64
         $totalcomments,
65 65
         $q->field($row, 'deletedcount'),
66
-        $percentagedeleted.'%',
66
+        $percentagedeleted . '%',
67 67
         $notupheldcount
68 68
     );
69 69
 }
70 70
 
71
-$tabledata = array (
72
-    'header' => array (
71
+$tabledata = array(
72
+    'header' => array(
73 73
         'Name',
74 74
         'Total comments',
75 75
         'Number deleted',
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 $rows = array();
106 106
 $USERURL = new \MySociety\TheyWorkForYou\Url('userview');
107 107
 
108
-for ($row=0; $row<$q->rows(); $row++) {
108
+for ($row = 0; $row < $q->rows(); $row++) {
109 109
 
110 110
     $user_id = $q->field($row, 'user_id');
111 111
 
@@ -117,15 +117,15 @@  discard block
 block discarded – undo
117 117
                     WHERE	user_id = '$user_id'
118 118
                     AND		upheld = '1'");
119 119
 
120
-    $rows[] = array (
120
+    $rows[] = array(
121 121
         '<a href="' . $USERURL->generate() . '">' . $q->field($row, 'firstname') . ' ' . $q->field($row, 'lastname') . '</a>',
122 122
         $q->field($row, 'rejectedcount'),
123 123
         $r->field(0, 'upheldcount')
124 124
     );
125 125
 
126 126
 }
127
-$tabledata = array (
128
-    'header' => array (
127
+$tabledata = array(
128
+    'header' => array(
129 129
         'Name',
130 130
         'Reports not upheld',
131 131
         'Reports upheld'
Please login to merge, or discard this patch.
www/docs/user/prompt/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 $anchor = '#addcomment';
21 21
 
22 22
 $URL = new \MySociety\TheyWorkForYou\Url('userjoin');
23
-$URL->insert(array('ret'=>$returl.$anchor));
23
+$URL->insert(array('ret'=>$returl . $anchor));
24 24
 $joinurl = $URL->generate();
25 25
 
26 26
 
Please login to merge, or discard this patch.
www/docs/index-election.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 $HANSARDURL = new \MySociety\TheyWorkForYou\Url('hansard');
73 73
 $MPURL = new \MySociety\TheyWorkForYou\Url('yourmp');
74 74
 
75
-$PAGE->block_start(array ('id'=>'intro', 'title'=>'Election special! Find out how they performed for YOU:'));
75
+$PAGE->block_start(array('id'=>'intro', 'title'=>'Election special! Find out how they performed for YOU:'));
76 76
 ?>
77 77
                         <ol>
78 78
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     } else {
90 90
         $CHANGEURL = new \MySociety\TheyWorkForYou\Url('userchangepc');
91 91
     }
92
-    $MEMBER = new MEMBER(array ('postcode'=>$THEUSER->postcode(), 'house'=>1));
92
+    $MEMBER = new MEMBER(array('postcode'=>$THEUSER->postcode(), 'house'=>1));
93 93
     $mpname = $MEMBER->full_name();
94 94
     ?>
95 95
       <p><a href="<?php echo $MPURL->generate(); ?>"><strong>Find out more about how <?php echo $mpname; ?>, your ex-MP, represented you over the last parliament</strong></a><br>
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 //$PAGE->block_end();
186 186
 
187 187
 $PAGE->stripe_end(array(
188
-    array (
188
+    array(
189 189
         'type' => 'include',
190 190
         'content' => 'whatisthissite'
191 191
     ),
192
-    array (
192
+    array(
193 193
         'type' => 'include',
194 194
         'content' => 'sitenews_recent'
195 195
     )
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,17 +43,20 @@  discard block
 block discarded – undo
43 43
         if ($todaystime - $debatesdata['timestamp'] == 86400) {
44 44
             $daytext = "yesterday's";
45 45
 
46
-        } elseif ($todaystime - $debatesdata['timestamp'] <= (6 * 86400)) {
46
+        }
47
+        elseif ($todaystime - $debatesdata['timestamp'] <= (6 * 86400)) {
47 48
             // Less than a week ago, so like "last Tuesday's".
48 49
             $daytext = gmdate('l', $debatesdata['timestamp']) . "'s";
49 50
 
50
-        } else {
51
+        }
52
+        else {
51 53
 
52 54
             // Over a week ago.
53 55
             $daytext = "the most recent ";
54 56
         }
55 57
 
56
-    } else {
58
+    }
59
+    else {
57 60
         // Debates and Wrans are from different dates. We'll just do this for now:
58 61
         $daytext = "the most recent ";
59 62
     }
@@ -61,7 +64,8 @@  discard block
 block discarded – undo
61 64
 #	$hansardline = "Comment on $daytext <ul><li>$debatestext</li><li>$wranstext</li><li>$whalltext</li><li>$wmstext</li></ul>";
62 65
     $hansardline = "Comment on $daytext $debatestext, $wranstext, $whalltext, and $wmstext";
63 66
 
64
-} else {
67
+}
68
+else {
65 69
     // We didn't get some or all of the data, so just...
66 70
     $hansardline = "Comment on events in parliament";
67 71
 }
@@ -86,7 +90,8 @@  discard block
 block discarded – undo
86 90
 
87 91
     if ($THEUSER->isloggedin()) {
88 92
         $CHANGEURL = new \MySociety\TheyWorkForYou\Url('useredit');
89
-    } else {
93
+    }
94
+    else {
90 95
         $CHANGEURL = new \MySociety\TheyWorkForYou\Url('userchangepc');
91 96
     }
92 97
     $MEMBER = new MEMBER(array ('postcode'=>$THEUSER->postcode(), 'house'=>1));
@@ -96,7 +101,8 @@  discard block
 block discarded – undo
96 101
                         In <?php echo strtoupper(_htmlentities($THEUSER->postcode())); ?> (<a href="<?php echo $CHANGEURL->generate(); ?>">Change your postcode</a>)</p>
97 102
 <?php
98 103
 
99
-} else {
104
+}
105
+else {
100 106
     // User is not logged in and doesn't have a personal postcode set.
101 107
     ?>
102 108
                         <form action="<?php echo $MPURL->generate(); ?>" method="get">
Please login to merge, or discard this patch.
classes/MiniSurvey.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,10 +26,12 @@  discard block
 block discarded – undo
26 26
             $always_ask = 0;
27 27
             $show_survey_qn = $current_question;
28 28
             setcookie('survey', $current_question, time()+60*60*24*365, '/');
29
-        } elseif ($has_answered_question == $current_question && !$always_ask) {
29
+        }
30
+        elseif ($has_answered_question == $current_question && !$always_ask) {
30 31
             $show_survey_qn = $current_question;
31 32
             setcookie('survey', $current_question, time()+60*60*24*365, '/');
32
-        } elseif (isset($_COOKIE['survey'])) {
33
+        }
34
+        elseif (isset($_COOKIE['survey'])) {
33 35
             $show_survey_qn = $_COOKIE['survey'];
34 36
         }
35 37
 
@@ -44,7 +46,8 @@  discard block
 block discarded – undo
44 46
                     $page_url = $MEMBER->url(true) . "?answered_survey=$current_question";
45 47
                     $hide_url = $MEMBER->url() . "?hide_survey=$current_question";
46 48
                 }
47
-            } else {
49
+            }
50
+            else {
48 51
                 $URL = new Url($this_page);
49 52
                 $URL->insert(array('answered_survey' => $current_question ));
50 53
                 $page_url = 'https://' . DOMAIN . $URL->generate();
Please login to merge, or discard this patch.
classes/Renderer/User.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $edittext   = $menudata['text'];
50 50
         $edittitle  = $menudata['title'];
51 51
         $EDITURL    = new \MySociety\TheyWorkForYou\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
 block discarded – undo
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 \MySociety\TheyWorkForYou\Url('userlogout');
64 64
         if ($this->page != 'userlogout') {
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -38,7 +38,8 @@  discard block
 block discarded – undo
38 38
         //user logged in
39 39
         if ($this->user->isloggedin()) {
40 40
             $this->addLoggedInLinks();
41
-        } else {
41
+        }
42
+        else {
42 43
             $this->addLoggedOutLinks();
43 44
         }
44 45
     }
@@ -51,7 +52,8 @@  discard block
 block discarded – undo
51 52
         $EDITURL    = new \MySociety\TheyWorkForYou\Url('userviewself');
52 53
         if ($this->page == 'userviewself' || $this->page == 'useredit' ) {
53 54
             $editclass = 'on';
54
-        } else {
55
+        }
56
+        else {
55 57
             $editclass = '';
56 58
         }
57 59
 
@@ -64,7 +66,8 @@  discard block
 block discarded – undo
64 66
         if ($this->page != 'userlogout') {
65 67
             $LOGOUTURL->insert(array("ret"=>$this->returl));
66 68
             $logoutclass = '';
67
-        } else {
69
+        }
70
+        else {
68 71
             $logoutclass = 'on';
69 72
         }
70 73
 
@@ -105,7 +108,8 @@  discard block
 block discarded – undo
105 108
                 $JOINURL->insert(array("ret"=>$this->returl));
106 109
             }
107 110
             $joinclass = '';
108
-        } else {
111
+        }
112
+        else {
109 113
             $joinclass = 'on';
110 114
         }
111 115
 
@@ -127,7 +131,8 @@  discard block
 block discarded – undo
127 131
                 $LOGINURL->insert(array("ret"=>$this->returl));
128 132
             }
129 133
             $loginclass = '';
130
-        } else {
134
+        }
135
+        else {
131 136
             $loginclass = 'on';
132 137
         }
133 138
 
@@ -153,7 +158,8 @@  discard block
 block discarded – undo
153 158
             $items = array('yourmp');
154 159
             if (\MySociety\TheyWorkForYou\Utility\Postcode::postcodeIsScottish($this->user->postcode())) {
155 160
                 $items[] = 'yourmsp';
156
-            } elseif (\MySociety\TheyWorkForYou\Utility\Postcode::postcodeIsNi($this->user->postcode())) {
161
+            }
162
+            elseif (\MySociety\TheyWorkForYou\Utility\Postcode::postcodeIsNi($this->user->postcode())) {
157 163
                 $items[] = 'yourmla';
158 164
             }
159 165
 
Please login to merge, or discard this patch.