@@ -164,7 +164,7 @@ |
||
| 164 | 164 | $user->prefs = $prefs; |
| 165 | 165 | } |
| 166 | 166 | function privilege($specialbit) { |
| 167 | - return (substr($this->special_user, $specialbit,1)==1); |
|
| 167 | + return (substr($this->special_user, $specialbit,1)==1); |
|
| 168 | 168 | } |
| 169 | 169 | function update($clause) { |
| 170 | 170 | $db = BoincDb::get(); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | function print_text_field($text,$name,$value) { |
| 64 | 64 | echo "$text <input type=\"text\" size=\"10\" name=\"$name\" value=\"$value\">\n" |
| 65 | - . "<p>\n"; |
|
| 65 | + . "<p>\n"; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | function row($x, $y) { |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | $db->do_query($q4); |
| 379 | 379 | return 2; |
| 380 | 380 | } else if (!$db->do_query($q3)) { |
| 381 | - echo "MySQL command '$q3' failed:<br/>unable to cancel workunits and trigger transitioner.<br>\n"; |
|
| 381 | + echo "MySQL command '$q3' failed:<br/>unable to cancel workunits and trigger transitioner.<br>\n"; |
|
| 382 | 382 | $db->do_query($q4); |
| 383 | 383 | return 3; |
| 384 | 384 | } |
@@ -11,10 +11,10 @@ |
||
| 11 | 11 | |
| 12 | 12 | spl_autoload_register(function ($class) { |
| 13 | 13 | if (substr($class, 0, 10) !== 'ReCaptcha\\') { |
| 14 | - /* If the class does not lie under the "ReCaptcha" namespace, |
|
| 14 | + /* If the class does not lie under the "ReCaptcha" namespace, |
|
| 15 | 15 | * then we can exit immediately. |
| 16 | 16 | */ |
| 17 | - return; |
|
| 17 | + return; |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | /* All of the classes have names like "ReCaptcha\Foo", so we need |
@@ -358,10 +358,10 @@ |
||
| 358 | 358 | $db = BoincDb::get(); |
| 359 | 359 | return $db->enum('result', 'BoincResult', $where_clause); |
| 360 | 360 | } |
| 361 | - static function enum_fields($fields, $where_clause, $order_clause) { |
|
| 361 | + static function enum_fields($fields, $where_clause, $order_clause) { |
|
| 362 | 362 | $db = BoincDb::get(); |
| 363 | - return $db->enum_fields('result', 'BoincResult', $fields, $where_clause, $order_clause); |
|
| 364 | - } |
|
| 363 | + return $db->enum_fields('result', 'BoincResult', $fields, $where_clause, $order_clause); |
|
| 364 | + } |
|
| 365 | 365 | function update($clause) { |
| 366 | 366 | $db = BoincDb::get(); |
| 367 | 367 | return $db->update($this, 'result', $clause); |
@@ -191,7 +191,7 @@ |
||
| 191 | 191 | $min_credit = parse_config(get_config(), "<profile_min_credit>"); |
| 192 | 192 | if (!$logged_in_user && $min_credit && $user->expavg_credit < $min_credit ) { |
| 193 | 193 | error_page( |
| 194 | - tra("To prevent spam, profiles of users with an average credit of less than %1 are displayed only to logged-in users. We apologize for this inconvenience.", $min_credit) |
|
| 194 | + tra("To prevent spam, profiles of users with an average credit of less than %1 are displayed only to logged-in users. We apologize for this inconvenience.", $min_credit) |
|
| 195 | 195 | ); |
| 196 | 196 | } |
| 197 | 197 | if (is_banished($user)) { |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | header("Expires: Thu, 01 Jan 1970 00:00:00 GMT"); |
| 24 | 24 | |
| 25 | 25 | echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>" |
| 26 | - . "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" " |
|
| 27 | - . "\"http://www.wapforum.org/DTD/wml_1.2.xml\">" |
|
| 28 | - . "<wml><card id=\"cd1\"><p>"; |
|
| 26 | + . "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" " |
|
| 27 | + . "\"http://www.wapforum.org/DTD/wml_1.2.xml\">" |
|
| 28 | + . "<wml><card id=\"cd1\"><p>"; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | function wap_end() { |
@@ -33,6 +33,6 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | function wap_timestamp() { |
| 36 | - return gmdate('j M Y G:i:s', time()) . " UTC"; |
|
| 36 | + return gmdate('j M Y G:i:s', time()) . " UTC"; |
|
| 37 | 37 | } |
| 38 | 38 | ?> |
@@ -213,26 +213,26 @@ discard block |
||
| 213 | 213 | } |
| 214 | 214 | function geoip_load_shared_mem ($file) { |
| 215 | 215 | |
| 216 | - $fp = fopen($file, "rb"); |
|
| 217 | - if (!$fp) { |
|
| 216 | + $fp = fopen($file, "rb"); |
|
| 217 | + if (!$fp) { |
|
| 218 | 218 | print "error opening $file: $php_errormsg\n"; |
| 219 | 219 | exit; |
| 220 | - } |
|
| 221 | - $s_array = fstat($fp); |
|
| 222 | - $size = $s_array['size']; |
|
| 223 | - if ($shmid = @shmop_open (GEOIP_SHM_KEY, "w", 0, 0)) { |
|
| 220 | + } |
|
| 221 | + $s_array = fstat($fp); |
|
| 222 | + $size = $s_array['size']; |
|
| 223 | + if ($shmid = @shmop_open (GEOIP_SHM_KEY, "w", 0, 0)) { |
|
| 224 | 224 | shmop_delete ($shmid); |
| 225 | 225 | shmop_close ($shmid); |
| 226 | - } |
|
| 227 | - $shmid = shmop_open (GEOIP_SHM_KEY, "c", 0644, $size); |
|
| 228 | - shmop_write ($shmid, fread($fp, $size), 0); |
|
| 229 | - shmop_close ($shmid); |
|
| 226 | + } |
|
| 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 | 232 | function _setup_segments($gi){ |
| 233 | - $gi->databaseType = GEOIP_COUNTRY_EDITION; |
|
| 234 | - $gi->record_length = STANDARD_RECORD_LENGTH; |
|
| 235 | - if ($gi->flags & GEOIP_SHARED_MEMORY) { |
|
| 233 | + $gi->databaseType = GEOIP_COUNTRY_EDITION; |
|
| 234 | + $gi->record_length = STANDARD_RECORD_LENGTH; |
|
| 235 | + if ($gi->flags & GEOIP_SHARED_MEMORY) { |
|
| 236 | 236 | $offset = @shmop_size ($gi->shmid) - 3; |
| 237 | 237 | for ($i = 0; $i < STRUCTURE_INFO_MAX_SIZE; $i++) { |
| 238 | 238 | $delim = @shmop_read ($gi->shmid, $offset, 3); |
@@ -245,19 +245,19 @@ discard block |
||
| 245 | 245 | $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0; |
| 246 | 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 | - || ($gi->databaseType == GEOIP_ISP_EDITION) |
|
| 252 | - || ($gi->databaseType == GEOIP_ASNUM_EDITION)){ |
|
| 251 | + || ($gi->databaseType == GEOIP_ISP_EDITION) |
|
| 252 | + || ($gi->databaseType == GEOIP_ASNUM_EDITION)){ |
|
| 253 | 253 | $gi->databaseSegments = 0; |
| 254 | 254 | $buf = @shmop_read ($gi->shmid, $offset, SEGMENT_RECORD_LENGTH); |
| 255 | 255 | for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){ |
| 256 | 256 | $gi->databaseSegments += (ord($buf[$j]) << ($j * 8)); |
| 257 | 257 | } |
| 258 | - if (($gi->databaseType == GEOIP_ORG_EDITION)|| |
|
| 259 | - ($gi->databaseType == GEOIP_ISP_EDITION)) { |
|
| 260 | - $gi->record_length = ORG_RECORD_LENGTH; |
|
| 258 | + if (($gi->databaseType == GEOIP_ORG_EDITION)|| |
|
| 259 | + ($gi->databaseType == GEOIP_ISP_EDITION)) { |
|
| 260 | + $gi->record_length = ORG_RECORD_LENGTH; |
|
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | break; |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | ($gi->databaseType == GEOIP_NETSPEED_EDITION)){ |
| 271 | 271 | $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; |
| 272 | 272 | } |
| 273 | - } else { |
|
| 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++) { |
@@ -281,19 +281,19 @@ discard block |
||
| 281 | 281 | $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0; |
| 282 | 282 | } |
| 283 | 283 | else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){ |
| 284 | - $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1; |
|
| 284 | + $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1; |
|
| 285 | 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 | - ($gi->databaseType == GEOIP_ISP_EDITION) || |
|
| 288 | + ($gi->databaseType == GEOIP_ISP_EDITION) || |
|
| 289 | 289 | ($gi->databaseType == GEOIP_ASNUM_EDITION)){ |
| 290 | 290 | $gi->databaseSegments = 0; |
| 291 | 291 | $buf = fread($gi->filehandle,SEGMENT_RECORD_LENGTH); |
| 292 | 292 | for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){ |
| 293 | 293 | $gi->databaseSegments += (ord($buf[$j]) << ($j * 8)); |
| 294 | 294 | } |
| 295 | - if ($gi->databaseType == GEOIP_ORG_EDITION) { |
|
| 296 | - $gi->record_length = ORG_RECORD_LENGTH; |
|
| 295 | + if ($gi->databaseType == GEOIP_ORG_EDITION) { |
|
| 296 | + $gi->record_length = ORG_RECORD_LENGTH; |
|
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | break; |
@@ -304,17 +304,17 @@ discard block |
||
| 304 | 304 | if (($gi->databaseType == GEOIP_COUNTRY_EDITION)|| |
| 305 | 305 | ($gi->databaseType == GEOIP_PROXY_EDITION)|| |
| 306 | 306 | ($gi->databaseType == GEOIP_NETSPEED_EDITION)){ |
| 307 | - $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; |
|
| 307 | + $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; |
|
| 308 | 308 | } |
| 309 | 309 | fseek($gi->filehandle,$filepos,SEEK_SET); |
| 310 | - } |
|
| 311 | - return $gi; |
|
| 310 | + } |
|
| 311 | + return $gi; |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | function geoip_open($filename, $flags) { |
| 315 | - $gi = new GeoIP; |
|
| 316 | - $gi->flags = $flags; |
|
| 317 | - if ($gi->flags & GEOIP_SHARED_MEMORY) { |
|
| 315 | + $gi = new GeoIP; |
|
| 316 | + $gi->flags = $flags; |
|
| 317 | + if ($gi->flags & GEOIP_SHARED_MEMORY) { |
|
| 318 | 318 | $gi->shmid = @shmop_open (GEOIP_SHM_KEY, "a", 0, 0); |
| 319 | 319 | } else { |
| 320 | 320 | $gi->filehandle = fopen($filename,"rb"); |
@@ -322,174 +322,174 @@ discard block |
||
| 322 | 322 | $s_array = fstat($gi->filehandle); |
| 323 | 323 | $gi->memory_buffer = fread($gi->filehandle, $s_array[size]); |
| 324 | 324 | } |
| 325 | - } |
|
| 325 | + } |
|
| 326 | 326 | |
| 327 | - $gi = _setup_segments($gi); |
|
| 328 | - return $gi; |
|
| 327 | + $gi = _setup_segments($gi); |
|
| 328 | + return $gi; |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | function geoip_close($gi) { |
| 332 | - if ($gi->flags & GEOIP_SHARED_MEMORY) { |
|
| 332 | + if ($gi->flags & GEOIP_SHARED_MEMORY) { |
|
| 333 | 333 | return true; |
| 334 | - } |
|
| 334 | + } |
|
| 335 | 335 | |
| 336 | - return fclose($gi->filehandle); |
|
| 336 | + return fclose($gi->filehandle); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | function geoip_country_id_by_name($gi, $name) { |
| 340 | - $addr = gethostbyname($name); |
|
| 341 | - if (!$addr || $addr == $name) { |
|
| 340 | + $addr = gethostbyname($name); |
|
| 341 | + if (!$addr || $addr == $name) { |
|
| 342 | 342 | return false; |
| 343 | - } |
|
| 344 | - return geoip_country_id_by_addr($gi, $addr); |
|
| 343 | + } |
|
| 344 | + return geoip_country_id_by_addr($gi, $addr); |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | function geoip_country_code_by_name($gi, $name) { |
| 348 | - $country_id = geoip_country_id_by_name($gi,$name); |
|
| 349 | - if ($country_id !== false) { |
|
| 348 | + $country_id = geoip_country_id_by_name($gi,$name); |
|
| 349 | + if ($country_id !== false) { |
|
| 350 | 350 | return $gi->GEOIP_COUNTRY_CODES[$country_id]; |
| 351 | - } |
|
| 352 | - return false; |
|
| 351 | + } |
|
| 352 | + return false; |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | function geoip_country_name_by_name($gi, $name) { |
| 356 | - $country_id = geoip_country_id_by_name($gi,$name); |
|
| 357 | - if ($country_id !== false) { |
|
| 356 | + $country_id = geoip_country_id_by_name($gi,$name); |
|
| 357 | + if ($country_id !== false) { |
|
| 358 | 358 | return $gi->GEOIP_COUNTRY_NAMES[$country_id]; |
| 359 | - } |
|
| 360 | - return false; |
|
| 359 | + } |
|
| 360 | + return false; |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | function geoip_country_id_by_addr($gi, $addr) { |
| 364 | - $ipnum = ip2long($addr); |
|
| 365 | - return _geoip_seek_country($gi, $ipnum) - GEOIP_COUNTRY_BEGIN; |
|
| 364 | + $ipnum = ip2long($addr); |
|
| 365 | + return _geoip_seek_country($gi, $ipnum) - GEOIP_COUNTRY_BEGIN; |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | function geoip_country_code_by_addr($gi, $addr) { |
| 369 | - $country_id = geoip_country_id_by_addr($gi,$addr); |
|
| 370 | - if ($country_id !== false) { |
|
| 369 | + $country_id = geoip_country_id_by_addr($gi,$addr); |
|
| 370 | + if ($country_id !== false) { |
|
| 371 | 371 | return $gi->GEOIP_COUNTRY_CODES[$country_id]; |
| 372 | - } |
|
| 373 | - return false; |
|
| 372 | + } |
|
| 373 | + return false; |
|
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | function geoip_country_name_by_addr($gi, $addr) { |
| 377 | - $country_id = geoip_country_id_by_addr($gi,$addr); |
|
| 378 | - if ($country_id !== false) { |
|
| 377 | + $country_id = geoip_country_id_by_addr($gi,$addr); |
|
| 378 | + if ($country_id !== false) { |
|
| 379 | 379 | return $gi->GEOIP_COUNTRY_NAMES[$country_id]; |
| 380 | - } |
|
| 381 | - return false; |
|
| 380 | + } |
|
| 381 | + return false; |
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | function _geoip_seek_country($gi, $ipnum) { |
| 385 | - $offset = 0; |
|
| 386 | - for ($depth = 31; $depth >= 0; --$depth) { |
|
| 385 | + $offset = 0; |
|
| 386 | + for ($depth = 31; $depth >= 0; --$depth) { |
|
| 387 | 387 | if ($gi->flags & GEOIP_MEMORY_CACHE) { |
| 388 | - $buf = substr($gi->memory_buffer, |
|
| 388 | + $buf = substr($gi->memory_buffer, |
|
| 389 | 389 | 2 * $gi->record_length * $offset, |
| 390 | 390 | 2 * $gi->record_length); |
| 391 | 391 | } elseif ($gi->flags & GEOIP_SHARED_MEMORY) { |
| 392 | - $buf = @shmop_read ($gi->shmid, |
|
| 392 | + $buf = @shmop_read ($gi->shmid, |
|
| 393 | 393 | 2 * $gi->record_length * $offset, |
| 394 | 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 | 400 | $x = array(0,0); |
| 401 | 401 | for ($i = 0; $i < 2; ++$i) { |
| 402 | - for ($j = 0; $j < $gi->record_length; ++$j) { |
|
| 402 | + for ($j = 0; $j < $gi->record_length; ++$j) { |
|
| 403 | 403 | $x[$i] += ord($buf[$gi->record_length * $i + $j]) << ($j * 8); |
| 404 | - } |
|
| 404 | + } |
|
| 405 | 405 | } |
| 406 | 406 | if ($ipnum & (1 << $depth)) { |
| 407 | - if ($x[1] >= $gi->databaseSegments) { |
|
| 407 | + if ($x[1] >= $gi->databaseSegments) { |
|
| 408 | 408 | return $x[1]; |
| 409 | - } |
|
| 410 | - $offset = $x[1]; |
|
| 409 | + } |
|
| 410 | + $offset = $x[1]; |
|
| 411 | 411 | } else { |
| 412 | - if ($x[0] >= $gi->databaseSegments) { |
|
| 412 | + if ($x[0] >= $gi->databaseSegments) { |
|
| 413 | 413 | return $x[0]; |
| 414 | - } |
|
| 415 | - $offset = $x[0]; |
|
| 414 | + } |
|
| 415 | + $offset = $x[0]; |
|
| 416 | + } |
|
| 416 | 417 | } |
| 417 | - } |
|
| 418 | - trigger_error("error traversing database - perhaps it is corrupt?", E_USER_ERROR); |
|
| 419 | - return false; |
|
| 418 | + trigger_error("error traversing database - perhaps it is corrupt?", E_USER_ERROR); |
|
| 419 | + return false; |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | function _get_org($gi,$ipnum){ |
| 423 | - $seek_org = _geoip_seek_country($gi,$ipnum); |
|
| 424 | - if ($seek_org == $gi->databaseSegments) { |
|
| 423 | + $seek_org = _geoip_seek_country($gi,$ipnum); |
|
| 424 | + if ($seek_org == $gi->databaseSegments) { |
|
| 425 | 425 | return NULL; |
| 426 | - } |
|
| 427 | - $record_pointer = $seek_org + (2 * $gi->record_length - 1) * $gi->databaseSegments; |
|
| 428 | - if ($gi->flags & GEOIP_SHARED_MEMORY) { |
|
| 426 | + } |
|
| 427 | + $record_pointer = $seek_org + (2 * $gi->record_length - 1) * $gi->databaseSegments; |
|
| 428 | + if ($gi->flags & GEOIP_SHARED_MEMORY) { |
|
| 429 | 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 | 432 | $org_buf = fread($gi->filehandle,MAX_ORG_RECORD_LENGTH); |
| 433 | - } |
|
| 434 | - $org_buf = substr($org_buf, 0, strpos($org_buf, 0)); |
|
| 435 | - return $org_buf; |
|
| 433 | + } |
|
| 434 | + $org_buf = substr($org_buf, 0, strpos($org_buf, 0)); |
|
| 435 | + return $org_buf; |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | function geoip_org_by_addr ($gi,$addr) { |
| 439 | - if ($addr == NULL) { |
|
| 439 | + if ($addr == NULL) { |
|
| 440 | 440 | return 0; |
| 441 | - } |
|
| 442 | - $ipnum = ip2long($addr); |
|
| 443 | - return _get_org($gi, $ipnum); |
|
| 441 | + } |
|
| 442 | + $ipnum = ip2long($addr); |
|
| 443 | + return _get_org($gi, $ipnum); |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | function _get_region($gi,$ipnum){ |
| 447 | - if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ |
|
| 447 | + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ |
|
| 448 | 448 | $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV0; |
| 449 | 449 | if ($seek_region >= 1000){ |
| 450 | - $country_code = "US"; |
|
| 451 | - $region = chr(($seek_region - 1000)/26 + 65) . chr(($seek_region - 1000)%26 + 65); |
|
| 450 | + $country_code = "US"; |
|
| 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 | - $region = ""; |
|
| 454 | + $region = ""; |
|
| 455 | 455 | } |
| 456 | - return array ($country_code,$region); |
|
| 456 | + return array ($country_code,$region); |
|
| 457 | 457 | } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { |
| 458 | 458 | $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV1; |
| 459 | 459 | //print $seek_region; |
| 460 | 460 | if ($seek_region < US_OFFSET){ |
| 461 | - $country_code = ""; |
|
| 462 | - $region = ""; |
|
| 461 | + $country_code = ""; |
|
| 462 | + $region = ""; |
|
| 463 | 463 | } else if ($seek_region < CANADA_OFFSET) { |
| 464 | - $country_code = "US"; |
|
| 465 | - $region = chr(($seek_region - US_OFFSET)/26 + 65) . chr(($seek_region - US_OFFSET)%26 + 65); |
|
| 464 | + $country_code = "US"; |
|
| 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 | - $country_code = "CA"; |
|
| 468 | - $region = chr(($seek_region - CANADA_OFFSET)/26 + 65) . chr(($seek_region - CANADA_OFFSET)%26 + 65); |
|
| 467 | + $country_code = "CA"; |
|
| 468 | + $region = chr(($seek_region - CANADA_OFFSET)/26 + 65) . chr(($seek_region - CANADA_OFFSET)%26 + 65); |
|
| 469 | 469 | } else { |
| 470 | 470 | $country_code = $gi->GEOIP_COUNTRY_CODES[($seek_region - WORLD_OFFSET) / FIPS_RANGE]; |
| 471 | - $region = ""; |
|
| 471 | + $region = ""; |
|
| 472 | + } |
|
| 473 | + return array ($country_code,$region); |
|
| 472 | 474 | } |
| 473 | - return array ($country_code,$region); |
|
| 474 | - } |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | function geoip_region_by_addr ($gi,$addr) { |
| 478 | - if ($addr == NULL) { |
|
| 478 | + if ($addr == NULL) { |
|
| 479 | 479 | return 0; |
| 480 | - } |
|
| 481 | - $ipnum = ip2long($addr); |
|
| 482 | - return _get_region($gi, $ipnum); |
|
| 480 | + } |
|
| 481 | + $ipnum = ip2long($addr); |
|
| 482 | + return _get_region($gi, $ipnum); |
|
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | function getdnsattributes ($l,$ip){ |
| 486 | - $r = new Net_DNS_Resolver(); |
|
| 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); |
|
| 491 | - $str = $regs[1]; |
|
| 492 | - return $str; |
|
| 486 | + $r = new Net_DNS_Resolver(); |
|
| 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); |
|
| 491 | + $str = $regs[1]; |
|
| 492 | + return $str; |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | ?> |
@@ -7,15 +7,15 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | class views_handler_argument_boincteam_id extends views_handler_argument_numeric { |
| 10 | - function construct() { |
|
| 10 | + function construct() { |
|
| 11 | 11 | parent::construct(); |
| 12 | - } |
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - function set_argument($arg) { |
|
| 14 | + function set_argument($arg) { |
|
| 15 | 15 | // When setting the ID argument, convert to BOINC ID |
| 16 | 16 | $id = is_numeric($arg) ? $arg : 0; |
| 17 | 17 | $boinc_id = db_result(db_query("SELECT team_id FROM {boincteam} WHERE nid = %d", $id)); |
| 18 | 18 | $this->argument = $boinc_id; |
| 19 | 19 | return $this->validate_arg($boinc_id); |
| 20 | - } |
|
| 20 | + } |
|
| 21 | 21 | } |
@@ -7,15 +7,15 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | class views_handler_argument_boincuser_id extends views_handler_argument_numeric { |
| 10 | - function construct() { |
|
| 10 | + function construct() { |
|
| 11 | 11 | parent::construct(); |
| 12 | - } |
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - function set_argument($arg) { |
|
| 14 | + function set_argument($arg) { |
|
| 15 | 15 | // When setting the ID argument, convert to BOINC ID |
| 16 | 16 | $id = is_numeric($arg) ? $arg : 0; |
| 17 | 17 | $boinc_id = db_result(db_query("SELECT boinc_id FROM {boincuser} WHERE uid = %d", $id)); |
| 18 | 18 | $this->argument = $boinc_id; |
| 19 | 19 | return $this->validate_arg($boinc_id); |
| 20 | - } |
|
| 20 | + } |
|
| 21 | 21 | } |