Lines 129-139
Link Here
|
129 |
{ |
129 |
{ |
130 |
if (stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) { |
130 |
if (stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) { |
131 |
GEOIP_G(set_runtime_custom_directory) = 1; |
131 |
GEOIP_G(set_runtime_custom_directory) = 1; |
|
|
132 |
#if PHP_MAJOR_VERSION >= 7 |
133 |
geoip_change_custom_directory(new_value->val); |
134 |
#else |
132 |
geoip_change_custom_directory(new_value); |
135 |
geoip_change_custom_directory(new_value); |
|
|
136 |
#endif |
133 |
return SUCCESS; |
137 |
return SUCCESS; |
134 |
} |
138 |
} |
135 |
|
139 |
|
|
|
140 |
#if PHP_MAJOR_VERSION >= 7 |
141 |
return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); |
142 |
#else |
136 |
return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); |
143 |
return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); |
|
|
144 |
#endif |
137 |
} |
145 |
} |
138 |
/* }}} */ |
146 |
/* }}} */ |
139 |
#endif |
147 |
#endif |
Lines 250-256
Link Here
|
250 |
/* {{{ proto boolean geoip_db_avail( [ int database ] ) */ |
258 |
/* {{{ proto boolean geoip_db_avail( [ int database ] ) */ |
251 |
PHP_FUNCTION(geoip_db_avail) |
259 |
PHP_FUNCTION(geoip_db_avail) |
252 |
{ |
260 |
{ |
253 |
long edition; |
261 |
zend_long edition; |
254 |
|
262 |
|
255 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &edition) == FAILURE) { |
263 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &edition) == FAILURE) { |
256 |
return; |
264 |
return; |
Lines 269-275
Link Here
|
269 |
/* {{{ proto string geoip_db_filename( [ int database ] ) */ |
277 |
/* {{{ proto string geoip_db_filename( [ int database ] ) */ |
270 |
PHP_FUNCTION(geoip_db_filename) |
278 |
PHP_FUNCTION(geoip_db_filename) |
271 |
{ |
279 |
{ |
272 |
long edition; |
280 |
zend_long edition; |
273 |
|
281 |
|
274 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &edition) == FAILURE) { |
282 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &edition) == FAILURE) { |
275 |
return; |
283 |
return; |
Lines 282-288
Link Here
|
282 |
} |
290 |
} |
283 |
|
291 |
|
284 |
if (NULL != GeoIPDBFileName[edition]) |
292 |
if (NULL != GeoIPDBFileName[edition]) |
285 |
RETURN_STRING(GeoIPDBFileName[edition], 1); |
293 |
#if PHP_MAJOR_VERSION >= 7 |
|
|
294 |
RETURN_STRING(GeoIPDBFileName[edition]); |
295 |
#else |
296 |
RETURN_STRING(GeoIPDBFileName[edition], 1); |
297 |
#endif |
286 |
} |
298 |
} |
287 |
/* }}} */ |
299 |
/* }}} */ |
288 |
|
300 |
|
Lines 297-312
Link Here
|
297 |
{ |
309 |
{ |
298 |
if (NULL != GeoIPDBDescription[i]) |
310 |
if (NULL != GeoIPDBDescription[i]) |
299 |
{ |
311 |
{ |
|
|
312 |
#if PHP_MAJOR_VERSION >= 7 |
313 |
zval real_row; |
314 |
zval *row = &real_row; |
315 |
|
316 |
array_init(row); |
317 |
#else |
300 |
zval *row; |
318 |
zval *row; |
301 |
ALLOC_INIT_ZVAL(row); |
319 |
ALLOC_INIT_ZVAL(row); |
302 |
array_init(row); |
320 |
array_init(row); |
|
|
321 |
#endif |
303 |
|
322 |
|
304 |
add_assoc_bool(row, "available", GeoIP_db_avail(i)); |
323 |
add_assoc_bool(row, "available", GeoIP_db_avail(i)); |
305 |
if (GeoIPDBDescription[i]) { |
324 |
if (GeoIPDBDescription[i]) { |
|
|
325 |
#if PHP_MAJOR_VERSION >= 7 |
326 |
add_assoc_string(row, "description", (char *)GeoIPDBDescription[i]); |
327 |
#else |
306 |
add_assoc_string(row, "description", (char *)GeoIPDBDescription[i], 1); |
328 |
add_assoc_string(row, "description", (char *)GeoIPDBDescription[i], 1); |
|
|
329 |
#endif |
307 |
} |
330 |
} |
308 |
if (GeoIPDBFileName[i]) { |
331 |
if (GeoIPDBFileName[i]) { |
|
|
332 |
#if PHP_MAJOR_VERSION >= 7 |
333 |
add_assoc_string(row, "filename", GeoIPDBFileName[i]); |
334 |
#else |
309 |
add_assoc_string(row, "filename", GeoIPDBFileName[i], 1); |
335 |
add_assoc_string(row, "filename", GeoIPDBFileName[i], 1); |
|
|
336 |
#endif |
310 |
} |
337 |
} |
311 |
|
338 |
|
312 |
add_index_zval(return_value, i, row); |
339 |
add_index_zval(return_value, i, row); |
Lines 321-327
Link Here
|
321 |
{ |
348 |
{ |
322 |
GeoIP * gi; |
349 |
GeoIP * gi; |
323 |
char * db_info; |
350 |
char * db_info; |
324 |
long edition = GEOIP_COUNTRY_EDITION; |
351 |
zend_long edition = GEOIP_COUNTRY_EDITION; |
325 |
|
352 |
|
326 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &edition) == FAILURE) { |
353 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &edition) == FAILURE) { |
327 |
return; |
354 |
return; |
Lines 346-357
Link Here
|
346 |
db_info = GeoIP_database_info(gi); |
373 |
db_info = GeoIP_database_info(gi); |
347 |
GeoIP_delete(gi); |
374 |
GeoIP_delete(gi); |
348 |
|
375 |
|
|
|
376 |
#if PHP_MAJOR_VERSION >= 7 |
377 |
RETVAL_STRING(db_info); |
378 |
#else |
349 |
RETVAL_STRING(db_info, 1); |
379 |
RETVAL_STRING(db_info, 1); |
|
|
380 |
#endif |
350 |
free(db_info); |
381 |
free(db_info); |
351 |
} |
382 |
} |
352 |
/* }}} */ |
383 |
/* }}} */ |
353 |
|
384 |
|
354 |
/* {{{ */ |
385 |
/* {{{ */ |
|
|
386 |
#if PHP_MAJOR_VERSION >= 7 |
387 |
#define GEOIPDEF(php_func, c_func, db_type) \ |
388 |
PHP_FUNCTION(php_func) \ |
389 |
{ \ |
390 |
GeoIP * gi; \ |
391 |
char * hostname = NULL; \ |
392 |
const char * return_code; \ |
393 |
size_t arglen; \ |
394 |
\ |
395 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { \ |
396 |
return; \ |
397 |
} \ |
398 |
\ |
399 |
if (GeoIP_db_avail(db_type)) { \ |
400 |
gi = GeoIP_open_type(db_type, GEOIP_STANDARD); \ |
401 |
} else { \ |
402 |
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Required database not available at %s.", GeoIPDBFileName[db_type]); \ |
403 |
return; \ |
404 |
} \ |
405 |
\ |
406 |
return_code = c_func(gi, hostname); \ |
407 |
GeoIP_delete(gi); \ |
408 |
if (return_code == NULL) { \ |
409 |
RETURN_FALSE; \ |
410 |
} \ |
411 |
RETURN_STRING((char*)return_code); \ |
412 |
\ |
413 |
} |
414 |
#else |
355 |
#define GEOIPDEF(php_func, c_func, db_type) \ |
415 |
#define GEOIPDEF(php_func, c_func, db_type) \ |
356 |
PHP_FUNCTION(php_func) \ |
416 |
PHP_FUNCTION(php_func) \ |
357 |
{ \ |
417 |
{ \ |
Lines 379-384
Link Here
|
379 |
RETURN_STRING((char*)return_code, 1); \ |
439 |
RETURN_STRING((char*)return_code, 1); \ |
380 |
\ |
440 |
\ |
381 |
} |
441 |
} |
|
|
442 |
#endif |
382 |
#include "geoip.def" |
443 |
#include "geoip.def" |
383 |
#undef GEOIPDEF |
444 |
#undef GEOIPDEF |
384 |
/* }}} */ |
445 |
/* }}} */ |
Lines 390-396
Link Here
|
390 |
GeoIP * gi; |
451 |
GeoIP * gi; |
391 |
char * hostname = NULL; |
452 |
char * hostname = NULL; |
392 |
int id; |
453 |
int id; |
|
|
454 |
#if PHP_MAJOR_VERSION >= 7 |
455 |
size_t arglen; |
456 |
#else |
393 |
int arglen; |
457 |
int arglen; |
|
|
458 |
#endif |
394 |
|
459 |
|
395 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { |
460 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { |
396 |
return; |
461 |
return; |
Lines 408-414
Link Here
|
408 |
if (id == 0) { |
473 |
if (id == 0) { |
409 |
RETURN_FALSE; |
474 |
RETURN_FALSE; |
410 |
} |
475 |
} |
|
|
476 |
#if PHP_MAJOR_VERSION >= 7 |
477 |
RETURN_STRING((char *)GeoIP_country_continent[id]); |
478 |
#else |
411 |
RETURN_STRING((char *)GeoIP_country_continent[id], 1); |
479 |
RETURN_STRING((char *)GeoIP_country_continent[id], 1); |
|
|
480 |
#endif |
412 |
} |
481 |
} |
413 |
/* }}} */ |
482 |
/* }}} */ |
414 |
|
483 |
|
Lines 419-425
Link Here
|
419 |
GeoIP * gi; |
488 |
GeoIP * gi; |
420 |
char * hostname = NULL; |
489 |
char * hostname = NULL; |
421 |
char * org; |
490 |
char * org; |
|
|
491 |
#if PHP_MAJOR_VERSION >= 7 |
492 |
size_t arglen; |
493 |
#else |
422 |
int arglen; |
494 |
int arglen; |
|
|
495 |
#endif |
423 |
|
496 |
|
424 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { |
497 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { |
425 |
return; |
498 |
return; |
Lines 437-443
Link Here
|
437 |
if (org == NULL) { |
510 |
if (org == NULL) { |
438 |
RETURN_FALSE; |
511 |
RETURN_FALSE; |
439 |
} |
512 |
} |
|
|
513 |
#if PHP_MAJOR_VERSION >= 7 |
514 |
RETVAL_STRING(org); |
515 |
#else |
440 |
RETVAL_STRING(org, 1); |
516 |
RETVAL_STRING(org, 1); |
|
|
517 |
#endif |
441 |
free(org); |
518 |
free(org); |
442 |
} |
519 |
} |
443 |
/* }}} */ |
520 |
/* }}} */ |
Lines 449-455
Link Here
|
449 |
GeoIP * gi; |
526 |
GeoIP * gi; |
450 |
char * hostname = NULL; |
527 |
char * hostname = NULL; |
451 |
char * org; |
528 |
char * org; |
|
|
529 |
#if PHP_MAJOR_VERSION >= 7 |
530 |
size_t arglen; |
531 |
#else |
452 |
int arglen; |
532 |
int arglen; |
|
|
533 |
#endif |
453 |
|
534 |
|
454 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { |
535 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { |
455 |
return; |
536 |
return; |
Lines 467-473
Link Here
|
467 |
if (org == NULL) { |
548 |
if (org == NULL) { |
468 |
RETURN_FALSE; |
549 |
RETURN_FALSE; |
469 |
} |
550 |
} |
|
|
551 |
#if PHP_MAJOR_VERSION >= 7 |
552 |
RETVAL_STRING(org); |
553 |
#else |
470 |
RETVAL_STRING(org, 1); |
554 |
RETVAL_STRING(org, 1); |
|
|
555 |
#endif |
471 |
free(org); |
556 |
free(org); |
472 |
} |
557 |
} |
473 |
/* }}} */ |
558 |
/* }}} */ |
Lines 479-485
Link Here
|
479 |
GeoIP * gi; |
564 |
GeoIP * gi; |
480 |
char * hostname = NULL; |
565 |
char * hostname = NULL; |
481 |
char * org; |
566 |
char * org; |
|
|
567 |
#if PHP_MAJOR_VERSION >= 7 |
568 |
size_t arglen; |
569 |
#else |
482 |
int arglen; |
570 |
int arglen; |
|
|
571 |
#endif |
483 |
|
572 |
|
484 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { |
573 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { |
485 |
return; |
574 |
return; |
Lines 497-503
Link Here
|
497 |
if (org == NULL) { |
586 |
if (org == NULL) { |
498 |
RETURN_FALSE; |
587 |
RETURN_FALSE; |
499 |
} |
588 |
} |
|
|
589 |
#if PHP_MAJOR_VERSION >= 7 |
590 |
RETVAL_STRING(org); |
591 |
#else |
500 |
RETVAL_STRING(org, 1); |
592 |
RETVAL_STRING(org, 1); |
|
|
593 |
#endif |
501 |
free(org); |
594 |
free(org); |
502 |
} |
595 |
} |
503 |
/* }}} */ |
596 |
/* }}} */ |
Lines 510-516
Link Here
|
510 |
GeoIP * gi; |
603 |
GeoIP * gi; |
511 |
char * hostname = NULL; |
604 |
char * hostname = NULL; |
512 |
char * org; |
605 |
char * org; |
|
|
606 |
#if PHP_MAJOR_VERSION >= 7 |
607 |
size_t arglen; |
608 |
#else |
513 |
int arglen; |
609 |
int arglen; |
|
|
610 |
#endif |
514 |
|
611 |
|
515 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { |
612 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { |
516 |
return; |
613 |
return; |
Lines 528-534
Link Here
|
528 |
if (org == NULL) { |
625 |
if (org == NULL) { |
529 |
RETURN_FALSE; |
626 |
RETURN_FALSE; |
530 |
} |
627 |
} |
|
|
628 |
#if PHP_MAJOR_VERSION >= 7 |
629 |
RETVAL_STRING(org); |
630 |
#else |
531 |
RETVAL_STRING(org, 1); |
631 |
RETVAL_STRING(org, 1); |
|
|
632 |
#endif |
532 |
free(org); |
633 |
free(org); |
533 |
} |
634 |
} |
534 |
/* }}} */ |
635 |
/* }}} */ |
Lines 540-546
Link Here
|
540 |
{ |
641 |
{ |
541 |
GeoIP * gi; |
642 |
GeoIP * gi; |
542 |
char * hostname = NULL; |
643 |
char * hostname = NULL; |
|
|
644 |
#if PHP_MAJOR_VERSION >= 7 |
645 |
size_t arglen; |
646 |
#else |
543 |
int arglen; |
647 |
int arglen; |
|
|
648 |
#endif |
544 |
GeoIPRecord * gir; |
649 |
GeoIPRecord * gir; |
545 |
|
650 |
|
546 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { |
651 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { |
Lines 566-580
Link Here
|
566 |
} |
671 |
} |
567 |
|
672 |
|
568 |
array_init(return_value); |
673 |
array_init(return_value); |
569 |
#if LIBGEOIP_VERSION >= 1004003 |
674 |
#if PHP_MAJOR_VERSION >= 7 |
|
|
675 |
# if LIBGEOIP_VERSION >= 1004003 |
676 |
add_assoc_string(return_value, "continent_code", (gir->continent_code == NULL) ? "" : gir->continent_code); |
677 |
# endif |
678 |
add_assoc_string(return_value, "country_code", (gir->country_code == NULL) ? "" : gir->country_code); |
679 |
add_assoc_string(return_value, "country_code3", (gir->country_code3 == NULL) ? "" : gir->country_code3); |
680 |
add_assoc_string(return_value, "country_name", (gir->country_name == NULL) ? "" : gir->country_name); |
681 |
add_assoc_string(return_value, "region", (gir->region == NULL) ? "" : gir->region); |
682 |
add_assoc_string(return_value, "city", (gir->city == NULL) ? "" : gir->city); |
683 |
add_assoc_string(return_value, "postal_code", (gir->postal_code == NULL) ? "" : gir->postal_code); |
684 |
#else |
685 |
# if LIBGEOIP_VERSION >= 1004003 |
570 |
add_assoc_string(return_value, "continent_code", (gir->continent_code == NULL) ? "" : gir->continent_code, 1); |
686 |
add_assoc_string(return_value, "continent_code", (gir->continent_code == NULL) ? "" : gir->continent_code, 1); |
571 |
#endif |
687 |
# endif |
572 |
add_assoc_string(return_value, "country_code", (gir->country_code == NULL) ? "" : gir->country_code, 1); |
688 |
add_assoc_string(return_value, "country_code", (gir->country_code == NULL) ? "" : gir->country_code, 1); |
573 |
add_assoc_string(return_value, "country_code3", (gir->country_code3 == NULL) ? "" : gir->country_code3, 1); |
689 |
add_assoc_string(return_value, "country_code3", (gir->country_code3 == NULL) ? "" : gir->country_code3, 1); |
574 |
add_assoc_string(return_value, "country_name", (gir->country_name == NULL) ? "" : gir->country_name, 1); |
690 |
add_assoc_string(return_value, "country_name", (gir->country_name == NULL) ? "" : gir->country_name, 1); |
575 |
add_assoc_string(return_value, "region", (gir->region == NULL) ? "" : gir->region, 1); |
691 |
add_assoc_string(return_value, "region", (gir->region == NULL) ? "" : gir->region, 1); |
576 |
add_assoc_string(return_value, "city", (gir->city == NULL) ? "" : gir->city, 1); |
692 |
add_assoc_string(return_value, "city", (gir->city == NULL) ? "" : gir->city, 1); |
577 |
add_assoc_string(return_value, "postal_code", (gir->postal_code == NULL) ? "" : gir->postal_code, 1); |
693 |
add_assoc_string(return_value, "postal_code", (gir->postal_code == NULL) ? "" : gir->postal_code, 1); |
|
|
694 |
#endif |
578 |
add_assoc_double(return_value, "latitude", gir->latitude); |
695 |
add_assoc_double(return_value, "latitude", gir->latitude); |
579 |
add_assoc_double(return_value, "longitude", gir->longitude); |
696 |
add_assoc_double(return_value, "longitude", gir->longitude); |
580 |
#if LIBGEOIP_VERSION >= 1004005 |
697 |
#if LIBGEOIP_VERSION >= 1004005 |
Lines 594-600
Link Here
|
594 |
{ |
711 |
{ |
595 |
GeoIP * gi; |
712 |
GeoIP * gi; |
596 |
char * hostname = NULL; |
713 |
char * hostname = NULL; |
|
|
714 |
#if PHP_MAJOR_VERSION >= 7 |
715 |
size_t arglen; |
716 |
#else |
597 |
int arglen; |
717 |
int arglen; |
|
|
718 |
#endif |
598 |
int netspeed; |
719 |
int netspeed; |
599 |
|
720 |
|
600 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { |
721 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { |
Lines 620-626
Link Here
|
620 |
{ |
741 |
{ |
621 |
GeoIP * gi; |
742 |
GeoIP * gi; |
622 |
char * hostname = NULL; |
743 |
char * hostname = NULL; |
|
|
744 |
#if PHP_MAJOR_VERSION >= 7 |
745 |
size_t arglen; |
746 |
#else |
623 |
int arglen; |
747 |
int arglen; |
|
|
748 |
#endif |
624 |
GeoIPRegion * region; |
749 |
GeoIPRegion * region; |
625 |
|
750 |
|
626 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { |
751 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { |
Lines 646-653
Link Here
|
646 |
} |
771 |
} |
647 |
|
772 |
|
648 |
array_init(return_value); |
773 |
array_init(return_value); |
|
|
774 |
#if PHP_MAJOR_VERSION >= 7 |
775 |
add_assoc_string(return_value, "country_code", region->country_code); |
776 |
add_assoc_string(return_value, "region", region->region); |
777 |
#else |
649 |
add_assoc_string(return_value, "country_code", region->country_code, 1); |
778 |
add_assoc_string(return_value, "country_code", region->country_code, 1); |
650 |
add_assoc_string(return_value, "region", region->region, 1); |
779 |
add_assoc_string(return_value, "region", region->region, 1); |
|
|
780 |
#endif |
651 |
|
781 |
|
652 |
GeoIPRegion_delete(region); |
782 |
GeoIPRegion_delete(region); |
653 |
} |
783 |
} |
Lines 660-666
Link Here
|
660 |
GeoIP * gi; |
790 |
GeoIP * gi; |
661 |
char * hostname = NULL; |
791 |
char * hostname = NULL; |
662 |
char * isp; |
792 |
char * isp; |
|
|
793 |
#if PHP_MAJOR_VERSION >= 7 |
794 |
size_t arglen; |
795 |
#else |
663 |
int arglen; |
796 |
int arglen; |
|
|
797 |
#endif |
664 |
|
798 |
|
665 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { |
799 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &hostname, &arglen) == FAILURE) { |
666 |
return; |
800 |
return; |
Lines 678-684
Link Here
|
678 |
if (isp == NULL) { |
812 |
if (isp == NULL) { |
679 |
RETURN_FALSE; |
813 |
RETURN_FALSE; |
680 |
} |
814 |
} |
|
|
815 |
#if PHP_MAJOR_VERSION >= 7 |
816 |
RETVAL_STRING(isp); |
817 |
#else |
681 |
RETVAL_STRING(isp, 1); |
818 |
RETVAL_STRING(isp, 1); |
|
|
819 |
#endif |
682 |
free(isp); |
820 |
free(isp); |
683 |
} |
821 |
} |
684 |
|
822 |
|
Lines 690-696
Link Here
|
690 |
char * country_code = NULL; |
828 |
char * country_code = NULL; |
691 |
char * region_code = NULL; |
829 |
char * region_code = NULL; |
692 |
const char * region_name; |
830 |
const char * region_name; |
|
|
831 |
#if PHP_MAJOR_VERSION >= 7 |
832 |
size_t countrylen, regionlen; |
833 |
#else |
693 |
int countrylen, regionlen; |
834 |
int countrylen, regionlen; |
|
|
835 |
#endif |
694 |
|
836 |
|
695 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &country_code, &countrylen, ®ion_code, ®ionlen) == FAILURE) { |
837 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &country_code, &countrylen, ®ion_code, ®ionlen) == FAILURE) { |
696 |
return; |
838 |
return; |
Lines 705-711
Link Here
|
705 |
if (region_name == NULL) { |
847 |
if (region_name == NULL) { |
706 |
RETURN_FALSE; |
848 |
RETURN_FALSE; |
707 |
} |
849 |
} |
|
|
850 |
#if PHP_MAJOR_VERSION >= 7 |
851 |
RETURN_STRING((char*)region_name); |
852 |
#else |
708 |
RETURN_STRING((char*)region_name, 1); |
853 |
RETURN_STRING((char*)region_name, 1); |
|
|
854 |
#endif |
709 |
} |
855 |
} |
710 |
/* }}} */ |
856 |
/* }}} */ |
711 |
#endif |
857 |
#endif |
Lines 718-724
Link Here
|
718 |
char * country = NULL; |
864 |
char * country = NULL; |
719 |
char * region = NULL; |
865 |
char * region = NULL; |
720 |
const char * timezone; |
866 |
const char * timezone; |
|
|
867 |
#if PHP_MAJOR_VERSION >= 7 |
868 |
size_t countrylen, arg2len; |
869 |
#else |
721 |
int countrylen, arg2len; |
870 |
int countrylen, arg2len; |
|
|
871 |
#endif |
722 |
|
872 |
|
723 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &country, &countrylen, ®ion, &arg2len) == FAILURE) { |
873 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &country, &countrylen, ®ion, &arg2len) == FAILURE) { |
724 |
return; |
874 |
return; |
Lines 733-739
Link Here
|
733 |
if (timezone == NULL) { |
883 |
if (timezone == NULL) { |
734 |
RETURN_FALSE; |
884 |
RETURN_FALSE; |
735 |
} |
885 |
} |
|
|
886 |
#if PHP_MAJOR_VERSION >= 7 |
887 |
RETURN_STRING((char*)timezone); |
888 |
#else |
736 |
RETURN_STRING((char*)timezone, 1); |
889 |
RETURN_STRING((char*)timezone, 1); |
|
|
890 |
#endif |
737 |
} |
891 |
} |
738 |
/* }}} */ |
892 |
/* }}} */ |
739 |
#endif |
893 |
#endif |
Lines 744-750
Link Here
|
744 |
PHP_FUNCTION(geoip_setup_custom_directory) |
898 |
PHP_FUNCTION(geoip_setup_custom_directory) |
745 |
{ |
899 |
{ |
746 |
char * dir = NULL; |
900 |
char * dir = NULL; |
|
|
901 |
#if PHP_MAJOR_VERSION >= 7 |
902 |
size_t dirlen; |
903 |
#else |
747 |
int dirlen; |
904 |
int dirlen; |
|
|
905 |
#endif |
748 |
|
906 |
|
749 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &dir, &dirlen) == FAILURE) { |
907 |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &dir, &dirlen) == FAILURE) { |
750 |
return; |
908 |
return; |