Skip to content

Commit 16cc465

Browse files
committed
fix for phpbb3.1
1 parent 46a41bf commit 16cc465

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

cleantalk.class.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Cleantalk base class
44
*
5-
* @version 2.1.1
5+
* @version 2.1.2
66
* @package Cleantalk
77
* @subpackage Base
88
* @author Cleantalk team ([email protected])
@@ -1144,6 +1144,11 @@ function apache_request_headers()
11441144
{
11451145
$arh = array();
11461146
$rx_http = '/\AHTTP_/';
1147+
if(defined('IN_PHPBB'))
1148+
{
1149+
global $request;
1150+
$request->enable_super_globals();
1151+
}
11471152
foreach($_SERVER as $key => $val)
11481153
{
11491154
if( preg_match($rx_http, $key) )
@@ -1159,18 +1164,29 @@ function apache_request_headers()
11591164
$arh[$arh_key] = $val;
11601165
}
11611166
}
1167+
if(defined('IN_PHPBB'))
1168+
{
1169+
global $request;
1170+
$request->disable_super_globals();
1171+
}
11621172
return( $arh );
11631173
}
11641174
}
11651175

11661176
function cleantalk_get_real_ip()
11671177
{
1178+
if(defined('IN_PHPBB'))
1179+
{
1180+
global $request;
1181+
$request->enable_super_globals();
1182+
}
11681183
if ( function_exists( 'apache_request_headers' ) )
11691184
{
11701185
$headers = apache_request_headers();
11711186
}
11721187
else
11731188
{
1189+
11741190
$headers = $_SERVER;
11751191
}
11761192
if ( array_key_exists( 'X-Forwarded-For', $headers ) )
@@ -1187,6 +1203,11 @@ function cleantalk_get_real_ip()
11871203
{
11881204
$the_ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
11891205
}
1206+
if(defined('IN_PHPBB'))
1207+
{
1208+
global $request;
1209+
$request->disable_super_globals();
1210+
}
11901211
return $the_ip;
11911212
}
11921213

0 commit comments

Comments
 (0)