Файл: vsime.com/fotos/inc/foto_komm_form.php
Строк: 119
<?
if ($count_komm > 0)
{
echo "<div class='list_or'>n";
echo "<img src='/i/site/message.png' /> ".sklon_text($count_komm, array('комментарий', 'комментария', 'комментариев'))."n";
echo "</div>n";
}
$count_results = mysqli_result("SELECT COUNT(*) FROM `foto_komm` WHERE$skp `id_foto` = '$foto[id]'");
$count_pages = count_pages($count_results);
$page = page();
$start = start_pages();
if( isset($user) && $user['id']==$ank['id'])
{
mysqli_query($dbi, "UPDATE `foto` SET `a_time` = '$time' WHERE `id` = '$foto[id]'");
if (mysqli_result("SELECT COUNT(*) FROM `foto_komm` WHERE `id_foto` = '$foto[id]' AND `id_user` != '$user[id]' AND `time` > '$foto[a_time]'"))
{
locon(" ?foto=$foto[id]&page=$page");
}
}
if (isset($user) && mysqli_result("SELECT COUNT(*) FROM `journal` WHERE `id_kont` = '$user[id]' AND `cat` = 'fotos' AND `type` = 'komm' AND `id_object2` = '$foto[id]' AND `read` = '0'"))
{
mysqli_query($dbi, "UPDATE `journal` SET `read` = '1', `last_time` = '$time' WHERE `id_kont` = '$user[id]' AND `cat` = 'fotos' AND `type` = 'komm' AND `id_object2` = '$foto[id]' AND `read` = '0'");
locon(" ?foto=$foto[id]&page=$page");
}
if(isset($mdelete))
{
echo "<form method='post' class='multi'>n";
}
if (!$count_results)
{
echo "<div class='list_empty'>n";
echo "Нет комментариевn";
echo "</div>n";
}
?>
<script>
function toggle(id) {
var quote = document.getElementById('quote-' + id);
var state = quote.style.display;
if(state == 'none') {
quote.style.display = 'block';
} else {
quote.style.display = 'none';
}
}
</script>
<?
$query = mysqli_query($dbi, "SELECT * FROM `foto_komm` WHERE$skp `id_foto` = '$foto[id]' ORDER BY `time` DESC LIMIT $start, $config[rop]");
while ($post = mysqli_fetch_array($query))
{
$ank2=profile($post['id_user']);
echo "<div class='list'>n";
echo "<div class='left'>n";
show_avatar($ank2['id'], 'small');
echo "</div>n";
echo "<div class='overfl_hid'>n";
echo profile_icon($ank2['id']).profile_nick($ank2['id'], 1).profile_medal($ank2['id']);
echo " (".vremja($post['time']).")n";
echo "<span class='right'>n";
if(isset($mdelete))echo "<input type='checkbox' name='mdelelte_komm_$post[id]' value='1'>n";
else
{
if ($ank['id']==$user['id'] && isset($user) || isset($moderate_foto) && $user['level'] > $ank['level'])echo " <a href='?foto=$foto[id]&delete=$post[id]&mdp=$mdp'>$config[code_delete]</a>n";
if(isset($user) && $user['id']==$ank2['id'] && $post['time']>time()-600)echo "<a href='?foto=$foto[id]&edit=$post[id]'>$config[code_edit]</a>n";
}
echo "</span>n";
echo "<br />n";
if($post['id_reply']!=0 && mysqli_result("SELECT COUNT(*) FROM `user` WHERE `id` = '$post[id_reply]'"))
{
echo "<div id='quote-$post[id]' class='quote' style='display: none;'>n";
echo output_text($post['reply_msg'], $post['id_reply'])."n";
echo "</div>n";
}
if($post['sk']==1 && $post['sk_user']!=0 && mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `user` WHERE `id` = '$post[sk_user]'")))
{
$sku=profile($post['sk_user']);
echo "<font color='red'>Скрыл".($sku['pol']==0?'a':null)." $sku[nick]</font><br />";
}
if($post['id_reply']!=0 && mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `user` WHERE `id` = '$post[id_reply]'")))
{
$ru=profile($post['id_reply']);
echo "<a href='#' onclick='javascript:toggle("$post[id]"); return false;'>$ru[nick]</a>, ";
}
echo output_text($post['msg'], $ank2['id']);
echo "<br />n";
if ($ank2['id']!=0)echo "<a href='?foto=$foto[id]&reply=$post[id]'>Ответить</a>n";
echo "</div>n";
echo "<div class='clear'></div>n";
echo "</div>n";
}
if(isset($mdelete))
{
echo "Выбранные: <input type='submit' name='m_d_okey' value='Удалить'> <input type='submit' name='m_sk_okey' value='Скрыть/Показать'> <a href='?foto=$foto[id]&page=$page'>Отмена</a>n";
echo "<input type='hidden' name='mdp' value='$mdp' />n";
echo "</form>n";
}
pages_show("?foto=$foto[id]".(isset($mdelete)?"&mdelete=1":null)."&"); // Вывод страниц
show_errors();
if (isset($user))
{
input_bbs();
echo "<div class=foot><form method='POST'>n";
echo "<textarea name='msg' id='textarea' rows='5' cols='17' style='width: 95%' placeholder='Введите комментарий...'></textarea><br />n";
echo "<input type='submit' name='submited' value='Добавить' />n";
echo "<input type='hidden' name='mdp' value='$mdp' /></div>n";
echo "</form>n";
} else echo "<div class='main'>$config[code_add] <a href='/login.php'>Добавить комментарий</a></div>n";
if($ank['id']==$user['id'] && isset($user) || isset($moderate_foto) && $user['level'] > $ank['level'])
{
echo "<div class='mod_grad'>n";
if ($config['web']==false)
{
echo "$config[code_edit] <a href='?foto=$foto[id]&edit_foto'>Редактировать</a><br />n";
echo "$config[code_delete] <a href='?foto=$foto[id]&delete_foto'>Удалить</a><br />n";
}
echo "<img src='/i/site/move.png' /> <a href='?foto=$foto[id]&page=$page".(isset($mdelete)?NULL:"&mdelete=start")."'>".(isset($mdelete)?"Отмена":"Выбрать комментарии")."</a><br />n";
echo "</div>n";
}
?>