aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/questionnaire/questionnaire.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/questionnaire/questionnaire.php')
-rw-r--r--phpBB/includes/questionnaire/questionnaire.php68
1 files changed, 54 insertions, 14 deletions
diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php
index 659c088763..cbd7638809 100644
--- a/phpBB/includes/questionnaire/questionnaire.php
+++ b/phpBB/includes/questionnaire/questionnaire.php
@@ -162,25 +162,59 @@ class phpbb_questionnaire_system_data_provider
$server_address = $_SERVER['LOCAL_ADDR'];
}
- $ip_address_ary = explode('.', $server_address);
-
- // build ip
- if (!isset($ip_address_ary[0]) || !isset($ip_address_ary[1]))
- {
- $ip_address_ary = explode('.', '0.0.0.0');
- }
-
return array(
'os' => PHP_OS,
'httpd' => $_SERVER['SERVER_SOFTWARE'],
// we don't want the real IP address (for privacy policy reasons) but only
// a network address to see whether your installation is running on a private or public network.
+ 'private_ip' => $this->is_private_ip($server_address),
+ 'ipv6' => strpos($server_address, ':') !== false,
+ );
+ }
+
+ /**
+ * Checks whether the given IP is in a private network.
+ *
+ * @param string $ip IP in v4 dot-decimal or v6 hex format
+ * @return bool true if the IP is from a private network, else false
+ */
+ function is_private_ip($ip)
+ {
+ // IPv4
+ if (strpos($ip, ':') === false)
+ {
+ $ip_address_ary = explode('.', $ip);
+
+ // build ip
+ if (!isset($ip_address_ary[0]) || !isset($ip_address_ary[1]))
+ {
+ $ip_address_ary = explode('.', '0.0.0.0');
+ }
+
// IANA reserved addresses for private networks (RFC 1918) are:
// - 10.0.0.0/8
// - 172.16.0.0/12
// - 192.168.0.0/16
- 'ip' => $ip_address_ary[0] . '.' . $ip_address_ary[1] . '.XXX.YYY',
- );
+ if ($ip_address_ary[0] == '10' ||
+ ($ip_address_ary[0] == '172' && intval($ip_address_ary[1]) > 15 && intval($ip_address_ary[1]) < 32) ||
+ ($ip_address_ary[0] == '192' && $ip_address_ary[1] == '168') ||
+ ($ip_address_ary[0] == '192' && $ip_address_ary[1] == '168'))
+ {
+ return true;
+ }
+ }
+ // IPv6
+ else
+ {
+ // unique local unicast
+ $prefix = substr($ip, 0, 2);
+ if ($prefix == 'fc' || $prefix == 'fd')
+ {
+ return true;
+ }
+ }
+
+ return false;
}
}
@@ -233,6 +267,7 @@ class phpbb_questionnaire_phpbb_data_provider
{
global $phpbb_root_path, $phpEx;
include("{$phpbb_root_path}config.$phpEx");
+ unset($dbhost, $dbport, $dbname, $dbuser, $dbpasswd); // Just a precaution
// Only send certain config vars
$config_vars = array(
@@ -315,13 +350,15 @@ class phpbb_questionnaire_phpbb_data_provider
'enable_pm_icons' => true,
'enable_post_confirm' => true,
'feed_enable' => true,
- 'feed_limit' => true,
+ 'feed_http_auth' => true,
+ 'feed_limit_post' => true,
+ 'feed_limit_topic' => true,
+ 'feed_overall' => true,
'feed_overall_forums' => true,
- 'feed_overall_forums_limit' => true,
- 'feed_overall_topics' => true,
- 'feed_overall_topics_limit' => true,
'feed_forum' => true,
'feed_topic' => true,
+ 'feed_topics_new' => true,
+ 'feed_topics_active' => true,
'feed_item_statistics' => true,
'flood_interval' => true,
'force_server_vars' => true,
@@ -445,10 +482,13 @@ class phpbb_questionnaire_phpbb_data_provider
}
}
+ global $db;
+
$result['dbms'] = $dbms;
$result['acm_type'] = $acm_type;
$result['load_extensions'] = $load_extensions;
$result['user_agent'] = 'Unknown';
+ $result['dbms_version'] = $db->sql_server_info(true);
// Try to get user agent vendor and version
$match = array();