예제 #1
0
}
// Verificamos si el usuario tiene permiso de eliminación para el post
if ($xoopsUser->uid() != $post->user() && (!$xoopsUser->isAdmin() && !$forum->isModerator($xoopsUser->uid()))) {
    redirect_header('topic.php?pid=' . $id . '#p' . $id, 2, __('Sorry, you don\'t have permission to do this action!', 'bxpress'));
    die;
}
if ($ok) {
    if (!$xoopsSecurity->check()) {
        redirect_header('topic.php?pid=' . $id . '#p' . $id, 2, __('Session token expired!', 'bxpress'));
        die;
    }
    if ($post->id() == bXFunctions::getFirstId($topic->id())) {
        $ret = $topic->delete();
        $wtopic = true;
    } else {
        $ret = $post->delete();
        $wtopic = false;
    }
    if ($ret) {
        redirect_header($wtopic ? 'forum.php?id=' . $forum->id() : 'topic.php?id=' . $topic->id(), 1, $wtopic ? __('Topic deleted successfully!', 'bxpress') : __('Post deleted successfully!', 'bxpress'));
    } else {
        redirect_header('topic.php?pid=' . $id, 1, ($wtopic ? __('The topic could not be deleted!', 'bxpress') : __('The post could not be deleted!', 'bxpress')) . '<br />' . ($wtopic ? $topic->errors() : $post->errors()));
    }
} else {
    include 'header.php';
    //include '../../header.php';
    $myts =& MyTextSanitizer::getInstance();
    $hiddens['ok'] = 1;
    $hiddens['id'] = $id;
    $buttons['sbt']['value'] = __('Delete', 'bxpress');
    $buttons['sbt']['type'] = 'submit';