Completed
Pull Request — master (#1322)
by Nick
11:36 queued 06:31
created
www/docs/report/index.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 $this_page = "commentreport";
6 6
 
7 7
 include_once '../../includes/easyparliament/init.php';
8
-include_once (INCLUDESPATH."easyparliament/commentreport.php");
8
+include_once (INCLUDESPATH . "easyparliament/commentreport.php");
9 9
 
10 10
 $PAGE->page_start();
11 11
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
             $REPORT = new COMMENTREPORT;
58 58
 
59
-            $reportdata = array (
59
+            $reportdata = array(
60 60
                 'body'		=> get_http_var('body'),
61 61
                 'firstname'	=> get_http_var('firstname'),
62 62
                 'lastname'	=> get_http_var('lastname'),
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
 
86 86
             } else {
87
-                $PAGE->error_message ("Sorry, we were unable to add the report to the database.");
87
+                $PAGE->error_message("Sorry, we were unable to add the report to the database.");
88 88
             }
89 89
         }
90 90
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
 
101 101
 
102
-function display_form($COMMENT, $errors=array()) {
102
+function display_form($COMMENT, $errors = array()) {
103 103
     global $this_page, $THEUSER, $PAGE;
104 104
 
105 105
     ?>
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,7 +50,8 @@  discard block
 block discarded – undo
50 50
         if (count($errors) > 0) {
51 51
             display_form($COMMENT, $errors);
52 52
 
53
-        } else {
53
+        }
54
+        else {
54 55
 
55 56
             // Report this comment.
56 57
 
@@ -83,17 +84,20 @@  discard block
 block discarded – undo
83 84
                 }
84 85
 
85 86
 
86
-            } else {
87
+            }
88
+            else {
87 89
                 $PAGE->error_message ("Sorry, we were unable to add the report to the database.");
88 90
             }
89 91
         }
90 92
 
91
-    } else {
93
+    }
94
+    else {
92 95
         display_form($COMMENT);
93 96
     }
94 97
 
95 98
 
96
-} else {
99
+}
100
+else {
97 101
     $PAGE->error_message("We need the ID of a annotation before it can be reported.");
98 102
 }
99 103
 
@@ -124,7 +128,8 @@  discard block
 block discarded – undo
124 128
         ?>
125 129
                 <p><br><strong>From:</strong> <?php echo _htmlentities($THEUSER->firstname() . ' ' . $THEUSER->lastname()); ?></p>
126 130
 <?php
127
-    } else {
131
+    }
132
+    else {
128 133
         // Not-logged-in user, so we want their name and email address.
129 134
         if (isset($errors['name'])) {
130 135
             $PAGE->error_message($errors['name']);
Please login to merge, or discard this patch.
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/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 URL('hansard');
73 73
 $MPURL = new 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 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 URL('useredit');
89
-    } else {
93
+    }
94
+    else {
90 95
         $CHANGEURL = new 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.
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/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 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/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.