Exemplo n.º 1
0
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';
    $buttons['cancel']['value'] = __('Cancel', 'bxpress');
    $buttons['cancel']['type'] = 'button';
    $buttons['cancel']['extra'] = 'onclick="window.location=\'topic.php?pid=' . $id . '#p' . $id . '\';"';
    $text = __('Dou you really wish to delete specified post?', 'bxpress');
    if ($id == bXFunctions::getFirstId($topic->id())) {
        $text .= "<br /><br /><span class='bbwarning'>" . __('<strong>Warning:</strong> This is the first post in the topic. By deleting this all posts will be deleted also.', 'bxpress') . "</span>";