Вернуться в форум

'; echo '
Непрочитанное
'; if (empty($_SESSION['uid'])) { if (isset($_GET['newup'])) { $_SESSION['uppost'] = 1; } if (isset($_GET['newdown'])) { $_SESSION['uppost'] = 0; } } if (!empty($_SESSION['uid'])) { $do = isset($_GET['do']) ? $_GET['do'] : ''; switch ($do) { case "razd": if (isset($_GET['okey'])) { echo "Сделано!
"; } if (isset($_POST['submit'])) { if (empty($_SESSION['uid'])) { echo "Только для авторизованных!
Назад
"; require_once ("../incfiles/end.php"); exit; } $rz = mysql_query("select `id` from `forum` where type='f';"); while ($rz1 = mysql_fetch_array($rz)) { $rz2[] = $rz1['id']; } if (isset($_POST['pf'])) { $q = mysql_query("select `id`, `refid` from `forum` where type='n' and `from`='" . $login . "';"); while ($q1 = mysql_fetch_array($q)) { if (in_array($q1['refid'], $_POST['pf'])) { mysql_query("delete from `forum` where `id`='" . $q1['id'] . "';"); } } foreach ($rz2 as $v) { if (!in_array($v, $_POST['pf'])) { $q2 = mysql_query("select `id` from `forum` where type='n' and `from`='" . $login . "' and refid='" . $v . "';"); $q3 = mysql_num_rows($q2); if ($q3 == 0) { mysql_query("INSERT INTO `forum` SET `refid`='" . intval($v) . "', `type`='n', `from`='" . $login . "' ;"); } } } } else { $rz = mysql_query("select `id` from `forum` where type='f';"); while ($rz3 = mysql_fetch_array($rz)) { $q2 = mysql_query("select `id` from `forum` where type='n' and `from`='" . $login . "' and refid='" . $rz3[id] . "';"); $q3 = mysql_num_rows($q2); if ($q3 == 0) { mysql_query("INSERT INTO `forum` SET `refid`='" . $rz3['id'] . "', `type`='n', `from`='" . $login . "' ;"); } } } header("Location: index.php?act=new&do=razd&okey"); } else { if (empty($_SESSION['uid'])) { echo "Только для авторизованных!
Назад
"; require_once ("../incfiles/end.php"); exit; } echo "Показывать темы только из подфорумов :
"; $q = mysql_query("select `id`, `text` from `forum` where type='f';"); while ($q1 = mysql_fetch_array($q)) { $q2 = mysql_query("select `id`, `text` from `forum` where type='n' and `from`='" . $login . "' and refid='" . $q1[id] . "';"); $q3 = mysql_num_rows($q2); if ($q3 == 0) { echo "$q1[text]
"; } else { echo "$q1[text]
"; } } echo "
"; } echo "
Назад
"; break; case "reset": //////////////////////////////////////////////////////////// // Отмечаем все темы как прочитанные // //////////////////////////////////////////////////////////// $req = mysql_query("SELECT `forum`.`id` FROM `forum` LEFT JOIN `cms_forum_rdm` ON `forum`.`id` = `cms_forum_rdm`.`topic_id` AND `cms_forum_rdm`.`user_id` = '" . $user_id . "' WHERE `forum`.`type`='t' AND `moder`='1' AND `cms_forum_rdm`.`topic_id` Is Null;"); while ($res = mysql_fetch_array($req)) { mysql_query("INSERT INTO `cms_forum_rdm` SET `topic_id`='" . $res['id'] . "', `user_id`='" . $user_id . "', `time`='" . $realtime . "';"); } $req = mysql_query("SELECT `forum`.`id` AS `id` FROM `forum` LEFT JOIN `cms_forum_rdm` ON `forum`.`id` = `cms_forum_rdm`.`topic_id` AND `cms_forum_rdm`.`user_id` = '" . $user_id . "' WHERE `forum`.`type`='t' AND `moder`='1' AND `forum`.`time` > `cms_forum_rdm`.`time`;"); while ($res = mysql_fetch_array($req)) { mysql_query("UPDATE `cms_forum_rdm` SET `time`='" . $realtime . "' WHERE `topic_id`='" . $res['id'] . "' AND `user_id`='" . $user_id . "';"); } $_SESSION['fnew'] = 0; $_SESSION['fnewtime'] = time(); echo "Все темы приняты как прочитанные
"; break; case "all": if (isset($_POST['submit'])) { if (empty($_POST['vr'])) { echo "Вы не ввели время!
Повторить
"; require_once ("../incfiles/end.php"); exit; } $vr = intval(check($_POST['vr'])); $vr1 = $realtime - $vr * 3600; if ($dostsadm == 1) { $lpz = mysql_query("select `id` from `forum` where type='t' and moder='1' and time>'" . $vr1 . "' ;"); } else { $lpz = mysql_query("select `id` from `forum` where type='t' and moder='1' and time>'" . $vr1 . "' and close!='1' ;"); } $count = mysql_num_rows($lpz); $ba = ceil($count / $kmess); if (empty($_GET['page'])) { $page = 1; } else { $page = intval($_GET['page']); } if ($page < 1) { $page = 1; } if ($page > $ba) { $page = $ba; } $start = $page * $kmess - $kmess; if ($count < $start + $kmess) { $end = $count; } else { $end = $start + $kmess; } if ($dostsadm == 1) { $lp = mysql_query("select * from `forum` where type='t' and moder='1' and time>'" . $vr1 . "' order by time desc LIMIT " . $start . "," . $end . ";"); } else { $lp = mysql_query("select * from `forum` where type='t' and moder='1' and time>'" . $vr1 . "' and close!='1' order by time desc LIMIT " . $start . "," . $end . ";"); } echo "Все за период $vr часов
"; $i = 0; while ($arr = mysql_fetch_array($lp)) { $q3 = mysql_query("select `id`, `refid`, `text` from `forum` where type='r' and id='" . $arr[refid] . "';"); $razd = mysql_fetch_array($q3); $q4 = mysql_query("select `id`, `refid`, `text` from `forum` where type='f' and id='" . $razd[refid] . "';"); $frm = mysql_fetch_array($q4); $colmes = mysql_query("select `id` from `forum` where type='m' and close!='1' and refid='" . $arr[id] . "' order by time desc;"); $nikuser = mysql_query("SELECT `from` FROM `forum` WHERE `type` = 'm' AND `close` != '1' AND `refid` = '" . $arr[id] . "'ORDER BY time DESC LIMIT 1;"); $colmes1 = mysql_num_rows($colmes); $cpg = ceil($colmes1 / $kmess); $colmes1 = $colmes1 - 1; if ($colmes1 < 0) { $colmes1 = 0; } $nam = mysql_fetch_array($nikuser); $d = $i / 2; $d1 = ceil($d); $d2 = $d1 - $d; $d3 = ceil($d2); if ($d3 == 0) { $div = "
"; } else { $div = "
"; } echo "$div"; if ($arr[edit] == 1) { echo ""; } else { echo ""; } echo "$arr[text][$colmes1]"; if ($cpg > 1) { if (((empty($_SESSION['uid'])) && (!empty($_SESSION['uppost'])) && ($_SESSION['uppost'] == 1)) || ((!empty($_SESSION['uid'])) && $upfp == 1)) { echo "[<<]"; } else { echo "[>>]"; } } echo "
"; echo "(" . date("H:i /d.m.y", $arr['time']) . ")
[$arr[from]"; if (!empty($nam['from'])) { echo "/$nam[from]"; } echo "]
"; echo "$frm[text]/$razd[text]"; echo "
"; $i++; } echo "
"; echo "Всего: $count
"; if ($count > $kmess) { if ($offpg != 1) { echo "Страницы:
"; } else { echo "Страниц: $ba
"; } if ($start != 0) { echo '<< '; } if ($offpg != 1) { navigate('index.php?act=new&do=all&vr=' . $vr . '&submit', $count, $kmess, $start, $page); } else { echo "[$page]"; } if ($count > $start + $kmess) { echo ' >>'; } echo "
Перейти к странице:

