Вход Регистрация
Файл: modules/user/activity.php
Строк: 103
<?php 
/**
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) 2013, Taras Chornyi, Sergiy Mazurenko, Ivan Kotliar
 * @link          http://perf-engine.net
 * @package       PerfEngine
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
$locate = 'in_profile';
if(!isset(
$_GET['id']) || $db->query("SELECT * FROM `users` WHERE `id` = '". num($_GET['id']) ."'")->rowCount() != 1)
{
    
NotFound();
}

$id = num($_GET['id']);

include_header(_t('User activity') .' - '. tnick($id));
switch(@
$_GET['action'])
{
    case 
'posts':
        
Template::div('title', _t('user_posts').' - '. _t('User activity') .' - '. tnick($id));
        
$posts_r = $db->query("SELECT * FROM `forum_pt` WHERE `user_id` = '". $id ."'")->rowCount();
        
$pages = new Paginator($posts_r, $ames);
        
        if(
$posts_r == 0)
        {
            
Template::div('error', _t('no_posts'));
        }
        else
        {
            
$posts = $db->query("SELECT * FROM `forum_pt` WHERE `user_id` = '$id' ORDER BY time DESC LIMIT $start, $ames");
            foreach(
$posts as $post)
            {
                
Template::div('post', output($post['text']).'<br/>
                <small>[<a href="/forum/topic/'
.$post['topic_id'].'?page=end">'. $db->query("SELECT name FROM `forum_t` WHERE `id` = '". $post['topic_id'] ."'")->fetchColumn().'</a>/'. rtime($post['time']) .']</small>
                '
);
            }
            
$pages->view('&');
        }
        
Template::div('block', img('back.png').' <a href="/user/activity/'.$id.'?">'. _t('back') .'</a><br/>
        '
. img('back.png').' <a href="/user/profile/'.$id.'">'. tnick($id) .'</a><br/>
        '
. HICO .' <a href="/">'. _t('home') .'</a>');
        
include_footer();
    break;
    
    case 
'topics':
        
Template::div('title', _t('user_topics').' - '. _t('User activity') .' - '. tnick($id));
        
$topics_r = $db->query("SELECT * FROM `forum_pt` WHERE `cat_id` != '0' AND `user_id` = '". $id ."'")->rowCount();
        
$pages = new Paginator($topics_r, $ames);
        
        if(
$topics_r == 0)
        {
            
Template::div('error', _t('no_topics'));
        }
        else
        {
            
$topics = $db->query("SELECT * FROM `forum_pt` WHERE `cat_id` != '0' AND `user_id` = '". $id ."' ORDER BY time DESC LIMIT $start, $ames");
            foreach(
$topics as $topic)
            {
                
Template::div('post', img('topic.png').' <a href="/forum/topic/'.$topic['topic_id'].'">'. $db->query("SELECT name FROM `forum_t` WHERE `id` = '". $topic['topic_id'] ."'")->fetchColumn().'</a> ('.$db->query("SELECT * FROM `forum_pt` WHERE `topic_id` = '". $topic['topic_id'] ."'")->rowCount().')');
            }
            
$pages->view('&');
        }
        
Template::div('block', img('back.png').' <a href="/user/activity/'.$id.'?">'. _t('back') .'</a><br/>
        '
. img('back.png').' <a href="/user/profile/'.$id.'">'. tnick($id) .'</a><br/>
        '
. HICO .' <a href="/">'. _t('home') .'</a>');
        
include_footer();
    break;
    
    case 
'files':
        
Template::div('title', _t('user_files').' - '. _t('User activity') .' - '. tnick($id));
        
$files_r = $db->query("SELECT * FROM `downloads_files` WHERE `user_id` = '". $id ."'")->rowCount();
        
$pages = new Paginator($files_r, $ames);
        
        if(
$files_r == 0)
        {
            
Template::div('error', _t('no_files'));
        }
        else
        {
            
$files = $db->query("SELECT * FROM `downloads_files` WHERE `user_id` = '". $id ."' ORDER BY time DESC LIMIT $start, $ames");
            foreach(
$files as $file)
            {
                
Template::div('post', dlext($file['ext']).' <a href="/downloads/file/'.$file['id'].'">'.$file['name'].'.'.$file['ext'].'</a> ('.size($file['size']).')');
            }
            
$pages->view('&');
        }
        
Template::div('block', img('back.png').' <a href="/user/activity/'.$id.'?">'. _t('back') .'</a><br/>
        '
. img('back.png').' <a href="/user/profile/'.$id.'">'. tnick($id) .'</a><br/>
        '
. HICO .' <a href="/">'. _t('home') .'</a>');
        
include_footer();
    break;
    
    default:
        
$user_comments = $db->query("SELECT * FROM `blog_comms` WHERE `user_id` = '". abs(intval($id)) ."'")->rowCount() + $db->query("SELECT * FROM `news_comms` WHERE `user_id` = '". abs(intval($id)) ."'")->rowCount() + $db->query("SELECT * FROM `downloads_comms` WHERE `user_id` = '". abs(intval($id)) ."'")->rowCount();
        
$user_posts    = $db->query("SELECT * FROM `forum_pt` WHERE `user_id` = '". abs(intval($id)) ."'")->rowCount();
        
$user_topics = $db->query("SELECT * FROM `forum_pt` WHERE `cat_id` != '0' AND `user_id` = '". abs(intval($id)) ."'")->rowCount();
        
$user_files    = $db->query("SELECT * FROM `downloads_files` WHERE `user_id` = '". abs(intval($id)) ."'")->rowCount();
        
        
Template::div('title', _t('user_activity').' - '. tnick($id));
        echo 
'<div class="menu">'.img('u_act.png').' <a href="/user/activity/'.$id.'?action=posts">'. _t('user_posts') .'</a>: '.$user_posts.'</div>
        <div class="menu">'
.img('u_act.png').' <a href="/user/activity/'.$id.'?action=topics">'. _t('user_topics') .'</a>: '.$user_topics.'</div>
        <div class="menu">'
.img('u_act.png').' <a href="/user/activity/'.$id.'?action=files">'. _t('user_files') .'</a>: '. $user_files .'</div>
        <div class="menu">'
.img('u_act.png').' '. _t('user_comments') .': '. $user_comments .'</div>';
        
        
Template::div('block', img('back.png').' <a href="/user/profile/'.$id.'">'. _t('back') .'</a><br/>
        '
. HICO .' <a href="/">'. _t('home') .'</a>');
        
include_footer();
    break;
}
Онлайн: 2
Реклама