@@ -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,21 +386,21 @@ 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 | 406 | if ($ipnum & (1 << $depth)) { |
@@ -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 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function zen_theme(&$existing, $type, $theme, $path) { |
24 | 24 | // When #341140 is fixed, replace _zen_path() with drupal_get_path(). |
25 | - include_once './' . _zen_path() . '/zen-internals/template.theme-registry.inc'; |
|
25 | + include_once './'._zen_path().'/zen-internals/template.theme-registry.inc'; |
|
26 | 26 | return _zen_theme($existing, $type, $theme, $path); |
27 | 27 | } |
28 | 28 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | elseif (theme_get_setting('zen_breadcrumb_trailing')) { |
58 | 58 | $trailing_separator = $breadcrumb_separator; |
59 | 59 | } |
60 | - return '<div class="breadcrumb">' . implode($breadcrumb_separator, $breadcrumb) . "$trailing_separator$title</div>"; |
|
60 | + return '<div class="breadcrumb">'.implode($breadcrumb_separator, $breadcrumb)."$trailing_separator$title</div>"; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | // Otherwise, return an empty string. |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | 'level' => 'h2', |
107 | 107 | ); |
108 | 108 | } |
109 | - $output .= '<' . $heading['level']; |
|
109 | + $output .= '<'.$heading['level']; |
|
110 | 110 | if (!empty($heading['class'])) { |
111 | 111 | $output .= drupal_attributes(array('class' => $heading['class'])); |
112 | 112 | } |
113 | - $output .= '>' . check_plain($heading['text']) . '</' . $heading['level'] . '>'; |
|
113 | + $output .= '>'.check_plain($heading['text']).'</'.$heading['level'].'>'; |
|
114 | 114 | } |
115 | 115 | |
116 | - $output .= '<ul'. drupal_attributes($attributes) .'>'; |
|
116 | + $output .= '<ul'.drupal_attributes($attributes).'>'; |
|
117 | 117 | |
118 | 118 | $num_links = count($links); |
119 | 119 | $i = 1; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | && (empty($link['language']) || $link['language']->language == $language->language)) { |
133 | 133 | $class .= ' active'; |
134 | 134 | } |
135 | - $output .= '<li'. drupal_attributes(array('class' => $class)) .'>'; |
|
135 | + $output .= '<li'.drupal_attributes(array('class' => $class)).'>'; |
|
136 | 136 | |
137 | 137 | if (isset($link['href'])) { |
138 | 138 | // Pass in $link as $options, they share the same keys. |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | if (isset($link['attributes'])) { |
148 | 148 | $span_attributes = drupal_attributes($link['attributes']); |
149 | 149 | } |
150 | - $output .= '<span'. $span_attributes .'>'. $link['title'] .'</span>'; |
|
150 | + $output .= '<span'.$span_attributes.'>'.$link['title'].'</span>'; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | $i++; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | // If an item is a LOCAL TASK, render it as a tab |
172 | 172 | if ($link['type'] & MENU_IS_LOCAL_TASK) { |
173 | - $link['title'] = '<span class="tab">' . check_plain($link['title']) . '</span>'; |
|
173 | + $link['title'] = '<span class="tab">'.check_plain($link['title']).'</span>'; |
|
174 | 174 | $link['localized_options']['html'] = TRUE; |
175 | 175 | } |
176 | 176 | |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | if ($primary) { |
198 | - $output .= '<ul class="tabs primary clearfix">' . $primary . '</ul>'; |
|
198 | + $output .= '<ul class="tabs primary clearfix">'.$primary.'</ul>'; |
|
199 | 199 | } |
200 | 200 | if ($secondary) { |
201 | - $output .= '<ul class="tabs secondary clearfix">' . $secondary . '</ul>'; |
|
201 | + $output .= '<ul class="tabs secondary clearfix">'.$secondary.'</ul>'; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | return $output; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | $elements['#region'] = $region; |
254 | 254 | |
255 | 255 | // Set the theme hook suggestions. |
256 | - $hook = array('region_' . $region); |
|
256 | + $hook = array('region_'.$region); |
|
257 | 257 | if (strpos($region, 'sidebar_') === 0) { |
258 | 258 | $hook[] = 'region_sidebar'; |
259 | 259 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | // Views (and possibly other modules) have templates with a $classes |
296 | 296 | // variable that isn't a string, so we leave those variables alone. |
297 | 297 | if (is_string($vars[$key])) { |
298 | - $vars['classes_array'] = explode(' ', $hook . ' ' . $vars[$key]); |
|
298 | + $vars['classes_array'] = explode(' ', $hook.' '.$vars[$key]); |
|
299 | 299 | unset($vars[$key]); |
300 | 300 | } |
301 | 301 | } |
@@ -319,37 +319,37 @@ discard block |
||
319 | 319 | function zen_preprocess_page(&$vars, $hook) { |
320 | 320 | // If the user is silly and enables Zen as the theme, add some styles. |
321 | 321 | if ($GLOBALS['theme'] == 'zen') { |
322 | - include_once './' . _zen_path() . '/zen-internals/template.zen.inc'; |
|
322 | + include_once './'._zen_path().'/zen-internals/template.zen.inc'; |
|
323 | 323 | _zen_preprocess_page($vars, $hook); |
324 | 324 | } |
325 | 325 | // Add conditional stylesheets. |
326 | 326 | elseif (!module_exists('conditional_styles')) { |
327 | 327 | $language = $GLOBALS['language']->direction == LANGUAGE_RTL ? '_rtl' : ''; |
328 | - $vars['conditional_styles'] = variable_get('conditional_styles_' . $GLOBALS['theme'] . $language, ''); |
|
328 | + $vars['conditional_styles'] = variable_get('conditional_styles_'.$GLOBALS['theme'].$language, ''); |
|
329 | 329 | $vars['styles'] .= $vars['conditional_styles']; |
330 | 330 | } |
331 | 331 | |
332 | 332 | // Classes for body element. Allows advanced theming based on context |
333 | 333 | // (home page, node of certain type, etc.) |
334 | 334 | // Remove the mostly useless page-ARG0 class. |
335 | - if ($index = array_search(preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s', '', 'page-'. drupal_strtolower(arg(0))), $vars['classes_array'])) { |
|
335 | + if ($index = array_search(preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s', '', 'page-'.drupal_strtolower(arg(0))), $vars['classes_array'])) { |
|
336 | 336 | unset($vars['classes_array'][$index]); |
337 | 337 | } |
338 | 338 | if (!$vars['is_front']) { |
339 | 339 | // Add unique class for each page. |
340 | 340 | $path = drupal_get_path_alias($_GET['q']); |
341 | - $vars['classes_array'][] = drupal_html_class('page-' . $path); |
|
341 | + $vars['classes_array'][] = drupal_html_class('page-'.$path); |
|
342 | 342 | // Add unique class for each website section. |
343 | - list($section, ) = explode('/', $path, 2); |
|
343 | + list($section,) = explode('/', $path, 2); |
|
344 | 344 | if (arg(0) == 'node') { |
345 | 345 | if (arg(1) == 'add') { |
346 | 346 | $section = 'node-add'; |
347 | 347 | } |
348 | 348 | elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) { |
349 | - $section = 'node-' . arg(2); |
|
349 | + $section = 'node-'.arg(2); |
|
350 | 350 | } |
351 | 351 | } |
352 | - $vars['classes_array'][] = drupal_html_class('section-' . $section); |
|
352 | + $vars['classes_array'][] = drupal_html_class('section-'.$section); |
|
353 | 353 | } |
354 | 354 | if (theme_get_setting('zen_wireframes')) { |
355 | 355 | $vars['classes_array'][] = 'with-wireframes'; // Optionally add the wireframes style. |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | } |
377 | 377 | else { |
378 | 378 | $vars['classes_array'][] = 'one-sidebar'; |
379 | - $vars['classes_array'][] = 'sidebar-' . $vars['layout']; |
|
379 | + $vars['classes_array'][] = 'sidebar-'.$vars['layout']; |
|
380 | 380 | } |
381 | 381 | } |
382 | 382 | // Store the menu item since it has some useful information. |
@@ -406,13 +406,13 @@ discard block |
||
406 | 406 | function zen_preprocess_maintenance_page(&$vars, $hook) { |
407 | 407 | // If Zen is the maintenance theme, add some styles. |
408 | 408 | if ($GLOBALS['theme'] == 'zen') { |
409 | - include_once './' . _zen_path() . '/zen-internals/template.zen.inc'; |
|
409 | + include_once './'._zen_path().'/zen-internals/template.zen.inc'; |
|
410 | 410 | _zen_preprocess_page($vars, $hook); |
411 | 411 | } |
412 | 412 | // Add conditional stylesheets. |
413 | 413 | elseif (!module_exists('conditional_styles')) { |
414 | 414 | $language = $GLOBALS['language']->direction == LANGUAGE_RTL ? '_rtl' : ''; |
415 | - $vars['conditional_styles'] = variable_get('conditional_styles_' . $GLOBALS['theme'] . $language, ''); |
|
415 | + $vars['conditional_styles'] = variable_get('conditional_styles_'.$GLOBALS['theme'].$language, ''); |
|
416 | 416 | $vars['styles'] .= $vars['conditional_styles']; |
417 | 417 | } |
418 | 418 | } |
@@ -459,11 +459,11 @@ discard block |
||
459 | 459 | $vars['user_picture'] = $vars['picture']; |
460 | 460 | |
461 | 461 | // Create the Drupal 7 $display_submitted variable. |
462 | - $vars['display_submitted'] = theme_get_setting('toggle_node_info_' . $vars['node']->type); |
|
462 | + $vars['display_submitted'] = theme_get_setting('toggle_node_info_'.$vars['node']->type); |
|
463 | 463 | |
464 | 464 | // Special classes for nodes. |
465 | 465 | // Class for node type: "node-type-page", "node-type-story", "node-type-my-custom-type", etc. |
466 | - $vars['classes_array'][] = drupal_html_class('node-type-' . $vars['type']); |
|
466 | + $vars['classes_array'][] = drupal_html_class('node-type-'.$vars['type']); |
|
467 | 467 | if ($vars['promote']) { |
468 | 468 | $vars['classes_array'][] = 'node-promoted'; |
469 | 469 | } |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | if (isset($vars['preview'])) { |
487 | 487 | $vars['classes_array'][] = 'node-preview'; |
488 | 488 | } |
489 | - $vars['classes_array'][] = 'build-mode-' . $vars['build_mode'] ; |
|
489 | + $vars['classes_array'][] = 'build-mode-'.$vars['build_mode']; |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | /** |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | * The name of the template being rendered ("comment" in this case.) |
499 | 499 | */ |
500 | 500 | function zen_preprocess_comment(&$vars, $hook) { |
501 | - include_once './' . _zen_path() . '/zen-internals/template.comment.inc'; |
|
501 | + include_once './'._zen_path().'/zen-internals/template.comment.inc'; |
|
502 | 502 | _zen_preprocess_comment($vars, $hook); |
503 | 503 | } |
504 | 504 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | $vars['region'] = $vars['elements']['#region']; |
517 | 517 | |
518 | 518 | // Setup the default classes. |
519 | - $vars['classes_array'] = array('region', 'region-' . str_replace('_', '-', $vars['region'])); |
|
519 | + $vars['classes_array'] = array('region', 'region-'.str_replace('_', '-', $vars['region'])); |
|
520 | 520 | |
521 | 521 | // Sidebar regions get a couple extra classes. |
522 | 522 | if (strpos($vars['region'], 'sidebar_') === 0) { |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | $vars['title'] = $block->subject; |
543 | 543 | |
544 | 544 | // Special classes for blocks. |
545 | - $vars['classes_array'][] = 'block-' . $block->module; |
|
545 | + $vars['classes_array'][] = 'block-'.$block->module; |
|
546 | 546 | // Classes describing the position of the block within the region. |
547 | 547 | if ($vars['block_id'] == 1) { |
548 | 548 | $vars['classes_array'][] = 'first'; |
@@ -550,17 +550,17 @@ discard block |
||
550 | 550 | if (!function_exists('context_blocks') && count(block_list($vars['block']->region)) == $vars['block_id']) { |
551 | 551 | $vars['classes_array'][] = 'last'; |
552 | 552 | } |
553 | - $vars['classes_array'][] = 'region-' . $vars['block_zebra']; |
|
553 | + $vars['classes_array'][] = 'region-'.$vars['block_zebra']; |
|
554 | 554 | $vars['classes_array'][] = $vars['zebra']; |
555 | - $vars['classes_array'][] = 'region-count-' . $vars['block_id']; |
|
556 | - $vars['classes_array'][] = 'count-' . $vars['id']; |
|
555 | + $vars['classes_array'][] = 'region-count-'.$vars['block_id']; |
|
556 | + $vars['classes_array'][] = 'count-'.$vars['id']; |
|
557 | 557 | |
558 | 558 | // Create the block ID. |
559 | - $vars['block_html_id'] = 'block-' . $block->module . '-' . $block->delta; |
|
559 | + $vars['block_html_id'] = 'block-'.$block->module.'-'.$block->delta; |
|
560 | 560 | |
561 | 561 | $vars['edit_links_array'] = array(); |
562 | 562 | if (theme_get_setting('zen_block_editing') && user_access('administer blocks')) { |
563 | - include_once './' . _zen_path() . '/zen-internals/template.block-editing.inc'; |
|
563 | + include_once './'._zen_path().'/zen-internals/template.block-editing.inc'; |
|
564 | 564 | zen_preprocess_block_editing($vars, $hook); |
565 | 565 | $vars['classes_array'][] = 'with-block-editing'; |
566 | 566 | } |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | * The name of the template being rendered ("block" in this case.) |
591 | 591 | */ |
592 | 592 | function zen_process_block(&$vars, $hook) { |
593 | - $vars['edit_links'] = !empty($vars['edit_links_array']) ? '<div class="edit">' . implode(' ', $vars['edit_links_array']) . '</div>' : ''; |
|
593 | + $vars['edit_links'] = !empty($vars['edit_links_array']) ? '<div class="edit">'.implode(' ', $vars['edit_links_array']).'</div>' : ''; |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | if (!function_exists('drupal_html_class')) { |
@@ -24,72 +24,72 @@ |
||
24 | 24 | define('KW_CATEGORY_SCIENCE', 0); |
25 | 25 | define('KW_CATEGORY_LOC', 1); |
26 | 26 | |
27 | -define('KW_ASTRONOMY', 1); |
|
28 | -define('KW_SETI', 2); |
|
29 | -define('KW_PULSARS', 3); |
|
30 | -define('KW_GW', 4); |
|
31 | -define('KW_COSMOLOGY', 5); |
|
32 | -define('KW_PHYSICS', 6); |
|
27 | +define('KW_ASTRONOMY', 1); |
|
28 | +define('KW_SETI', 2); |
|
29 | +define('KW_PULSARS', 3); |
|
30 | +define('KW_GW', 4); |
|
31 | +define('KW_COSMOLOGY', 5); |
|
32 | +define('KW_PHYSICS', 6); |
|
33 | 33 | define('KW_PARTICLE_PHYSICS', 7); |
34 | -define('KW_NANOSCIENCE', 8); |
|
35 | -define('KW_BIOMED', 9); |
|
34 | +define('KW_NANOSCIENCE', 8); |
|
35 | +define('KW_BIOMED', 9); |
|
36 | 36 | define('KW_DRUG_DISCOVERY', 10); |
37 | -define('KW_PROTEINS', 11); |
|
38 | -define('KW_GENETICS', 12); |
|
39 | -define('KW_DISEASE', 13); |
|
40 | -define('KW_CANCER', 14); |
|
41 | -define('KW_MATH_CS', 15); |
|
42 | -define('KW_AI', 16); |
|
43 | -define('KW_OCEANIA', 17); |
|
44 | -define('KW_AUSTRALIA', 18); |
|
37 | +define('KW_PROTEINS', 11); |
|
38 | +define('KW_GENETICS', 12); |
|
39 | +define('KW_DISEASE', 13); |
|
40 | +define('KW_CANCER', 14); |
|
41 | +define('KW_MATH_CS', 15); |
|
42 | +define('KW_AI', 16); |
|
43 | +define('KW_OCEANIA', 17); |
|
44 | +define('KW_AUSTRALIA', 18); |
|
45 | 45 | |
46 | -define('KW_EUROPE', 20); |
|
47 | -define('KW_GERMANY', 21); |
|
48 | -define('KW_ASIA', 22); |
|
49 | -define('KW_AMERICAS', 23); |
|
50 | -define('KW_US', 24); |
|
51 | -define('KW_UCB', 25); |
|
52 | -define('KW_AEI', 26); |
|
53 | -define('KW_CERN', 27); |
|
54 | -define('KW_UW', 28); |
|
55 | -define('KW_EARTH_SCI', 29); |
|
56 | -define('KW_SPAIN', 30); |
|
57 | -define('KW_SAN_JORGE', 31); |
|
58 | -define('KW_NUMBER_THEORY', 32); |
|
59 | -define('KW_CRYPTO', 33); |
|
60 | -define('KW_ENV_RESEARCH', 34); |
|
61 | -define('KW_CLIMATE', 35); |
|
62 | -define('KW_CZECH', 36); |
|
46 | +define('KW_EUROPE', 20); |
|
47 | +define('KW_GERMANY', 21); |
|
48 | +define('KW_ASIA', 22); |
|
49 | +define('KW_AMERICAS', 23); |
|
50 | +define('KW_US', 24); |
|
51 | +define('KW_UCB', 25); |
|
52 | +define('KW_AEI', 26); |
|
53 | +define('KW_CERN', 27); |
|
54 | +define('KW_UW', 28); |
|
55 | +define('KW_EARTH_SCI', 29); |
|
56 | +define('KW_SPAIN', 30); |
|
57 | +define('KW_SAN_JORGE', 31); |
|
58 | +define('KW_NUMBER_THEORY', 32); |
|
59 | +define('KW_CRYPTO', 33); |
|
60 | +define('KW_ENV_RESEARCH', 34); |
|
61 | +define('KW_CLIMATE', 35); |
|
62 | +define('KW_CZECH', 36); |
|
63 | 63 | define('KW_CHARLES_PRAGUE', 37); |
64 | -define('KW_RECHENKRAFT', 38); |
|
65 | -define('KW_RHEINMAIN', 39); |
|
66 | -define('KW_HUNGARY', 40); |
|
67 | -define('KW_IRELAND', 41); |
|
68 | -define('KW_UC_DUBLIN', 42); |
|
69 | -define('KW_POLAND', 43); |
|
70 | -define('KW_RUSSIA', 44); |
|
64 | +define('KW_RECHENKRAFT', 38); |
|
65 | +define('KW_RHEINMAIN', 39); |
|
66 | +define('KW_HUNGARY', 40); |
|
67 | +define('KW_IRELAND', 41); |
|
68 | +define('KW_UC_DUBLIN', 42); |
|
69 | +define('KW_POLAND', 43); |
|
70 | +define('KW_RUSSIA', 44); |
|
71 | 71 | define('KW_SW_STATE_RUSSIA', 45); |
72 | -define('KW_RAS', 46); |
|
73 | -define('KW_PRBB', 47); |
|
74 | -define('KW_UK', 48); |
|
75 | -define('KW_OXFORD', 49); |
|
76 | -define('KW_CHINA', 50); |
|
77 | -define('KW_U_DAYTON', 51); |
|
78 | -define('KW_WRIGHT_STATE', 52); |
|
79 | -define('KW_USC', 53); |
|
80 | -define('KW_FULLERTON', 54); |
|
81 | -define('KW_ARIZONA_STATE', 55); |
|
82 | -define('KW_U_ILLINOIS', 56); |
|
83 | -define('KW_U_WARSAW', 57); |
|
84 | -define('KW_RPI', 58); |
|
85 | -define('KW_INTERNATIONAL', 59); |
|
86 | -define('KW_UND', 60); |
|
87 | -define('KW_HOLLAND', 61); |
|
88 | -define('KW_CHEMISTRY', 62); |
|
89 | -define('KW_GAMES', 63); |
|
90 | -define('KW_VIRUS', 64); |
|
91 | -define('KW_FRANCE', 65); |
|
92 | -define('KW_CANADA', 66); |
|
72 | +define('KW_RAS', 46); |
|
73 | +define('KW_PRBB', 47); |
|
74 | +define('KW_UK', 48); |
|
75 | +define('KW_OXFORD', 49); |
|
76 | +define('KW_CHINA', 50); |
|
77 | +define('KW_U_DAYTON', 51); |
|
78 | +define('KW_WRIGHT_STATE', 52); |
|
79 | +define('KW_USC', 53); |
|
80 | +define('KW_FULLERTON', 54); |
|
81 | +define('KW_ARIZONA_STATE', 55); |
|
82 | +define('KW_U_ILLINOIS', 56); |
|
83 | +define('KW_U_WARSAW', 57); |
|
84 | +define('KW_RPI', 58); |
|
85 | +define('KW_INTERNATIONAL', 59); |
|
86 | +define('KW_UND', 60); |
|
87 | +define('KW_HOLLAND', 61); |
|
88 | +define('KW_CHEMISTRY', 62); |
|
89 | +define('KW_GAMES', 63); |
|
90 | +define('KW_VIRUS', 64); |
|
91 | +define('KW_FRANCE', 65); |
|
92 | +define('KW_CANADA', 66); |
|
93 | 93 | |
94 | 94 | $job_keywords = array(); |
95 | 95 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | $offset = get_int("offset", true); |
35 | -if (!$offset) $offset=0; |
|
35 | +if (!$offset) $offset = 0; |
|
36 | 36 | |
37 | 37 | if ($offset > 1000) { |
38 | 38 | error_page(tra("Limit exceeded: Can only display the first 1000 members.")); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | } |
31 | 31 | |
32 | 32 | function show_forum_rss_item($thread, $userid, $threads_only, $no_images) { |
33 | - $unique_url=secure_url_base()."forum_thread.php?id=".$thread->id; |
|
33 | + $unique_url = secure_url_base()."forum_thread.php?id=".$thread->id; |
|
34 | 34 | |
35 | 35 | $clause2 = " and hidden=0 "; |
36 | 36 | if ($userid) $clause2 .= "and user=$userid"; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | if (!count($posts)) return; |
43 | 43 | $post = $posts[0]; |
44 | - $post_date = gmdate('D, d M Y H:i:s',$post->timestamp).' GMT'; |
|
44 | + $post_date = gmdate('D, d M Y H:i:s', $post->timestamp).' GMT'; |
|
45 | 45 | $post_user = BOincUser::lookup_id($post->user); |
46 | 46 | BoincForumPrefs::lookup($post_user); |
47 | 47 | $options = new output_options(); |
@@ -84,25 +84,25 @@ discard block |
||
84 | 84 | |
85 | 85 | // Now construct header |
86 | 86 | // |
87 | - header ("Expires: " . gmdate('D, d M Y H:i:s', time()+86400) . " GMT"); |
|
87 | + header("Expires: ".gmdate('D, d M Y H:i:s', time() + 86400)." GMT"); |
|
88 | 88 | if (sizeof($threads)) { |
89 | 89 | $t = $threads[0]; |
90 | - $last_mod_time = $threads_only?$t->create_time:$t->timestamp; |
|
91 | - $create_date = gmdate('D, d M Y H:i:s', $last_mod_time) . ' GMT'; |
|
92 | - header ("Last-Modified: " . $create_date); |
|
90 | + $last_mod_time = $threads_only ? $t->create_time : $t->timestamp; |
|
91 | + $create_date = gmdate('D, d M Y H:i:s', $last_mod_time).' GMT'; |
|
92 | + header("Last-Modified: ".$create_date); |
|
93 | 93 | } else { |
94 | - $create_date = gmdate('D, d M Y H:i:s') . ' GMT'; |
|
94 | + $create_date = gmdate('D, d M Y H:i:s').' GMT'; |
|
95 | 95 | } |
96 | - header ("Content-Type: application/xml"); |
|
96 | + header("Content-Type: application/xml"); |
|
97 | 97 | |
98 | - $forum=BoincForum::lookup_id($forumid); |
|
98 | + $forum = BoincForum::lookup_id($forumid); |
|
99 | 99 | // Create channel header and open XML content |
100 | 100 | // |
101 | 101 | $description = PROJECT.": $forum->title"; |
102 | 102 | if ($userid) { |
103 | 103 | $description .= " (posts by $user->name)"; |
104 | 104 | } |
105 | - $channel_image = secure_url_base() . "rss_image.gif"; |
|
105 | + $channel_image = secure_url_base()."rss_image.gif"; |
|
106 | 106 | $language = "en-us"; |
107 | 107 | echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> |
108 | 108 | <rss version=\"2.0\"> |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | $dh = opendir($langdir.$transdir); |
65 | 65 | if (!$dh) die("can't open translation dir"); |
66 | 66 | while (($file = readdir($dh)) !== false) { |
67 | - if ($file==".." || $file==".") { |
|
67 | + if ($file == ".." || $file == ".") { |
|
68 | 68 | continue; |
69 | 69 | } |
70 | 70 | // only do files ending in .po |
71 | - if (substr($file,-3) != ".po"){ |
|
71 | + if (substr($file, -3) != ".po") { |
|
72 | 72 | //debug("File $file with unknown extension found in $info_dir"); |
73 | 73 | continue; |
74 | 74 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | "-------------Compiling $transdir$file------------", 0 |
77 | 77 | ); |
78 | 78 | $language = parse_po_file($langdir.$transdir.$file); |
79 | - if (!$language){ |
|
79 | + if (!$language) { |
|
80 | 80 | language_log( |
81 | 81 | "WARNING: Could not parse language ".$file |
82 | 82 | ); |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | ); |
96 | 96 | exit; |
97 | 97 | } |
98 | - foreach ($language as $key => $value){ |
|
98 | + foreach ($language as $key => $value) { |
|
99 | 99 | if ($value !== "") { |
100 | 100 | // Skip if the msgstr is empty |
101 | - fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n"); |
|
101 | + fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file, 0, -3))."\"][\"".$key."\"] = \"".$value."\";\n"); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | // don't write \?\> - may append |
@@ -115,27 +115,27 @@ discard block |
||
115 | 115 | function parse_po_file($file) { |
116 | 116 | $translation_file = file($file); |
117 | 117 | $first_entry = true; |
118 | - $current_token_text=""; |
|
119 | - $current_token =""; |
|
118 | + $current_token_text = ""; |
|
119 | + $current_token = ""; |
|
120 | 120 | $parsing_token = false; |
121 | 121 | $parsing_text = false; |
122 | 122 | $size = sizeof($translation_file); |
123 | 123 | $output = array(); |
124 | - for ($i=0; $i<$size; $i++){ |
|
124 | + for ($i = 0; $i < $size; $i++) { |
|
125 | 125 | $entry = trim($translation_file[$i]); |
126 | 126 | //echo "line $i: $entry\n"; |
127 | - if (substr($entry, 0, 1)=="#") { |
|
127 | + if (substr($entry, 0, 1) == "#") { |
|
128 | 128 | continue; |
129 | 129 | } elseif (strpos($entry, "msgid") !== false) { |
130 | - if (!$first_entry){ |
|
130 | + if (!$first_entry) { |
|
131 | 131 | //If this is not the first, save the previous entry |
132 | - $output[$current_token]=$current_token_text; |
|
132 | + $output[$current_token] = $current_token_text; |
|
133 | 133 | } |
134 | 134 | $current_token = get_po_line($entry, $file); |
135 | - $current_token_text=""; |
|
135 | + $current_token_text = ""; |
|
136 | 136 | $parsing_token = true; |
137 | 137 | $parsing_text = false; |
138 | - $first_entry=false; |
|
138 | + $first_entry = false; |
|
139 | 139 | } elseif (strpos($entry, "msgstr") !== false) { |
140 | 140 | $current_token_text = get_po_line($entry, $file); |
141 | 141 | $parsing_token = false; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | // Get the last token |
151 | 151 | // |
152 | - if ($current_token && $current_token_text){ |
|
152 | + if ($current_token && $current_token_text) { |
|
153 | 153 | $output[$current_token] = $current_token_text; |
154 | 154 | } |
155 | 155 | return $output; |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | // Returns the contents of a line (ie removes "" from start and end) |
160 | 160 | // |
161 | 161 | function get_po_line($line, $file) { |
162 | - $start = strpos($line, '"')+1; |
|
162 | + $start = strpos($line, '"') + 1; |
|
163 | 163 | $stop = strrpos($line, '"'); |
164 | - $x = substr($line, $start, $stop-$start); |
|
164 | + $x = substr($line, $start, $stop - $start); |
|
165 | 165 | $n = preg_match("/[^\\\\]\"/", $x); |
166 | 166 | if ($n) { |
167 | 167 | echo "ERROR - MISMATCHED QUOTES IN $file: $line\n"; |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | |
181 | 181 | // Find the string in the user's language |
182 | 182 | // |
183 | - foreach ($languages_in_use as $language){ |
|
183 | + foreach ($languages_in_use as $language) { |
|
184 | 184 | if (isset($language_lookup_array[$language][$text])) { |
185 | 185 | $text = $language_lookup_array[$language][$text]; |
186 | 186 | break; |
187 | - } else if ($language=="en"){ |
|
187 | + } else if ($language == "en") { |
|
188 | 188 | // This language is defined in the code and is always available |
189 | 189 | break; |
190 | 190 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | // Replace relevant substrings with given arguments. |
194 | 194 | // Use strtr to avoid problems if an argument contains %n. |
195 | 195 | $replacements = array(); |
196 | - for ($i=1; $i<func_num_args(); $i++){ |
|
196 | + for ($i = 1; $i < func_num_args(); $i++) { |
|
197 | 197 | $replacements["%".$i] = func_get_arg($i); |
198 | 198 | } |
199 | 199 | |
@@ -210,14 +210,14 @@ discard block |
||
210 | 210 | return $text; |
211 | 211 | } |
212 | 212 | |
213 | -function language_log($message, $loglevel=0) { |
|
213 | +function language_log($message, $loglevel = 0) { |
|
214 | 214 | global $lang_log_level; |
215 | 215 | $msg = ""; |
216 | - if ($loglevel==0) $msg = "[ Debug ]"; |
|
217 | - if ($loglevel==1) $msg = "[ Warning ]"; |
|
218 | - if ($loglevel==2) $msg = "[ CRITICAL ]"; |
|
216 | + if ($loglevel == 0) $msg = "[ Debug ]"; |
|
217 | + if ($loglevel == 1) $msg = "[ Warning ]"; |
|
218 | + if ($loglevel == 2) $msg = "[ CRITICAL ]"; |
|
219 | 219 | |
220 | - if ($loglevel >= $lang_log_level){ |
|
220 | + if ($loglevel >= $lang_log_level) { |
|
221 | 221 | echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n"; |
222 | 222 | } |
223 | 223 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | // (by looking at cookies and browser settings) |
227 | 227 | // cookies have highest priority. |
228 | 228 | |
229 | -if (isset($_COOKIE['lang'])){ |
|
229 | +if (isset($_COOKIE['lang'])) { |
|
230 | 230 | $language_string = $_COOKIE['lang'].","; |
231 | 231 | } else { |
232 | 232 | $language_string = ''; |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | // Loop over languages that the client requests |
258 | 258 | // |
259 | 259 | $size = sizeof($client_languages); |
260 | -for ($i=0; $i<$size; $i++) { |
|
261 | - if ((strlen($client_languages[$i])>2) |
|
260 | +for ($i = 0; $i < $size; $i++) { |
|
261 | + if ((strlen($client_languages[$i]) > 2) |
|
262 | 262 | && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-") |
263 | - ){ |
|
263 | + ) { |
|
264 | 264 | // If this is defined as primary-secondary, represent it as xx_YY |
265 | 265 | // |
266 | 266 | $language = substr( |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | // if main language is english, look no further |
281 | 281 | // |
282 | - if ((count($languages_in_use)==0) && ($language == 'en' || $language2 == 'en')) { |
|
282 | + if ((count($languages_in_use) == 0) && ($language == 'en' || $language2 == 'en')) { |
|
283 | 283 | break; |
284 | 284 | } |
285 | 285 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | // |
288 | 288 | $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc"; |
289 | 289 | if (file_exists($file_name)) { |
290 | - if (!in_array($language, $languages_in_use)){ |
|
290 | + if (!in_array($language, $languages_in_use)) { |
|
291 | 291 | require_once($file_name); |
292 | 292 | $languages_in_use[] = $language; |
293 | 293 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | if ($language2) { |
296 | 296 | $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc"; |
297 | 297 | if (file_exists($file_name)) { |
298 | - if (!in_array($language2, $languages_in_use)){ |
|
298 | + if (!in_array($language2, $languages_in_use)) { |
|
299 | 299 | require_once($file_name); |
300 | 300 | $languages_in_use[] = $language2; |
301 | 301 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
306 | -$GLOBALS['languages_in_use'] = $languages_in_use; // for Drupal |
|
306 | +$GLOBALS['languages_in_use'] = $languages_in_use; // for Drupal |
|
307 | 307 | |
308 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
308 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
309 | 309 | ?> |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | "Zimbabwe" |
258 | 258 | ); |
259 | 259 | |
260 | -$country_to_iso3166_2 = array ( |
|
260 | +$country_to_iso3166_2 = array( |
|
261 | 261 | "Afghanistan" => "af", |
262 | 262 | "Albania" => "al", |
263 | 263 | "Algeria" => "dz", |
@@ -493,25 +493,25 @@ discard block |
||
493 | 493 | |
494 | 494 | // return a list of country options for a <select> |
495 | 495 | // |
496 | -function country_select_options($selected_country="None") { |
|
496 | +function country_select_options($selected_country = "None") { |
|
497 | 497 | global $countries; |
498 | 498 | |
499 | 499 | require_once("../inc/geoip.inc"); |
500 | 500 | |
501 | 501 | // See if we can find the user's country and select it as default: |
502 | 502 | // |
503 | - $gi = geoip_open("../inc/GeoIP.dat",GEOIP_STANDARD); |
|
504 | - $geoip_country = geoip_country_name_by_addr($gi,$_SERVER["REMOTE_ADDR"]); |
|
503 | + $gi = geoip_open("../inc/GeoIP.dat", GEOIP_STANDARD); |
|
504 | + $geoip_country = geoip_country_name_by_addr($gi, $_SERVER["REMOTE_ADDR"]); |
|
505 | 505 | geoip_close($gi); |
506 | 506 | |
507 | - if ($selected_country=="") $selected_country="None"; |
|
508 | - if ($selected_country=="None" and $geoip_country!=""){ |
|
509 | - $selected_country=$geoip_country; |
|
507 | + if ($selected_country == "") $selected_country = "None"; |
|
508 | + if ($selected_country == "None" and $geoip_country != "") { |
|
509 | + $selected_country = $geoip_country; |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | $x = ""; |
513 | 513 | foreach ($countries as $country) { |
514 | - $selected = ($selected_country == $country ? "selected":""); |
|
514 | + $selected = ($selected_country == $country ? "selected" : ""); |
|
515 | 515 | $x .= "<option value=\"$country\" $selected>$country</option>\n"; |
516 | 516 | } |
517 | 517 | return $x; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | new NUM_SPEC(tra("% of the CPUs"), 1, 100, 0) |
109 | 109 | ), |
110 | 110 | new PREF_NUM( |
111 | - tra("Use at most") ."<br><font size=-2>Requires BOINC 7.20.3+</font>", |
|
111 | + tra("Use at most")."<br><font size=-2>Requires BOINC 7.20.3+</font>", |
|
112 | 112 | // xgettext:no-php-format |
113 | 113 | tra("Suspend/resume computing every few seconds to reduce CPU temperature and energy usage. Example: 75% means compute for 3 seconds, wait for 1 second, and repeat."), |
114 | 114 | "niu_cpu_usage_limit", |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | $dp->disk_max_used_pct = parse_config($config, "<default_disk_max_used_pct>"); |
296 | 296 | $dp->disk_min_free_gb = parse_config($config, "<default_disk_min_free_gb>"); |
297 | 297 | // set some defaults if not found |
298 | - if (!$dp->disk_max_used_gb) $dp->disk_max_used_gb = 0; // no limit |
|
298 | + if (!$dp->disk_max_used_gb) $dp->disk_max_used_gb = 0; // no limit |
|
299 | 299 | if (!$dp->disk_max_used_pct) $dp->disk_max_used_pct = 90; // 90 percent |
300 | - if (!$dp->disk_min_free_gb) $dp->disk_min_free_gb = 1; // 1 GB |
|
300 | + if (!$dp->disk_min_free_gb) $dp->disk_min_free_gb = 1; // 1 GB |
|
301 | 301 | // set mininimum free space scheduler allows |
302 | 302 | // - depends on which scheduler is running |
303 | 303 | $dp->new_sched_flag = 1; |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | global $text; |
324 | 324 | global $venue_name; |
325 | 325 | |
326 | - switch($name) { |
|
326 | + switch ($name) { |
|
327 | 327 | case "venue": |
328 | 328 | if (array_key_exists("name", $attrs)) { |
329 | 329 | $venue_name = $attrs["name"]; |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | return; |
374 | 374 | } |
375 | 375 | } |
376 | - switch($name) { |
|
376 | + switch ($name) { |
|
377 | 377 | case "venue": |
378 | 378 | $top_parse_result->$venue_name = $parse_result; |
379 | 379 | $parse_result = $top_parse_result; |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | } |
548 | 548 | } |
549 | 549 | |
550 | -function print_prefs_display_global($user, $columns=false) { |
|
550 | +function print_prefs_display_global($user, $columns = false) { |
|
551 | 551 | $global_prefs = prefs_parse_global($user->global_prefs); |
552 | 552 | |
553 | 553 | echo tra("These settings apply to all computers using this account except") |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | .tra("Android devices") |
558 | 558 | ."</ul> |
559 | 559 | "; |
560 | - $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=global&cols=". (int)!$columns .">".tra("(Switch view)")."</a></font>"; |
|
560 | + $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=global&cols=".(int)!$columns.">".tra("(Switch view)")."</a></font>"; |
|
561 | 561 | if ($columns) { |
562 | 562 | echo "<h3>".tra("Combined preferences").$switch_link."</h3>"; |
563 | 563 | start_table(); |
@@ -594,9 +594,9 @@ discard block |
||
594 | 594 | // otherwise false |
595 | 595 | // |
596 | 596 | function print_prefs_form( |
597 | - $action, $subset, $venue, $user, $prefs, $cols, $error=false, |
|
598 | - $project_error=false |
|
599 | -){ |
|
597 | + $action, $subset, $venue, $user, $prefs, $cols, $error = false, |
|
598 | + $project_error = false |
|
599 | +) { |
|
600 | 600 | if ($action == "add") { |
601 | 601 | $script = "add_venue.php"; |
602 | 602 | $submit_value = tra("Add preferences"); |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | // |
637 | 637 | // Functions to display preference subsets as forms |
638 | 638 | // |
639 | -function prefs_form_global($user, $prefs, $error=false) { |
|
639 | +function prefs_form_global($user, $prefs, $error = false) { |
|
640 | 640 | global $in_use_prefs; |
641 | 641 | global $not_in_use_prefs; |
642 | 642 | global $job_prefs; |
@@ -673,9 +673,9 @@ discard block |
||
673 | 673 | // |
674 | 674 | function prefs_form_radio_buttons($name, $yesno) { |
675 | 675 | $rb = tra("yes")." <input type=radio name=$name value=yes " |
676 | - .($yesno?"checked":"") |
|
676 | + .($yesno ? "checked" : "") |
|
677 | 677 | ."> ".tra("no")." <input type=radio name=$name value=no " |
678 | - .($yesno?"":"checked") |
|
678 | + .($yesno ? "" : "checked") |
|
679 | 679 | .">\n"; |
680 | 680 | return $rb; |
681 | 681 | } |
@@ -694,12 +694,12 @@ discard block |
||
694 | 694 | } |
695 | 695 | function venue_show($user) { |
696 | 696 | $venue = $user->venue; |
697 | - if ($venue =='') $venue = '---'; |
|
697 | + if ($venue == '') $venue = '---'; |
|
698 | 698 | tooltip_row2(VENUE_TOOLTIP, VENUE_DESC, $venue); |
699 | 699 | } |
700 | 700 | |
701 | 701 | function venue_form($user) { |
702 | - $n=$h=$w=$s=$m=''; |
|
702 | + $n = $h = $w = $s = $m = ''; |
|
703 | 703 | if ($user->venue == '') $n = 'selected'; |
704 | 704 | if ($user->venue == 'home') $h = 'selected'; |
705 | 705 | if ($user->venue == 'work') $w = 'selected'; |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | // |
758 | 758 | // convert prefs from structure to XML |
759 | 759 | // |
760 | -function global_prefs_make_xml($prefs, $primary=true) { |
|
760 | +function global_prefs_make_xml($prefs, $primary = true) { |
|
761 | 761 | global $in_use_prefs; |
762 | 762 | global $not_in_use_prefs; |
763 | 763 | global $job_prefs; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | db_init(); |
27 | 27 | |
28 | 28 | function current_tally($voteid) { |
29 | - $query="select sum(yes) as ayes,count(id)-sum(yes) as nays from banishment_votes where voteid=".$voteid; |
|
29 | + $query = "select sum(yes) as ayes,count(id)-sum(yes) as nays from banishment_votes where voteid=".$voteid; |
|
30 | 30 | $result = _mysql_query($query); |
31 | 31 | $foobar = _mysql_fetch_object($result); |
32 | 32 | echo "<b>Current Tally</b> Ayes: ".$foobar->ayes." Nays: ".$foobar->nays."<p>"; |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | |
36 | 36 | function vote_is_in_progress($userid) { |
37 | 37 | // check whether a vote is already ongoing |
38 | - $now=time(); |
|
39 | - $query="select count(id) as count from banishment_vote where userid=".$userid." and end_time>".$now; |
|
38 | + $now = time(); |
|
39 | + $query = "select count(id) as count from banishment_vote where userid=".$userid." and end_time>".$now; |
|
40 | 40 | $result = _mysql_query($query); |
41 | 41 | if (!$result) { |
42 | 42 | echo "Database error attempting to read banishment_vote table 1.<p>"; |
@@ -51,56 +51,56 @@ discard block |
||
51 | 51 | return $foobar->count; |
52 | 52 | } |
53 | 53 | |
54 | -function start_vote($config,$logged_in_user,$user,$category,$reason) { |
|
55 | - $now=time(); |
|
56 | - $fin=$now+21600; |
|
54 | +function start_vote($config, $logged_in_user, $user, $category, $reason) { |
|
55 | + $now = time(); |
|
56 | + $fin = $now + 21600; |
|
57 | 57 | |
58 | 58 | |
59 | - if ( vote_is_in_progress($user->id) !=0 ) { |
|
59 | + if (vote_is_in_progress($user->id) != 0) { |
|
60 | 60 | echo "A banishment vote is already underway for this user.<p>"; |
61 | 61 | return 0; |
62 | 62 | } |
63 | - $query="insert into banishment_vote (userid,modid,start_time,end_time) values (".$user->id.",".$logged_in_user->id.",".$now.",".$fin.")"; |
|
63 | + $query = "insert into banishment_vote (userid,modid,start_time,end_time) values (".$user->id.",".$logged_in_user->id.",".$now.",".$fin.")"; |
|
64 | 64 | $result = _mysql_query($query); |
65 | 65 | if (!$result) { |
66 | 66 | echo "Database error attempting to insert to banishment_vote table.<p>"; |
67 | 67 | return 0; |
68 | 68 | } |
69 | 69 | |
70 | - $voteid=_mysql_insert_id(); |
|
71 | - $query="insert into banishment_votes (voteid,modid,time,yes) values (". $voteid .",". $logged_in_user->id .",". $now .",1)"; |
|
70 | + $voteid = _mysql_insert_id(); |
|
71 | + $query = "insert into banishment_votes (voteid,modid,time,yes) values (".$voteid.",".$logged_in_user->id.",".$now.",1)"; |
|
72 | 72 | $result = _mysql_query($query); |
73 | 73 | if (!$result) { |
74 | 74 | echo "Database error attempting to insert to banishment_votes table.<p>"; |
75 | 75 | return 0; |
76 | 76 | } |
77 | 77 | |
78 | - $query="update forum_preferences set banished_until=".$fin." where userid=".$user->id; |
|
78 | + $query = "update forum_preferences set banished_until=".$fin." where userid=".$user->id; |
|
79 | 79 | $result = _mysql_query($query); |
80 | 80 | |
81 | 81 | echo "Banishment vote started.<p><p>"; |
82 | 82 | current_tally($voteid); |
83 | - return send_banish_vote_email($user, 86400*14, $reason, $now+21600); |
|
83 | + return send_banish_vote_email($user, 86400*14, $reason, $now + 21600); |
|
84 | 84 | } |
85 | 85 | |
86 | -function vote_yes($config,$logged_in_user,$user) { |
|
87 | - $now=time(); |
|
86 | +function vote_yes($config, $logged_in_user, $user) { |
|
87 | + $now = time(); |
|
88 | 88 | // Check that a vote is underway. |
89 | - if (vote_is_in_progress($user->id)<1) { |
|
89 | + if (vote_is_in_progress($user->id) < 1) { |
|
90 | 90 | echo "No banishment vote is underway for this user.<p><p>"; |
91 | 91 | return 0; |
92 | 92 | } |
93 | 93 | // Find the voteid |
94 | - $query="select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now; |
|
94 | + $query = "select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now; |
|
95 | 95 | $result = _mysql_query($query); |
96 | 96 | $foobar = _mysql_fetch_object($result); |
97 | 97 | if (!$foobar) { |
98 | 98 | echo "Database error attempting to read banishment_vote table.<p>"; |
99 | 99 | return 0; |
100 | 100 | } |
101 | - $voteid=$foobar->voteid; |
|
101 | + $voteid = $foobar->voteid; |
|
102 | 102 | // Check whether mod has voted already. |
103 | - $query="select count(id) as count from banishment_votes where voteid=".$voteid." and modid=".$logged_in_user->id; |
|
103 | + $query = "select count(id) as count from banishment_votes where voteid=".$voteid." and modid=".$logged_in_user->id; |
|
104 | 104 | $result = _mysql_query($query); |
105 | 105 | $foobar = _mysql_fetch_object($result); |
106 | 106 | if (!$foobar) { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | return 0; |
114 | 114 | } |
115 | 115 | // insert the vote |
116 | - $query="insert into banishment_votes (voteid,modid,time,yes) values (" . $voteid .",". $logged_in_user->id .",". $now .",1)"; |
|
116 | + $query = "insert into banishment_votes (voteid,modid,time,yes) values (".$voteid.",".$logged_in_user->id.",".$now.",1)"; |
|
117 | 117 | $result = _mysql_query($query); |
118 | 118 | if (!$result) { |
119 | 119 | echo "Database error attempting to insert to banishment_votes table.<p>"; |
@@ -124,24 +124,24 @@ discard block |
||
124 | 124 | return 1; |
125 | 125 | } |
126 | 126 | |
127 | -function vote_no($config,$logged_in_user,$user) { |
|
127 | +function vote_no($config, $logged_in_user, $user) { |
|
128 | 128 | // Check that a vote is underway. |
129 | - $now=time(); |
|
130 | - if (vote_is_in_progress($user->id)<1) { |
|
129 | + $now = time(); |
|
130 | + if (vote_is_in_progress($user->id) < 1) { |
|
131 | 131 | echo "No banishment vote is underway for this user.<p>"; |
132 | 132 | return 0; |
133 | 133 | } |
134 | 134 | // Find the voteid |
135 | - $query="select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now; |
|
135 | + $query = "select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now; |
|
136 | 136 | $result = _mysql_query($query); |
137 | 137 | $foobar = _mysql_fetch_object($result); |
138 | 138 | if (!$foobar) { |
139 | 139 | echo "Database error attempting to read banishment_vote table.<p>"; |
140 | 140 | return 0; |
141 | 141 | } |
142 | - $voteid=$foobar->voteid; |
|
142 | + $voteid = $foobar->voteid; |
|
143 | 143 | // Check whether mod has voted already. |
144 | - $query="select count(id) as count from banishment_votes where voteid=".$voteid ." and modid=".$logged_in_user->id; |
|
144 | + $query = "select count(id) as count from banishment_votes where voteid=".$voteid." and modid=".$logged_in_user->id; |
|
145 | 145 | $result = _mysql_query($query); |
146 | 146 | $foobar = _mysql_fetch_object($result); |
147 | 147 | if (!$foobar) { |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | return 0; |
155 | 155 | } |
156 | 156 | // insert the vote |
157 | - $query="insert into banishment_votes (voteid,modid,time,yes) values (" . $voteid .",". $logged_in_user->id .",". $now .",0)"; |
|
157 | + $query = "insert into banishment_votes (voteid,modid,time,yes) values (".$voteid.",".$logged_in_user->id.",".$now.",0)"; |
|
158 | 158 | $result = _mysql_query($query); |
159 | 159 | if (!$result) { |
160 | 160 | echo "Database error attempting to insert to banishment_votes table.<p>"; |