@@ -259,10 +259,10 @@ |
||
| 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){ |
|
| 265 | + if (sizeof($matches)>2) { |
|
| 266 | 266 | if ($matches[3]=="1" and $matches[4]=="1") { |
| 267 | 267 | return $desc.tra(", CPU has hardware virtualization support and it is enabled"); |
| 268 | 268 | } elseif ($matches[3]=="1" and $matches[4]=="0") { |
@@ -98,7 +98,9 @@ discard block |
||
| 98 | 98 | if (!isset($types)) { |
| 99 | 99 | $types = array(); |
| 100 | 100 | $constants = get_defined_constants(true); |
| 101 | - foreach ($constants['mysqli'] as $c => $n) if (preg_match('/^MYSQLI_TYPE_(.*)/', $c, $m)) $types[$n] = $m[1]; |
|
| 101 | + foreach ($constants['mysqli'] as $c => $n) { |
|
| 102 | + if (preg_match('/^MYSQLI_TYPE_(.*)/', $c, $m)) $types[$n] = $m[1]; |
|
| 103 | + } |
|
| 102 | 104 | } |
| 103 | 105 | return array_key_exists($type_id, $types)? strtolower($types[$type_id]) : "unknown"; |
| 104 | 106 | } |
@@ -381,13 +383,13 @@ discard block |
||
| 381 | 383 | |
| 382 | 384 | |
| 383 | 385 | function link_results($n, $mq, $query, $clauses) { |
| 384 | - if ($n == '0') { // intentional compare by string |
|
| 386 | + if ($n == '0') { |
|
| 387 | +// intentional compare by string |
|
| 385 | 388 | return "0"; |
| 386 | 389 | } else { |
| 387 | 390 | if(strlen($clauses)) { |
| 388 | 391 | return "<a href=\"db_action.php?table=result&query=$mq&$query&clauses=".urlencode($clauses)."&sort_by=mod_time&detail=low\">$n</a>"; |
| 389 | - } |
|
| 390 | - else { |
|
| 392 | + } else { |
|
| 391 | 393 | return "<a href=\"db_action.php?table=result&query=$mq&$query&sort_by=mod_time&detail=low\">$n</a>"; |
| 392 | 394 | } |
| 393 | 395 | |
@@ -397,7 +399,7 @@ discard block |
||
| 397 | 399 | // Determines if in stderr_out is an error reported and prints as human readable String |
| 398 | 400 | // @return String A human readable string if error otherwise FALSE |
| 399 | 401 | // @param String $stderr_out the stderr_out value to parse |
| 400 | -function stderr_error_string($stderr_out){ |
|
| 402 | +function stderr_error_string($stderr_out) { |
|
| 401 | 403 | $y = parse_element($stderr_out, "<error_code>"); |
| 402 | 404 | $x = 0; |
| 403 | 405 | if ($y) { |
@@ -1176,7 +1178,7 @@ discard block |
||
| 1176 | 1178 | // result has not been received yet, so show report deadline either |
| 1177 | 1179 | // in green if in the future or in red if in the past. |
| 1178 | 1180 | $timenow=time(); |
| 1179 | - if ($result->report_deadline==0) { |
|
| 1181 | + if ($result->report_deadline==0) { |
|
| 1180 | 1182 | // not sent -- show create time in purple |
| 1181 | 1183 | $received = "<font color=\"9900cc\">". time_str($result->create_time) . "</font>"; |
| 1182 | 1184 | } else if ($result->report_deadline>=$timenow) { |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | function search_thread_titles( |
| 34 | 34 | $keyword_list, $forum="", $user="", $time="", $limit=200, |
| 35 | 35 | $sort_style=CREATE_TIME_NEW, $show_hidden = false |
| 36 | -){ |
|
| 36 | +) { |
|
| 37 | 37 | $search_string="%"; |
| 38 | 38 | foreach ($keyword_list as $key => $word) { |
| 39 | 39 | $search_string .= BoincDb::escape_string($word)."%"; |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | // |
| 85 | 85 | function search_post_content( |
| 86 | 86 | $keyword_list, $forum, $user, $time, $limit, $sort_style, $show_hidden |
| 87 | -){ |
|
| 87 | +) { |
|
| 88 | 88 | $db = BoincDb::get(); |
| 89 | 89 | |
| 90 | 90 | $search_string="%"; |
| 91 | - foreach ($keyword_list as $key => $word){ |
|
| 91 | + foreach ($keyword_list as $key => $word) { |
|
| 92 | 92 | $search_string .= BoincDb::escape_string($word)."%"; |
| 93 | 93 | } |
| 94 | 94 | $optional_join = ""; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | $logged_in_user = get_logged_in_user(false); |
| 136 | 136 | BoincForumPrefs::lookup($logged_in_user); |
| 137 | -if ($logged_in_user && $logged_in_user->prefs->privilege(S_MODERATOR)){ |
|
| 137 | +if ($logged_in_user && $logged_in_user->prefs->privilege(S_MODERATOR)) { |
|
| 138 | 138 | $show_hidden_posts = true; |
| 139 | 139 | } else { |
| 140 | 140 | $show_hidden_posts = false; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | $limit = 100; |
| 158 | 158 | |
| 159 | -if ($search_forum==-1){ |
|
| 159 | +if ($search_forum==-1) { |
|
| 160 | 160 | $forum = null; |
| 161 | 161 | } else if ($search_forum) { |
| 162 | 162 | $forum = BoincForum::lookup_id($search_forum); |
@@ -173,10 +173,10 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | // Display the threads while we search for posts |
| 175 | 175 | // |
| 176 | -if (count($threads)){ |
|
| 176 | +if (count($threads)) { |
|
| 177 | 177 | echo "<h3>" . tra("Thread titles matching your query:") . "</h3>"; |
| 178 | 178 | show_thread_and_context_header(); |
| 179 | - foreach ($threads as $thread){ |
|
| 179 | + foreach ($threads as $thread) { |
|
| 180 | 180 | if ($thread->hidden) continue; |
| 181 | 181 | show_thread_and_context($thread, $logged_in_user); |
| 182 | 182 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $show_hidden_posts |
| 193 | 193 | ); |
| 194 | 194 | |
| 195 | -if (count($posts)){ |
|
| 195 | +if (count($posts)) { |
|
| 196 | 196 | echo "<h3>" . tra("Messages matching your query:") . "</h3>"; |
| 197 | 197 | start_table(); |
| 198 | 198 | $n = 1; |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | end_table(); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | -if (!count($threads) && !count($posts)){ |
|
| 218 | +if (!count($threads) && !count($posts)) { |
|
| 219 | 219 | echo "<p>".tra("Sorry, couldn't find anything matching your search query. You can try to broaden your search by using less words (or less specific words).")."</p> |
| 220 | 220 | <p>" |
| 221 | 221 | .tra("You can also %1 try the same search on Google. %2", |
@@ -35,14 +35,14 @@ |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | $owner = BoincUser::lookup_id($thread->owner); |
| 38 | -if ($logged_in_user->id == $owner->id){ |
|
| 38 | +if ($logged_in_user->id == $owner->id) { |
|
| 39 | 39 | $action = get_str("action"); |
| 40 | 40 | if ($action == "set") { |
| 41 | 41 | $ret = $thread->update("status=1"); |
| 42 | 42 | } else { |
| 43 | 43 | $ret = $thread->update("status=0"); |
| 44 | 44 | } |
| 45 | - if (!$ret){ |
|
| 45 | + if (!$ret) { |
|
| 46 | 46 | error_page("Could not update the status of the thread: ".$thread->id); |
| 47 | 47 | } |
| 48 | 48 | } else { |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | proc_terminate($p); |
| 39 | 39 | // echo "child process is $ret\n"; |
| 40 | 40 | $pids=preg_split('/\s+/',$ret); |
| 41 | - foreach($pids as $pid){ |
|
| 42 | - if(is_numeric($pid)){ |
|
| 41 | + foreach($pids as $pid) { |
|
| 42 | + if(is_numeric($pid)) { |
|
| 43 | 43 | if($GLOBALS["debug"])echo "killing child process $pid\n"; |
| 44 | 44 | posix_kill($pid,9); |
| 45 | 45 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $p = proc_open("$cmd", $descs, $pipes); |
| 61 | 61 | while (1) { |
| 62 | 62 | $ctime=time(); |
| 63 | - if($ctime-$stime >=2 and ! file_exists("log.1")){ |
|
| 63 | + if($ctime-$stime >=2 and ! file_exists("log.1")) { |
|
| 64 | 64 | if($GLOBALS["debug"]) echo "time out "."<br>"; |
| 65 | 65 | terminate_job($p); |
| 66 | 66 | break; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | $steps = $end_step-$start_step; |
| 158 | 158 | $avg_cpu = $cpu/$steps; |
| 159 | 159 | #$avg_cpu = $cpu/$count; |
| 160 | - if ($GLOBALS["debug"]){ |
|
| 160 | + if ($GLOBALS["debug"]) { |
|
| 161 | 161 | echo "test steps is ".$steps."<br>"; |
| 162 | 162 | echo "avg_cpu is ".$avg_cpu."<br>"; |
| 163 | 163 | } |
@@ -169,20 +169,19 @@ discard block |
||
| 169 | 169 | return array($avg_cpu,$test_steps); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | -function calc_est_size($lammps_script, $structure_file, $cmd_file,$test_steps){ |
|
| 172 | +function calc_est_size($lammps_script, $structure_file, $cmd_file,$test_steps) { |
|
| 173 | 173 | $dump_types = 0; |
| 174 | 174 | $fd = fopen($lammps_script,"r"); |
| 175 | - if (!$fd){ |
|
| 175 | + if (!$fd) { |
|
| 176 | 176 | echo "can not open file $lammps_script\n"; |
| 177 | 177 | exit(-1); |
| 178 | 178 | } |
| 179 | - while (!feof($fd)){ |
|
| 179 | + while (!feof($fd)) { |
|
| 180 | 180 | $line = fgets($fd, 4096); |
| 181 | 181 | //if (preg_match("/^\s*dump/", $line) |
| 182 | 182 | // and preg_match_all("/dump\S+\.\w{3}/", $line, $matches, PREG_PATTERN_ORDER)) |
| 183 | 183 | |
| 184 | - if(preg_match("/^\s*dump\s+(\d)\s+/", $line,$matches)) |
|
| 185 | - { |
|
| 184 | + if(preg_match("/^\s*dump\s+(\d)\s+/", $line,$matches)) { |
|
| 186 | 185 | if($GLOBALS["debug"]){print "matches=";print_r($matches);} |
| 187 | 186 | |
| 188 | 187 | $dump_types=(int)$matches[1]; |
@@ -194,7 +193,7 @@ discard block |
||
| 194 | 193 | |
| 195 | 194 | $structure_file_size = filesize($structure_file); |
| 196 | 195 | $fd = fopen($cmd_file,"r"); |
| 197 | - if (!$fd){ |
|
| 196 | + if (!$fd) { |
|
| 198 | 197 | echo "can not open file $cmd_file\n"; |
| 199 | 198 | exit(-1); |
| 200 | 199 | } |
@@ -202,10 +201,10 @@ discard block |
||
| 202 | 201 | |
| 203 | 202 | $loopno=1; |
| 204 | 203 | $looprun=1; |
| 205 | - while (!feof($fd)){ |
|
| 204 | + while (!feof($fd)) { |
|
| 206 | 205 | $line = fgets($fd,4096); |
| 207 | - if(preg_match("/loopnumber\s+\d+/", $line, $matches)){ |
|
| 208 | - if(preg_match("/\d+/", $matches[0], $no)){ |
|
| 206 | + if(preg_match("/loopnumber\s+\d+/", $line, $matches)) { |
|
| 207 | + if(preg_match("/\d+/", $matches[0], $no)) { |
|
| 209 | 208 | //$loopno=$no[0]; |
| 210 | 209 | if($no[0]>$loopno)$loopno=$no[0]; |
| 211 | 210 | } |
@@ -215,7 +214,7 @@ discard block |
||
| 215 | 214 | } |
| 216 | 215 | } |
| 217 | 216 | fclose($fd); |
| 218 | - if($GLOBALS["debug"]){ |
|
| 217 | + if($GLOBALS["debug"]) { |
|
| 219 | 218 | print "max loopno(number of loops to run)=".$loopno."<br>"; |
| 220 | 219 | print "max looprun(steps for each loop)=".$looprun."<br>"; |
| 221 | 220 | } |
@@ -231,7 +230,7 @@ discard block |
||
| 231 | 230 | $app_fixed_size = 5e7; |
| 232 | 231 | $est_size = $log_size+$dump_size+$app_fixed_size; |
| 233 | 232 | |
| 234 | - if($GLOBALS["debug"]){ |
|
| 233 | + if($GLOBALS["debug"]) { |
|
| 235 | 234 | print "test_steps=".$test_steps."<br>"; |
| 236 | 235 | print "test_log_size=".$test_log_size."<br>"; |
| 237 | 236 | print "log_size1=".$log_size1."<br>"; |
@@ -367,7 +366,7 @@ discard block |
||
| 367 | 366 | $err="Your test job <strong>failed</strong> |
| 368 | 367 | <br>Please refer to the following Error Message:<br><p> |
| 369 | 368 | "; |
| 370 | - foreach($err_msgs as $line){ |
|
| 369 | + foreach($err_msgs as $line) { |
|
| 371 | 370 | $err=$err.$line."<br>"; |
| 372 | 371 | } |
| 373 | 372 | $err=$err." <p> |
@@ -380,9 +379,9 @@ discard block |
||
| 380 | 379 | $info->rsc_fpops_est = $est_cpu_time * 1.5e9; |
| 381 | 380 | $info->rsc_fpops_bound = $info->rsc_fpops_est * 20; |
| 382 | 381 | |
| 383 | - if ($disk==0){ |
|
| 382 | + if ($disk==0) { |
|
| 384 | 383 | $info->rsc_disk_bound=1000000; |
| 385 | - } else{ |
|
| 384 | + } else { |
|
| 386 | 385 | $info->rsc_disk_bound = $disk; |
| 387 | 386 | } |
| 388 | 387 | |
@@ -444,7 +443,7 @@ discard block |
||
| 444 | 443 | |
| 445 | 444 | $njobs=0; |
| 446 | 445 | $cmdlines = file($info->cmdline_file_path); |
| 447 | - foreach ($cmdlines as $cmdline){ |
|
| 446 | + foreach ($cmdlines as $cmdline) { |
|
| 448 | 447 | if (preg_match("/^\s*-var/", $cmdline)) { |
| 449 | 448 | $njobs++; |
| 450 | 449 | } |
@@ -460,7 +459,7 @@ discard block |
||
| 460 | 459 | |
| 461 | 460 | $i = 0; |
| 462 | 461 | foreach ($cmdlines as $cmdline) { |
| 463 | - if (preg_match("/^\s*-var/", $cmdline)){ |
|
| 462 | + if (preg_match("/^\s*-var/", $cmdline)) { |
|
| 464 | 463 | submit_job($app, $batch_id, $info, $cmdline, $i); |
| 465 | 464 | $i++; |
| 466 | 465 | } |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | $format = get_str("format", true); |
| 41 | 41 | |
| 42 | -if ($format=="xml"){ |
|
| 42 | +if ($format=="xml") { |
|
| 43 | 43 | // don't do caching for XML |
| 44 | 44 | xml_header(); |
| 45 | 45 | $retval = db_init_xml(); |
| 46 | 46 | if ($retval) xml_error($retval); |
| 47 | - if ($auth){ |
|
| 47 | + if ($auth) { |
|
| 48 | 48 | $user = BoincUser::lookup_auth($auth); |
| 49 | 49 | $show_hosts = true; |
| 50 | 50 | } else { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | // |
| 61 | 61 | $cache_args="userid=".$id; |
| 62 | 62 | $cached_data = get_cached_data(USER_PAGE_TTL, $cache_args); |
| 63 | - if ($cached_data){ |
|
| 63 | + if ($cached_data) { |
|
| 64 | 64 | // We found some old but non-stale data, let's use it |
| 65 | 65 | $data = unserialize($cached_data); |
| 66 | 66 | $user = $data->user; |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | // Delete a user if they have no credit, results, or posts |
| 41 | 41 | // |
| 42 | -function possibly_delete_user($user){ |
|
| 43 | - if ($user->total_credit > 0.0){ |
|
| 42 | +function possibly_delete_user($user) { |
|
| 43 | + if ($user->total_credit > 0.0) { |
|
| 44 | 44 | admin_error_page("Cannot delete user: User has credit."); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | admin_error_page("Cannot delete user: User has forum posts."); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if ($user->teamid){ |
|
| 59 | + if ($user->teamid) { |
|
| 60 | 60 | user_quit_team($user); |
| 61 | 61 | } |
| 62 | 62 | delete_user($user); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | // put a timestamp in wiki to trigger re-validation of credentials |
| 102 | 102 | |
| 103 | - if (function_exists('touch_wiki_user')){ |
|
| 103 | + if (function_exists('touch_wiki_user')) { |
|
| 104 | 104 | touch_wiki_user($user); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -43,14 +43,15 @@ |
||
| 43 | 43 | $forum_preferencess = _mysql_query("select * from forum_preferences where userid>$start_id order by userid"); |
| 44 | 44 | echo _mysql_error(); |
| 45 | 45 | $i=0; |
| 46 | - while ($forum_preferences = _mysql_fetch_object($forum_preferencess)){ |
|
| 46 | + while ($forum_preferences = _mysql_fetch_object($forum_preferencess)) { |
|
| 47 | 47 | $i++; |
| 48 | - if ($i%100 == 0) { //For every 100 forum_preferencess |
|
| 48 | + if ($i%100 == 0) { |
|
| 49 | +//For every 100 forum_preferencess |
|
| 49 | 50 | echo $forum_preferences->userid.". "; flush(); // print out where we are |
| 50 | 51 | //usleep(200000); |
| 51 | 52 | } |
| 52 | 53 | |
| 53 | - if ($forum_preferences->userid > $start_id){ |
|
| 54 | + if ($forum_preferences->userid > $start_id) { |
|
| 54 | 55 | fix_forum_preferences($forum_preferences); |
| 55 | 56 | } |
| 56 | 57 | } |
@@ -45,14 +45,15 @@ |
||
| 45 | 45 | $posts = _mysql_query("select * from post where id>$start_id order by id"); |
| 46 | 46 | echo _mysql_error(); |
| 47 | 47 | $i=0; |
| 48 | - while ($post = _mysql_fetch_object($posts)){ |
|
| 48 | + while ($post = _mysql_fetch_object($posts)) { |
|
| 49 | 49 | $i++; |
| 50 | - if ($i%100 == 0) { //For every 100 posts |
|
| 50 | + if ($i%100 == 0) { |
|
| 51 | +//For every 100 posts |
|
| 51 | 52 | echo $post->id.". "; flush(); // print out where we are |
| 52 | 53 | //usleep(200000); |
| 53 | 54 | } |
| 54 | 55 | |
| 55 | - if ($post->id > $start_id){ |
|
| 56 | + if ($post->id > $start_id) { |
|
| 56 | 57 | fix_post($post); |
| 57 | 58 | } |
| 58 | 59 | } |