Файл: modules/albums/comments.php
Строк: 63
<?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';
$albums_id = abs(intval($_GET['id']));
$albums_t = $db->query("SELECT * FROM `albums_photo` WHERE `id` = '". $albums_id ."'")->fetch();
if(User::logged())
{
$db->query("UPDATE `notify` SET `read` = '1' WHERE `request_id` = '/albums/comments/".$albums_id."' AND `user_id` = '".User::Id()."' AND `type` = 'notify_comments_reply'");
$db->query("UPDATE `notify` SET `read` = '1' WHERE `request_id` = '/albums/comments/".$albums_id."' AND `user_id` = '".User::Id()."' AND `type` = 'notify_photo_reply'");
}
$title = _t('comments') .' - '._t('photo_albums');
include_header($title);
$tpl->div('title', _t('comments'));
$album = $db->query("SELECT * FROM `albums` WHERE `id` = '".$albums_t['album_id']."'")->fetch();
if (User::level() >= 6 or $album['user_id'] == User::Id() or $album['type'] == 0 or $album['type'] == 2 && $db->query("SELECT * FROM `friends` WHERE (`friend_id` = '". User::Id() ."' AND `user_id` = '". $album['user_id'] ."' OR `friend_id` = '". $album['user_id'] ."' AND `user_id` = '". User::Id() ."') AND `active` = '1'")->rowCount() > 0 or $album['type'] == 3 && $_SESSION['alb_'.$album['id']] == $album['password']) {
$tpl->div('post', '<img src="/cache/albums/thumbs/'. $albums_t['server_name'] .'.jpg" alt="" /><br />');
if(User::logged())
{
$tpl->div('menu', '<a href="/albums/add_comment?albums_id='. $albums_id .'">'. _t('add_comment') .'</a>');
}
$comments = new Comments('albums', $albums_id, '', '', 'albums_photo');
$comments->view();
} else {
if ($album['type'] == 1) Template::div('menu', _t('album_stop1'));
if ($album['type'] == 2) Template::div('menu', _t('album_stop2'));
if ($album['type'] == 3) {
echo '<div class="menu">
<form action="/albums/photo/'.abs(intval($_GET['id'])).'/?send" method="post">
'._t('album_stop3').':<br />
<input type="text" name="pass" maxlength="15" /><br/>
<input type="submit" name="send" value="'. _t('send') .'" />
</form></div>';
}
}
$tpl->div('block', NAV .' <a href="/albums/photo/'.$albums_id.'">'. _t('back') .'</a><br/>'. NAV .' <a href="/albums/">'. _t('photo_albums') .'</a><br/>' . HICO .' <a href="/">'. _t('home').'</a>');
include_footer();
?>