Просмотр файла download/index.php

Размер файла: 8.16Kb
  1. <?php
  2. /*
  3. =============================================
  4. Движок: SHCMS Engine
  5. =============================================
  6. Название файла: Обменник
  7. =============================================
  8. Official website: http://shcms.ru
  9. =============================================
  10. */
  11. define('SHCMS', true);
  12. include_once'../system/inc/basic_settings.php';
  13. if(isset($_GET['act_dir']))
  14. {$shcmsengine['title'] = 'Создание новой папки';}
  15. else{$shcmsengine['title'] = 'Файловый обменник';}
  16. include_once'../template/head.php';
  17.  
  18.  
  19. $allfield = mysql_result(mysql_query("SELECT COUNT(*) FROM `download_dir` WHERE `dir_index`='0'"),0);
  20. $newlist = new Navigation($allfield,10, true);
  21. $file_cat = mysql_query("SELECT * FROM `download_dir` WHERE `dir_index`='0' ". $newlist->limit()."");
  22. $dir_cats = mysql_fetch_array($file_cat);
  23. if($_GET['dir']){
  24. $dir = $_GET['dir'];
  25. }
  26. if($dir == false) {
  27. if($user_id) {
  28. echo '<div class="maintitle mainrazd">Поиск файлов:</div>
  29. <div class="maintext"><form action="search.php" method="post">';
  30. echo '<input type="text" name="search">';
  31. echo '<input type="submit" name="submit" value="Искать"></form>
  32. <small> * Файлы найти можно по названию</small></div>';
  33. }
  34. $new_files = mysql_result(mysql_query("SELECT COUNT(*) FROM `download_file` WHERE `time` > '".(time()-86400)."'"),0);
  35. echo '<div class="maintext"><a href="new.files.php">Новые поступление ('.$new_files .')</a></div><hr/>';
  36. if($dir_cats == null)
  37. {
  38. echo '<div class="maintext">Файловый обменник пуст.</div>';
  39. }
  40. else
  41. {
  42. echo '<div class="maintitle mainrazd">Обменник файлов</div><div class="maintext">';
  43. do
  44. {
  45. echo '<div class="posts"> <img src="icons/dir.png"/> <a href="?dir='.$dir_cats['id'].'">'.$dir_cats['name'].' </a>';
  46. echo '</div>';
  47. }
  48. while($dir_cats = mysql_fetch_array($file_cat));
  49. echo '</div>';
  50. echo '<div class="pages">';
  51. echo $newlist->pagination();
  52. echo '</div>';
  53. }
  54. if($user4['team'] == 6)
  55. {
  56. echo '<div class="maintitle mainrazd">Навигация</div>';
  57. echo '<div class="maintext"><div class="posts"><a href="new_dir.php">Создать папку</a></div>';
  58. echo '<div class="posts"><a href="edit.php">Настройка папок</a></div></div>';
  59. }
  60. }
  61.  
  62. /*
  63. @ $dir
  64. */
  65. if(isset($_GET['dir']))
  66. {
  67. $id = $dir;
  68. $yel_down = mysql_query("SELECT * FROM `download_dir` WHERE `dir_index`='$dir'");
  69. $ok_down = mysql_fetch_array($yel_down);
  70.  
  71. if($ok_down)
  72. {
  73. do {
  74. $result_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `download_file` WHERE `id_dir` = '$ok_down[id]'"),0);
  75.  
  76. if (mysql_result(mysql_query("SELECT COUNT(*) FROM `download_dir` WHERE `dir_path` LIKE '%$ok_down[dir_path]%' AND `id` != '$ok_down[id]' AND `time` > '". (time()-3600*24*3) ."'"), 0) != 0) ;
  77. echo '<div class="posts">
  78. <img src="icons/dir.png"/> <a href="?dir='.$ok_down['id'].'">'.$ok_down['name'].'</a>
  79. <span class="count">'. $result_count.'</span></div>';
  80. }
  81. while ($ok_down = mysql_fetch_array($yel_down));
  82. }
  83.  
  84. $files = mysql_fetch_array(mysql_query("SELECT * FROM `download_file` WHERE `id_dir`='$dir'"));
  85. $rt_d = mysql_result(mysql_query("SELECT COUNT(*) FROM `download_dir` WHERE `dir_index` = '$dir'"), 0);
  86. $allfield1 = mysql_result(mysql_query("SELECT COUNT(*) FROM `download_file` WHERE `id_dir`='$dir'"),0);
  87. $newlist1 = new Navigation($allfield1,10,true);
  88. $filew = mysql_query("SELECT * FROM `download_file` WHERE `id_dir`= '$dir' ORDER BY `id` DESC ". $newlist1->limit()."");
  89. $type_file = mysql_fetch_array(mysql_query("SELECT * FROM `download_dir` WHERE `id` = '$dir'"));
  90. if($type_file['type'] == 2) {
  91. echo '<div class="maintitle mainrazd"><center>Раздел картинок</center></div><div class="maintext">';
  92. echo 'Всего картинок:&nbsp;'.mysql_result(mysql_query("SELECT COUNT(*) FROM `download_file` WHERE `type` = 'png' OR `type` = 'jpg' OR `type` = 'jpeg' OR `type` = 'gif'"),0).'<br/>';
  93. $new_photo = mysql_fetch_array(mysql_query("SELECT * FROM `download_file` WHERE `type` = 'png' OR `type` = 'jpg' OR `type` = 'jpeg' OR `type` = 'gif' ORDER BY `id` DESC LIMIT 1"));
  94. echo 'Последняя добавленная картинка:&nbsp; <a href="files.php?id='.$new_photo['id'].'">'.$new_photo['names'].'</a>';
  95. echo '</div>';
  96. }
  97. elseif($type_file['type'] == 3) {
  98. echo '<div class="maintitle mainrazd"><center>Музыкальный раздел</center></div><div class="maintext">';
  99. echo 'Всего песен:&nbsp;'.mysql_result(mysql_query("SELECT COUNT(*) FROM `download_file` WHERE `type` = 'mp3'"),0).'<br/>';
  100. $new_music = mysql_fetch_array(mysql_query("SELECT * FROM `download_file` WHERE `type` = 'mp3' ORDER BY `id` DESC LIMIT 1"));
  101. echo 'Последняя добавленная песня:&nbsp; <a href="files.php?id='.$new_music['id'].'">'.$new_music['names'].'</a>';
  102. echo '</div>';
  103. }
  104. elseif($type_file['type'] == 4) {
  105. echo '<div class="maintitle mainrazd"><center>Видео раздел</center></div><div class="maintext">';
  106. echo 'Всего видео:&nbsp;'.mysql_result(mysql_query("SELECT COUNT(*) FROM `download_file` WHERE `type` = 'mp4' OR `type` = 'avi' OR `type` = '3gp' OR `type` = 'flv' OR `type` = 'mpg'"),0).'<br/>';
  107. $new_video = mysql_fetch_array(mysql_query("SELECT * FROM `download_file` WHERE `type` = 'mp4' OR `type` = 'avi' OR `type` = '3gp' OR `type` = 'flv' OR `type` = 'mpg' ORDER BY `id` DESC LIMIT 1"));
  108. if($new_video == false) {
  109. echo 'Последняя добавленная видео:&nbsp; Видео отсутствуют';
  110. }else {
  111. echo 'Последняя добавленная видео:&nbsp; <a href="files.php?id='.$new_video['id'].'">'.$new_video['names'].'</a>';
  112. }
  113. echo '</div>';}
  114. elseif($type_file['type'] == 5) {
  115. echo '<div class="maintitle mainrazd"><center>Архивный раздел</center></div><div class="maintext">';
  116. echo 'Всего картинок:&nbsp;'.mysql_result(mysql_query("SELECT COUNT(*) FROM `download_file` WHERE `type` = 'zip' OR `type` = 'rar' "),0).'<br/>';
  117. $new_arhive = mysql_fetch_array(mysql_query("SELECT * FROM `download_file` WHERE `type` = 'zip' OR `type` = 'rar' ORDER BY `id` DESC LIMIT 1"));
  118. echo 'Последний добавленный архив:&nbsp; <a href="files.php?id='.$new_arhive['id'].'">'.$new_arhive['names'].'</a>';
  119. echo '</div>';
  120. }
  121. if(mysql_num_rows($yel_down) == NULL and mysql_num_rows($filew)== NULL )
  122. {
  123. echo '<div class="maintext">';
  124. SHCMS_core::img_shcms('../template/icon/empty.png');
  125. echo 'В данной папки не найдено файлов</div>';
  126. }
  127. $file_while = mysql_fetch_array($filew);
  128. if($file_while != null)
  129. {
  130. echo '<div class="maintext">';
  131. do
  132. {
  133. files::files_icon($file_while['type']);
  134. }
  135. while($file_while = mysql_fetch_array($filew));
  136. echo '</div><div class="pages">';
  137. echo $newlist1->pagination('dir='.$id);
  138. echo '</div>';
  139.  
  140. }
  141. if($user_id)
  142. {
  143. $world = mysql_fetch_array(mysql_query("SELECT * FROM `download_dir` WHERE `id`='$id'"));
  144. echo '<div class="maintitle mainrazd">Добавление</div><div class="maintext">';
  145. if($world['vib'] == 1 or $user4['team'] == 6)
  146. {
  147. echo '<div class="posts"><a href="upload.php?act=rules&dir='.$dir.'&'.$conservation.'">Выгрузить файл</a></div>';
  148. }
  149. }
  150. if($user4['team'] == 6){
  151. echo '<div class="posts"><a href="new_dir.php?dir='.$dir.'&act_dir&'.$conservation.'">Создать папку</a></div>';
  152. }
  153. if($user_id)
  154. {
  155. echo '</div>';
  156. }
  157.  
  158. }
  159. include_once'../template/foot.php';
  160. ?>