@@ -65,6 +65,9 @@ |
||
65 | 65 | return $running; |
66 | 66 | } |
67 | 67 | |
68 | +/** |
|
69 | + * @param boolean $running |
|
70 | + */ |
|
68 | 71 | function show_status($host, $function, $running) { |
69 | 72 | echo "<tr><td>$function</td><td>$host</td>"; |
70 | 73 | if ($running) { |
@@ -41,9 +41,9 @@ |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | function find_oldest() { |
44 | - $result=_mysql_query("select name,create_time from result where server_state=2 order by create_time limit 1"); |
|
45 | - $x = _mysql_fetch_object($result); |
|
46 | - return $x->create_time; |
|
44 | + $result=_mysql_query("select name,create_time from result where server_state=2 order by create_time limit 1"); |
|
45 | + $x = _mysql_fetch_object($result); |
|
46 | + return $x->create_time; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | function daemon_status($host, $pidname) { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | function find_oldest() { |
44 | - $result=_mysql_query("select name,create_time from result where server_state=2 order by create_time limit 1"); |
|
44 | + $result = _mysql_query("select name,create_time from result where server_state=2 order by create_time limit 1"); |
|
45 | 45 | $x = _mysql_fetch_object($result); |
46 | 46 | return $x->create_time; |
47 | 47 | } |
@@ -88,25 +88,25 @@ discard block |
||
88 | 88 | |
89 | 89 | |
90 | 90 | |
91 | -$dbrc = db_init(1); // 1=soft, remember that DB might be down |
|
91 | +$dbrc = db_init(1); // 1=soft, remember that DB might be down |
|
92 | 92 | |
93 | -page_head(PROJECT . " - Server Status"); |
|
93 | +page_head(PROJECT." - Server Status"); |
|
94 | 94 | |
95 | 95 | |
96 | 96 | // Date stamp |
97 | 97 | |
98 | 98 | |
99 | -echo "<br ALIGN=RIGHT> ".PROJECT. " server status as of ". |
|
100 | - date("g:i A T"). " on ". date("l, j F Y ") . |
|
99 | +echo "<br ALIGN=RIGHT> ".PROJECT." server status as of ". |
|
100 | + date("g:i A T")." on ".date("l, j F Y "). |
|
101 | 101 | " (updated every $Nmin minutes).\n"; |
102 | 102 | |
103 | -$proc_uptime=exec("cat /proc/uptime | cut -d\" \" -f-1"); |
|
103 | +$proc_uptime = exec("cat /proc/uptime | cut -d\" \" -f-1"); |
|
104 | 104 | $days = (int)($proc_uptime/86400); |
105 | -$hours=(int)($proc_uptime/3600); |
|
106 | -$hours=$hours % 24; |
|
107 | -$minutes=(int)($proc_uptime/60); |
|
108 | -$minutes=$minutes % 60; |
|
109 | -echo "<br ALIGN=RIGHT>The ".PROJECT. " main server has been continuously up for ". "$days"." days "."$hours"." hours "."$minutes"." minutes.\n<P>"; |
|
105 | +$hours = (int)($proc_uptime/3600); |
|
106 | +$hours = $hours%24; |
|
107 | +$minutes = (int)($proc_uptime/60); |
|
108 | +$minutes = $minutes%60; |
|
109 | +echo "<br ALIGN=RIGHT>The ".PROJECT." main server has been continuously up for "."$days"." days "."$hours"." hours "."$minutes"." minutes.\n<P>"; |
|
110 | 110 | |
111 | 111 | // tables side by side |
112 | 112 | echo "<TABLE><TR><TD align=center> \n"; |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | if ($dbrc) { |
153 | 153 | echo "The database server is not accessable"; |
154 | 154 | } else { |
155 | - $now=time(0); |
|
156 | - $s_day=24*3600; |
|
157 | - $d_ago=$now-$s_day; |
|
158 | - $s_week=7*$s_day; |
|
159 | - $w_ago=$now-$s_week; |
|
155 | + $now = time(0); |
|
156 | + $s_day = 24*3600; |
|
157 | + $d_ago = $now - $s_day; |
|
158 | + $s_week = 7*$s_day; |
|
159 | + $w_ago = $now - $s_week; |
|
160 | 160 | |
161 | 161 | echo " |
162 | 162 | <table border=2 cellpadding=6> |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | <tr><td>invalid</td><td>".number_format($n)."</td></tr> |
277 | 277 | "; |
278 | 278 | |
279 | - $n = time(0)-find_oldest(); |
|
279 | + $n = time(0) - find_oldest(); |
|
280 | 280 | $days = (int)($n/86400); |
281 | - $hours=(int)($n/3600); |
|
282 | - $hours=$hours % 24; |
|
283 | - $minutes=(int)($n/60); |
|
284 | - $minutes=$minutes % 60; |
|
281 | + $hours = (int)($n/3600); |
|
282 | + $hours = $hours%24; |
|
283 | + $minutes = (int)($n/60); |
|
284 | + $minutes = $minutes%60; |
|
285 | 285 | echo " |
286 | 286 | <tr><td>Oldest Unsent Result</td><td>".$days." d ".$hours." h ".$minutes." m</td></tr> |
287 | 287 | "; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | |
298 | 298 | // Display cgi-bin restriction status |
299 | 299 | |
300 | -if ( file_exists("../../cgi-bin/.htaccess") ) { |
|
300 | +if (file_exists("../../cgi-bin/.htaccess")) { |
|
301 | 301 | echo "<P><font color=RED> |
302 | 302 | <b>The ".PROJECT." scheduler is currently restricted |
303 | 303 | to uwm.edu and a few other domains. |
@@ -12,6 +12,9 @@ |
||
12 | 12 | // insert "\n</venue>\n" before "</global_preferences>" |
13 | 13 | // This fixes an XML error introduced at some point in the past |
14 | 14 | // |
15 | +/** |
|
16 | + * @return string |
|
17 | + */ |
|
15 | 18 | function repair_prefs($prefs) { |
16 | 19 | if (strstr($prefs, '\"')) { |
17 | 20 | return str_replace('\"', '"', $prefs); |
@@ -17,7 +17,9 @@ discard block |
||
17 | 17 | return str_replace('\"', '"', $prefs); |
18 | 18 | } |
19 | 19 | $x = strstr($prefs, "</global_preferences>", true); |
20 | - if (!$x) return null; |
|
20 | + if (!$x) { |
|
21 | + return null; |
|
22 | + } |
|
21 | 23 | return "$x\n </venue>\n</global_preferences>\n"; |
22 | 24 | } |
23 | 25 | |
@@ -60,7 +62,9 @@ discard block |
||
60 | 62 | $m = $n + 1000; |
61 | 63 | $users = BoincUser::enum("id >= $n and id < $m"); |
62 | 64 | //echo "processing from $n\n"; |
63 | - if (!$users) break; |
|
65 | + if (!$users) { |
|
66 | + break; |
|
67 | + } |
|
64 | 68 | process_set($users); |
65 | 69 | $n = $m; |
66 | 70 | } |
@@ -24,12 +24,18 @@ |
||
24 | 24 | |
25 | 25 | db_init(); |
26 | 26 | |
27 | +/** |
|
28 | + * @param string $tag |
|
29 | + */ |
|
27 | 30 | function parse_num($xml, $tag) { |
28 | 31 | $x = parse_element($xml, $tag); |
29 | 32 | if (!$x) return 0; |
30 | 33 | return $x; |
31 | 34 | } |
32 | 35 | |
36 | +/** |
|
37 | + * @param string $tag |
|
38 | + */ |
|
33 | 39 | function parse_boolint($xml, $tag) { |
34 | 40 | $x = parse_bool($xml, $tag); |
35 | 41 | if ($x) return 1; |
@@ -26,13 +26,17 @@ |
||
26 | 26 | |
27 | 27 | function parse_num($xml, $tag) { |
28 | 28 | $x = parse_element($xml, $tag); |
29 | - if (!$x) return 0; |
|
29 | + if (!$x) { |
|
30 | + return 0; |
|
31 | + } |
|
30 | 32 | return $x; |
31 | 33 | } |
32 | 34 | |
33 | 35 | function parse_boolint($xml, $tag) { |
34 | 36 | $x = parse_bool($xml, $tag); |
35 | - if ($x) return 1; |
|
37 | + if ($x) { |
|
38 | + return 1; |
|
39 | + } |
|
36 | 40 | return 0; |
37 | 41 | } |
38 | 42 |
@@ -231,6 +231,9 @@ discard block |
||
231 | 231 | } |
232 | 232 | } |
233 | 233 | |
234 | +/** |
|
235 | + * @param resource $log |
|
236 | + */ |
|
234 | 237 | function do_batch($startid, $n, $log) { |
235 | 238 | $result = _mysql_query( |
236 | 239 | "select * from user where id>$startid order by id limit $n" |
@@ -245,6 +248,9 @@ discard block |
||
245 | 248 | return $startid; |
246 | 249 | } |
247 | 250 | |
251 | +/** |
|
252 | + * @param resource $log |
|
253 | + */ |
|
248 | 254 | function do_one($thisid, $log) { |
249 | 255 | $result = _mysql_query( |
250 | 256 | "select * from user where id=$thisid" |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $globals->batch = 1000; |
56 | 56 | $globals->lapsed_interval = 60*86400; |
57 | 57 | |
58 | -for ($i=1; $i<$argc; $i++) { |
|
58 | +for ($i = 1; $i < $argc; $i++) { |
|
59 | 59 | if ($argv[$i] == "--batch") { |
60 | 60 | $i++; |
61 | 61 | $globals->batch = $argv[$i]; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | gmdate('d F Y', $user->create_time), |
170 | 170 | number_format($user->total_credit, 0), |
171 | 171 | opt_out_url($user), |
172 | - floor((time() - $user->last_rpc_time) / 86400), |
|
172 | + floor((time() - $user->last_rpc_time)/86400), |
|
173 | 173 | ); |
174 | 174 | return preg_replace($pat, $rep, $template); |
175 | 175 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | while ($user = _mysql_fetch_object($result)) { |
239 | 239 | handle_user($user); |
240 | 240 | $startid = $user->id; |
241 | - fputs($log, $user->id . "\n"); |
|
241 | + fputs($log, $user->id."\n"); |
|
242 | 242 | fflush($log); |
243 | 243 | } |
244 | 244 | _mysql_free_result($result); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $user = _mysql_fetch_object($result); |
253 | 253 | if ($user) { |
254 | 254 | handle_user($user); |
255 | - fputs($log, $user->id . "\n"); |
|
255 | + fputs($log, $user->id."\n"); |
|
256 | 256 | fflush($log); |
257 | 257 | } |
258 | 258 | _mysql_free_result($result); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | } else { |
290 | 290 | $fid = fopen($id_file, 'r'); |
291 | 291 | if (!$fid) { |
292 | - echo $id_file . ' not found - create ID list and run again\n'; |
|
292 | + echo $id_file.' not found - create ID list and run again\n'; |
|
293 | 293 | exit(); |
294 | 294 | } |
295 | 295 | $thisid = 0; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | } |
301 | 301 | fclose($fid); |
302 | 302 | } |
303 | - echo 'All done!' . "\n"; |
|
303 | + echo 'All done!'."\n"; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | if (!function_exists('make_php_mailer')) { |
@@ -150,7 +150,9 @@ discard block |
||
150 | 150 | $x = 0; |
151 | 151 | $result = _mysql_query("select rpc_time from host where userid=$user->id"); |
152 | 152 | while ($host = _mysql_fetch_object($result)) { |
153 | - if ($host->rpc_time > $x) $x = $host->rpc_time; |
|
153 | + if ($host->rpc_time > $x) { |
|
154 | + $x = $host->rpc_time; |
|
155 | + } |
|
154 | 156 | } |
155 | 157 | _mysql_free_result($result); |
156 | 158 | return $x; |
@@ -283,7 +285,9 @@ discard block |
||
283 | 285 | if ($id_file == "") { |
284 | 286 | while (1) { |
285 | 287 | $new_startid = do_batch($startid, $globals->batch, $f); |
286 | - if ($new_startid == $startid) break; |
|
288 | + if ($new_startid == $startid) { |
|
289 | + break; |
|
290 | + } |
|
287 | 291 | $startid = $new_startid; |
288 | 292 | } |
289 | 293 | } else { |
@@ -39,6 +39,9 @@ |
||
39 | 39 | BoincNotify::delete_aux("create_time < $t"); |
40 | 40 | } |
41 | 41 | |
42 | +/** |
|
43 | + * @param string $message |
|
44 | + */ |
|
42 | 45 | function send_notify_email($userid, $message) { |
43 | 46 | $user = BoincUser::lookup_id($userid); |
44 | 47 | $subject = "Daily notification summary from ".PROJECT; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | // delete notifications older than 90 days |
36 | 36 | // |
37 | 37 | function delete_old_notifies() { |
38 | - $t = time()-90*86400; |
|
38 | + $t = time() - 90*86400; |
|
39 | 39 | BoincNotify::delete_aux("create_time < $t"); |
40 | 40 | } |
41 | 41 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | function send_notify_emails() { |
62 | 62 | $db = BoincDb::get(); |
63 | 63 | |
64 | - $t = time() - (86400 + 3600); // 1-hour slop factor |
|
64 | + $t = time() - (86400 + 3600); // 1-hour slop factor |
|
65 | 65 | $query = "select notify.* from ".$db->db_name.".notify, ".$db->db_name.".forum_preferences where forum_preferences.pm_notification=2 and notify.userid = forum_preferences.userid and notify.create_time > $t"; |
66 | 66 | |
67 | 67 | $notifies = BoincNotify::enum_general($query); |
@@ -41,6 +41,9 @@ discard block |
||
41 | 41 | |
42 | 42 | // see if a web server is running at the given URL |
43 | 43 | // |
44 | +/** |
|
45 | + * @param string $url |
|
46 | + */ |
|
44 | 47 | function web_server_running($url) { |
45 | 48 | $u = parse_url($url); |
46 | 49 | $url = $u['scheme']."://".$u['host']; |
@@ -56,6 +59,9 @@ discard block |
||
56 | 59 | |
57 | 60 | // see if the given daemon is running on the host by checking its PID |
58 | 61 | // |
62 | +/** |
|
63 | + * @param string $host |
|
64 | + */ |
|
59 | 65 | function is_daemon_running($host, $d) { |
60 | 66 | if ($d->pid_file) { |
61 | 67 | $path = "../../pid_$host/".(string)$d->pid_file; |
@@ -80,41 +80,41 @@ |
||
80 | 80 | die("can't parse config file\n"); |
81 | 81 | } |
82 | 82 | $config = $c->config; |
83 | - $master_url = (string) $config->master_url; |
|
83 | + $master_url = (string)$config->master_url; |
|
84 | 84 | $u = parse_url($master_url); |
85 | 85 | $master_host = $u["host"]; |
86 | 86 | |
87 | - $url = (string) $config->download_url; |
|
87 | + $url = (string)$config->download_url; |
|
88 | 88 | $u = parse_url($url); |
89 | 89 | $h = $u["host"]; |
90 | 90 | if ($h != $master_host) { |
91 | 91 | $y = new StdClass; |
92 | 92 | $y->cmd = 'Download server'; |
93 | 93 | $y->host = $h; |
94 | - $y->status = web_server_running($url)?1:0; |
|
94 | + $y->status = web_server_running($url) ? 1 : 0; |
|
95 | 95 | $x[] = $y; |
96 | 96 | } |
97 | - $url = (string) $config->upload_url; |
|
97 | + $url = (string)$config->upload_url; |
|
98 | 98 | $u = parse_url($url); |
99 | 99 | $h = $u["host"]; |
100 | 100 | if ($h != $master_host) { |
101 | 101 | $y = new StdClass; |
102 | 102 | $y->cmd = 'Upload server'; |
103 | 103 | $y->host = $h; |
104 | - $y->status = web_server_running($url)?1:0; |
|
104 | + $y->status = web_server_running($url) ? 1 : 0; |
|
105 | 105 | $x[] = $y; |
106 | 106 | } |
107 | 107 | |
108 | 108 | $main_host = (string)$c->config->host; |
109 | 109 | if ($c->config->www_host) { |
110 | - $web_host = (string) $c->config->www_host; |
|
110 | + $web_host = (string)$c->config->www_host; |
|
111 | 111 | } else { |
112 | 112 | $web_host = $main_host; |
113 | 113 | } |
114 | 114 | $daemons = $c->daemons; |
115 | 115 | foreach ($daemons->daemon as $d) { |
116 | 116 | if ((int)$d->disabled != 0) continue; |
117 | - $host = $d->host?(string)$d->host:$main_host; |
|
117 | + $host = $d->host ? (string)$d->host : $main_host; |
|
118 | 118 | if ($host != $web_host) { |
119 | 119 | $y = new StdClass; |
120 | 120 | $y->cmd = (string)$d->cmd; |
@@ -65,10 +65,14 @@ discard block |
||
65 | 65 | $path = "../../pid_$host/$prog".".pid"; |
66 | 66 | } |
67 | 67 | $pid = trim(@file_get_contents($path)); |
68 | - if ($pid === false) return false; |
|
68 | + if ($pid === false) { |
|
69 | + return false; |
|
70 | + } |
|
69 | 71 | $cmd = "ssh $host 'ps $pid'"; |
70 | 72 | $out = exec($cmd); |
71 | - if (strstr($out, $pid)) return true; |
|
73 | + if (strstr($out, $pid)) { |
|
74 | + return true; |
|
75 | + } |
|
72 | 76 | return false; |
73 | 77 | } |
74 | 78 | |
@@ -113,7 +117,9 @@ discard block |
||
113 | 117 | } |
114 | 118 | $daemons = $c->daemons; |
115 | 119 | foreach ($daemons->daemon as $d) { |
116 | - if ((int)$d->disabled != 0) continue; |
|
120 | + if ((int)$d->disabled != 0) { |
|
121 | + continue; |
|
122 | + } |
|
117 | 123 | $host = $d->host?(string)$d->host:$main_host; |
118 | 124 | if ($host != $web_host) { |
119 | 125 | $y = new StdClass; |
@@ -107,10 +107,18 @@ |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | +/** |
|
111 | + * @param integer $i |
|
112 | + * |
|
113 | + * @return string |
|
114 | + */ |
|
110 | 115 | function app_version_dir($app_name, $i, $platform) { |
111 | 116 | return "apps/$app_name/1.$i/$platform"; |
112 | 117 | } |
113 | 118 | |
119 | +/** |
|
120 | + * @param integer $i |
|
121 | + */ |
|
114 | 122 | function make_app_version_dir($app_name, $i, $platform) { |
115 | 123 | @mkdir("apps/$app_name"); |
116 | 124 | @mkdir("apps/$app_name/1.$i"); |
@@ -132,7 +132,9 @@ discard block |
||
132 | 132 | $have_latest_wrapper = false; |
133 | 133 | while (1) { |
134 | 134 | $app_dir = app_version_dir($app_name, $i, $platform); |
135 | - if (!file_exists($app_dir)) break; |
|
135 | + if (!file_exists($app_dir)) { |
|
136 | + break; |
|
137 | + } |
|
136 | 138 | $latest_i = $i; |
137 | 139 | $i++; |
138 | 140 | } |
@@ -200,7 +202,9 @@ discard block |
||
200 | 202 | } |
201 | 203 | } |
202 | 204 | |
203 | -if ($argc != 2) usage(); |
|
205 | +if ($argc != 2) { |
|
206 | + usage(); |
|
207 | +} |
|
204 | 208 | $boinc_samples_dir = $argv[1]; |
205 | 209 | check_wrapper_exists(); |
206 | 210 | get_includes(); |
@@ -58,6 +58,9 @@ |
||
58 | 58 | return $x; |
59 | 59 | } |
60 | 60 | |
61 | +/** |
|
62 | + * @param resource $f |
|
63 | + */ |
|
61 | 64 | function handle_team($team, $f) { |
62 | 65 | echo "Team: $team->name\n"; |
63 | 66 | $user = BoincUser::lookup_id($team->userid); |
@@ -100,7 +100,7 @@ |
||
100 | 100 | $f = fopen("temp.xml", "w"); |
101 | 101 | $teams = BoincTeam::enum(null); |
102 | 102 | fwrite($f, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<teams>\n"); |
103 | - foreach($teams as $team) { |
|
103 | + foreach ($teams as $team) { |
|
104 | 104 | handle_team($team, $f); |
105 | 105 | } |
106 | 106 | fwrite($f, "</teams>\n"); |
@@ -88,6 +88,9 @@ discard block |
||
88 | 88 | return null; |
89 | 89 | } |
90 | 90 | |
91 | +/** |
|
92 | + * @param stdClass $t |
|
93 | + */ |
|
91 | 94 | function valid_team($t) { |
92 | 95 | if (!$t->id) return false; |
93 | 96 | if (!$t->name) return false; |
@@ -96,6 +99,9 @@ discard block |
||
96 | 99 | return true; |
97 | 100 | } |
98 | 101 | |
102 | +/** |
|
103 | + * @param stdClass $t |
|
104 | + */ |
|
99 | 105 | function update_team($t, $team, $user) { |
100 | 106 | global $dry_run; |
101 | 107 | if ( |
@@ -126,6 +132,9 @@ discard block |
||
126 | 132 | } |
127 | 133 | } |
128 | 134 | |
135 | +/** |
|
136 | + * @param stdClass $t |
|
137 | + */ |
|
129 | 138 | function insert_case($t, $user) { |
130 | 139 | global $master_url; |
131 | 140 | global $dry_run; |
@@ -227,7 +227,7 @@ |
||
227 | 227 | if ($team->seti_id) { |
228 | 228 | if ($team->seti_id == $t->id) { |
229 | 229 | echo " case 1\n"; |
230 | - update_team($t, $team, $user); // update1 case |
|
230 | + update_team($t, $team, $user); // update1 case |
|
231 | 231 | } else { |
232 | 232 | echo " team exists but has wrong seti_id\n"; |
233 | 233 | } |
@@ -63,36 +63,54 @@ discard block |
||
63 | 63 | $t->user_postal_code = decode($t->user_postal_code); |
64 | 64 | $t->user_url = decode($t->user_url); |
65 | 65 | return $t; |
66 | - } |
|
67 | - else if (strstr($s, '<name>')) $t->name = parse_element($s, '<name>'); |
|
68 | - else if (strstr($s, '<url>')) $t->url = parse_element($s, '<url>'); |
|
69 | - else if (strstr($s, '<type>')) $t->type = parse_element($s, '<type>'); |
|
70 | - else if (strstr($s, '<name_html>')) $t->name_html = parse_element($s, '<name_html>'); |
|
71 | - else if (strstr($s, '<description>')) { |
|
66 | + } else if (strstr($s, '<name>')) { |
|
67 | + $t->name = parse_element($s, '<name>'); |
|
68 | + } else if (strstr($s, '<url>')) { |
|
69 | + $t->url = parse_element($s, '<url>'); |
|
70 | + } else if (strstr($s, '<type>')) { |
|
71 | + $t->type = parse_element($s, '<type>'); |
|
72 | + } else if (strstr($s, '<name_html>')) { |
|
73 | + $t->name_html = parse_element($s, '<name_html>'); |
|
74 | + } else if (strstr($s, '<description>')) { |
|
72 | 75 | while ($s = fgets($f)) { |
73 | - if (strstr($s, '</description>')) break; |
|
76 | + if (strstr($s, '</description>')) { |
|
77 | + break; |
|
78 | + } |
|
74 | 79 | $t->description .= $s; |
75 | 80 | } |
76 | - } |
|
77 | - else if (strstr($s, '<country>')) $t->country = parse_element($s, '<country>'); |
|
78 | - else if (strstr($s, '<id>')) $t->id = parse_element($s, '<id>'); |
|
79 | - else if (strstr($s, '<user_email_munged>')) { |
|
81 | + } else if (strstr($s, '<country>')) { |
|
82 | + $t->country = parse_element($s, '<country>'); |
|
83 | + } else if (strstr($s, '<id>')) { |
|
84 | + $t->id = parse_element($s, '<id>'); |
|
85 | + } else if (strstr($s, '<user_email_munged>')) { |
|
80 | 86 | $user_email_munged = parse_element($s, '<user_email_munged>'); |
81 | 87 | $t->user_email = str_rot13($user_email_munged); |
88 | + } else if (strstr($s, '<user_name>')) { |
|
89 | + $t->user_name = parse_element($s, '<user_name>'); |
|
90 | + } else if (strstr($s, '<user_country>')) { |
|
91 | + $t->user_country = parse_element($s, '<user_country>'); |
|
92 | + } else if (strstr($s, '<user_postal_code>')) { |
|
93 | + $t->user_postal_code = parse_element($s, '<user_postal_code>'); |
|
94 | + } else if (strstr($s, '<user_url>')) { |
|
95 | + $t->user_url = parse_element($s, '<user_url>'); |
|
82 | 96 | } |
83 | - else if (strstr($s, '<user_name>')) $t->user_name = parse_element($s, '<user_name>'); |
|
84 | - else if (strstr($s, '<user_country>')) $t->user_country = parse_element($s, '<user_country>'); |
|
85 | - else if (strstr($s, '<user_postal_code>')) $t->user_postal_code = parse_element($s, '<user_postal_code>'); |
|
86 | - else if (strstr($s, '<user_url>')) $t->user_url = parse_element($s, '<user_url>'); |
|
87 | 97 | } |
88 | 98 | return null; |
89 | 99 | } |
90 | 100 | |
91 | 101 | function valid_team($t) { |
92 | - if (!$t->id) return false; |
|
93 | - if (!$t->name) return false; |
|
94 | - if (!$t->user_email) return false; |
|
95 | - if (!$t->user_name) return false; |
|
102 | + if (!$t->id) { |
|
103 | + return false; |
|
104 | + } |
|
105 | + if (!$t->name) { |
|
106 | + return false; |
|
107 | + } |
|
108 | + if (!$t->user_email) { |
|
109 | + return false; |
|
110 | + } |
|
111 | + if (!$t->user_name) { |
|
112 | + return false; |
|
113 | + } |
|
96 | 114 | return true; |
97 | 115 | } |
98 | 116 | |
@@ -130,7 +148,9 @@ discard block |
||
130 | 148 | global $master_url; |
131 | 149 | global $dry_run; |
132 | 150 | if ($dry_run) { |
133 | - if (!$user) echo " making user $t->user_email\n"; |
|
151 | + if (!$user) { |
|
152 | + echo " making user $t->user_email\n"; |
|
153 | + } |
|
134 | 154 | echo " making team $t->name\n"; |
135 | 155 | return; |
136 | 156 | } |