includes/questionnaire/questionnaire.php
author indvdum (gotoindvdum[at]gmail[dot]com)
Fri, 09 Mar 2012 16:11:37 +0400
changeset 12 898199d067e7
parent 0 ceef6d64c21d
permissions -rw-r--r--
Ignoring cache
indvdum@0
     1
<?php
indvdum@0
     2
/**
indvdum@0
     3
*
indvdum@0
     4
* @package phpBB3
indvdum@0
     5
* @version $Id$
indvdum@0
     6
* @copyright (c) 2005 phpBB Group
indvdum@0
     7
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
indvdum@0
     8
*
indvdum@0
     9
*/
indvdum@0
    10
indvdum@0
    11
/**
indvdum@0
    12
* @ignore
indvdum@0
    13
*/
indvdum@0
    14
if (!defined('IN_PHPBB'))
indvdum@0
    15
{
indvdum@0
    16
	exit;
indvdum@0
    17
}
indvdum@0
    18
indvdum@0
    19
/**
indvdum@0
    20
* This class collects data which is used to create some usage statistics.
indvdum@0
    21
*
indvdum@0
    22
* The collected data is - after authorization of the administrator - submitted
indvdum@0
    23
* to a central server. For privacy reasons we try to collect only data which aren't private
indvdum@0
    24
* or don't give any information which might help to identify the user.
indvdum@0
    25
*
indvdum@0
    26
* @author		Johannes Schlueter <johannes@php.net>
indvdum@0
    27
* @copyright	(c) 2007-2008 Johannes Schlueter
indvdum@0
    28
*/
indvdum@0
    29
class phpbb_questionnaire_data_collector
indvdum@0
    30
{
indvdum@0
    31
	var $providers;
indvdum@0
    32
	var $data = null;
indvdum@0
    33
	var $install_id = '';
indvdum@0
    34
indvdum@0
    35
	/**
indvdum@0
    36
	* Constructor.
indvdum@0
    37
	*
indvdum@0
    38
	* @param	string
indvdum@0
    39
	*/
indvdum@0
    40
	function phpbb_questionnaire_data_collector($install_id)
indvdum@0
    41
	{
indvdum@0
    42
		$this->install_id = $install_id;
indvdum@0
    43
		$this->providers = array();
indvdum@0
    44
	}
indvdum@0
    45
indvdum@0
    46
	function add_data_provider(&$provider)
indvdum@0
    47
	{
indvdum@0
    48
		$this->providers[] = &$provider;
indvdum@0
    49
	}
indvdum@0
    50
indvdum@0
    51
	/**
indvdum@0
    52
	* Get data as an array.
indvdum@0
    53
	*
indvdum@0
    54
	* @return	array	All Data
indvdum@0
    55
	*/
indvdum@0
    56
	function get_data_raw()
indvdum@0
    57
	{
indvdum@0
    58
		if (!$this->data)
indvdum@0
    59
		{
indvdum@0
    60
			$this->collect();
indvdum@0
    61
		}
indvdum@0
    62
indvdum@0
    63
		return $this->data;
indvdum@0
    64
	}
indvdum@0
    65
indvdum@0
    66
	function get_data_for_form()
indvdum@0
    67
	{
indvdum@0
    68
		return base64_encode(serialize($this->get_data_raw()));
indvdum@0
    69
	}
indvdum@0
    70
indvdum@0
    71
	/**
indvdum@0
    72
	* Collect info into the data property.
indvdum@0
    73
	*
indvdum@0
    74
	* @return	void
indvdum@0
    75
	*/
indvdum@0
    76
	function collect()
indvdum@0
    77
	{
indvdum@0
    78
		foreach (array_keys($this->providers) as $key)
indvdum@0
    79
		{
indvdum@0
    80
			$provider = &$this->providers[$key];
indvdum@0
    81
			$this->data[$provider->get_identifier()] = $provider->get_data();
indvdum@0
    82
		}
indvdum@0
    83
		$this->data['install_id'] = $this->install_id;
indvdum@0
    84
	}
indvdum@0
    85
}
indvdum@0
    86
