From: Meik S. <acy...@ph...> - 2009-09-10 14:08:47
|
Author: acydburn Date: Thu Sep 10 14:30:47 2009 New Revision: 10131 Log: also collect admins user agent vendor and version (send_statistics) Modified: branches/phpBB-3_0_0/phpBB/adm/style/acp_send_statistics.html branches/phpBB-3_0_0/phpBB/includes/questionnaire/questionnaire.php Modified: branches/phpBB-3_0_0/phpBB/adm/style/acp_send_statistics.html ============================================================================== *** branches/phpBB-3_0_0/phpBB/adm/style/acp_send_statistics.html (original) --- branches/phpBB-3_0_0/phpBB/adm/style/acp_send_statistics.html Thu Sep 10 14:30:47 2009 *************** *** 23,29 **** //]]> </script> ! <iframe onload="iframe_updated();" name="questionaire_result" style="display:none;"></iframe> <form action="{U_COLLECT_STATS}" method="post" target="questionaire_result" id="questionnaire-form"> --- 23,29 ---- //]]> </script> ! <iframe onload="iframe_updated();" name="questionaire_result" style="display: none;"></iframe> <form action="{U_COLLECT_STATS}" method="post" target="questionaire_result" id="questionnaire-form"> Modified: branches/phpBB-3_0_0/phpBB/includes/questionnaire/questionnaire.php ============================================================================== *** branches/phpBB-3_0_0/phpBB/includes/questionnaire/questionnaire.php (original) --- branches/phpBB-3_0_0/phpBB/includes/questionnaire/questionnaire.php Thu Sep 10 14:30:47 2009 *************** *** 179,185 **** // - 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', ); } } --- 179,185 ---- // - 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', ); } } *************** *** 233,239 **** { global $phpbb_root_path, $phpEx; include("{$phpbb_root_path}config.$phpEx"); ! // Only send certain config vars $config_vars = array( 'active_sessions' => true, --- 233,239 ---- { global $phpbb_root_path, $phpEx; include("{$phpbb_root_path}config.$phpEx"); ! // Only send certain config vars $config_vars = array( 'active_sessions' => true, *************** *** 447,452 **** --- 447,468 ---- $result['dbms'] = $dbms; $result['acm_type'] = $acm_type; $result['load_extensions'] = $load_extensions; + $result['user_agent'] = 'Unknown'; + + // Try to get user agent vendor and version + $match = array(); + $user_agent = (!empty($_SERVER['HTTP_USER_AGENT'])) ? (string) $_SERVER['HTTP_USER_AGENT'] : ''; + $agents = array('firefox', 'msie', 'opera', 'chrome', 'safari', 'mozilla', 'seamonkey', 'konqueror', 'netscape', 'gecko', 'navigator', 'mosaic', 'lynx', 'amaya', 'omniweb', 'avant', 'camino', 'flock', 'aol'); + + // We check here 1 by 1 because some strings occur after others (for example Mozilla [...] Firefox/) + foreach ($agents as $agent) + { + if (preg_match('#(' . $agent . ')[/ ]?([0-9.]*)#i', $user_agent, $match)) + { + $result['user_agent'] = $match[1] . ' ' . $match[2]; + break; + } + } return $result; } |