<?php

include_once '../sys/inc/start.php';
$doc = new document();
$doc->title = __('Действия');

if (!isset($_GET ['id']) || !is_numeric($_GET ['id'])) {
    if (isset($_GET ['return']))
        header('Refresh: 1; url=' . $_GET ['return']);
    else
        header('Refresh: 1; url=./');
    $doc->err(__('Ошибка выбора сообщения'));
    exit();
}
$id_message = (int) $_GET ['id'];

$q = mysql_query("SELECT * FROM `chat_mini` WHERE `id` = '$id_message' LIMIT 1");

if (!mysql_num_rows($q)) {
    if (isset($_GET ['return']))
        header('Refresh: 1; url=' . $_GET ['return']);
    else
        header('Refresh: 1; url=./');
    $doc->err(__('Сообщение не найдено'));
    exit();
}

$message = mysql_fetch_assoc($q);




$listing = new listing;


$ank = new user($message['id_user']);

$post = $listing->post();
$post->title = $ank->nick();
$post->content = output_text($message['message']);
$post->time = vremja($message['time']);
$post->icon($ank->icon());

$post = $listing->post();
$post->title = __('Посмотреть анкету');
$post->icon('ank_view');
$post->url = '/profile.view.php?id=' . $ank->id;


if ($user->group) {
    $post = $listing->post();
    $post->title = __('Ответить');
    $post->icon('reply');
    $post->url = 'index.php?message=' . $id_message . '&amp;reply';

    $post = $listing->post();
    $post->title = __('Цитировать');
    $post->icon('quote');
    $post->url = 'index.php?message=' . $id_message . '&amp;quote';
}

if ($user->group >= 2) {
    $post = $listing->post();
    $post->title = __('Удалить сообщение');
    $post->icon('delete');
    $post->url = 'message.delete.php?id=' . $id_message;
}


$listing->display();


$doc->ret(__('Вернуться'), './');
?>
