aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2009-06-27 20:56:49 +0000
committerNils Adermann <naderman@naderman.de>2009-06-27 20:56:49 +0000
commit6273718dc5a7812b980ca45b20d123e5e0908026 (patch)
tree1be269bf21e689f2c02a27d97ddb03a9a03a46ab /phpBB
parent4bef644a94f6865a948951c0e946a93b93d55b21 (diff)
downloadforums-6273718dc5a7812b980ca45b20d123e5e0908026.tar
forums-6273718dc5a7812b980ca45b20d123e5e0908026.tar.gz
forums-6273718dc5a7812b980ca45b20d123e5e0908026.tar.bz2
forums-6273718dc5a7812b980ca45b20d123e5e0908026.tar.xz
forums-6273718dc5a7812b980ca45b20d123e5e0908026.zip
acp module for submitting statistical information to phpBB
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9698 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/adm/style/acp_send_statistics.html63
-rw-r--r--phpBB/includes/acp/acp_ranks.php2
-rw-r--r--phpBB/includes/acp/acp_send_statistics.php93
-rw-r--r--phpBB/includes/acp/info/acp_send_statistics.php37
-rw-r--r--phpBB/includes/questionnaire/questionnaire.php152
-rw-r--r--phpBB/includes/questionnaire/questionnaire_phpbb.php122
-rw-r--r--phpBB/language/en/acp/common.php8
7 files changed, 476 insertions, 1 deletions
diff --git a/phpBB/adm/style/acp_send_statistics.html b/phpBB/adm/style/acp_send_statistics.html
new file mode 100644
index 0000000000..573eee6fad
--- /dev/null
+++ b/phpBB/adm/style/acp_send_statistics.html
@@ -0,0 +1,63 @@
+<!-- INCLUDE overall_header.html -->
+
+<a name="maincontent"></a>
+
+<h1>{L_SEND_STATISTICS}</h1>
+
+<p>{L_EXPLAIN_SEND_STATISTICS}</p>
+
+<script type="text/javascript">
+//<![CDATA[
+var iframect = 0;
+
+function iframeUpdated()
+{
+ if (iframect++ == 0)
+ {
+ return;
+ }
+
+ //dE('questionnaireForm', -1);
+ //dE('questionnaireThanks', 1);
+}
+//]]>
+</script>
+
+<iframe onload="iframeUpdated();" name="questionaireResult" style="display:none"></iframe>
+<form action="{U_COLLECT_STATS}" method="post" target="questionaireResult" id="questionnaireForm">
+
+ <p id="show_button"><input type="button" class="button2" onclick="dE('configlist', 1);dE('show_button', -1);" value="{L_SHOW_STATISTICS}"/></p>
+
+ <div id="configlist">
+ <input type="button" class="button2" onclick="dE('show_button', 1);dE('configlist', -1);" value="{L_HIDE_STATISTICS}"/>
+ <p class="submit-buttons">
+ <input class="button1" type="submit" id="submit" name="submit" value="{L_SEND_STATISTICS}" />
+ </p>
+ <!-- BEGIN providers -->
+ <fieldset>
+ <legend>{providers.NAME}</legend>
+ <!-- BEGIN values -->
+ <dl>
+ <dt>{providers.values.KEY}</dt>
+ <dd>{providers.values.VALUE}</dd>
+ </dl>
+ <!-- END values -->
+ </fieldset>
+ <!-- END providers -->
+ </div>
+ <p class="submit-buttons">
+ <input type="hidden" name="systemdata" value="{RAW_DATA}" />
+ <input class="button1" type="submit" id="submit" name="submit" value="{L_SEND_STATISTICS}" />
+ </p>
+</form>
+<div id="questionnaireThanks">
+ <p><strong>{L_THANKS_SEND_STATISTICS}</strong></p>
+</div>
+
+<script type="text/javascript">
+//<![CDATA[
+dE('configlist', false);
+dE('questionnaireThanks', false);
+//]]>
+</script>
+<!-- INCLUDE overall_footer.html --> \ No newline at end of file
diff --git a/phpBB/includes/acp/acp_ranks.php b/phpBB/includes/acp/acp_ranks.php
index a1a10545ef..fcfef2a61e 100644
--- a/phpBB/includes/acp/acp_ranks.php
+++ b/phpBB/includes/acp/acp_ranks.php
@@ -39,7 +39,7 @@ class acp_ranks
$this->tpl_name = 'acp_ranks';
$this->page_title = 'ACP_MANAGE_RANKS';
- $form_name = 'acp_prune';
+ $form_name = 'acp_ranks';
add_form_key($form_name);
switch ($action)
diff --git a/phpBB/includes/acp/acp_send_statistics.php b/phpBB/includes/acp/acp_send_statistics.php
new file mode 100644
index 0000000000..4bfacfdb50
--- /dev/null
+++ b/phpBB/includes/acp/acp_send_statistics.php
@@ -0,0 +1,93 @@
+<?php
+/**
+*
+* @package acp
+* @version $Id: acp_ranks.php 8479 2008-03-29 00:22:48Z naderman $
+* @copyright (c) 2005 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+include($phpbb_root_path . 'includes/questionnaire/questionnaire_phpbb.' . $phpEx);
+
+
+/**
+* @package acp
+*/
+class acp_send_statistics
+{
+ var $u_action;
+
+ function main($id, $mode)
+ {
+ global $config, $template;
+
+ $collect_url = "http://www.phpbb.com/stats/getstatdata.php";
+
+ $this->tpl_name = 'acp_send_statistics';
+ $this->page_title = 'ACP_SEND_STATISTICS';
+
+ $c = new Questionnaire_Data_Collector();
+ $c->addDataProvider(new Questionnaire_PHP_Data_Provider());
+ $c->addDataProvider(new Questionnaire_System_Data_Provider());
+ $c->addDataProvider(new questionnaire_phpbb_data_provider($config));
+
+ $template->assign_vars(array(
+ 'U_COLLECT_STATS' => $collect_url,
+ 'RAW_DATA' => $c->getDataForForm(),
+ ));
+
+ $raw = $c->getDataRaw();
+
+ foreach ($raw as $provider => $data)
+ {
+ $template->assign_block_vars('providers', array(
+ 'NAME' => htmlentities($provider),
+ ));
+
+ foreach ($data as $key => $value)
+ {
+ if (is_array($value))
+ {
+ $value = utf8_wordwrap(serialize($value), 75, "\n", true);
+ }
+
+ $template->assign_block_vars('providers.values', array(
+ 'KEY' => htmlentities($key),
+ 'VALUE' => htmlentities($value),
+ ));
+ }
+ }
+ }
+
+ /**
+ * Output the data as an HTML Definition List.
+ *
+ * @param mixed
+ * @param string
+ * @param string
+ * @return void
+ */
+ function data_printer($value, $key)
+ {
+ echo '<dt>', htmlentities($key), '</dt>', $ident, "\t", '<dd>';
+ if (is_array($value))
+ {
+ $value = htmlentities(serialize($value));
+ echo '<dl>';
+ echo '</dl>';
+ } else {
+ echo htmlentities($value);
+ }
+ echo '</dd>';
+ }
+}
+
+?> \ No newline at end of file
diff --git a/phpBB/includes/acp/info/acp_send_statistics.php b/phpBB/includes/acp/info/acp_send_statistics.php
new file mode 100644
index 0000000000..33e66ecd26
--- /dev/null
+++ b/phpBB/includes/acp/info/acp_send_statistics.php
@@ -0,0 +1,37 @@
+<?php
+/**
+*
+* @package acp
+* @version $Id$
+* @copyright (c) 2005 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* @package module_install
+*/
+class acp_send_statistics_info
+{
+ function module()
+ {
+ return array(
+ 'filename' => 'acp_send_statistics',
+ 'title' => 'ACP_SEND_STATISTICS',
+ 'version' => '1.0.0',
+ 'modes' => array(
+ 'questionnaire' => array('title' => 'ACP_SEND_STATISTICS', 'auth' => 'acl_a_server', 'cat' => array('ACP_SERVER_CONFIGURATION')),
+ ),
+ );
+ }
+
+ function install()
+ {
+ }
+
+ function uninstall()
+ {
+ }
+}
+
+?> \ No newline at end of file
diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php
new file mode 100644
index 0000000000..7eeb4e4113
--- /dev/null
+++ b/phpBB/includes/questionnaire/questionnaire.php
@@ -0,0 +1,152 @@
+<?php
+
+/*interface Questionnaire_Data_Provider
+{
+ public function getIdentifier();
+ public function getData();
+}*/
+
+class Questionnaire_PHP_Data_Provider
+{
+ function getIdentifier()
+ {
+ return 'PHP';
+ }
+
+ /**
+ * Get data about the PHP runtime setup.
+ *
+ * @return array
+ */
+ function getData()
+ {
+ return array(
+ 'version' => PHP_VERSION,
+ 'sapi' => PHP_SAPI,
+ 'int_size' => defined('PHP_INT_SIZE') ? PHP_INT_SIZE : '',
+ 'safe_mode' => (int)ini_get('safe_mode'),
+ 'open_basedir' => (int)ini_get('open_basedir'),
+ 'memory_limit' => ini_get('memory_limit'),
+ 'allow_url_fopen' => (int)ini_get('allow_url_fopen'),
+ 'allow_url_include' => (int)ini_get('allow_url_include'),
+ 'file_uploads' => (int)ini_get('file_uploads'),
+ 'upload_max_filesize' => ini_get('upload_max_filesize'),
+ 'post_max_size' => ini_get('post_max_size'),
+ 'disable_functions' => ini_get('disable_functions'),
+ 'disable_classes' => ini_get('disable_classes'),
+ 'enable_dl' => (int)ini_get('enable_dl'),
+ 'magic_quotes_gpc' => (int)ini_get('magic_quotes_gpc'),
+ 'register_globals' => (int)ini_get('register_globals'),
+ 'filter.default' => ini_get('filter.default'),
+ 'zend.ze1_compatibility_mode' => (int)ini_get('zend.ze1_compatibility_mode'),
+ 'unicode.semantics' => (int)ini_get('unicode.semantics'),
+ 'zend_thread_safty' => (int)function_exists('zend_thread_id'),
+ 'extensions' => get_loaded_extensions()
+ );
+ }
+}
+
+
+class Questionnaire_System_Data_Provider
+{
+ function getIdentifier()
+ {
+ return 'System';
+ }
+
+ /**
+ * Get data about the general system information, like OS or IP (shortened).
+ *
+ * @return array
+ */
+ function getData()
+ {
+ // Start discovering the IPV4 server address, if available
+ $serverAddress = '0.0.0.0';
+ if (isset($_SERVER['SERVER_ADDR'])) {
+ $serverAddress = $_SERVER['SERVER_ADDR'];
+ }
+ // Running on IIS?
+ if (isset($_SERVER['LOCAL_ADDR'])) {
+ $serverAddress = $_SERVER['LOCAL_ADDR'];
+ }
+ $aIPAddress = explode('.', $serverAddress);
+
+ 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.
+ // 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' => $aIPAddress[0].'.'.$aIPAddress[1].'.XXX.YYY'
+ );
+ }
+}
+
+/**
+ * This class collects data which is used to create some usage statistics.
+ *
+ * The collected data is - after authorization of the administrator - submitted
+ * to a central server. For privacy reasons we try to collect only data which aren't private
+ * or don't give any information which might help to identify the user.
+ *
+ * @author Johannes Schlueter <johannes@php.net>
+ * @copyright (c) 2007-2008 Johannes Schlueter
+ */
+
+class Questionnaire_Data_Collector
+{
+ var $providers;
+ var $data = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array
+ * @param string
+ */
+ function __construct()
+ {
+ $this->providers = array();
+ }
+
+ function addDataProvider(&$provider)
+ {
+ $this->providers[] = &$provider;
+ }
+
+ /**
+ * Get data as an array.
+ *
+ * @return array All Data
+ */
+ function getDataRaw()
+ {
+ if (!$this->data) {
+ $this->collect();
+ }
+
+ return $this->data;
+ }
+
+ function getDataForForm()
+ {
+ return base64_encode(serialize($this->getDataRaw()));
+ }
+
+ /**
+ * Collect info into the data property.
+ *
+ * @return void
+ */
+ function collect()
+ {
+ foreach (array_keys($this->providers) as $key) {
+ $provider = &$this->providers[$key];
+ $this->data[$provider->getIdentifier()] = $provider->getData();
+ }
+ }
+}
diff --git a/phpBB/includes/questionnaire/questionnaire_phpbb.php b/phpBB/includes/questionnaire/questionnaire_phpbb.php
new file mode 100644
index 0000000000..7c2ce4c292
--- /dev/null
+++ b/phpBB/includes/questionnaire/questionnaire_phpbb.php
@@ -0,0 +1,122 @@
+<?php
+/**
+*
+* @package phpBB3
+* @version $Id$
+* @copyright (c) 2005 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx);
+
+class questionnaire_phpbb_data_provider
+{
+ var $config;
+ var $unique_id;
+
+ /**
+ * Constructor.
+ *
+ * @param array $config
+ * @param string $oldversion
+ */
+ function __construct($config)
+ {
+ // generate a unique id if necessary
+ if (!isset($config['questionnaire_unique_id']))
+ {
+ $this->unique_id = unique_id();
+ set_config('questionnaire_unique_id', $this->unique_id);
+ }
+ else
+ {
+ $this->unique_id = $config['questionnaire_unique_id'];
+ }
+
+ $this->config = $config;
+ }
+
+ /**
+ * Returns a string identifier for this data provider
+ *
+ * @return string "phpBB"
+ */
+ function getIdentifier()
+ {
+ return 'phpBB';
+ }
+
+
+ /**
+ * Get data about this phpBB installation.
+ *
+ * @return array Relevant anonymous config options
+ */
+ function getData()
+ {
+
+ // Exclude certain config vars
+ $exclude_config_vars = array(
+ 'avatar_gallery_path' => true,
+ 'avatar_path' => true,
+ 'avatar_salt' => true,
+ 'board_contact' => true,
+ 'board_disable_msg' => true,
+ 'board_email' => true,
+ 'board_email_sig' => true,
+ 'cookie_name' => true,
+ 'icons_path' => true,
+ 'icons_path' => true,
+ 'jab_host' => true,
+ 'jab_password' => true,
+ 'jab_port' => true,
+ 'jab_username' => true,
+ 'ldap_base_dn' => true,
+ 'ldap_email' => true,
+ 'ldap_password' => true,
+ 'ldap_port' => true,
+ 'ldap_server' => true,
+ 'ldap_uid' => true,
+ 'ldap_user' => true,
+ 'ldap_user_filter' => true,
+ 'ranks_path' => true,
+ 'script_path' => true,
+ 'server_name' => true,
+ 'server_port' => true,
+ 'server_protocol' => true,
+ 'site_desc' => true,
+ 'sitename' => true,
+ 'smilies_path' => true,
+ 'smtp_host' => true,
+ 'smtp_password' => true,
+ 'smtp_port' => true,
+ 'smtp_username' => true,
+ 'upload_icons_path' => true,
+ 'upload_path' => true,
+ 'newest_user_colour' => true,
+ 'newest_user_id' => true,
+ 'newest_username' => true,
+ 'rand_seed' => true,
+ );
+
+ $result = array();
+ foreach ($this->config as $name => $value)
+ {
+ if (!isset($exclude_config_vars[$name]))
+ {
+ $result['config.' . $name] = $value;
+ }
+ }
+
+ return $result;
+ }
+} \ No newline at end of file
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index 7e92594b85..55c3ed0cac 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -393,6 +393,14 @@ $lang = array_merge($lang, array(
'USER_IS_INACTIVE' => 'User is inactive',
));
+// Send statistics page
+$lang = array_merge($lang, array(
+ 'EXPLAIN_SEND_STATISTICS' => 'Please send some statistical information about your server and forum configuration to phpBB. All information that could identify you has been removed - the data is entirely anonymous. We will base decisions about future phpBB versions on this information. Below you can display all variables that will be transmitted.',
+ 'HIDE_STATISTICS' => 'Hide details',
+ 'SEND_STATISTICS' => 'Send statistical information',
+ 'SHOW_STATISTICS' => 'Show details',
+));
+
// Log Entries
$lang = array_merge($lang, array(
'LOG_ACL_ADD_USER_GLOBAL_U_' => '<strong>Added or edited users’ user permissions</strong><br />» %s',