Файл: modules/albums/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_photo_albums';
if(isset($_GET['id']))
{
$title = _t('album_of_user').' '.tnick(num($_GET['id']));
$id = num($_GET['id']);
}
else
{
redirect('/album');
}
if(User::profile('name', $id) == false)
{
redirect('/albums');
}
include_header($title);
Template::div('title', $title);
$album_r = $db->query("SELECT * FROM `albums` WHERE `user_id` = '$id'")->rowCount();
$pages = new Paginator($album_r, $ames);
if($album_r == 0)
{
Template::div('post', _t('no_albums'));
}
else
{
$albums = $db->query("SELECT * FROM `albums` WHERE `user_id` = '$id' ORDER BY id DESC LIMIT $start, $ames");
foreach($albums as $album)
{
echo'<div class="post">';
echo img('photo-album.png');
echo '
<a href="/albums/album/'.$album['id'].'">'.$album['name'].'</a> ('.$db->query("SELECT * FROM `albums_photo` WHERE `album_id` = '".$album['id']."'")->rowCount().')
'.($album['user_id'] == User::Id() || User::level() == 2 || User::level() >=6 ? '[ <a href="/albums/edit_album/'.$album['id'].'">'.img('edit.png').'</a> | <a href="/albums/delete_album/'.$album['id'].'">'.img('delete.png').'</a> ]' : NULL).'
'.(!empty($album['description']) ? '<br/><small>'.$album['description'].'</small>' : null).'</div>';
}
$pages->view();
}
echo '<div class="block">
'.(User::logged() && User::Id() == $id ? NAV.' <a href="/albums/add">'._t('add_album').'</a><br/>' : null)
. NAV.' <a href="/albums">'. _t('photo_albums').'</a><br/>'
.HICO.' <a href="/">'._t('home').'</a>
</div>';
include_footer();