diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_help_phpbb.php | 143 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_send_statistics.php | 91 | ||||
-rw-r--r-- | phpBB/includes/acp/info/acp_help_phpbb.php (renamed from phpBB/includes/acp/info/acp_send_statistics.php) | 8 | ||||
-rw-r--r-- | phpBB/includes/functions_acp.php | 1 | ||||
-rw-r--r-- | phpBB/includes/questionnaire/questionnaire.php | 6 |
5 files changed, 151 insertions, 98 deletions
diff --git a/phpBB/includes/acp/acp_help_phpbb.php b/phpBB/includes/acp/acp_help_phpbb.php new file mode 100644 index 0000000000..7991a0dad6 --- /dev/null +++ b/phpBB/includes/acp/acp_help_phpbb.php @@ -0,0 +1,143 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_help_phpbb +{ + var $u_action; + + function main($id, $mode) + { + global $config, $request, $template, $user, $phpbb_dispatcher, $phpbb_admin_path, $phpbb_root_path, $phpEx; + + if (!class_exists('phpbb_questionnaire_data_collector')) + { + include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx); + } + + $collect_url = "https://www.phpbb.com/stats/receive_stats.php"; + + $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'])) + { + $install_id = unique_id(); + $config->set('questionnaire_unique_id', $install_id); + } + else + { + $install_id = $config['questionnaire_unique_id']; + } + + $collector = new phpbb_questionnaire_data_collector($install_id); + + // Add data provider + $collector->add_data_provider(new phpbb_questionnaire_php_data_provider()); + $collector->add_data_provider(new phpbb_questionnaire_system_data_provider()); + $collector->add_data_provider(new phpbb_questionnaire_phpbb_data_provider($config)); + + /** + * Event to modify ACP help phpBB page and/or listen to submit + * + * @event core.acp_help_phpbb_submit_before + * @var boolean submit Do we display the form or process the submission + * @since 3.2.0-RC2 + */ + $vars = array('submit'); + extract($phpbb_dispatcher->trigger_event('core.acp_help_phpbb_submit_before', compact($vars))); + + if ($submit) + { + $config->set('help_send_statistics', $request->variable('help_send_statistics', false)); + $response = $request->variable('send_statistics_response', ''); + + $config->set('help_send_statistics_time', time()); + + if (!empty($response)) + { + if ((strpos($response, 'Thank you') !== false || strpos($response, 'Flood protection') !== false)) + { + 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)); + } + } + + trigger_error($user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action)); + } + + $template->assign_vars(array( + 'U_COLLECT_STATS' => $collect_url, + 'S_COLLECT_STATS' => (!empty($config['help_send_statistics'])) ? true : false, + 'RAW_DATA' => $collector->get_data_for_form(), + 'U_ACP_MAIN' => append_sid("{$phpbb_admin_path}index.$phpEx"), + 'U_ACTION' => $this->u_action, + // Pass earliest time we should try to send stats again + 'COLLECT_STATS_TIME' => intval($config['help_send_statistics_time']) + 86400, + )); + + $raw = $collector->get_data_raw(); + + foreach ($raw as $provider => $data) + { + if ($provider == 'install_id') + { + $data = array($provider => $data); + } + + $template->assign_block_vars('providers', array( + 'NAME' => htmlspecialchars($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' => utf8_htmlspecialchars($key), + 'VALUE' => utf8_htmlspecialchars($value), + )); + } + } + } +} diff --git a/phpBB/includes/acp/acp_send_statistics.php b/phpBB/includes/acp/acp_send_statistics.php deleted file mode 100644 index 74da5996f1..0000000000 --- a/phpBB/includes/acp/acp_send_statistics.php +++ /dev/null @@ -1,91 +0,0 @@ -<?php -/** -* -* This file is part of the phpBB Forum Software package. -* -* @copyright (c) phpBB Limited <https://www.phpbb.com> -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -class acp_send_statistics -{ - var $u_action; - - function main($id, $mode) - { - global $config, $template, $phpbb_admin_path, $phpbb_root_path, $phpEx; - - if (!class_exists('phpbb_questionnaire_data_collector')) - { - include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx); - } - - $collect_url = "https://www.phpbb.com/stats/receive_stats.php"; - - $this->tpl_name = 'acp_send_statistics'; - $this->page_title = 'ACP_SEND_STATISTICS'; - - // generate a unique id if necessary - if (!isset($config['questionnaire_unique_id'])) - { - $install_id = unique_id(); - $config->set('questionnaire_unique_id', $install_id); - } - else - { - $install_id = $config['questionnaire_unique_id']; - } - - $collector = new phpbb_questionnaire_data_collector($install_id); - - // Add data provider - $collector->add_data_provider(new phpbb_questionnaire_php_data_provider()); - $collector->add_data_provider(new phpbb_questionnaire_system_data_provider()); - $collector->add_data_provider(new phpbb_questionnaire_phpbb_data_provider($config)); - - $template->assign_vars(array( - 'U_COLLECT_STATS' => $collect_url, - 'RAW_DATA' => $collector->get_data_for_form(), - 'U_ACP_MAIN' => append_sid("{$phpbb_admin_path}index.$phpEx"), - )); - - $raw = $collector->get_data_raw(); - - foreach ($raw as $provider => $data) - { - if ($provider == 'install_id') - { - $data = array($provider => $data); - } - - $template->assign_block_vars('providers', array( - 'NAME' => htmlspecialchars($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' => utf8_htmlspecialchars($key), - 'VALUE' => utf8_htmlspecialchars($value), - )); - } - } - } -} diff --git a/phpBB/includes/acp/info/acp_send_statistics.php b/phpBB/includes/acp/info/acp_help_phpbb.php index a0db1a48c4..dee8ef41d7 100644 --- a/phpBB/includes/acp/info/acp_send_statistics.php +++ b/phpBB/includes/acp/info/acp_help_phpbb.php @@ -11,15 +11,15 @@ * */ -class acp_send_statistics_info +class acp_help_phpbb_info { function module() { return array( - 'filename' => 'acp_send_statistics', - 'title' => 'ACP_SEND_STATISTICS', + 'filename' => 'acp_help_phpbb', + 'title' => 'ACP_HELP_PHPBB', 'modes' => array( - 'send_statistics' => array('title' => 'ACP_SEND_STATISTICS', 'auth' => 'acl_a_server', 'cat' => array('ACP_SERVER_CONFIGURATION')), + 'help_phpbb' => array('title' => 'ACP_HELP_PHPBB', 'auth' => 'acl_a_server', 'cat' => array('ACP_SERVER_CONFIGURATION')), ), ); } diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index 766669480d..8bf42aa36e 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -88,6 +88,7 @@ function adm_page_header($page_title) 'T_ICONS_PATH' => "{$phpbb_root_path}{$config['icons_path']}/", 'T_RANKS_PATH' => "{$phpbb_root_path}{$config['ranks_path']}/", 'T_UPLOAD_PATH' => "{$phpbb_root_path}{$config['upload_path']}/", + 'T_FONT_AWESOME_LINK' => !empty($config['allow_cdn']) && !empty($config['load_font_awesome_url']) ? $config['load_font_awesome_url'] : "{$phpbb_root_path}assets/css/font-awesome.min.css?assets_version=" . $config['assets_version'], 'T_ASSETS_VERSION' => $config['assets_version'], diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index 6350f4bc5a..9699843db4 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -46,9 +46,9 @@ class phpbb_questionnaire_data_collector $this->providers = array(); } - function add_data_provider(&$provider) + function add_data_provider($provider) { - $this->providers[] = &$provider; + $this->providers[] = $provider; } /** @@ -80,7 +80,7 @@ class phpbb_questionnaire_data_collector { foreach (array_keys($this->providers) as $key) { - $provider = &$this->providers[$key]; + $provider = $this->providers[$key]; $this->data[$provider->get_identifier()] = $provider->get_data(); } $this->data['install_id'] = $this->install_id; |