예제 #1
0
 function main($id, $mode)
 {
     global $db, $config, $sconfig, $phpbb_root_path, $user, $template, $request, $phpbb_extension_manager, $phpbb_container, $phpbb_path_helper, $tables;
     $user->add_lang_ext('forumhulp/statistics', 'statistics');
     function __construct(\phpbb\user $user, \phpbb\controller\provider $controller_provider, \phpbb\extension\manager $extension_manager, $phpbb_root_path)
     {
         $this->controller_provider = $controller_provider;
         $this->extension_manager = $extension_manager;
         $this->phpbb_root_path = $phpbb_root_path;
         //		parent::__construct($user);
     }
     $tables['config'] = $phpbb_container->getParameter('tables.config_table');
     $tables['online'] = $phpbb_container->getParameter('tables.online_table');
     $tables['domain'] = $phpbb_container->getParameter('tables.domain_table');
     $tables['se'] = $phpbb_container->getParameter('tables.se_table');
     $tables['archive'] = $phpbb_container->getParameter('tables.archive_table');
     $tables['stats'] = $phpbb_container->getParameter('tables.stats_table');
     include $phpbb_root_path . 'ext/forumhulp/statistics/vendor/stat_functions.php';
     \stat_functions::get_config();
     $action = $request->variable('action', '');
     $screen = $request->variable('screen', $sconfig['statistics_start_screen']);
     $start = $request->variable('start', 0);
     $overall = (int) $request->variable('overall', $config['statistics_archive']);
     if ($overall != (int) $config['statistics_archive']) {
         $config->set('statistics_archive', (int) $overall);
     }
     $this->tpl_name = 'acp_statistics';
     $this->page_title = 'ACP_STATISTICS';
     $template->assign_vars(array('EXT_PATH' => $phpbb_path_helper->update_web_root_path($phpbb_extension_manager->get_extension_path('forumhulp/statistics', true)), 'U_ACTION' => $this->u_action, 'ACT' => $screen));
     switch ($screen) {
         case 'info':
             $user->add_lang(array('install', 'acp/extensions', 'migrator'));
             $ext_name = 'forumhulp/statistics';
             $md_manager = new \phpbb\extension\metadata_manager($ext_name, $config, $phpbb_extension_manager, $template, $user, $phpbb_root_path);
             try {
                 $this->metadata = $md_manager->get_metadata('all');
             } catch (\phpbb\extension\exception $e) {
                 trigger_error($e, E_USER_WARNING);
             }
             $md_manager->output_template_data();
             try {
                 $updates_available = $this->version_check($md_manager, $request->variable('versioncheck_force', false));
                 $template->assign_vars(array('S_UP_TO_DATE' => empty($updates_available), 'S_VERSIONCHECK' => true, 'UP_TO_DATE_MSG' => $user->lang(empty($updates_available) ? 'UP_TO_DATE' : 'NOT_UP_TO_DATE', $md_manager->get_metadata('display-name'))));
                 foreach ($updates_available as $branch => $version_data) {
                     $template->assign_block_vars('updates_available', $version_data);
                 }
             } catch (\RuntimeException $e) {
                 $template->assign_vars(array('S_VERSIONCHECK_STATUS' => $e->getCode(), 'VERSIONCHECK_FAIL_REASON' => $e->getMessage() !== $user->lang('VERSIONCHECK_FAIL') ? $e->getMessage() : ''));
             }
             $template->assign_vars(array('U_BACK' => $this->u_action));
             $this->tpl_name = 'acp_ext_details';
             break;
         case 'nyi':
             \stat_functions::nyi($start, $this->u_action, $overall);
             break;
         case 'countries':
             \stat_functions::countries($start, $this->u_action, $overall);
             break;
         case 'browsers':
             \stat_functions::browsers($start, $this->u_action, $overall);
             break;
         case 'os':
             \stat_functions::os($start, $this->u_action, $overall);
             break;
         case 'referrals':
             \stat_functions::referrals($start, $this->u_action, $overall);
             break;
         case 'se':
             \stat_functions::se($start, $this->u_action, $overall);
             break;
         case 'ese':
             $this->tpl_name = 'subdisplays/ese';
             \stat_functions::ese($this->u_action, $action);
             break;
         case 'se_terms':
             \stat_functions::se_terms($start, $this->u_action, $overall);
             break;
         case 'crawl':
             \stat_functions::crawl($start, $this->u_action, $overall);
             break;
         case 'modules':
             \stat_functions::modules($start, $this->u_action, $overall);
             break;
         case 'screens':
             \stat_functions::screens($start, $this->u_action, $overall);
             break;
         case 'stats':
             \stat_functions::stats($start, $this->u_action);
             break;
         case 'ustats':
             \stat_functions::ustats($start, $this->u_action);
             break;
         case 'users':
             \stat_functions::users($start, $this->u_action, $overall);
             break;
         case 'config':
             \stat_functions::config($start, $this->u_action);
             break;
         case 'top10':
             \stat_functions::top10($start, $this->u_action);
             break;
         default:
             \stat_functions::online($start, $this->u_action);
             break;
     }
 }