"; } } else { echo "
Показать все новые за период(в часах):

"; } echo 'Вернуться
'; break; default: //////////////////////////////////////////////////////////// // Вывод списка непрочитанных тем форума // //////////////////////////////////////////////////////////// $knt = forum_new(); $start = $page * $kmess - $kmess; if ($dostsadm == 1) { $req = mysql_query("SELECT * FROM `forum` LEFT JOIN `cms_forum_rdm` ON `forum`.`id` = `cms_forum_rdm`.`topic_id` AND `cms_forum_rdm`.`user_id` = '" . $user_id . "' WHERE `forum`.`type`='t' AND `moder`='1' AND (`cms_forum_rdm`.`topic_id` Is Null OR `forum`.`time` > `cms_forum_rdm`.`time`) ORDER BY `forum`.`time` DESC LIMIT " . $start . "," . $kmess . ";"); } else { $req = mysql_query("SELECT * FROM `forum` LEFT JOIN `cms_forum_rdm` ON `forum`.`id` = `cms_forum_rdm`.`topic_id` AND `cms_forum_rdm`.`user_id` = '" . $user_id . "' WHERE `forum`.`type`='t' AND `moder`='1' AND `close`!='1' AND (`cms_forum_rdm`.`topic_id` Is Null OR `forum`.`time` > `cms_forum_rdm`.`time`) ORDER BY `forum`.`time` DESC LIMIT " . $start . "," . $kmess . ";"); } while ($res = mysql_fetch_array($req)) { $q3 = mysql_query("SELECT `id`, `refid`, `text` FROM `forum` WHERE `type`='r' AND `id`='" . $res['refid'] . "';"); $razd = mysql_fetch_array($q3); $q4 = mysql_query("SELECT `text` FROM `forum` WHERE `type`='f' AND `id`='" . $razd['refid'] . "';"); $frm = mysql_fetch_array($q4); $colmes = mysql_query("SELECT * FROM `forum` WHERE `refid`='" . $res['id'] . "' AND `type`='m' AND `close`!='1' order by time desc;"); $colmes1 = mysql_num_rows($colmes); $nick = mysql_fetch_array($colmes); echo ''; } echo '
Всего: ' . $knt . '
'; if ($knt > $kmess) { echo '

