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

Размер файла: 5.38Kb
<?php

/**
 * Главная страница сайта 
 */
 
# Заголовок модуля
$system['page_title'] = 'Мобильный портал';

# Шапка модуля
require_once(HOME .'/incfiles/header.php');

# Вывод ошибок
error($err);

// Блок общения
echo '<div class="title">Общение</div>
<div class="menu">
'. (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>') .'
</div>
<div class="menu">
'. (isset($user) && $settings['img_site'] == 2?NULL:'<img src="/design/icons/forum/index.png" alt="" /> ') .'<a href="/forum/">Форум</a>';
$new_tnemes = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_p` WHERE `time` > '". (time()-3600*12) ."'". (isset($user)?" AND `user_id` != '". $user['id'] ."'":NULL) .""),0);
echo '('. mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_t`"), 0) .'';
if (isset($new_themes)) {
echo '<a href="/forum/new_themes.php">+ <font coror="green">'.$new_themes.'</a></font>';
}
echo '/'. mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_p`"), 0) .'';
$new_message = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_p` WHERE `time` > '". (time()-3600*12) ."'". (isset($user)?" AND `user_id` != '". $user['id'] ."'":NULL) .""),0);
if (isset($new_message)) {
echo ' <a href="/forum/new_posts.php">+ <font coror="green">'.$new_message.'</font></a> ';
}
echo ')<br />
</div>';

echo '<div class="title">Загруз-центр</div>';

# Количество файлов/папок
$k_downloads = mysql_result(mysql_query("SELECT COUNT(*) FROM `downloads` WHERE `dir_id` = '0'"), 0);

if ($k_downloads == 0) {
  echo '<div class="menu"><img src="/design/icons/loads.png" alt="" /> <a href="/downloads/">Загруз-центр</a></div>';
} else {

# Запрос для вывода папок
$sql_downloads = mysql_query("SELECT * FROM `downloads` WHERE `dir_id` = '0' ORDER BY type ASC, name ASC");

# Цикл извлечения данных
  while ($download = mysql_fetch_assoc($sql_downloads)) {
    if ($download['type'] == 1) {
      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>';
      else $new1 = '';
    
      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>';
      else $new2 = '';
      
      if ($new1 != NULL || $new2 != NULL) $new3 = $new1 . $new2;
      else $new3 = ''; 
    }
  
    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>';
  }
}

// Блок статистики
echo '<div class="title">Статистика</div>
<div class="menu">
'. (isset($user) && $settings['img_site'] == 2?NULL:'<img src="/design/icons/user/online.png" alt="" /> ') .'Сейчас на сайте:<br />
&raquo; <a href="/user/users_online.php">Пользователи онлайн</a> ('. mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `date_last_entry` > '". (time()-300) ."'"), 0) .')<br />
&raquo; <a href="/user/guests_online.php">Гости онлайн</a> ('. mysql_result(mysql_query("SELECT COUNT(*) FROM `guests` WHERE `date_last` > '". (time()-300) ."'"), 0) .')
</div>
<div class="menu">
'. (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 />
</div>';

require_once(HOME .'/incfiles/footer.php');

?>