Passed
Push — dpa_submit21 ( e4087a...141260 )
by David
08:42
created
html/user/forum_thread.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 $postid = get_int('postid', true);
31 31
 $filter = get_str('filter', true);
32 32
 
33
-if ($filter != "false"){
33
+if ($filter != "false") {
34 34
     $filter = true;
35 35
 } else {
36 36
     $filter = false;
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 if ($temp_sort_style) {
80 80
     $sort_style = $temp_sort_style;
81 81
 } else if ($sort_style) {
82
-    $forum_style = 0;   // this is deprecated
83
-    if ($logged_in_user){
82
+    $forum_style = 0; // this is deprecated
83
+    if ($logged_in_user) {
84 84
         $logged_in_user->prefs->thread_sorting = $sort_style;
85 85
         $logged_in_user->prefs->update("thread_sorting=$sort_style");
86 86
     } else {
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     );
93 93
 } else {
94 94
     // get the sorting style from the user or a cookie
95
-    if ($logged_in_user){
95
+    if ($logged_in_user) {
96 96
         $sort_style = $logged_in_user->prefs->thread_sorting;
97 97
     } else {
98 98
         list($forum_style, $sort_style) = parse_forum_cookie();
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 
119 119
 if (false) {
120 120
 if ($forum->parent_type == 0) {
121
-    if ($category->is_helpdesk && !$thread->status){
122
-        if ($logged_in_user){
123
-            if ($thread->owner == $logged_in_user->id){
124
-                if ($thread->replies !=0) {
121
+    if ($category->is_helpdesk && !$thread->status) {
122
+        if ($logged_in_user) {
123
+            if ($thread->owner == $logged_in_user->id) {
124
+                if ($thread->replies != 0) {
125 125
                     // Show a "this question has been answered" to the author
126 126
                     echo "<p>";
127 127
                     show_button(
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     // If logged in user is moderator, enable some extra features
190 190
     //
191 191
     if (is_moderator($logged_in_user, $forum)) {
192
-        if ($thread->hidden){
192
+        if ($thread->hidden) {
193 193
             show_button_small(
194 194
                 "forum_moderate_thread_action.php?action=unhide&amp;thread=".$thread->id."$tokens",
195 195
                 tra("Unhide"),
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                 tra("Hide this thread")
203 203
             );
204 204
         }
205
-        if ($thread->sticky){
205
+        if ($thread->sticky) {
206 206
             show_button_small(
207 207
                 "forum_moderate_thread_action.php?action=desticky&amp;thread=".$thread->id."$tokens",
208 208
                 tra("Make unsticky"),
Please login to merge, or discard this patch.
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/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/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.
html/inc/result.inc 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
     return $platforms[$id];
54 54
 }
55 55
 
56
-function anon_platform_string($result, $rsc_name=null) {
56
+function anon_platform_string($result, $rsc_name = null) {
57 57
     $app = get_app($result->appid);
58
-    $n = $app->user_friendly_name."<br>".  tra("Anonymous platform");
58
+    $n = $app->user_friendly_name."<br>".tra("Anonymous platform");
59 59
     if ($rsc_name) {
60 60
         $n .= " ($rsc_name)";
61 61
     }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         return $string_to_show;
100 100
     }
101 101
     if ($result->server_state <> RESULT_SERVER_STATE_OVER) return "---";
102
-    switch($result->outcome) {
102
+    switch ($result->outcome) {
103 103
     case RESULT_OUTCOME_SUCCESS:
104 104
         switch ($result->validate_state) {
105 105
         case VALIDATE_STATE_INIT:
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
             ) {
215 215
                 return tra("Not started by deadline - canceled");
216 216
             }
217
-            switch($result->client_state) {
217
+            switch ($result->client_state) {
218 218
             case RESULT_FILES_DOWNLOADING: return tra("Error while downloading");
219 219
             case RESULT_FILES_DOWNLOADED:
220 220
             case RESULT_COMPUTE_ERROR: return tra("Error while computing");
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 }
234 234
 
235 235
 function result_server_state_string($result) {
236
-    switch($result->server_state) {
236
+    switch ($result->server_state) {
237 237
     case RESULT_SERVER_STATE_INACTIVE: return tra("Inactive");
238 238
     case RESULT_SERVER_STATE_UNSENT: return tra("Unsent");
239 239
     case RESULT_SERVER_STATE_IN_PROGRESS: return tra("In progress");
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 }
244 244
 
245 245
 function result_outcome_string($result) {
246
-    switch($result->outcome) {
246
+    switch ($result->outcome) {
247 247
     case RESULT_OUTCOME_INIT: return "---";
248 248
     case RESULT_OUTCOME_SUCCESS: return tra("Success");
249 249
     case RESULT_OUTCOME_COULDNT_SEND: return tra("Couldn't send");
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 }
262 262
 
263 263
 function result_client_state_string($result) {
264
-    switch($result->client_state) {
264
+    switch ($result->client_state) {
265 265
     case RESULT_NEW: return tra("New");
266 266
     case RESULT_FILES_DOWNLOADING: return tra("Downloading");
267 267
     case RESULT_FILES_DOWNLOADED: return tra("Processing");
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 }
280 280
 
281 281
 function validate_state_str($result) {
282
-    switch($result->validate_state) {
282
+    switch ($result->validate_state) {
283 283
     case VALIDATE_STATE_INIT: return tra("Initial");
284 284
     case VALIDATE_STATE_VALID: return tra("Valid");
285 285
     case VALIDATE_STATE_INVALID:
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 }
296 296
 
297 297
 function assimilate_state_str($s) {
298
-    switch($s) {
298
+    switch ($s) {
299 299
     case ASSIMILATE_INIT: return "Initial";
300 300
     case ASSIMILATE_READY: return "Ready to assimilate";
301 301
     case ASSIMILATE_DONE: return "Assimilated";
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 }
305 305
 
306 306
 function file_delete_state_str($s) {
307
-    switch($s) {
307
+    switch ($s) {
308 308
     case FILE_DELETE_INIT: return "Initial";
309 309
     case FILE_DELETE_READY: return "Ready to delete";
310 310
     case FILE_DELETE_DONE: return "Deleted";
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 // convert WU error bitmask to str.
317 317
 // If $color, add HTML red color
318 318
 //
319
-function wu_error_mask_str($s, $color=false) {
319
+function wu_error_mask_str($s, $color = false) {
320 320
     $x = "";
321 321
     if ($s & WU_ERROR_COULDNT_SEND_RESULT) {
322 322
         $x = $x." ".tra("Couldn't send result");
@@ -430,10 +430,10 @@  discard block
 block discarded – undo
430 430
     if ($result->received_time) {
431 431
         $r = time_str($result->received_time);
432 432
     } else if ($result->report_deadline) {
433
-        if ($result->report_deadline>time()) {
434
-            $r = "<font color='#33cc33'>" . time_str($result->report_deadline) . "</font>";
433
+        if ($result->report_deadline > time()) {
434
+            $r = "<font color='#33cc33'>".time_str($result->report_deadline)."</font>";
435 435
         } else {
436
-            $r = "<font color='#ff3333'>" . time_str($result->report_deadline) . "</font>";
436
+            $r = "<font color='#ff3333'>".time_str($result->report_deadline)."</font>";
437 437
         }
438 438
     } else {
439 439
         $r = "---";
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 // @param Integer $dec A signed integer
495 495
 //
496 496
 function int2hex($dec) {
497
-    return "0x".strtoupper(substr(sprintf("%08x",$dec), -8));
497
+    return "0x".strtoupper(substr(sprintf("%08x", $dec), -8));
498 498
 }
499 499
 
500 500
 // Decode a windows error number into semi-human-readable,
@@ -504,9 +504,9 @@  discard block
 block discarded – undo
504 504
 // @return String A human readable error message
505 505
 // @param Integer $x An error number
506 506
 //
507
-function windows_error_code_str($x){
508
-    $h=int2hex($x);
509
-    switch($h){
507
+function windows_error_code_str($x) {
508
+    $h = int2hex($x);
509
+    switch ($h) {
510 510
     case "0xC0000005": return "STATUS_ACCESS_VIOLATION";
511 511
     case "0xC000001D": return "STATUS_ILLEGAL_INSTRUCTION";
512 512
     case "0xC0000094": return "STATUS_INTEGER_DIVIDE_BY_ZERO";
@@ -527,10 +527,10 @@  discard block
 block discarded – undo
527 527
 // @return String A human readable error message
528 528
 // @param Integer $x An error number
529 529
 //
530
-function error_code_str($x){
530
+function error_code_str($x) {
531 531
     // severe Windows error numbers are always large negative integers
532
-    if ($x<-400) return windows_error_code_str($x);
533
-    switch($x){
532
+    if ($x < -400) return windows_error_code_str($x);
533
+    switch ($x) {
534 534
     case 0: return "";
535 535
     case 192: return "EXIT_STATEFILE_WRITE";
536 536
     case 193: return "EXIT_SIGNAL";
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
     return $x." (".int2hex($x).") ".error_code_str($x);
692 692
 }
693 693
 
694
-function show_result($result, $show_outfile_links=false) {
694
+function show_result($result, $show_outfile_links = false) {
695 695
     start_table();
696 696
     row2(tra("Name"), $result->name);
697 697
     row2(tra("Workunit"), "<a href=\"workunit.php?wuid=$result->workunitid\">$result->workunitid</a>");
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
     echo "<h3>".tra("Stderr output")."</h3> <pre>"
743 743
         .htmlspecialchars(
744 744
             $result->stderr_out,
745
-            ENT_QUOTES | (defined('ENT_SUBSTITUTE')?ENT_SUBSTITUTE:0),
745
+            ENT_QUOTES|(defined('ENT_SUBSTITUTE') ?ENT_SUBSTITUTE:0),
746 746
             'utf-8'
747 747
         )
748 748
         ."</pre>"
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 
758 758
     $apps = BoincApp::enum('deprecated=0 ORDER BY user_friendly_name');
759 759
 
760
-    for ($i=0; $i<NSTATES; $i++) {
760
+    for ($i = 0; $i < NSTATES; $i++) {
761 761
         $state_count[$i] = 0;
762 762
     }
763 763
     foreach ($apps as $app) {
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
         $x .= "<a href=$url>".tra("Next")." ".$info->results_per_page."</a>";
801 801
     }
802 802
     $x .= "<br>".tra("State").": ";
803
-    for ($i=0; $i<NSTATES; $i++) {
803
+    for ($i = 0; $i < NSTATES; $i++) {
804 804
         if ($i) $x .= " &middot; ";
805 805
         if ($info->state == $i) {
806 806
             $x .= $state_name[$i];
Please login to merge, or discard this patch.
html/ops/sample_table_stats.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,25 +27,25 @@
 block discarded – undo
27 27
     row_array(array("Name", "Engine", "Version", "Row Format", "Rows", "Avg Row Length (KB)", "Data Length (MB)", "Max Data Length (MB)", "Index Length (MB)", "Data free (MB)", "Create Time", "Update Time", "Check Time", "Create Options", "Comment"));
28 28
     db_init();
29 29
     $result = _mysql_query("show table status");
30
-    while($row = _mysql_fetch_array($result)) {
30
+    while ($row = _mysql_fetch_array($result)) {
31 31
         $size += ($row["Data_length"] + $row["Index_length"]);
32 32
         $engine = $row["Engine"];
33 33
         //if (!$engine) $engine = $row["Type"];
34 34
         row_array(array(
35 35
             $row["Name"],
36 36
             $engine,
37
-            $row["Version"] ,
38
-            $row["Row_format"] ,
39
-            $row["Rows"] ,
40
-            round($row["Avg_row_length"]/1024,2) ,
41
-            round($row["Data_length"]/(1024*1024),2) ,
42
-            round($row["Max_data_length"]/(1024*1024),2) ,
43
-            round($row["Index_length"]/(1024*1024),2) ,
44
-            round($row["Data_free"]/(1024*1024),2) ,
45
-            $row["Create_time"] ,
46
-            $row["Update_time"] ,
47
-            $row["Check_time"] ,
48
-            $row["Create_options"] ,
37
+            $row["Version"],
38
+            $row["Row_format"],
39
+            $row["Rows"],
40
+            round($row["Avg_row_length"]/1024, 2),
41
+            round($row["Data_length"]/(1024*1024), 2),
42
+            round($row["Max_data_length"]/(1024*1024), 2),
43
+            round($row["Index_length"]/(1024*1024), 2),
44
+            round($row["Data_free"]/(1024*1024), 2),
45
+            $row["Create_time"],
46
+            $row["Update_time"],
47
+            $row["Check_time"],
48
+            $row["Create_options"],
49 49
             $row["Comment"]
50 50
         ));
51 51
     }
Please login to merge, or discard this patch.