Failed Conditions
Pull Request — master (#1327)
by Nick
69:15 queued 59:17
created
www/docs/freeourbills/sharethis.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 ";
39 39
     $subject = "Help make the laws we have to obey better! - TheyWorkForYou.com";
40 40
 
41
-    print '<a href="mailto:?subject=' . rawurlencode($subject) . '&body='. rawurlencode($email) . '">Click here to open a new email and invite your friends, family and colleagues to get involved.</a>';
41
+    print '<a href="mailto:?subject=' . rawurlencode($subject) . '&body=' . rawurlencode($email) . '">Click here to open a new email and invite your friends, family and colleagues to get involved.</a>';
42 42
 }
43 43
 
44 44
 function freeourbills_share_page() {
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     print '<p><a href="/freeourbills/doshare"';
59 59
     #print 'onclick="share(this); return false;"';
60 60
     print ' title="' .
61
-        _('E-mail this, post to del.icio.us, etc.'). '" class="share_link" rel="nofollow">'.
62
-        _('Share this'). '</a></p>';
61
+        _('E-mail this, post to del.icio.us, etc.') . '" class="share_link" rel="nofollow">' .
62
+        _('Share this') . '</a></p>';
63 63
     #freeourbills_share_form();
64 64
 }
Please login to merge, or discard this patch.
www/docs/user/password/index.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 
91 91
 
92 92
 
93
-function display_page ($errors=array()) {
93
+function display_page($errors = array()) {
94 94
     global $this_page, $PAGE;
95 95
 
96 96
     if (isset($errors["sending"])) {
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -31,9 +31,11 @@  discard block
 block discarded – undo
31 31
 
32 32
     if ($email == "") {
33 33
         $errors["email"] = "Please enter your email address";
34
-    } elseif (!validate_email($email)) {
34
+    }
35
+    elseif (!validate_email($email)) {
35 36
         $errors["email"] = "Please enter a valid email address";
36
-    } else {
37
+    }
38
+    else {
37 39
 
38 40
         $USER = new USER;
39 41
         $emailexists = $USER->email_exists($email);
@@ -47,7 +49,8 @@  discard block
 block discarded – undo
47 49
         // Validation errors. Print form again.
48 50
         display_page($errors);
49 51
 
50
-    } else {
52
+    }
53
+    else {
51 54
 
52 55
         // Change the user's password!
53 56
 
@@ -63,7 +66,8 @@  discard block
 block discarded – undo
63 66
 
64 67
                 print "<p>A new password has been sent to " . _htmlentities($email) . "</p>\n";
65 68
 
66
-            } else {
69
+            }
70
+            else {
67 71
 
68 72
                 $errors["sending"] = "Sorry, there was a technical problem sending the email.";
69 73
 
@@ -71,7 +75,8 @@  discard block
 block discarded – undo
71 75
 
72 76
             }
73 77
 
74
-        } else {
78
+        }
79
+        else {
75 80
             // This email address isn't in the DB.
76 81
 
77 82
             $errors["passwordchange"] = "Sorry, there was a problem and we couldn't set a new password for " . _htmlentities($email);
@@ -83,7 +88,8 @@  discard block
 block discarded – undo
83 88
 
84 89
     }
85 90
 
86
-} else {
91
+}
92
+else {
87 93
 
88 94
     display_page();
89 95
 }
@@ -95,7 +101,8 @@  discard block
 block discarded – undo
95 101
 
96 102
     if (isset($errors["sending"])) {
97 103
         $PAGE->error_message($errors["sending"]);
98
-    } else {
104
+    }
105
+    else {
99 106
         print "<p>If you can't remember your password we can send you a new one.</p>\n<p>If you would like a new password, enter your address below.</p>\n";
100 107
     }
101 108
 ?>
Please login to merge, or discard this patch.
www/docs/user/confirm/index.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         }
69 69
 