indvdum@0
    87
/** interface: get_indentifier(), get_data() */
indvdum@0
    88
indvdum@0
    89
/**
indvdum@0
    90
* Questionnaire PHP data provider
indvdum@0
    91
* @package phpBB3
indvdum@0
    92
*/
indvdum@0
    93
class phpbb_questionnaire_php_data_provider
indvdum@0
    94
{
indvdum@0
    95
	function get_identifier()
indvdum@0
    96
	{
indvdum@0
    97
		return 'PHP';
indvdum@0
    98
	}
indvdum@0
    99
indvdum@0
   100
	/**
indvdum@0
   101
	* Get data about the PHP runtime setup.
indvdum@0
   102
	*
indvdum@0
   103
	* @return	array
indvdum@0
   104
	*/
indvdum@0
   105
	function get_data()
indvdum@0
   106
	{
indvdum@0
   107
		return array(
indvdum@0
   108
			'version'						=> PHP_VERSION,
indvdum@0
   109
			'sapi'							=> PHP_SAPI,
indvdum@0
   110
			'int_size'						=> defined('PHP_INT_SIZE') ? PHP_INT_SIZE : '',
indvdum@0
   111
			'safe_mode'						=> (int) @ini_get('safe_mode'),
indvdum@0
   112
			'open_basedir'					=> (int) @ini_get('open_basedir'),
indvdum@0
   113
			'memory_limit'					=> @ini_get('memory_limit'),
indvdum@0
   114
			'allow_url_fopen'				=> (int) @ini_get('allow_url_fopen'),
indvdum@0
   115
			'allow_url_include'				=> (int) @ini_get('allow_url_include'),
indvdum@0
   116
			'file_uploads'					=> (int) @ini_get('file_uploads'),
indvdum@0
   117
			'upload_max_filesize'			=> @ini_get('upload_max_filesize'),
indvdum@0
   118
			'post_max_size'					=> @ini_get('post_max_size'),
indvdum@0
   119
			'disable_functions'				=> @ini_get('disable_functions'),
indvdum@0
   120
			'disable_classes'				=> @ini_get('disable_classes'),
indvdum@0
   121
			'enable_dl'						=> (int) @ini_get('enable_dl'),
indvdum@0
   122
			'magic_quotes_gpc'				=> (int) @ini_get('magic_quotes_gpc'),
indvdum@0
   123
			'register_globals'				=> (int) @ini_get('register_globals'),
indvdum@0
   124
			'filter.default'				=> @ini_get('filter.default'),
indvdum@0
   125
			'zend.ze1_compatibility_mode'	=> (int) @ini_get('zend.ze1_compatibility_mode'),
indvdum@0
   126
			'unicode.semantics'				=> (int) @ini_get('unicode.semantics'),
indvdum@0
   127
			'zend_thread_safty'				=> (int) function_exists('zend_thread_id'),
indvdum@0
   128
			'extensions'					=> get_loaded_extensions(),
indvdum@0
   129
		);
indvdum@0
   130
	}
indvdum@0
   131
}
indvdum@0
   132
indvdum@0
   133
/**
indvdum@0
   134
* Questionnaire System data provider
indvdum@0
   135
* @package phpBB3
indvdum@0
   136
*/
indvdum@0
   137
