Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
questionnaire.php
001 <?php
002 /**
003 *
004 * This file is part of the phpBB Forum Software package.
005 *
006 * @copyright (c) phpBB Limited <https://www.phpbb.com>
007 * @license GNU General Public License, version 2 (GPL-2.0)
008 *
009 * For full copyright and license information, please see
010 * the docs/CREDITS.txt file.
011 *
012 */
013
014 /**
015 * @ignore
016 */
017 if (!defined('IN_PHPBB'))
018 {
019 exit;
020 }
021
022 /**
023 * This class collects data which is used to create some usage statistics.
024 *
025 * The collected data is - after authorization of the administrator - submitted
026 * to a central server. For privacy reasons we try to collect only data which aren't private
027 * or don't give any information which might help to identify the user.
028 *
029 * @author Johannes Schlueter <johannes@php.net>
030 * @copyright (c) 2007-2008 Johannes Schlueter
031 */
032 class phpbb_questionnaire_data_collector
033 {
034 var $providers;
035 var $data = null;
036 var $install_id = '';
037
038 /**
039 * Constructor.
040 *
041 * @param string $install_id
042 */
043 function __construct($install_id)
044 {
045 $this->install_id = $install_id;
046 $this->providers = array();
047 }
048
049 function add_data_provider($provider)
050 {
051 $this->providers[] = $provider;
052 }
053
054 /**
055 * Get data as an array.
056 *
057 * @return array All Data
058 */
059 function get_data_raw()
060 {
061 if (!$this->data)
062 {
063 $this->collect();
064 }
065
066 return $this->data;
067 }
068
069 function get_data_for_form()
070 {
071 return base64_encode(json_encode($this->get_data_raw()));
072 }
073
074 /**
075 * Collect info into the data property.
076 *
077 * @return null
078 */
079 function collect()
080 {
081 foreach (array_keys($this->providers) as $key)
082 {
083 $provider = $this->providers[$key];
084 $this->data[$provider->get_identifier()] = $provider->get_data();
085 }
086 $this->data['install_id'] = $this->install_id;
087 }
088 }
089
090 /** interface: get_indentifier(), get_data() */
091
092 /**
093 * Questionnaire PHP data provider
094 */
095 class phpbb_questionnaire_php_data_provider
096 {
097 function get_identifier()
098 {
099 return 'PHP';
100 }
101
102 /**
103 * Get data about the PHP runtime setup.
104 *
105 * @return array
106 */
107 function get_data()
108 {
109 return array(
110 'version' => PHP_VERSION,
111 'sapi' => PHP_SAPI,
112 'int_size' => defined('PHP_INT_SIZE') ? PHP_INT_SIZE : '',
113 'open_basedir' => (int) @ini_get('open_basedir'),
114 'memory_limit' => @ini_get('memory_limit'),
115 'allow_url_fopen' => (int) @ini_get('allow_url_fopen'),
116 'allow_url_include' => (int) @ini_get('allow_url_include'),
117 'file_uploads' => (int) @ini_get('file_uploads'),
118 'upload_max_filesize' => @ini_get('upload_max_filesize'),
119 'post_max_size' => @ini_get('post_max_size'),
120 'disable_functions' => @ini_get('disable_functions'),
121 'disable_classes' => @ini_get('disable_classes'),
122 'enable_dl' => (int) @ini_get('enable_dl'),
123 'filter.default' => @ini_get('filter.default'),
124 'zend.ze1_compatibility_mode' => (int) @ini_get('zend.ze1_compatibility_mode'),
125 'unicode.semantics' => (int) @ini_get('unicode.semantics'),
126 'zend_thread_safty' => (int) function_exists('zend_thread_id'),
127 'extensions' => implode(',', get_loaded_extensions()),
128 );
129 }
130 }
131
132 /**
133 * Questionnaire System data provider
134 */
135 class phpbb_questionnaire_system_data_provider
136 {
137 function get_identifier()
138 {
139 return 'System';
140 }
141
142 /**
143 * Get data about the general system information, like OS or IP (shortened).
144 *
145 * @return array
146 */
147 function get_data()
148 {
149 global $request;
150
151 // Start discovering the IPV4 server address, if available
152 // Try apache, IIS, fall back to 0.0.0.0
153 $server_address = html_entity_decode($request->server('SERVER_ADDR', $request->server('LOCAL_ADDR', '0.0.0.0')), ENT_COMPAT);
154
155 return array(
156 'os' => PHP_OS,
157 'httpd' => html_entity_decode($request->server('SERVER_SOFTWARE'), ENT_COMPAT),
158 // we don't want the real IP address (for privacy policy reasons) but only
159 // a network address to see whether your installation is running on a private or public network.
160 'private_ip' => $this->is_private_ip($server_address),
161 'ipv6' => strpos($server_address, ':') !== false,
162 );
163 }
164
165 /**
166 * Checks whether the given IP is in a private network.
167 *
168 * @param string $ip IP in v4 dot-decimal or v6 hex format
169 * @return bool true if the IP is from a private network, else false
170 */
171 function is_private_ip($ip)
172 {
173 // IPv4
174 if (strpos($ip, ':') === false)
175 {
176 $ip_address_ary = explode('.', $ip);
177
178 // build ip
179 if (!isset($ip_address_ary[0]) || !isset($ip_address_ary[1]))
180 {
181 $ip_address_ary = explode('.', '0.0.0.0');
182 }
183
184 // IANA reserved addresses for private networks (RFC 1918) are:
185 // - 10.0.0.0/8
186 // - 172.16.0.0/12
187 // - 192.168.0.0/16
188 if ($ip_address_ary[0] == '10' ||
189 ($ip_address_ary[0] == '172' && intval($ip_address_ary[1]) > 15 && intval($ip_address_ary[1]) < 32) ||
190 ($ip_address_ary[0] == '192' && $ip_address_ary[1] == '168'))
191 {
192 return true;
193 }
194 }
195 // IPv6
196 else
197 {
198 // unique local unicast
199 $prefix = substr($ip, 0, 2);
200 if ($prefix == 'fc' || $prefix == 'fd')
201 {
202 return true;
203 }
204 }
205
206 return false;
207 }
208 }
209
210 /**
211 * Questionnaire phpBB data provider
212 */
213 class phpbb_questionnaire_phpbb_data_provider
214 {
215 var $config;
216 var $unique_id;
217
218 /**
219 * Constructor.
220 *
221 * @param array $config
222 */
223 function __construct($config)
224 {
225 // generate a unique id if necessary
226 if (empty($config['questionnaire_unique_id']))
227 {
228 $this->unique_id = unique_id();
229 $config->set('questionnaire_unique_id', $this->unique_id);
230 }
231 else
232 {
233 $this->unique_id = $config['questionnaire_unique_id'];
234 }
235
236 $this->config = $config;
237 }
238
239 /**
240 * Returns a string identifier for this data provider
241 *
242 * @return string "phpBB"
243 */
244 function get_identifier()
245 {
246 return 'phpBB';
247 }
248
249 /**
250 * Get data about this phpBB installation.
251 *
252 * @return array Relevant anonymous config options
253 */
254 function get_data()
255 {
256 global $phpbb_config_php_file;
257
258 extract($phpbb_config_php_file->get_all());
259 unset($dbhost, $dbport, $dbname, $dbuser, $dbpasswd); // Just a precaution
260
261 $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms);
262
263 // Only send certain config vars
264 $config_vars = array(
265 'active_sessions' => true,
266 'allow_attachments' => true,
267 'allow_autologin' => true,
268 'allow_avatar' => true,
269 'allow_avatar_local' => true,
270 'allow_avatar_remote' => true,
271 'allow_avatar_upload' => true,
272 'allow_bbcode' => true,
273 'allow_birthdays' => true,
274 'allow_bookmarks' => true,
275 'allow_emailreuse' => true,
276 'allow_forum_notify' => true,
277 'allow_mass_pm' => true,
278 'allow_name_chars' => true,
279 'allow_namechange' => true,
280 'allow_nocensors' => true,
281 'allow_pm_attach' => true,
282 'allow_pm_report' => true,
283 'allow_post_flash' => true,
284 'allow_post_links' => true,
285 'allow_privmsg' => true,
286 'allow_quick_reply' => true,
287 'allow_sig' => true,
288 'allow_sig_bbcode' => true,
289 'allow_sig_flash' => true,
290 'allow_sig_img' => true,
291 'allow_sig_links' => true,
292 'allow_sig_pm' => true,
293 'allow_sig_smilies' => true,
294 'allow_smilies' => true,
295 'allow_topic_notify' => true,
296 'attachment_quota' => true,
297 'auth_bbcode_pm' => true,
298 'auth_flash_pm' => true,
299 'auth_img_pm' => true,
300 'auth_method' => true,
301 'auth_smilies_pm' => true,
302 'avatar_filesize' => true,
303 'avatar_max_height' => true,
304 'avatar_max_width' => true,
305 'avatar_min_height' => true,
306 'avatar_min_width' => true,
307 'board_email_form' => true,
308 'board_hide_emails' => true,
309 'board_timezone' => true,
310 'browser_check' => true,
311 'bump_interval' => true,
312 'bump_type' => true,
313 'cache_gc' => true,
314 'captcha_plugin' => true,
315 'captcha_gd' => true,
316 'captcha_gd_foreground_noise' => true,
317 'captcha_gd_x_grid' => true,
318 'captcha_gd_y_grid' => true,
319 'captcha_gd_wave' => true,
320 'captcha_gd_3d_noise' => true,
321 'captcha_gd_fonts' => true,
322 'confirm_refresh' => true,
323 'check_attachment_content' => true,
324 'check_dnsbl' => true,
325 'chg_passforce' => true,
326 'cookie_secure' => true,
327 'coppa_enable' => true,
328 'database_gc' => true,
329 'dbms_version' => true,
330 'default_dateformat' => true,
331 'default_lang' => true,
332 'display_last_edited' => true,
333 'display_order' => true,
334 'edit_time' => true,
335 'email_check_mx' => true,
336 'email_enable' => true,
337 'email_force_sender' => true,
338 'email_package_size' => true,
339 'enable_confirm' => true,
340 'enable_pm_icons' => true,
341 'enable_post_confirm' => true,
342 'feed_enable' => true,
343 'feed_http_auth' => true,
344 'feed_limit_post' => true,
345 'feed_limit_topic' => true,
346 'feed_overall' => true,
347 'feed_overall_forums' => true,
348 'feed_forum' => true,
349 'feed_topic' => true,
350 'feed_topics_new' => true,
351 'feed_topics_active' => true,
352 'feed_item_statistics' => true,
353 'flood_interval' => true,
354 'force_server_vars' => true,
355 'form_token_lifetime' => true,
356 'form_token_mintime' => true,
357 'form_token_sid_guests' => true,
358 'forward_pm' => true,
359 'forwarded_for_check' => true,
360 'full_folder_action' => true,
361 'fulltext_native_common_thres' => true,
362 'fulltext_native_load_upd' => true,
363 'fulltext_native_max_chars' => true,
364 'fulltext_native_min_chars' => true,
365 'gzip_compress' => true,
366 'hot_threshold' => true,
367 'img_create_thumbnail' => true,
368 'img_display_inlined' => true,
369 'img_link_height' => true,
370 'img_link_width' => true,
371 'img_max_height' => true,
372 'img_max_thumb_width' => true,
373 'img_max_width' => true,
374 'img_min_thumb_filesize' => true,
375 'ip_check' => true,
376 'jab_enable' => true,
377 'jab_package_size' => true,
378 'jab_use_ssl' => true,
379 'limit_load' => true,
380 'limit_search_load' => true,
381 'load_anon_lastread' => true,
382 'load_birthdays' => true,
383 'load_cpf_memberlist' => true,
384 'load_cpf_viewprofile' => true,
385 'load_cpf_viewtopic' => true,
386 'load_db_lastread' => true,
387 'load_db_track' => true,
388 'load_jumpbox' => true,
389 'load_moderators' => true,
390 'load_online' => true,
391 'load_online_guests' => true,
392 'load_online_time' => true,
393 'load_onlinetrack' => true,
394 'load_search' => true,
395 'load_tplcompile' => true,
396 'load_user_activity' => true,
397 'max_attachments' => true,
398 'max_attachments_pm' => true,
399 'max_autologin_time' => true,
400 'max_filesize' => true,
401 'max_filesize_pm' => true,
402 'max_login_attempts' => true,
403 'max_name_chars' => true,
404 'max_num_search_keywords' => true,
405 'max_poll_options' => true,
406 'max_post_chars' => true,
407 'max_post_font_size' => true,
408 'max_post_img_height' => true,
409 'max_post_img_width' => true,
410 'max_post_smilies' => true,
411 'max_post_urls' => true,
412 'max_quote_depth' => true,
413 'max_reg_attempts' => true,
414 'max_sig_chars' => true,
415 'max_sig_font_size' => true,
416 'max_sig_img_height' => true,
417 'max_sig_img_width' => true,
418 'max_sig_smilies' => true,
419 'max_sig_urls' => true,
420 'min_name_chars' => true,
421 'min_pass_chars' => true,
422 'min_post_chars' => true,
423 'min_search_author_chars' => true,
424 'mime_triggers' => true,
425 'new_member_post_limit' => true,
426 'new_member_group_default' => true,
427 'override_user_style' => true,
428 'pass_complex' => true,
429 'pm_edit_time' => true,
430 'pm_max_boxes' => true,
431 'pm_max_msgs' => true,
432 'pm_max_recipients' => true,
433 'posts_per_page' => true,
434 'print_pm' => true,
435 'queue_interval' => true,
436 'require_activation' => true,
437 'referer_validation' => true,
438 'search_block_size' => true,
439 'search_gc' => true,
440 'search_interval' => true,
441 'search_anonymous_interval' => true,
442 'search_type' => true,
443 'search_store_results' => true,
444 'secure_allow_deny' => true,
445 'secure_allow_empty_referer' => true,
446 'secure_downloads' => true,
447 'session_gc' => true,
448 'session_length' => true,
449 'smtp_auth_method' => true,
450 'smtp_delivery' => true,
451 'topics_per_page' => true,
452 'tpl_allow_php' => true,
453 'version' => true,
454 'warnings_expire_days' => true,
455 'warnings_gc' => true,
456
457 'num_files' => true,
458 'num_posts' => true,
459 'num_topics' => true,
460 'num_users' => true,
461 'record_online_users' => true,
462 );
463
464 $result = array();
465 foreach ($config_vars as $name => $void)
466 {
467 if (isset($this->config[$name]))
468 {
469 $result['config_' . $name] = $this->config[$name];
470 }
471 }
472
473 global $db, $request;
474
475 $result['dbms'] = $dbms;
476 $result['acm_type'] = $acm_type;
477 $result['user_agent'] = 'Unknown';
478 $result['dbms_version'] = $db->sql_server_info(true);
479
480 // Try to get user agent vendor and version
481 $match = array();
482 $user_agent = $request->header('User-Agent');
483 $agents = array('firefox', 'msie', 'opera', 'chrome', 'safari', 'mozilla', 'seamonkey', 'konqueror', 'netscape', 'gecko', 'navigator', 'mosaic', 'lynx', 'amaya', 'omniweb', 'avant', 'camino', 'flock', 'aol');
484
485 // We check here 1 by 1 because some strings occur after others (for example Mozilla [...] Firefox/)
486 foreach ($agents as $agent)
487 {
488 if (preg_match('#(' . $agent . ')[/ ]?([0-9.]*)#i', $user_agent, $match))
489 {
490 $result['user_agent'] = $match[1] . ' ' . $match[2];
491 break;
492 }
493 }
494
495 return $result;
496 }
497 }
498