80s toys - Atari. I still have
' . $set['mod_lib_msg'] . '

'; require_once ("../incfiles/end.php"); exit; } $act = isset($_GET['act']) ? $_GET['act'] : ''; $do = array('java', 'symb', 'search', 'new', 'moder', 'addkomm', 'komm', 'del', 'edit', 'load', 'write', 'mkcat', 'topread', 'trans'); if (in_array($act, $do)) { require_once ($act . '.php'); } else { if (!$set['mod_lib']) echo '

Библиотека закрыта!

'; if (empty($_GET['id'])) { echo '
Библиотека
'; if ($dostlmod == 1) { // Считаем число статей, ожидающих модерацию $req = mysql_query("SELECT COUNT(*) FROM `lib` WHERE `type` = 'bk' AND `moder` = '0';"); $res = mysql_result($req, 0); if ($res > 0) echo '
Модерации ожидают ' . $res . ' статей
'; } $old = $realtime - (3 * 24 * 3600); // Сколько суток считать статьи новыми? $req = mysql_query("SELECT COUNT(*) FROM `lib` WHERE `time` > '" . $old . "' AND `type`='bk' AND `moder`='1'"); $res = mysql_result($req, 0); echo '

'; if ($res > 0) echo 'Новые статьи (' . $res . ')
'; echo 'Самые читаемые

'; $id = 0; $tip = "cat"; } else { $tp = mysql_query("SELECT * FROM `lib` WHERE `id` = '" . $id . "' LIMIT 1;"); $tp1 = mysql_fetch_array($tp); $tip = $tp1['type']; if ($tp1['type'] == "cat") { echo '
' . $tp1['text'] . '
'; } } switch ($tip) { case 'cat': $req = mysql_query("SELECT COUNT(*) FROM `lib` WHERE `type` = 'cat' AND `refid` = '" . $id . "'"); $totalcat = mysql_result($req, 0); $bkz = mysql_query("SELECT COUNT(*) FROM `lib` WHERE `type` = 'bk' AND `refid` = '" . $id . "' AND `moder`='1'"); $totalbk = mysql_result($bkz, 0); if ($totalcat > 0) { $total = $totalcat; $req = mysql_query("SELECT `id`, `text` FROM `lib` WHERE `type` = 'cat' AND `refid` = '" . $id . "' LIMIT " . $start . "," . $kmess); while ($cat1 = mysql_fetch_array($req)) { $cat2 = mysql_query("select `id` from `lib` where type = 'cat' and refid = '" . $cat1['id'] . "';"); $totalcat2 = mysql_num_rows($cat2); $bk2 = mysql_query("select `id` from `lib` where type = 'bk' and refid = '" . $cat1['id'] . "' and moder='1';"); $totalbk2 = mysql_num_rows($bk2); if ($totalcat2 != 0) { $kol = "$totalcat2 кат."; } elseif ($totalbk2 != 0) { $kol = "$totalbk2 ст."; } else { $kol = "0"; } echo ''; ++$i; } echo '
Всего категорий: ' . $totalcat . '
'; } elseif ($totalbk > 0) { $total = $totalbk; $ba = ceil($total / 10); if ($page > $ba) { $page = $ba; } $start = $page * 10 - 10; if ($total < $start + 10) { $end = $total; } else { $end = $start + 10; } $bk = mysql_query("select * from `lib` where type = 'bk' and refid = '" . $id . "' and moder='1' order by time desc LIMIT " . $start . "," . $end . ";"); while ($bk1 = mysql_fetch_array($bk)) { $d = $i / 2; $d1 = ceil($d); $d2 = $d1 - $d; $d3 = ceil($d2); if ($d3 == 0) { $div = "
"; } else { $div = "
"; } $vr = $bk1[time] + $sdvig * 3600; $vr = date("d.m.y / H:i", $vr); echo $div . '' . htmlentities($bk1['name'], ENT_QUOTES, 'UTF-8') . '
'; echo htmlentities($bk1['announce'], ENT_QUOTES, 'UTF-8') . '
'; echo 'Добавил: ' . $bk1['avtor'] . ' (' . $vr . ')
'; echo 'Прочтений: ' . $bk1['count'] . '
'; ++$i; } } else { $total = 0; } echo '

'; if ($total > 10) { if ($offpg != 1) { echo "Страницы:
"; } else { echo "Страниц: $ba
"; } if ($start != 0) { echo '<< '; } if ($offpg != 1) { navigate('index.php?id=' . $id . '', $total, 10, $start, $page); } else { echo "[$page]"; } if ($total > $start + 10) { echo ' >>'; } echo "

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

