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

Размер файла: 4.76Kb
  1. <?php
  2.  
  3. /**
  4. * Главная страница сайта
  5. */
  6. # Заголовок модуля
  7. $system['page_title'] = 'Мобильный портал';
  8.  
  9. # Шапка модуля
  10. require_once(HOME .'/incfiles/header.php');
  11.  
  12. # Вывод ошибок
  13. error($err);
  14.  
  15. // Блок общения
  16. echo '<div class="title">Общение</div>
  17. <div class="menu">
  18. '. (isset($user) && $settings['img_site'] == 2?NULL:'<img src="/design/icons/news/index.png" alt="" /> ') . (mysql_result(mysql_query("SELECT COUNT(*) FROM `news`"), 0) != 0?'<a href="/news/index.php?news_id='. mysql_result(mysql_query("SELECT `id` FROM `news` ORDER BY time DESC LIMIT 1"), 0) .'">'. mysql_result(mysql_query("SELECT `title` FROM `news` ORDER BY time DESC LIMIT 1"), 0) .'</a> ('. vtime(mysql_result(mysql_query("SELECT `time` FROM `news` ORDER BY time DESC LIMIT 1"), 0)) .')':'<a href="/news/index.php">Новости сайта</a>') .'
  19. </div>
  20. <div class="menu">
  21. '. (isset($user) && $settings['img_site'] == 2?NULL:'<img src="/design/icons/forum/index.png" alt="" /> ') .'<a href="/forum/">Форум</a> ('. mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_t`"), 0) .'/'. mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_p`"), 0) .')<br />
  22. </div>';
  23.  
  24. echo '<div class="title">Загруз-центр</div>';
  25.  
  26. # Количество файлов/папок
  27. $k_downloads = mysql_result(mysql_query("SELECT COUNT(*) FROM `downloads` WHERE `dir_id` = '0'"), 0);
  28.  
  29. if ($k_downloads == 0) {
  30. echo '<div class="menu"><img src="/design/icons/loads.png" alt="" /> <a href="/downloads/">Загруз-центр</a></div>';
  31. } else {
  32.  
  33. # Запрос для вывода папок
  34. $sql_downloads = mysql_query("SELECT * FROM `downloads` WHERE `dir_id` = '0' ORDER BY type ASC, name ASC");
  35.  
  36. # Цикл извлечения данных
  37. while ($download = mysql_fetch_assoc($sql_downloads)) {
  38. if ($download['type'] == 1) {
  39. if (mysql_result(mysql_query("SELECT COUNT(*) FROM `downloads` WHERE `path` LIKE '%$download[path]%' AND `id` != '$download[id]' AND `type` = '2' AND `time` > '". (time()-3600*24*3) ."'"), 0) != 0) $new1 = '<span class="green">+'. mysql_result(mysql_query("SELECT COUNT(*) FROM `downloads` WHERE `path` LIKE '%$download[path]%' AND `id` != '$download[id]' AND `type` = '2' AND `time` > '". (time()-3600*24*3) ."'"), 0) .'</span>';
  40. else $new1 = '';
  41. if (mysql_result(mysql_query("SELECT COUNT(*) FROM `downloads` WHERE `path` LIKE '%$download[path]%' AND `id` != '$download[id]' AND `type` = '2' AND `time` > '". (time()-3600*24*7) ."'"), 0) != 0) $new2 = '<span class="red">+'. mysql_result(mysql_query("SELECT COUNT(*) FROM `downloads` WHERE `path` LIKE '%$download[path]%' AND `id` != '$download[id]' AND `type` = '2' AND `time` > '". (time()-3600*24*7) ."'"), 0) .'</span>';
  42. else $new2 = '';
  43. if ($new1 != NULL || $new2 != NULL) $new3 = $new1 . $new2;
  44. else $new3 = '';
  45. }
  46. echo '<div class="menu"><img src="/design/icons/downloads/'. ($download['file_ext'] != NULL?$download['file_ext']:'file') .'.png" alt="'. ($download['type'] == 1?'Папка':'Файл') .'"> <a href="/downloads/'. ($download['type'] == 1?'index.php?dir_id='. $download['id']:'file.php?file_id='. $download['id']) .'">'. $download['name'] .'</a>'. ($download['type'] == 2?' ('. vtime($download['time']) .')':' ('. mysql_result(mysql_query("SELECT COUNT(*) FROM `downloads` WHERE `path` LIKE '%$download[path]%' AND `id` != '$download[id]' AND `type` = '2'"), 0) .')'. ($new3 != NULL?' '. $new3:NULL)) . ($download['type'] == 1 && user_access('add_dir_downloads')?' [<a href="/downloads/index.php?dir_id='. $dir_id .'&amp;edit_id='. $download['id'] .'">изм</a>] [<a href="/downloads/index.php?dir_id='. $dir_id .'&amp;delete_id='. $download['id'] .'">уд</a>]':NULL) .'</div>';
  47. }
  48. }
  49.  
  50. // Блок статистики
  51. echo '<div class="title">Статистика</div>
  52. <div class="menu">
  53. '. (isset($user) && $settings['img_site'] == 2?NULL:'<img src="/design/icons/user/online.png" alt="" /> ') .'Сейчас на сайте:<br />
  54. &raquo; <a href="/user/users_online.php">Пользователи онлайн</a> ('. mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `date_last_entry` > '". (time()-300) ."'"), 0) .')<br />
  55. &raquo; <a href="/user/guests_online.php">Гости онлайн</a> ('. mysql_result(mysql_query("SELECT COUNT(*) FROM `guests` WHERE `date_last` > '". (time()-300) ."'"), 0) .')
  56. </div>
  57. <div class="menu">
  58. '. (isset($user) && $settings['img_site'] == 2?NULL:'<img src="/design/icons/user/list_users.png" alt="" /> ') .'<a href="/user/list_users.php">Список пользователей</a> ('. mysql_result(mysql_query("SELECT COUNT(*) FROM `users`"), 0) .')<br />
  59. </div>';
  60.  
  61. require_once(HOME .'/incfiles/footer.php');
  62.  
  63. ?>