Размер файла: 7.15Kb
<? php define ( '_IN_JOHNCMS' , 1 ); $headmod = 'lib' ; $textl = 'Библиотека' ; require_once ( "../incfiles/core.php" ); require_once ( "./inc/conf.php" ); // Ограничиваем доступ к Библиотеке if (! $set [ 'mod_lib' ] && $rights < 7 ) $error = 'Библиотека закрыта' ; elseif ( $set [ 'mod_lib' ] == 1 && ! $user_id ) $error = 'Доступ в Библиотеку открыт только <a href="../in.php">авторизованным</a> посетителям' ; if ( $error ) { require_once ( "../incfiles/head.php" ); echo '<div class="rmenu"><p>' . $error . '</p></div>' ; require_once ( "../incfiles/end.php" ); exit ; } require_once ( "../incfiles/head.php" ); if ( $rights == 5 || $rights >= 6 ) { echo '<div class="gmenu"><a href="admin.php"><strong>Управление библиотекой</strong></a></div>' ; $co = mysql_result ( mysql_query ( "select COUNT(*) from `library` where `moder` = '0' and `type` = 'file'" ), 0 ); if ( $co > 0 ) { echo '<div class="bmenu"><strong>' . $co . '</strong> статей ожидают модерации перейти к ним <a href="mod.php">>>></a></div>' ; } } echo '<small><img src="img/bar.png" alt=""/><a href="pop.php?">Популярные книги</a><br/>' ; echo '<img src="img/new.png" alt=""/><a href="new.php?">Новые книги</a></small><br/>' ; if ( empty ( $id )) { echo '<div class="phdr">Библиотека</div>' ; } else { //////////////////////////////////////////////////////////// // Получаем структуру каталогов // //////////////////////////////////////////////////////////// $tree = array (); $dirid = $id ; while ( $dirid != '0' && $dirid != "" ) { $req = mysql_query ( "SELECT `name`,`fid` FROM `library` WHERE `type` = 'dir' and `id` = '" . $dirid . "' LIMIT 1" ); $res = mysql_fetch_array ( $req ); $tree [] = '<a href="index.php?id=' . $dirid . '">' . $res [ 'name' ] . '</a>' ; $dirid = $res [ 'fid' ]; } krsort ( $tree ); $cdir = array_pop ( $tree ); echo '<div class="phdr"><a href="index.php">Библиотека</a> | ' ; foreach ( $tree as $value ) { echo $value . ' | ' ; } echo '<b>' . strip_tags ( $cdir ) . '</b></div>' ; } $totaldir = mysql_result ( mysql_query ( "select COUNT(*) from `library` where `type` = 'dir' and `fid` = '" . $id . "'" ), 0 ); $totalfile = mysql_result ( mysql_query ( "select COUNT(*) from `library` where `type` = 'file' and `fid` = '" . $id . "' and `moder` = '1'" ), 0 ); $total = $totaldir + $totalfile ; if ( $total > 0 ) { $sql = mysql_query ( "select * from `library` where `fid` = '" . $id . "' order by `type` ASC, `name` ASC, `file` ASC LIMIT " . $start . "," . $kol_file . "" ); while ( $mas = mysql_fetch_array ( $sql )) { if ( $totaldir > 0 && $mas [ 'type' ] == 'dir' ) { echo '<div class="list1">' ; echo '»<img src="./img/' .( $mas [ 'type2' ] == "YES" ? 'folder_user' : 'folder' ). '.png" alt="" /><a href="index.php?id=' . $mas [ 'id' ]. '">' . htmlentities ( $mas [ 'name' ], ENT_QUOTES , 'utf-8' ). '</a>' ; $count = 0 ; $countnew = 0 ; $count = mysql_result ( mysql_query ( "select COUNT(*) from `library` where `type` = 'file' and `path` LIKE '" . $mas [ 'path' ]. "%' and `moder` = '1'" ), 0 ); $countnew = mysql_result ( mysql_query ( "select COUNT(*) from `library` where `type` = 'file' and `path` LIKE '" . $mas [ 'path' ]. "%' and `time` > '" .( $realtime -( $new_fil * 24 * 3600 ) ). "' and `moder` = '1'" ), 0 ); echo '(' . intval ( $count ); if ( $countnew !== "0" ){ echo '/<span class="red">+' . intval ( $countnew ). '</span>)' ;} else { echo ')' ;} if (! empty ( $mas [ 'opis' ])) { echo '<div class="sub">' . htmlentities ( $mas [ 'opis' ], ENT_QUOTES , 'utf-8' ). '</div>' ; } echo '</div>' ; } if ( $totalfile > 0 && $mas [ 'type' ] == 'file' && $mas [ 'moder' ] == "1" ) { echo '<div class="list2">' ; echo '°<img src="./img/page_white_text.png" alt="" /><a href="read.php?id=' . $mas [ 'id' ]. '">' . htmlentities ( $mas [ 'name' ], ENT_QUOTES , 'utf-8' ). '</a>' ; $c = mysql_result ( mysql_query ( "select COUNT(*) from `lib_file` where `fid` = '" . $mas [ 'id' ]. "'" ), 0 ); if ( $c > 0 ) { $sql1 = mysql_query ( "select * from `lib_file` where `fid` = '" . $mas [ 'id' ]. "'" ); echo '<br/>' ; echo '<small>Прикрепленные файлы:<br/>' ; while ( $res = mysql_fetch_array ( $sql1 )) { echo '<a href="file.php?act=look&id=' . $res [ 'id' ]. '">' . htmlentities ( $res [ 'name' ], ENT_QUOTES , 'utf-8' ). '</a>, ' ; } echo '</small>' ; } if (! empty ( $mas [ 'opis' ])) { echo '<div class="sub">' . htmlentities ( $mas [ 'opis' ], ENT_QUOTES , 'utf-8' ). '</div>' ; } else { echo '<br/>' ;} echo '<ul><small><li><strong>Прочтений:</strong>' . $mas [ 'count' ]. '<br/></li>' ; $us = mysql_fetch_array ( mysql_query ( "select `name` from `users` where `id` = '" . $mas [ 'id_avtor' ]. "' LIMIT 1" )); $re1 = explode ( ":" , $mas [ 'rating' ]); $tit = round ( $re1 [ 1 ]/ 2 / $re1 [ 0 ], 1 ); echo '<li><strong>Оценка:</strong> ' . $tit . '/<b>' .( int ) $re1 [ 0 ]. '</b></li>' ; echo '<li><strong>Добавил:</strong>' . htmlentities ( $us [ 'name' ], ENT_QUOTES , 'utf-8' ). '</li>' ; echo '<li><a href="komm.php?id=' . $mas [ 'id' ]. '">Комментарии</a>[' . count_komm ( $mas [ 'id' ]). ']</li>' ; echo '</small></ul>' ; echo '</div>' ; } } } else { echo '<strong>В даной категории статей нету!!!</strong><br/>' ; } echo '<div class="phdr">' ; if ( $totaldir > 0 ) echo 'Папок: ' . $totaldir ; echo ' ' ; if ( $totalfile > 0 ) echo 'Файлов: ' . $totalfile ; echo '</div>' ; // Постраничная навигация if ( $total > $kol_file ) { echo '<p>' . pagenav ( 'index.php?id=' . $id . '&' , $start , $total , $kol_file ) . '</p>' ; } echo '<div class="gmenu"><small><ul><li><a href="set.php?">Настройки отображения</a></li>' ; echo '<li><a href="serch.php?">Поиск книг</a></li>' ; echo '<li><a href="stat.php?">Статистика библиотеки</a></li>' ; echo '<li><a href="zak.php?">Стол заказов</a></li></ul></small>' ; echo '</div>' ; echo '<hr/>' ; if (! empty ( $_GET [ 'id' ])) { $sq = mysql_fetch_array ( mysql_query ( "select `type2` from `library` where `id` = '" . $id . "' LIMIT 1" )); if ( $sq [ 'type2' ] == "YES" && $user_id ) { echo '<div class="func"><ul>' ; echo '<li><a href="file.php?act=upload&id=' . $id . '">Выгрузить статью</a></li>' ; echo '<li><a href="file.php?act=newstat&id=' . $id . '">Написать статью</a></li>' ; echo '</ul></div>' ; } } require_once ( '../incfiles/end.php' ); ?>