"; } if ($total != 0) { if ($totalcat >= 1) { echo 'Всего категорий: ' . $totalcat . '
'; } elseif ($totalbk >= 1) { echo 'Всего статей: ' . $totalbk . '
'; } } else { echo 'В данной категории нет статей!
'; } if ($dostlmod == 1 && $id != 0) { $ct = mysql_query("select `id` from `lib` where type='cat' and refid='" . $id . "';"); $ct1 = mysql_num_rows($ct); if ($ct1 == 0) { echo "Удалить категорию
"; } echo "Изменить категорию
"; } if ($dostlmod == 1 && ($tp1['ip'] == 1 || $id == 0)) { echo "Создать категорию
"; } if ($tp1['ip'] == 0 && $id != 0) { if ($dostlmod == 1 || ($tp1['soft'] == 1 && !empty($_SESSION['uid']))) { echo "Написать статью
"; } if ($dostlmod == 1) { echo "Выгрузить статью
"; } } if ($id != 0) { $dnam = mysql_query("select `id`, `refid`, `text` from `lib` where type = 'cat' and id = '" . $id . "';"); $dnam1 = mysql_fetch_array($dnam); $dnam2 = mysql_query("select `id`, `refid`, `text` from `lib` where type = 'cat' and id = '" . $dnam1['refid'] . "';"); $dnam3 = mysql_fetch_array($dnam2); $catname = "$dnam3[text]"; $dirid = "$dnam1[id]"; $nadir = $dnam1[refid]; while ($nadir != "0") { echo "»$catname
"; $dnamm = mysql_query("select `id`, `refid`, `text` from `lib` where type = 'cat' and id = '" . $nadir . "';"); $dnamm1 = mysql_fetch_array($dnamm); $dnamm2 = mysql_query("select `id`, `refid`, `text` from `lib` where type = 'cat' and id = '" . $dnamm1['refid'] . "';"); $dnamm3 = mysql_fetch_array($dnamm2); $nadir = $dnamm1['refid']; $catname = $dnamm3['text']; } echo "»В библиотеку
"; } else { echo "Настройки
"; echo "
"; echo "Поиск статьи:

Метод поиска:

"; echo "

"; } echo '

'; break; case 'bk': //////////////////////////////////////////////////////////// // Читаем статью // //////////////////////////////////////////////////////////// if (!empty($_SESSION['symb'])) { $simvol = $_SESSION['symb']; } else { $simvol = 2000; // Число символов на страницу по умолчанию } // Счетчик прочтений if ($_SESSION['lib'] != $id) { $_SESSION['lib'] = $id; $libcount = intval($tp1[count]) + 1; mysql_query("update `lib` set `count`='" . $libcount . "' where id='" . $id . "';"); } // Заголовок статьи echo '

' . htmlentities($tp1['name'], ENT_QUOTES, 'UTF-8') . '

'; $tx = $tp1['text']; # для постраничного вывода используется модифицированный код от hintoz # $strrpos = mb_strrpos($tx, " "); $pages = 1; $t_si = 0; if ($strrpos) { while ($t_si < $strrpos) { $string = mb_substr($tx, $t_si, $simvol); $t_ki = mb_strrpos($string, " "); $m_sim = $t_ki; $strings[$pages] = $string; $t_si = $t_ki + $t_si; if ($page == $pages) { $page_text = $strings[$pages]; } if ($strings[$pages] == "") { $t_si = $strrpos++; } else { $pages++; } } if ($page >= $pages) { $page = $pages - 1; $page_text = $strings[$page]; } $pages = $pages - 1; if ($page != $pages) { $prb = mb_strrpos($page_text, " "); $page_text = mb_substr($page_text, 0, $prb); } } else { $page_text = $tx; } // Текст статьи $page_text = htmlentities($page_text, ENT_QUOTES, 'UTF-8'); $page_text = str_replace("\r\n", "
", $page_text); echo $page_text; echo '

'; $next = $page + 1; $prev = $page - 1; if ($pages > 1) { if ($offpg != 1) { echo "Страницы:
"; } else { echo "Страниц: $pages
"; } if ($page > 1) { print " << "; } if ($offpg != 1) { if ($page > 1) { print "1 "; } if ($prev > 2) { print " .. "; } $page2 = $pages - $page; $pa = ceil($page / 2); $paa = ceil($page / 3); $pa2 = $page + floor($page2 / 2); $paa2 = $page + floor($page2 / 3); $paa3 = $page + (floor($page2 / 3) * 2); if ($page > 13) { echo ' ' . $paa . ' ' . ($paa + 1) . ' .. ' . ($paa * 2) . ' ' . ($paa * 2 + 1) . ' .. '; } elseif ($page > 7) { echo ' ' . $pa . ' ' . ($pa + 1) . ' .. '; } if ($prev > 1) { print "$prev "; } echo "$page "; if ($next < $pages) { print "$next "; } if ($page2 > 12) { echo ' .. ' . $paa2 . ' ' . ($paa2 + 1) . ' .. ' . ($paa3) . ' ' . ($paa3 + 1) . ' '; } elseif ($page2 > 6) { echo ' .. ' . $pa2 . ' ' . ($pa2 + 1) . ' '; } if ($next < ($pages - 1)) { print " .. "; } if ($page < $pages) { print "$pages "; } } else { echo "[$page]"; } if ($page < $pages) { print " >>"; } echo "

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

"; } if ($dostlmod == 1) { echo "Удалить статью
"; echo "Изменить название

"; } $km = mysql_query("select `id` from `lib` where type = 'komm' and refid = '" . $id . "';"); $km1 = mysql_num_rows($km); echo "Комментарии($km1)
"; echo 'Скачать Java книгу

'; $dnam = mysql_query("select `id`, `refid`, `text` from `lib` where type = 'cat' and id = '" . $tp1[refid] . "';"); $dnam1 = mysql_fetch_array($dnam); $catname = "$dnam1[text]"; $dirid = "$dnam1[id]"; $nadir = $tp1[refid]; while ($nadir != "0") { echo "»$catname
"; $dnamm = mysql_query("select `id`, `refid`, `text` from `lib` where type = 'cat' and id = '" . $nadir . "';"); $dnamm1 = mysql_fetch_array($dnamm); $dnamm2 = mysql_query("select `id`, `refid`, `text` from `lib` where type = 'cat' and id = '" . $dnamm1[refid] . "';"); $dnamm3 = mysql_fetch_array($dnamm2); $nadir = $dnamm1[refid]; $catname = $dnamm3[text]; } echo "»В библиотеку

"; break; default: header("location: index.php"); break; } } require_once ('../incfiles/end.php'); ?>