예제 #2
0
 function main($id, $mode)
 {
     global $db, $config, $sconfig, $phpbb_root_path, $user, $template, $request, $phpbb_extension_manager, $phpbb_container, $phpbb_path_helper, $tables;
     $user->add_lang_ext('forumhulp/postsstats', 'postsstats');
     include $phpbb_root_path . 'ext/forumhulp/postsstats/vendor/stat_functions.php';
     $tables['config'] = $phpbb_container->getParameter('tables.poststatconfig_table');
     $tables['domain'] = $phpbb_container->getParameter('tables.poststatdomain_table');
     \stat_functions::get_config();
     $action = $request->variable('action', '');
     $screen = $request->variable('screen', $sconfig['start_screen']);
     $start = $request->variable('start', 0);
     $type = $request->variable('t', 0);
     $month = $request->variable('m', date('n', time()));
     $year = $request->variable('y', date('Y', time()));
     $prev = $type == 0 ? '&m=' . ($month - 1 == 0 ? 12 : $month - 1) . '&y=' . ($month - 1 == 0 ? $year - 1 : $year) : ($type == 2 ? '' : '&t=' . $type . '&y=' . ($year - 1));
     $next = $type == 0 ? '&m=' . ($month + 1 == 13 ? 1 : $month + 1) . '&y=' . ($month + 1 == 13 ? $year + 1 : $year) : ($type == 2 ? '' : '&t=' . $type . '&y=' . ($year + 1));
     $this->tpl_name = 'acp_statistics';
     $this->page_title = 'ACP_POSTSSTATS';
     $template->assign_vars(array('EXT_PATH' => $phpbb_path_helper->update_web_root_path($phpbb_extension_manager->get_extension_path('forumhulp/postsstats', true)), 'U_ACTION' => $this->u_action, 'ACT' => $screen, 'VIEW_TABLE' => $request->variable('table', false)));
     switch ($screen) {
         case 'info':
             $user->add_lang_ext('forumhulp/postsstats', 'info_acp_postsstats');
             $phpbb_container->get('forumhulp.helper')->detail('forumhulp/postsstats');
             $this->tpl_name = 'acp_ext_details';
             break;
         case 'nyi':
             \stat_functions::nyi($start, $this->u_action);
             break;
         case 'posts':
             \stat_functions::posts($type, $month, $year, $next, $prev, $this->u_action);
             break;
         case 'ppu':
             \stat_functions::ppu($type, $month, $year, $next, $prev, $this->u_action);
             break;
         case 'ppt':
             \stat_functions::ppt($type, $month, $year, $next, $prev, $this->u_action);
             break;
         case 'topics':
             \stat_functions::topics($type, $month, $year, $next, $prev, $this->u_action);
             break;
         case 'tpu':
             \stat_functions::tpu($type, $month, $year, $next, $prev, $this->u_action);
             break;
         case 'tpf':
             \stat_functions::tpf($type, $month, $year, $next, $prev, $this->u_action);
             break;
         case 'tv':
             \stat_functions::tv($type, $month, $year, $next, $prev, $this->u_action);
             break;
         case 'gp':
             \stat_functions::gp($type, $month, $year, $next, $prev, $this->u_action);
             break;
         case 'ptv':
             \stat_functions::ptv($type, $month, $year, $next, $prev, $this->u_action);
             break;
         case 'poll':
             \stat_functions::poll($type, $month, $year, $next, $prev, $this->u_action);
             break;
         case 'config':
             \stat_functions::config($start, $this->u_action);
             break;
         default:
             \stat_functions::online($start, $this->u_action);
             break;
     }
 }