@@ -176,8 +176,8 @@ |
||
176 | 176 | echo "<tr><th>WU ID</th><th>WU name</th><th>App ID</th><th>Quorum</th><th>Unsent</th><th>In Progress</th><th>Success</th>"; |
177 | 177 | echo "<th>Download Errors</th><th>Compute Errors</th><th>Validate Errors</th><th>Error mask</th></tr>\n"; |
178 | 178 | |
179 | -$hidden=0; |
|
180 | -foreach($row_array as $row) { |
|
179 | +$hidden = 0; |
|
180 | +foreach ($row_array as $row) { |
|
181 | 181 | if ($hide_canceled == 'on' && (($row->error_mask & WU_ERROR_CANCELLED) == WU_ERROR_CANCELLED)) { |
182 | 182 | $hidden++; |
183 | 183 | continue; |
@@ -138,25 +138,25 @@ discard block |
||
138 | 138 | "VU", "WF", "WS", "YE", "YT", "CS", "ZA", "ZM", "ZR", "ZW", "A1", "A2", "O1" |
139 | 139 | ); |
140 | 140 | var $GEOIP_COUNTRY_CODES3 = array( |
141 | -"","AP","EU","AND","ARE","AFG","ATG","AIA","ALB","ARM","ANT","AGO","AQ","ARG", |
|
142 | -"ASM","AUT","AUS","ABW","AZE","BIH","BRB","BGD","BEL","BFA","BGR","BHR","BDI", |
|
143 | -"BEN","BMU","BRN","BOL","BRA","BHS","BTN","BV","BWA","BLR","BLZ","CAN","CC", |
|
144 | -"COD","CAF","COG","CHE","CIV","COK","CHL","CMR","CHN","COL","CRI","CUB","CPV", |
|
145 | -"CX","CYP","CZE","DEU","DJI","DNK","DMA","DOM","DZA","ECU","EST","EGY","ESH", |
|
146 | -"ERI","ESP","ETH","FIN","FJI","FLK","FSM","FRO","FRA","FX","GAB","GBR","GRD", |
|
147 | -"GEO","GUF","GHA","GIB","GRL","GMB","GIN","GLP","GNQ","GRC","GS","GTM","GUM", |
|
148 | -"GNB","GUY","HKG","HM","HND","HRV","HTI","HUN","IDN","IRL","ISR","IND","IO", |
|
149 | -"IRQ","IRN","ISL","ITA","JAM","JOR","JPN","KEN","KGZ","KHM","KIR","COM","KNA", |
|
150 | -"PRK","KOR","KWT","CYM","KAZ","LAO","LBN","LCA","LIE","LKA","LBR","LSO","LTU", |
|
151 | -"LUX","LVA","LBY","MAR","MCO","MDA","MDG","MHL","MKD","MLI","MMR","MNG","MAC", |
|
152 | -"MNP","MTQ","MRT","MSR","MLT","MUS","MDV","MWI","MEX","MYS","MOZ","NAM","NCL", |
|
153 | -"NER","NFK","NGA","NIC","NLD","NOR","NPL","NRU","NIU","NZL","OMN","PAN","PER", |
|
154 | -"PYF","PNG","PHL","PAK","POL","SPM","PCN","PRI","PSE","PRT","PLW","PRY","QAT", |
|
155 | -"REU","ROU","RUS","RWA","SAU","SLB","SYC","SDN","SWE","SGP","SHN","SVN","SJM", |
|
156 | -"SVK","SLE","SMR","SEN","SOM","SUR","STP","SLV","SYR","SWZ","TCA","TCD","TF", |
|
157 | -"TGO","THA","TJK","TKL","TLS","TKM","TUN","TON","TUR","TTO","TUV","TWN","TZA", |
|
158 | -"UKR","UGA","UM","USA","URY","UZB","VAT","VCT","VEN","VGB","VIR","VNM","VUT", |
|
159 | - "WLF","WSM","YEM","YT","SCG","ZAF","ZMB","ZR","ZWE","A1","A2","O1" |
|
141 | +"", "AP", "EU", "AND", "ARE", "AFG", "ATG", "AIA", "ALB", "ARM", "ANT", "AGO", "AQ", "ARG", |
|
142 | +"ASM", "AUT", "AUS", "ABW", "AZE", "BIH", "BRB", "BGD", "BEL", "BFA", "BGR", "BHR", "BDI", |
|
143 | +"BEN", "BMU", "BRN", "BOL", "BRA", "BHS", "BTN", "BV", "BWA", "BLR", "BLZ", "CAN", "CC", |
|
144 | +"COD", "CAF", "COG", "CHE", "CIV", "COK", "CHL", "CMR", "CHN", "COL", "CRI", "CUB", "CPV", |
|
145 | +"CX", "CYP", "CZE", "DEU", "DJI", "DNK", "DMA", "DOM", "DZA", "ECU", "EST", "EGY", "ESH", |
|
146 | +"ERI", "ESP", "ETH", "FIN", "FJI", "FLK", "FSM", "FRO", "FRA", "FX", "GAB", "GBR", "GRD", |
|
147 | +"GEO", "GUF", "GHA", "GIB", "GRL", "GMB", "GIN", "GLP", "GNQ", "GRC", "GS", "GTM", "GUM", |
|
148 | +"GNB", "GUY", "HKG", "HM", "HND", "HRV", "HTI", "HUN", "IDN", "IRL", "ISR", "IND", "IO", |
|
149 | +"IRQ", "IRN", "ISL", "ITA", "JAM", "JOR", "JPN", "KEN", "KGZ", "KHM", "KIR", "COM", "KNA", |
|
150 | +"PRK", "KOR", "KWT", "CYM", "KAZ", "LAO", "LBN", "LCA", "LIE", "LKA", "LBR", "LSO", "LTU", |
|
151 | +"LUX", "LVA", "LBY", "MAR", "MCO", "MDA", "MDG", "MHL", "MKD", "MLI", "MMR", "MNG", "MAC", |
|
152 | +"MNP", "MTQ", "MRT", "MSR", "MLT", "MUS", "MDV", "MWI", "MEX", "MYS", "MOZ", "NAM", "NCL", |
|
153 | +"NER", "NFK", "NGA", "NIC", "NLD", "NOR", "NPL", "NRU", "NIU", "NZL", "OMN", "PAN", "PER", |
|
154 | +"PYF", "PNG", "PHL", "PAK", "POL", "SPM", "PCN", "PRI", "PSE", "PRT", "PLW", "PRY", "QAT", |
|
155 | +"REU", "ROU", "RUS", "RWA", "SAU", "SLB", "SYC", "SDN", "SWE", "SGP", "SHN", "SVN", "SJM", |
|
156 | +"SVK", "SLE", "SMR", "SEN", "SOM", "SUR", "STP", "SLV", "SYR", "SWZ", "TCA", "TCD", "TF", |
|
157 | +"TGO", "THA", "TJK", "TKL", "TLS", "TKM", "TUN", "TON", "TUR", "TTO", "TUV", "TWN", "TZA", |
|
158 | +"UKR", "UGA", "UM", "USA", "URY", "UZB", "VAT", "VCT", "VEN", "VGB", "VIR", "VNM", "VUT", |
|
159 | + "WLF", "WSM", "YEM", "YT", "SCG", "ZAF", "ZMB", "ZR", "ZWE", "A1", "A2", "O1" |
|
160 | 160 | ); |
161 | 161 | var $GEOIP_COUNTRY_NAMES = array( |
162 | 162 | "", "Asia/Pacific Region", "Europe", "Andorra", "United Arab Emirates", |
@@ -208,10 +208,10 @@ discard block |
||
208 | 208 | Grenadines", "Venezuela", "Virgin Islands, British", "Virgin Islands, U.S.", |
209 | 209 | "Vietnam", "Vanuatu", "Wallis and Futuna", "Samoa", "Yemen", "Mayotte", |
210 | 210 | "Serbia and Montenegro", "South Africa", "Zambia", "Zaire", "Zimbabwe", |
211 | -"Anonymous Proxy","Satellite Provider","Other" |
|
211 | +"Anonymous Proxy", "Satellite Provider", "Other" |
|
212 | 212 | ); |
213 | 213 | } |
214 | -function geoip_load_shared_mem ($file) { |
|
214 | +function geoip_load_shared_mem($file) { |
|
215 | 215 | |
216 | 216 | $fp = fopen($file, "rb"); |
217 | 217 | if (!$fp) { |
@@ -220,42 +220,42 @@ discard block |
||
220 | 220 | } |
221 | 221 | $s_array = fstat($fp); |
222 | 222 | $size = $s_array['size']; |
223 | - if ($shmid = @shmop_open (GEOIP_SHM_KEY, "w", 0, 0)) { |
|
224 | - shmop_delete ($shmid); |
|
225 | - shmop_close ($shmid); |
|
223 | + if ($shmid = @shmop_open(GEOIP_SHM_KEY, "w", 0, 0)) { |
|
224 | + shmop_delete($shmid); |
|
225 | + shmop_close($shmid); |
|
226 | 226 | } |
227 | - $shmid = shmop_open (GEOIP_SHM_KEY, "c", 0644, $size); |
|
228 | - shmop_write ($shmid, fread($fp, $size), 0); |
|
229 | - shmop_close ($shmid); |
|
227 | + $shmid = shmop_open(GEOIP_SHM_KEY, "c", 0644, $size); |
|
228 | + shmop_write($shmid, fread($fp, $size), 0); |
|
229 | + shmop_close($shmid); |
|
230 | 230 | } |
231 | 231 | |
232 | -function _setup_segments($gi){ |
|
232 | +function _setup_segments($gi) { |
|
233 | 233 | $gi->databaseType = GEOIP_COUNTRY_EDITION; |
234 | 234 | $gi->record_length = STANDARD_RECORD_LENGTH; |
235 | 235 | if ($gi->flags & GEOIP_SHARED_MEMORY) { |
236 | - $offset = @shmop_size ($gi->shmid) - 3; |
|
236 | + $offset = @shmop_size($gi->shmid) - 3; |
|
237 | 237 | for ($i = 0; $i < STRUCTURE_INFO_MAX_SIZE; $i++) { |
238 | - $delim = @shmop_read ($gi->shmid, $offset, 3); |
|
238 | + $delim = @shmop_read($gi->shmid, $offset, 3); |
|
239 | 239 | $offset += 3; |
240 | 240 | if ($delim == (chr(255).chr(255).chr(255))) { |
241 | - $gi->databaseType = ord(@shmop_read ($gi->shmid, $offset, 1)); |
|
241 | + $gi->databaseType = ord(@shmop_read($gi->shmid, $offset, 1)); |
|
242 | 242 | $offset++; |
243 | 243 | |
244 | - if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ |
|
244 | + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0) { |
|
245 | 245 | $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0; |
246 | - } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){ |
|
246 | + } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { |
|
247 | 247 | $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1; |
248 | - } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0)|| |
|
248 | + } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0) || |
|
249 | 249 | ($gi->databaseType == GEOIP_CITY_EDITION_REV1) |
250 | 250 | || ($gi->databaseType == GEOIP_ORG_EDITION) |
251 | 251 | || ($gi->databaseType == GEOIP_ISP_EDITION) |
252 | - || ($gi->databaseType == GEOIP_ASNUM_EDITION)){ |
|
252 | + || ($gi->databaseType == GEOIP_ASNUM_EDITION)) { |
|
253 | 253 | $gi->databaseSegments = 0; |
254 | - $buf = @shmop_read ($gi->shmid, $offset, SEGMENT_RECORD_LENGTH); |
|
255 | - for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){ |
|
256 | - $gi->databaseSegments += (ord($buf[$j]) << ($j * 8)); |
|
254 | + $buf = @shmop_read($gi->shmid, $offset, SEGMENT_RECORD_LENGTH); |
|
255 | + for ($j = 0; $j < SEGMENT_RECORD_LENGTH; $j++) { |
|
256 | + $gi->databaseSegments += (ord($buf[$j]) << ($j*8)); |
|
257 | 257 | } |
258 | - if (($gi->databaseType == GEOIP_ORG_EDITION)|| |
|
258 | + if (($gi->databaseType == GEOIP_ORG_EDITION) || |
|
259 | 259 | ($gi->databaseType == GEOIP_ISP_EDITION)) { |
260 | 260 | $gi->record_length = ORG_RECORD_LENGTH; |
261 | 261 | } |
@@ -265,32 +265,32 @@ discard block |
||
265 | 265 | $offset -= 4; |
266 | 266 | } |
267 | 267 | } |
268 | - if (($gi->databaseType == GEOIP_COUNTRY_EDITION)|| |
|
269 | - ($gi->databaseType == GEOIP_PROXY_EDITION)|| |
|
270 | - ($gi->databaseType == GEOIP_NETSPEED_EDITION)){ |
|
268 | + if (($gi->databaseType == GEOIP_COUNTRY_EDITION) || |
|
269 | + ($gi->databaseType == GEOIP_PROXY_EDITION) || |
|
270 | + ($gi->databaseType == GEOIP_NETSPEED_EDITION)) { |
|
271 | 271 | $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; |
272 | 272 | } |
273 | 273 | } else { |
274 | 274 | $filepos = ftell($gi->filehandle); |
275 | 275 | fseek($gi->filehandle, -3, SEEK_END); |
276 | 276 | for ($i = 0; $i < STRUCTURE_INFO_MAX_SIZE; $i++) { |
277 | - $delim = fread($gi->filehandle,3); |
|
278 | - if ($delim == (chr(255).chr(255).chr(255))){ |
|
279 | - $gi->databaseType = ord(fread($gi->filehandle,1)); |
|
280 | - if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ |
|
277 | + $delim = fread($gi->filehandle, 3); |
|
278 | + if ($delim == (chr(255).chr(255).chr(255))) { |
|
279 | + $gi->databaseType = ord(fread($gi->filehandle, 1)); |
|
280 | + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0) { |
|
281 | 281 | $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0; |
282 | 282 | } |
283 | - else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){ |
|
283 | + else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { |
|
284 | 284 | $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1; |
285 | - } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0) || |
|
285 | + } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0) || |
|
286 | 286 | ($gi->databaseType == GEOIP_CITY_EDITION_REV1) || |
287 | 287 | ($gi->databaseType == GEOIP_ORG_EDITION) || |
288 | 288 | ($gi->databaseType == GEOIP_ISP_EDITION) || |
289 | - ($gi->databaseType == GEOIP_ASNUM_EDITION)){ |
|
289 | + ($gi->databaseType == GEOIP_ASNUM_EDITION)) { |
|
290 | 290 | $gi->databaseSegments = 0; |
291 | - $buf = fread($gi->filehandle,SEGMENT_RECORD_LENGTH); |
|
292 | - for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){ |
|
293 | - $gi->databaseSegments += (ord($buf[$j]) << ($j * 8)); |
|
291 | + $buf = fread($gi->filehandle, SEGMENT_RECORD_LENGTH); |
|
292 | + for ($j = 0; $j < SEGMENT_RECORD_LENGTH; $j++) { |
|
293 | + $gi->databaseSegments += (ord($buf[$j]) << ($j*8)); |
|
294 | 294 | } |
295 | 295 | if ($gi->databaseType == GEOIP_ORG_EDITION) { |
296 | 296 | $gi->record_length = ORG_RECORD_LENGTH; |
@@ -301,12 +301,12 @@ discard block |
||
301 | 301 | fseek($gi->filehandle, -4, SEEK_CUR); |
302 | 302 | } |
303 | 303 | } |
304 | - if (($gi->databaseType == GEOIP_COUNTRY_EDITION)|| |
|
305 | - ($gi->databaseType == GEOIP_PROXY_EDITION)|| |
|
306 | - ($gi->databaseType == GEOIP_NETSPEED_EDITION)){ |
|
304 | + if (($gi->databaseType == GEOIP_COUNTRY_EDITION) || |
|
305 | + ($gi->databaseType == GEOIP_PROXY_EDITION) || |
|
306 | + ($gi->databaseType == GEOIP_NETSPEED_EDITION)) { |
|
307 | 307 | $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; |
308 | 308 | } |
309 | - fseek($gi->filehandle,$filepos,SEEK_SET); |
|
309 | + fseek($gi->filehandle, $filepos, SEEK_SET); |
|
310 | 310 | } |
311 | 311 | return $gi; |
312 | 312 | } |
@@ -315,9 +315,9 @@ discard block |
||
315 | 315 | $gi = new GeoIP; |
316 | 316 | $gi->flags = $flags; |
317 | 317 | if ($gi->flags & GEOIP_SHARED_MEMORY) { |
318 | - $gi->shmid = @shmop_open (GEOIP_SHM_KEY, "a", 0, 0); |
|
318 | + $gi->shmid = @shmop_open(GEOIP_SHM_KEY, "a", 0, 0); |
|
319 | 319 | } else { |
320 | - $gi->filehandle = fopen($filename,"rb"); |
|
320 | + $gi->filehandle = fopen($filename, "rb"); |
|
321 | 321 | if ($gi->flags & GEOIP_MEMORY_CACHE) { |
322 | 322 | $s_array = fstat($gi->filehandle); |
323 | 323 | $gi->memory_buffer = fread($gi->filehandle, $s_array[size]); |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | } |
346 | 346 | |
347 | 347 | function geoip_country_code_by_name($gi, $name) { |
348 | - $country_id = geoip_country_id_by_name($gi,$name); |
|
348 | + $country_id = geoip_country_id_by_name($gi, $name); |
|
349 | 349 | if ($country_id !== false) { |
350 | 350 | return $gi->GEOIP_COUNTRY_CODES[$country_id]; |
351 | 351 | } |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | } |
354 | 354 | |
355 | 355 | function geoip_country_name_by_name($gi, $name) { |
356 | - $country_id = geoip_country_id_by_name($gi,$name); |
|
356 | + $country_id = geoip_country_id_by_name($gi, $name); |
|
357 | 357 | if ($country_id !== false) { |
358 | 358 | return $gi->GEOIP_COUNTRY_NAMES[$country_id]; |
359 | 359 | } |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | } |
367 | 367 | |
368 | 368 | function geoip_country_code_by_addr($gi, $addr) { |
369 | - $country_id = geoip_country_id_by_addr($gi,$addr); |
|
369 | + $country_id = geoip_country_id_by_addr($gi, $addr); |
|
370 | 370 | if ($country_id !== false) { |
371 | 371 | return $gi->GEOIP_COUNTRY_CODES[$country_id]; |
372 | 372 | } |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | } |
375 | 375 | |
376 | 376 | function geoip_country_name_by_addr($gi, $addr) { |
377 | - $country_id = geoip_country_id_by_addr($gi,$addr); |
|
377 | + $country_id = geoip_country_id_by_addr($gi, $addr); |
|
378 | 378 | if ($country_id !== false) { |
379 | 379 | return $gi->GEOIP_COUNTRY_NAMES[$country_id]; |
380 | 380 | } |
@@ -386,24 +386,24 @@ discard block |
||
386 | 386 | for ($depth = 31; $depth >= 0; --$depth) { |
387 | 387 | if ($gi->flags & GEOIP_MEMORY_CACHE) { |
388 | 388 | $buf = substr($gi->memory_buffer, |
389 | - 2 * $gi->record_length * $offset, |
|
390 | - 2 * $gi->record_length); |
|
389 | + 2*$gi->record_length*$offset, |
|
390 | + 2*$gi->record_length); |
|
391 | 391 | } elseif ($gi->flags & GEOIP_SHARED_MEMORY) { |
392 | - $buf = @shmop_read ($gi->shmid, |
|
393 | - 2 * $gi->record_length * $offset, |
|
394 | - 2 * $gi->record_length ); |
|
392 | + $buf = @shmop_read($gi->shmid, |
|
393 | + 2*$gi->record_length*$offset, |
|
394 | + 2*$gi->record_length); |
|
395 | 395 | } else { |
396 | - fseek($gi->filehandle, 2 * $gi->record_length * $offset, SEEK_SET) == 0 |
|
396 | + fseek($gi->filehandle, 2*$gi->record_length*$offset, SEEK_SET) == 0 |
|
397 | 397 | or die("fseek failed"); |
398 | - $buf = fread($gi->filehandle, 2 * $gi->record_length); |
|
398 | + $buf = fread($gi->filehandle, 2*$gi->record_length); |
|
399 | 399 | } |
400 | - $x = array(0,0); |
|
400 | + $x = array(0, 0); |
|
401 | 401 | for ($i = 0; $i < 2; ++$i) { |
402 | 402 | for ($j = 0; $j < $gi->record_length; ++$j) { |
403 | - $x[$i] += ord($buf[$gi->record_length * $i + $j]) << ($j * 8); |
|
403 | + $x[$i] += ord($buf[$gi->record_length*$i + $j]) << ($j*8); |
|
404 | 404 | } |
405 | 405 | } |
406 | - if ($ipnum & (1 << $depth)) { |
|
406 | + if ($ipnum&(1 << $depth)) { |
|
407 | 407 | if ($x[1] >= $gi->databaseSegments) { |
408 | 408 | return $x[1]; |
409 | 409 | } |
@@ -419,23 +419,23 @@ discard block |
||
419 | 419 | return false; |
420 | 420 | } |
421 | 421 | |
422 | -function _get_org($gi,$ipnum){ |
|
423 | - $seek_org = _geoip_seek_country($gi,$ipnum); |
|
422 | +function _get_org($gi, $ipnum) { |
|
423 | + $seek_org = _geoip_seek_country($gi, $ipnum); |
|
424 | 424 | if ($seek_org == $gi->databaseSegments) { |
425 | 425 | return NULL; |
426 | 426 | } |
427 | - $record_pointer = $seek_org + (2 * $gi->record_length - 1) * $gi->databaseSegments; |
|
427 | + $record_pointer = $seek_org + (2*$gi->record_length - 1)*$gi->databaseSegments; |
|
428 | 428 | if ($gi->flags & GEOIP_SHARED_MEMORY) { |
429 | - $org_buf = @shmop_read ($gi->shmid, $record_pointer, MAX_ORG_RECORD_LENGTH); |
|
429 | + $org_buf = @shmop_read($gi->shmid, $record_pointer, MAX_ORG_RECORD_LENGTH); |
|
430 | 430 | } else { |
431 | 431 | fseek($gi->filehandle, $record_pointer, SEEK_SET); |
432 | - $org_buf = fread($gi->filehandle,MAX_ORG_RECORD_LENGTH); |
|
432 | + $org_buf = fread($gi->filehandle, MAX_ORG_RECORD_LENGTH); |
|
433 | 433 | } |
434 | 434 | $org_buf = substr($org_buf, 0, strpos($org_buf, 0)); |
435 | 435 | return $org_buf; |
436 | 436 | } |
437 | 437 | |
438 | -function geoip_org_by_addr ($gi,$addr) { |
|
438 | +function geoip_org_by_addr($gi, $addr) { |
|
439 | 439 | if ($addr == NULL) { |
440 | 440 | return 0; |
441 | 441 | } |
@@ -443,38 +443,38 @@ discard block |
||
443 | 443 | return _get_org($gi, $ipnum); |
444 | 444 | } |
445 | 445 | |
446 | -function _get_region($gi,$ipnum){ |
|
447 | - if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ |
|
448 | - $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV0; |
|
449 | - if ($seek_region >= 1000){ |
|
446 | +function _get_region($gi, $ipnum) { |
|
447 | + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0) { |
|
448 | + $seek_region = _geoip_seek_country($gi, $ipnum) - GEOIP_STATE_BEGIN_REV0; |
|
449 | + if ($seek_region >= 1000) { |
|
450 | 450 | $country_code = "US"; |
451 | - $region = chr(($seek_region - 1000)/26 + 65) . chr(($seek_region - 1000)%26 + 65); |
|
451 | + $region = chr(($seek_region - 1000)/26 + 65).chr(($seek_region - 1000)%26 + 65); |
|
452 | 452 | } else { |
453 | 453 | $country_code = $gi->GEOIP_COUNTRY_CODES[$seek_region]; |
454 | 454 | $region = ""; |
455 | 455 | } |
456 | - return array ($country_code,$region); |
|
457 | - } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { |
|
458 | - $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV1; |
|
456 | + return array($country_code, $region); |
|
457 | + } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { |
|
458 | + $seek_region = _geoip_seek_country($gi, $ipnum) - GEOIP_STATE_BEGIN_REV1; |
|
459 | 459 | //print $seek_region; |
460 | - if ($seek_region < US_OFFSET){ |
|
460 | + if ($seek_region < US_OFFSET) { |
|
461 | 461 | $country_code = ""; |
462 | 462 | $region = ""; |
463 | 463 | } else if ($seek_region < CANADA_OFFSET) { |
464 | 464 | $country_code = "US"; |
465 | - $region = chr(($seek_region - US_OFFSET)/26 + 65) . chr(($seek_region - US_OFFSET)%26 + 65); |
|
465 | + $region = chr(($seek_region - US_OFFSET)/26 + 65).chr(($seek_region - US_OFFSET)%26 + 65); |
|
466 | 466 | } else if ($seek_region < WORLD_OFFSET) { |
467 | 467 | $country_code = "CA"; |
468 | - $region = chr(($seek_region - CANADA_OFFSET)/26 + 65) . chr(($seek_region - CANADA_OFFSET)%26 + 65); |
|
468 | + $region = chr(($seek_region - CANADA_OFFSET)/26 + 65).chr(($seek_region - CANADA_OFFSET)%26 + 65); |
|
469 | 469 | } else { |
470 | - $country_code = $gi->GEOIP_COUNTRY_CODES[($seek_region - WORLD_OFFSET) / FIPS_RANGE]; |
|
470 | + $country_code = $gi->GEOIP_COUNTRY_CODES[($seek_region - WORLD_OFFSET)/FIPS_RANGE]; |
|
471 | 471 | $region = ""; |
472 | 472 | } |
473 | - return array ($country_code,$region); |
|
473 | + return array($country_code, $region); |
|
474 | 474 | } |
475 | 475 | } |
476 | 476 | |
477 | -function geoip_region_by_addr ($gi,$addr) { |
|
477 | +function geoip_region_by_addr($gi, $addr) { |
|
478 | 478 | if ($addr == NULL) { |
479 | 479 | return 0; |
480 | 480 | } |
@@ -482,12 +482,12 @@ discard block |
||
482 | 482 | return _get_region($gi, $ipnum); |
483 | 483 | } |
484 | 484 | |
485 | -function getdnsattributes ($l,$ip){ |
|
485 | +function getdnsattributes($l, $ip) { |
|
486 | 486 | $r = new Net_DNS_Resolver(); |
487 | 487 | $r->nameservers = array("ws1.maxmind.com"); |
488 | - $p = $r->search($l."." . $ip .".s.maxmind.com","TXT","IN"); |
|
489 | - $str = is_object($p->answer[0])?$p->answer[0]->string():''; |
|
490 | - ereg("\"(.*)\"",$str,$regs); |
|
488 | + $p = $r->search($l.".".$ip.".s.maxmind.com", "TXT", "IN"); |
|
489 | + $str = is_object($p->answer[0]) ? $p->answer[0]->string() : ''; |
|
490 | + ereg("\"(.*)\"", $str, $regs); |
|
491 | 491 | $str = $regs[1]; |
492 | 492 | return $str; |
493 | 493 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | function default_mode($item) { |
80 | - return $item->is_exercise()?BOLT_MODE_SHOW:BOLT_MODE_LESSON; |
|
80 | + return $item->is_exercise() ?BOLT_MODE_SHOW:BOLT_MODE_LESSON; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | // A page is being shown to the user; make a record of it |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | // show an item (lesson, exercise, answer page) |
172 | 172 | // |
173 | -function show_item($iter, $view_id, $prev_view_id, $mode, $repeat=null) { |
|
173 | +function show_item($iter, $view_id, $prev_view_id, $mode, $repeat = null) { |
|
174 | 174 | global $user; |
175 | 175 | global $course; |
176 | 176 | global $bolt_ex; |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | $bolt_ex->score = 0; |
463 | 463 | $bolt_query_string = $item->query_string; |
464 | 464 | srand($view_id); |
465 | - ob_start(); // buffer output to avoid showing exercise text |
|
465 | + ob_start(); // buffer output to avoid showing exercise text |
|
466 | 466 | require($item->filename); |
467 | 467 | ob_end_clean(); |
468 | 468 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | db_set_active('boinc_rw'); |
27 | 27 | $boincteam = db_fetch_object(db_query('SELECT * FROM team WHERE id=%d', array($team_id))); |
28 | 28 | $boincteam_members = db_query('SELECT id FROM user WHERE teamid=%d', array($team_id)); |
29 | - $boincteam_admin = (int) db_result(db_query('SELECT userid FROM team_admin WHERE teamid=%d', array($team_id))); |
|
29 | + $boincteam_admin = (int)db_result(db_query('SELECT userid FROM team_admin WHERE teamid=%d', array($team_id))); |
|
30 | 30 | db_set_active('default'); |
31 | 31 | |
32 | 32 | $team_exists = db_query('SELECT team_id FROM {boincteam} WHERE team_id = %d', $boincteam->id); |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | 'teaser' => $teaser, |
45 | 45 | 'uid' => boincuser_lookup_uid($boincteam->userid), |
46 | 46 | 'path' => null, |
47 | - 'status' => 1, // published or not - always publish |
|
47 | + 'status' => 1, // published or not - always publish |
|
48 | 48 | 'promote' => 0, |
49 | 49 | 'created' => $boincteam->create_time, |
50 | - 'comment' => 0, // comments disabled |
|
50 | + 'comment' => 0, // comments disabled |
|
51 | 51 | 'moderate' => 0, |
52 | 52 | 'sticky' => 0, |
53 | 53 | 'format' => $input_format |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | exit; |
64 | 64 | } |
65 | 65 | |
66 | - $node = (object) $node; // node_save requires an object form |
|
66 | + $node = (object)$node; // node_save requires an object form |
|
67 | 67 | |
68 | 68 | $node->taxonomy[] = taxonomy_get_term($team_type_tid); |
69 | 69 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | db_set_active('default'); |
82 | 82 | if ($boincteam_member_ids) { |
83 | 83 | $team_members = db_query('SELECT uid FROM {boincuser} WHERE boinc_id IN(%s)', implode(',', $boincteam_member_ids)); |
84 | - $team_admin = (int) db_result(db_query('SELECT uid FROM {boincuser} WHERE boinc_id=%d', $boincteam_admin)); |
|
84 | + $team_admin = (int)db_result(db_query('SELECT uid FROM {boincuser} WHERE boinc_id=%d', $boincteam_admin)); |
|
85 | 85 | |
86 | 86 | while ($drupal_user = db_fetch_object($team_members)) { |
87 | 87 | // Add action to take on member accounts? |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | if ($preset) { |
169 | 169 | // Load preset from configuration |
170 | - $preset_prefs = (array) $preset_prefs['general_preferences']; |
|
170 | + $preset_prefs = (array)$preset_prefs['general_preferences']; |
|
171 | 171 | if (isset($preset_prefs['preset'])) { |
172 | 172 | if (!is_numeric(key($preset_prefs['preset']))) { |
173 | 173 | $preset_prefs['preset'] = array($preset_prefs['preset']); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | function boincwork_get_project_specific_config() { |
189 | 189 | $raw_config_data = variable_get('boinc_project_specific_prefs_config', ''); |
190 | 190 | |
191 | - $xsd = './' . drupal_get_path('module', 'boincwork') . '/includes/projectprefs.xsd'; |
|
191 | + $xsd = './'.drupal_get_path('module', 'boincwork').'/includes/projectprefs.xsd'; |
|
192 | 192 | libxml_use_internal_errors(true); |
193 | 193 | |
194 | 194 | $xml = new DomDocument(); |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | if (!$xml->schemaValidate($xsd)) { |
197 | 197 | $errors = libxml_get_errors(); |
198 | 198 | $lines = explode("\r", $raw_config_data); |
199 | - drupal_set_message("{$errors[0]->message} at line {$errors[0]->line}" . |
|
200 | - ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), 'error'); |
|
199 | + drupal_set_message("{$errors[0]->message} at line {$errors[0]->line}". |
|
200 | + ': <br/>'.htmlentities($lines[$errors[0]->line - 1]), 'error'); |
|
201 | 201 | return NULL; |
202 | 202 | } |
203 | 203 | |
@@ -392,13 +392,13 @@ discard block |
||
392 | 392 | |
393 | 393 | // Use appropriate datatype |
394 | 394 | if (isset($element['@attributes']['datatype'])) { |
395 | - switch($element['@attributes']['datatype']) { |
|
395 | + switch ($element['@attributes']['datatype']) { |
|
396 | 396 | case 'integer': |
397 | - $value = (int) $value; |
|
397 | + $value = (int)$value; |
|
398 | 398 | break; |
399 | 399 | |
400 | 400 | case 'float': |
401 | - $value = number_format((float) $value, 2); |
|
401 | + $value = number_format((float)$value, 2); |
|
402 | 402 | break; |
403 | 403 | |
404 | 404 | default: |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | '#type' => 'textfield', |
421 | 421 | '#default_value' => $value, |
422 | 422 | '#size' => 5, |
423 | - '#description' => $description . bts(' Default value: @default', array('@default' => $default), NULL, 'boinc:account-preferences-project') |
|
423 | + '#description' => $description.bts(' Default value: @default', array('@default' => $default), NULL, 'boinc:account-preferences-project') |
|
424 | 424 | ); |
425 | 425 | } |
426 | 426 | break; |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | $name = $element['@attributes']['name']; |
485 | 485 | $default = null; |
486 | 486 | $options = array(); |
487 | - foreach($element['items']['item'] as $item) { |
|
487 | + foreach ($element['items']['item'] as $item) { |
|
488 | 488 | if (is_array($item)) { |
489 | 489 | $value = $item['@value']; |
490 | 490 | if ($default === NULL AND |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | '#options' => $options, |
527 | 527 | '#attributes' => array('class' => 'fancy'), |
528 | 528 | '#default_value' => $value, |
529 | - '#description' => $description . bts(' Default value: @default', array('@default' =>$default), NULL, 'boinc:account-preferences-project') |
|
529 | + '#description' => $description.bts(' Default value: @default', array('@default' =>$default), NULL, 'boinc:account-preferences-project') |
|
530 | 530 | ); |
531 | 531 | } |
532 | 532 | break; |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | } |
592 | 592 | foreach ($elements as $key => $element) { |
593 | 593 | $title = is_array($element['title']) ? $element['title']['@value'] : $element['title']; |
594 | - $name = str_replace(' ','_',strtolower($title)); |
|
594 | + $name = str_replace(' ', '_', strtolower($title)); |
|
595 | 595 | $name = "group_{$name}"; |
596 | 596 | |
597 | 597 | // Translate elements as appropriate |
@@ -743,13 +743,13 @@ discard block |
||
743 | 743 | if ($type == 'project') { |
744 | 744 | if ($boincuser->project_prefs) { |
745 | 745 | $main_prefs = load_configuration($boincuser->project_prefs); |
746 | - $main_prefs = (array) $main_prefs['project_preferences']; |
|
746 | + $main_prefs = (array)$main_prefs['project_preferences']; |
|
747 | 747 | } |
748 | 748 | } |
749 | 749 | else { |
750 | 750 | if ($boincuser->global_prefs) { |
751 | 751 | $main_prefs = load_configuration($boincuser->global_prefs); |
752 | - $main_prefs = (array) $main_prefs['global_preferences']; |
|
752 | + $main_prefs = (array)$main_prefs['global_preferences']; |
|
753 | 753 | } |
754 | 754 | } |
755 | 755 | |
@@ -801,13 +801,13 @@ discard block |
||
801 | 801 | if ($type == 'project') { |
802 | 802 | if ($boincuser->project_prefs) { |
803 | 803 | $main_prefs = load_configuration($boincuser->project_prefs); |
804 | - $main_prefs = (array) $main_prefs['project_preferences']; |
|
804 | + $main_prefs = (array)$main_prefs['project_preferences']; |
|
805 | 805 | } |
806 | 806 | } |
807 | 807 | else { |
808 | 808 | if ($boincuser->global_prefs) { |
809 | 809 | $main_prefs = load_configuration($boincuser->global_prefs); |
810 | - $main_prefs = (array) $main_prefs['global_preferences']; |
|
810 | + $main_prefs = (array)$main_prefs['global_preferences']; |
|
811 | 811 | } |
812 | 812 | } |
813 | 813 | |
@@ -1001,11 +1001,11 @@ discard block |
||
1001 | 1001 | $magnitude = 0; |
1002 | 1002 | $precision = 0; |
1003 | 1003 | if ($digits > $max_digits) { |
1004 | - $magnitude = floor(($digits - ($max_digits - 3)) / 3); |
|
1005 | - $precision = $max_digits - ($digits - ($magnitude * 3) + 1); |
|
1006 | - $number = round($number / pow(1000, $magnitude), $precision); |
|
1004 | + $magnitude = floor(($digits - ($max_digits - 3))/3); |
|
1005 | + $precision = $max_digits - ($digits - ($magnitude*3) + 1); |
|
1006 | + $number = round($number/pow(1000, $magnitude), $precision); |
|
1007 | 1007 | } |
1008 | - $number = number_format($number, $precision) . (($magnitude) ? "{$suffix[$magnitude]}" : ''); |
|
1008 | + $number = number_format($number, $precision).(($magnitude) ? "{$suffix[$magnitude]}" : ''); |
|
1009 | 1009 | |
1010 | 1010 | return $number; |
1011 | 1011 | } |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | |
1184 | 1184 | function text_to_xml($text) { |
1185 | 1185 | $xml = new DomDocument(); |
1186 | - if ( !($xml->loadXML($text)) ) return false; |
|
1186 | + if (!($xml->loadXML($text))) return false; |
|
1187 | 1187 | return $xml; |
1188 | 1188 | } |
1189 | 1189 | |
@@ -1200,7 +1200,7 @@ discard block |
||
1200 | 1200 | while (!is_null($node)) { |
1201 | 1201 | switch ($node->nodeType) { |
1202 | 1202 | case XML_TEXT_NODE: |
1203 | - if (trim($node->nodeValue) != '') $result = $node->nodeValue; |
|
1203 | + if (trim($node->nodeValue) != '') $result = $node->nodeValue; |
|
1204 | 1204 | break; |
1205 | 1205 | case XML_ELEMENT_NODE: |
1206 | 1206 | $node_name = $node->nodeName; |
@@ -1217,7 +1217,7 @@ discard block |
||
1217 | 1217 | if ($sibling) { |
1218 | 1218 | $result[$node_name][$index] = ''; |
1219 | 1219 | if ($node->childNodes) { |
1220 | - $result[$node_name][$index] = xml_to_array($node) ; |
|
1220 | + $result[$node_name][$index] = xml_to_array($node); |
|
1221 | 1221 | } |
1222 | 1222 | if ($node->hasAttributes()) { |
1223 | 1223 | $attributes = $node->attributes; |
@@ -1240,14 +1240,14 @@ discard block |
||
1240 | 1240 | } else { |
1241 | 1241 | $result[$node_name] = ''; |
1242 | 1242 | if ($node->childNodes) { |
1243 | - $result[$node_name] = xml_to_array($node) ; |
|
1243 | + $result[$node_name] = xml_to_array($node); |
|
1244 | 1244 | } |
1245 | 1245 | if ($node->hasAttributes()) { |
1246 | 1246 | $attributes = $node->attributes; |
1247 | 1247 | if ($result[$node_name] !== '' AND !is_array($result[$node_name])) { |
1248 | 1248 | $result[$node_name] = array('@value' => $result[$node_name]); |
1249 | 1249 | } |
1250 | - foreach($attributes as $key => $attribute) { |
|
1250 | + foreach ($attributes as $key => $attribute) { |
|
1251 | 1251 | $result[$node_name]['@attributes'][$attribute->name] = $attribute->value; |
1252 | 1252 | } |
1253 | 1253 | } |
@@ -1287,30 +1287,30 @@ discard block |
||
1287 | 1287 | // Determine if hosts are associated at all or just hidden |
1288 | 1288 | $output = ''; |
1289 | 1289 | if ($boincuser->show_hosts) { |
1290 | - switch($context) { |
|
1290 | + switch ($context) { |
|
1291 | 1291 | case 'active': |
1292 | - $output .= '<h2>' . bts('No active computers', array(), NULL, 'boinc:host-list') . '</h2>'; |
|
1293 | - $output .= '<p>' . bts('This user has no computers that have been' |
|
1294 | - . ' active in the last 30 days.', array(), NULL, 'boinc:host-list') . '</p>'; |
|
1292 | + $output .= '<h2>'.bts('No active computers', array(), NULL, 'boinc:host-list').'</h2>'; |
|
1293 | + $output .= '<p>'.bts('This user has no computers that have been' |
|
1294 | + . ' active in the last 30 days.', array(), NULL, 'boinc:host-list').'</p>'; |
|
1295 | 1295 | break; |
1296 | 1296 | |
1297 | 1297 | case 'preferences': |
1298 | - $output .= '<h2>' . bts('No computers', array(), NULL, 'boinc:host-list') . '</h2>'; |
|
1299 | - $output .= '<p>' . bts('There are no computers assigned to this' |
|
1300 | - . ' preference set.', array(), NULL, 'boinc:host-list') . '</p>'; |
|
1298 | + $output .= '<h2>'.bts('No computers', array(), NULL, 'boinc:host-list').'</h2>'; |
|
1299 | + $output .= '<p>'.bts('There are no computers assigned to this' |
|
1300 | + . ' preference set.', array(), NULL, 'boinc:host-list').'</p>'; |
|
1301 | 1301 | break; |
1302 | 1302 | |
1303 | 1303 | default: |
1304 | - $output .= '<h2>' . bts('Computers pending', array(), NULL, 'boinc:host-list') . '</h2>'; |
|
1305 | - $output .= '<p>' . bts('This user does not yet have any associated' |
|
1304 | + $output .= '<h2>'.bts('Computers pending', array(), NULL, 'boinc:host-list').'</h2>'; |
|
1305 | + $output .= '<p>'.bts('This user does not yet have any associated' |
|
1306 | 1306 | . ' computers. Computers will be displayed when they have earned their' |
1307 | - . ' first credits.', array(), NULL, 'boinc:host-list') . '</p>'; |
|
1307 | + . ' first credits.', array(), NULL, 'boinc:host-list').'</p>'; |
|
1308 | 1308 | } |
1309 | 1309 | } |
1310 | 1310 | else { |
1311 | - $output .= '<h2>' . bts('Computers hidden', array(), NULL, 'boinc:host-list') . '</h2>'; |
|
1312 | - $output .= '<p>' . bts('This user has chosen not to show information' |
|
1313 | - . ' about their computers.', array(), NULL, 'boinc:host-list') . '</p>'; |
|
1311 | + $output .= '<h2>'.bts('Computers hidden', array(), NULL, 'boinc:host-list').'</h2>'; |
|
1312 | + $output .= '<p>'.bts('This user has chosen not to show information' |
|
1313 | + . ' about their computers.', array(), NULL, 'boinc:host-list').'</p>'; |
|
1314 | 1314 | } |
1315 | 1315 | return $output; |
1316 | 1316 | } |
@@ -1322,11 +1322,11 @@ discard block |
||
1322 | 1322 | |
1323 | 1323 | // |
1324 | 1324 | $output = ''; |
1325 | - switch($context) { |
|
1325 | + switch ($context) { |
|
1326 | 1326 | default: |
1327 | - $output .= '<h2>' . bts('No @type tasks', array('@type' => $context), NULL, 'boinc:task-list') |
|
1327 | + $output .= '<h2>'.bts('No @type tasks', array('@type' => $context), NULL, 'boinc:task-list') |
|
1328 | 1328 | . '</h2>'; |
1329 | - $output .= '<p>' . bts('There are no tasks of this type on record', array(), NULL, 'boinc:task-list') |
|
1329 | + $output .= '<p>'.bts('There are no tasks of this type on record', array(), NULL, 'boinc:task-list') |
|
1330 | 1330 | . '</p>'; |
1331 | 1331 | } |
1332 | 1332 | return $output; |
@@ -1348,10 +1348,10 @@ discard block |
||
1348 | 1348 | $output .= l(bts('Delete', array(), NULL, 'boinc:form-delete'), "host/{$host_id}/delete", |
1349 | 1349 | array( |
1350 | 1350 | 'attributes' => array( |
1351 | - 'onclick' => 'return confirm(\'' . bts('This will delete host @id' |
|
1351 | + 'onclick' => 'return confirm(\''.bts('This will delete host @id' |
|
1352 | 1352 | . ' from your account forever. Are you sure this is OK?', |
1353 | 1353 | array('@id' => $host_id), |
1354 | - NULL, 'boinc:account-host-delete') . '\')' |
|
1354 | + NULL, 'boinc:account-host-delete').'\')' |
|
1355 | 1355 | ) |
1356 | 1356 | ) |
1357 | 1357 | ); |
@@ -1441,8 +1441,8 @@ discard block |
||
1441 | 1441 | "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location') |
1442 | 1442 | ); |
1443 | 1443 | variable_set('jump_use_js_venues-Array', 1); |
1444 | - drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
|
1445 | - drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme'); |
|
1444 | + drupal_add_js(drupal_get_path('module', 'jump').'/jump.js'); |
|
1445 | + drupal_add_js(drupal_get_path('theme', 'boinc').'/js/prefs.js', 'theme'); |
|
1446 | 1446 | // Get current venue |
1447 | 1447 | db_set_active('boinc_ro'); |
1448 | 1448 | $venue = db_result(db_query( |
@@ -1466,10 +1466,10 @@ discard block |
||
1466 | 1466 | // Add a wrapper to deadline text |
1467 | 1467 | if (!$received_time) { |
1468 | 1468 | if (time() < $deadline) { |
1469 | - $output = '<span class="on-time">' . $output . '</span>'; |
|
1469 | + $output = '<span class="on-time">'.$output.'</span>'; |
|
1470 | 1470 | } |
1471 | 1471 | else { |
1472 | - $output = '<span class="past-due">' . $output . '</span>'; |
|
1472 | + $output = '<span class="past-due">'.$output.'</span>'; |
|
1473 | 1473 | } |
1474 | 1474 | } |
1475 | 1475 | } |
@@ -1505,15 +1505,15 @@ discard block |
||
1505 | 1505 | */ |
1506 | 1506 | function boincwork_tasktable($category = 0, $queryid = 1, $tselect = NULL, $app_id = 0, $tablerows = 20) { |
1507 | 1507 | // Check type parameter, if not (0,2) then return an error. |
1508 | - if ( ($category!=0) AND ($category!=1) AND ($category!=2) ) { |
|
1508 | + if (($category != 0) AND ($category != 1) AND ($category != 2)) { |
|
1509 | 1509 | watchdog('boincwork', 'task table called with invalid category = %category', array('%category' => $category), WATCHDOG_WARNING); |
1510 | 1510 | return ''; |
1511 | 1511 | } |
1512 | 1512 | |
1513 | - require_boinc( array('util', 'result') ); |
|
1513 | + require_boinc(array('util', 'result')); |
|
1514 | 1514 | |
1515 | 1515 | global $language; |
1516 | - $locality=$language->language; |
|
1516 | + $locality = $language->language; |
|
1517 | 1517 | $nf = new NumberFormatter($locality, NumberFormatter::DECIMAL); |
1518 | 1518 | $nf->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, 0); |
1519 | 1519 | $nf->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, 0); |
@@ -1561,13 +1561,13 @@ discard block |
||
1561 | 1561 | ."ON r.appid=a.id "; |
1562 | 1562 | |
1563 | 1563 | // Use userid, hostid, or workunitid |
1564 | - if ($category==0) { |
|
1564 | + if ($category == 0) { |
|
1565 | 1565 | $sqlall .= " WHERE r.userid='%s' "; |
1566 | 1566 | } |
1567 | - elseif ($category==1) { |
|
1567 | + elseif ($category == 1) { |
|
1568 | 1568 | $sqlall .= " WHERE r.workunitid='%s' "; |
1569 | 1569 | } |
1570 | - elseif ($category==2) { |
|
1570 | + elseif ($category == 2) { |
|
1571 | 1571 | $sqlall .= " WHERE r.hostid='%s' "; |
1572 | 1572 | } |
1573 | 1573 | $sqlall .= " ORDER BY user_friendly_name"; |
@@ -1578,7 +1578,7 @@ discard block |
||
1578 | 1578 | if ($dbres_all) { |
1579 | 1579 | while ($result = db_fetch_object($dbres_all)) { |
1580 | 1580 | $mystate = state_num($result); |
1581 | - if ( ($result->appid==$app_id) OR ($app_id==0) OR ($app_id==-1) ) { |
|
1581 | + if (($result->appid == $app_id) OR ($app_id == 0) OR ($app_id == -1)) { |
|
1582 | 1582 | $taskstates[STATE_ALL]++; |
1583 | 1583 | switch ($mystate) { |
1584 | 1584 | case STATE_IN_PROGRESS: |
@@ -1601,7 +1601,7 @@ discard block |
||
1601 | 1601 | |
1602 | 1602 | //map holds a map between app ids and user friendly names for all applications. |
1603 | 1603 | $application_map[$result->appid] = $result->user_friendly_name; |
1604 | - if ( ($mystate == $tselect) OR ($tselect==STATE_ALL) ) { |
|
1604 | + if (($mystate == $tselect) OR ($tselect == STATE_ALL)) { |
|
1605 | 1605 | //count of appids in the results. |
1606 | 1606 | $application_select_count[$result->appid]++; |
1607 | 1607 | }// if mystate |
@@ -1614,14 +1614,14 @@ discard block |
||
1614 | 1614 | // Entry for all applications. |
1615 | 1615 | $allcount = $application_select_count ? array_sum($application_select_count) : 0; |
1616 | 1616 | $applications[-1] = bts('Application', array(), NULL, 'boinc:task-table'); |
1617 | - $applications[0] = bts('All applications', array(), NULL, 'boinc:task-table') . ' (' . $allcount . ')'; |
|
1617 | + $applications[0] = bts('All applications', array(), NULL, 'boinc:task-table').' ('.$allcount.')'; |
|
1618 | 1618 | // Create application filter from application_map and application_select_count. |
1619 | - foreach($application_map as $akey => $aname) { |
|
1619 | + foreach ($application_map as $akey => $aname) { |
|
1620 | 1620 | $acount = 0; |
1621 | - if ( $application_select_count and array_key_exists($akey, $application_select_count) ) { |
|
1621 | + if ($application_select_count and array_key_exists($akey, $application_select_count)) { |
|
1622 | 1622 | $acount = $application_select_count[$akey]; |
1623 | 1623 | } |
1624 | - $applications[$akey] = $aname . ' ('. $acount . ')'; |
|
1624 | + $applications[$akey] = $aname.' ('.$acount.')'; |
|
1625 | 1625 | } |
1626 | 1626 | // Header array for (sub) results table. |
1627 | 1627 | $resultheader = array( |
@@ -1700,13 +1700,13 @@ discard block |
||
1700 | 1700 | $sqlwhere = array(); |
1701 | 1701 | |
1702 | 1702 | // Use userid, hostid, or workunitid |
1703 | - if ($category==0) { |
|
1703 | + if ($category == 0) { |
|
1704 | 1704 | $sqlwhere[] = "r.userid = '%s'"; |
1705 | 1705 | } |
1706 | - elseif ($category==1) { |
|
1706 | + elseif ($category == 1) { |
|
1707 | 1707 | $sqlwhere[] = "r.workunitid = '%s'"; |
1708 | 1708 | } |
1709 | - elseif ($category==2) { |
|
1709 | + elseif ($category == 2) { |
|
1710 | 1710 | $sqlwhere[] = "r.hostid = '%s'"; |
1711 | 1711 | } |
1712 | 1712 | |
@@ -1730,14 +1730,14 @@ discard block |
||
1730 | 1730 | default: |
1731 | 1731 | } |
1732 | 1732 | |
1733 | - if (is_numeric($app_id) AND $app_id>0 ) { |
|
1733 | + if (is_numeric($app_id) AND $app_id > 0) { |
|
1734 | 1734 | $sqlwhere[] = "r.appid = '%s'"; |
1735 | - if ($sqlwhere) $sqlsub .= " WHERE " . implode(' AND ', $sqlwhere); |
|
1736 | - $dbres_sub = pager_query( $sqlsub . tablesort_sql($resultheader), $tablerows, 0, NULL, $queryid, $app_id); |
|
1735 | + if ($sqlwhere) $sqlsub .= " WHERE ".implode(' AND ', $sqlwhere); |
|
1736 | + $dbres_sub = pager_query($sqlsub.tablesort_sql($resultheader), $tablerows, 0, NULL, $queryid, $app_id); |
|
1737 | 1737 | } |
1738 | 1738 | else { |
1739 | - if ($sqlwhere) $sqlsub .= " WHERE " . implode(' AND ', $sqlwhere); |
|
1740 | - $dbres_sub = pager_query( $sqlsub . tablesort_sql($resultheader), $tablerows, 0, NULL, $queryid); |
|
1739 | + if ($sqlwhere) $sqlsub .= " WHERE ".implode(' AND ', $sqlwhere); |
|
1740 | + $dbres_sub = pager_query($sqlsub.tablesort_sql($resultheader), $tablerows, 0, NULL, $queryid); |
|
1741 | 1741 | } |
1742 | 1742 | db_set_active('default'); |
1743 | 1743 | |
@@ -1747,7 +1747,7 @@ discard block |
||
1747 | 1747 | // state_num() function changes $result object, clone $result |
1748 | 1748 | // object for use in state_num() |
1749 | 1749 | // check if state matches selection |
1750 | - if ( (state_num(clone $result) == $tselect) OR ($tselect==STATE_ALL) ) { |
|
1750 | + if ((state_num(clone $result) == $tselect) OR ($tselect == STATE_ALL)) { |
|
1751 | 1751 | // create pretty result row |
1752 | 1752 | $prettyresult = array( |
1753 | 1753 | array( |
@@ -1763,7 +1763,7 @@ discard block |
||
1763 | 1763 | $nf->format($result->cpu_time), |
1764 | 1764 | $nf->format($result->granted_credit), |
1765 | 1765 | array( |
1766 | - 'data' => $result->user_friendly_name . " " . pretty_application_version($result->app_version_id,$result->version_number, $result->plan_class, $result->platform), |
|
1766 | + 'data' => $result->user_friendly_name." ".pretty_application_version($result->app_version_id, $result->version_number, $result->plan_class, $result->platform), |
|
1767 | 1767 | 'class' => 'task-app', |
1768 | 1768 | ), |
1769 | 1769 | ); |
@@ -1776,54 +1776,54 @@ discard block |
||
1776 | 1776 | // Begin result navigation |
1777 | 1777 | |
1778 | 1778 | // Set pathprefix based on type |
1779 | - if ($category==0) { |
|
1779 | + if ($category == 0) { |
|
1780 | 1780 | $pathprefix = 'account/tasks'; |
1781 | 1781 | } |
1782 | - elseif ($category==1) { |
|
1783 | - $pathprefix = 'workunit/' . $queryid . '/tasks'; |
|
1782 | + elseif ($category == 1) { |
|
1783 | + $pathprefix = 'workunit/'.$queryid.'/tasks'; |
|
1784 | 1784 | } |
1785 | - elseif ($category==2) { |
|
1786 | - $pathprefix = 'host/' . $queryid . '/tasks'; |
|
1785 | + elseif ($category == 2) { |
|
1786 | + $pathprefix = 'host/'.$queryid.'/tasks'; |
|
1787 | 1787 | } |
1788 | 1788 | // Need an "All" tab as well, maps to app_id of zero. |
1789 | 1789 | $application_map[0] = bts('All', array(), NULL, 'boinc:task-table'); |
1790 | 1790 | $stitems = array(); |
1791 | 1791 | foreach ($taskstates as $state => $numstates) { |
1792 | - $mypath = $pathprefix . '/' . $state . '/' . $app_id; |
|
1793 | - if ($state==STATE_ALL) { |
|
1794 | - $ltext = '<span class="tab task-app-name">' . bts('All', array(), NULL, 'boinc:task-table') . ' (' . $numstates . ')</span>'; |
|
1792 | + $mypath = $pathprefix.'/'.$state.'/'.$app_id; |
|
1793 | + if ($state == STATE_ALL) { |
|
1794 | + $ltext = '<span class="tab task-app-name">'.bts('All', array(), NULL, 'boinc:task-table').' ('.$numstates.')</span>'; |
|
1795 | 1795 | } |
1796 | 1796 | else { |
1797 | - $ltext = '<span class="tab">' . bts($state_hnames[$state], array(), NULL, 'boinc:task-table') . ' (' . $numstates . ')</span>'; |
|
1797 | + $ltext = '<span class="tab">'.bts($state_hnames[$state], array(), NULL, 'boinc:task-table').' ('.$numstates.')</span>'; |
|
1798 | 1798 | } |
1799 | 1799 | $myitem = array( |
1800 | - 'data' => l($ltext, $mypath, array('html' => TRUE) ), |
|
1800 | + 'data' => l($ltext, $mypath, array('html' => TRUE)), |
|
1801 | 1801 | ); |
1802 | - if ($state==$tselect) { |
|
1802 | + if ($state == $tselect) { |
|
1803 | 1803 | $myitem['class'] = 'active'; |
1804 | 1804 | } |
1805 | 1805 | $stitems[] = $myitem; |
1806 | 1806 | } |
1807 | 1807 | // Add reset button |
1808 | - $mypath = $pathprefix . '/0/0'; |
|
1809 | - $ltext = '<span class="tab">' . bts('Reset', array(), NULL, 'boinc:task-table') . '</span>'; |
|
1810 | - $stitems[] = array( 'data' => l($ltext, $mypath, array('html' => TRUE) ) ); |
|
1808 | + $mypath = $pathprefix.'/0/0'; |
|
1809 | + $ltext = '<span class="tab">'.bts('Reset', array(), NULL, 'boinc:task-table').'</span>'; |
|
1810 | + $stitems[] = array('data' => l($ltext, $mypath, array('html' => TRUE))); |
|
1811 | 1811 | |
1812 | - $output .= theme_item_list($stitems, NULL, 'ul' . ' class="tabs secondary clearfix"'); |
|
1812 | + $output .= theme_item_list($stitems, NULL, 'ul'.' class="tabs secondary clearfix"'); |
|
1813 | 1813 | |
1814 | 1814 | // Application select-drop down form |
1815 | 1815 | // Hack to place Application form into header |
1816 | 1816 | // App ID of zero maps to "-1" for drop-down box. |
1817 | - if ($app_id==0) { |
|
1818 | - $app_id=-1; |
|
1817 | + if ($app_id == 0) { |
|
1818 | + $app_id = -1; |
|
1819 | 1819 | } |
1820 | 1820 | $resultheader[] = drupal_get_form('boincwork_selectapp_form', $applications, $app_id); |
1821 | 1821 | |
1822 | 1822 | // Begin table of results |
1823 | - if ( is_array($resultheader) AND is_array($resultdata) ) { |
|
1823 | + if (is_array($resultheader) AND is_array($resultdata)) { |
|
1824 | 1824 | |
1825 | 1825 | // Take advantage of the fact that $category is the same as the row/column we want to remove. |
1826 | - if ( ($category==1) OR ($category==2) ) { |
|
1826 | + if (($category == 1) OR ($category == 2)) { |
|
1827 | 1827 | unset($resultheader[$category]); |
1828 | 1828 | delete_col($resultdata, $category); |
1829 | 1829 | } |
@@ -1840,7 +1840,7 @@ discard block |
||
1840 | 1840 | * Function to delete a column from an array. |
1841 | 1841 | */ |
1842 | 1842 | function delete_col(&$array, $offset) { |
1843 | - return array_walk($array, function (&$v) use ($offset) { |
|
1843 | + return array_walk($array, function(&$v) use ($offset) { |
|
1844 | 1844 | array_splice($v, $offset, 1); |
1845 | 1845 | }); |
1846 | 1846 | } |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | // prefix for links; needed for pages not in top dir |
139 | 139 | $user, |
140 | 140 | // logged-in user, if any |
141 | - $fixed=false, |
|
141 | + $fixed = false, |
|
142 | 142 | // if true, navbar is fixed at top of page. |
143 | 143 | // NOTE: if you do this, you must set a global var $fixed_navbar |
144 | 144 | // to true at compile time |
145 | 145 | // (it needs to be set when page_head() is called). |
146 | - $inverse=false |
|
146 | + $inverse = false |
|
147 | 147 | // white on black? |
148 | 148 | ) { |
149 | 149 | global $master_url; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | // output a panel. |
219 | 219 | // $content_func is a function that generates the panel contents |
220 | 220 | // |
221 | -function panel($title, $content_func, $class="panel-primary") { |
|
221 | +function panel($title, $content_func, $class = "panel-primary") { |
|
222 | 222 | echo sprintf('<div class="panel %s"> |
223 | 223 | ', $class |
224 | 224 | ); |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | // are functions that generate the top, left, and right content |
245 | 245 | // $left_width is the width of left column in 1/12 units. |
246 | 246 | // |
247 | -function grid($top_func, $left_func, $right_func, $left_width=6) { |
|
247 | +function grid($top_func, $left_func, $right_func, $left_width = 6) { |
|
248 | 248 | echo ' |
249 | 249 | <div class="container-fluid"> |
250 | 250 | '; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | </div> |
260 | 260 | '; |
261 | 261 | } |
262 | - $right_width = 12-$left_width; |
|
262 | + $right_width = 12 - $left_width; |
|
263 | 263 | echo ' |
264 | 264 | <div class="row"> |
265 | 265 | <div class="col-sm-'.$left_width.'"> |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | '; |
278 | 278 | } |
279 | 279 | |
280 | -function form_start($action, $method='get') { |
|
280 | +function form_start($action, $method = 'get') { |
|
281 | 281 | echo sprintf( |
282 | 282 | '<div class="container"> |
283 | 283 | <form class="form-horizontal" method="%s" action="%s">' |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | define('FORM_LEFT_OFFSET', 'col-sm-offset-4'); |
302 | 302 | define('FORM_RIGHT_CLASS', 'col-sm-8'); |
303 | 303 | |
304 | -function form_input_text($label, $name, $value='', $type='text', $attrs='', $extra='') { |
|
304 | +function form_input_text($label, $name, $value = '', $type = 'text', $attrs = '', $extra = '') { |
|
305 | 305 | echo sprintf(' |
306 | 306 | <div class="form-group"> |
307 | 307 | <label class="control-label %s">%s</label> |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | ); |
329 | 329 | } |
330 | 330 | |
331 | -function form_input_textarea($label, $name, $value='') { |
|
331 | +function form_input_textarea($label, $name, $value = '') { |
|
332 | 332 | echo sprintf(' |
333 | 333 | <div class="form-group"> |
334 | 334 | <label class="control-label %s" for="%s">%s</label> |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | ); |
378 | 378 | $n = 0; |
379 | 379 | foreach ($items as $i) { |
380 | - $s = ($flags && $flags[$n])?'selected':''; |
|
380 | + $s = ($flags && $flags[$n]) ? 'selected' : ''; |
|
381 | 381 | echo '<option '.$s.' value="'.$i[0].'">'.$i[1].'</option> |
382 | 382 | '; |
383 | 383 | $n++; |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | |
388 | 388 | // $items is list of (name, label, checked) |
389 | 389 | // |
390 | -function form_checkboxes($label, $items, $attrs='') { |
|
390 | +function form_checkboxes($label, $items, $attrs = '') { |
|
391 | 391 | echo sprintf(' |
392 | 392 | <div class="form-group"> |
393 | 393 | <label class="control-label %s">%s</label> |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | } |
405 | 405 | echo sprintf('<input %s type="checkbox" name="%s" %s> %s |
406 | 406 | ', |
407 | - $attrs, $i[0], $i[2]?"checked":"", $i[1] |
|
407 | + $attrs, $i[0], $i[2] ? "checked" : "", $i[1] |
|
408 | 408 | ); |
409 | 409 | } |
410 | 410 | echo '</div> |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS |
424 | 424 | ); |
425 | 425 | foreach ($items as $i) { |
426 | - $checked = ($selected == $i[0])?"checked":""; |
|
426 | + $checked = ($selected == $i[0]) ? "checked" : ""; |
|
427 | 427 | echo sprintf('<input type="radio" name="%s" value="%s" %s> %s <br> |
428 | 428 | ', |
429 | 429 | $name, $i[0], $checked, $i[1] |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | '; |
457 | 457 | } |
458 | 458 | |
459 | -function form_submit($text, $attrs='') { |
|
459 | +function form_submit($text, $attrs = '') { |
|
460 | 460 | form_general( |
461 | 461 | "", |
462 | 462 | sprintf('<button %s type="submit" class="btn btn-success">%s</button>', |
@@ -465,11 +465,11 @@ discard block |
||
465 | 465 | ); |
466 | 466 | } |
467 | 467 | |
468 | -function form_checkbox($label, $name, $checked=false) { |
|
468 | +function form_checkbox($label, $name, $checked = false) { |
|
469 | 469 | echo sprintf(' |
470 | 470 | <div class="form-group"> |
471 | 471 | <input type="checkbox" name="%s" %s> <span class="lead">%s</span> |
472 | 472 | </div> |
473 | - ', $name, $checked?"checked":"", $label |
|
473 | + ', $name, $checked ? "checked" : "", $label |
|
474 | 474 | ); |
475 | 475 | } |
@@ -56,7 +56,7 @@ |
||
56 | 56 | if (!parse_bool($config, "disable_account_creation") |
57 | 57 | && !parse_bool($config, "no_web_account_creation") |
58 | 58 | ) { |
59 | - echo tra("or %1 create an account %2.", "<a href=\"create_account_form.php?next_url=$next_url\">","</a>"); |
|
59 | + echo tra("or %1 create an account %2.", "<a href=\"create_account_form.php?next_url=$next_url\">", "</a>"); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | page_tail(); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | // This variable name has been changed for Drupal 7/8. |
44 | 44 | $maintenance_mode = variable_get('site_offline'); |
45 | 45 | if (!$maintenance_mode) { |
46 | - drupal_set_message(t('WARNING: Site is online (not in maintenance mode)! Deleting teams is only allowed when site is offline. Change this setting in ') . l(t('Site maintenance'), '/admin/settings/site-maintenance'), 'warning'); |
|
46 | + drupal_set_message(t('WARNING: Site is online (not in maintenance mode)! Deleting teams is only allowed when site is offline. Change this setting in ').l(t('Site maintenance'), '/admin/settings/site-maintenance'), 'warning'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $form['teamdelete'] = array( |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | '#value' => t('Delete Selected Teams'), |
57 | 57 | '#submit' => array('boincteam_utility_delete_team'), |
58 | 58 | '#attributes' => array( |
59 | - 'onclick' => 'return confirm(\'' . t('You are about to delete the selected teams suspected of being SPAM. Do you want to continue?') . '\')', |
|
59 | + 'onclick' => 'return confirm(\''.t('You are about to delete the selected teams suspected of being SPAM. Do you want to continue?').'\')', |
|
60 | 60 | ), |
61 | 61 | ); |
62 | 62 | $form['teamdelete']['results_table'] = array( |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | function boincteam_utility_team_table() { |
70 | 70 | |
71 | - $limit=50; |
|
71 | + $limit = 50; |
|
72 | 72 | $sql = "SELECT team.id AS id, team.name AS name, team.nusers AS nusers FROM {team} WHERE team.nusers<2 AND team.total_credit=0 AND team.seti_id=0 AND team.description REGEXP '<a href'"; |
73 | 73 | |
74 | 74 | // @todo - add bts() or t() |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | $tablesort = tablesort_sql($resultheader); |
96 | 96 | db_set_active('boinc_rw'); |
97 | - $db_res = pager_query($sql . $tablesort, $limit); |
|
97 | + $db_res = pager_query($sql.$tablesort, $limit); |
|
98 | 98 | db_set_active('default'); |
99 | 99 | |
100 | 100 | $form = array(); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | while ($result = db_fetch_object($db_res)) { |
105 | 105 | $drupalnid = boincteam_lookup_nid($result->id); |
106 | 106 | if ($drupalnid) { |
107 | - $tlink = l($result->name, '/community/teams/' . $drupalnid); |
|
107 | + $tlink = l($result->name, '/community/teams/'.$drupalnid); |
|
108 | 108 | } |
109 | 109 | else { |
110 | 110 | $tlink = ''; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | 'operations' => $operations, |
150 | 150 | 'init_message' => t('Starting team deletion'), |
151 | 151 | 'finished' => 'boincteam_utility_batch_finished', |
152 | - 'file' => drupal_get_path('module', 'boincteam') . '/boincteam.admin.inc', |
|
152 | + 'file' => drupal_get_path('module', 'boincteam').'/boincteam.admin.inc', |
|
153 | 153 | ); |
154 | 154 | batch_set($batch); |
155 | 155 | //batch_process('/admin/boinc/utility-team-delete'); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | ); |
174 | 174 | $rows = array(); |
175 | 175 | $output = ""; |
176 | - if(!empty($form['checkboxes']['#options'])) { |
|
176 | + if (!empty($form['checkboxes']['#options'])) { |
|
177 | 177 | foreach (element_children($form['id']) as $key) { |
178 | 178 | $rows[] = array( |
179 | 179 | drupal_render($form['checkboxes'][$key]), |
@@ -207,12 +207,12 @@ discard block |
||
207 | 207 | |
208 | 208 | // Delete entry in team table |
209 | 209 | db_set_active('boinc_rw'); |
210 | - $sql1='DELETE FROM {team} WHERE id=%d'; |
|
210 | + $sql1 = 'DELETE FROM {team} WHERE id=%d'; |
|
211 | 211 | $db_res = db_query($sql1, $id); |
212 | 212 | db_set_active('default'); |
213 | 213 | |
214 | 214 | // Delete entry in boincteam table |
215 | - $sql2='DELETE FROM {boincteam} WHERE id=%d'; |
|
215 | + $sql2 = 'DELETE FROM {boincteam} WHERE id=%d'; |
|
216 | 216 | $db_res = db_query($sql2, $id); |
217 | 217 | |
218 | 218 | // Delete the drupal node (if present) |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | node_delete($drupalid); |
221 | 221 | } |
222 | 222 | |
223 | - $context['results'][] = $id . ' : ' . check_plain($boincteam->name); |
|
223 | + $context['results'][] = $id.' : '.check_plain($boincteam->name); |
|
224 | 224 | $context['message'] = t('Processing team @name', array('@name' => $boincteam->name)); |
225 | 225 | } |
226 | 226 | |
@@ -230,14 +230,14 @@ discard block |
||
230 | 230 | */ |
231 | 231 | function boincteam_utility_batch_finished($success, $results, $operations) { |
232 | 232 | if ($success) { |
233 | - $message = 'Info: Delete SPAM Teams utility- ' . count($results) . ' team(s) deleted.'; |
|
233 | + $message = 'Info: Delete SPAM Teams utility- '.count($results).' team(s) deleted.'; |
|
234 | 234 | drupal_set_message($message, 'info'); |
235 | 235 | } |
236 | 236 | else { |
237 | 237 | // An error occurred. |
238 | 238 | // $operations contains the operations that remained unprocessed. |
239 | 239 | $error_operation = reset($operations); |
240 | - $message = 'Error: An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
240 | + $message = 'Error: An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE); |
|
241 | 241 | drupal_set_message($message, 'error'); |
242 | 242 | } |
243 | 243 | } |
244 | 244 | \ No newline at end of file |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | function boinctranslate_initialize_languages() { |
17 | 17 | |
18 | - require_once(getcwd() . '/includes/locale.inc'); |
|
18 | + require_once(getcwd().'/includes/locale.inc'); |
|
19 | 19 | |
20 | 20 | $api_base_url = 'https://www.transifex.com/api/2'; |
21 | 21 | $project_name = variable_get( |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | } |
147 | 147 | } |
148 | 148 | if ($disabled_languages) { |
149 | - drupal_set_message('The following languages were not found in Transifex and were disabled: ' . implode(' ', $disabled_languages)); |
|
149 | + drupal_set_message('The following languages were not found in Transifex and were disabled: '.implode(' ', $disabled_languages)); |
|
150 | 150 | } |
151 | 151 | if ($process_batches) { |
152 | 152 | $batch = array( |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * |
196 | 196 | */ |
197 | 197 | function boinctranslate_export_translations() { |
198 | - require_once(getcwd() . '/includes/locale.inc'); |
|
198 | + require_once(getcwd().'/includes/locale.inc'); |
|
199 | 199 | $project_name = variable_get( |
200 | 200 | 'boinc_translate_transifex_project_name', '' |
201 | 201 | ); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * |
298 | 298 | */ |
299 | 299 | function boinctranslate_update_official_boinc_translations() { |
300 | - require_once(getcwd() . '/includes/locale.inc'); |
|
300 | + require_once(getcwd().'/includes/locale.inc'); |
|
301 | 301 | $project_name = variable_get( |
302 | 302 | 'boinc_translate_transifex_standard_name', '' |
303 | 303 | ); |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | |
406 | 406 | $url = "{$api_base_url}/{$path}"; |
407 | 407 | $headers = array( |
408 | - 'Authorization' => 'Basic ' . base64_encode($username . ":" . $password), |
|
408 | + 'Authorization' => 'Basic '.base64_encode($username.":".$password), |
|
409 | 409 | ); |
410 | 410 | $data = NULL; |
411 | 411 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | return json_decode($response->data, TRUE); |
434 | 434 | } |
435 | 435 | else { |
436 | - return (string) $response->data; |
|
436 | + return (string)$response->data; |
|
437 | 437 | } |
438 | 438 | break; |
439 | 439 | case 404: |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | */ |
457 | 457 | function boinctranslate_get_po($langcode, $type = 'standard') { |
458 | 458 | |
459 | - require_once(getcwd() . '/includes/locale.inc'); |
|
459 | + require_once(getcwd().'/includes/locale.inc'); |
|
460 | 460 | |
461 | 461 | $all_languages = language_list(); |
462 | 462 | $language = $langcode ? $all_languages[$langcode] : NULL; |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | */ |
516 | 516 | function boinctranslate_export_po_generate($language = NULL, $strings = array(), $header = NULL, $type = NULL) { |
517 | 517 | |
518 | - require_once(getcwd() . '/includes/locale.inc'); |
|
518 | + require_once(getcwd().'/includes/locale.inc'); |
|
519 | 519 | global $user; |
520 | 520 | |
521 | 521 | // unset $language to indicate template creation |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | $header = "# BOINC drupal localization template\n"; |
532 | 532 | $header .= "# Copyright (C) ".date("Y")." University of California\n"; |
533 | 533 | } |
534 | - $header .= '# Generated by ' . $user->name . ' <' . $user->mail . ">\n"; |
|
534 | + $header .= '# Generated by '.$user->name.' <'.$user->mail.">\n"; |
|
535 | 535 | $header .= "#\n"; |
536 | 536 | $header .= "# This file is distributed under the same license as BOINC.\n"; |
537 | 537 | $header .= "#\n"; |
@@ -543,9 +543,9 @@ discard block |
||
543 | 543 | $header .= "\"Project-Id-Version: BOINC unknown\\n\"\n"; // TODO: add SHA1 of source checkout here |
544 | 544 | } |
545 | 545 | $header .= "\"Report-Msgid-Bugs-To: BOINC translation team <[email protected]>\\n\"\n"; |
546 | - $header .= "\"POT-Creation-Date: " . date("Y-m-d H:iO") . "\\n\"\n"; |
|
546 | + $header .= "\"POT-Creation-Date: ".date("Y-m-d H:iO")."\\n\"\n"; |
|
547 | 547 | if (isset($language)) { |
548 | - $header .= "\"PO-Revision-Date: " . date("Y-m-d H:iO") . "\\n\"\n"; |
|
548 | + $header .= "\"PO-Revision-Date: ".date("Y-m-d H:iO")."\\n\"\n"; |
|
549 | 549 | } |
550 | 550 | $header .= "\"Last-Translator: Generated automatically from Drupal translate interface\\n\"\n"; |
551 | 551 | $header .= "\"MIME-Version: 1.0\\n\"\n"; |
@@ -554,31 +554,31 @@ discard block |
||
554 | 554 | if (isset($language)) { |
555 | 555 | $header .= "\"Language: ".$language->language."\\n\""; |
556 | 556 | if ($language->formula && $language->plurals) { |
557 | - $header .= "\"Plural-Forms: nplurals=" . $language->plurals . "; plural=" . strtr($language->formula, array('$' => '')) . ";\\n\"\n"; |
|
557 | + $header .= "\"Plural-Forms: nplurals=".$language->plurals."; plural=".strtr($language->formula, array('$' => '')).";\\n\"\n"; |
|
558 | 558 | } |
559 | 559 | } |
560 | 560 | $header .= "\"X-Poedit-SourceCharset: utf-8\\n\"\n"; |
561 | 561 | } |
562 | 562 | |
563 | - $output = $header . "\n"; |
|
563 | + $output = $header."\n"; |
|
564 | 564 | |
565 | 565 | foreach ($strings as $lid => $string) { |
566 | 566 | // Only process non-children, children are output below their parent. |
567 | 567 | if (!isset($string['child'])) { |
568 | 568 | if ($string['comment']) { |
569 | - $output .= '#: ' . $string['comment'] . "\n"; |
|
569 | + $output .= '#: '.$string['comment']."\n"; |
|
570 | 570 | } |
571 | 571 | if ($string['context']) { |
572 | - $output .= 'msgctxt "' . $string['context'] . "\"\n"; |
|
572 | + $output .= 'msgctxt "'.$string['context']."\"\n"; |
|
573 | 573 | } |
574 | - $output .= 'msgid ' . _locale_export_string($string['source']); |
|
574 | + $output .= 'msgid '._locale_export_string($string['source']); |
|
575 | 575 | if (!empty($string['plural'])) { |
576 | 576 | $plural = $string['plural']; |
577 | - $output .= 'msgid_plural ' . _locale_export_string($strings[$plural]['source']); |
|
577 | + $output .= 'msgid_plural '._locale_export_string($strings[$plural]['source']); |
|
578 | 578 | if (isset($language)) { |
579 | 579 | $translation = $string['translation']; |
580 | 580 | for ($i = 0; $i < $language->plurals; $i++) { |
581 | - $output .= 'msgstr[' . $i . '] ' . _locale_export_string($translation); |
|
581 | + $output .= 'msgstr['.$i.'] '._locale_export_string($translation); |
|
582 | 582 | if ($plural) { |
583 | 583 | $translation = _locale_export_remove_plural($strings[$plural]['translation']); |
584 | 584 | $plural = isset($strings[$plural]['plural']) ? $strings[$plural]['plural'] : 0; |
@@ -589,12 +589,12 @@ discard block |
||
589 | 589 | } |
590 | 590 | } |
591 | 591 | else { |
592 | - $output .= 'msgstr[0] ""' . "\n"; |
|
593 | - $output .= 'msgstr[1] ""' . "\n"; |
|
592 | + $output .= 'msgstr[0] ""'."\n"; |
|
593 | + $output .= 'msgstr[1] ""'."\n"; |
|
594 | 594 | } |
595 | 595 | } |
596 | 596 | else { |
597 | - $output .= 'msgstr ' . _locale_export_string($string['translation']); |
|
597 | + $output .= 'msgstr '._locale_export_string($string['translation']); |
|
598 | 598 | } |
599 | 599 | $output .= "\n"; |
600 | 600 | } |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | * |
607 | 607 | */ |
608 | 608 | function boinctranslate_refresh_translations() { |
609 | - require_once(getcwd() . '/includes/locale.inc'); |
|
609 | + require_once(getcwd().'/includes/locale.inc'); |
|
610 | 610 | $errors = array(); |
611 | 611 | $languages = locale_language_list(); |
612 | 612 | $translation_resources = array(); |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | ), |
654 | 654 | ); |
655 | 655 | // Be sure any strings from the override file are added to the boinc group |
656 | - $override_file = './' . drupal_get_path('module', 'boinctranslate') . '/includes/other-boinc-translation-strings.txt'; |
|
656 | + $override_file = './'.drupal_get_path('module', 'boinctranslate').'/includes/other-boinc-translation-strings.txt'; |
|
657 | 657 | $other_strings = file($override_file); |
658 | 658 | if ($other_strings) { |
659 | 659 | foreach ($other_strings as $string) { |
@@ -666,13 +666,13 @@ discard block |
||
666 | 666 | // Use '|' as delimiter to split string and context info. |
667 | 667 | $line = explode("|", $string); |
668 | 668 | if ($line) { |
669 | - if (count($line)==1) { |
|
669 | + if (count($line) == 1) { |
|
670 | 670 | $tl0 = trim($line[0]); |
671 | 671 | if ($tl0) { |
672 | 672 | bts($tl0); |
673 | 673 | } |
674 | 674 | } |
675 | - elseif (count($line)>1) { |
|
675 | + elseif (count($line) > 1) { |
|
676 | 676 | $tl0 = trim($line[0]); |
677 | 677 | $tl1 = trim($line[1]); |
678 | 678 | if ($tl0 and $tl1) { |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | */ |
742 | 742 | function boinctranslate_refresh_translations_op($project, $resource, $langcode, $language, $textgroups, $debug_mode, &$context) { |
743 | 743 | |
744 | - require_once(getcwd() . '/includes/locale.inc'); |
|
744 | + require_once(getcwd().'/includes/locale.inc'); |
|
745 | 745 | |
746 | 746 | if ($debug_mode) { |
747 | 747 | watchdog( |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | $file->filename = basename($file->filepath); |
773 | 773 | if (!$file->filepath) { |
774 | 774 | $message = 'Unable to create temporary file in ' |
775 | - . file_directory_temp() . " for {$language} translation " |
|
775 | + . file_directory_temp()." for {$language} translation " |
|
776 | 776 | . "resource {$project}:{$resource}"; |
777 | 777 | } |
778 | 778 | |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | $context['finished'] = 1; |
850 | 850 | } |
851 | 851 | else { |
852 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
852 | + $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max']; |
|
853 | 853 | } |
854 | 854 | } |
855 | 855 | |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | // An error occurred. |
873 | 873 | // $operations contains the operations that remained unprocessed. |
874 | 874 | $error_operation = reset($operations); |
875 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
875 | + $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE); |
|
876 | 876 | watchdog( |
877 | 877 | 'boinctranslate', |
878 | 878 | $message, |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | @set_time_limit(240); |
894 | 894 | } |
895 | 895 | |
896 | - require_once(getcwd() . '/includes/locale.inc'); |
|
896 | + require_once(getcwd().'/includes/locale.inc'); |
|
897 | 897 | |
898 | 898 | // Check if we have the language already in the database. |
899 | 899 | if (!db_fetch_object(db_query("SELECT language FROM {languages} WHERE language = '%s'", $langcode))) { |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | */ |
936 | 936 | function _boinctranslate_locale_import_read_po($op, $file, $mode = NULL, $lang = NULL, $group = 'default') { |
937 | 937 | |
938 | - require_once(getcwd() . '/includes/locale.inc'); |
|
938 | + require_once(getcwd().'/includes/locale.inc'); |
|
939 | 939 | |
940 | 940 | $fd = fopen($file->filepath, "rb"); // File will get closed by PHP on return |
941 | 941 | if (!$fd) { |
@@ -955,7 +955,7 @@ discard block |
||
955 | 955 | $lineno = 0; // Current line |
956 | 956 | |
957 | 957 | while (!feof($fd)) { |
958 | - $line = fgets($fd, 10 * 1024); // A line should not be this long |
|
958 | + $line = fgets($fd, 10*1024); // A line should not be this long |
|
959 | 959 | if ($lineno == 0) { |
960 | 960 | // The first line might come with a UTF-8 BOM, which should be removed. |
961 | 961 | $line = str_replace("\xEF\xBB\xBF", '', $line); |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno); |
1038 | 1038 | return FALSE; |
1039 | 1039 | } |
1040 | - $current["msgid"] = $current["msgid"] . "\0" . $quoted; |
|
1040 | + $current["msgid"] = $current["msgid"]."\0".$quoted; |
|
1041 | 1041 | $context = "MSGID_PLURAL"; |
1042 | 1042 | } |
1043 | 1043 | elseif (!strncmp("msgid", $line, 5)) { |
@@ -1190,7 +1190,7 @@ discard block |
||
1190 | 1190 | */ |
1191 | 1191 | function _boinctranslate_locale_import_one_string($op, $value = NULL, $mode = NULL, $lang = NULL, $file = NULL, $group = 'default') { |
1192 | 1192 | |
1193 | - require_once(getcwd() . '/includes/locale.inc'); |
|
1193 | + require_once(getcwd().'/includes/locale.inc'); |
|
1194 | 1194 | |
1195 | 1195 | static $report = array( |
1196 | 1196 | 'additions' => 0, |
@@ -1323,13 +1323,13 @@ discard block |
||
1323 | 1323 | |
1324 | 1324 | $lid = $row['lid']; |
1325 | 1325 | // Check of if one or more translations exist for this lid in locales_target table. |
1326 | - $exists = (bool) db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode)); |
|
1326 | + $exists = (bool)db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode)); |
|
1327 | 1327 | if (!$exists) { |
1328 | 1328 | // No translation in this language, insert translation into locales_target table. |
1329 | 1329 | db_query("INSERT INTO {locales_target} (lid, language, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $langcode, $translation, $plid, $plural); |
1330 | 1330 | $report['additions']++; |
1331 | 1331 | } |
1332 | - else if ( ($mode == LOCALE_IMPORT_OVERWRITE) and (!$ignoreoverwrite) ) { |
|
1332 | + else if (($mode == LOCALE_IMPORT_OVERWRITE) and (!$ignoreoverwrite)) { |
|
1333 | 1333 | // Translation exists, only overwrite if instructed. |
1334 | 1334 | db_query("UPDATE {locales_target} SET translation = '%s', plid = %d, plural = %d WHERE language = '%s' AND lid = %d", $translation, $plid, $plural, $langcode, $lid); |
1335 | 1335 | $report['updates']++; |
@@ -1345,7 +1345,7 @@ discard block |
||
1345 | 1345 | // Loop over db results from locales_source table. |
1346 | 1346 | while ($row = db_fetch_array($resource)) { |
1347 | 1347 | $lid = $row['lid']; |
1348 | - $exists = (bool) db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode)); |
|
1348 | + $exists = (bool)db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode)); |
|
1349 | 1349 | if ($exists) { |
1350 | 1350 | // Empty translation, remove existing if instructed. |
1351 | 1351 | db_query("DELETE FROM {locales_target} WHERE language = '%s' AND lid = %d AND plid = %d AND plural = %d", $langcode, $lid, $plid, $plural); |
@@ -1403,5 +1403,5 @@ discard block |
||
1403 | 1403 | * database. |
1404 | 1404 | */ |
1405 | 1405 | function _boinctranslate_supertrim($instr) { |
1406 | - return implode("\n", array_map('trim', preg_split('/\r\n|\r|\n/', $instr) ) ); |
|
1406 | + return implode("\n", array_map('trim', preg_split('/\r\n|\r|\n/', $instr))); |
|
1407 | 1407 | } |