class phpbb_questionnaire_system_data_provider
indvdum@0
   138
{
indvdum@0
   139
	function get_identifier()
indvdum@0
   140
	{
indvdum@0
   141
		return 'System';
indvdum@0
   142
	}
indvdum@0
   143
indvdum@0
   144
	/**
indvdum@0
   145
	* Get data about the general system information, like OS or IP (shortened).
indvdum@0
   146
	*
indvdum@0
   147
	* @return	array
indvdum@0
   148
	*/
indvdum@0
   149
	function get_data()
indvdum@0
   150
	{
indvdum@0
   151
		// Start discovering the IPV4 server address, if available
indvdum@0
   152
		$server_address = '0.0.0.0';
indvdum@0
   153
indvdum@0
   154
		if (!empty($_SERVER['SERVER_ADDR']))
indvdum@0
   155
		{
indvdum@0
   156
			$server_address = $_SERVER['SERVER_ADDR'];
indvdum@0
   157
		}
indvdum@0
   158
indvdum@0
   159
		// Running on IIS?
indvdum@0
   160
		if (!empty($_SERVER['LOCAL_ADDR']))
indvdum@0
   161
		{
indvdum@0
   162
			$server_address = $_SERVER['LOCAL_ADDR'];
indvdum@0
   163
		}
indvdum@0
   164
indvdum@0
   165
		return array(
indvdum@0
   166
			'os'	=> PHP_OS,
indvdum@0
   167
			'httpd'	=> $_SERVER['SERVER_SOFTWARE'],
indvdum@0
   168
			// we don't want the real IP address (for privacy policy reasons) but only
indvdum@0
   169
			// a network address to see whether your installation is running on a private or public network.
indvdum@0
   170
			'private_ip'	=> $this->is_private_ip($server_address),
indvdum@0
   171
			'ipv6'			=> strpos($server_address, ':') !== false,
indvdum@0
   172
		);
indvdum@0
   173
	}
indvdum@0
   174
indvdum@0
   175
	/**
indvdum@0
   176
	* Checks whether the given IP is in a private network.
indvdum@0
   177
	*
indvdum@0
   178
	* @param	string	$ip	IP in v4 dot-decimal or v6 hex format
indvdum@0
   179
	* @return	bool		true if the IP is from a private network, else false
indvdum@0
   180
	*/
indvdum@0
   181
	function is_private_ip($ip)
indvdum@0
   182
	{
indvdum@0
   183
		// IPv4
indvdum@0
   184
		if (strpos($ip, ':') === false)
indvdum@0
   185
		{
indvdum@0
   186
			$ip_address_ary = explode('.', $ip);
indvdum@0
   187
indvdum@0
   188
			// build ip
indvdum@0
   189
			if (!isset($ip_address_ary[0]) || !isset($ip_address_ary[1]))
indvdum@0
   190
			{
indvdum@0
   191
				$ip_address_ary = explode('.', '0.0.0.0');
indvdum@0
   192
			}
indvdum@0
   193
indvdum@0
   194
			// IANA reserved addresses for private networks (RFC 1918) are:
indvdum@0
   195
			// - 10.0.0.0/8
indvdum@0
   196
			// - 172.16.0.0/12
indvdum@0
   197
			// - 192.168.0.0/16
indvdum@0
   198
			if ($ip_address_ary[0] == '10' ||
indvdum@0
   199
				($ip_address_ary[0] == '172' && intval($ip_address_ary[1]) > 15 && intval($ip_address_ary[1]) < 32) ||
indvdum@0
   200
				($ip_address_ary[0] == '192' && $ip_address_ary[1] == '168') ||
indvdum@0
   201
				($ip_address_ary[0] == '192' && $ip_address_ary[1] == '168'))
indvdum@0
   202
			{
indvdum@0
   203
				return true;
indvdum@0
   204
			}
indvdum@0
   205
		}
indvdum@0
   206
		// IPv6
indvdum@0
   207
		else
indvdum@0
   208
		{
indvdum@0
   209
			// unique local unicast
indvdum@0
   210
			$prefix = substr($ip, 0, 2);
indvdum@0
   211
			if ($prefix == 'fc' || $prefix == 'fd')
indvdum@0
   212
			{
indvdum@0
   213
				return true;
indvdum@0
   214
			}
indvdum@0
   215
		}
indvdum@0
   216
indvdum@0
   217
		return false;
indvdum@0
   218
	}
indvdum@0
   219
}
indvdum@0
   220
indvdum@0
   221
/**
indvdum@0
   222
* Questionnaire phpBB data provider
indvdum@0
   223
* @package phpBB3
indvdum@0
   224
*/
indvdum@0
   225
