aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2016-02-01 13:55:36 +0100
committerMarc Alexander <admin@m-a-styles.de>2016-12-03 14:20:28 +0100
commitcc7a0aa4fb2d6c8efd5c78df7d68328c9f8d4d32 (patch)
treeeb8e41e0fa97ec278e40af11806daa7cd277ac33 /phpBB
parent9fb2a5d5f8ed4c23689843178a4a06a151d146e6 (diff)
downloadforums-cc7a0aa4fb2d6c8efd5c78df7d68328c9f8d4d32.tar
forums-cc7a0aa4fb2d6c8efd5c78df7d68328c9f8d4d32.tar.gz
forums-cc7a0aa4fb2d6c8efd5c78df7d68328c9f8d4d32.tar.bz2
forums-cc7a0aa4fb2d6c8efd5c78df7d68328c9f8d4d32.tar.xz
forums-cc7a0aa4fb2d6c8efd5c78df7d68328c9f8d4d32.zip
[ticket/14492] Use guzzle for submitting data to stats service
PHPBB3-14492
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/adm/style/acp_help_phpbb.html8
-rw-r--r--phpBB/includes/acp/acp_help_phpbb.php43
-rw-r--r--phpBB/language/en/acp/common.php1
3 files changed, 51 insertions, 1 deletions
diff --git a/phpBB/adm/style/acp_help_phpbb.html b/phpBB/adm/style/acp_help_phpbb.html
index 347d39af86..cbbe42e8c7 100644
--- a/phpBB/adm/style/acp_help_phpbb.html
+++ b/phpBB/adm/style/acp_help_phpbb.html
@@ -4,6 +4,7 @@
<h1>{L_ACP_HELP_PHPBB}</h1>
+<form id="acp_board" method="post" action="{U_ACTION}">
<div class="send-stats-row">
<div class="send-stats-tile">
<h2><i class="icon fa-bar-chart"></i>Send statistics</h2>
@@ -47,6 +48,13 @@
<dd>Enable</dd>
</dl>
</div>
+ <fieldset>
+ <p class="submit-buttons">
+ <input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />
+ </p>
+ {S_FORM_TOKEN}
+ </fieldset>
</div>
+</form>
<!-- INCLUDE overall_footer.html -->
diff --git a/phpBB/includes/acp/acp_help_phpbb.php b/phpBB/includes/acp/acp_help_phpbb.php
index 2ac90eee48..c981cf79df 100644
--- a/phpBB/includes/acp/acp_help_phpbb.php
+++ b/phpBB/includes/acp/acp_help_phpbb.php
@@ -25,7 +25,7 @@ class acp_help_phpbb
function main($id, $mode)
{
- global $config, $template, $phpbb_admin_path, $phpbb_root_path, $phpEx;
+ global $config, $request, $template, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx;
if (!class_exists('phpbb_questionnaire_data_collector'))
{
@@ -37,6 +37,22 @@ class acp_help_phpbb
$this->tpl_name = 'acp_help_phpbb';
$this->page_title = 'ACP_HELP_PHPBB';
+ $submit = ($request->is_set_post('submit')) ? true : false;
+
+ $form_key = 'acp_help_phpbb';
+ add_form_key($form_key);
+ $error = array();
+
+ if ($submit && !check_form_key($form_key))
+ {
+ $error[] = $user->lang['FORM_INVALID'];
+ }
+ // Do not write values if there is an error
+ if (sizeof($error))
+ {
+ $submit = false;
+ }
+
// generate a unique id if necessary
if (!isset($config['questionnaire_unique_id']))
{
@@ -55,6 +71,31 @@ class acp_help_phpbb
$collector->add_data_provider(new phpbb_questionnaire_system_data_provider());
$collector->add_data_provider(new phpbb_questionnaire_phpbb_data_provider($config));
+ if ($submit)
+ {
+ $client = new \Guzzle\Http\Client(
+ $this->u_action,
+ array(
+ 'timeout' => 6,
+ 'connect_timeout' => 6,
+ )
+ );
+
+ $collect_request = $client->post($collect_url, [], [
+ 'systemdata' => $collector->get_data_for_form(),
+ ]);
+
+ $response = $collect_request->send();
+ if ($response->isSuccessful())
+ {
+ trigger_error($user->lang('THANKS_SEND_STATISTICS') . adm_back_link($this->u_action));
+ }
+ else
+ {
+ trigger_error($user->lang('FAIL_SEND_STATISTICS') . adm_back_link($this->u_action));
+ }
+ }
+
$template->assign_vars(array(
'U_COLLECT_STATS' => $collect_url,
'RAW_DATA' => $collector->get_data_for_form(),
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index a233547c7e..592021624b 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -486,6 +486,7 @@ $lang = array_merge($lang, array(
'SEND_STATISTICS_LONG' => 'Send statistical information',
'SHOW_STATISTICS' => 'Show details',
'THANKS_SEND_STATISTICS' => 'Thank you for submitting your information.',
+ 'FAIL_SEND_STATISTICS' => 'phpBB was unable to send statistics',
'EXPLAIN_ENABLE_VIGLINK' => 'Viglink is a non-invasive third-party service that will monetize existing links posted by users of your forum. When visitors click on those existing links and perform certain actions, such as shopping, the merchants pay VigLink a commission, of which a share is donated to the phpBB project. By agreeing to enable VigLink and donating proceeds to the phpBB project, you are supporting our open source organization and ensuring our continued financial security.<br /><br />You can change these settings at any time in VigLink settings panel.',
));