'; // Постраничная навигация $pagenav = array('address' => 'index.php?act=new', 'total' => $knt, 'numpr' => $kmess, 'page' => $page); pagenav($pagenav); echo '

Перейти к странице:

'; echo '

'; } echo '

Сброс!
'; echo 'Показать за период...
'; echo 'Выбор подфорумов

'; if (empty($_SESSION['uid'])) { if ((empty($_SESSION['uppost'])) || ($_SESSION['uppost'] == 0)) { echo "»Новые вверху
"; } else { echo "»Новые внизу
"; } } break; } } else { $lp = mysql_query("select * from `forum` where type='t' and moder='1' order by time desc LIMIT 10;"); while ($arr = mysql_fetch_array($lp)) { $q3 = mysql_query("select `id`, `refid`, `text` from `forum` where type='r' and id='" . $arr['refid'] . "';"); $razd = mysql_fetch_array($q3); $q4 = mysql_query("select `id`, `refid`, `text` from `forum` where type='f' and id='" . $razd['refid'] . "';"); $frm = mysql_fetch_array($q4); $colmes = mysql_query("select `id` from `forum` where type='m' and close!='1' and refid='" . $arr['id'] . "' order by time desc;"); $nikuser = mysql_query("SELECT `from` FROM `forum` WHERE `type` = 'm' AND `close` != '1' AND `refid` = '" . $arr['id'] . "'ORDER BY time DESC LIMIT 1;"); $colmes1 = mysql_num_rows($colmes); $cpg = ceil($colmes1 / $kmess); $colmes1 = $colmes1 - 1; if ($colmes1 < 0) { $colmes1 = 0; } $nam = mysql_fetch_array($nikuser); $d = $i / 2; $d1 = ceil($d); $d2 = $d1 - $d; $d3 = ceil($d2); if ($d3 == 0) { $div = "
"; } else { $div = "
"; } echo "$div"; if ($arrt['edit'] == 1) { echo ""; } else { echo ""; } echo "$arr[text][$colmes1]"; if ($cpg > 1) { if (((empty($_SESSION['uid'])) && (!empty($_SESSION['uppost'])) && ($_SESSION['uppost'] == 1)) || ((!empty($_SESSION['uid'])) && $upfp == 1)) { echo "[<<]"; } else { echo "[>>]"; } } echo "
"; echo "(" . date("H:i /d.m.y", $arr['time']) . ")
[$arr[from]"; if (!empty($nam['from'])) { echo "/$nam[from]"; } echo "]
"; echo "$frm[text]/$razd[text]"; echo "
"; $i++; } } echo 'В форум'; require_once ("../incfiles/end.php"); ?>