Example #1
0
 public function stats($top_id, $action)
 {
     if (!$this->config['top_rating_type'] && !isset($this->user->data['user_type'])) {
         trigger_error($this->user->lang['NOT_VIEW_RATING']);
     }
     $statrow = $this->rating->view_stat($top_id);
     if ($action && $statrow['top_type'] == 2) {
         trigger_error($this->user->lang['TOP_CLOSED']);
     }
     switch ($action) {
         case 'hosts':
             if (!$statrow['top_id'] || !$statrow['top_hosts']) {
                 trigger_error('TOP_NOT');
             }
             $this->rating->view_stat_hosts($statrow['top_id'], $statrow['top_hosts']);
             $page_title = $this->user->lang['TOP_HOSTS'] . str_replace(array('http://', 'https://'), ' ', $statrow['top_url']);
             $this->template->assign_vars(array('S_STATS_HOSTS' => true));
             break;
         case 'online':
             if (!$statrow['top_id'] || !$statrow['top_online']) {
                 trigger_error('TOP_NOT');
             }
             $this->rating->view_stat_online($statrow['top_id'], $statrow['top_online']);
             $page_title = $this->user->lang['TOP_ONLINE'] . str_replace(array('http://', 'https://'), ' ', $statrow['top_url']);
             $this->template->assign_vars(array('S_STATS_ONLINE' => true));
             break;
         case 'click':
             if (!$statrow['top_id'] || !$statrow['top_in'] && !$statrow['top_out']) {
                 trigger_error('TOP_NOT');
             }
             $top_count = $statrow['top_in'] + $statrow['top_out'];
             $this->rating->view_stat_click($statrow['top_id'], $top_count);
             $page_title = $this->user->lang['TOP_OUT'] . str_replace(array('http://', 'https://'), ' ', $statrow['top_url']);
             $this->template->assign_vars(array('S_STATS_CLICK' => true));
             break;
         case 'country':
             if (!$statrow['top_id'] || !$statrow['top_in'] && !$statrow['top_out']) {
                 trigger_error('TOP_NOT');
             }
             $this->rating->view_country($statrow['top_id']);
             $page_title = $this->user->lang['TOP_COUNTRYS'] . str_replace(array('http://', 'https://'), ' ', $statrow['top_url']);
             $this->template->assign_vars(array('S_STATS_COUNTRY' => true));
             break;
         default:
             $page_title = $this->user->lang['STATISTICS'] . str_replace(array('http://', 'https://'), ' ', $statrow['top_url']);
             $catrow = $this->rating->view_cat($statrow['cat_id']);
             $description = $statrow['post_text'];
             strip_bbcode($description);
             $description = str_replace(array(""", "/", "\n", "\t", "\r"), ' ', $description);
             $this->template->assign_vars(array('DESCRIPTION' => $description, 'CAT_NAME' => $catrow[$statrow['cat_id']]['cat_title'], 'CAT_URL' => $this->helper->route("bb3top_rating_cat", array('cat_id' => $statrow['cat_id'])), 'S_STATS_DEFAULT' => true));
             break;
     }
     $this->template->assign_vars(array('U_STAT_DEFAULT' => $this->helper->route("bb3top_rating_stats", array('top_id' => $top_id)), 'U_STAT_HOSTS' => $this->helper->route("bb3top_rating_hosts", array('top_id' => $top_id)), 'U_STAT_ONLINE' => $this->helper->route("bb3top_rating_online", array('top_id' => $top_id)), 'U_STAT_CLICK' => $this->helper->route("bb3top_rating_click", array('top_id' => $top_id)), 'U_STAT_COUNTRY' => $this->helper->route("bb3top_rating_country", array('top_id' => $top_id)), 'U_CANONICAL' => $this->helper->route("bb3top_rating_stats", array('top_id' => $top_id), false, '', true)));
     $this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang['RATING'], 'U_VIEW_FORUM' => $this->helper->route("bb3top_rating_category")));
     $this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $page_title, 'U_VIEW_FORUM' => $this->helper->route("bb3top_rating_stats", array('top_id' => $top_id))));
     page_header($page_title);
     $this->template->set_filenames(array('body' => '@bb3top_rating/rating_stats.html'));
     page_footer();
 }
Example #2
0
 public function count_site_profile_user($event)
 {
     $member = $event['member'];
     $count = $this->rating->count_user_site($member['user_id']);
     $this->template->assign_vars(array('COUNT_SITE' => isset($count['count_site']) ? $count['count_site'] : 0, 'COUNT_SITE_TOP' => isset($count['site_url']) ? $count['site_url'] : ''));
 }