Вход Регистрация
Файл: modules/forum/delete_topic.php
Строк: 66
<?php
/****
* @package LiveCMS
* @link livecms.org
* @author MyZik
* @version See attached file VERSION.txt
* @license See attached file LICENSE.txt
* @copyright Copyright (C) LiveCMS Development Team
****/

ob_start();
$lang_forum load_lng('forum'); // Подключаем файл языка

$title $lang_forum['forum']; // Заголовок страницы
$module 'forum'// Модуль

  /**
    * Проверка наличия авторизации
  **/
  
if (!isset($user)) {
    require_once(
HOME .'/incfiles/header.php');
    echo 
'<div class="error">' $lang['only_users'] . '</div>';
    echo 
'<div class="home">' .
    
'<img src="/design/themes/' $set_user['theme'] . '/images/back.png" alt="" /> <a href="/index.php">' $lang['back'] . '</a>' .
    
'</div>';
    require_once(
HOME .'/incfiles/footer.php');
      }

  
/**
    * Проверяем, задан ли параметр
  **/
  
if (!isset($_GET['id']) || empty($_GET['id']) || !is_numeric($_GET['id'])) {
    require_once(
HOME .'/incfiles/header.php');
    echo 
'<div class="error">' $lang['error_parameter'] . '</div>';
    echo 
'<div class="home">' .
    
'<img src="/design/themes/' $set_user['theme'] . '/images/back.png" alt="" /> <a href="index.php">' $lang['back'] . '</a>' .
    
'</div>';
    require_once(
HOME .'/incfiles/footer.php');
      }

  
/**
    * Проверяем наличие темы
  **/
  
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_forum_topics` WHERE `id` = '" num($_GET['id']) . "'"), 0) == 0) {
    require_once(
HOME .'/incfiles/header.php');
    echo 
'<div class="error">' $lang_forum['topic_not_exists'] . '</div>';
    echo 
'<div class="home">' .
    
'<img src="/design/themes/' $set_user['theme'] . '/images/back.png" alt="" /> <a href="index.php">' $lang['back'] . '</a>' .
    
'</div>';
    require_once(
HOME .'/incfiles/footer.php');
      }

  
$ID num($_GET['id']);
  
$topic mysql_fetch_assoc(mysql_query("SELECT * FROM `cms_forum_topics` WHERE `id` = '$ID' LIMIT 1"));
  
$section mysql_fetch_assoc(mysql_query("SELECT * FROM `cms_forum_sections` WHERE `id` = '" $topic['section_id'] . "' LIMIT 1"));
  
$category mysql_fetch_assoc(mysql_query("SELECT * FROM `cms_forum_categories` WHERE `id` = '" $topic['category_id'] . "' LIMIT 1"));
  
$user_topic mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '" $topic['author_id'] . "' LIMIT 1"));
  
/**
    * Проверяем права доступа
  **/
  
if (($user['rights'] == || $user['rights'] >= 7) && ($user_topic['rights'] <= $user['rights'])) {
    if (!isset(
$_GET['yes'])) {
      require_once(
HOME .'/incfiles/header.php'); // Подключаем шапку
      /**
        * Небольшая панель навигации
      **/
      
echo '<div class="title"><a href="/forum/">' $lang['forum'] . '</a> | <a href="category.php?id=' $category['id'] . '">' txt($category['name']) . '</a> | <a href="section.php?id=' $section['id'] . '">' txt($section['name']) . '</a></div>';
      echo 
'<div class="error">' .
      
$lang_forum['topic_delete_info'] . '<br />' .
      
'<a href="delete_topic.php?id=' $ID '&amp;yes"><input type="button" name="" value="' $lang['delete'] . '" /></a> | <a href="topic.php?id=' $ID '">' $lang['cancel'] . '</a>' .
      
'</div>';
      require_once(
HOME .'/incfiles/footer.php'); // Подключаем ноги
    
} else {
    
mysql_query("DELETE FROM `cms_forum_topics` WHERE `id` = '$ID' LIMIT 1");
    
mysql_query("DELETE FROM `cms_forum_messages` WHERE `topic_id` = '$ID' LIMIT 1");
    
header("Location: section.php?id=$topic[section_id]");
  }
} else {
    
header("Location: topic.php?id=$ID");
}
ob_end_flush();
?>
Онлайн: 0
Реклама