/**
  * Check if quickedit is enabled and assign S_QUICK_EDIT accordingly
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function check_quickedit_enabled($event)
 {
     // Check if quick edit is available
     $s_quick_edit = false;
     if ($this->user->data['is_registered'] && $this->config['allow_quick_edit'] && $this->helper->check_forum_permissions($event)) {
         // Quick edit enabled forum
         $s_quick_edit = $this->helper->check_topic_edit($event);
     }
     $this->template->assign_var('S_QUICK_EDIT', $s_quick_edit);
 }
Esempio n. 2
0
 /**
  * Update the data
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function add_stats_settings($event)
 {
     // Need this as global until it is added to the event
     global $legend;
     //$legend = $event['legend'];
     $display_output = false;
     // No point in doing the processing if it is not being displayed
     if ($this->config['statsonindex_guests'] || $this->config['statsonindex_admin'] && $this->auth->acl_get('a_') || !$this->config['statsonindex_admin'] && $this->user->data['is_registered']) {
         $display_output = true;
         $this->user->add_lang_ext('david63/statsonindex', 'stats_on_index');
         // Activity stats
         // Obtain posts/topics/new users activity
         $activity = $this->obtain_activity_data();
         $tf_posts = number_format($activity['posts'], '0');
         $tf_topics = number_format($activity['topics'], '0');
         $tf_users = number_format($activity['users'], '0');
         // Obtain user activity data
         $active_users = $this->obtain_active_user_data();
         $active_user_count = number_format(sizeof($active_users), '0');
         // 24 hour users online list, assign to the template block: lastvisit
         foreach ($active_users as $row) {
             // Check that the user is valid
             if ($row['user_id']) {
                 if ($row['user_type'] != USER_IGNORE) {
                     $this->template->assign_block_vars('lastvisit_user', array('USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'])));
                 } else {
                     $this->template->assign_block_vars('lastvisit_bot', array('USERNAME_FULL' => get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour'])));
                 }
             }
         }
         // Extended stats
         $files_per_day = number_format($this->config['num_files'] / ceil((time() - $this->config['board_startdate']) / 86400), '2');
         $files_per_user = number_format($this->config['num_files'] / $this->config['num_users'], '2');
         $files_per_year = number_format($files_per_day * 364.25, '0');
         $posts_per_day = number_format($this->config['num_posts'] / ceil((time() - $this->config['board_startdate']) / 86400), '2');
         $posts_per_topic = number_format($this->config['num_posts'] / $this->config['num_topics'], '2');
         $posts_per_user = number_format($this->config['num_posts'] / $this->config['num_users'], '2');
         $posts_per_year = number_format($posts_per_day * 364.25, '0');
         $topics_per_day = number_format($this->config['num_topics'] / ceil((time() - $this->config['board_startdate']) / 86400), '2');
         $topics_per_user = number_format($this->config['num_topics'] / $this->config['num_users'], '2');
         $topics_per_year = number_format($topics_per_day * 364.25, '0');
         $total_files = number_format($this->config['num_files'], '0');
         $users_per_day = number_format($this->config['num_users'] / ceil((time() - $this->config['board_startdate']) / 86400), '2');
         $users_per_year = number_format($users_per_day * 364.25, '0');
         $none = $this->user->lang('NONE');
         $this->template->assign_vars(array('FILES_PER_DAY' => $this->user->lang('FILE_PER_DAY', $files_per_day == 0 ? $none : $files_per_day), 'FILES_PER_USER' => $this->user->lang('FILES_PER_USER', $files_per_user == 0 ? $none : $files_per_user), 'FILES_PER_YEAR' => $this->user->lang('FILES_PER_YEAR', $files_per_year == 0 ? $none : $files_per_year), 'POSTS_PER_DAY' => $this->user->lang('POST_PER_DAY', $posts_per_day == 0 ? $none : $posts_per_day), 'POSTS_PER_TOPIC' => $this->user->lang('POSTS_PER_TOPIC', $posts_per_topic == 0 ? $none : $posts_per_topic), 'POSTS_PER_USER' => $this->user->lang('POSTS_PER_USER', $posts_per_user == 0 ? $none : $posts_per_user), 'POSTS_PER_YEAR' => $this->user->lang('POSTS_PER_YEAR', $posts_per_year == 0 ? $none : $posts_per_year), 'TFHOUR_POSTS' => $this->user->lang('TFHOUR_POSTS', $tf_posts == 0 ? $none : $tf_posts), 'TFHOUR_TOPICS' => $this->user->lang('TFHOUR_TOPICS', $tf_topics == 0 ? $none : $tf_topics), 'TFHOUR_USERS' => $this->user->lang('TFHOUR_USERS', $tf_users == 0 ? $none : $tf_users), 'TOPICS_PER_DAY' => $this->user->lang('TOPIC_PER_DAY', $topics_per_day == 0 ? $none : $topics_per_day), 'TOPICS_PER_USER' => $this->user->lang('TOPICS_PER_USER', $topics_per_user == 0 ? $none : $topics_per_user), 'TOPICS_PER_YEAR' => $this->user->lang('TOPICS_PER_YEAR', $topics_per_year == 0 ? $none : $topics_per_year), 'TOTAL_FILES' => $this->user->lang('TOTAL_FILES', $total_files == 0 ? $none : $total_files), 'USERS_PER_DAY' => $this->user->lang('USER_PER_DAY', $users_per_day == 0 ? $none : $users_per_day), 'USERS_PER_YEAR' => $this->user->lang('USERS_PER_YEAR', $users_per_year == 0 ? $none : $users_per_year), 'USERS_TFHOUR_TOTAL' => $this->user->lang('USERS_TFHOUR_TOTAL', $active_user_count == 0 ? $none : (int) $active_user_count), 'START_DATE' => $this->user->format_date($this->config['board_startdate']), 'ONLINE_FOR' => floor((time() - $this->config['board_startdate']) / 86400), 'S_SHOW_BOTS' => $this->config['statsonindex_bots'], 'S_SHOW_DAYS' => $this->config['statsonindex_days'], 'S_SHOW_STATS' => $this->config['statsonindex_stats'], 'S_SHOW_SUMMARY' => $this->config['statsonindex_summary'], 'S_SHOW_USERS' => $this->config['statsonindex_users'], 'LEGEND' => false, 'LEGEND_USERS' => $legend, 'TOTAL_POSTS' => $this->user->lang('TOTAL_POSTS_COUNT', number_format($this->config['num_posts'], '0')), 'TOTAL_TOPICS' => $this->user->lang('TOTAL_TOPICS', number_format($this->config['num_topics'], '0')), 'TOTAL_USERS' => $this->user->lang('TOTAL_USERS', number_format($this->config['num_users'], '0'))));
     }
     $this->template->assign_var('S_DISPLAY_STATS_OUTPUT', $display_output);
 }