' : '
';
$vr = $bk1['time'] + $set_user['sdvig'] + $set['timeshift'] * 3600;
$vr = date("d.m.y / H:i", $vr);
echo $div . ($rights == 5 || $rights >= 6 ? '
' : '') . '
' . htmlentities($bk1['name'], ENT_QUOTES, 'UTF-8') . '';
echo htmlentities($bk1['announce'], ENT_QUOTES, 'UTF-8') . '
';
$req = mysql_query("SELECT * FROM `users` WHERE `name`= '".$bk1['avtor']."'");
$user = mysql_fetch_assoc($req);
echo 'Добавил:
' . $bk1['avtor'] . ' [анк] (' . $vr . ')
';
echo 'Прочтений: ' . $bk1['count'] . '
';
echo 'Рейтинг: ' . $bk1['rate'] . '
';
$zzz = mysql_query("select `komm` from `lib` where type = 'cat' and id = '" . $id . "'");
$zzz = mysql_fetch_array($zzz);
if ($zzz['komm'] != 'no') {
$komm_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `lib` WHERE type = 'komm' AND refid = '" . $bk1['id'] . "'"), 0);
echo '
Комментарии: ' . $komm_count;
}
echo '
';
++$i;
}
echo '';
if ($rights == 5 || $rights >= 6)
echo '';
}else{
$total = 0;
}
// Навигация по страницам
if ($total > $kmess) {
echo '
' . functions::display_pagination('index.php?id=' . $id . '&', $start, $total, $kmess) . '
';
echo '
';
}
if (($rights == 5 || $rights >= 6) && $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 (($rights == 5 || $rights >= 6) && ($zag['ip'] == 1 || $id == 0)) {
echo "";
}
if ($zag['ip'] == 0 && $id != 0) {
if (($rights == 5 || $rights >= 6) || ($zag['soft'] == 1 && !empty ($_SESSION['uid']))) {
echo "";
}
if ($rights == 5 || $rights >= 6) {
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 "";
$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'];
}
}else{
echo "
";
}
break;
case 'bk' :
// Читаем статью
if (!empty ($_SESSION['symb'])) {
$simvol = $_SESSION['symb'];
}else{
$simvol = 2000; // Число символов на страницу по умолчанию
}
// Счетчик прочтений
if ($_SESSION['lib'] != $id) {
$_SESSION['lib'] = $id;
$libcount = intval($zag['count']) + 1;
mysql_query("UPDATE `lib` SET `count` = '" . $libcount . "' WHERE `id` = '" . $id . "'"); }
// Заголовок статьи
echo '
' . htmlentities($zag['name'], ENT_QUOTES, 'UTF-8') . '
';
// Автор книги
$vr5 = $zag['time'] + $set_user['sdvig'] + $set['timeshift'] * 3600;
$vr6 = date("d.m.y / H:i", $vr5);
$aft = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `name` = '" . $zag['avtor'] . "';"));
$aft = (int) $aft['id'];
echo '';
}else{
echo '
' . ($zag['rate'] != 0 ? ($zag['rate'] > 0 ? '' : '') : '') . $zag['rate'] . ' ';
}
// Постраничная навигация читаемой статьи
// Используется модифицированный код от hintoz
$tx = $zag['text'];
$strrpos = mb_strrpos($tx, " ");
$pages = 1;
// Вычисляем номер страницы
if (isset ($_GET['page'])) {
$page = abs(intval($_GET['page']));
if ($page == 0)
$page = 1;
$start = $page - 1;
}else{
$page = $start + 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');
echo '' . functions::display_pagination('index.php?id=' . $id . '&', $start, $pages, 1) . '
';
echo '
';
}
echo '';
// Ссылка на комментарии
$mmm = mysql_query("select `komm` from `lib` where type = 'cat' and id = '" . $zag['refid'] . "'");
$mmm = mysql_fetch_array($mmm);
if (($set['mod_lib_comm'] || $rights >= 7) && $mmm['komm'] != 'no') {
echo '' : '
';
$uz = mysql_query("select * from `users` where name='" . functions::check($mass['avtor']) . "';");
$mass1 = mysql_fetch_array($uz);
if ((!empty($_SESSION['uid'])) && ($_SESSION['uid'] != $mass1['id'])) {
echo "
$mass[avtor]";
}else{
echo $mass['avtor'];
}
$vr = $mass['time'] + $set_user['sdvig'] + $set['timeshift'] * 3600;
$vr1 = date("d.m.Y / H:i", $vr);
switch ($mass1['rights']) {
case 7 :
echo ' [Adm] ';
break;
case 6 :
echo ' [Smd] ';
break;
case 5 :
echo ' [Mod] ';
break;
case 1 :
echo ' [Kil] ';
break;
}
$ontime = $mass1['lastdate'];
$ontime2 = $ontime + 300;
if ($realtime > $ontime2) {
echo ' [
OFF]';
}else{
echo ' [
ON]';
}
echo " ($vr1)
";
if ($set_user['smileys']) {
$tekst = functions::smileys($mass['text'], ($mass['from'] == $nickadmina || $mass['from'] == $nickadmina2 || $mass1['rights'] >= 1) ? 1 : 0);
}else{
$tekst = $mass['text'];
}
echo "$tekst
";
if ($rights == 5 || $rights >= 6) {
echo "(
Удалить)";
}
echo '
';
++$i;
}
}
if ($user_id) {
echo "";
}
echo ""; }
$dnam = mysql_query("select `id`, `refid`, `text` from `lib` where type = 'cat' and id = '" . $zag['refid'] . "'");
$dnam1 = mysql_fetch_array($dnam);
$catname = "$dnam1[text]";
$dirid = "$dnam1[id]";
$nadir = $zag['refid'];
while ($nadir != "0") {
echo "";
$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'];
}
break;
default :
header("location: index.php");
break;
}
}
require_once ('../incfiles/end.php');