Passed
Push — master ( 1e3eac...4db6de )
by Vitalii
10:20 queued 27s
created
html/user/user_permissions.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     start_table('table-striped');
28 28
 
29 29
     $x = ['User'];
30
-    for ($i=0; $i<S_NFLAGS; $i++) {
30
+    for ($i = 0; $i < S_NFLAGS; $i++) {
31 31
         $x[] = $special_user_bitfield[$i];
32 32
     }
33 33
     $x[] = '';
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
             $pref->userid
43 43
         );
44 44
         $x = ["$user->name ($user->id)"];
45
-        for ($j=0; $j<S_NFLAGS; $j++) {
45
+        for ($j = 0; $j < S_NFLAGS; $j++) {
46 46
             $bit = substr($pref->special_user, $j, 1);
47
-            $c = ($bit == 1)?"checked":"";
47
+            $c = ($bit == 1) ? "checked" : "";
48 48
             $x[] = sprintf(
49 49
                 '<input type="checkbox" name="role%d" value="1" %s>',
50 50
                 $j, $c
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
     echo '<form action="user_permissions.php" method="POST">';
59 59
     $x = ['Add User ID: <input type="text" name="userid" size="6">'];
60
-    for ($j=0; $j<S_NFLAGS; $j++) {
60
+    for ($j = 0; $j < S_NFLAGS; $j++) {
61 61
         $x[] = sprintf(
62 62
             '<input type="checkbox" name="role%d" value="1">',
63 63
             $j
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     if (!$user) error_page('no user');
78 78
     BoincForumPrefs::lookup($user);
79 79
 
80
-    for ($i=0; $i<S_NFLAGS; $i++) {
80
+    for ($i = 0; $i < S_NFLAGS; $i++) {
81 81
         if (post_int("role$i", true) == 1) {
82 82
             $bitset .= '1';
83 83
             echo "<br> setting $i";
Please login to merge, or discard this patch.
html/project.sample/project_specific_prefs.inc 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 //      Also error-check values, and return errors in $errors->*
34 34
 
35 35
 function option($name, $val) {
36
-    $x = ($name == $val) ?  "selected" : "";
36
+    $x = ($name == $val) ? "selected" : "";
37 37
     return "<option name='$name' $x>$name\n";
38 38
 }
39 39
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 if (APP_SELECT_PREFS) {
54 54
     $app_array = array();
55 55
     $apps = BoincApp::enum("deprecated=0");
56
-    foreach($apps as $app) {
56
+    foreach ($apps as $app) {
57 57
         $app_array[] = array($app->id, $app->user_friendly_name);
58 58
     }
59 59
 } else {
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
 }
92 92
 
93 93
 function number_select($name, $max, $n) {
94
-    $sel = ($n == 0) ? "selected":"";
94
+    $sel = ($n == 0) ? "selected" : "";
95 95
     $x = "<select class=\"form-control input-sm\" name=$name> <option value=0 $sel>".tra("No limit")."</option>";
96
-    for ($i=1; $i<=$max; $i++) {
97
-        $sel = ($n == $i) ? "selected":"";
96
+    for ($i = 1; $i <= $max; $i++) {
97
+        $sel = ($n == $i) ? "selected" : "";
98 98
         $x .= "<option value=$i $sel>$i</option>";
99 99
     }
100 100
     $x .= "</select>";
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     return tra("No limit");
107 107
 }
108 108
 
109
-function project_specific_prefs_edit($prefs, $error=false) {
109
+function project_specific_prefs_edit($prefs, $error = false) {
110 110
     global $app_array;
111 111
     if (COLOR_PREFS) {
112 112
         $x = $prefs->color_scheme;
@@ -132,15 +132,15 @@  discard block
 block discarded – undo
132 132
             } else {
133 133
                 $present = true;
134 134
             }
135
-            $checked = $present?"checked":"";
135
+            $checked = $present ? "checked" : "";
136 136
             $x .= "<input type=checkbox name=app_id_$app_id $checked> $app_name<br>";
137 137
         }
138 138
         tooltip_row2(APP_SELECT_TOOLTIP, APP_SELECT_DESC, $x);
139
-        $checked = $prefs->allow_non_preferred_apps?"checked":"";
139
+        $checked = $prefs->allow_non_preferred_apps ? "checked" : "";
140 140
         row2(ACCEPT_ANY_DESC, "<input type=checkbox name=allow_non_preferred_apps $checked>");
141 141
     }
142 142
     if (NON_GRAPHICAL_PREF) {
143
-        $checked = $prefs->non_graphical?"checked":"";
143
+        $checked = $prefs->non_graphical ? "checked" : "";
144 144
         row2(
145 145
             NON_GRAPHICAL_DESC,
146 146
             "<input type=checkbox name=non_graphical $checked>"
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
     return $x;
217 217
 }
218 218
 
219
-function project_specific_prefs_show($prefs, $columns=false) {
219
+function project_specific_prefs_show($prefs, $columns = false) {
220 220
     global $app_array;
221 221
     if ($columns) {
222 222
         if (COLOR_PREFS) {
223
-            row_defs(COLOR_DESC,"color_scheme", "", "", $prefs);
223
+            row_defs(COLOR_DESC, "color_scheme", "", "", $prefs);
224 224
         }
225 225
         if (GFX_CPU_PREFS) {
226 226
             row_defs(MAX_GFX_CPU_PCT_DESC, "max_gfx_cpu_pct", "", "", $prefs);
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
             row2(ACCEPT_ANY_DESC, $prefs->allow_non_preferred_apps_text);
255 255
         }
256 256
         if (NON_GRAPHICAL_PREF) {
257
-            row2(NON_GRAPHICAL_DESC, $prefs->non_graphical?tra("yes"):tra("no"));
257
+            row2(NON_GRAPHICAL_DESC, $prefs->non_graphical ?tra("yes") : tra("no"));
258 258
         }
259 259
         if (MAX_JOBS_PREF) {
260 260
             row2(tra("Max # jobs"), limit_string($prefs->max_jobs));
@@ -277,12 +277,12 @@  discard block
 block discarded – undo
277 277
         $cursor = 0;
278 278
         while ($thisxml = parse_next_element($prefs_xml, "<app_id>", $cursor)) {
279 279
             if (is_numeric($thisxml)) {
280
-                $n = (int) $thisxml;
280
+                $n = (int)$thisxml;
281 281
                 $prefs->app_ids[] = $n;
282 282
             }
283 283
         }
284 284
         $prefs->allow_non_preferred_apps = parse_element($prefs_xml, "<allow_non_preferred_apps>");
285
-        $prefs->allow_non_preferred_apps_text = $prefs->allow_non_preferred_apps?"yes":"no";
285
+        $prefs->allow_non_preferred_apps_text = $prefs->allow_non_preferred_apps ? "yes" : "no";
286 286
     }
287 287
     if (NON_GRAPHICAL_PREF) {
288 288
         $prefs->non_graphical = parse_bool($prefs_xml, "non_graphical");
Please login to merge, or discard this patch.
html/inc/stats_sites.inc 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -147,11 +147,11 @@
 block discarded – undo
147 147
 
148 148
 function site_list($sites) {
149 149
     echo "<ul>\n";
150
-    for ($i=0; $i<count($sites); $i++) {
150
+    for ($i = 0; $i < count($sites); $i++) {
151 151
         $s = $sites[$i];
152 152
         $url = $s[0];
153 153
         $name = $s[1];
154
-        $comment = array_key_exists(2, $s)?$s[2]:"";
154
+        $comment = array_key_exists(2, $s) ? $s[2] : "";
155 155
         echo "<li><a href=\"$url\">$name</a> $comment\n";
156 156
     }
157 157
     echo "</ul>\n";
Please login to merge, or discard this patch.
html/inc/translation.inc 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
     $dh = opendir($langdir.$transdir);
65 65
     if (!$dh) die("can't open translation dir");
66 66
     while (($file = readdir($dh)) !== false) {
67
-        if ($file==".." || $file==".") {
67
+        if ($file == ".." || $file == ".") {
68 68
             continue;
69 69
         }
70 70
         // only do files ending in .po
71
-        if (substr($file,-3) != ".po"){
71
+        if (substr($file, -3) != ".po") {
72 72
             //debug("File $file with unknown extension found in $info_dir");
73 73
             continue;
74 74
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             "-------------Compiling $transdir$file------------", 0
77 77
         );
78 78
         $language = parse_po_file($langdir.$transdir.$file);
79
-        if (!$language){
79
+        if (!$language) {
80 80
             language_log(
81 81
                 "WARNING: Could not parse language ".$file
82 82
             );
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
             );
96 96
             exit;
97 97
         }
98
-        foreach ($language as $key => $value){
98
+        foreach ($language as $key => $value) {
99 99
             if ($value !== "") {
100 100
                 // Skip if the msgstr is empty
101
-                fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n");
101
+                fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file, 0, -3))."\"][\"".$key."\"] = \"".$value."\";\n");
102 102
             }
103 103
         }
104 104
         // don't write \?\> - may append
@@ -115,27 +115,27 @@  discard block
 block discarded – undo
115 115
 function parse_po_file($file) {
116 116
     $translation_file = file($file);
117 117
     $first_entry = true;
118
-    $current_token_text="";
119
-    $current_token ="";
118
+    $current_token_text = "";
119
+    $current_token = "";
120 120
     $parsing_token = false;
121 121
     $parsing_text = false;
122 122
     $size = sizeof($translation_file);
123 123
     $output = array();
124
-    for ($i=0; $i<$size; $i++){
124
+    for ($i = 0; $i < $size; $i++) {
125 125
         $entry = trim($translation_file[$i]);
126 126
         //echo "line $i: $entry\n";
127
-        if (substr($entry, 0, 1)=="#") {
127
+        if (substr($entry, 0, 1) == "#") {
128 128
             continue;
129 129
         } elseif (strpos($entry, "msgid") !== false) {
130
-            if (!$first_entry){
130
+            if (!$first_entry) {
131 131
                 //If this is not the first, save the previous entry
132
-                $output[$current_token]=$current_token_text;
132
+                $output[$current_token] = $current_token_text;
133 133
             }
134 134
             $current_token = get_po_line($entry, $file);
135
-            $current_token_text="";
135
+            $current_token_text = "";
136 136
             $parsing_token = true;
137 137
             $parsing_text = false;
138
-            $first_entry=false;
138
+            $first_entry = false;
139 139
         } elseif (strpos($entry, "msgstr") !== false) {
140 140
             $current_token_text = get_po_line($entry, $file);
141 141
             $parsing_token = false;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
     // Get the last token
151 151
     //
152
-    if ($current_token && $current_token_text){
152
+    if ($current_token && $current_token_text) {
153 153
         $output[$current_token] = $current_token_text;
154 154
     }
155 155
     return $output;
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 // Returns the contents of a line (ie removes "" from start and end)
160 160
 //
161 161
 function get_po_line($line, $file) {
162
-    $start = strpos($line, '"')+1;
162
+    $start = strpos($line, '"') + 1;
163 163
     $stop = strrpos($line, '"');
164
-    $x = substr($line, $start, $stop-$start);
164
+    $x = substr($line, $start, $stop - $start);
165 165
     $n = preg_match("/[^\\\\]\"/", $x);
166 166
     if ($n) {
167 167
         echo "ERROR - MISMATCHED QUOTES IN $file: $line\n";
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 
181 181
     // Find the string in the user's language
182 182
     //
183
-    foreach ($languages_in_use as $language){
183
+    foreach ($languages_in_use as $language) {
184 184
         if (isset($language_lookup_array[$language][$text])) {
185 185
             $text = $language_lookup_array[$language][$text];
186 186
             break;
187
-        } else if ($language=="en"){
187
+        } else if ($language == "en") {
188 188
             // This language is defined in the code and is always available
189 189
             break;
190 190
         }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     // Replace relevant substrings with given arguments.
194 194
     // Use strtr to avoid problems if an argument contains %n.
195 195
     $replacements = array();
196
-    for ($i=1; $i<func_num_args(); $i++){
196
+    for ($i = 1; $i < func_num_args(); $i++) {
197 197
         $replacements["%".$i] = func_get_arg($i);
198 198
     }
199 199
 
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
     return $text;
211 211
 }
212 212
 
213
-function language_log($message, $loglevel=0) {
213
+function language_log($message, $loglevel = 0) {
214 214
     global $lang_log_level;
215 215
     $msg = "";
216
-    if ($loglevel==0) $msg = "[ Debug    ]";
217
-    if ($loglevel==1) $msg = "[ Warning  ]";
218
-    if ($loglevel==2) $msg = "[ CRITICAL ]";
216
+    if ($loglevel == 0) $msg = "[ Debug    ]";
217
+    if ($loglevel == 1) $msg = "[ Warning  ]";
218
+    if ($loglevel == 2) $msg = "[ CRITICAL ]";
219 219
 
220
-    if ($loglevel >= $lang_log_level){
220
+    if ($loglevel >= $lang_log_level) {
221 221
         echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n";
222 222
     }
223 223
 }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 // (by looking at cookies and browser settings)
227 227
 // cookies have highest priority.
228 228
 
229
-if (isset($_COOKIE['lang'])){
229
+if (isset($_COOKIE['lang'])) {
230 230
     $language_string = $_COOKIE['lang'].",";
231 231
 } else {
232 232
     $language_string = '';
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 // Loop over languages that the client requests
258 258
 //
259 259
 $size = sizeof($client_languages);
260
-for ($i=0; $i<$size; $i++) {
261
-    if ((strlen($client_languages[$i])>2)
260
+for ($i = 0; $i < $size; $i++) {
261
+    if ((strlen($client_languages[$i]) > 2)
262 262
         && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-")
263
-    ){
263
+    ) {
264 264
         // If this is defined as primary-secondary, represent it as xx_YY
265 265
         //
266 266
         $language = substr(
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
     // if main language is english, look no further
281 281
     //
282
-    if ((count($languages_in_use)==0) && ($language == 'en' || $language2 == 'en')) {
282
+    if ((count($languages_in_use) == 0) && ($language == 'en' || $language2 == 'en')) {
283 283
         break;
284 284
     }
285 285
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
     //
288 288
     $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc";
289 289
     if (file_exists($file_name)) {
290
-        if (!in_array($language, $languages_in_use)){
290
+        if (!in_array($language, $languages_in_use)) {
291 291
             require_once($file_name);
292 292
             $languages_in_use[] = $language;
293 293
         }
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
     if ($language2) {
296 296
         $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc";
297 297
         if (file_exists($file_name)) {
298
-            if (!in_array($language2, $languages_in_use)){
298
+            if (!in_array($language2, $languages_in_use)) {
299 299
                 require_once($file_name);
300 300
                 $languages_in_use[] = $language2;
301 301
             }
@@ -303,6 +303,6 @@  discard block
 block discarded – undo
303 303
     }
304 304
 }
305 305
 
306
-$GLOBALS['languages_in_use'] = $languages_in_use;   // for Drupal
306
+$GLOBALS['languages_in_use'] = $languages_in_use; // for Drupal
307 307
 
308 308
 ?>
Please login to merge, or discard this patch.
html/inc/pm.inc 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     return $x;
52 52
 }
53 53
 
54
-function pm_team_form($user, $teamid, $error=null) {
54
+function pm_team_form($user, $teamid, $error = null) {
55 55
     global $bbcode_html, $bbcode_js;
56 56
     $team = BoincTeam::lookup_id($teamid);
57 57
     if (!$team) {
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         error_page("not admin");
62 62
     }
63 63
 
64
-    page_head(tra("Send message to team"),'','','', $bbcode_js);
64
+    page_head(tra("Send message to team"), '', '', '', $bbcode_js);
65 65
 
66 66
     $subject = post_str("subject", true);
67 67
     $content = post_str("content", true);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 function pm_form_page($replyto, $userid, $error = null) {
114 114
     global $bbcode_html, $bbcode_js;
115 115
     global $g_logged_in_user;
116
-    page_head(tra("Send private message"),'','','', $bbcode_js);
116
+    page_head(tra("Send private message"), '', '', '', $bbcode_js);
117 117
 
118 118
     if (post_str("preview", true) == tra("Preview")) {
119 119
         $content = post_str("content", true);
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         if (!$user) {
138 138
             error_page("Sender no longer exists");
139 139
         }
140
-        $writeto = UNIQUE_USER_NAME?$user->name:$userid." (".$user->name.")";
140
+        $writeto = UNIQUE_USER_NAME ? $user->name : $userid." (".$user->name.")";
141 141
         $subject = $message->subject;
142 142
         if (substr($subject, 0, 3) != "re:") {
143 143
             $subject = "re: ".$subject;
@@ -147,15 +147,15 @@  discard block
 block discarded – undo
147 147
         if (!$user) {
148 148
             error_page("Sender no longer exists");
149 149
         }
150
-        $writeto = UNIQUE_USER_NAME?$user->name:$userid." (".$user->name.")";
150
+        $writeto = UNIQUE_USER_NAME ? $user->name : $userid." (".$user->name.")";
151 151
     } else {
152 152
         $writeto = sanitize_tags(post_str("to", true));
153 153
         $subject = post_str("subject", true);
154 154
         $content = post_str("content", true);
155 155
     }
156 156
 
157
-    $content = $content?htmlspecialchars($content):'';
158
-    $subject = $subject?htmlspecialchars($subject):'';
157
+    $content = $content ?htmlspecialchars($content) : '';
158
+    $subject = $subject ?htmlspecialchars($subject) : '';
159 159
 
160 160
     if ($error != null) {
161 161
         echo "<p class=\"text-danger\">".$error."</p>\n";
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 function send_pm_notification_email(
212 212
     $logged_in_user, $to_user, $subject, $content
213 213
 ) {
214
-    $message  = "
214
+    $message = "
215 215
 You have received a new private message at ".PROJECT.".
216 216
 
217 217
 From: $logged_in_user->name (ID $logged_in_user->id)
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
     $pm = BoincPrivateMessage::lookup_id($notify->opaque);
242 242
     $from_user = BoincUser::lookup_id($pm->senderid);
243 243
     if (!$pm || !$from_user) return null;
244
-    return "<a href=pm.php>".tra("Private message%1 from %2, subject:" , "</a>", $from_user->name )." $pm->subject";
244
+    return "<a href=pm.php>".tra("Private message%1 from %2, subject:", "</a>", $from_user->name)." $pm->subject";
245 245
 }
246 246
 
247 247
 function pm_send_msg($from_user, $to_user, $subject, $content, $send_email) {
@@ -305,11 +305,11 @@  discard block
 block discarded – undo
305 305
 
306 306
 function pm_email_remind($user) {
307 307
     if (!$user->prefs->pm_notification) {
308
-        return "<br><small>" .
308
+        return "<br><small>".
309 309
             tra(
310 310
                 "For email notification, %1 edit community prefs %2",
311 311
                 '<a href="edit_forum_preferences_form.php">', '</a>'
312
-            ) .
312
+            ).
313 313
             "</small>"
314 314
         ;
315 315
     }
Please login to merge, or discard this patch.
html/inc/team.inc 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     row2('<b>'.tra('Search criteria (use one or more)').'</b>', '');
41 41
     row2(
42 42
         tra('Key words').'<br><small>'.tra('Find teams with these words in their names or descriptions').'</small>',
43
-        '<input class="form-control" type="text" name="keywords" value="' . htmlspecialchars($params->keywords) . '">');
43
+        '<input class="form-control" type="text" name="keywords" value="'.htmlspecialchars($params->keywords).'">');
44 44
     row2_init(tra('Country'));
45 45
     echo '<select class="form-control" name="country"><option value="" selected>---</option>';
46 46
     $country = $params->country;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     echo country_select_options($country);
49 49
     echo "</select></td></tr>\n";
50 50
     row2(tra('Type of team'), team_type_select($params->type, true));
51
-    $checked = $params->active?"checked":"";
51
+    $checked = $params->active ? "checked" : "";
52 52
     row2(tra('Show only active teams'), "<input type=checkbox name=active $checked>");
53 53
     row2("", "<input class=\"btn btn-primary\" type=submit name=submit value=\"".tra('Search')."\">");
54 54
     end_table();
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     row2("Created", date_str($team->create_time));
96 96
     if (defined("SHOW_NONVALIDATED_TEAMS")) {
97 97
         $founder = $team->founder;
98
-        row2("Founder email validated", $founder->email_validated?"Yes":"No (team will not be exported)");
98
+        row2("Founder email validated", $founder->email_validated ? "Yes" : "No (team will not be exported)");
99 99
     }
100 100
     if (strlen($team->url)) {;
101 101
         if (strstr($team->url, "http://")) {
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     }
169 169
     row1(tra('Members'));
170 170
     row2(tra('Founder'),
171
-        $team->founder?user_links($team->founder, BADGE_HEIGHT_MEDIUM):"---"
171
+        $team->founder ?user_links($team->founder, BADGE_HEIGHT_MEDIUM) : "---"
172 172
     );
173 173
     if (count($team->admins)) {
174 174
         $first = true;
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
     foreach ($deltas as $delta) {
356 356
         $u = BoincUser::lookup_id($delta->userid);
357 357
         if ($u->teamid == $teamid) {
358
-            $new_members[] = $u->id;  // they might have later quit
358
+            $new_members[] = $u->id; // they might have later quit
359 359
         }
360 360
     }
361 361
     return array_unique($new_members);
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
     if (!$user->teamid) return;
439 439
     $user->update("teamid=0");
440 440
     $team = BoincTeam::lookup_id($user->teamid);
441
-    if ($team && $team->ping_user==$user->id) {
441
+    if ($team && $team->ping_user == $user->id) {
442 442
         $team->update("ping_user=-ping_user");
443 443
     }
444 444
     BoincTeamAdmin::delete("teamid=$user->teamid and userid=$user->id");
@@ -477,33 +477,33 @@  discard block
 block discarded – undo
477 477
     start_table();
478 478
     row2(tra('Team name, text version').'
479 479
         <br><p class=\"text-muted\">'.tra('Don\'t use HTML tags.').'</p>',
480
-        '<input class="form-control" name="name" type="text" size="50" value="'.($team?$team->name:"").'">'
480
+        '<input class="form-control" name="name" type="text" size="50" value="'.($team ? $team->name : "").'">'
481 481
     );
482 482
     row2(tra('Team name, HTML version').'
483 483
         <br><p class=\"text-muted\">
484 484
         '.tra('You may use %1 limited HTML tags %2.', '<a href="html.php" target="_new">', '</a>').'
485 485
         '.tra('If you don\'t know HTML, leave this box blank.').'</p>',
486
-        '<input class="form-control" name="name_html" type="text" size="50" value="'.str_replace('"',"'",($team?$team->name_html:"")).'">'
486
+        '<input class="form-control" name="name_html" type="text" size="50" value="'.str_replace('"', "'", ($team ? $team->name_html : "")).'">'
487 487
     );
488 488
     row2(tra('URL of team web page, if any').':<br><font size=-2>('.tra('without "http://"').')
489 489
         '.tra('This URL will be linked to from the team\'s page on this site.'),
490
-        '<input class="form-control" type="text" name="url" size="60" value="'.($team?$team->url:"").'">'
490
+        '<input class="form-control" type="text" name="url" size="60" value="'.($team ? $team->url : "").'">'
491 491
     );
492 492
     row2(tra('Description of team').':
493 493
         <br><p class=\"text-muted\">
494 494
         '.tra('You may use %1 limited HTML tags %2.', '<a href="html.php" target="_new">', '</a>').'
495 495
         </p>',
496
-        '<textarea class="form-control" name="description" rows=10>'.($team?$team->description:"").'</textarea>'
496
+        '<textarea class="form-control" name="description" rows=10>'.($team ? $team->description : "").'</textarea>'
497 497
     );
498 498
 
499
-    row2(tra('Type of team').':', team_type_select($team?$team->type:null));
499
+    row2(tra('Type of team').':', team_type_select($team ? $team->type : null));
500 500
 
501 501
     row2_init(tra('Country'));
502 502
     echo '<select class="form-control" name="country">';
503
-    echo country_select_options($team?$team->country:null);
503
+    echo country_select_options($team ? $team->country : null);
504 504
     echo "</select></td></tr>\n";
505 505
 
506
-    $x = (!$team || $team->joinable)?"checked":"";
506
+    $x = (!$team || $team->joinable) ? "checked" : "";
507 507
     row2(tra("Accept new members?"), "<input type=checkbox name=joinable $x>");
508 508
     // Check if we're using reCaptcha to prevent spam accounts
509 509
     //
@@ -571,12 +571,12 @@  discard block
 block discarded – undo
571 571
 //
572 572
 function new_transfer_request_ok($team, $now) {
573 573
     if ($team->ping_user <= 0) {
574
-        if ($team->ping_time < $now - 60 * 86400) {
574
+        if ($team->ping_time < $now - 60*86400) {
575 575
             return true;
576 576
         }
577 577
         return false;
578 578
     }
579
-    if ($team->ping_time < $now - 90 * 86400) {
579
+    if ($team->ping_time < $now - 90*86400) {
580 580
         return true;
581 581
     }
582 582
     return false;
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
     if (!is_valid_country($country)) {
612 612
         $country = tra('None');
613 613
     }
614
-    $country = BoincDb::escape_string($country);  // for Cote d'Ivoire
614
+    $country = BoincDb::escape_string($country); // for Cote d'Ivoire
615 615
 
616 616
     $clause = sprintf(
617 617
         "(userid, create_time, name, name_lc, url, type, name_html, description, country, nusers, expavg_time) values(%d, %d, '%s', '%s', '%s', %d, '%s', '%s', '%s', %d, unix_timestamp())",
Please login to merge, or discard this patch.
html/inc/user.inc 1 patch
Spacing   +15 added lines, -15 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
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
     usort($user->projects, "cmp");
123 123
     if ($personal) {
124
-        $t  = tra("Projects in which you are participating");
124
+        $t = tra("Projects in which you are participating");
125 125
     } else {
126 126
         $t = tra("Projects in which %1 is participating", $user->name);
127 127
     }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     }
181 181
 
182 182
     if (!NO_STATS) {
183
-        $cpid = md5($user->cross_project_id . $user->email_addr);
183
+        $cpid = md5($user->cross_project_id.$user->email_addr);
184 184
         $x = "";
185 185
         shuffle($cpid_stats_sites);
186 186
         foreach ($cpid_stats_sites as $site) {
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
         $u = normalize_user_url($user->url);
267 267
         row2(
268 268
             tra("URL"),
269
-            $u?sprintf('<a href="%s">%s</a>', $u, $u):tra('Invalid URL')
269
+            $u ?sprintf('<a href="%s">%s</a>', $u, $u) : tra('Invalid URL')
270 270
         );
271 271
     }
272 272
     if (USER_COUNTRY) {
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 // if $badge_height is > 0, show badges
378 378
 // if $name_limit, limit name to N chars
379 379
 //
380
-function user_links($user, $badge_height=0, $name_limit=0) {
380
+function user_links($user, $badge_height = 0, $name_limit = 0) {
381 381
     if (!$user) {
382 382
         error_log("user_links(): null arg\n");
383 383
         return;
@@ -409,13 +409,13 @@  discard block
 block discarded – undo
409 409
         $user->id,
410 410
         $name
411 411
     );
412
-    if (function_exists("project_user_links")){
412
+    if (function_exists("project_user_links")) {
413 413
         $x .= project_user_links($user);
414 414
     }
415 415
     if ($badge_height) {
416 416
         $x .= badges_string(true, $user, $badge_height);
417 417
     }
418
-    return $name_limit?"<nobr>$x</nobr>":$x;
418
+    return $name_limit ? "<nobr>$x</nobr>" : $x;
419 419
 }
420 420
 
421 421
 function show_community_private($user) {
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 
463 463
             // if there's a foundership request, notify the founder
464 464
             //
465
-            if ($user->id==$team->userid && $team->ping_user >0) {
465
+            if ($user->id == $team->userid && $team->ping_user > 0) {
466 466
                 $x .= "<p class=\"text-danger\">".tra("(foundership change request pending)")."</p>";
467 467
             }
468 468
             row2(tra("Member of team"), $x);
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
     $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1");
487 487
     $x = [];
488 488
     if ($friends) {
489
-        foreach($friends as $friend) {
489
+        foreach ($friends as $friend) {
490 490
             $fuser = BoincUser::lookup_id($friend->user_dest);
491 491
             if (!$fuser) continue;
492 492
             $x[] = friend_links($fuser);
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 
537 537
 // return an object with data to show the user's community links
538 538
 //
539
-function get_community_links_object($user){
539
+function get_community_links_object($user) {
540 540
     $cache_object = new StdClass;
541 541
     $cache_object->post_count = total_posts($user);
542 542
     $cache_object->user = $user;
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
     $cache_object->friends = array();
545 545
 
546 546
     $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1");
547
-    foreach($friends as $friend) {
547
+    foreach ($friends as $friend) {
548 548
         $fuser = BoincUser::lookup_id($friend->user_dest);
549 549
         if (!$fuser) continue;
550 550
         $cache_object->friends[] = $fuser;
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 
555 555
 // show community links of another user (described by $clo)
556 556
 //
557
-function community_links($clo, $logged_in_user){
557
+function community_links($clo, $logged_in_user) {
558 558
     $user = $clo->user;
559 559
     if (!$user) {
560 560
         error_log("community_links(): null user\n");
@@ -584,15 +584,15 @@  discard block
 block discarded – undo
584 584
                 "<a href=\"friend.php?action=cancel_confirm&userid=$user->id\">".tra("Cancel friendship")."</a>"
585 585
             );
586 586
         } else if ($friend) {
587
-            row2(tra("Friends"),  "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>");
587
+            row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>");
588 588
         } else {
589
-            row2(tra("Friends"),  "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>");
589
+            row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>");
590 590
         }
591 591
     }
592 592
 
593 593
     if ($friends) {
594 594
         $x = [];
595
-        foreach($friends as $friend) {
595
+        foreach ($friends as $friend) {
596 596
             $x[] = friend_links($friend);
597 597
         }
598 598
         row2(tra('Friends'), implode('<br>', $x));
Please login to merge, or discard this patch.
html/inc/host.inc 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 
33 33
 function sched_log_name($x) {
34 34
     if ($x == 0) return "NO_SUCH_LOG";
35
-    return gmdate('Y-m-d_H/Y-m-d_H:i', $x) . ".txt";
35
+    return gmdate('Y-m-d_H/Y-m-d_H:i', $x).".txt";
36 36
 }
37 37
 
38 38
 function sched_log_link($x) {
39 39
     if (file_exists("sched_logs")) {
40
-        return "<a href=\"../sched_logs/" . sched_log_name($x) . "\">" . time_str($x) . "</a>";
40
+        return "<a href=\"../sched_logs/".sched_log_name($x)."\">".time_str($x)."</a>";
41 41
     } else {
42 42
         return time_str($x);
43 43
     }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 function location_form($host) {
47 47
     $none = "selected";
48
-    $h=$w=$s=$m="";
48
+    $h = $w = $s = $m = "";
49 49
     if ($host->venue == "home") $h = "selected";
50 50
     if ($host->venue == "work") $w = "selected";
51 51
     if ($host->venue == "school") $s = "selected";
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             row2(tra("Product name"), $host->product_name);
100 100
         }
101 101
         $x = $host->timezone/3600;
102
-        if ($x >= 0) $x="+$x";
102
+        if ($x >= 0) $x = "+$x";
103 103
         row2(tra("Local Standard Time"), tra("UTC %1 hours", $x));
104 104
     } else {
105 105
         $owner = BoincUser::lookup_id($host->userid);
@@ -259,15 +259,15 @@  discard block
 block discarded – undo
259 259
 // "[vbox|5.0.0|1|1]", where now two additional flags give information about
260 260
 // hardware virtualization support. Older clients may have the old-style
261 261
 // serialnum in the DB despite the server being upgraded.
262
-function vbox_desc($x){
263
-    if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/",$x,$matches)){
262
+function vbox_desc($x) {
263
+    if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/", $x, $matches)) {
264 264
         $desc = "Virtualbox (".$matches[1].") ".tra("installed");
265
-        if (sizeof($matches)>2){
266
-            if ($matches[3]=="1" and $matches[4]=="1") {
265
+        if (sizeof($matches) > 2) {
266
+            if ($matches[3] == "1" and $matches[4] == "1") {
267 267
                 return $desc.tra(", CPU has hardware virtualization support and it is enabled");
268
-            } elseif ($matches[3]=="1" and $matches[4]=="0") {
268
+            } elseif ($matches[3] == "1" and $matches[4] == "0") {
269 269
                 return $desc.tra(", CPU has hardware virtualization support but it is disabled");
270
-            } elseif ($matches[3]=="0") {
270
+            } elseif ($matches[3] == "0") {
271 271
                 return $desc.tra(", CPU does not have hardware virtualization support");
272 272
             }
273 273
         } else {
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 // Given string of the form [BOINC|vers][type|model|count|RAM|driver-vers][vbox|vers],
282 282
 // return a human-readable version of the GPU info
283 283
 //
284
-function gpu_desc($x, $detail=true) {
284
+function gpu_desc($x, $detail = true) {
285 285
     $descs = explode("]", $x);
286 286
     array_pop($descs);
287 287
     $str = "";
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
         if ($d[0] == "vbox") continue;
294 294
         if (count($d) < 4) continue;
295 295
         if ($str) $str .= "<p>";
296
-        if ($d[2]!="" && $d[2]!="1") $str .= "[".$d[2]."] ";
296
+        if ($d[2] != "" && $d[2] != "1") $str .= "[".$d[2]."] ";
297 297
         if ($d[0] == "CUDA") {
298 298
             $str .= "NVIDIA";
299 299
         } else if ($d[0] == "CAL") {
@@ -500,14 +500,14 @@  discard block
 block discarded – undo
500 500
     if ($pos1 === false) return $x;
501 501
     $pos2 = strpos($model, ']');
502 502
     if ($pos2 === false) return $x;
503
-    $a = substr($model, $pos1+1, $pos2-$pos1-1);
503
+    $a = substr($model, $pos1 + 1, $pos2 - $pos1 - 1);
504 504
     $y = explode(" ", $a);
505 505
     if (count($y) == 0) return $x;
506 506
     if ($y[0] == "Family") {
507 507
         $x->info = $a;
508 508
     } else {
509 509
         $x->arch = $y[0];
510
-        $x->info = substr($a, strlen($y[0])+1);
510
+        $x->info = substr($a, strlen($y[0]) + 1);
511 511
     }
512 512
     return $x;
513 513
 }
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
     $avg_time = 0;
597 597
 
598 598
     $results = BoincResult::enum("hostid=$hostid order by received_time");
599
-    foreach($results as $result) {
599
+    foreach ($results as $result) {
600 600
         if ($result->granted_credit <= 0) continue;
601 601
         $total += $result->granted_credit;
602 602
 
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 
690 690
 function link_url($sort, $rev, $show_all) {
691 691
     global $userid;
692
-    $x = $userid ? "&userid=$userid":"";
692
+    $x = $userid ? "&userid=$userid" : "";
693 693
     return "hosts_user.php?sort=$sort&rev=$rev&show_all=$show_all$x";
694 694
 }
695 695
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
 }
764 764
 
765 765
 function show_user_hosts($userid, $private, $show_all, $sort, $rev) {
766
-    $desc = false;  // whether the sort order's default is decreasing
766
+    $desc = false; // whether the sort order's default is decreasing
767 767
     switch ($sort) {
768 768
     case "total_credit": $sort_clause = "total_credit"; $desc = true; break;
769 769
     case "expavg_credit": $sort_clause = "expavg_credit"; $desc = true; break;
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
     more_or_less($sort, $rev, $show_all);
787 787
 
788 788
     $now = time();
789
-    $old_hosts=0;
789
+    $old_hosts = 0;
790 790
     $i = 1;
791 791
     $hosts = BoincHost::enum("userid=$userid order by $sort_clause");
792 792
     $any_product_name = false;
@@ -798,9 +798,9 @@  discard block
 block discarded – undo
798 798
     }
799 799
     user_host_table_start($private, $sort, $rev, $show_all, $any_product_name);
800 800
     foreach ($hosts as $host) {
801
-        $is_old=false;
801
+        $is_old = false;
802 802
         if (($now - $host->rpc_time) > 30*86400) {
803
-            $is_old=true;
803
+            $is_old = true;
804 804
             $old_hosts++;
805 805
         }
806 806
         if (!$show_all && $is_old) continue;
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
     }
810 810
     end_table();
811 811
 
812
-    if ($old_hosts>0) {
812
+    if ($old_hosts > 0) {
813 813
         more_or_less($sort, $rev, $show_all);
814 814
     }
815 815
 
Please login to merge, or discard this patch.
html/inc/profile.inc 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     if (!$user->has_profile) return null;
72 72
     $profile = BoincProfile::lookup("userid=$user->id");
73 73
     if (!$profile->has_picture) return null;
74
-    if (profile_screening() && $profile->verification!=1) return null;
74
+    if (profile_screening() && $profile->verification != 1) return null;
75 75
     return profile_thumb_url($user->id);
76 76
 }
77 77
 
@@ -125,11 +125,11 @@  discard block
 block discarded – undo
125 125
         return $image;
126 126
     }
127 127
 
128
-    ($origWidth > $origHeight)? $scalar = ($origWidth / $targetWidth) : $scalar = ($origHeight / $targetHeight);
128
+    ($origWidth > $origHeight) ? $scalar = ($origWidth/$targetWidth) : $scalar = ($origHeight/$targetHeight);
129 129
 
130 130
     if ($scalar != 0) {
131
-        $destWidth = $origWidth / $scalar;
132
-        $destHeight = $origHeight / $scalar;
131
+        $destWidth = $origWidth/$scalar;
132
+        $destHeight = $origHeight/$scalar;
133 133
     } else {
134 134
         $destWidth = $origWidth;
135 135
         $destHeight = $origHeight;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     $gd_info = gd_info();
139 139
     $v = $gd_info["GD Version"];
140 140
     $v = explode('.', $v);
141
-    $v = (int)$v[0];        // major version
141
+    $v = (int)$v[0]; // major version
142 142
     if ($v >= 2) {
143 143
         // If you are using a modern PHP/GD installation that does
144 144
         // 'truecolor' images, this is what's needed.
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         $options->htmlitems = false;
182 182
         $temp = output_transform($profile->response1, $options);
183 183
         $temp = sanitize_tags($temp);
184
-        $description = "(\"" . sub_sentence($temp, ' ', MAX_DESC_LENGTH, true) . "\")";
184
+        $description = "(\"".sub_sentence($temp, ' ', MAX_DESC_LENGTH, true)."\")";
185 185
 
186 186
     }
187 187
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
 function check_whether_to_show_profile($user, $logged_in_user) {
193 193
     $min_credit = parse_config(get_config(), "<profile_min_credit>");
194
-    if (!$logged_in_user && $min_credit && $user->expavg_credit < $min_credit ) {
194
+    if (!$logged_in_user && $min_credit && $user->expavg_credit < $min_credit) {
195 195
         error_page(
196 196
            tra("To prevent spam, profiles of users with an average credit of less than %1 are displayed only to logged-in users. We apologize for this inconvenience.", $min_credit)
197 197
         );
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     //
230 230
     $show_picture = $profile->has_picture;
231 231
     if (profile_screening()) {
232
-        if (!$screen_mode && !$can_edit && $profile->verification!=1) {
232
+        if (!$screen_mode && !$can_edit && $profile->verification != 1) {
233 233
             $show_picture = false;
234 234
         }
235 235
     }
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     // yet verified.  This will tell them if other users can't view it yet, or
246 246
     // if there is a problem with it and they need to replace it.
247 247
     //
248
-    if (profile_screening() && $profile->has_picture && $can_edit && $profile->verification!=1) {
248
+    if (profile_screening() && $profile->has_picture && $can_edit && $profile->verification != 1) {
249 249
         row1(offensive_profile_warning($profile->verification));
250 250
     }
251 251
 
Please login to merge, or discard this patch.