Файл: vsime.com/files/inc/file_komm_form.php
Строк: 125
<?
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_num_rows(mysqli_query($dbi, "SELECT * FROM `files_komm` WHERE$skp `id_file` = '$file[id]'"));
$count_pages=count_pages($count_results);
$page=page();
$start=start_pages();
if (isset($user) && $user['id']==$ank['id']) {
mysqli_query($dbi, "UPDATE `files` SET `a_time` = '$time' WHERE `id` = '$file[id]'");
if (mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `files_komm` WHERE `id_file` = '$file[id]' AND `id_user` != '$user[id]' AND `time` > '$file[a_time]'"))!=0) {
locon(" ?file=$file[id]&page=$page");
}
}
if (mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `journal` WHERE `id_kont` = '$user[id]' AND `cat` = 'files' AND `type` = 'komm' AND `id_object2` = '$file[id]' AND `read` = '0'"))!=0) {
mysqli_query($dbi, "UPDATE `journal` SET `read` = '1', `last_time` = '$time' WHERE `id_kont` = '$user[id]' AND `cat` = 'files' AND `type` = 'komm' AND `id_object2` = '$file[id]' AND `read` = '0'");
locon(" ?file=$file[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 `files_komm` WHERE$skp `id_file` = '$file[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 (isset($user) && $ank['id']==$user['id'] || isset($moderate_files) && $user['level'] > $ank['level'])echo " <a href='?file=$file[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='?file=$file[id]&edit=$post[id]'>$config[code_edit]</a>n";
}
echo "</span>n";
echo "<br />n";
if ($post['id_reply']!=0 && mysqli_num_rows(mysqli_query($dbi, "SELECT * FROM `user` WHERE `id` = '$post[id_reply]'"))) {
echo "<div id='quote-$post[id]' style='display:none;' class='quote'>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 "<span class='spared'>Скрыл".pol_word($sku['id'], array('', 'a'))." $sku[nick]</span><br />n";
}
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='?file=$file[id]&reply=$post[id]'>Ответить</a>n";
echo "</div>n";
echo "<div class='clear'></div>n";
echo "</div>n";
}
if (isset($mdelete)) {
echo "<div class='mod_grad'>n";
echo "Выбранные: <input type='submit' name='m_d_okey' value='Удалить'> <input type='submit' name='m_sk_okey' value='Скрыть/Показать'> <a href='?file=$file[id]&page=$page'>Отмена</a>n";
echo "</div>n";
echo "<input type='hidden' name='mdp' value='$mdp' />n";
echo "</form>n";
}
pages_show("?file=$file[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' />n";
echo "</form></div>n";
} else echo "<div class='main'>$config[code_add] <a href='/login.php'>Добавить комментарий</a></div>n";
if (isset($user) && $ank['id']==$user['id'] || isset($moderate_files) && $user['level'] > $ank['level']) {
echo "<div class='mod_grad'>n";
if ($config['web']==false) {
echo "$config[code_edit] <a href='?file=$file[id]&edit_file'>Редактировать</a><br />n";
echo "$config[code_delete] <a href='?file=$file[id]&delete_file'>Удалить</a><br />n";
}
echo "<img src='/i/site/move.png' /> <a href='?file=$file[id]&page=$page".(isset($mdelete)?NULL:"&mdelete=start")."'>".(isset($mdelete)?"Отмена":"Выбрать комментарии")."</a><br />n";
echo "</div>n";
}
?>