class phpbb_questionnaire_phpbb_data_provider
indvdum@0
   226
{
indvdum@0
   227
	var $config;
indvdum@0
   228
	var $unique_id;
indvdum@0
   229
indvdum@0
   230
	/**
indvdum@0
   231
	* Constructor.
indvdum@0
   232
	*
indvdum@0
   233
	* @param	array	$config
indvdum@0
   234
	*/
indvdum@0
   235
	function phpbb_questionnaire_phpbb_data_provider($config)
indvdum@0
   236
	{
indvdum@0
   237
		// generate a unique id if necessary
indvdum@0
   238
		if (empty($config['questionnaire_unique_id']))
indvdum@0
   239
		{
indvdum@0
   240
			$this->unique_id = unique_id();
indvdum@0
   241
			set_config('questionnaire_unique_id', $this->unique_id);
indvdum@0
   242
		}
indvdum@0
   243
		else
indvdum@0
   244
		{
indvdum@0
   245
			$this->unique_id = $config['questionnaire_unique_id'];
indvdum@0
   246
		}
indvdum@0
   247
indvdum@0
   248
		$this->config = $config;
indvdum@0
   249
	}
indvdum@0
   250
indvdum@0
   251
	/**
indvdum@0
   252
	* Returns a string identifier for this data provider
indvdum@0
   253
	*
indvdum@0
   254
	* @return	string	"phpBB"
indvdum@0
   255
	*/
indvdum@0
   256
	function get_identifier()
indvdum@0
   257
	{
indvdum@0
   258
		return 'phpBB';
indvdum@0
   259
	}
indvdum@0
   260
indvdum@0
   261
	/**
indvdum@0
   262
	* Get data about this phpBB installation.
indvdum@0
   263
	*
indvdum@0
   264
	* @return	array	Relevant anonymous config options
indvdum@0
   265
	*/
indvdum@0
   266
	function get_data()
indvdum@0
   267
	{
indvdum@0
   268
		global $phpbb_root_path, $phpEx;
indvdum@0
   269
		include("{$phpbb_root_path}config.$phpEx");
indvdum@0
   270
		unset($dbhost, $dbport, $dbname, $dbuser, $dbpasswd); // Just a precaution
indvdum@0
   271
indvdum@0
   272
		// Only send certain config vars
indvdum@0
   273
		$config_vars = array(
indvdum@0
   274
			'active_sessions' => true,
indvdum@0
   275
			'allow_attachments' => true,
indvdum@0
   276
			'allow_autologin' => true,
indvdum@0
   277
			'allow_avatar' => true,
indvdum@0
   278
			'allow_avatar_local' => true,
indvdum@0
   279
			'allow_avatar_remote' => true,
indvdum@0
   280
			'allow_avatar_upload' => true,
indvdum@0
   281
			'allow_bbcode' => true,
indvdum@0
   282
			'allow_birthdays' => true,
indvdum@0
   283
			'allow_bookmarks' => true,
indvdum@0
   284
			'allow_emailreuse' => true,
indvdum@0
   285
			'allow_forum_notify' => true,
indvdum@0
   286
			'allow_mass_pm' => true,
indvdum@0
   287
			'allow_name_chars' => true,
indvdum@0
   288
			'allow_namechange' => true,
indvdum@0
   289
			'allow_nocensors' => true,
indvdum@0
   290
			'allow_pm_attach' => true,
indvdum@0
   291
			'allow_pm_report' => true,
indvdum@0
   292
			'allow_post_flash' => true,
indvdum@0
   293
			'allow_post_links' => true,
indvdum@0
   294
			'allow_privmsg' => true,
indvdum@0
   295
			'allow_quick_reply' => true,
indvdum@0
   296
			'allow_sig' => true,
indvdum@0
   297
			'allow_sig_bbcode' => true,
indvdum@0
   298
			'allow_sig_flash' => true,
indvdum@0
   299
			'allow_sig_img' => true,
indvdum@0
   300
			'allow_sig_links' => true,
indvdum@0
   301
			'allow_sig_pm' => true,
indvdum@0
   302
			'allow_sig_smilies' => true,
indvdum@0
   303
			'allow_smilies' => true,
indvdum@0
   304
			'allow_topic_notify' => true,
indvdum@0
   305
			'attachment_quota' => true,
indvdum@0
   306
			'auth_bbcode_pm' => true,
indvdum@0
   307
			'auth_flash_pm' => true,
indvdum@0
   308
			'auth_img_pm' => true,
indvdum@0
   309
			'auth_method' => true,
indvdum@0
   310
			'auth_smilies_pm' => true,
indvdum@0
   311
			'avatar_filesize' => true,
indvdum@0
   312
			'avatar_max_height' => true,
indvdum@0
   313
			'avatar_max_width' => true,
indvdum@0
   314
			'avatar_min_height' => true,
indvdum@0
   315
			'avatar_min_width' => true,
indvdum@0
   316
			'board_dst' => true,
indvdum@0
   317
			'board_email_form' => true,
indvdum@0
   318
			'board_hide_emails' => true,
indvdum@0
   319
			'board_timezone' => true,
indvdum@0
   320
			'browser_check' => true,
indvdum@0
   321
			'bump_interval' => true,
indvdum@0
   322
			'bump_type' => true,
indvdum@0
   323
			'cache_gc' => true,
indvdum@0
   324
			'captcha_plugin' => true,
indvdum@0
   325
			'captcha_gd' => true,
indvdum@0
   326
			'captcha_gd_foreground_noise' => true,
indvdum@0
   327
			'captcha_gd_x_grid' => true,
indvdum@0
   328
			'captcha_gd_y_grid' => true,
indvdum@0
   329
			'captcha_gd_wave' => true,
indvdum@0
   330
			'captcha_gd_3d_noise' => true,
indvdum@0
   331
			'captcha_gd_fonts' => true,
indvdum@0
   332
			'confirm_refresh' => true,
indvdum@0
   333
			'check_attachment_content' => true,
indvdum@0
   334
			'check_dnsbl' => true,
indvdum@0
   335
			'chg_passforce' => true,
indvdum@0
   336
			'cookie_secure' => true,
indvdum@0
   337
			'coppa_enable' => true,
indvdum@0
   338
			'database_gc' => true,
indvdum@0
   339
			'dbms_version' => true,
indvdum@0
   340
			'default_dateformat' => true,
indvdum@0
   341
			'default_lang' => true,
indvdum@0
   342
			'display_last_edited' => true,
indvdum@0
   343
			'display_order' => true,
indvdum@0
   344
			'edit_time' => true,
indvdum@0
   345
			'email_check_mx' => true,
indvdum@0
   346
			'email_enable' => true,
indvdum@0
   347
			'email_function_name' => true,
indvdum@0
   348
			'email_package_size' => true,
indvdum@0
   349
			'enable_confirm' => true,
indvdum@0
   350
			'enable_pm_icons' => true,
indvdum@0
   351
			'enable_post_confirm' => true,
indvdum@0
   352
			'feed_enable' => true,
indvdum@0
   353
			'feed_http_auth' => true,
indvdum@0
   354
			'feed_limit_post' => true,
indvdum@0
   355
			'feed_limit_topic' => true,
indvdum@0
   356
			'feed_overall' => true,
indvdum@0
   357
			'feed_overall_forums' => true,
indvdum@0
   358
			'feed_forum' => true,
indvdum@0
   359
			'feed_topic' => true,
indvdum@0
   360
			'feed_topics_new' => true,
indvdum@0
   361
			'feed_topics_active' => true,
indvdum@0
   362
			'feed_item_statistics' => true,
indvdum@0
   363
			'flood_interval' => true,
indvdum@0
   364
			'force_server_vars' => true,
indvdum@0
   365
			'form_token_lifetime' => true,
indvdum@0
   366
			'form_token_mintime' => true,
indvdum@0
   367
			'form_token_sid_guests' => true,
indvdum@0
   368
			'forward_pm' => true,
indvdum@0
   369
			'forwarded_for_check' => true,
indvdum@0
   370
			'full_folder_action' => true,
indvdum@0
   371
			'fulltext_native_common_thres' => true,
indvdum@0
   372
			'fulltext_native_load_upd' => true,
indvdum@0
   373
			'fulltext_native_max_chars' => true,
indvdum@0
   374
			'fulltext_native_min_chars' => true,
indvdum@0
   375
			'gzip_compress' => true,
indvdum@0
   376
			'hot_threshold' => true,
indvdum@0
   377
			'img_create_thumbnail' => true,
indvdum@0
   378
			'img_display_inlined' => true,
indvdum@0
   379
			'img_imagick' => true,
indvdum@0
   380
			'img_link_height' => true,
indvdum@0
   381
			'img_link_width' => true,
indvdum@0
   382
			'img_max_height' => true,
indvdum@0
   383
			'img_max_thumb_width' => true,
indvdum@0
   384
			'img_max_width' => true,
indvdum@0
   385
			'img_min_thumb_filesize' => true,
indvdum@0
   386
			'ip_check' => true,
indvdum@0
   387
			'jab_enable' => true,
indvdum@0
   388
			'jab_package_size' => true,
indvdum@0
   389
			'jab_use_ssl' => true,
indvdum@0
   390
			'limit_load' => true,
indvdum@0
   391
			'limit_search_load' => true,
indvdum@0
   392
			'load_anon_lastread' => true,
indvdum@0
   393
			'load_birthdays' => true,
indvdum@0
   394
			'load_cpf_memberlist' => true,
indvdum@0
   395
			'load_cpf_viewprofile' => true,
indvdum@0
   396
			'load_cpf_viewtopic' => true,
indvdum@0
   397
			'load_db_lastread' => true,
indvdum@0
   398
			'load_db_track' => true,
indvdum@0
   399
			'load_jumpbox' => true,
indvdum@0
   400
			'load_moderators' => true,
indvdum@0
   401
			'load_online' => true,
indvdum@0
   402
			'load_online_guests' => true,
indvdum@0
   403
			'load_online_time' => true,
indvdum@0
   404
			'load_onlinetrack' => true,
indvdum@0
   405
			'load_search' => true,
indvdum@0
   406
			'load_tplcompile' => true,
indvdum@0
   407
			'load_user_activity' => true,
indvdum@0
   408
			'max_attachments' => true,
indvdum@0
   409
			'max_attachments_pm' => true,
indvdum@0
   410
			'max_autologin_time' => true,
indvdum@0
   411
			'max_filesize' => true,
indvdum@0
   412
			'max_filesize_pm' => true,
indvdum@0
   413
			'max_login_attempts' => true,
indvdum@0
   414
			'max_name_chars' => true,
indvdum@0
   415
			'max_num_search_keywords' => true,
indvdum@0
   416
			'max_pass_chars' => true,
indvdum@0
   417
			'max_poll_options' => true,
indvdum@0
   418
			'max_post_chars' => true,
indvdum@0
   419
			'max_post_font_size' => true,
indvdum@0
   420
			'max_post_img_height' => true,
indvdum@0
   421
			'max_post_img_width' => true,
indvdum@0
   422
			'max_post_smilies' => true,
indvdum@0
   423
			'max_post_urls' => true,
indvdum@0
   424
			'max_quote_depth' => true,
indvdum@0
   425
			'max_reg_attempts' => true,
indvdum@0
   426
			'max_sig_chars' => true,
indvdum@0
   427
			'max_sig_font_size' => true,
indvdum@0
   428
			'max_sig_img_height' => true,
indvdum@0
   429
			'max_sig_img_width' => true,
indvdum@0
   430
			'max_sig_smilies' => true,
indvdum@0
   431
			'max_sig_urls' => true,
indvdum@0
   432
			'min_name_chars' => true,
indvdum@0
   433
			'min_pass_chars' => true,
indvdum@0
   434
			'min_post_chars' => true,
indvdum@0
   435
			'min_search_author_chars' => true,
indvdum@0
   436
			'mime_triggers' => true,
indvdum@0
   437
			'new_member_post_limit' => true,
indvdum@0
   438
			'new_member_group_default' => true,
indvdum@0
   439
			'override_user_style' => true,
indvdum@0
   440
			'pass_complex' => true,
indvdum@0
   441
			'pm_edit_time' => true,
indvdum@0
   442
			'pm_max_boxes' => true,
indvdum@0
   443
			'pm_max_msgs' => true,
indvdum@0
   444
			'pm_max_recipients' => true,
indvdum@0
   445
			'posts_per_page' => true,
indvdum@0
   446
			'print_pm' => true,
indvdum@0
   447
			'queue_interval' => true,
indvdum@0
   448
			'require_activation' => true,
indvdum@0
   449
			'referer_validation' => true,
indvdum@0
   450
			'search_block_size' => true,
indvdum@0
   451
			'search_gc' => true,
indvdum@0
   452
			'search_interval' => true,
indvdum@0
   453
			'search_anonymous_interval' => true,
indvdum@0
   454
			'search_type' => true,
indvdum@0
   455
			'search_store_results' => true,
indvdum@0
   456
			'secure_allow_deny' => true,
indvdum@0
   457
			'secure_allow_empty_referer' => true,
indvdum@0
   458
			'secure_downloads' => true,
indvdum@0
   459
			'session_gc' => true,
indvdum@0
   460
			'session_length' => true,
indvdum@0
   461
			'smtp_auth_method' => true,
indvdum@0
   462
			'smtp_delivery' => true,
indvdum@0
   463
			'topics_per_page' => true,
indvdum@0
   464
			'tpl_allow_php' => true,
indvdum@0
   465
			'version' => true,
indvdum@0
   466
			'warnings_expire_days' => true,
indvdum@0
   467
			'warnings_gc' => true,
indvdum@0
   468
indvdum@0
   469
			'num_files' => true,
indvdum@0
   470
			'num_posts' => true,
indvdum@0
   471
			'num_topics' => true,
indvdum@0
   472
			'num_users' => true,
indvdum@0
   473
			'record_online_users' => true,
indvdum@0
   474
		);
indvdum@0
   475
indvdum@0
   476
		$result = array();
indvdum@0
   477
		foreach ($config_vars as $name => $void)
indvdum@0
   478
		{
indvdum@0
   479
			if (isset($this->config[$name]))
indvdum@0
   480
			{
indvdum@0
   481
				$result['config_' . $name] = $this->config[$name];
indvdum@0
   482
			}
indvdum@0
   483
		}
indvdum@0
   484
indvdum@0
   485
		global $db;
indvdum@0
   486
indvdum@0
   487
		$result['dbms'] = $dbms;
indvdum@0
   488
		$result['acm_type'] = $acm_type;
indvdum@0
   489
		$result['load_extensions'] = $load_extensions;
indvdum@0
   490
		$result['user_agent'] = 'Unknown';
indvdum@0
   491
		$result['dbms_version'] = $db->sql_server_info(true);
indvdum@0
   492
indvdum@0
   493
		// Try to get user agent vendor and version
indvdum@0
   494
		$match = array();
indvdum@0
   495
		$user_agent = (!empty($_SERVER['HTTP_USER_AGENT'])) ? (string) $_SERVER['HTTP_USER_AGENT'] : '';
indvdum@0
   496
		$agents = array('firefox', 'msie', 'opera', 'chrome', 'safari', 'mozilla', 'seamonkey', 'konqueror', 'netscape', 'gecko', 'navigator', 'mosaic', 'lynx', 'amaya', 'omniweb', 'avant', 'camino', 'flock', 'aol');
indvdum@0
   497
indvdum@0
   498
		// We check here 1 by 1 because some strings occur after others (for example Mozilla [...] Firefox/)
indvdum@0
   499
		foreach ($agents as $agent)
indvdum@0
   500
		{
indvdum@0
   501
			if (preg_match('#(' . $agent . ')[/ ]?([0-9.]*)#i', $user_agent, $match))
indvdum@0
   502
			{
indvdum@0
   503
				$result['user_agent'] = $match[1] . ' ' . $match[2];
indvdum@0
   504
				break;
indvdum@0
   505
			}
indvdum@0
   506
		}
indvdum@0
   507
indvdum@0
   508
		return $result;
indvdum@0
   509
	}
indvdum@0
   510
}
indvdum@0
   511
indvdum@0
   512
?>