Passed
Pull Request — master (#5620)
by David
10:14
created
html/inc/user_util.inc 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 function check_passwd_ui($user, $passwd) {
59 59
     $passwd_hash = md5($passwd.$user->email_addr);
60
-    if(!check_passwd_hash($user, $passwd_hash)) {
60
+    if (!check_passwd_hash($user, $passwd_hash)) {
61 61
         sleep(LOGIN_FAIL_SLEEP_SEC);
62 62
         page_head("Password incorrect");
63 63
         echo "The password you entered is incorrect. Please go back and try again.\n";
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 function is_banned_email_addr($email_addr) {
70 70
     global $banned_email_domains;
71 71
     if (isset($banned_email_domains)) {
72
-        foreach($banned_email_domains as $d) {
72
+        foreach ($banned_email_domains as $d) {
73 73
             $x = strstr($email_addr, $d);
74 74
             if ($x == $d) return true;
75 75
         }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 //
109 109
 function make_user(
110 110
     $email_addr, $name, $passwd_hash,
111
-    $country=null, $postal_code=null, $project_prefs=null, $teamid=0
111
+    $country = null, $postal_code = null, $project_prefs = null, $teamid = 0
112 112
 ) {
113 113
     if (!is_valid_email_addr($email_addr)) return null;
114 114
     if (is_banned_email_addr($email_addr)) return null;
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             $users = BoincUser::enum(
243 243
                 sprintf("name like '%s%%'", $new_name)
244 244
             );
245
-            foreach ($users as $u){
245
+            foreach ($users as $u) {
246 246
                 echo "<p>$u->name\n";
247 247
             }
248 248
             page_tail();
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
         show_error(tra("Passwords may only include ASCII characters."));
273 273
     }
274 274
 
275
-    if (strlen($passwd)<$min_passwd_length) {
275
+    if (strlen($passwd) < $min_passwd_length) {
276 276
         show_error(
277 277
             tra("New password is too short: minimum password length is %1 characters.", $min_passwd_length)
278 278
         );
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -242,7 +242,7 @@
 block discarded – undo
242 242
             $users = BoincUser::enum(
243 243
                 sprintf("name like '%s%%'", $new_name)
244 244
             );
245
-            foreach ($users as $u){
245
+            foreach ($users as $u) {
246 246
                 echo "<p>$u->name\n";
247 247
             }
248 248
             page_tail();
Please login to merge, or discard this patch.
html/user/edit_forum_preferences_action.php 2 patches
Spacing   +29 added lines, -29 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;
@@ -67,30 +67,30 @@  discard block
 block discarded – undo
67 67
 if (!DISABLE_FORUMS) {
68 68
 
69 69
 $avatar_type = post_int("avatar_select");
70
-$newfile=IMAGE_PATH.$user->id."_avatar.jpg";
70
+$newfile = IMAGE_PATH.$user->id."_avatar.jpg";
71 71
 
72 72
 // Update the user avatar
73
-if ($avatar_type<0 or $avatar_type>3) $avatar_type=0;
74
-if ($avatar_type==0){
75
-    if (file_exists($newfile)){
73
+if ($avatar_type < 0 or $avatar_type > 3) $avatar_type = 0;
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
         //
79 79
         unlink($newfile);
80 80
     }
81
-    $avatar_url="";
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){
85
-    if (($rpc && (post_str("avatar_url", true) != null)) || ($_FILES['picture']['tmp_name']!="")) {
86
-        if ($_FILES['picture']['tmp_name']!="") {
84
+} elseif ($avatar_type == 2) {
85
+    if (($rpc && (post_str("avatar_url", true) != null)) || ($_FILES['picture']['tmp_name'] != "")) {
86
+        if ($_FILES['picture']['tmp_name'] != "") {
87 87
             $file = $_FILES['picture']['tmp_name'];
88 88
         } else {
89 89
             // Remote image. Download and store locally
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,30 +99,30 @@  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)){
103
-        $avatar_url=IMAGE_URL.$user->id."_avatar.jpg"; //$newfile;
102
+    if (file_exists($newfile)) {
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
106
-        $avatar_url="";
106
+        $avatar_url = "";
107 107
     }
108 108
 }
109 109
 
110
-$images_as_links = (isset($_POST["forum_images_as_links"]) && $_POST["forum_images_as_links"]!="")?1:0;
111
-$link_popup = (isset($_POST["forum_link_popup"]) && $_POST["forum_link_popup"]!="")?1:0;
112
-$hide_avatars = (isset($_POST["forum_hide_avatars"]) && $_POST["forum_hide_avatars"]!="")?1:0;
113
-$hide_signatures = (isset($_POST["forum_hide_signatures"]) && $_POST["forum_hide_signatures"]!="")?1:0;
114
-$highlight_special = (isset($_POST["forum_highlight_special"]) && $_POST["forum_highlight_special"]!="")?1:0;
115
-$jump_to_unread = (isset($_POST["forum_jump_to_unread"]) && $_POST["forum_jump_to_unread"]!="")?1:0;
116
-$ignore_sticky_posts = (isset($_POST["forum_ignore_sticky_posts"]) && $_POST["forum_ignore_sticky_posts"]!="")?1:0;
117
-$no_signature_by_default = (isset($_POST["signature_by_default"]) && $_POST["signature_by_default"]!="")?0:1;
110
+$images_as_links = (isset($_POST["forum_images_as_links"]) && $_POST["forum_images_as_links"] != "") ? 1 : 0;
111
+$link_popup = (isset($_POST["forum_link_popup"]) && $_POST["forum_link_popup"] != "") ? 1 : 0;
112
+$hide_avatars = (isset($_POST["forum_hide_avatars"]) && $_POST["forum_hide_avatars"] != "") ? 1 : 0;
113
+$hide_signatures = (isset($_POST["forum_hide_signatures"]) && $_POST["forum_hide_signatures"] != "") ? 1 : 0;
114
+$highlight_special = (isset($_POST["forum_highlight_special"]) && $_POST["forum_highlight_special"] != "") ? 1 : 0;
115
+$jump_to_unread = (isset($_POST["forum_jump_to_unread"]) && $_POST["forum_jump_to_unread"] != "") ? 1 : 0;
116
+$ignore_sticky_posts = (isset($_POST["forum_ignore_sticky_posts"]) && $_POST["forum_ignore_sticky_posts"] != "") ? 1 : 0;
117
+$no_signature_by_default = (isset($_POST["signature_by_default"]) && $_POST["signature_by_default"] != "") ? 0 : 1;
118 118
 $signature = post_str("signature", true);
119
-if (strlen($signature)>250) {
119
+if (strlen($signature) > 250) {
120 120
     error_page(tra("Your signature was too long, please keep it less than 250 characters."));
121 121
 }
122 122
 $forum_sort = post_int("forum_sort");
123 123
 $thread_sort = post_int("thread_sort");
124 124
 $display_wrap_postcount = post_int("forum_display_wrap_postcount");
125
-if ($display_wrap_postcount<1) $display_wrap_postcount=1;
125
+if ($display_wrap_postcount < 1) $display_wrap_postcount = 1;
126 126
 
127 127
 $signature = BoincDb::escape_string($signature);
128 128
 
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
     }
142 142
 } else {
143 143
     // todo: clean up the following
144
-    $add_user_to_filter = (isset($_POST["add_user_to_filter"]) && $_POST["add_user_to_filter"]!="");
145
-    if ($add_user_to_filter){
144
+    $add_user_to_filter = (isset($_POST["add_user_to_filter"]) && $_POST["add_user_to_filter"] != "");
145
+    if ($add_user_to_filter) {
146 146
         $user_to_add = trim($_POST["forum_filter_user"]);
147
-        if ($user_to_add!="" and $user_to_add==strval(intval($user_to_add))){
147
+        if ($user_to_add != "" and $user_to_add == strval(intval($user_to_add))) {
148 148
             $other_user = BoincUser::lookup_id($user_to_add);
149 149
             if (!$other_user) {
150 150
                 echo tra("No such user:")." ".$user_to_add;
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 //
160 160
 $ignored_users = get_ignored_list($user);
161 161
 // todo: use foreach
162
-for ($i=0;$i<sizeof($ignored_users);$i++){
162
+for ($i = 0; $i < sizeof($ignored_users); $i++) {
163 163
     $remove = "remove".trim($ignored_users[$i]);
164
-    if (isset($_POST[$remove]) && $_POST[$remove]!=""){
164
+    if (isset($_POST[$remove]) && $_POST[$remove] != "") {
165 165
         $other_user = BoincUser::lookup_id($ignored_users[$i]);
166 166
         if (!$other_user) {
167 167
             echo tra("No such user:")." ".$ignored_users[$j];
Please login to merge, or discard this 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
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 } else {
143 143
     // todo: clean up the following
144 144
     $add_user_to_filter = (isset($_POST["add_user_to_filter"]) && $_POST["add_user_to_filter"]!="");
145
-    if ($add_user_to_filter){
145
+    if ($add_user_to_filter) {
146 146
         $user_to_add = trim($_POST["forum_filter_user"]);
147
-        if ($user_to_add!="" and $user_to_add==strval(intval($user_to_add))){
147
+        if ($user_to_add!="" and $user_to_add==strval(intval($user_to_add))) {
148 148
             $other_user = BoincUser::lookup_id($user_to_add);
149 149
             if (!$other_user) {
150 150
                 echo tra("No such user:")." ".$user_to_add;
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 //
160 160
 $ignored_users = get_ignored_list($user);
161 161
 // todo: use foreach
162
-for ($i=0;$i<sizeof($ignored_users);$i++){
162
+for ($i=0;$i<sizeof($ignored_users);$i++) {
163 163
     $remove = "remove".trim($ignored_users[$i]);
164
-    if (isset($_POST[$remove]) && $_POST[$remove]!=""){
164
+    if (isset($_POST[$remove]) && $_POST[$remove]!="") {
165 165
         $other_user = BoincUser::lookup_id($ignored_users[$i]);
166 166
         if (!$other_user) {
167 167
             echo tra("No such user:")." ".$ignored_users[$j];
Please login to merge, or discard this patch.
html/user/edit_forum_preferences_form.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 // ------------ Notification -----------
39 39
 
40 40
 row1(tra("Notifications"));
41
-$ch0 = $user->prefs->pm_notification==0?"checked":"";
42
-$ch1 = $user->prefs->pm_notification==1?"checked":"";
43
-$ch2 = $user->prefs->pm_notification==2?"checked":"";
41
+$ch0 = $user->prefs->pm_notification == 0 ? "checked" : "";
42
+$ch1 = $user->prefs->pm_notification == 1 ? "checked" : "";
43
+$ch2 = $user->prefs->pm_notification == 2 ? "checked" : "";
44 44
 row2(
45 45
     tra("How should we notify you of new private messages, friend requests, posts in subscribed threads, and other events?"),
46 46
     "<input type=radio name=pm_notification value=0 $ch0> ".tra("On my Account page (no email)")."
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 // ------------ Forum identity -----------
54 54
 
55 55
 $select_0 = $select_1 = $select_2 = "";
56
-if (strlen($user->prefs->avatar)){
57
-    if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { // Gravatar
56
+if (strlen($user->prefs->avatar)) {
57
+    if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18) == "//www.gravatar.com") { // Gravatar
58 58
         $select_1 = "checked=\"true\"";
59 59
     } else {
60 60
         $select_2 = "checked=\"true\"";
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
     <input type=\"radio\" id=\"avatar_select_2\" name=\"avatar_select\" value=\"2\" ".$select_2.">
74 74
         <label for=\"avatar_select_2\">".tra("Use this uploaded avatar:")."</label> <input type=\"file\" name=\"picture\">"
75 75
 );
76
-if (strlen($user->prefs->avatar)){
76
+if (strlen($user->prefs->avatar)) {
77 77
     row2(tra("Avatar preview")."<br><p class=\"text-muted\">".tra("This is how your avatar will look")."</p>",
78 78
     "<img src=\"".$user->prefs->avatar."\" width=\"100\" height=\"100\">");
79 79
 }
80 80
 
81
-$signature_by_default = $user->prefs->no_signature_by_default==false?"checked=\"checked\"":"";
81
+$signature_by_default = $user->prefs->no_signature_by_default == false ? "checked=\"checked\"" : "";
82 82
 
83
-$signature=$user->prefs->signature;
84
-$maxlen=250;
83
+$signature = $user->prefs->signature;
84
+$maxlen = 250;
85 85
 row2(
86 86
     tra("Signature for message board posts")
87 87
     .bbcode_info()
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     textarea_with_counter("signature", 250, $signature)
93 93
     ."<br><input type=\"checkbox\" name=\"signature_by_default\" ".$signature_by_default."> ".tra("Attach signature by default")
94 94
 );
95
-if ($user->prefs->signature!=""){
95
+if ($user->prefs->signature != "") {
96 96
     row2(tra("Signature preview").
97 97
         "<br><p class=\"text-muted\">".tra("This is how your signature will look in the forums")."</p>",
98 98
         output_transform($user->prefs->signature)
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
 
102 102
 // ------------ Message display  -----------
103 103
 
104
-$forum_hide_avatars = $user->prefs->hide_avatars?"checked=\"checked\"":"";
105
-$forum_hide_signatures = $user->prefs->hide_signatures?"checked=\"checked\"":"";
106
-$forum_link_popup = $user->prefs->link_popup?"checked=\"checked\"":"";
107
-$forum_image_as_link = $user->prefs->images_as_links?"checked=\"checked\"":"";
108
-$forum_jump_to_unread = $user->prefs->jump_to_unread?"checked=\"checked\"":"";
109
-$forum_ignore_sticky_posts = $user->prefs->ignore_sticky_posts?"checked=\"checked\"":"";
110
-$forum_highlight_special = $user->prefs->highlight_special?"checked=\"checked\"":"";
104
+$forum_hide_avatars = $user->prefs->hide_avatars ? "checked=\"checked\"" : "";
105
+$forum_hide_signatures = $user->prefs->hide_signatures ? "checked=\"checked\"" : "";
106
+$forum_link_popup = $user->prefs->link_popup ? "checked=\"checked\"" : "";
107
+$forum_image_as_link = $user->prefs->images_as_links ? "checked=\"checked\"" : "";
108
+$forum_jump_to_unread = $user->prefs->jump_to_unread ? "checked=\"checked\"" : "";
109
+$forum_ignore_sticky_posts = $user->prefs->ignore_sticky_posts ? "checked=\"checked\"" : "";
110
+$forum_highlight_special = $user->prefs->highlight_special ? "checked=\"checked\"" : "";
111 111
 
112 112
 $forum_minimum_wrap_postcount = intval($user->prefs->minimum_wrap_postcount);
113 113
 $forum_display_wrap_postcount = intval($user->prefs->display_wrap_postcount);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 //
141 141
 $filtered_userlist = get_ignored_list($user);
142 142
 $forum_filtered_userlist = "";
143
-for ($i=0; $i<sizeof($filtered_userlist); $i++){
143
+for ($i = 0; $i < sizeof($filtered_userlist); $i++) {
144 144
     $id = (int)$filtered_userlist[$i];
145 145
     if ($id) {
146 146
         $filtered_user = BoincUser::lookup_id($id);
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                 <input class="btn btn-default" type="submit" name="remove%d" value="%s">
155 155
                 <br>
156 156
             ',
157
-            UNIQUE_USER_NAME?'':"$filtered_user->id -",
157
+            UNIQUE_USER_NAME ? '' : "$filtered_user->id -",
158 158
             user_links($filtered_user),
159 159
             $filtered_user->id,
160 160
             tra("Unblock")
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
             <input type="text" name="forum_filter_user" size=12>
179 179
             <input class="btn btn-default" type="submit" name="add_user_to_filter" value="%s">
180 180
         ',
181
-        UNIQUE_USER_NAME?tra('User name'):tra('User ID (For instance: 123456789)'),
181
+        UNIQUE_USER_NAME ?tra('User name') : tra('User ID (For instance: 123456789)'),
182 182
         tra("Block")
183 183
     )
184 184
 );
@@ -193,5 +193,5 @@  discard block
 block discarded – undo
193 193
 end_table();
194 194
 page_tail();
195 195
 
196
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
196
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
197 197
 ?>
Please login to merge, or discard this patch.
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,8 +53,9 @@  discard block
 block discarded – undo
53 53
 // ------------ Forum identity -----------
54 54
 
55 55
 $select_0 = $select_1 = $select_2 = "";
56
-if (strlen($user->prefs->avatar)){
57
-    if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { // Gravatar
56
+if (strlen($user->prefs->avatar)) {
57
+    if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") {
58
+// Gravatar
58 59
         $select_1 = "checked=\"true\"";
59 60
     } else {
60 61
         $select_2 = "checked=\"true\"";
@@ -73,7 +74,7 @@  discard block
 block discarded – undo
73 74
     <input type=\"radio\" id=\"avatar_select_2\" name=\"avatar_select\" value=\"2\" ".$select_2.">
74 75
         <label for=\"avatar_select_2\">".tra("Use this uploaded avatar:")."</label> <input type=\"file\" name=\"picture\">"
75 76
 );
76
-if (strlen($user->prefs->avatar)){
77
+if (strlen($user->prefs->avatar)) {
77 78
     row2(tra("Avatar preview")."<br><p class=\"text-muted\">".tra("This is how your avatar will look")."</p>",
78 79
     "<img src=\"".$user->prefs->avatar."\" width=\"100\" height=\"100\">");
79 80
 }
@@ -92,7 +93,7 @@  discard block
 block discarded – undo
92 93
     textarea_with_counter("signature", 250, $signature)
93 94
     ."<br><input type=\"checkbox\" name=\"signature_by_default\" ".$signature_by_default."> ".tra("Attach signature by default")
94 95
 );
95
-if ($user->prefs->signature!=""){
96
+if ($user->prefs->signature!="") {
96 97
     row2(tra("Signature preview").
97 98
         "<br><p class=\"text-muted\">".tra("This is how your signature will look in the forums")."</p>",
98 99
         output_transform($user->prefs->signature)
@@ -140,7 +141,7 @@  discard block
 block discarded – undo
140 141
 //
141 142
 $filtered_userlist = get_ignored_list($user);
142 143
 $forum_filtered_userlist = "";
143
-for ($i=0; $i<sizeof($filtered_userlist); $i++){
144
+for ($i=0; $i<sizeof($filtered_userlist); $i++) {
144 145
     $id = (int)$filtered_userlist[$i];
145 146
     if ($id) {
146 147
         $filtered_user = BoincUser::lookup_id($id);
Please login to merge, or discard this patch.
html/user/user_search.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     $y = [];
27 27
     $x[] = sprintf('%s%s',
28 28
         user_links($user, BADGE_HEIGHT_MEDIUM),
29
-        UNIQUE_USER_NAME?'':" (ID $user->id)"
29
+        UNIQUE_USER_NAME ? '' : " (ID $user->id)"
30 30
     );
31 31
     $y[] = null;
32 32
     if (!DISABLE_TEAMS) {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     $where = "true";
105 105
     $search_string = get_str('search_string');
106 106
     if (strlen($search_string)) {
107
-        if (strlen($search_string)<3) {
107
+        if (strlen($search_string) < 3) {
108 108
             error_page(tra("search string must be at least 3 characters"));
109 109
         }
110 110
         $s = BoincDb::escape_string($search_string);
@@ -136,17 +136,17 @@  discard block
 block discarded – undo
136 136
     $search_type = get_str('search_type', true);
137 137
     $order_clause = "id desc";
138 138
     if ($search_type == 'rac') {
139
-        $order_clause ="expavg_credit desc";
139
+        $order_clause = "expavg_credit desc";
140 140
     } else if ($search_type == 'total') {
141
-        $order_clause ="total_credit desc";
141
+        $order_clause = "total_credit desc";
142 142
     }
143 143
 
144 144
     $fields = "id, create_time, name, country, total_credit, expavg_credit, teamid, url, has_profile, donated";
145 145
     $users = BoincUser::enum_fields($fields, $where, "order by $order_clause limit 100");
146 146
     page_head(tra("User search results"));
147
-    $n=0;
147
+    $n = 0;
148 148
     foreach ($users as $user) {
149
-        if ($n==0) {
149
+        if ($n == 0) {
150 150
             start_table('table-striped');
151 151
             $x = ['Name'];
152 152
             $y = [null];
@@ -183,5 +183,5 @@  discard block
 block discarded – undo
183 183
     user_search_form();
184 184
 }
185 185
 
186
-$cvs_version_tracker[]="\$Id: user_search.php 13586 2007-09-13 09:46:36Z Rytis $";  //Generated automatically - do not edit
186
+$cvs_version_tracker[] = "\$Id: user_search.php 13586 2007-09-13 09:46:36Z Rytis $"; //Generated automatically - do not edit
187 187
 ?>
Please login to merge, or discard this patch.
html/project.sample/project.inc 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 define('UNIQUE_USER_NAME', true);
51 51
 define("FORUM_QA_MERGED_MODE", true);
52 52
     // Set to true to merge Message boards and Q&A section
53
-define ("DISABLE_PROFILES", true);
53
+define("DISABLE_PROFILES", true);
54 54
     // enable profiles only after enabling reCAPTCHA
55 55
     // https://github.com/BOINC/boinc/wiki/ProtectionFromSpam
56 56
 define("USE_STOPFORUMSPAM", true);
@@ -191,15 +191,15 @@  discard block
 block discarded – undo
191 191
     </ol>", PROJECT);
192 192
 }
193 193
 
194
-function project_workunit($wu){
194
+function project_workunit($wu) {
195 195
     // shown in the workunit page
196 196
 }
197 197
 
198
-function project_user_summary($user){
198
+function project_user_summary($user) {
199 199
     // shown in the user summary page
200 200
 }
201 201
 
202
-function project_user_page_private($user){
202
+function project_user_page_private($user) {
203 203
     // shown in the private account page
204 204
 }
205 205
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
     array("name" => "Uppercase", "short_name" => "UC", "appids" => array(1, 25)),
283 283
 );
284 284
 
285
-function project_user_credit($user){
285
+function project_user_credit($user) {
286 286
     global $sub_projects;
287 287
     foreach ($sub_projects as $sp) {
288 288
         show_app_credit_user($user, $sp["name"], $sp["appids"]);
Please login to merge, or discard this patch.
html/inc/user.inc 2 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
         $user->id,
382 382
         $name
383 383
     );
384
-    if (function_exists("project_user_links")){
384
+    if (function_exists("project_user_links")) {
385 385
         $x .= project_user_links($user);
386 386
     }
387 387
     if ($badge_height) {
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 // Returns a cacheable community links data object
507 507
 // @param user The user to produce a community links object for
508 508
 
509
-function get_community_links_object($user){
509
+function get_community_links_object($user) {
510 510
     $cache_object = new StdClass;
511 511
     $cache_object->post_count = total_posts($user);
512 512
     $cache_object->user = $user;
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
     return $cache_object;
523 523
 }
524 524
 
525
-function community_links($clo, $logged_in_user){
525
+function community_links($clo, $logged_in_user) {
526 526
     $user = $clo->user;
527 527
     $team = $clo->team;
528 528
     $friends = $clo->friends;
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 // they've participated in
34 34
 //
35 35
 function get_other_projects($user) {
36
-    $cpid = md5($user->cross_project_id . $user->email_addr);
36
+    $cpid = md5($user->cross_project_id.$user->email_addr);
37 37
     $url = "http://boinc.netsoft-online.com/get_user.php?cpid=".$cpid;
38 38
 
39 39
     // Check the cache for that URL
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     }
172 172
 
173 173
     if (!NO_STATS) {
174
-        $cpid = md5($user->cross_project_id . $user->email_addr);
174
+        $cpid = md5($user->cross_project_id.$user->email_addr);
175 175
         $x = "";
176 176
         shuffle($cpid_stats_sites);
177 177
         foreach ($cpid_stats_sites as $site) {
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
         $u = normalize_user_url($user->url);
256 256
         row2(
257 257
             tra("URL"),
258
-            $u?sprintf('<a href="%s">%s</a>', $u, $u):tra('Invalid URL')
258
+            $u ?sprintf('<a href="%s">%s</a>', $u, $u) : tra('Invalid URL')
259 259
         );
260 260
     }
261 261
     if (USER_COUNTRY) {
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
     $x .= sprintf(
345 345
         '<a href="%s%s?userid=%d">%s</a>',
346 346
         url_base(),
347
-        defined('SHOW_USER_FILENAME')?SHOW_USER_FILENAME:'show_user.php',
347
+        defined('SHOW_USER_FILENAME') ?SHOW_USER_FILENAME:'show_user.php',
348 348
         $user->id,
349 349
         $user->name
350 350
     );
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 // if $badge_height is > 0, show badges
360 360
 // if $name_limit, limit name to N chars
361 361
 //
362
-function user_links($user, $badge_height=0, $name_limit=0) {
362
+function user_links($user, $badge_height = 0, $name_limit = 0) {
363 363
     BoincForumPrefs::lookup($user);
364 364
     if (is_banished($user)) {
365 365
         return "(banished: ID $user->id)";
@@ -383,17 +383,17 @@  discard block
 block discarded – undo
383 383
     $x .= sprintf(
384 384
         '<a href="%s%s?userid=%d">%s</a>',
385 385
         url_base(),
386
-        defined('SHOW_USER_FILENAME')?SHOW_USER_FILENAME:'show_user.php',
386
+        defined('SHOW_USER_FILENAME') ?SHOW_USER_FILENAME:'show_user.php',
387 387
         $user->id,
388 388
         $name
389 389
     );
390
-    if (function_exists("project_user_links")){
390
+    if (function_exists("project_user_links")) {
391 391
         $x .= project_user_links($user);
392 392
     }
393 393
     if ($badge_height) {
394 394
         $x .= badges_string(true, $user, $badge_height);
395 395
     }
396
-    return $name_limit?"<nobr>$x</nobr>":$x;
396
+    return $name_limit ? "<nobr>$x</nobr>" : $x;
397 397
 }
398 398
 
399 399
 function show_community_private($user) {
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 
441 441
             // if there's a foundership request, notify the founder
442 442
             //
443
-            if ($user->id==$team->userid && $team->ping_user >0) {
443
+            if ($user->id == $team->userid && $team->ping_user > 0) {
444 444
                 $x .= "<p class=\"text-danger\">".tra("(foundership change request pending)")."</p>";
445 445
             }
446 446
             row2(tra("Member of team"), $x);
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
     $x = "<a href=\"user_search.php\">".tra("Find friends")."</a><br/>\n";
466 466
     $n = count($friends);
467 467
     if ($n) {
468
-        foreach($friends as $friend) {
468
+        foreach ($friends as $friend) {
469 469
             $fuser = BoincUser::lookup_id($friend->user_dest);
470 470
             if (!$fuser) continue;
471 471
             $x .= friend_links($fuser);
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 // Returns a cacheable community links data object
513 513
 // @param user The user to produce a community links object for
514 514
 
515
-function get_community_links_object($user){
515
+function get_community_links_object($user) {
516 516
     $cache_object = new StdClass;
517 517
     $cache_object->post_count = total_posts($user);
518 518
     $cache_object->user = $user;
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
     $cache_object->friends = array();
521 521
 
522 522
     $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1");
523
-    foreach($friends as $friend) {
523
+    foreach ($friends as $friend) {
524 524
         $fuser = BoincUser::lookup_id($friend->user_dest);
525 525
         if (!$fuser) continue;
526 526
         $cache_object->friends[] = $fuser;
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
     return $cache_object;
529 529
 }
530 530
 
531
-function community_links($clo, $logged_in_user){
531
+function community_links($clo, $logged_in_user) {
532 532
     $user = $clo->user;
533 533
     $team = $clo->team;
534 534
     $friends = $clo->friends;
@@ -554,15 +554,15 @@  discard block
 block discarded – undo
554 554
                 "<a href=\"friend.php?action=cancel_confirm&userid=$user->id\">".tra("Cancel friendship")."</a>"
555 555
             );
556 556
         } else if ($friend) {
557
-            row2(tra("Friends"),  "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>");
557
+            row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>");
558 558
         } else {
559
-            row2(tra("Friends"),  "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>");
559
+            row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>");
560 560
         }
561 561
     }
562 562
 
563 563
     if ($friends) {
564 564
         $x = "";
565
-        foreach($friends as $friend) {
565
+        foreach ($friends as $friend) {
566 566
             $x .= friend_links($friend);
567 567
         }
568 568
         row2(tra("Friends")." (".sizeof($friends).")", $x);
@@ -606,6 +606,6 @@  discard block
 block discarded – undo
606 606
 }
607 607
 
608 608
 
609
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
609
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
610 610
 
611 611
 ?>
Please login to merge, or discard this patch.
html/inc/util.inc 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -33,17 +33,17 @@  discard block
 block discarded – undo
33 33
 //
34 34
 $config = get_config();
35 35
 global $master_url;
36
-$master_url = parse_config($config , "<master_url>");
36
+$master_url = parse_config($config, "<master_url>");
37 37
 $recaptcha_public_key = parse_config($config, "<recaptcha_public_key>");
38 38
 $recaptcha_private_key = parse_config($config, "<recaptcha_private_key>");
39 39
 
40 40
 // Set parameters to defaults if not defined in config.xml
41 41
 
42 42
 $x = parse_config($config, "<user_country>");
43
-define('USER_COUNTRY', ($x===null)?1:(int)$x);
43
+define('USER_COUNTRY', ($x === null) ? 1 : (int)$x);
44 44
 
45 45
 $x = parse_config($config, "<user_url>");
46
-define('USER_URL', ($x===null)?1:(int)$x);
46
+define('USER_URL', ($x === null) ? 1 : (int)$x);
47 47
 
48 48
 // Set parameters to defaults if not defined in project.inc
49 49
 
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
 }
140 140
 
141 141
 function url_base() {
142
-    return is_https()?secure_url_base():URL_BASE;
142
+    return is_https() ?secure_url_base() : URL_BASE;
143 143
 }
144 144
 
145
-function send_cookie($name, $value, $permanent, $ops=false) {
145
+function send_cookie($name, $value, $permanent, $ops = false) {
146 146
     global $master_url;
147 147
 
148 148
     // the following allows independent login for projects on the same server
@@ -153,11 +153,11 @@  discard block
 block discarded – undo
153 153
         $path = substr($path, 0, -1);
154 154
         $path .= "_ops/";
155 155
     }
156
-    $expire = $permanent?time()+3600*24*365:0;
156
+    $expire = $permanent ?time() + 3600*24*365 : 0;
157 157
     setcookie($name, $value, $expire, $path);
158 158
 }
159 159
 
160
-function clear_cookie($name, $ops=false) {
160
+function clear_cookie($name, $ops = false) {
161 161
     global $master_url;
162 162
     $url = parse_url($master_url);
163 163
     $path = $url['path'];
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
         $path = substr($path, 0, -1);
166 166
         $path .= "_ops/";
167 167
     }
168
-    setcookie($name, '', time()-3600, $path);
168
+    setcookie($name, '', time() - 3600, $path);
169 169
 }
170 170
 
171 171
 $g_logged_in_user = null;
172 172
 $got_logged_in_user = false;
173 173
 
174
-function get_logged_in_user($must_be_logged_in=true) {
174
+function get_logged_in_user($must_be_logged_in = true) {
175 175
     global $g_logged_in_user, $got_logged_in_user;
176 176
     if ($got_logged_in_user) {
177 177
         // this could have been called earlier with $must_be_logged_in false
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             $next_url = $_SERVER['REQUEST_URI'];
198 198
             $n = strrpos($next_url, "/");
199 199
             if ($n) {
200
-                $next_url = substr($next_url, $n+1);
200
+                $next_url = substr($next_url, $n + 1);
201 201
             }
202 202
         }
203 203
         $next_url = urlencode($next_url);
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     return $g_logged_in_user;
209 209
 }
210 210
 
211
-function show_login_info($prefix="") {
211
+function show_login_info($prefix = "") {
212 212
     $user = get_logged_in_user(false);
213 213
     if ($user) {
214 214
         $url_tokens = url_tokens($user->authenticator);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     }
219 219
 }
220 220
 
221
-$cache_control_extra="";
221
+$cache_control_extra = "";
222 222
 $is_login_page = false;
223 223
 
224 224
 // Call this to start pages.
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
 // with an existing web framework can more easily do so.
231 231
 // To do so, define page_head() in the project include file.
232 232
 //
233
-if (!function_exists("page_head")){
233
+if (!function_exists("page_head")) {
234 234
 function page_head(
235 235
     $title,
236 236
         // page title. Put in <title>, used as title for browser tab.
237
-    $body_attrs=null,
237
+    $body_attrs = null,
238 238
         // <body XXXX>
239 239
         // e.g. Javascript to put focus in an input field
240 240
         // (onload="document.form.foo.focus()")
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
         // if set, include schedulers.txt.
244 244
         // also pass to project_banner() in case you want a different
245 245
         // header for your main page.
246
-    $url_prefix="",
246
+    $url_prefix = "",
247 247
         // prepend this to links.
248 248
         // Use for web pages not in the top directory
249
-    $head_extra=null
249
+    $head_extra = null
250 250
         // extra stuff to put in <head>. E.g.:
251 251
         // reCAPTCHA code (create_profile.php)
252 252
         // bbcode javascript (forums)
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         header("Content-type: text/html; charset=utf-8");
269 269
         header("Expires: Mon, 26 Jul 1997 05:00:00 UTC");
270 270
             // Date in the past
271
-        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " UTC");
271
+        header("Last-Modified: ".gmdate("D, d M Y H:i:s")." UTC");
272 272
             // always modified
273 273
         header("Cache-Control: $cache_control_extra no-cache, must-revalidate, post-check=0, pre-check=0");
274 274
             // for HTTP/1.1
@@ -289,11 +289,11 @@  discard block
 block discarded – undo
289 289
     if ($head_extra) {
290 290
         echo "\n$head_extra\n";
291 291
     }
292
-    if ($is_main && (!defined('NO_COMPUTING')||!NO_COMPUTING)) {
292
+    if ($is_main && (!defined('NO_COMPUTING') || !NO_COMPUTING)) {
293 293
         readfile("schedulers.txt");
294 294
     }
295 295
 
296
-    $t = $title?$title:PROJECT;
296
+    $t = $title ? $title : PROJECT;
297 297
     echo "<title>$t</title>\n";
298 298
     echo '
299 299
         <meta charset="utf-8">
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
     echo '<div class="container-fluid">
351 351
     ';
352 352
 
353
-    switch($title) {    //kludge
353
+    switch ($title) {    //kludge
354 354
     case tra("Log in"):
355 355
     case tra("Create an account"):
356 356
     case tra("Server status page"):
@@ -365,13 +365,13 @@  discard block
 block discarded – undo
365 365
 
366 366
 // See the comments for page_head()
367 367
 //
368
-if (!function_exists("page_tail")){
368
+if (!function_exists("page_tail")) {
369 369
 function page_tail(
370
-    $show_date=false,
370
+    $show_date = false,
371 371
         // true for pages that are generated periodically rather than on the fly
372
-    $url_prefix="",
372
+    $url_prefix = "",
373 373
         // use for pages not at top level
374
-    $is_main=false
374
+    $is_main = false
375 375
         // passed to project_footer;
376 376
 ) {
377 377
     echo "<br>\n";
@@ -386,10 +386,10 @@  discard block
 block discarded – undo
386 386
 }
387 387
 }
388 388
 
389
-function display_cvs_versions(){
389
+function display_cvs_versions() {
390 390
     global $cvs_version_tracker;
391 391
     echo "\n<!-- SVN VERSIONS -->\n";
392
-    for ($i=0;$i<sizeof($cvs_version_tracker);$i++) {
392
+    for ($i = 0; $i < sizeof($cvs_version_tracker); $i++) {
393 393
         echo "<!-- ".$cvs_version_tracker[$i]." -->\n";
394 394
     }
395 395
 }
@@ -414,24 +414,24 @@  discard block
 block discarded – undo
414 414
 // convert time interval in seconds to a string of the form
415 415
 // 'D days h hours m min s sec'.
416 416
 
417
-function time_diff($x, $res=3) {
417
+function time_diff($x, $res = 3) {
418 418
     $x = (int)$x;
419 419
     $days    = (int)($x/86400);
420
-    $hours   = (int)(($x-$days*86400)/3600);
421
-    $minutes = (int)(($x-$days*86400-$hours*3600)/60);
422
-    $seconds = $x % 60;
420
+    $hours   = (int)(($x - $days*86400)/3600);
421
+    $minutes = (int)(($x - $days*86400 - $hours*3600)/60);
422
+    $seconds = $x%60;
423 423
 
424 424
     $s = "";
425 425
     if ($days) {
426 426
         $s .= "$days ".tra("days")." ";
427 427
     }
428
-    if ($res>0 && ($hours || strlen($s))) {
428
+    if ($res > 0 && ($hours || strlen($s))) {
429 429
         $s .= "$hours ".tra("hours")." ";
430 430
     }
431
-    if ($res>1 && ($minutes || strlen($s))) {
431
+    if ($res > 1 && ($minutes || strlen($s))) {
432 432
         $s .= "$minutes ".tra("min")." ";
433 433
     }
434
-    if ($res>2) {
434
+    if ($res > 2) {
435 435
         $s .= "$seconds ".tra("sec")." ";
436 436
     }
437 437
     return $s;
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 
446 446
 function time_str($x) {
447 447
     if ($x == 0) return "---";
448
-    return gmdate('j M Y, G:i:s', (int)$x) . " UTC";
448
+    return gmdate('j M Y, G:i:s', (int)$x)." UTC";
449 449
 }
450 450
 
451 451
 function local_time_str($x) {
@@ -457,14 +457,14 @@  discard block
 block discarded – undo
457 457
     return time_str($x);
458 458
 }
459 459
 
460
-function start_table_str($class="", $style="") {
461
-    $s = $style?'style="'.$style.'"':'';
460
+function start_table_str($class = "", $style = "") {
461
+    $s = $style ? 'style="'.$style.'"' : '';
462 462
     return '<div class="table">
463 463
       <table '.$s.' width="100%" class="table table-condensed '.$class.'" >
464 464
     ';
465 465
 }
466 466
 
467
-function start_table($class="", $style="") {
467
+function start_table($class = "", $style = "") {
468 468
     echo start_table_str($class, $style);
469 469
 }
470 470
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
     echo "</tr>\n";
510 510
 }
511 511
 
512
-function row1($x, $ncols=2, $class="heading") {
512
+function row1($x, $ncols = 2, $class = "heading") {
513 513
     if ($class == "heading") {
514 514
         echo "<tr><th class=\"bg-primary\" colspan=\"$ncols\">$x</th></tr>\n";
515 515
     } else {
@@ -523,10 +523,10 @@  discard block
 block discarded – undo
523 523
 
524 524
 // a table row with 2 columns, with the left on right-aligned
525 525
 
526
-function row2($x, $y, $show_error=false, $lwidth='40%') {
527
-    if ($x==="") $x="<br>";
528
-    if ($y==="") $y="<br>";
529
-    $attrs = $show_error?VALUE_ATTRS_ERR:VALUE_ATTRS;
526
+function row2($x, $y, $show_error = false, $lwidth = '40%') {
527
+    if ($x === "") $x = "<br>";
528
+    if ($y === "") $y = "<br>";
529
+    $attrs = $show_error ?VALUE_ATTRS_ERR:VALUE_ATTRS;
530 530
     echo "<tr>
531 531
         <td width=\"$lwidth\" ".NAME_ATTRS.">$x</td>
532 532
         <td $attrs >$y</td>
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 // output the first part of row2();
538 538
 // then write the content, followed by </td></tr>
539 539
 
540
-function row2_init($x, $lwidth='40%') {
540
+function row2_init($x, $lwidth = '40%') {
541 541
     echo sprintf('<tr>
542 542
         <td width="%s" %s>%s</td>
543 543
         <td %s>',
@@ -553,31 +553,31 @@  discard block
 block discarded – undo
553 553
     echo "<tr><td>$string</td></tr>";
554 554
 }
555 555
 
556
-function row_array($x, $attrs=null) {
556
+function row_array($x, $attrs = null) {
557 557
     echo "<tr>\n";
558 558
     $i = 0;
559 559
     foreach ($x as $h) {
560
-        $a = $attrs?$attrs[$i]:"";
560
+        $a = $attrs ? $attrs[$i] : "";
561 561
         echo "<td $a>$h</td>\n";
562 562
         $i++;
563 563
     }
564 564
     echo "</tr>\n";
565 565
 }
566 566
 
567
-define ('ALIGN_RIGHT', 'style="text-align:right;"');
567
+define('ALIGN_RIGHT', 'style="text-align:right;"');
568 568
 
569
-function row_heading_array($x, $attrs=null, $class='bg-primary') {
569
+function row_heading_array($x, $attrs = null, $class = 'bg-primary') {
570 570
     echo "<tr>";
571 571
     $i = 0;
572 572
     foreach ($x as $h) {
573
-        $a = $attrs?$attrs[$i]:"";
573
+        $a = $attrs ? $attrs[$i] : "";
574 574
         echo "<th $a class=\"$class\">$h</th>";
575 575
         $i++;
576 576
     }
577 577
     echo "</tr>\n";
578 578
 }
579 579
 
580
-function row_heading($x, $class='bg-primary') {
580
+function row_heading($x, $class = 'bg-primary') {
581 581
     echo sprintf('<tr><th class="%s" colspan=99>%s</th></tr>
582 582
         ', $class, $x
583 583
     );
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 // If $ellipsis is true, then an ellipsis is added to any sentence which
638 638
 // is cut short.
639 639
 
640
-function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis=false) {
640
+function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis = false) {
641 641
     $words = explode($delimiter, $sentence);
642 642
     $total_chars = 0;
643 643
     $trunc = false;
@@ -720,8 +720,8 @@  discard block
 block discarded – undo
720 720
 
721 721
 // returns null if the arg is optional and missing
722 722
 //
723
-function get_int($name, $optional=false) {
724
-    $x=null;
723
+function get_int($name, $optional = false) {
724
+    $x = null;
725 725
     if (isset($_GET[$name])) $x = $_GET[$name];
726 726
     if (!is_numeric($x)) {
727 727
         if ($optional) {
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 
741 741
 // returns null if the arg is optional and missing
742 742
 //
743
-function post_num($name, $optional=false) {
743
+function post_num($name, $optional = false) {
744 744
     $x = null;
745 745
     if (isset($_POST[$name])) $x = $_POST[$name];
746 746
     if (!is_numeric($x)) {
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 
756 756
 // returns null if the arg is optional and missing
757 757
 //
758
-function post_int($name, $optional=false) {
758
+function post_int($name, $optional = false) {
759 759
     $x = post_num($name, $optional);
760 760
     if (is_null($x)) return null;
761 761
     $y = (int)$x;
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
     }
774 774
 }
775 775
 
776
-function get_str($name, $optional=false) {
776
+function get_str($name, $optional = false) {
777 777
     if (isset($_GET[$name])) {
778 778
         $x = $_GET[$name];
779 779
     } else {
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
     return undo_magic_quotes($x);
786 786
 }
787 787
 
788
-function post_str($name, $optional=false) {
788
+function post_str($name, $optional = false) {
789 789
     if (isset($_POST[$name])) {
790 790
         $x = $_POST[$name];
791 791
     } else {
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
     return undo_magic_quotes($x);
798 798
 }
799 799
 
800
-function post_arr($name, $optional=false) {
800
+function post_arr($name, $optional = false) {
801 801
     if (isset($_POST[$name]) && is_array($_POST[$name])) {
802 802
         $x = $_POST[$name];
803 803
     } else {
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
     // the mb_* functions are not included by default
814 814
     // return (mb_detect_encoding($passwd) -= 'ASCII');
815 815
 
816
-    for ($i=0; $i<strlen($str); $i++) {
816
+    for ($i = 0; $i < strlen($str); $i++) {
817 817
         $c = ord(substr($str, $i));
818 818
         if ($c < 32 || $c > 127) return false;
819 819
     }
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
     $number = str_replace(',', '.', $number); // replace the german decimal separator
838 838
     // if no value was entered and this is ok
839 839
     //
840
-    if ($number=='' && !$low) return true;
840
+    if ($number == '' && !$low) return true;
841 841
 
842 842
     // the supplied value contains alphabetic characters
843 843
     //
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 
855 855
 // Generate a "select" element from an array of values
856 856
 //
857
-function select_from_array($name, $array, $selection=null, $width=240) {
857
+function select_from_array($name, $array, $selection = null, $width = 240) {
858 858
     $out = '<select style="color:#000;"class="form-control input-sm" style="width:'.$width.'px" name="'.$name.'">"';
859 859
 
860 860
     foreach ($array as $key => $value) {
@@ -879,8 +879,8 @@  discard block
 block discarded – undo
879 879
     return $str;
880 880
 }
881 881
 
882
-function strip_bbcode($string){
883
-    return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string);
882
+function strip_bbcode($string) {
883
+    return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/", "", $string);
884 884
 }
885 885
 
886 886
 function current_url() {
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
 // @params extra Additional text in href tag
910 910
 //
911 911
 
912
-function button_text($url, $text, $desc=null, $class=null, $extra='') {
912
+function button_text($url, $text, $desc = null, $class = null, $extra = '') {
913 913
     if (!$desc) {
914 914
         $desc = $text;
915 915
     }
@@ -921,19 +921,19 @@  discard block
 block discarded – undo
921 921
     );
922 922
 }
923 923
 
924
-function show_button($url, $text, $desc=null, $class=null, $extra=null) {
924
+function show_button($url, $text, $desc = null, $class = null, $extra = null) {
925 925
     echo button_text($url, $text, $desc, $class, $extra);
926 926
 }
927 927
 
928 928
 // for places with a bunch of buttons, like forum posts
929 929
 //
930
-function show_button_small($url, $text, $desc=null) {
930
+function show_button_small($url, $text, $desc = null) {
931 931
     echo button_text($url, $text, $desc, "btn-primary btn-xs");
932 932
 }
933 933
 
934 934
 // used for showing icons
935 935
 //
936
-function show_image($src, $title, $alt, $height=null) {
936
+function show_image($src, $title, $alt, $height = null) {
937 937
     $h = "";
938 938
     if ($height) {
939 939
         $h = "height=\"$height\"";
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
 // tries instead to connect to <replica_db_host> if tag exists.
971 971
 // DEPRECATED - use boinc_db.inc
972 972
 //
973
-function db_init($try_replica=false) {
973
+function db_init($try_replica = false) {
974 974
     check_web_stopped();
975 975
     $retval = db_init_aux($try_replica);
976 976
     if ($retval == 1) {
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
 // Check this to avoid XSS vulnerability
1087 1087
 //
1088 1088
 function sanitize_sort_by($x) {
1089
-    switch($x) {
1089
+    switch ($x) {
1090 1090
     case 'expavg_credit':
1091 1091
     case 'total_credit':
1092 1092
         return;
@@ -1103,9 +1103,9 @@  discard block
 block discarded – undo
1103 1103
     return $c/(200/24);
1104 1104
 }
1105 1105
 
1106
-function do_download($path,$name="") {
1107
-    if (strcmp($name,"") == 0) {
1108
-        $name=basename($path);
1106
+function do_download($path, $name = "") {
1107
+    if (strcmp($name, "") == 0) {
1108
+        $name = basename($path);
1109 1109
     }
1110 1110
     header('Content-Description: File Transfer');
1111 1111
     header('Content-Type: application/octet-stream');
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
     header('Expires: 0');
1115 1115
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
1116 1116
     header('Pragma: public');
1117
-    header('Content-Length: ' . filesize($path));
1117
+    header('Content-Length: '.filesize($path));
1118 1118
     flush();
1119 1119
     readfile($path);
1120 1120
 }
@@ -1163,10 +1163,10 @@  discard block
 block discarded – undo
1163 1163
 // Otherwise return 0.
1164 1164
 // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)"
1165 1165
 //
1166
-function boinc_client_version(){
1166
+function boinc_client_version() {
1167 1167
     if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0;
1168 1168
     $x = $_SERVER['HTTP_USER_AGENT'];
1169
-    $e =  "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/";
1169
+    $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/";
1170 1170
     if (preg_match($e, $x, $matches)) {
1171 1171
         return $matches[1]*10000 + $matches[2]*100 + $matches[3];
1172 1172
     }
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
     $rem_name = $name."_remaining";
1196 1196
     return "<textarea name=\"$name\" class=\"form-control\" rows=3 id=\"$name\" onkeydown=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\"
1197 1197
         onkeyup=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\">".$text."</textarea>
1198
-        <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen-strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining")
1198
+        <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen - strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining")
1199 1199
     ;
1200 1200
 }
1201 1201
 
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
 // use the following around text with long lines,
1226 1226
 // to limit the width and make it more readable.
1227 1227
 //
1228
-function text_start($width=640) {
1228
+function text_start($width = 640) {
1229 1229
     echo sprintf("<div style=\"max-width: %dpx;\">\n", $width);
1230 1230
 }
1231 1231
 function text_end() {
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
 }
1252 1252
 
1253 1253
 function cert_filename() {
1254
-    return defined("CERT_FILENAME")?CERT_FILENAME:"cert1.php";
1254
+    return defined("CERT_FILENAME") ?CERT_FILENAME:"cert1.php";
1255 1255
 }
1256 1256
 
1257 1257
 // if user hasn't validated their email addr, tell them to
@@ -1268,6 +1268,6 @@  discard block
 block discarded – undo
1268 1268
     }
1269 1269
 }
1270 1270
 
1271
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
1271
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
1272 1272
 
1273 1273
 ?>
Please login to merge, or discard this patch.
html/inc/pm.inc 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     return $x;
49 49
 }
50 50
 
51
-function pm_team_form($user, $teamid, $error=null) {
51
+function pm_team_form($user, $teamid, $error = null) {
52 52
     global $bbcode_html, $bbcode_js;
53 53
     $team = BoincTeam::lookup_id($teamid);
54 54
     if (!$team) {
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         error_page("not admin");
59 59
     }
60 60
 
61
-    page_head(tra("Send message to team"),'','','', $bbcode_js);
61
+    page_head(tra("Send message to team"), '', '', '', $bbcode_js);
62 62
 
63 63
     $subject = post_str("subject", true);
64 64
     $content = post_str("content", true);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 function pm_form($replyto, $userid, $error = null) {
103 103
     global $bbcode_html, $bbcode_js;
104 104
     global $g_logged_in_user;
105
-    page_head(tra("Send private message"),'','','', $bbcode_js);
105
+    page_head(tra("Send private message"), '', '', '', $bbcode_js);
106 106
 
107 107
     if (post_str("preview", true) == tra("Preview")) {
108 108
         $content = post_str("content", true);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         if (!$user) {
127 127
             error_page("Sender no longer exists");
128 128
         }
129
-        $writeto = UNIQUE_USER_NAME?$user->name:$userid." (".$user->name.")";
129
+        $writeto = UNIQUE_USER_NAME ? $user->name : $userid." (".$user->name.")";
130 130
         $subject = $message->subject;
131 131
         if (substr($subject, 0, 3) != "re:") {
132 132
             $subject = "re: ".$subject;
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         if (!$user) {
137 137
             error_page("Sender no longer exists");
138 138
         }
139
-        $writeto = UNIQUE_USER_NAME?$user->name:$userid." (".$user->name.")";
139
+        $writeto = UNIQUE_USER_NAME ? $user->name : $userid." (".$user->name.")";
140 140
     } else {
141 141
         $writeto = sanitize_tags(post_str("to", true));
142 142
         $subject = post_str("subject", true);
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 function send_pm_notification_email(
190 190
     $logged_in_user, $to_user, $subject, $content
191 191
 ) {
192
-    $message  = "
192
+    $message = "
193 193
 You have received a new private message at ".PROJECT.".
194 194
 
195 195
 From: $logged_in_user->name (ID $logged_in_user->id)
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     $pm = BoincPrivateMessage::lookup_id($notify->opaque);
220 220
     $from_user = BoincUser::lookup_id($pm->senderid);
221 221
     if (!$pm || !$from_user) return null;
222
-    return "<a href=pm.php>".tra("Private message%1 from %2, subject:" , "</a>", $from_user->name )." $pm->subject";
222
+    return "<a href=pm.php>".tra("Private message%1 from %2, subject:", "</a>", $from_user->name)." $pm->subject";
223 223
 }
224 224
 
225 225
 function pm_send_msg($from_user, $to_user, $subject, $content, $send_email) {
@@ -283,11 +283,11 @@  discard block
 block discarded – undo
283 283
 
284 284
 function pm_email_remind($user) {
285 285
     if (!$user->prefs->pm_notification) {
286
-        return "<br><small>" .
286
+        return "<br><small>".
287 287
             tra(
288 288
                 "For email notification, %1 edit community prefs %2",
289 289
                 '<a href="edit_forum_preferences_form.php">', '</a>'
290
-            ) .
290
+            ).
291 291
             "</small>"
292 292
         ;
293 293
     }
@@ -313,5 +313,5 @@  discard block
 block discarded – undo
313 313
     }
314 314
 }
315 315
 
316
-$cvs_version_tracker[]="\$Id: pm.inc 14019 2007-11-01 23:04:39Z davea $";
316
+$cvs_version_tracker[] = "\$Id: pm.inc 14019 2007-11-01 23:04:39Z davea $";
317 317
 ?>
Please login to merge, or discard this patch.
html/inc/forum.inc 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -811,9 +811,9 @@  discard block
 block discarded – undo
811 811
 function post_rules() {
812 812
     if (defined('FORUM_RULES')) return FORUM_RULES;
813 813
     if (function_exists("project_forum_post_rules")) {
814
-      $project_rules=project_forum_post_rules();
814
+        $project_rules=project_forum_post_rules();
815 815
     } else {
816
-      $project_rules="";
816
+        $project_rules="";
817 817
     }
818 818
     return sprintf("
819 819
         <ul>
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
     }
1279 1279
     if ($thread->hidden) {
1280 1280
         error_page(
1281
-           tra("Can't post to a hidden thread.")
1281
+            tra("Can't post to a hidden thread.")
1282 1282
         );
1283 1283
     }
1284 1284
 
Please login to merge, or discard this patch.
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 define('THREAD_SOLVED', 1);
55 55
 
56 56
 define('AVATAR_WIDTH', 100);
57
-define('AVATAR_HEIGHT',100);
57
+define('AVATAR_HEIGHT', 100);
58 58
 
59 59
 define('ST_NEW_TIME', 1209600); //3600*24*14 - 14 days
60 60
 define('ST_NEW', 'New member');
61 61
 
62
-define('MAXIMUM_EDIT_TIME',3600);
62
+define('MAXIMUM_EDIT_TIME', 3600);
63 63
     // allow edits of forums posts up till one hour after posting.
64 64
 
65 65
 define('MAX_FORUM_LOGGING_TIME', 2419200); //3600*24*28 - 28 days
@@ -77,24 +77,24 @@  discard block
 block discarded – undo
77 77
 define('IMAGE_HIDDEN', 'img/hidden.png');
78 78
 define('IMAGE_STICKY_LOCKED', 'img/sticky_locked_post.png');
79 79
 define('IMAGE_POST', 'img/post.png');
80
-define('NEW_IMAGE_HEIGHT','15');
80
+define('NEW_IMAGE_HEIGHT', '15');
81 81
 define('EMPHASIZE_IMAGE', 'img/emphasized_post.png');
82
-define('EMPHASIZE_IMAGE_HEIGHT','15');
82
+define('EMPHASIZE_IMAGE_HEIGHT', '15');
83 83
 define('FILTER_IMAGE', 'img/filtered_post.png');
84
-define('FILTER_IMAGE_HEIGHT','15');
84
+define('FILTER_IMAGE_HEIGHT', '15');
85 85
 define('RATE_POSITIVE_IMAGE', 'img/rate_positive.png');
86
-define('RATE_POSITIVE_IMAGE_HEIGHT','9');
86
+define('RATE_POSITIVE_IMAGE_HEIGHT', '9');
87 87
 define('RATE_NEGATIVE_IMAGE', 'img/rate_negative.png');
88
-define('RATE_NEGATIVE_IMAGE_HEIGHT','9');
88
+define('RATE_NEGATIVE_IMAGE_HEIGHT', '9');
89 89
 define('REPORT_POST_IMAGE', 'img/report_post.png');
90
-define('REPORT_POST_IMAGE_HEIGHT','9');
90
+define('REPORT_POST_IMAGE_HEIGHT', '9');
91 91
 
92 92
 define('SOLUTION', tra('This answered my question'));
93 93
 define('SUFFERER', tra('I also have this question'));
94 94
 define('OFF_TOPIC', tra('Off-topic'));
95 95
 
96
-define ('DEFAULT_LOW_RATING_THRESHOLD', -25);
97
-define ('DEFAULT_HIGH_RATING_THRESHOLD', 5);
96
+define('DEFAULT_LOW_RATING_THRESHOLD', -25);
97
+define('DEFAULT_HIGH_RATING_THRESHOLD', 5);
98 98
 
99 99
 // special user attributes
100 100
 //
@@ -164,15 +164,15 @@  discard block
 block discarded – undo
164 164
 
165 165
 // Output the forum/thread title.
166 166
 //
167
-function show_forum_title($category, $forum, $thread, $link_thread=false) {
167
+function show_forum_title($category, $forum, $thread, $link_thread = false) {
168 168
     if ($category) {
169 169
         $is_helpdesk = $category->is_helpdesk;
170 170
     } else {
171 171
         $is_helpdesk = false;
172 172
     }
173 173
 
174
-    $where = $is_helpdesk?tra("Questions and Answers"):tra("Message boards");
175
-    $top_url = $is_helpdesk?"forum_help_desk.php":"forum_index.php";
174
+    $where = $is_helpdesk ?tra("Questions and Answers") : tra("Message boards");
175
+    $top_url = $is_helpdesk ? "forum_help_desk.php" : "forum_index.php";
176 176
 
177 177
     if (!$forum && !$thread) {
178 178
         echo "<span class=\"title\">$where</span>\n";
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
     }
201 201
 }
202 202
 
203
-function show_team_forum_title($forum, $thread=null, $link_thread=false) {
203
+function show_team_forum_title($forum, $thread = null, $link_thread = false) {
204 204
     $team = BoincTeam::lookup_id($forum->category);
205 205
     echo "<span class=title>
206 206
         <a href=\"forum_index.php\">".tra("Message boards")."</a> :
@@ -233,12 +233,12 @@  discard block
 block discarded – undo
233 233
 }
234 234
 
235 235
 function page_link($url, $page_num, $items_per_page, $text) {
236
-    return " <a href=\"$url&amp;start=" . $page_num*$items_per_page . "\">$text</a> ";
236
+    return " <a href=\"$url&amp;start=".$page_num*$items_per_page."\">$text</a> ";
237 237
 }
238 238
 
239 239
 // return a string for navigating pages
240 240
 //
241
-function page_links($url, $nitems, $items_per_page, $start){
241
+function page_links($url, $nitems, $items_per_page, $start) {
242 242
     // How many pages to potentially show before and after this one:
243 243
     $preshow = 3;
244 244
     $postshow = 3;
@@ -246,14 +246,14 @@  discard block
 block discarded – undo
246 246
     $x = "";
247 247
 
248 248
     if ($nitems <= $items_per_page) return "";
249
-    $npages = ceil($nitems / $items_per_page);
250
-    $curpage = ceil($start / $items_per_page);
249
+    $npages = ceil($nitems/$items_per_page);
250
+    $curpage = ceil($start/$items_per_page);
251 251
 
252 252
     // If this is not the first page, display "previous"
253 253
     //
254
-    if ($curpage > 0){
254
+    if ($curpage > 0) {
255 255
         $x .= page_link(
256
-            $url, $curpage-1, $items_per_page,
256
+            $url, $curpage - 1, $items_per_page,
257 257
             tra("Previous")." &middot; "
258 258
         );
259 259
     }
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
     }
269 269
     // Display a list of pages surrounding this one
270 270
     //
271
-    for ($i=$curpage-$preshow; $i<=$curpage+$postshow; $i++){
272
-        $page_str = (string)($i+1);
271
+    for ($i = $curpage - $preshow; $i <= $curpage + $postshow; $i++) {
272
+        $page_str = (string)($i + 1);
273 273
         if ($i < 0) continue;
274 274
         if ($i >= $npages) break;
275 275
 
@@ -278,20 +278,20 @@  discard block
 block discarded – undo
278 278
         } else {
279 279
             $x .= page_link($url, $i, $items_per_page, $page_str);
280 280
         }
281
-        if ($i == $npages-1) break;
282
-        if ($i == $curpage+$postshow) break;
281
+        if ($i == $npages - 1) break;
282
+        if ($i == $curpage + $postshow) break;
283 283
         $x .= " &middot; ";
284 284
     }
285 285
 
286
-    if ($curpage + $postshow < $npages-1) {
286
+    if ($curpage + $postshow < $npages - 1) {
287 287
         $x .= " . . . ";
288
-        $x .= page_link($url, $npages-1, $items_per_page, $npages);
288
+        $x .= page_link($url, $npages - 1, $items_per_page, $npages);
289 289
     }
290 290
     // If there is a next page
291 291
     //
292
-    if ($curpage < $npages-1){
292
+    if ($curpage < $npages - 1) {
293 293
         $x .= page_link(
294
-            $url, $curpage+1, $items_per_page,
294
+            $url, $curpage + 1, $items_per_page,
295 295
             " &middot; ".tra("Next")
296 296
         );
297 297
     }
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 function cleanup_title($title) {
313 313
     $x = sanitize_tags(bb2html($title));
314 314
     $x = trim($x);
315
-    if (strlen($x)==0) return "(no title)";
315
+    if (strlen($x) == 0) return "(no title)";
316 316
     else return $x;
317 317
 }
318 318
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
             $i = 0;
375 375
             foreach ($posts as $post) {
376 376
                 if ($post->id == $postid) {
377
-                    $start = $i - ($i % $num_to_show);
377
+                    $start = $i - ($i%$num_to_show);
378 378
                     $jump_to_post = $post;
379 379
                     break;
380 380
                 }
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
             // if jump to post, figure out what page to show
402 402
             //
403 403
             if ($jump_to_post) {
404
-                $start = $ibest - ($ibest % $num_to_show);
404
+                $start = $ibest - ($ibest%$num_to_show);
405 405
             } else {
406 406
                 $start = $default_start;
407 407
             }
@@ -509,8 +509,8 @@  discard block
 block discarded – undo
509 509
 // Generates a table row with two cells: author and message
510 510
 //
511 511
 function show_post(
512
-    $post, $thread, $forum, $logged_in_user, $start=0,
513
-    $latest_viewed=0, $controls=FORUM_CONTROLS, $filter=true
512
+    $post, $thread, $forum, $logged_in_user, $start = 0,
513
+    $latest_viewed = 0, $controls = FORUM_CONTROLS, $filter = true
514 514
 ) {
515 515
     global $country_to_iso3166_2;
516 516
 
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 
519 519
     // If the user no longer exists, skip the post
520 520
     //
521
-    if (!$user){
521
+    if (!$user) {
522 522
         return;
523 523
     }
524 524
 
@@ -539,9 +539,9 @@  discard block
 block discarded – undo
539 539
     // check whether the poster is on the list of people to ignore
540 540
     //
541 541
     $ignore_poster = false;
542
-    if ($logged_in_user){
542
+    if ($logged_in_user) {
543 543
         $tokens = url_tokens($logged_in_user->authenticator);
544
-        if (is_ignoring($logged_in_user, $user)){
544
+        if (is_ignoring($logged_in_user, $user)) {
545 545
             $ignore_poster = true;
546 546
         }
547 547
     }
@@ -555,8 +555,8 @@  discard block
 block discarded – undo
555 555
             if (is_moderator($logged_in_user, $forum)) {
556 556
                 $can_edit = true;
557 557
             } else if (can_reply($thread, $forum, $logged_in_user)) {
558
-                $time_limit = $post->timestamp+MAXIMUM_EDIT_TIME;
559
-                $can_edit = time()<$time_limit;
558
+                $time_limit = $post->timestamp + MAXIMUM_EDIT_TIME;
559
+                $can_edit = time() < $time_limit;
560 560
             } else {
561 561
                 $can_edit = false;
562 562
             }
@@ -566,24 +566,24 @@  discard block
 block discarded – undo
566 566
     // Print the special user lines, if any
567 567
     //
568 568
     global $special_user_bitfield;
569
-    $fstatus="";
569
+    $fstatus = "";
570 570
     $keys = array_keys($special_user_bitfield);
571 571
     $is_posted_by_special = false;
572
-    for ($i=0; $i<sizeof($special_user_bitfield);$i++) {
572
+    for ($i = 0; $i < sizeof($special_user_bitfield); $i++) {
573 573
         if ($user->prefs && $user->prefs->privilege($keys[$i])) {
574
-            $fstatus.="<nobr>".$special_user_bitfield[$keys[$i]]."<nobr><br>";
574
+            $fstatus .= "<nobr>".$special_user_bitfield[$keys[$i]]."<nobr><br>";
575 575
             $is_posted_by_special = true;
576 576
         }
577 577
     }
578 578
 
579 579
     // Highlight special users if set in prefs;
580 580
     //
581
-    if ($logged_in_user && $logged_in_user->prefs){
581
+    if ($logged_in_user && $logged_in_user->prefs) {
582 582
         $highlight = $logged_in_user->prefs->highlight_special && $is_posted_by_special;
583 583
     } else {
584 584
         $highlight = $is_posted_by_special;
585 585
     }
586
-    $class = $highlight?' style="border-left: 5px solid LightGreen" ':'';
586
+    $class = $highlight ? ' style="border-left: 5px solid LightGreen" ' : '';
587 587
 
588 588
     // row and start of author col
589 589
     //
@@ -595,12 +595,12 @@  discard block
 block discarded – undo
595 595
 
596 596
     echo user_links($user, 0, 30);
597 597
     echo "<br>";
598
-    if ($user->create_time > time()-ST_NEW_TIME) $fstatus.=ST_NEW."<br>";
598
+    if ($user->create_time > time() - ST_NEW_TIME) $fstatus .= ST_NEW."<br>";
599 599
     echo "<span class=\"small\">";
600 600
     if ($fstatus) echo "$fstatus";
601 601
 
602
-    if (!$filter || !$ignore_poster){
603
-        if ($user->prefs && $user->prefs->avatar!="" && (!$logged_in_user || ($logged_in_user->prefs->hide_avatars==false))) {
602
+    if (!$filter || !$ignore_poster) {
603
+        if ($user->prefs && $user->prefs->avatar != "" && (!$logged_in_user || ($logged_in_user->prefs->hide_avatars == false))) {
604 604
             echo "<img width=\"".AVATAR_WIDTH."\" height=\"".AVATAR_HEIGHT."\" src=\"".avatar_url($user->prefs->avatar)."\" alt=\"Avatar\"><br>";
605 605
         }
606 606
     }
@@ -608,14 +608,14 @@  discard block
 block discarded – undo
608 608
 
609 609
     $url = "pm.php?action=new&amp;userid=".$user->id;
610 610
     $name = $user->name;
611
-    show_button_small($url, tra("Send message"), tra("Send %1 a private message",$name));
611
+    show_button_small($url, tra("Send message"), tra("Send %1 a private message", $name));
612 612
     echo '<br>'.tra("Joined: %1", gmdate('j M y', $user->create_time)), "<br>";
613 613
 
614 614
     if (!isset($user->nposts)) {
615 615
         $user->nposts = BoincPost::count("user=$user->id");
616 616
     }
617 617
 
618
-    if (function_exists('project_forum_user_info')){
618
+    if (function_exists('project_forum_user_info')) {
619 619
         project_forum_user_info($user);
620 620
     } else {
621 621
         echo tra("Posts: %1", $user->nposts)."<br>";
@@ -624,8 +624,8 @@  discard block
 block discarded – undo
624 624
         //
625 625
         //echo "ID: ".$user->id."<br>";
626 626
         if (!NO_COMPUTING) {
627
-            echo tra("Credit: %1", number_format($user->total_credit)) ."<br>";
628
-            echo tra("RAC: %1",    number_format($user->expavg_credit))."<br>";
627
+            echo tra("Credit: %1", number_format($user->total_credit))."<br>";
628
+            echo tra("RAC: %1", number_format($user->expavg_credit))."<br>";
629 629
         }
630 630
 
631 631
         // to use this feature:
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
         echo "<form action=\"forum_rate.php?post=", $post->id, "\" method=\"post\">";
655 655
     }
656 656
 
657
-    if ($logged_in_user && $post->timestamp > $latest_viewed){
657
+    if ($logged_in_user && $post->timestamp > $latest_viewed) {
658 658
         show_image(NEW_IMAGE, tra("You haven't read this message yet"), tra("Unread"), NEW_IMAGE_HEIGHT);
659 659
     }
660 660
 
@@ -674,8 +674,8 @@  discard block
 block discarded – undo
674 674
     if ($post->modified) {
675 675
         echo "<br>".tra("Last modified: %1", pretty_time_Str($post->modified));
676 676
     }
677
-    if ($ignore_poster && $filter){
678
-        echo "<br>" .tra(
677
+    if ($ignore_poster && $filter) {
678
+        echo "<br>".tra(
679 679
             "This post is hidden because the sender is on your 'ignore' list.  Click %1 here %2 to view hidden posts",
680 680
             "<a href=\"?id=".$thread->id."&amp;filter=false&amp;start=$start#".$post->id."\">",
681 681
             "</a>"
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
         <p>
689 689
     ";
690 690
 
691
-    if (!$filter || !$ignore_poster){
691
+    if (!$filter || !$ignore_poster) {
692 692
         $posttext = $post->content;
693 693
 
694 694
         // If the creator of this post has a signature and
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
         // user has signatures enabled: show it
697 697
         //
698 698
         $posttext = output_transform($posttext, $options);
699
-        if ($post->signature && (!$logged_in_user || !$logged_in_user->prefs->hide_signatures)){
699
+        if ($post->signature && (!$logged_in_user || !$logged_in_user->prefs->hide_signatures)) {
700 700
             $sig = output_transform($user->prefs->signature, $options);
701 701
             $posttext .= "<hr>$sig\n";
702 702
         }
@@ -730,10 +730,10 @@  discard block
 block discarded – undo
730 730
         }
731 731
         if (($controls == FORUM_CONTROLS) && (can_reply($thread, $forum, $logged_in_user))) {
732 732
             echo "&nbsp;&nbsp;&nbsp;&nbsp;";
733
-            $url = "forum_reply.php?thread=" . $thread->id . "&amp;post=" . $post->id . "&amp;no_quote=1#input";
733
+            $url = "forum_reply.php?thread=".$thread->id."&amp;post=".$post->id."&amp;no_quote=1#input";
734 734
             // "Reply" is used as a verb
735 735
             show_button($url, tra("Reply"), tra("Post a reply to this message"));
736
-            $url = "forum_reply.php?thread=" . $thread->id . "&amp;post=" . $post->id . "#input";
736
+            $url = "forum_reply.php?thread=".$thread->id."&amp;post=".$post->id."#input";
737 737
             // "Quote" is used as a verb
738 738
             show_button($url, tra("Quote"), tra("Post a reply by quoting this message"));
739 739
         }
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
     $content = output_transform($post->content, $options);
756 756
     $when = time_diff_str($post->timestamp, time());
757 757
     $user = BoincUser::lookup_id($post->user);
758
-    if (!$user){
758
+    if (!$user) {
759 759
         return;
760 760
     }
761 761
 
@@ -811,9 +811,9 @@  discard block
 block discarded – undo
811 811
 function post_rules() {
812 812
     if (defined('FORUM_RULES')) return FORUM_RULES;
813 813
     if (function_exists("project_forum_post_rules")) {
814
-      $project_rules=project_forum_post_rules();
814
+      $project_rules = project_forum_post_rules();
815 815
     } else {
816
-      $project_rules="";
816
+      $project_rules = "";
817 817
     }
818 818
     return sprintf("
819 819
         <ul>
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
     );
843 843
 }
844 844
 
845
-function post_warning($forum=null) {
845
+function post_warning($forum = null) {
846 846
     $x = "<br><br>
847 847
         <table><tr><td align=left>
848 848
     ";
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
     $content = substr($content, 0, 64000);
903 903
     $content = BoincDb::escape_string($content);
904 904
     $now = time();
905
-    $sig = $signature?1:0;
905
+    $sig = $signature ? 1 : 0;
906 906
     $id = BoincPost::insert("(thread, user, timestamp, content, modified, parent_post, score, votes, signature, hidden) values ($thread->id, $user->id, $now, '$content', 0, $parent_id, 0, 0, $sig, 0)");
907 907
     if (!$id) {
908 908
         $forum_error = "Failed to add post to DB.";
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 //
923 923
 function update_thread_timestamp($thread) {
924 924
     $posts = BoincPost::enum("thread=$thread->id and hidden=0 order by timestamp desc limit 1");
925
-    if (count($posts)>0) {
925
+    if (count($posts) > 0) {
926 926
         $post = $posts[0];
927 927
         $thread->update("timestamp=$post->timestamp");
928 928
     }
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
 
931 931
 function update_forum_timestamp($forum) {
932 932
     $threads = BoincThread::enum("forum=$forum->id and hidden=0 order by timestamp desc limit 1");
933
-    if (count($threads)>0) {
933
+    if (count($threads) > 0) {
934 934
         $thread = $threads[0];
935 935
         $forum->update("timestamp=$thread->timestamp");
936 936
     }
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
     if (is_news_forum($forum) && !$export) {
954 954
         $status = 1;
955 955
     }
956
-    $id  = BoincThread::insert("(forum, owner, status, title, timestamp, views, replies, activity, sufferers, score, votes, create_time, hidden, sticky, locked) values ($forum->id, $user->id, $status, '$title', $now, 0, -1, 0, 0, 0, 0, $now, 0, 0, 0)");
956
+    $id = BoincThread::insert("(forum, owner, status, title, timestamp, views, replies, activity, sufferers, score, votes, create_time, hidden, sticky, locked) values ($forum->id, $user->id, $status, '$title', $now, 0, -1, 0, 0, 0, 0, $now, 0, 0, 0)");
957 957
     if (!$id) {
958 958
         $forum_error = "Failed to add thread to DB.";
959 959
         return null;
@@ -1081,22 +1081,22 @@  discard block
 block discarded – undo
1081 1081
 // $sticky - bool (not directly passed to SQL)
1082 1082
 //
1083 1083
 function get_forum_threads(
1084
-    $forumID, $start=-1, $nRec=-1, $sort_style=MODIFIED_NEW,
1084
+    $forumID, $start = -1, $nRec = -1, $sort_style = MODIFIED_NEW,
1085 1085
     $show_hidden = 0, $sticky = 1
1086 1086
 ) {
1087 1087
     //if (! (is_numeric($forumID) && is_numeric($min) && is_numeric($nRec))) {
1088 1088
     //    return NULL;  // Something is wrong here.
1089 1089
     //}
1090 1090
 
1091
-    $sql = 'forum = ' . $forumID ;
1091
+    $sql = 'forum = '.$forumID;
1092 1092
     $stickysql = "";
1093
-    if ($sticky){
1093
+    if ($sticky) {
1094 1094
         $stickysql = "sticky DESC, ";
1095 1095
     }
1096 1096
     if (!$show_hidden) {
1097 1097
         $sql .= ' AND hidden = 0';
1098 1098
     }
1099
-    switch($sort_style) {
1099
+    switch ($sort_style) {
1100 1100
     case MODIFIED_NEW:
1101 1101
         $sql .= ' ORDER BY '.$stickysql.'timestamp DESC';
1102 1102
         break;
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
     if (!$show_hidden) {
1150 1150
         $sql .= ' AND hidden = 0';
1151 1151
     }
1152
-    switch($sort_style) {
1152
+    switch ($sort_style) {
1153 1153
     case CREATE_TIME_NEW:
1154 1154
         $sql .= ' ORDER BY timestamp desc';
1155 1155
         break;
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
 //
1172 1172
 function show_post_moderation_links(
1173 1173
     $config, $logged_in_user, $post, $forum, $tokens
1174
-){
1174
+) {
1175 1175
     $moderators_allowed_to_ban = parse_bool($config, "moderators_allowed_to_ban");
1176 1176
     $moderators_vote_to_ban = parse_bool($config, "moderators_vote_to_ban");
1177 1177
 
@@ -1258,14 +1258,14 @@  discard block
 block discarded – undo
1258 1258
     // We do not tell the (ab)user how much this is -
1259 1259
     // no need to make it easy for them to break the system.
1260 1260
     //
1261
-    if ($user->total_credit<$forum->post_min_total_credit || $user->expavg_credit<$forum->post_min_expavg_credit) {
1261
+    if ($user->total_credit < $forum->post_min_total_credit || $user->expavg_credit < $forum->post_min_expavg_credit) {
1262 1262
         error_page(tra("To create a new thread in %1 you must have a certain level of average credit. This is to protect against abuse of the system.", $forum->title));
1263 1263
     }
1264 1264
 
1265 1265
     // If the user is posting faster than forum regulations allow
1266 1266
     // Tell the user to wait a while before creating any more posts
1267 1267
     //
1268
-    if (time()-$user->prefs->last_post <$forum->post_min_interval) {
1268
+    if (time() - $user->prefs->last_post < $forum->post_min_interval) {
1269 1269
         error_page(tra("You cannot create threads right now. Please wait before trying again. This is to protect against abuse of the system."));
1270 1270
     }
1271 1271
 }
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
 
1294 1294
 function is_moderator($user, $forum) {
1295 1295
     if (!$user) return false;
1296
-    $type = $forum?$forum->parent_type:0;
1296
+    $type = $forum ? $forum->parent_type : 0;
1297 1297
     switch ($type) {
1298 1298
     case 0:
1299 1299
         if ($user->prefs->privilege(S_MODERATOR)) return true;
@@ -1331,7 +1331,7 @@  discard block
 block discarded – undo
1331 1331
     $owner = BoincUser::lookup_id($thread->owner);
1332 1332
     if (!$owner) return;
1333 1333
     echo "<tr><td>\n";
1334
-    switch($thread_forum->parent_type) {
1334
+    switch ($thread_forum->parent_type) {
1335 1335
     case 0:
1336 1336
         $category = BoincCategory::lookup_id($thread_forum->category);
1337 1337
         show_forum_title($category, $thread_forum, $thread, true);
@@ -1341,7 +1341,7 @@  discard block
 block discarded – undo
1341 1341
         break;
1342 1342
     }
1343 1343
     echo '
1344
-        </td><td class="numbers">'.($thread->replies+1).'</td>
1344
+        </td><td class="numbers">'.($thread->replies + 1).'</td>
1345 1345
         <td>'.user_links($owner).'</td>
1346 1346
         <td class="numbers">'.$thread->views.'</td>
1347 1347
         <td class="lastpost">'.time_diff_str($thread->timestamp, time()).'</td>
@@ -1375,13 +1375,13 @@  discard block
 block discarded – undo
1375 1375
 
1376 1376
 function subscribed_post_web_line($notify) {
1377 1377
     $thread = BoincThread::lookup_id($notify->opaque);
1378
-    return tra("New posts in the thread %1","<a href=forum_thread.php?id=$thread->id>$thread->title</a>");
1378
+    return tra("New posts in the thread %1", "<a href=forum_thread.php?id=$thread->id>$thread->title</a>");
1379 1379
 }
1380 1380
 
1381 1381
 function subscribe_rss($notify, &$title, &$msg, &$url) {
1382 1382
     $thread = BoincThread::lookup_id($notify->opaque);
1383 1383
     $title = tra("New posts in subscribed thread");
1384
-    $msg = tra("There are new posts in the thread '%1'",$thread->title);
1384
+    $msg = tra("There are new posts in the thread '%1'", $thread->title);
1385 1385
     $url = secure_url_base()."forum_thread.php?id=$thread->id";
1386 1386
 }
1387 1387
 
Please login to merge, or discard this patch.