Файл: modules/albums/photo_list.php
Строк: 42
<?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('all_photos');
include_header($title);
Template::div('title', $title);
$album_r = $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();
$pages = new Paginator($album_r, $ames);
if($album_r == 0)
{
Template::div('post', _t('no_images'));
}
else
{
$photoss = $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 $start, $ames");
foreach($photoss as $photo)
{
echo '<div class="post">';
$albums = $db->query("SELECT * FROM `albums` WHERE `id` = '".$photo['album_id']."'")->fetch();
if ($photo['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 '<a href="/albums/photo/'.$photo['id'].'">'.img('album_stop.jpg').'</a><br />
<b>'._t('author').'</b>: '.nick($photo['user_id'], '', true).' ('.rtime($photo['time']).')<br/>';
} else {
echo '<a href="/albums/photo/'.$photo['id'].'"><img src="/cache/albums/thumbs/'.$photo['server_name'].'.jpg" alt="" /></a><br />
<b>'._t('author').'</b>: '.nick($photo['user_id'], '', true).' ('.rtime($photo['time']).')<br/>
<a href="/albums/comments/'.$photo['id'].'">'._t('comments').'</a> ['.$db->query("SELECT * FROM `albums_comms` WHERE `albums_id` = '".$photo['id']."'")->rowCount().']';
}
echo '</div>';
}
$pages->view();
}
echo '<div class="block">
'
. NAV.' <a href="/albums">'. _t('photo_albums').'</a><br/>'
.HICO.' <a href="/">'._t('home').'</a>
</div>';
include_footer();