70 70
         $PAGE->stripe_end(array(
71
-            array (
71
+            array(
72 72
                 'type'		=> 'include',
73 73
                 'content'	=> 'userconfirmed'
74 74
             )
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
     // The user's first visit to this page, and they have a registration token.
81 81
     // So let's confirm them and hope they get logged in...
82 82
 
83
-    if (get_http_var('c') == 'email' ) {
84
-        $success = $THEUSER->confirm_email( get_http_var('t') );
83
+    if (get_http_var('c') == 'email') {
84
+        $success = $THEUSER->confirm_email(get_http_var('t'));
85 85
     } else {
86
-        $success = $THEUSER->confirm( get_http_var('t') );
86
+        $success = $THEUSER->confirm(get_http_var('t'));
87 87
     }
88 88
 
89 89
     if (!$success) {
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
     $this_page = 'userconfirmfailed';
104 104
 
105
-    if ( !$PAGE->page_started() ) {
105
+    if (!$PAGE->page_started()) {
106 106
         $PAGE->page_start();
107 107
 
108 108
         $PAGE->stripe_start();
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -36,7 +36,8 @@  discard block
 block discarded – undo
36 36
     <p>Do <a href="mailto:<?php echo str_replace('@', '&#64;', CONTACTEMAIL); ?>">let us know</a> if you find a bug, or have a suggestion.</p>
37 37
 
38 38
 <?php
39
-        } else {
39
+        }
40
+        else {
40 41
             // Oops, something must have gone wrong when the user was logged in.
41 42
             // It shouldn't do, but...
42 43
             $PAGE->error_message("Sorry, we couldn't log you in - TheyWorkForYou requires cookies to keep
@@ -46,7 +47,8 @@  discard block
 block discarded – undo
46 47
         $PAGE->page_end();
47 48
 
48 49
 
49
-} elseif (get_http_var('email') == 't') {
50
+}
51
+elseif (get_http_var('email') == 't') {
50 52
         $this_page = 'emailconfirmed';
51 53
 
52 54
         $PAGE->page_start();
@@ -60,7 +62,8 @@  discard block
 block discarded – undo
60 62
     <p>Do <a href="mailto:<?php echo str_replace('@', '&#64;', CONTACTEMAIL); ?>">let us know</a> if you find a bug, or have a suggestion.</p>
61 63
 
62 64
 <?php
63
-        } else {
65
+        }
66
+        else {
64 67
             // Oops, something must have gone wrong when the user was logged in.
65 68
             // It shouldn't do, but...
66 69
             $PAGE->error_message("Sorry, we couldn't log you in - TheyWorkForYou requires cookies to keep
@@ -76,20 +79,23 @@  discard block
 block discarded – undo
76 79
 
77 80
         $PAGE->page_end();
78 81
 
79
-} elseif (get_http_var('t') != '') {
82
+}
83
+elseif (get_http_var('t') != '') {
80 84
     // The user's first visit to this page, and they have a registration token.
81 85
     // So let's confirm them and hope they get logged in...
82 86
 
83 87
     if (get_http_var('c') == 'email' ) {
84 88
         $success = $THEUSER->confirm_email( get_http_var('t') );
85
-    } else {
89
+    }
90
+    else {
86 91
         $success = $THEUSER->confirm( get_http_var('t') );
87 92
     }
88 93
 
89 94
     if (!$success) {
90 95
         confirm_error();
91 96
     }
92
-} else {
97
+}
98
+else {
93 99
     // We have no registration token, and no notification of welcome...
94 100
 
95 101
     confirm_error();
@@ -112,7 +118,8 @@  discard block
 block discarded – undo
112 118
     <p>The link you followed to reach this page appears to be incomplete.</p>
113 119
 
114 120
 <?php
115
-    } else {
121
+    }
122
+    else {
116 123
         $PAGE->stripe_start();
117 124
     }
118 125
 ?>
Please login to merge, or discard this patch.
www/docs/404.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 <?php
33 33
 
34 34
 $includes = array(
35
-    array (
35
+    array(
36 36
         'type' => 'include',
37 37
         'content' => 'whatisthissite'
38 38
     ),
Please login to merge, or discard this patch.
www/docs/random/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 $q = $db->query("select gid from hansard where htype in (10,11) and major=1 and hdate='$date' order by rand() limit 1");
15 15
 $gid = $q->field(0, 'gid');
16 16
 
17
-$args = array (
17
+$args = array(
18 18
     'gid' => fix_gid_from_db($gid),
19 19
     'sort' => 'regexp_replace',
20 20
 );
Please login to merge, or discard this patch.
www/docs/email/index.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,15 +45,15 @@  discard block
 block discarded – undo
45 45
 <?php
46 46
 } else {
47 47
     $rep_name = $MEMBER->full_name();
48
-    if ($MEMBER->house_disp==1) $rep_name .= ' MP';
49
-    elseif ($MEMBER->house_disp==3) $rep_name .= ' MLA';
50
-    $data = array (
48
+    if ($MEMBER->house_disp == 1) $rep_name .= ' MP';
49
+    elseif ($MEMBER->house_disp == 3) $rep_name .= ' MLA';
50
+    $data = array(
51 51
         'template'      => 'email_a_friend',
52 52
         'to'            => $recipient_email,
53 53
         'subject'       => 'Find out all about ' . $rep_name
54 54
     );
55 55
     $url = $MEMBER->url(true);
56
-    $merge = array (
56
+    $merge = array(
57 57
         'NAME' => $sender_name,
58 58
         'EMAIL' => $sender_email,
59 59
         'REP_NAME' => $rep_name,
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
     $success = send_template_email($data, $merge);
64 64
     if ($success) {
65
-        print "<p>Your email has been sent successfully. Thank you for using TheyWorkForYou.</p> <p><a href=\"$url\">Return to ".$MEMBER->full_name()."'s page</a></p>";
65
+        print "<p>Your email has been sent successfully. Thank you for using TheyWorkForYou.</p> <p><a href=\"$url\">Return to " . $MEMBER->full_name() . "'s page</a></p>";
66 66
     } else {
67 67
         print "<p>Sorry, something went wrong trying to send an email. Please wait a few minutes and try again.</p>";
68 68
     }
Please login to merge, or discard this patch.
Braces   +20 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,20 +14,25 @@  discard block
 block discarded – undo
14 14
 $sender_email = get_http_var('sender_mail');
15 15
 $sender_name = get_http_var('sender_name');
16 16
 $pid = intval(get_http_var('pid'));
17
-if ($pid)
17
+if ($pid) {
18 18
     $MEMBER = new MEMBER(array('person_id' => $pid));
19
+}
19 20
 
20 21
 //validate them
21 22
 $errors = array();
22 23
 
23
-if (!$pid)
24
+if (!$pid) {
24 25
     $errors[] = 'You did not get to this page from an MP or Peer page. Please go back and try again.';
25
-if (!preg_match('#^[^@]+@#', $recipient_email))
26
+}
27
+if (!preg_match('#^[^@]+@#', $recipient_email)) {
26 28
     $errors[] = "'$recipient_email' is not a valid recipient email address. Please have another go.";
27
-if (!validate_email($sender_email))
29
+}
30
+if (!validate_email($sender_email)) {
28 31
     $errors[] = "'$sender_email' is not a valid sender email address. Please have another go.";
29
-if (!$sender_name)
32
+}
33
+if (!$sender_name) {
30 34
     $errors[] = "If you don't give us your name, we can't tell the recipient who sent them the link. We won't store it or use for any other purpose than sending this email.";
35
+}
31 36
 
32 37
 if (sizeof($errors)) {
33 38
     print '<p>Please correct the following errors:</p>';
@@ -43,10 +48,15 @@  discard block
 block discarded – undo
43 48
 <input type="submit" class="submit" value="Send"></p>
44 49
 </form>
45 50
 <?php
46
-} else {
51
+}
52
+else {
47 53
     $rep_name = $MEMBER->full_name();
48
-    if ($MEMBER->house_disp==1) $rep_name .= ' MP';
49
-    elseif ($MEMBER->house_disp==3) $rep_name .= ' MLA';
54
+    if ($MEMBER->house_disp==1) {
55
+        $rep_name .= ' MP';
56
+    }
57
+    elseif ($MEMBER->house_disp==3) {
58
+        $rep_name .= ' MLA';
59
+    }
50 60
     $data = array (
51 61
         'template'      => 'email_a_friend',
52 62
         'to'            => $recipient_email,
@@ -63,7 +73,8 @@  discard block
 block discarded – undo
63 73
     $success = send_template_email($data, $merge);
64 74
     if ($success) {
65 75
         print "<p>Your email has been sent successfully. Thank you for using TheyWorkForYou.</p> <p><a href=\"$url\">Return to ".$MEMBER->full_name()."'s page</a></p>";
66
-    } else {
76
+    }
77
+    else {
67 78
         print "<p>Sorry, something went wrong trying to send an email. Please wait a few minutes and try again.</p>";
68 79
     }
69 80
 }
Please login to merge, or discard this patch.
www/docs/vote/index.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         voteerror("Your browser must be able to accept cookies before you can register a vote.");
32 32
     } else {
33 33
         // Delete the test cookie.
34
-        setcookie ('testcookie', '');
34
+        setcookie('testcookie', '');
35 35
     }
36 36
     // On with the voting...!
37 37
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     // We need to check the user can accept cookies, so...
41 41
 
42 42
     // Set a cookie
43
-    setcookie ('testcookie', 'true');
43
+    setcookie('testcookie', 'true');
44 44
 
45 45
     $ret = get_http_var('ret');
46 46
     $id = get_http_var('id');
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
     $PAGE->page_start();
69 69
 
70
-    $message = array (
70
+    $message = array(
71 71
         'title'	=> 'Sorry',
72 72
         'text'	=> $text
73 73
     );
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         $prev_epvotes[] = $epobject_id;
159 159
         $new_cookie = implode('+', $prev_epvotes);
160 160
 
161
-        setcookie ("epvotes", $new_cookie, time()+60*60*24*365, "/", COOKIEDOMAIN);
161
+        setcookie("epvotes", $new_cookie, time() + 60 * 60 * 24 * 365, "/", COOKIEDOMAIN);
162 162
 
163 163
 
164 164
     } else {
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 
190 190
 $PAGE->page_start();
191 191
 
192
-$message = array (
192
+$message = array(
193 193
     'title'	=> "Thanks for your vote",
194 194
     'text'	=> "<strong>Would you like to ask a question like this yourself?</strong> Use our <a href=\"http://www.whatdotheyknow.com\">Freedom of Information site</a>."
195 195
 );
Please login to merge, or discard this patch.
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,14 +29,16 @@  discard block
 block discarded – undo
29 29
 
30 30
     if ($testcookie != true) {
31 31
         voteerror("Your browser must be able to accept cookies before you can register a vote.");
32
-    } else {
32
+    }
33
+    else {
33 34
         // Delete the test cookie.
34 35
         setcookie ('testcookie', '');
35 36
     }
36 37
     // On with the voting...!
37 38
 
38 39
 
39
-} else {
40
+}
41
+else {
40 42
     // We need to check the user can accept cookies, so...
41 43
 
42 44
     // Set a cookie
@@ -121,7 +123,8 @@  discard block
 block discarded – undo
121 123
             // We're not checking the validity of the contents of $votecookie,
122 124
             // just doing it.
123 125
             $prev_epvotes = explode('+', $votecookie);
124
-        } else {
126
+        }
127
+        else {
125 128
             $prev_epvotes = array();
126 129
         }
127 130
 
@@ -135,13 +138,16 @@  discard block
 block discarded – undo
135 138
         if ($q->rows() == 1) {
136 139
             if ($vote == 1) {
137 140
                 $q = $db->query("UPDATE anonvotes SET yes_votes = yes_votes + 1 WHERE epobject_id=:epobject_id", array(':epobject_id' => $epobject_id));
138
-            } else {
141
+            }
142
+            else {
139 143
                 $q = $db->query("UPDATE anonvotes SET no_votes = no_votes + 1 WHERE epobject_id=:epobject_id", array(':epobject_id' => $epobject_id));
140 144
             }
141
-        } else {
145
+        }
146
+        else {
142 147
             if ($vote == 1) {
143 148
                 $q = $db->query("INSERT INTO anonvotes (epobject_id, yes_votes) VALUES (:epobject_id, '1')", array(':epobject_id' => $epobject_id));
144
-            } else {
149
+            }
150
+            else {
145 151
                 $q = $db->query("INSERT INTO anonvotes (epobject_id, no_votes) VALUES (:epobject_id, '1')", array(':epobject_id' => $epobject_id));
146 152
             }
147 153
         }
@@ -161,7 +167,8 @@  discard block
 block discarded – undo
161 167
         setcookie ("epvotes", $new_cookie, time()+60*60*24*365, "/", COOKIEDOMAIN);
162 168
 
163 169
 
164
-    } else {
170
+    }
171
+    else {
165 172
         // User is logged in.
166 173
 
167 174
         // See if the user's already voted for this.
@@ -172,7 +179,8 @@  discard block
 block discarded – undo
172 179
 
173 180
         if ($q->rows() == 1) {
174 181
             voteerror("You have already rated this item. You can only rate something once.");
175
-        } else {
182
+        }
183
+        else {
176 184
             // Add the vote.
177 185
             $q = $db->query("INSERT INTO uservotes (user_id, epobject_id, vote) VALUES (:user_id, :epobject_id, :vote)", array(':user_id' => $THEUSER->user_id(), ':vote' => $vote, ':epobject_id' => $epobject_id));
178 186
             if (!$q->success()) {
@@ -181,7 +189,8 @@  discard block
 block discarded – undo
181 189
         }
182 190
     }
183 191
 
184
-} else {
192
+}
193
+else {
185 194
     voteerror("We weren't able to register your vote");
186 195
 }
187 196
 
Please login to merge, or discard this patch.
www/docs/boundaries/index.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         WHERE constituency IN ('" . join("','", $a) . "')
70 70
         AND ( ( house = 3 and left_house = '2011-03-24' ) or ( house = 4 and left_house = '2011-03-23') )");
71 71
     $mreg = array();
72
-    for ($i=0; $i<$q->rows(); $i++) {
72
+    for ($i = 0; $i < $q->rows(); $i++) {
73 73
         $cons = $q->field($i, 'constituency');
74 74
         $house = $q->field($i, 'house');
75 75
         if (($house == 4 && $cons == $current['SPC']) || ($house == 3 && $cons == $current['NIE'])) {
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 <li>You were in the <strong><?=$current['SPC']?></strong> constituency, in the <strong><?=$current['SPE']?></strong> region; your constituency MSP was <a href='<?=$mp_url?>'><?=$name?></a>, and your regional MSPs were <?php
135 135
         foreach ($mreg as $k => $n) {
136 136
             print "<a href='/msp/" . make_member_url($n, '', 4) . "'>$n</a>";
137
-            if ($k < count($mreg)-2) print ', ';
138
-            elseif ($k == count($mreg)-2) print ' and ';
137
+            if ($k < count($mreg) - 2) print ', ';
138
+            elseif ($k == count($mreg) - 2) print ' and ';
139 139
         }
140 140
         echo '.</li>';
141 141
     } elseif ($country == 'N') {
Please login to merge, or discard this patch.
Braces   +18 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,7 +21,8 @@  discard block
 block discarded – undo
21 21
 if ($pc) {
22 22
     # current will have WMC key. If Scottish, has SPC and SPE too. If NI, has NIE.
23 23
     $mapit = mapit_call('postcode', $pc);
24
-    if (is_object($mapit)) { # RABX error returns an object
24
+    if (is_object($mapit)) {
25
+# RABX error returns an object
25 26
         print '<p class="error">Afraid we couldn&rsquo;t find that postcode.</p>';
26 27
         $pc = '';
27 28
     }
@@ -42,7 +43,8 @@  discard block
 block discarded – undo
42 43
     if (array_key_exists('SPC', $current)) {
43 44
         $a = array($current['SPC'], $current['SPE']);
44 45
         $country = 'S';
45
-    } else {
46
+    }
47
+    else {
46 48
         $a = array($current['NIE']);
47 49
         $country = 'N';
48 50
     }
@@ -74,7 +76,8 @@  discard block
 block discarded – undo
74 76
         $house = $q->field($i, 'house');
75 77
         if (($house == 4 && $cons == $current['SPC']) || ($house == 3 && $cons == $current['NIE'])) {
76 78
             $name = $q->field($i, 'first_name') . ' ' . $q->field($i, 'last_name');
77
-        } elseif ($house == 4 && $cons == $current['SPE']) {
79
+        }
80
+        elseif ($house == 4 && $cons == $current['SPE']) {
78 81
             $mreg[] = $q->field($i, 'first_name') . ' ' . $q->field($i, 'last_name');
79 82
         }
80 83
     }
@@ -122,9 +125,11 @@  discard block
 block discarded – undo
122 125
 <?php
123 126
     if (count($new)) {
124 127
         print "<li>For the Parliament election, you are in the <strong>$new[SPC]</strong> constituency, in the <strong>$new[SPE]</strong> region.";
125
-    } elseif ($country == 'N') {
128
+    }
129
+    elseif ($country == 'N') {
126 130
         print "<li>For the Assembly election, you are in the <strong>$current[WMC]</strong> constituency.";
127
-    } else {
131
+    }
132
+    else {
128 133
         print '<li>We cannot look up the constituency for the election for some reason, sorry.';
129 134
     }
130 135
 
@@ -134,11 +139,16 @@  discard block
 block discarded – undo
134 139
 <li>You were in the <strong><?=$current['SPC']?></strong> constituency, in the <strong><?=$current['SPE']?></strong> region; your constituency MSP was <a href='<?=$mp_url?>'><?=$name?></a>, and your regional MSPs were <?php
135 140
         foreach ($mreg as $k => $n) {
136 141
             print "<a href='/msp/" . make_member_url($n, '', 4) . "'>$n</a>";
137
-            if ($k < count($mreg)-2) print ', ';
138
-            elseif ($k == count($mreg)-2) print ' and ';
142
+            if ($k < count($mreg)-2) {
143
+                print ', ';
144
+            }
145
+            elseif ($k == count($mreg)-2) {
146
+                print ' and ';
147
+            }
139 148
         }
140 149
         echo '.</li>';
141
-    } elseif ($country == 'N') {
150
+    }
151
+    elseif ($country == 'N') {
142 152
         $mp_url = '/mla/' . make_member_url($name, '', 3);
143 153
 ?>
144 154
 <li>You were in the <strong><?=$current['NIE']?></strong> constituency; your constituency MLA was <a href='<?=$mp_url?>'><?=$name?></a>.</li>
Please login to merge, or discard this patch.
www/docs/wikipedia/index.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 preg_match_all('#<li>.*? \(<a[^>]*>hist</a>\) \(<a href=".*?title=(.*?)&.*?oldid=(.*?)"[^>]*>diff</a>\)  <a[^>]*>(.*?)</a> .*?</li>#', $file, $m, PREG_SET_ORDER);
52 52
 foreach ($m as $row) {
53 53
     $file = file_get_contents("cache/$row[1].$row[2]");
54
-    $file = str_replace(array("\xe2\x86\x90","\xe2\x86\x92"), array('&larr;', '&rarr;'), $file);
54
+    $file = str_replace(array("\xe2\x86\x90", "\xe2\x86\x92"), array('&larr;', '&rarr;'), $file);
55 55
     print "<h3>$row[3]</h3>";
56 56
     if (preg_match('#<table.*?</table>#s', $file, $m))
57 57
         print preg_replace('#href=(\'|")(.*?)\1#', 'href=\1http://en.wikipedia.org\2\1', $m[0]);
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -9,8 +9,9 @@  discard block
 block discarded – undo
9 9
     '212.35.252.2' => 'Liberal Democrats',
10 10
 );
11 11
 $ip = get_http_var('ip');
12
-if (!array_key_exists($ip, $site))
12
+if (!array_key_exists($ip, $site)) {
13 13
     $ip = '194.60.38.10';
14
+}
14 15
 
15 16
 $this_page = 'wikipedia';
16 17
 $DATA->set_page_metadata($this_page, 'title', 'Latest 100 changes to Wikipedia by non-logged-in computers in ' . $site[$ip]);
@@ -28,10 +29,12 @@  discard block
 block discarded – undo
28 29
 <p align="center"><?php
29 30
 $out = array();
30 31
 foreach ($site as $k => $v) {
31
-    if ($k == $ip)
32
-        $o = "<strong>$v</strong>";
33
-    else
34
-        $o = "<a href=\"./?ip=$k\">$v</a>";
32
+    if ($k == $ip) {
33
+            $o = "<strong>$v</strong>";
34
+    }
35
+    else {
36
+            $o = "<a href=\"./?ip=$k\">$v</a>";
37
+    }
35 38
     $out[] = $o;
36 39
 }
37 40
 print join(' | ', $out);
@@ -53,11 +56,13 @@  discard block
 block discarded – undo
53 56
     $file = file_get_contents("cache/$row[1].$row[2]");
54 57
     $file = str_replace(array("\xe2\x86\x90","\xe2\x86\x92"), array('&larr;', '&rarr;'), $file);
55 58
     print "<h3>$row[3]</h3>";
56
-    if (preg_match('#<table.*?</table>#s', $file, $m))
57
-        print preg_replace('#href=(\'|")(.*?)\1#', 'href=\1http://en.wikipedia.org\2\1', $m[0]);
58
-    elseif (preg_match('#<div class="firstrevisionheader.*?</div>#s', $file, $m))
59
-        print preg_replace('#href=(\'|")(.*?)\1#', 'href=\1http://en.wikipedia.org\2\1', $m[0]);
60
-}
59
+    if (preg_match('#<table.*?</table>#s', $file, $m)) {
60
+            print preg_replace('#href=(\'|")(.*?)\1#', 'href=\1http://en.wikipedia.org\2\1', $m[0]);
61
+    }
62
+    elseif (preg_match('#<div class="firstrevisionheader.*?</div>#s', $file, $m)) {
63
+            print preg_replace('#href=(\'|")(.*?)\1#', 'href=\1http://en.wikipedia.org\2\1', $m[0]);
64
+    }
65
+    }
61 66
 
62 67
 $PAGE->stripe_end();
63 68
 $PAGE->page_end();
Please login to merge, or discard this patch.