[ Index ]

PHP Cross Reference of phpBB-3.2.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/stats/receive_stats.php";
  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                  if ((strpos($response, 'Thank you') !== false || strpos($response, 'Flood protection') !== false))
  94                  {
  95                      trigger_error($user->lang('THANKS_SEND_STATISTICS') . adm_back_link($this->u_action));
  96                  }
  97                  else
  98                  {
  99                      trigger_error($user->lang('FAIL_SEND_STATISTICS') . adm_back_link($this->u_action));
 100                  }
 101              }
 102  
 103              trigger_error($user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
 104          }
 105  
 106          $template->assign_vars(array(
 107              'U_COLLECT_STATS'        => $collect_url,
 108              'S_COLLECT_STATS'        => (!empty($config['help_send_statistics'])) ? true : false,
 109              'RAW_DATA'                => $collector->get_data_for_form(),
 110              'U_ACP_MAIN'            => append_sid("{$phpbb_admin_path}index.$phpEx"),
 111              'U_ACTION'                => $this->u_action,
 112              // Pass earliest time we should try to send stats again
 113              'COLLECT_STATS_TIME'    => intval($config['help_send_statistics_time']) + 86400,
 114          ));
 115  
 116          $raw = $collector->get_data_raw();
 117  
 118          foreach ($raw as $provider => $data)
 119          {
 120              if ($provider == 'install_id')
 121              {
 122                  $data = array($provider => $data);
 123              }
 124  
 125              $template->assign_block_vars('providers', array(
 126                  'NAME'    => htmlspecialchars($provider),
 127              ));
 128  
 129              foreach ($data as $key => $value)
 130              {
 131                  if (is_array($value))
 132                  {
 133                      $value = utf8_wordwrap(serialize($value), 75, "\n", true);
 134                  }
 135  
 136                  $template->assign_block_vars('providers.values', array(
 137                      'KEY'    => utf8_htmlspecialchars($key),
 138                      'VALUE'    => utf8_htmlspecialchars($value),
 139                  ));
 140              }
 141          }
 142      }
 143  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1