Passed
Pull Request — master (#2712)
by Christian
13:50 queued 06:33
created
html/user/openid.php 1 patch
Braces   +24 added lines, -42 removed lines patch added patch discarded remove patch
@@ -44,8 +44,7 @@  discard block
 block discarded – undo
44 44
  * @copyright Copyright (c) 2010, Mewp
45 45
  * @license http://www.opensource.org/licenses/mit-license.php MIT
46 46
  */
47
-class LightOpenID
48
-{
47
+class LightOpenID {
49 48
     public $returnUrl
50 49
          , $required = array()
51 50
          , $optional = array()
@@ -67,8 +66,7 @@  discard block
 block discarded – undo
67 66
         'pref/timezone'           => 'timezone',
68 67
         );
69 68
 
70
-    function __construct()
71
-    {
69
+    function __construct() {
72 70
         $this->trustRoot = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];
73 71
         $uri = rtrim(preg_replace('#((?<=\?)|&)openid\.[^&]+#', '', $_SERVER['REQUEST_URI']), '?');
74 72
         $this->returnUrl = $this->trustRoot . $uri;
@@ -80,8 +78,7 @@  discard block
 block discarded – undo
80 78
         }
81 79
     }
82 80
 
83
-    function __set($name, $value)
84
-    {
81
+    function __set($name, $value) {
85 82
         switch ($name) {
86 83
         case 'identity':
87 84
             if (strlen($value = trim((String) $value))) {
@@ -102,8 +99,7 @@  discard block
 block discarded – undo
102 99
         }
103 100
     }
104 101
 
105
-    function __get($name)
106
-    {
102
+    function __get($name) {
107 103
         switch ($name) {
108 104
         case 'identity':
109 105
             # We return claimed_id instead of identity,
@@ -124,8 +120,7 @@  discard block
 block discarded – undo
124 120
      * @param $url url to check
125 121
      * @return true, if the server exists; false otherwise
126 122
      */
127
-    function hostExists($url)
128
-    {
123
+    function hostExists($url) {
129 124
         if (strpos($url, '/') === false) {
130 125
             $server = $url;
131 126
         } else {
@@ -139,8 +134,7 @@  discard block
 block discarded – undo
139 134
         return !!gethostbynamel($server);
140 135
     }
141 136
 
142
-    protected function request_curl($url, $method='GET', $params=array())
143
-    {
137
+    protected function request_curl($url, $method='GET', $params=array()) {
144 138
         $params = http_build_query($params, '', '&');
145 139
         $curl = curl_init($url . ($method == 'GET' && $params ? '?' . $params : ''));
146 140
         curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
@@ -195,8 +189,7 @@  discard block
 block discarded – undo
195 189
         return $response;
196 190
     }
197 191
 
198
-    protected function request_streams($url, $method='GET', $params=array())
199
-    {
192
+    protected function request_streams($url, $method='GET', $params=array()) {
200 193
         if(!$this->hostExists($url)) {
201 194
             throw new ErrorException('Invalid request.');
202 195
         }
@@ -285,16 +278,14 @@  discard block
 block discarded – undo
285 278
         return file_get_contents($url, false, $context);
286 279
     }
287 280
 
288
-    protected function request($url, $method='GET', $params=array())
289
-    {
281
+    protected function request($url, $method='GET', $params=array()) {
290 282
         if(function_exists('curl_init') && !ini_get('safe_mode') && !ini_get('open_basedir')) {
291 283
             return $this->request_curl($url, $method, $params);
292 284
         }
293 285
         return $this->request_streams($url, $method, $params);
294 286
     }
295 287
 
296
-    protected function build_url($url, $parts)
297
-    {
288
+    protected function build_url($url, $parts) {
298 289
         if (isset($url['query'], $parts['query'])) {
299 290
             $parts['query'] = $url['query'] . '&' . $parts['query'];
300 291
         }
@@ -316,8 +307,7 @@  discard block
 block discarded – undo
316 307
      * Helper function used to scan for <meta>/<link> tags and extract information
317 308
      * from them
318 309
      */
319
-    protected function htmlTag($content, $tag, $attrName, $attrValue, $valueName)
320
-    {
310
+    protected function htmlTag($content, $tag, $attrName, $attrValue, $valueName) {
321 311
         preg_match_all("#<{$tag}[^>]*$attrName=['\"].*?$attrValue.*?['\"][^>]*$valueName=['\"](.+?)['\"][^>]*/?>#i", $content, $matches1);
322 312
         preg_match_all("#<{$tag}[^>]*$valueName=['\"](.+?)['\"][^>]*$attrName=['\"].*?$attrValue.*?['\"][^>]*/?>#i", $content, $matches2);
323 313
 
@@ -331,8 +321,7 @@  discard block
 block discarded – undo
331 321
      * @return String OP Endpoint (i.e. OpenID provider address).
332 322
      * @throws ErrorException
333 323
      */
334
-    function discover($url)
335
-    {
324
+    function discover($url) {
336 325
         if (!$url) throw new ErrorException('No identity supplied.');
337 326
         # Use xri.net proxy to resolve i-name identities
338 327
         if (!preg_match('#^https?:#', $url)) {
@@ -465,8 +454,7 @@  discard block
 block discarded – undo
465 454
         throw new ErrorException('Endless redirection!');
466 455
     }
467 456
 
468
-    protected function sregParams()
469
-    {
457
+    protected function sregParams() {
470 458
         $params = array();
471 459
         # We always use SREG 1.1, even if the server is advertising only support for 1.0.
472 460
         # That's because it's fully backwards compatibile with 1.0, and some providers
@@ -492,8 +480,7 @@  discard block
 block discarded – undo
492 480
         return $params;
493 481
     }
494 482
 
495
-    protected function axParams()
496
-    {
483
+    protected function axParams() {
497 484
         $params = array();
498 485
         if ($this->required || $this->optional) {
499 486
             $params['openid.ns.ax'] = 'http://openid.net/srv/ax/1.0';
@@ -531,8 +518,7 @@  discard block
 block discarded – undo
531 518
         return $params;
532 519
     }
533 520
 
534
-    protected function authUrl_v1($immediate)
535
-    {
521
+    protected function authUrl_v1($immediate) {
536 522
 	$returnUrl = $this->returnUrl;
537 523
         # If we have an openid.delegate that is different from our claimed id,
538 524
         # we need to somehow preserve the claimed id between requests.
@@ -552,8 +538,7 @@  discard block
 block discarded – undo
552 538
                                , array('query' => http_build_query($params, '', '&')));
553 539
     }
554 540
 
555
-    protected function authUrl_v2($immediate)
556
-    {
541
+    protected function authUrl_v2($immediate) {
557 542
         $params = array(
558 543
             'openid.ns'          => 'http://specs.openid.net/auth/2.0',
559 544
             'openid.mode'        => $immediate ? 'checkid_immediate' : 'checkid_setup',
@@ -590,8 +575,7 @@  discard block
 block discarded – undo
590 575
      * @param String $select_identifier Whether to request OP to select identity for an user in OpenID 2. Does not affect OpenID 1.
591 576
      * @throws ErrorException
592 577
      */
593
-    function authUrl($immediate = false)
594
-    {
578
+    function authUrl($immediate = false) {
595 579
         if ($this->setup_url && !$immediate) return $this->setup_url;
596 580
         if (!$this->server) $this->discover($this->identity);
597 581
 
@@ -606,8 +590,7 @@  discard block
 block discarded – undo
606 590
      * @return Bool Whether the verification was successful.
607 591
      * @throws ErrorException
608 592
      */
609
-    function validate()
610
-    {
593
+    function validate() {
611 594
         # If the request was using immediate mode, a failure may be reported
612 595
         # by presenting user_setup_url (for 1.1) or reporting
613 596
         # mode 'setup_needed' (for 2.0). Also catching all modes other than
@@ -668,12 +651,12 @@  discard block
 block discarded – undo
668 651
         return preg_match('/is_valid\s*:\s*true/i', $response);
669 652
     }
670 653
 
671
-    protected function getAxAttributes()
672
-    {
654
+    protected function getAxAttributes() {
673 655
         $alias = null;
674 656
         if (isset($this->data['openid_ns_ax'])
675 657
             && $this->data['openid_ns_ax'] != 'http://openid.net/srv/ax/1.0'
676
-        ) { # It's the most likely case, so we'll check it before
658
+        ) {
659
+# It's the most likely case, so we'll check it before
677 660
             $alias = 'ax';
678 661
         } else {
679 662
             # 'ax' prefix is either undefined, or points to another extension,
@@ -713,8 +696,7 @@  discard block
 block discarded – undo
713 696
         return $attributes;
714 697
     }
715 698
 
716
-    protected function getSregAttributes()
717
-    {
699
+    protected function getSregAttributes() {
718 700
         $attributes = array();
719 701
         $sreg_to_ax = array_flip(self::$ax_to_sreg);
720 702
         foreach ($this->data as $key => $value) {
@@ -741,11 +723,11 @@  discard block
 block discarded – undo
741 723
      *     * @return Array Array of attributes with keys being the AX schema names, e.g. 'contact/email'
742 724
      * @see http://www.axschema.org/types/
743 725
      */
744
-    function getAttributes()
745
-    {
726
+    function getAttributes() {
746 727
         if (isset($this->data['openid_ns'])
747 728
             && $this->data['openid_ns'] == 'http://specs.openid.net/auth/2.0'
748
-        ) { # OpenID 2.0
729
+        ) {
730
+# OpenID 2.0
749 731
             # We search for both AX and SREG attributes, with AX taking precedence.
750 732
             return $this->getAxAttributes() + $this->getSregAttributes();
751 733
         }
Please login to merge, or discard this patch.
html/user/edit_forum_preferences_action.php 1 patch
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 }
30 30
 BoincForumPrefs::lookup($user);
31 31
 
32
-if (post_str("action", true)=="reset_confirm"){
32
+if (post_str("action", true)=="reset_confirm") {
33 33
     page_head(tra("Confirm reset"));
34 34
     echo tra("This action will erase any changes you have made in your community preferences. To cancel, click your browser's Back button.")."
35 35
         <p>
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 // If the user has requested a reset of preferences;
46 46
 // preserve a few fields.
47 47
 //
48
-if (post_str("action", true)=="reset"){
48
+if (post_str("action", true)=="reset") {
49 49
     $posts = $user->prefs->posts;
50 50
     $last_post = $user->prefs->last_post;
51 51
     $rated_posts = $user->prefs->rated_posts;
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 
72 72
 // Update the user avatar
73 73
 if ($avatar_type<0 or $avatar_type>3) $avatar_type=0;
74
-if ($avatar_type==0){
75
-    if (file_exists($newfile)){
74
+if ($avatar_type==0) {
75
+    if (file_exists($newfile)) {
76 76
         // Delete the file on the server if the user
77 77
         // decides not to use an avatar
78 78
         //
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     $avatar_url="";
82 82
 } elseif ($avatar_type == 1) {
83 83
     $avatar_url = "//www.gravatar.com/avatar/".md5($user->email_addr)."?s=100&amp;d=identicon";
84
-} elseif ($avatar_type==2){
84
+} elseif ($avatar_type==2) {
85 85
     if (($rpc && (post_str("avatar_url", true) != null)) || ($_FILES['picture']['tmp_name']!="")) {
86 86
         if ($_FILES['picture']['tmp_name']!="") {
87 87
             $file = $_FILES['picture']['tmp_name'];
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             $file = post_str("avatar_url");
91 91
         }
92 92
         $size = getImageSize($file);
93
-        if ($size[2]!=2 and $size[2]!=3){
93
+        if ($size[2]!=2 and $size[2]!=3) {
94 94
             //Not the right kind of file
95 95
             error_page(tra("Error: Not the right kind of file, only PNG and JPEG are supported."));
96 96
         }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $image2 = intelligently_scale_image($file, 100, 100);
100 100
         ImageJPEG($image2, $newfile);
101 101
     }
102
-    if (file_exists($newfile)){
102
+    if (file_exists($newfile)) {
103 103
         $avatar_url=IMAGE_URL.$user->id."_avatar.jpg"; //$newfile;
104 104
     } else {
105 105
         //User didn't upload a compatible file or it went lost on the server
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
 }   // DISABLE_FORUMS
132 132
 
133 133
 $add_user_to_filter = (isset($_POST["add_user_to_filter"]) && $_POST["add_user_to_filter"]!="");
134
-if ($add_user_to_filter){
134
+if ($add_user_to_filter) {
135 135
     $user_to_add = trim($_POST["forum_filter_user"]);
136
-    if ($user_to_add!="" and $user_to_add==strval(intval($user_to_add))){
136
+    if ($user_to_add!="" and $user_to_add==strval(intval($user_to_add))) {
137 137
         $other_user = BoincUser::lookup_id($user_to_add);
138 138
         if (!$other_user) {
139 139
             echo tra("No such user:")." ".$user_to_add;
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 // Or remove some from the ignore list
147 147
 //
148 148
 $ignored_users = get_ignored_list($user);
149
-for ($i=0;$i<sizeof($ignored_users);$i++){
149
+for ($i=0;$i<sizeof($ignored_users);$i++) {
150 150
     $remove = "remove".trim($ignored_users[$i]);
151
-    if (isset($_POST[$remove]) && $_POST[$remove]!=""){
151
+    if (isset($_POST[$remove]) && $_POST[$remove]!="") {
152 152
         $other_user = BoincUser::lookup_id($ignored_users[$i]);
153 153
         if (!$other_user) {
154 154
             echo tra("No such user:")." ".$ignored_users[$j];
Please login to merge, or discard this patch.
html/user/submit.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -369,7 +369,7 @@
 block discarded – undo
369 369
             $text = "---";
370 370
             if ($batch->state == BATCH_STATE_COMPLETE) {
371 371
                 $y = '<font color="red">failed</font>';
372
-            }   else {
372
+            } else {
373 373
                 $y = "in progress";
374 374
             }
375 375
         }
Please login to merge, or discard this patch.
html/user/forum_forum.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,14 +48,14 @@
 block discarded – undo
48 48
 
49 49
 if (!$sort_style) {
50 50
     // get the sort style either from the logged in user or a cookie
51
-    if ($user){
51
+    if ($user) {
52 52
         $sort_style = $user->prefs->forum_sorting;
53 53
     } else {
54 54
         list($sort_style, $thread_style) = parse_forum_cookie();
55 55
     }
56 56
 } else {
57 57
     // set the sort style
58
-    if ($user){
58
+    if ($user) {
59 59
         $user->prefs->forum_sorting = $sort_style;
60 60
         $user->prefs->update("forum_sorting=$sort_style");
61 61
     } else {
Please login to merge, or discard this patch.
html/user/team_change_founder_form.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,8 @@
 block discarded – undo
92 92
 
93 93
 $navailable_users = 0;
94 94
 foreach ($users as $user) {
95
-    if ($user->id != $team->userid) {       //don't show current founder
95
+    if ($user->id != $team->userid) {
96
+//don't show current founder
96 97
         $user_total_credit = format_credit($user->total_credit);
97 98
         $user_expavg_credit = format_credit($user->expavg_credit);
98 99
         $selected = ($user->id == $team->ping_user)?"selected":"";
Please login to merge, or discard this patch.
html/user/top_users.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
     // Do we have the data in cache?
93 93
     //
94
-    if ($cacheddata){
94
+    if ($cacheddata) {
95 95
         $data = unserialize($cacheddata); // use the cached data
96 96
     } else {
97 97
         //if not do queries etc to generate new data
@@ -122,7 +122,8 @@  discard block
 block discarded – undo
122 122
     echo "<a href=top_users.php?sort_by=$sort_by&amp;offset=$new_offset>".tra("Previous %1", $users_per_page)."</a> &middot; ";
123 123
 
124 124
 }
125
-if ($n==$users_per_page){ //If we aren't on the last page
125
+if ($n==$users_per_page) {
126
+//If we aren't on the last page
126 127
     $new_offset = $offset + $users_per_page;
127 128
     echo "<a href=top_users.php?sort_by=$sort_by&amp;offset=$new_offset>".tra("Next %1", $users_per_page)."</a>";
128 129
 }
Please login to merge, or discard this patch.
html/user/forum_reply.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     $parent_post_id = 0;
51 51
 }
52 52
 
53
-if ($filter != "false"){
53
+if ($filter != "false") {
54 54
     $filter = true;
55 55
 } else {
56 56
     $filter = false;
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 }
66 66
 
67 67
 $warning = null;
68
-if ($content && (!$preview)){
69
-    if (post_str('add_signature',true)=="add_it"){
68
+if ($content && (!$preview)) {
69
+    if (post_str('add_signature',true)=="add_it") {
70 70
         $add_signature=true;    // set a flag and concatenate later
71
-    }  else {
71
+    } else {
72 72
         $add_signature=false;
73 73
     }
74 74
     check_tokens($logged_in_user->authenticator);
Please login to merge, or discard this patch.
html/user/view_profile.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
 
45 45
 $cache_args = "userid=$userid";
46 46
 $cacheddata = get_cached_data(USER_PROFILE_TTL, $cache_args);
47
-if ($cacheddata){
47
+if ($cacheddata) {
48 48
     // Already got a cached version of the information
49 49
     $community_links_object = unserialize($cacheddata);
50 50
 } else {
Please login to merge, or discard this patch.
html/user/forum_banishment_vote_action.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
 // See if "action" is provided - either through post or get
39 39
 if (!post_str('action', true)) {
40
-    if (!get_str('action', true)){
40
+    if (!get_str('action', true)) {
41 41
 	    error_page(tra("You must specify an action..."));
42 42
     } else {
43 43
         $action = get_str('action');
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 $userid = post_int('userid');
50 50
 $user=BoincUser::lookup_id($userid);
51 51
 
52
-if ($action!="start"){
52
+if ($action!="start") {
53 53
     error_page("Unknown action");
54 54
 }
55 55
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         $mod_category = tra("Other");
66 66
 }
67 67
 
68
-if (post_str('reason', true)){
68
+if (post_str('reason', true)) {
69 69
     start_vote($config,$logged_in_user,$user, $mod_category,post_str("reason"));
70 70
 } else {
71 71
     start_vote($config,$logged_in_user,$user, $mod_category,"None given");
Please login to merge, or discard this patch.