Skip to content

Commit

Permalink
Merge pull request #3 from VladCleantalk/master
Browse files Browse the repository at this point in the history
Version 1.70
  • Loading branch information
CleanTalk committed Jan 21, 2016
2 parents bb75318 + 55d36ef commit 4c2e054
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 1.70 January 21, 2016
------------------------------
- Updated base class
- Fixed "tell others" link output
- Added test query for settings updating

Version 1.60 October 15, 2015
------------------------------
- Updated Cleantalk API to v2.1.1
Expand Down
50 changes: 37 additions & 13 deletions cleantalk.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Cleantalk base class
*
* @version 2.1.1
* @version 2.1.2
* @package Cleantalk
* @subpackage Base
* @author Cleantalk team ([email protected])
Expand All @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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;
}
}

/**
Expand Down Expand Up @@ -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) )
Expand All @@ -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 ) )
Expand All @@ -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;
}
}

0 comments on commit 4c2e054

Please sign in to comment.