@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | db_init(); |
27 | 27 | |
28 | 28 | function current_tally($voteid) { |
29 | - $query="select sum(yes) as ayes,count(id)-sum(yes) as nays from banishment_votes where voteid=".$voteid; |
|
29 | + $query = "select sum(yes) as ayes,count(id)-sum(yes) as nays from banishment_votes where voteid=".$voteid; |
|
30 | 30 | $result = _mysql_query($query); |
31 | 31 | $foobar = _mysql_fetch_object($result); |
32 | 32 | echo "<b>Current Tally</b> Ayes: ".$foobar->ayes." Nays: ".$foobar->nays."<p>"; |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | |
36 | 36 | function vote_is_in_progress($userid) { |
37 | 37 | // check whether a vote is already ongoing |
38 | - $now=time(); |
|
39 | - $query="select count(id) as count from banishment_vote where userid=".$userid." and end_time>".$now; |
|
38 | + $now = time(); |
|
39 | + $query = "select count(id) as count from banishment_vote where userid=".$userid." and end_time>".$now; |
|
40 | 40 | $result = _mysql_query($query); |
41 | 41 | if (!$result) { |
42 | 42 | echo "Database error attempting to read banishment_vote table 1.<p>"; |
@@ -51,56 +51,56 @@ discard block |
||
51 | 51 | return $foobar->count; |
52 | 52 | } |
53 | 53 | |
54 | -function start_vote($config,$logged_in_user,$user,$category,$reason) { |
|
55 | - $now=time(); |
|
56 | - $fin=$now+21600; |
|
54 | +function start_vote($config, $logged_in_user, $user, $category, $reason) { |
|
55 | + $now = time(); |
|
56 | + $fin = $now + 21600; |
|
57 | 57 | |
58 | 58 | |
59 | - if ( vote_is_in_progress($user->id) !=0 ) { |
|
59 | + if (vote_is_in_progress($user->id) != 0) { |
|
60 | 60 | echo "A banishment vote is already underway for this user.<p>"; |
61 | 61 | return 0; |
62 | 62 | } |
63 | - $query="insert into banishment_vote (userid,modid,start_time,end_time) values (".$user->id.",".$logged_in_user->id.",".$now.",".$fin.")"; |
|
63 | + $query = "insert into banishment_vote (userid,modid,start_time,end_time) values (".$user->id.",".$logged_in_user->id.",".$now.",".$fin.")"; |
|
64 | 64 | $result = _mysql_query($query); |
65 | 65 | if (!$result) { |
66 | 66 | echo "Database error attempting to insert to banishment_vote table.<p>"; |
67 | 67 | return 0; |
68 | 68 | } |
69 | 69 | |
70 | - $voteid=_mysql_insert_id(); |
|
71 | - $query="insert into banishment_votes (voteid,modid,time,yes) values (". $voteid .",". $logged_in_user->id .",". $now .",1)"; |
|
70 | + $voteid = _mysql_insert_id(); |
|
71 | + $query = "insert into banishment_votes (voteid,modid,time,yes) values (".$voteid.",".$logged_in_user->id.",".$now.",1)"; |
|
72 | 72 | $result = _mysql_query($query); |
73 | 73 | if (!$result) { |
74 | 74 | echo "Database error attempting to insert to banishment_votes table.<p>"; |
75 | 75 | return 0; |
76 | 76 | } |
77 | 77 | |
78 | - $query="update forum_preferences set banished_until=".$fin." where userid=".$user->id; |
|
78 | + $query = "update forum_preferences set banished_until=".$fin." where userid=".$user->id; |
|
79 | 79 | $result = _mysql_query($query); |
80 | 80 | |
81 | 81 | echo "Banishment vote started.<p><p>"; |
82 | 82 | current_tally($voteid); |
83 | - return send_banish_vote_email($user, 86400*14, $reason, $now+21600); |
|
83 | + return send_banish_vote_email($user, 86400*14, $reason, $now + 21600); |
|
84 | 84 | } |
85 | 85 | |
86 | -function vote_yes($config,$logged_in_user,$user) { |
|
87 | - $now=time(); |
|
86 | +function vote_yes($config, $logged_in_user, $user) { |
|
87 | + $now = time(); |
|
88 | 88 | // Check that a vote is underway. |
89 | - if (vote_is_in_progress($user->id)<1) { |
|
89 | + if (vote_is_in_progress($user->id) < 1) { |
|
90 | 90 | echo "No banishment vote is underway for this user.<p><p>"; |
91 | 91 | return 0; |
92 | 92 | } |
93 | 93 | // Find the voteid |
94 | - $query="select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now; |
|
94 | + $query = "select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now; |
|
95 | 95 | $result = _mysql_query($query); |
96 | 96 | $foobar = _mysql_fetch_object($result); |
97 | 97 | if (!$foobar) { |
98 | 98 | echo "Database error attempting to read banishment_vote table.<p>"; |
99 | 99 | return 0; |
100 | 100 | } |
101 | - $voteid=$foobar->voteid; |
|
101 | + $voteid = $foobar->voteid; |
|
102 | 102 | // Check whether mod has voted already. |
103 | - $query="select count(id) as count from banishment_votes where voteid=".$voteid." and modid=".$logged_in_user->id; |
|
103 | + $query = "select count(id) as count from banishment_votes where voteid=".$voteid." and modid=".$logged_in_user->id; |
|
104 | 104 | $result = _mysql_query($query); |
105 | 105 | $foobar = _mysql_fetch_object($result); |
106 | 106 | if (!$foobar) { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | return 0; |
114 | 114 | } |
115 | 115 | // insert the vote |
116 | - $query="insert into banishment_votes (voteid,modid,time,yes) values (" . $voteid .",". $logged_in_user->id .",". $now .",1)"; |
|
116 | + $query = "insert into banishment_votes (voteid,modid,time,yes) values (".$voteid.",".$logged_in_user->id.",".$now.",1)"; |
|
117 | 117 | $result = _mysql_query($query); |
118 | 118 | if (!$result) { |
119 | 119 | echo "Database error attempting to insert to banishment_votes table.<p>"; |
@@ -124,24 +124,24 @@ discard block |
||
124 | 124 | return 1; |
125 | 125 | } |
126 | 126 | |
127 | -function vote_no($config,$logged_in_user,$user) { |
|
127 | +function vote_no($config, $logged_in_user, $user) { |
|
128 | 128 | // Check that a vote is underway. |
129 | - $now=time(); |
|
130 | - if (vote_is_in_progress($user->id)<1) { |
|
129 | + $now = time(); |
|
130 | + if (vote_is_in_progress($user->id) < 1) { |
|
131 | 131 | echo "No banishment vote is underway for this user.<p>"; |
132 | 132 | return 0; |
133 | 133 | } |
134 | 134 | // Find the voteid |
135 | - $query="select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now; |
|
135 | + $query = "select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now; |
|
136 | 136 | $result = _mysql_query($query); |
137 | 137 | $foobar = _mysql_fetch_object($result); |
138 | 138 | if (!$foobar) { |
139 | 139 | echo "Database error attempting to read banishment_vote table.<p>"; |
140 | 140 | return 0; |
141 | 141 | } |
142 | - $voteid=$foobar->voteid; |
|
142 | + $voteid = $foobar->voteid; |
|
143 | 143 | // Check whether mod has voted already. |
144 | - $query="select count(id) as count from banishment_votes where voteid=".$voteid ." and modid=".$logged_in_user->id; |
|
144 | + $query = "select count(id) as count from banishment_votes where voteid=".$voteid." and modid=".$logged_in_user->id; |
|
145 | 145 | $result = _mysql_query($query); |
146 | 146 | $foobar = _mysql_fetch_object($result); |
147 | 147 | if (!$foobar) { |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | return 0; |
155 | 155 | } |
156 | 156 | // insert the vote |
157 | - $query="insert into banishment_votes (voteid,modid,time,yes) values (" . $voteid .",". $logged_in_user->id .",". $now .",0)"; |
|
157 | + $query = "insert into banishment_votes (voteid,modid,time,yes) values (".$voteid.",".$logged_in_user->id.",".$now.",0)"; |
|
158 | 158 | $result = _mysql_query($query); |
159 | 159 | if (!$result) { |
160 | 160 | echo "Database error attempting to insert to banishment_votes table.<p>"; |
@@ -25,17 +25,17 @@ |
||
25 | 25 | page_head(tra("Download BOINC add-on software")); |
26 | 26 | echo " |
27 | 27 | <p>" . |
28 | - tra("You can download applications in several categories.") ." |
|
28 | + tra("You can download applications in several categories.")." |
|
29 | 29 | <ul> |
30 | 30 | <li>". |
31 | - tra("These applications are not endorsed by %1 and you use them at your own risk.", PROJECT) ." |
|
31 | + tra("These applications are not endorsed by %1 and you use them at your own risk.", PROJECT)." |
|
32 | 32 | <li>" . |
33 | 33 | tra("We do not provide instructions for installing these applications. |
34 | 34 | However, the author may have provided some help on installing or uninstalling the application. |
35 | 35 | If this is not enough you should contact the author."). |
36 | 36 | tra("Instructions for installing and running BOINC are %1 here %2.", "<a href=https://boinc.berkeley.edu/download.php>", "</a>") |
37 | - . "<li>" . |
|
38 | - tra("This list is managed centrally at %1 the BOINC website %2.", "<a href=\"https://boinc.berkeley.edu/addons.php\">", "</a>") ." |
|
37 | + . "<li>". |
|
38 | + tra("This list is managed centrally at %1 the BOINC website %2.", "<a href=\"https://boinc.berkeley.edu/addons.php\">", "</a>")." |
|
39 | 39 | </ul> |
40 | 40 | "; |
41 | 41 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | // where team includes a field "refcnt". |
32 | 32 | // |
33 | 33 | function merge_lists($list1, &$list2, $weight) { |
34 | - foreach($list1 as $team) { |
|
34 | + foreach ($list1 as $team) { |
|
35 | 35 | $id = $team->id; |
36 | 36 | if (array_key_exists($id, $list2)) { |
37 | 37 | $list2[$id]->refcnt += $weight; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | if (defined("SHOW_NONVALIDATED_TEAMS")) { |
98 | 98 | $user = BoincUser::lookup_id($team->userid); |
99 | 99 | echo "<td>"; |
100 | - echo $user->email_validated?"Yes":"No"; |
|
100 | + echo $user->email_validated ? "Yes" : "No"; |
|
101 | 101 | echo "</td>\n"; |
102 | 102 | } |
103 | 103 | echo " |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | xml_header(); |
138 | 138 | echo "<teams>\n"; |
139 | 139 | sort_list($list); |
140 | - foreach($list as $team) { |
|
140 | + foreach ($list as $team) { |
|
141 | 141 | show_team_xml($team); |
142 | 142 | } |
143 | 143 | echo "</teams>\n"; |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | merge_lists($list2, $list, 3); |
165 | 165 | $tried = true; |
166 | 166 | } |
167 | - if (strlen($params->country) && $params->country!='None') { |
|
167 | + if (strlen($params->country) && $params->country != 'None') { |
|
168 | 168 | $country = BoincDb::escape_string($params->country); |
169 | 169 | $list2 = get_teams("country = '$country'", $params->active); |
170 | 170 | //echo "<br>country matches: ",sizeof($list2); |
171 | 171 | merge_lists($list2, $list, 1); |
172 | 172 | $tried = true; |
173 | 173 | } |
174 | - if ($params->type and $params->type>1) { |
|
174 | + if ($params->type and $params->type > 1) { |
|
175 | 175 | $list2 = get_teams("type=$params->type", $params->active); |
176 | 176 | //echo "<br>type matches: ",sizeof($list2); |
177 | 177 | merge_lists($list2, $list, 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 { |
@@ -39,7 +39,7 @@ |
||
39 | 39 | } else { |
40 | 40 | $last_mod_time = time(); |
41 | 41 | } |
42 | -$create_date = gmdate('D, d M Y H:i:s', $last_mod_time) . ' GMT'; |
|
42 | +$create_date = gmdate('D, d M Y H:i:s', $last_mod_time).' GMT'; |
|
43 | 43 | |
44 | 44 | header("Expires: ".gmdate('D, d M Y H:i:s', time())." GMT"); |
45 | 45 | header("Last-Modified: ".$create_date); |
@@ -42,15 +42,15 @@ |
||
42 | 42 | $start_id = 0; //Set this to something else if you like |
43 | 43 | $forum_preferencess = _mysql_query("select * from forum_preferences where userid>$start_id order by userid"); |
44 | 44 | echo _mysql_error(); |
45 | - $i=0; |
|
46 | - while ($forum_preferences = _mysql_fetch_object($forum_preferencess)){ |
|
45 | + $i = 0; |
|
46 | + while ($forum_preferences = _mysql_fetch_object($forum_preferencess)) { |
|
47 | 47 | $i++; |
48 | 48 | if ($i%100 == 0) { //For every 100 forum_preferencess |
49 | - echo $forum_preferences->userid.". "; flush(); // print out where we are |
|
49 | + echo $forum_preferences->userid.". "; flush(); // print out where we are |
|
50 | 50 | //usleep(200000); |
51 | 51 | } |
52 | 52 | |
53 | - if ($forum_preferences->userid > $start_id){ |
|
53 | + if ($forum_preferences->userid > $start_id) { |
|
54 | 54 | fix_forum_preferences($forum_preferences); |
55 | 55 | } |
56 | 56 | } |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | |
27 | 27 | |
28 | 28 | // Create the graph. These two calls are always required |
29 | - $graph = new Graph(350,250,"auto"); |
|
29 | + $graph = new Graph(350, 250, "auto"); |
|
30 | 30 | //$graph->SetScale("lin"); |
31 | 31 | //$graph->SetScale("textlin"); |
32 | 32 | $graph->SetScale("loglin"); |
33 | 33 | |
34 | 34 | // Create the linear plot |
35 | - $lineplot=new BarPlot($arr, $xarr); |
|
35 | + $lineplot = new BarPlot($arr, $xarr); |
|
36 | 36 | $lineplot->SetColor("blue"); |
37 | 37 | |
38 | 38 | // Add the plot to the graph |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | function show_text($xarr, $yarr) { |
46 | 46 | $n = sizeof($xarr); |
47 | - for ($i=0; $i<$n; $i++) { |
|
47 | + for ($i = 0; $i < $n; $i++) { |
|
48 | 48 | echo "<br>$xarr[$i] $yarr[$i]\n"; |
49 | 49 | } |
50 | 50 | } |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | if ($ind > $maxind) $maxind = $ind; |
91 | 91 | } |
92 | 92 | $xarr = array(); |
93 | - for ($i=0; $i<=$maxind; $i++) { |
|
93 | + for ($i = 0; $i <= $maxind; $i++) { |
|
94 | 94 | $xarr[$i] = $i; |
95 | - if (is_null($yarr[$i])) $yarr[$i]=0; |
|
95 | + if (is_null($yarr[$i])) $yarr[$i] = 0; |
|
96 | 96 | } |
97 | 97 | if ($show_text) { |
98 | 98 | show_text($xarr, $yarr); |
@@ -44,15 +44,15 @@ |
||
44 | 44 | $start_id = 0; //Set this to something else if you like |
45 | 45 | $posts = _mysql_query("select * from post where id>$start_id order by id"); |
46 | 46 | echo _mysql_error(); |
47 | - $i=0; |
|
48 | - while ($post = _mysql_fetch_object($posts)){ |
|
47 | + $i = 0; |
|
48 | + while ($post = _mysql_fetch_object($posts)) { |
|
49 | 49 | $i++; |
50 | 50 | if ($i%100 == 0) { //For every 100 posts |
51 | - echo $post->id.". "; flush(); // print out where we are |
|
51 | + echo $post->id.". "; flush(); // print out where we are |
|
52 | 52 | //usleep(200000); |
53 | 53 | } |
54 | 54 | |
55 | - if ($post->id > $start_id){ |
|
55 | + if ($post->id > $start_id) { |
|
56 | 56 | fix_post($post); |
57 | 57 | } |
58 | 58 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | "deprecated?", |
73 | 73 | "" |
74 | 74 | ); |
75 | - $clause = $all?"true":"deprecated = 0"; |
|
75 | + $clause = $all ? "true" : "deprecated = 0"; |
|
76 | 76 | $avs = BoincAppVersion::enum( |
77 | 77 | "$clause order by appid, platformid, plan_class, version_num" |
78 | 78 | ); |
@@ -80,20 +80,20 @@ discard block |
||
80 | 80 | foreach ($avs as $av) { |
81 | 81 | // grey out deprecated versions |
82 | 82 | // |
83 | - $f1=$f2=''; |
|
83 | + $f1 = $f2 = ''; |
|
84 | 84 | if ($av->deprecated == 1) { |
85 | - $f1="<font color='GREY'>"; |
|
86 | - $f2="</font>"; |
|
85 | + $f1 = "<font color='GREY'>"; |
|
86 | + $f2 = "</font>"; |
|
87 | 87 | } |
88 | 88 | |
89 | - $all_value = $all?1:0; |
|
89 | + $all_value = $all ? 1 : 0; |
|
90 | 90 | $app = $apps[$av->appid]; |
91 | 91 | // ignore app versions of deprecated apps by default |
92 | 92 | if ($all_value == 0 && $app->deprecated == 1) { |
93 | 93 | continue; |
94 | 94 | } |
95 | 95 | echo "<tr class=row$i><form action=manage_app_versions.php?all=$all_value#av_$av->id method=POST>\n"; |
96 | - $i = 1-$i; |
|
96 | + $i = 1 - $i; |
|
97 | 97 | echo "<input type=hidden name=id value=$av->id>"; |
98 | 98 | echo " <TD>$f1 <a id='av_$av->id' href=db_action.php?table=app_version&id=$av->id>$av->id</a> $f2</TD>\n"; |
99 | 99 | |
@@ -110,15 +110,15 @@ discard block |
||
110 | 110 | $v = $av->min_core_version; |
111 | 111 | echo " <TD><input type='text' size='4' name=min_core_version value='$v'></TD>\n"; |
112 | 112 | |
113 | - $v=$av->max_core_version; |
|
113 | + $v = $av->max_core_version; |
|
114 | 114 | echo " <TD><input type='text' size='4' name=max_core_version value='$v'></TD>\n"; |
115 | 115 | |
116 | - $v=''; |
|
117 | - if ($av->beta) $v=' CHECKED '; |
|
116 | + $v = ''; |
|
117 | + if ($av->beta) $v = ' CHECKED '; |
|
118 | 118 | echo " <TD> <input name=beta type='checkbox' $v></TD>\n"; |
119 | 119 | |
120 | - $v=''; |
|
121 | - if ($av->deprecated) $v=' CHECKED '; |
|
120 | + $v = ''; |
|
121 | + if ($av->deprecated) $v = ' CHECKED '; |
|
122 | 122 | echo " <TD> <input name=deprecated type='checkbox' $v></TD>\n"; |
123 | 123 | |
124 | 124 | if (!in_rops()) { |