[ Index ]

PHP Cross Reference of phpBB-3.3.11-deutsch

title

Body

[close]

/includes/acp/ -> acp_help_phpbb.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  /**
  15  * @ignore
  16  */
  17  if (!defined('IN_PHPBB'))
  18  {
  19      exit;
  20  }
  21  
  22  class acp_help_phpbb
  23  {
  24      var $u_action;
  25  
  26  	function main($id, $mode)
  27      {
  28          global $config, $request, $template, $user, $phpbb_dispatcher, $phpbb_admin_path, $phpbb_root_path, $phpEx;
  29  
  30          if (!class_exists('phpbb_questionnaire_data_collector'))
  31          {
  32              include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx);
  33          }
  34  
  35          $collect_url = "https://www.phpbb.com/statistics/send";
  36  
  37          $this->tpl_name = 'acp_help_phpbb';
  38          $this->page_title = 'ACP_HELP_PHPBB';
  39  
  40          $submit = ($request->is_set_post('submit')) ? true : false;
  41  
  42          $form_key = 'acp_help_phpbb';
  43          add_form_key($form_key);
  44          $error = array();
  45  
  46          if ($submit && !check_form_key($form_key))
  47          {
  48              $error[] = $user->lang['FORM_INVALID'];
  49          }
  50          // Do not write values if there is an error
  51          if (count($error))
  52          {
  53              $submit = false;
  54          }
  55  
  56          // generate a unique id if necessary
  57          if (!isset($config['questionnaire_unique_id']))
  58          {
  59              $install_id = unique_id();
  60              $config->set('questionnaire_unique_id', $install_id);
  61          }
  62          else
  63          {
  64              $install_id = $config['questionnaire_unique_id'];
  65          }
  66  
  67          $collector = new phpbb_questionnaire_data_collector($install_id);
  68  
  69          // Add data provider
  70          $collector->add_data_provider(new phpbb_questionnaire_php_data_provider());
  71          $collector->add_data_provider(new phpbb_questionnaire_system_data_provider());
  72          $collector->add_data_provider(new phpbb_questionnaire_phpbb_data_provider($config));
  73  
  74          /**
  75           * Event to modify ACP help phpBB page and/or listen to submit
  76           *
  77           * @event core.acp_help_phpbb_submit_before
  78           * @var    boolean    submit            Do we display the form or process the submission
  79           * @since 3.2.0-RC2
  80           */
  81          $vars = array('submit');
  82          extract($phpbb_dispatcher->trigger_event('core.acp_help_phpbb_submit_before', compact($vars)));
  83  
  84          if ($submit)
  85          {
  86              $config->set('help_send_statistics', $request->variable('help_send_statistics', false));
  87              $response = $request->variable('send_statistics_response', '');
  88  
  89              $config->set('help_send_statistics_time', time());
  90  
  91              if (!empty($response))
  92              {
  93                  $decoded_response = json_decode(html_entity_decode($response, ENT_COMPAT), true);
  94  
  95                  if ($decoded_response && isset($decoded_response['status']) && $decoded_response['status'] == 'ok')
  96                  {
  97                      trigger_error($user->lang('THANKS_SEND_STATISTICS') . adm_back_link($this->u_action));
  98                  }
  99                  else
 100                  {
 101                      trigger_error($user->lang('FAIL_SEND_STATISTICS') . adm_back_link($this->u_action), E_USER_WARNING);
 102                  }
 103              }
 104  
 105              trigger_error($user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
 106          }
 107  
 108          $template->assign_vars(array(
 109              'U_COLLECT_STATS'        => $collect_url,
 110              'S_COLLECT_STATS'        => (!empty($config['help_send_statistics'])) ? true : false,
 111              'S_STATS'                => $collector->get_data_raw(),
 112              'S_STATS_DATA'            => json_encode($collector->get_data_raw()),
 113              'U_ACP_MAIN'            => append_sid("{$phpbb_admin_path}index.$phpEx"),
 114              'U_ACTION'                => $this->u_action,
 115              // Pass earliest time we should try to send stats again
 116              'COLLECT_STATS_TIME'    => intval($config['help_send_statistics_time']) + 86400,
 117          ));
 118  
 119          $raw = $collector->get_data_raw();
 120  
 121          foreach ($raw as $provider => $data)
 122          {
 123              if ($provider == 'install_id')
 124              {
 125                  $data = array($provider => $data);
 126              }
 127  
 128              $template->assign_block_vars('providers', array(
 129                  'NAME'    => htmlspecialchars($provider, ENT_COMPAT),
 130              ));
 131  
 132              foreach ($data as $key => $value)
 133              {
 134                  if (is_array($value))
 135                  {
 136                      $value = utf8_wordwrap(serialize($value), 75, "\n", true);
 137                  }
 138  
 139                  $template->assign_block_vars('providers.values', array(
 140                      'KEY'    => utf8_htmlspecialchars($key),
 141                      'VALUE'    => utf8_htmlspecialchars($value),
 142                  ));
 143              }
 144          }
 145      }
 146  }


Generated: Sat Nov 4 14:26:03 2023 Cross-referenced by PHPXref 0.7.1