-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from VladCleantalk/master
Version 1.70
- Loading branch information
Showing
2 changed files
with
43 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
/** | ||
* Cleantalk base class | ||
* | ||
* @version 2.1.1 | ||
* @version 2.1.2 | ||
* @package Cleantalk | ||
* @subpackage Base | ||
* @author Cleantalk team ([email protected]) | ||
|
@@ -16,7 +16,7 @@ | |
* Load JSON functions if they are not exists | ||
*/ | ||
if(!function_exists('json_encode')) { | ||
require_once dirname(__FILE__) . '/JSON.php'; | ||
require_once 'JSON.php'; | ||
|
||
function json_encode($data) { | ||
$json = new Services_JSON(); | ||
|
@@ -25,7 +25,7 @@ function json_encode($data) { | |
|
||
} | ||
if(!function_exists('json_decode')) { | ||
require_once dirname(__FILE__) . '/JSON.php'; | ||
require_once 'JSON.php'; | ||
|
||
function json_decode($data) { | ||
$json = new Services_JSON(); | ||
|
@@ -1050,16 +1050,19 @@ public function get_2s_blacklists_db ($api_key) { | |
* @return type | ||
*/ | ||
|
||
function getAutoKey($email, $host, $platform) | ||
if(!function_exists('getAutoKey')) | ||
{ | ||
$request=Array(); | ||
$request['method_name'] = 'get_api_key'; | ||
$request['email'] = $email; | ||
$request['website'] = $host; | ||
$request['platform'] = $platform; | ||
$url='https://api.cleantalk.org'; | ||
$result=sendRawRequest($url,$request); | ||
return $result; | ||
function getAutoKey($email, $host, $platform) | ||
{ | ||
$request=Array(); | ||
$request['method_name'] = 'get_api_key'; | ||
$request['email'] = $email; | ||
$request['website'] = $host; | ||
$request['platform'] = $platform; | ||
$url='https://api.cleantalk.org'; | ||
$result=sendRawRequest($url,$request); | ||
return $result; | ||
} | ||
} | ||
|
||
/** | ||
|
@@ -1144,6 +1147,11 @@ function apache_request_headers() | |
{ | ||
$arh = array(); | ||
$rx_http = '/\AHTTP_/'; | ||
if(defined('IN_PHPBB')) | ||
{ | ||
global $request; | ||
$request->enable_super_globals(); | ||
} | ||
foreach($_SERVER as $key => $val) | ||
{ | ||
if( preg_match($rx_http, $key) ) | ||
|
@@ -1159,18 +1167,29 @@ function apache_request_headers() | |
$arh[$arh_key] = $val; | ||
} | ||
} | ||
if(defined('IN_PHPBB')) | ||
{ | ||
global $request; | ||
$request->disable_super_globals(); | ||
} | ||
return( $arh ); | ||
} | ||
} | ||
|
||
function cleantalk_get_real_ip() | ||
{ | ||
if(defined('IN_PHPBB')) | ||
{ | ||
global $request; | ||
$request->enable_super_globals(); | ||
} | ||
if ( function_exists( 'apache_request_headers' ) ) | ||
{ | ||
$headers = apache_request_headers(); | ||
} | ||
else | ||
{ | ||
|
||
$headers = $_SERVER; | ||
} | ||
if ( array_key_exists( 'X-Forwarded-For', $headers ) ) | ||
|
@@ -1187,10 +1206,15 @@ function cleantalk_get_real_ip() | |
{ | ||
$the_ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ); | ||
} | ||
if(defined('IN_PHPBB')) | ||
{ | ||
global $request; | ||
$request->disable_super_globals(); | ||
} | ||
return $the_ip; | ||
} | ||
|
||
function cleantalk_is_JSON($string) | ||
{ | ||
return ((is_string($string) && (is_object(json_decode($string)) || is_array(json_decode($string))))) ? true : false; | ||
} | ||
} |