@@ -46,8 +46,8 @@ |
||
46 | 46 | define('BOLT_COURSE_FINISHED', 3); |
47 | 47 | |
48 | 48 | // bits in bolt_user.flags |
49 | -define('BOLT_FLAGS_DEBUG', 1); // print debugging info in output pages |
|
50 | -define('BOLT_FLAGS_SHOW_ALL', 2); // show hidden courses |
|
49 | +define('BOLT_FLAGS_DEBUG', 1); // print debugging info in output pages |
|
50 | +define('BOLT_FLAGS_SHOW_ALL', 2); // show hidden courses |
|
51 | 51 | |
52 | 52 | class BoltDb extends DbConn { |
53 | 53 | static $instance; |
@@ -86,14 +86,14 @@ |
||
86 | 86 | function _mysql_field_attrs($r, $i) { |
87 | 87 | $x = mysqli_fetch_field_direct($r, $i); |
88 | 88 | switch ($x->type) { |
89 | - case 1: $x->type = 'tinyint'; break; |
|
90 | - case 2: $x->type = 'smallint'; break; |
|
91 | - case 3: $x->type = 'int'; break; |
|
92 | - case 5: $x->type = 'double'; break; |
|
93 | - case 7: $x->type = 'timestamp'; break; |
|
94 | - case 252: $x->type = 'blob'; break; |
|
95 | - case 253: $x->type = 'varchar'; break; |
|
96 | - case 254: $x->type = 'char'; break; |
|
89 | + case 1: $x->type = 'tinyint'; break; |
|
90 | + case 2: $x->type = 'smallint'; break; |
|
91 | + case 3: $x->type = 'int'; break; |
|
92 | + case 5: $x->type = 'double'; break; |
|
93 | + case 7: $x->type = 'timestamp'; break; |
|
94 | + case 252: $x->type = 'blob'; break; |
|
95 | + case 253: $x->type = 'varchar'; break; |
|
96 | + case 254: $x->type = 'char'; break; |
|
97 | 97 | } |
98 | 98 | return $x; |
99 | 99 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | function _mysql_connect($host, $user, $pass, $dbname) { |
44 | 44 | global $mysqli; |
45 | 45 | $x = explode(":", $host); |
46 | - if (sizeof($x)>1) { |
|
46 | + if (sizeof($x) > 1) { |
|
47 | 47 | $host = $x[0]; |
48 | 48 | $port = $x[1]; |
49 | 49 | } else { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | -function db_init_aux($try_replica=false) { |
|
165 | +function db_init_aux($try_replica = false) { |
|
166 | 166 | $config = get_config(); |
167 | 167 | $user = parse_config($config, "<db_user>"); |
168 | 168 | $pass = parse_config($config, "<db_passwd>"); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | echo " |
53 | 53 | <span style=\"width:".$size."px;height:".$size."px;position:absolute;top:".$cy.";left:".$cx.";color:white;border-style:solid;border-width:1px\"> |
54 | 54 | "; |
55 | - $c = $f->comment?"($f->comment)":""; |
|
55 | + $c = $f->comment ? "($f->comment)" : ""; |
|
56 | 56 | echo " |
57 | 57 | <span class=link> |
58 | 58 | <a href=\"javascript: void(0)\"> |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $features = $opaque_data->features; |
99 | 99 | $x = ""; |
100 | 100 | foreach ($features as $f) { |
101 | - $c = $f->comment?"($f->comment)":""; |
|
101 | + $c = $f->comment ? "($f->comment)" : ""; |
|
102 | 102 | $x .= "$f->type $c <br>"; |
103 | 103 | } |
104 | 104 | return $x; |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | header("Expires: Thu, 01 Jan 1970 00:00:00 GMT"); |
24 | 24 | |
25 | 25 | echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>" |
26 | - . "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" " |
|
27 | - . "\"http://www.wapforum.org/DTD/wml_1.2.xml\">" |
|
28 | - . "<wml><card id=\"cd1\"><p>"; |
|
26 | + . "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" " |
|
27 | + . "\"http://www.wapforum.org/DTD/wml_1.2.xml\">" |
|
28 | + . "<wml><card id=\"cd1\"><p>"; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | function wap_end() { |
@@ -33,6 +33,6 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | function wap_timestamp() { |
36 | - return gmdate('j M Y G:i:s', time()) . " UTC"; |
|
36 | + return gmdate('j M Y G:i:s', time()) . " UTC"; |
|
37 | 37 | } |
38 | 38 | ?> |
@@ -33,6 +33,6 @@ |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | function wap_timestamp() { |
36 | - return gmdate('j M Y G:i:s', time()) . " UTC"; |
|
36 | + return gmdate('j M Y G:i:s', time())." UTC"; |
|
37 | 37 | } |
38 | 38 | ?> |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | $gd_info = gd_info(); |
24 | 24 | // libgd version numbers seem to be always three numbers |
25 | 25 | preg_match('/(\d).(\d).(\d)/', $gd_info['GD Version'], $match); |
26 | - $newGD = ($match[1]>=2); |
|
26 | + $newGD = ($match[1] >= 2); |
|
27 | 27 | |
28 | 28 | list($ow, $oh, $from_type) = getimagesize($sourcefile); |
29 | - switch($from_type) { |
|
29 | + switch ($from_type) { |
|
30 | 30 | case 1: // GIF |
31 | 31 | $srcImage = imageCreateFromGif($sourcefile); |
32 | 32 | break; |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | $tempw = $fw; |
42 | 42 | $temph = number_format((($oh*$fw)/$ow), 0); |
43 | 43 | |
44 | - if($temph < $fh) { |
|
44 | + if ($temph < $fh) { |
|
45 | 45 | $tempw = number_format((($ow*$fh)/$oh), 0); |
46 | 46 | $temph = $fh; |
47 | 47 | } |
48 | 48 | |
49 | - if ($newGD){ |
|
49 | + if ($newGD) { |
|
50 | 50 | $tempImage = imageCreateTrueColor($tempw, $temph); |
51 | 51 | // Seems not to work: |
52 | 52 | // imageAntiAlias($tempImage, true); |
@@ -58,15 +58,15 @@ discard block |
||
58 | 58 | |
59 | 59 | |
60 | 60 | // Calculate offsets |
61 | - if($temph < $fh) { |
|
62 | - $offsety = number_format(($temph/2)-($fh/2), 0); |
|
61 | + if ($temph < $fh) { |
|
62 | + $offsety = number_format(($temph/2) - ($fh/2), 0); |
|
63 | 63 | $offsetx = 0; |
64 | 64 | } else { |
65 | 65 | $offsety = 0; |
66 | - $offsetx = number_format(($tempw/2)-($fw/2), 0); |
|
66 | + $offsetx = number_format(($tempw/2) - ($fw/2), 0); |
|
67 | 67 | } |
68 | 68 | |
69 | - if ($newGD){ |
|
69 | + if ($newGD) { |
|
70 | 70 | $destImage = imageCreateTrueColor($fw, $fh); |
71 | 71 | // Seems not to work: |
72 | 72 | // imageAntiAlias($tempImage, true); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $temph = $fh; |
47 | 47 | } |
48 | 48 | |
49 | - if ($newGD){ |
|
49 | + if ($newGD) { |
|
50 | 50 | $tempImage = imageCreateTrueColor($tempw, $temph); |
51 | 51 | // Seems not to work: |
52 | 52 | // imageAntiAlias($tempImage, true); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $offsetx = number_format(($tempw/2)-($fw/2), 0); |
67 | 67 | } |
68 | 68 | |
69 | - if ($newGD){ |
|
69 | + if ($newGD) { |
|
70 | 70 | $destImage = imageCreateTrueColor($fw, $fh); |
71 | 71 | // Seems not to work: |
72 | 72 | // imageAntiAlias($tempImage, true); |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | function select_cmp($a, $b) { |
20 | 20 | if ($a->value == $b->value) return 0; |
21 | - return ($a->value < $b->value)?1:-1; |
|
21 | + return ($a->value < $b->value) ? 1 : -1; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | class BoltSelect extends BoltSet { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | function team_type_name($num) { |
39 | 39 | global $team_types; |
40 | - if ($num>0 && $num<count($team_types)) { |
|
40 | + if ($num > 0 && $num < count($team_types)) { |
|
41 | 41 | return $team_types[$num]; |
42 | 42 | } |
43 | 43 | return "None"; |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | |
54 | 54 | function team_type_num($name) { |
55 | 55 | global $team_types; |
56 | - for ($i=0; $i<sizeof($team_types); $i++) { |
|
56 | + for ($i = 0; $i < sizeof($team_types); $i++) { |
|
57 | 57 | if ($name == $team_types[$i]) return $i; |
58 | 58 | } |
59 | 59 | return 0; |
60 | 60 | } |
61 | 61 | |
62 | -function team_type_select($selected_type, $allow_none=false){ |
|
62 | +function team_type_select($selected_type, $allow_none = false) { |
|
63 | 63 | global $team_types; |
64 | 64 | |
65 | 65 | $types = $team_types; |
@@ -59,7 +59,7 @@ |
||
59 | 59 | return 0; |
60 | 60 | } |
61 | 61 | |
62 | -function team_type_select($selected_type, $allow_none=false){ |
|
62 | +function team_type_select($selected_type, $allow_none=false) { |
|
63 | 63 | global $team_types; |
64 | 64 | |
65 | 65 | $types = $team_types; |
@@ -74,9 +74,9 @@ |
||
74 | 74 | foreach ($insts as $inst) { |
75 | 75 | $results[] = $inst->get_opaque_data(); |
76 | 76 | } |
77 | - for ($i=0; $i<$n-1; $i++) { |
|
77 | + for ($i = 0; $i < $n - 1; $i++) { |
|
78 | 78 | $r1 = $results[$i]; |
79 | - for ($j=$i+1; $j<$n; $j++) { |
|
79 | + for ($j = $i + 1; $j < $n; $j++) { |
|
80 | 80 | $r2 = $results[$j]; |
81 | 81 | if (compatible($r1, $r2)) { |
82 | 82 | $job->set_state(BOSSA_JOB_DONE); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | // see if there's a negative consensus |
123 | 123 | // |
124 | 124 | $prob = 1; |
125 | - for ($i=0; $i<$n; $i++) { |
|
125 | + for ($i = 0; $i < $n; $i++) { |
|
126 | 126 | $r = $results[$i]; |
127 | 127 | if ($r1->have_ellipse) continue; |
128 | 128 | $u = $users[$i]; |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | |
136 | 136 | // see if there's a positive consensus |
137 | 137 | // |
138 | - for ($i=0; $i<$n; $i++) { |
|
138 | + for ($i = 0; $i < $n; $i++) { |
|
139 | 139 | $r1 = $results[$i]; |
140 | 140 | $u = $users[$i]; |
141 | 141 | $prob = $u->pos_error_rate; |
142 | - for ($j=0; $j<$n; $j++) { |
|
142 | + for ($j = 0; $j < $n; $j++) { |
|
143 | 143 | if ($j == $i) continue; |
144 | 144 | $r2 = $results[$j]; |
145 | 145 | if (compatible($r1, $r2)) { |