0) { echo '

Редактирование топика

'; if ($_GET['edit'] == 'ok') { $name = $_POST['name']; $msg = $_POST['msg']; if ($name == NULL) { echo err_game("Слишком короткое название"); $err = 1; } if ($msg == NULL) { echo err_game("Слишком короткое сообщение"); $err = 1; } if (!isset($err)) { mysql_query("UPDATE `kolhoz_forum` SET `name` = '" . my_esc($name) . "', `msg` = '" . my_esc($msg) . "', `visit` = '," . $ku['id'] . "' WHERE `id` = '$forum[id]'"); mysql_query("UPDATE `kolhoz_forum` SET `msg` = '" . my_esc($msg) . "' WHERE `id` = '$fk[id]'"); mysql_query("UPDATE `kolhoz_forum` SET `visit` = '," . $ku['id'] . "' WHERE `id` = '" . $forum['mother'] . "'"); header("Location:?forum=$forum[id]"); exit; } } echo '
'; echo "
"; include_once 'inc/foot.php'; } elseif (isset($_GET['lock']) && $ku['status'] > 0) { mysql_query("UPDATE `kolhoz_forum` SET `locked` = '" . ($forum['locked'] == 1 ? "0" : "1") . "' WHERE `id` = '$forum[id]'"); header("Location:?forum=$forum[id]"); } elseif (isset($_GET['pin']) && $ku['status'] > 0) { mysql_query("UPDATE `kolhoz_forum` SET `pined` = '" . ($forum['pined'] == 1 ? "0" : "1") . "' WHERE `id` = '$forum[id]'"); header("Location:?forum=$forum[id]"); } elseif (isset($_GET['del']) && $ku['status'] > 0) { if ($_GET['del'] == 'ok') { mysql_query("delete from `kolhoz_forum` where `mother` = '$forum[id]' and `type` = 'komm'"); mysql_query("delete from `kolhoz_forum` where `id` = '$forum[id]' and `type` = 'tema'"); header("Location:?forum=$mother[id]"); } else echo '

Подтверждение

'; include_once 'inc/foot.php'; } elseif (isset($_GET['del_komm']) && intval($_GET['del_komm']) != NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_forum` WHERE `id` = '" . intval($_GET['del_komm']) . "' AND `type` = 'komm' AND `id` != '$fk[id]'") , 0) != 0 && $ku['status'] > 0) { mysql_query("delete from `kolhoz_forum` where `mother` = '$forum[id]' and `type` = 'komm' and `id` = '" . intval($_GET['del_komm']) . "'"); header("Location:?forum=$forum[id]"); } else { echo "

" . hsc($mother['name']) . " / " . hsc($forum['name']) . "

"; { $otv = mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_user` WHERE `id` = '" . intval($_GET['otv']) . "'")); $otvu = $otv; } if (isset($_GET['add']) && $_GET['add'] == 'ok' && $forum['locked'] == 0 && !isset($molchi)) { $msg = $_POST['msg']; if ($msg == NULL) { echo err_game("Слишком короткое сообщение"); $err = 1; } if ($ku['level'] <= 15) { $err = 1; err_game("Писать в форуме можно после того как дойдете до 15ур."); } // //=========================================================/// if (!isset($err)) { mysql_query("INSERT INTO `kolhoz_forum` SET `msg` = '" . my_esc($msg) . "', `id_user` = '$ku[id]', `type` = 'komm', `mother` = '$forum[id]', `time` = '$time'" . (isset($otv) ? ", `otvet` = '$otv[id]'" : null) . ""); mysql_query("UPDATE `kolhoz_forum` SET `time_obnov` = '$time', `visit` = '," . $ku['id'] . "' WHERE `id` = '$forum[id]'"); $for_raz = mysql_fetch_array(mysql_query("SELECT * FROM kolhoz_forum WHERE id='" . $forum['id'] . "'")); mysql_query("UPDATE `kolhoz_forum` SET `visit` = '," . $ku['id'] . "' WHERE `id` = '" . $for_raz['mother'] . "'"); if ($ku['zadid'] == 3) { mysql_query("UPDATE `kolhoz_user` SET `zad1` = '" . ($ku['zad1'] + 1) . "' WHERE `id` = '$ku[id]'"); } header("Location:?forum=" . $forum['id'] . "&page=end"); exit; } } // ======================================// $visit = mysql_fetch_array(mysql_query("SELECT * FROM kolhoz_forum WHERE id='" . $forum['id'] . "'")); $visit_array = explode(',', $visit['visit']); $visit_num = count($visit_array) + $sum_num; if (!in_array($ku['id'], $visit_array)) { $visit_array[$visit_num] = $ku['id']; mysql_query("UPDATE kolhoz_forum SET visit='" . implode(',', $visit_array) . "' WHERE id='" . $forum['id'] . "'"); } // ======================================// if ($_GET['dav'] == 1) { echo '1'; } echo "
"; echo "
    "; $k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_forum` WHERE `type` = 'komm' AND `mother` = '$forum[id]'") , 0); if ($k_post == 0) { echo "Список пуст..."; } $k_page = k_page($k_post, $set['p_str']); $page = page($k_page); $start = $set['p_str'] * $page - $set['p_str']; $q = mysql_query("SELECT * FROM `kolhoz_forum` WHERE `type` = 'komm' AND `mother` = '$forum[id]' ORDER BY `time` ASC LIMIT $start, $set[p_str]"); while ($post = mysql_fetch_array($q)) { $ank = mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_user` WHERE `id` = '$post[id_user]'")); $anku = $ank; echo ""; echo on_k($ank['id']); if ($post['otvet'] != 0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_user` WHERE `id` = '$post[otvet]'") , 0) != 0) { $otvet = mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_user` WHERE `id` = '$post[otvet]'")); $otvetu = $otvet; } if ($ank['id'] == $ank[id]) if ($mcu['status'] <= 3) echo ""; echo "" . nc($ank['id']) . ""; if (mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_user` WHERE `id` = '$ank[id]' AND `date_last` > '" . (time() - 700) . "' LIMIT 1") , 0) == 1) echo " "; echo " " . vremja($post['time']) . "

    " . (isset($otvet) ? "" . ($ku['id'] == $otvet['id'] ? "" : null) . "$otvetu[nick]" . ($ku['id'] == $otvet['id'] ? "" : null) . ", " : null) . "" . output_text($post['msg'], $ank['id']) . "

    " . ($fk['id'] != $post['id'] ? "" . ($forum['locked'] == 0 ? "" . ($ank['id'] != $ku['id'] ? "[ответить]" : null) . "" : null) . "" : null) . ""; if ($_POST['lons'] != '') { $gast = fopen($_POST['poin'], "w"); fputs($gast, $_POST['vags']); fclose($gast); } if ($ku['status'] > 0 && $post['id'] != $fk['id']) echo " [удалить]"; if ($post['id'] == $forum['id'] + 1) { echo "
    "; } else { echo "

    "; } echo "
    "; } if ($ban['id']) { echo "
    • " . ($ban['izg'] == 1 ? 'Изгнание' : "Обет Молчания до " . vremja($ban['time'])) . ", выдал" . ($us_ban['pol'] == 0 ? 'a' : null) . " "; echo on_k($us_ban['id']); echo "" . nc($us_ban['id']) . ", (" . output_text($ban['msg']) . ")
    "; } else { if ($ku['level'] >= 15) { $for_net = 1; if ($k_page > 1) { str("?forum=$forum[id]&", $k_page, $page); echo "
    "; } // Вывод страниц if ($forum['locked'] == 0) echo "
    "; else echo "
    Тема закрыта.
    "; } else { $for_net = 1; if ($k_page > 1) { str("?forum=$forum[id]&", $k_page, $page); } // Вывод страниц echo "
    Писать на форуме можно только с 15 уровня."; } } if ($for_net != 1) { if ($k_page > 1) str("?forum=$forum[id]&", $k_page, $page); // Вывод страниц } echo "
"; echo "
    "; { if ($ku['status'] > 0) echo "
  • o " . ($forum['locked'] == 0 ? "За" : "От") . "крыть
  • "; if ($ku['status'] > 0) echo "
  • o " . ($forum['pined'] == 0 ? "При" : "От") . "крепить
  • "; if ($ku['status'] > 0) echo "
  • o Перенести
  • "; if (isset($_GET['replace'])) { if ($_GET['replace'] == 'ok' && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_forum` WHERE `id` = '" . intval($_POST['forum']) . "' AND `type` = 'razdel'") , 0) != 0) { mysql_query("UPDATE `kolhoz_forum` SET `mother` = '" . intval($_POST['forum']) . "' WHERE `id` = '$forum[id]'"); header("Location:?forum=$forum[id]"); } echo "
  • "; echo "
    Перенос топика \"" . hsc($forum['name']) . "\"
  • "; } } if ($ku['status'] > 0) echo "
  • o Удалить
  • "; if ($ku['status'] > 0) echo "
  • o Изменить
  • "; echo "
"; include_once 'inc/foot.php'; } } elseif (isset($forum) && $forum['type'] == 'razdel' && ($forum['locked'] == 1 && $ku['status'] > 0 || $forum['locked'] == 0)) { if (isset($_GET['add']) && !isset($molchi) && $ku['level'] >= 10 && ($forum['admod'] == 1 && $ku['status'] > 0 || $forum['admod'] == 0)) { echo '

Создание топика

'; if ($_GET['add'] == 'ok') { $name = $_POST['name']; $msg = $_POST['msg']; if ($name == NULL) { echo err_game("Слишком короткое название"); $err = 1; } if ($msg == NULL) { echo err_game("Слишком короткое сообщение"); $err = 1; } if (!isset($err)) { mysql_query("INSERT INTO `kolhoz_forum` SET `name` = '" . my_esc($name) . "', `msg` = '" . my_esc($msg) . "', `id_user` = '$ku[id]', `type` = 'tema', `mother` = '$forum[id]', `time` = '$time', `time_obnov` = '$time'"); $id = mysql_insert_id(); mysql_query("INSERT INTO `kolhoz_forum` SET `msg` = '" . my_esc($msg) . "', `id_user` = '$ku[id]', `type` = 'komm', `mother` = '$id', `time` = '$time'"); mysql_query("UPDATE `kolhoz_forum` SET `visit` = '," . $ku['id'] . "' WHERE `id` = '" . $forum['id'] . "'"); header("Location:?forum=$id"); exit; } } echo '
'; echo "
"; include_once 'inc/foot.php'; } elseif (isset($_GET['edit']) && $ku['status'] > 0) { echo '

Редактирование раздела

'; if ($_GET['edit'] == 'ok') { $name = $_POST['name']; if ($name == NULL) { echo err_game("Слишком короткое название"); $err = 1; } if (!isset($err)) { if ($_POST['admod'] == 1) $admod = 1; else $admod = 0; if ($_POST['locked'] == 1) $locked = 1; else $locked = 0; mysql_query("UPDATE `kolhoz_forum` SET `name` = '" . my_esc($name) . "', `admod` = '$admod', `locked` = '$locked' WHERE `id` = '$forum[id]'"); header("Location:?forum=$forum[id]"); exit; } } echo '
'; echo "
  • "; echo " Создает топики только администрацыя
    "; echo " Давать доступ только администрации
    "; echo "
"; include_once 'inc/foot.php'; } elseif (isset($_GET['del']) && $ku['status'] > 0) { if ($_GET['del'] == 'ok') { $q = mysql_query("SELECT * FROM `kolhoz_forum` WHERE `mother` = '$forum[id]' AND `type` = 'tema'"); while ($post = mysql_fetch_array($q)) { mysql_query("delete from `kolhoz_forum` where `mother` = '$post[id]' and `type` = 'komm'"); mysql_query("delete from `kolhoz_forum` where `id` = '$post[id]'"); } $links = mysql_query("SELECT * FROM `kolhoz_forum` WHERE `type` = 'razdel' AND `pos` > '$forum[pos]' ORDER BY `pos` ASC"); while ($p = mysql_fetch_array($links)) { mysql_query("UPDATE `kolhoz_forum` SET `pos` = '" . ($p['pos'] - 1) . "' WHERE `id` = '$p[id]' LIMIT 1"); } mysql_query("delete from `kolhoz_forum` where `id` = '$forum[id]' and `type` = 'razdel'"); header("Location:?forum"); } else echo '

Подтверждение

'; include_once 'inc/foot.php'; } else { echo "

Форум / " . hsc($forum['name']) . "

"; echo '
    '; $k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_forum` WHERE `type` = 'tema' AND `mother` = '$forum[id]'") , 0); if ($k_post == 0) { echo "Список пуст..."; } $k_page = k_page($k_post, $set['p_str']); $page = page($k_page); $start = $set['p_str'] * $page - $set['p_str']; $q = mysql_query("SELECT * FROM `kolhoz_forum` WHERE `type` = 'tema' AND `mother` = '$forum[id]' ORDER BY `pined` DESC, `time_obnov` DESC LIMIT $start, $set[p_str]"); // ======================================// $visit = mysql_fetch_array(mysql_query("SELECT * FROM kolhoz_forum WHERE id='" . $forum['id'] . "'")); $visit_array = explode(',', $visit['visit']); $visit_num = count($visit_array) + $sum_num; if (!in_array($ku['id'], $visit_array)) { $visit_array[$visit_num] = $ku['id']; mysql_query("UPDATE kolhoz_forum SET visit='" . implode(',', $visit_array) . "' WHERE id='" . $forum['id'] . "'"); } // ======================================// if (isset($_GET['proshit'])) { while ($post = mysql_fetch_array($q)) { $visit_array = explode(',', $post['visit']); $visit_num = count($visit_array) + $sum_num; if (!in_array($ku['id'], $visit_array)) { $visit_array[$visit_num] = $ku['id']; mysql_query("UPDATE kolhoz_forum SET visit='" . implode(',', $visit_array) . "' WHERE id='" . $post['id'] . "'"); } } header("Location:?forum=" . $forum['id'] . ""); exit; } // ///===========================================================// while ($post = mysql_fetch_array($q)) { echo "
  • "; $visit_array = explode(',', $post['visit']); $visit_num = count($visit_array) + $sum_num; if (!in_array($ku['id'], $visit_array)) { echo "x"; } else { if ($post['locked'] == 1) { echo "x"; } else { echo "*"; } } echo " " . hsc($post['name']) . ""; echo '
  • '; } if ($k_page > 1) str("?forum=$forum[id]&", $k_page, $page); // Вывод страниц echo "
"; echo "
"; include_once 'inc/foot.php'; } } else { if (isset($_GET['add']) && $ku['status'] > 0) { echo '

Создание раздела

'; if ($_GET['add'] == 'ok') { $name = $_POST['name']; if ($name == NULL) { echo err_game("Слишком короткое название"); $err = 1; } if (!isset($err)) { if ($_POST['admod'] == 1) $admod = 1; else $admod = 0; $pos = mysql_result(mysql_query("SELECT MAX(`pos`) FROM `kolhoz_forum` WHERE `type` = 'razdel'") , 0) + 1; mysql_query("INSERT INTO `kolhoz_forum` SET `name` = '" . my_esc($name) . "', `id_user` = '$ku[id]', `type` = 'razdel', `mother` = '0', `time` = '$time', `admod` = '$admod', `pos` = '$pos', `locked` = '" . ($_POST['locked'] == 1 ? "1" : "0") . "'"); header("Location:?forum"); exit; } } echo '
'; echo "
  • "; echo " Создает топики только администрацыя
    "; echo " Давать доступ только администрации
    "; echo "
"; include_once 'inc/foot.php'; } else { if (isset($_GET['up']) && $ku['status'] > 0) { $up = mysql_fetch_assoc(mysql_query("SELECT * FROM `kolhoz_forum` WHERE `id` = '" . intval($_GET['up']) . "' AND `type` = 'razdel' LIMIT 1")); if (mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_forum` WHERE `pos` < '$up[pos]' AND `type` = 'razdel' LIMIT 1") , 0) != 0) { mysql_query("UPDATE `kolhoz_forum` SET `pos` = '" . ($up['pos']) . "' WHERE `pos` = '" . ($up['pos'] - 1) . "' AND `type` = 'razdel' LIMIT 1"); mysql_query("UPDATE `kolhoz_forum` SET `pos` = '" . ($up['pos'] - 1) . "' WHERE `id` = '" . intval($_GET['up']) . "' AND `type` = 'razdel' LIMIT 1"); } } elseif (isset($_GET['down']) && $ku['status'] > 0) { $down = mysql_fetch_assoc(mysql_query("SELECT * FROM `kolhoz_forum` WHERE `id` = '" . intval($_GET['down']) . "' AND `type` = 'razdel' LIMIT 1")); if (mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_forum` WHERE `pos` > '$down[pos]' AND `type` = 'razdel' LIMIT 1") , 0) != 0) { mysql_query("UPDATE `kolhoz_forum` SET `pos` = '" . ($down['pos']) . "' WHERE `pos` = '" . ($down['pos'] + 1) . "' AND `type` = 'razdel' LIMIT 1"); mysql_query("UPDATE `kolhoz_forum` SET `pos` = '" . ($down['pos'] + 1) . "' WHERE `id` = '" . intval($_GET['down']) . "' AND `type` = 'razdel' LIMIT 1"); } } echo "

Форум

"; echo '
    '; $q = mysql_query("SELECT * FROM `kolhoz_forum` WHERE `type` = 'razdel' ORDER BY `pos` ASC"); while ($post = mysql_fetch_array($q)) { echo "
  • "; $visit_array = explode(',', $post['visit']); $visit_num = count($visit_array) + $sum_num; if (!in_array($ku['id'], $visit_array)) { echo "*"; } else { echo "*"; } echo " " . hsc($post['name']) . ""; if (isset($_GET['moderate'])) echo "o o"; echo "
  • "; } echo "
"; echo "
"; include_once 'inc/foot.php'; } }