<?php

if (!defined('XOOPS_ROOT_PATH')) {
    exit;
}
// get (object)$forumpost
$forumpost = new ForumPosts(intval(@$_GET['post_id']));
$post_id = intval($forumpost->postid());
if (empty($post_id)) {
    die(_MD_XHNEWBB_ERRORPOST);
}
$topic_id = intval($forumpost->topic());
$forum = intval($forumpost->forum());
// lock check (even admin cannot post into locked topic)
if (xhnewbb_is_locked($topic_id)) {
    die(_MD_XHNEWBB_TOPICLOCKED);
}
Example #2
0
    }
    include XOOPS_ROOT_PATH . '/header.php';
    include_once 'class/class.forumposts.php';
    $forumpost = new ForumPosts($post_id);
    $r_message = $forumpost->text();
    $r_date = formatTimestamp($forumpost->posttime());
    $r_name = $forumpost->uid() != 0 ? XoopsUser::getUnameFromId($forumpost->uid()) : $xoopsConfig['anonymous'];
    $r_content = _MD_BY . " " . $r_name . " " . _MD_ON . " " . $r_date . "<br /><br />";
    $r_content .= $r_message;
    $r_subject = $forumpost->subject();
    if (!preg_match("/^Re:/i", $r_subject)) {
        $subject = 'Re: ' . $myts->htmlSpecialChars($r_subject);
    } else {
        $subject = $myts->htmlSpecialChars($r_subject);
    }
    $q_message = $forumpost->text("Quotes");
    $hidden = "[quote]\n";
    $hidden .= sprintf(_MD_USERWROTE, $r_name);
    $hidden .= "\n" . $q_message . "[/quote]";
    $message = "";
    themecenterposts($r_subject, $r_content);
    echo "<br />";
    $pid = $post_id;
    unset($post_id);
    $topic_id = $forumpost->topic();
    $forum = $forumpost->forum();
    $isreply = 1;
    $istopic = 0;
    include 'include/forumform.inc.php';
    include XOOPS_ROOT_PATH . '/footer.php';
}
Example #3
0
 $forumpost->setIcon($HTTP_POST_VARS['icon']);
 $forumpost->setAttachsig($HTTP_POST_VARS['attachsig']);
 if (!($postid = $forumpost->store())) {
     include_once XOOPS_ROOT_PATH . '/header.php';
     xoops_error('Could not insert forum post');
     include_once XOOPS_ROOT_PATH . '/footer.php';
     exit;
 }
 if (is_object($xoopsUser) && !empty($isnew)) {
     $xoopsUser->incrementPost();
 }
 // RMV-NOTIFY
 // Define tags for notification message
 $tags = array();
 $tags['THREAD_NAME'] = $HTTP_POST_VARS['subject'];
 $tags['THREAD_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/viewtopic.php?forum=' . $forum . '&post_id=' . $postid . '&topic_id=' . $forumpost->topic();
 $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $postid;
 include_once 'include/notification.inc.php';
 $forum_info = newbb_notify_iteminfo('forum', $forum);
 $tags['FORUM_NAME'] = $forum_info['name'];
 $tags['FORUM_URL'] = $forum_info['url'];
 $notification_handler =& xoops_gethandler('notification');
 if (!empty($isnew)) {
     if (empty($isreply)) {
         // Notify of new thread
         $notification_handler->triggerEvent('forum', $forum, 'new_thread', $tags);
     } else {
         // Notify of new post
         $notification_handler->triggerEvent('thread', $topic_id, 'new_post', $tags);
     }
     $notification_handler->triggerEvent('global', 0, 'new_post', $tags);
     if (!$xoopsDB->query($sql)) {
         die(_MD_XHNEWBB_DATABASEERROR);
     }
 } else {
     // get topic_id from post_id
     $targetpost = new ForumPosts($pid);
     $pid = intval($targetpost->postid());
     // loop check
     if (in_array($pid, $children)) {
         die(_MD_XHNEWBB_ERROR_PIDLOOP);
     }
     $new_forum = intval($targetpost->forum());
     if (empty($pid)) {
         die(_MD_XHNEWBB_ERRORPOST);
     }
     $new_topic_id = intval($targetpost->topic());
     $sql = "UPDATE " . $xoopsDB->prefix("xhnewbb_posts") . " SET pid={$pid} WHERE post_id={$post_id}";
     if (!$xoopsDB->query($sql)) {
         die(_MD_XHNEWBB_DATABASEERROR);
     }
 }
 foreach ($children as $child_post_id) {
     $child_post_id = intval($child_post_id);
     $sql = "UPDATE " . $xoopsDB->prefix("xhnewbb_posts") . " SET topic_id={$new_topic_id},forum_id={$new_forum} WHERE post_id={$child_post_id}";
     $xoopsDB->query($sql);
 }
 xhnewbb_sync($new_forum, "forum");
 xhnewbb_sync($forum, "forum");
 xhnewbb_sync($topic_id, "topic");
 xhnewbb_sync($new_topic_id, "topic");
 redirect_header(XOOPS_URL . "/modules/xhnewbb/viewtopic.php?topic_id={$new_topic_id}", 2, _MD_XHNEWBB_CUTPASTESUCCESS);
Example #5
0
 if ($forumdata['allow_sig']) {
     $forumpost->setAttachsig(@$_POST['attachsig']);
 } else {
     $forumpost->setAttachsig(0);
 }
 // insert
 if (!($post_id = $forumpost->store())) {
     die('Could not insert forum post');
 }
 // increment post
 if (is_object(@$xoopsUser) && $mode != 'edit') {
     $xoopsUser->incrementPost();
 }
 // set u2t_marked
 $uid = is_object(@$xoopsUser) ? $xoopsUser->getVar('uid') : 0;
 $topic_id = $forumpost->topic();
 $u2t_marked = empty($_POST['u2t_marked']) ? 0 : 1;
 if (!empty($xoopsModuleConfig['xhnewbb_allow_mark']) && $uid > 0) {
     $xoopsDB->query("UPDATE " . $xoopsDB->prefix("xhnewbb_users2topics") . " SET u2t_marked={$u2t_marked} , u2t_time=" . time() . " WHERE uid='{$uid}' AND topic_id='{$topic_id}'");
     if (!$xoopsDB->getAffectedRows()) {
         $xoopsDB->query('INSERT INTO ' . $xoopsDB->prefix('xhnewbb_users2topics') . " SET uid='{$uid}',topic_id='{$topic_id}',u2t_marked={$u2t_marked} , u2t_time=" . time());
     }
 }
 // RMV-NOTIFY
 // Define tags for notification message
 $tags = array();
 $tags['POSTER_UNAME'] = is_object(@$xoopsUser) ? $xoopsUser->getVar('uname') : _GUESTS;
 $tags['THREAD_NAME'] = $_POST['subject'];
 $tags['THREAD_URL'] = XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/viewtopic.php?post_id={$post_id}&topic_id=" . $forumpost->topic();
 $tags['POST_URL'] = $tags['THREAD_URL'] . '#forumpost' . $post_id;
 include_once XOOPS_ROOT_PATH . '/modules/xhnewbb/include/notification.inc.php';
Example #6
0
if ($xoopsUser) {
    if (!$xoopsUser->isAdmin($xoopsModule->mid())) {
        if (!is_moderator($forum, $xoopsUser->uid())) {
            redirect_header("viewtopic.php?topic_id={$topic_id}&amp;order={$order}&amp;viewmode={$viewmode}&amp;pid={$pid}&amp;forum={$forum}", 2, _MD_DELNOTALLOWED);
            exit;
        }
    }
} else {
    redirect_header("viewtopic.php?topic_id={$topic_id}&amp;order={$order}&amp;viewmode={$viewmode}&amp;pid={$pid}&amp;forum={$forum}", 2, _MD_DELNOTALLOWED);
    exit;
}
include_once 'class/class.forumposts.php';
if (!empty($_POST['ok'])) {
    if (!empty($post_id)) {
        $post = new ForumPosts($post_id);
        $post->delete();
        sync($post->forum(), "forum");
        sync($post->topic(), "topic");
    }
    if ($post->istopic()) {
        redirect_header("viewforum.php?forum={$forum}", 2, _MD_POSTSDELETED);
        exit;
    } else {
        redirect_header("viewtopic.php?topic_id={$topic_id}&amp;order={$order}&amp;viewmode={$viewmode}&amp;pid={$pid}&amp;forum={$forum}", 2, _MD_POSTSDELETED);
        exit;
    }
} else {
    include XOOPS_ROOT_PATH . "/header.php";
    xoops_confirm(array('post_id' => $post_id, 'viewmode' => $viewmode, 'order' => $order, 'forum' => $forum, 'topic_id' => $topic_id, 'ok' => 1), 'delete.php', _MD_AREUSUREDEL);
}
include XOOPS_ROOT_PATH . '/footer.php';