View file load/new.php

File size: 5.99Kb
<?php
#-----------------------------------------------------#
#          ********* ROTORCMS *********               #
#             Made by   :  VANTUZ                     #
#               E-mail  :  [email protected]         #
#                 Site  :  http://pizdec.ru           #
#             WAP-Site  :  http://visavi.net          #
#                  ICQ  :  36-44-66                   #
#  Вы не имеете право вносить изменения в код скрипта #
#        для его дальнейшего распространения          #
#-----------------------------------------------------#	
require_once ('../includes/start.php');
require_once ('../includes/functions.php');
require_once ('../includes/header.php');
include_once ('../themes/' . $config['themes'] . '/index.php');

if (isset($_GET['start'])) {
  $start = abs(intval($_GET['start']));
} else {
  $start = 0;
} 
if (isset($_GET['act'])) {
  $act = check($_GET['act']);
} else {
  $act = 'scripts';
} 

switch ($act):
# ###########################################################################################
# #                                        Вывод тем                                       ##
# ###########################################################################################
case "scripts":
  show_title('site.png', 'Список новых файлов');
  $config['newtitle'] = 'Список новых файлов';

  $total = DB :: $dbh -> querySingle("SELECT count(*) FROM downs;");

  if ($total > 0) {
    if ($total > 100) {
      $total = 100;
    } 
    if ($start >= $total) {
      $start = 0;
    } 

    $querydown = DB :: $dbh -> query("SELECT downs.*, cats_name FROM downs LEFT JOIN cats ON downs.downs_cats_id=cats.cats_id ORDER BY downs_time DESC LIMIT " . $start . ", " . $config['downlist'] . ";");

    while ($data = $querydown -> fetch()) {
      echo '<div class="b"><img src="../images/img/zip.gif" alt="image" /> ';

      echo '<b><a href="down.php?act=view&amp;id=' . $data['downs_id'] . '&amp;' . SID . '">' . $data['downs_title'] . '</a></b> (' . read_file('files/' . $data['downs_link']) . ')</div>';

      echo '<div>Категория: <a href="down.php?cid=' . $data['downs_cats_id'] . '&amp;' . SID . '">' . $data['cats_name'] . '</a><br />';
      echo 'Скачиваний: ' . $data['downs_load'] . '<br />';
      echo 'Добавил: <a href="../pages/anketa.php?uz=' . $data['downs_user'] . '&amp;' . SID . '">' . nickname($data['downs_user']) . '</a>  (' . date_fixed($data['downs_time']) . ')</div>';
    } 

    page_strnavigation('new.php?act=scripts&amp;', $config['downlist'], $start, $total);
  } else {
    show_error('Опубликованных файлов еще нет!');
  } 
  break;
# ###########################################################################################
# #                                     Вывод сообщений                                    ##
# ###########################################################################################
case "comments":
  show_title('site.png', 'Список последних комментариев');
  $config['newtitle'] = 'Список последних комментариев';

  $total = DB :: $dbh -> querySingle("SELECT count(*) FROM commload;");

  if ($total > 0) {
    if ($total > 100) {
      $total = 100;
    } 
    if ($start >= $total) {
      $start = 0;
    } 

    $querydown = DB :: $dbh -> query("SELECT commload.*, downs_title, downs_comments FROM commload LEFT JOIN downs ON commload.commload_down=downs.downs_id ORDER BY commload_time DESC LIMIT " . $start . ", " . $config['downlist'] . ";");

    while ($data = $querydown -> fetch()) {
      echo '<div class="b">';

      echo '<img src="../images/img/balloon.gif" alt="image" /> <b><a href="new.php?act=viewcomm&amp;id=' . $data['commload_down'] . '&amp;cid=' . $data['commload_id'] . '&amp;' . SID . '">' . $data['downs_title'] . '</a></b> (' . $data['downs_comments'] . ')</div>';

      echo '<div>' . bb_code($data['commload_text']) . '<br />';

      echo 'Написал: <a href="../pages/anketa.php?uz=' . $data['commload_author'] . '&amp;' . SID . '">' . nickname($data['commload_author']) . '</a> <small>(' . date_fixed($data['commload_time']) . ')</small><br />';

      if (is_admin() || empty($config['anonymity'])) {
        echo '<span class="data">(' . $data['commload_brow'] . ', ' . $data['commload_ip'] . ')</span>';
      } 

      echo '</div>';
    } 

    page_strnavigation('new.php?act=comments&amp;', $config['downlist'], $start, $total);
  } else {
    show_error('Комментарии не найдены!');
  } 
  break;
# ###########################################################################################
# #                                     Переход к сообщение                                ##
# ###########################################################################################
case 'viewcomm':

  if (isset($_GET['id'])) {
    $id = abs(intval($_GET['id']));
  } else {
    $id = 0;
  } 
  if (isset($_GET['cid'])) {
    $cid = abs(intval($_GET['cid']));
  } else {
    $cid = 0;
  } 

  $querycomm = DB :: $dbh -> querySingle("SELECT COUNT(*) FROM `commload` WHERE `commload_id`<=? AND `commload_down`=? ORDER BY `commload_time` ASC LIMIT 1;", array($cid, $id));

  if (!empty($querycomm)) {
    $end = floor(($querycomm - 1) / $config['downlist']) * $config['downlist'];

    header ("Location: down.php?act=comments&id=$id&start=$end&" . SID);
    exit;
  } else {
    show_error('Ошибка! Комментарий к данному файлу не существует!');
  } 
  break;

default:
  header("location: new.php?" . SID);
  exit;
  endswitch;

  echo '<img src="../images/img/reload.gif" alt="image" /> <a href="index.php?' . SID . '">Категории</a><br />';
  echo '<img src="../images/img/homepage.gif" alt="image" /> <a href="../index.php?' . SID . '">На главную</a>';

  include_once ('../themes/' . $config['themes'] . '/foot.php');

  ?>