View file betachat/actions.php

File size: 1.44Kb
<?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_text = (int) $_GET ['id'];

$q = $db->prepare("SELECT * FROM `roms_message` WHERE `id` = ? LIMIT 1");
$q->execute(Array($id_text));

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



$listing = new listing;


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

$post = $listing->post();
$post->title = $ank->nick();
$post->content = text::toOutput($rev['text']);
$post->time = misc::when($rev['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 >= 2) {
    $post = $listing->post();
    $post->title = __('Удалить сообщение');
    $post->icon('delete');
    $post->url = 'message.delete.php?id=' . $id_text;
}


$listing->display();


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