Файл: modules/blog/user.php
Строк: 45
<?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_blogs';
if(isset($_GET['id']))
{
$title = _t('blog_of_user').' '.tnick(num($_GET['id']));
$id = num($_GET['id']);
}
else
{
redirect('/blog');
}
if(User::profile('name', $id) == false)
{
redirect('/blog');
}
include_header($title);
Template::div('title', $title);
$blog_r = $db->query("SELECT * FROM `blogs` WHERE `user_id` = '$id'")->rowCount();
$pages = new Paginator($blog_r, $ames);
if($blog_r == 0)
{
Template::div('post', _t('no_notes'));
}
else
{
$blogs = $db->query("SELECT * FROM `blogs` WHERE `user_id` = '$id' ORDER BY time DESC LIMIT $start, $ames");
foreach($blogs as $blog)
{
echo '<div class="post">
<a href="/blog/note/'.$blog['id'].'"><b>'.$blog['name'].'</b></a> ('.rtime($blog['time']).')<br/>
'.mb_substr($blog['text'], 0, 300).'...<br/>
'._t('blog_tags').': ';
$tags = explode(',', $blog['tags']);
foreach($tags as $tag)
{
$lastTag = $tags[count($tags)-1];
if($tag == $lastTag)
{
echo '<a href="/blog/tag?id='.trim($tag).'">'.trim($tag).'</a>';
}
else
{
echo '<a href="/blog/tag?id='.trim($tag).'">'.trim($tag).'</a>, ';
}
}
echo '<br/>
<a href="/blog/comments/'.$blog['id'].'">'._t('comments').'</a> ['.$db->query("SELECT * FROM `blog_comms` WHERE `blog_id` = '".$blog['id']."'")->rowCount().']
</div>';
}
$pages->view();
}
echo '<div class="block">
'. NAV .' <a href="/blog/tag">'._t('search').'</a><br/>
'.(User::logged() && User::Id() == $id ? NAV.' <a href="/blog/write">'._t('write_note').'</a><br/>' : null)
. NAV.' <a href="/blog">'. _t('blogs').'</a><br/>'
.HICO.' <a href="/">'._t('home').'</a>
</div>';
include_footer();