Файл: modules/albums/index.php
Строк: 50
<?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';
$title = _t('photo_albums');
include_header($title);
Template::div('title', $title);
if(User::logged())
{
$tpl->div('menu', img('photo-album.png') .'<a href="/albums/user/'. User::Id() .'/">'. _t('my_album') .'</a><br/>');
}
$tpl->div('menu', img('photo-album.png') .'<a href="/albums/album_list/">'. _t('all_albums') .'</a> ('.$db->query("SELECT * FROM `albums`")->rowCount().')<br/>');
$tpl->div('menu', img('photo-album.png') .'<a href="/albums/photo_list/">'. _t('all_photos') .'</a> ('.$db->query("SELECT ".(User::level() <= 6 ? "`albums_photo`.* FROM `albums` JOIN `albums_photo` ON `albums`.`id`=`albums_photo`.`album_id` WHERE `albums`.`type` != '1'" : "* FROM `albums_photo`"))->rowCount().') ');
Template::div('title', _t('late_photo'));
$late = $db->query("SELECT ".(User::level() <= 6 ? "`albums_photo`.* FROM `albums` LEFT JOIN `albums_photo` ON `albums`.`id`=`albums_photo`.`album_id` WHERE `albums`.`type` != '1'" : "* FROM `albums_photo`"))->rowCount();
$pages = new Paginator($late, $ames);
if($late == 0)
{
Template::div('post', _t('no_images'));
}
else
{
$albums = $db->query("SELECT ".(User::level() <= 6 ? "`albums_photo`.* FROM `albums` JOIN `albums_photo` ON `albums`.`id`=`albums_photo`.`album_id` WHERE `albums`.`type` != '1' ORDER BY `albums_photo`.`id`" : "* FROM `albums_photo` ORDER BY `id`")." DESC LIMIT 3");
foreach($albums as $album)
{
$albums = $db->query("SELECT * FROM `albums` WHERE `id` = '".$album['album_id']."'")->fetch();
if ($album['user_id'] != User::Id() && $albums['type'] == 3 or $albums['type'] == 2 && $db->query("SELECT * FROM `friends` WHERE (`friend_id` = '". User::Id() ."' AND `user_id` = '". $albums['user_id'] ."' OR `friend_id` = '". $albums['user_id'] ."' AND `user_id` = '". User::Id() ."') AND `active` = '1'")->rowCount() == 0)
{
/* echo '<div class="post">';
echo '<a href="/albums/photo/'.$album['id'].'">'.img('album_stop.jpg').'</a><br />
<b>'._t('author').'</b>: '.nick($album['user_id'], '', true).' ('.rtime($album['time']).')<br/>';
echo '</div>';
*/
}
else
{
echo '<div class="post">';
echo '<a href="/albums/photo/'.$album['id'].'"><img src="/cache/albums/thumbs/'.$album['server_name'].'.jpg" alt="" /></a><br />
<b>'._t('author').'</b>: '.nick($album['user_id'], '', true).' ('.rtime($album['time']).')<br/>
<a href="/albums/comments/'.$album['id'].'">'._t('comments').'</a> ['.$db->query("SELECT * FROM `albums_comms` WHERE `albums_id` = '".$album['id']."'")->rowCount().']';
echo '</div>';
}
}
}
echo '<div class="block">
'.HICO.' <a href="/">'._t('home').'</a>
</div>';
include_footer();
?>