// Handle "Post as Anonymous" feature $post_author = $post_as_anonymous ? '' : $user; $qId = $commentslib->post_new_comment($comments_objectId, $parent_id, $post_author, $_REQUEST["comments_title"], $_REQUEST["comments_data"], $message_id, $in_reply_to, 'n', '', '', isset($_REQUEST['contributions']) ? $_REQUEST['contributions'] : '', $anonymous_name); if ($object[0] != "forum") { $smarty->assign("comments_parentId", 0); // to display all the comments $_REQUEST["comments_parentId"] = 0; } $_REQUEST["comments_reply_threadId"] = $_REQUEST["comments_parentId"]; // to have the right re: $smarty->assign("comments_reply_threadId", $_REQUEST["comments_parentId"]); // without the flag } else { $qId = $_REQUEST["comments_threadId"]; if ($tiki_p_edit_comments == 'y' && (!isset($forum_mode) || $forum_mode == 'n') || ($tiki_p_forum_post == 'y' || $tiki_p_admin_forum == 'y') && isset($forum_mode) && $forum_mode == 'y' || $commentslib->user_can_edit_post($user, $_REQUEST["comments_threadId"])) { $commentslib->update_comment($_REQUEST["comments_threadId"], $_REQUEST["comments_title"], $_REQUEST["comment_rating"], $_REQUEST["comments_data"], 'n', '', '', $comments_objectId, isset($_REQUEST['contributions']) ? $_REQUEST['contributions'] : ''); } } } if (isset($_REQUEST['contributions'])) { unset($_REQUEST['contributions']); } $object = explode(':', $comments_objectId); if ($object[0] == 'forum') { // Deal with attachment if (($forum_info['att'] == 'att_all' || $forum_info['att'] == 'att_admin' && $tiki_p_admin_forum == 'y' || $forum_info['att'] == 'att_perm' && $tiki_p_forum_attach == 'y') && isset($_FILES['userfile1']) && is_uploaded_file($_FILES['userfile1']['tmp_name'])) { $fp = fopen($_FILES['userfile1']['tmp_name'], "rb"); $data = ''; $fhash = ''; if ($forum_info['att_store'] == 'dir') { $name = $_FILES['userfile1']['name'];
if ($threadId) { // Deal with mail notifications. include_once 'lib/notifications/notificationemaillib.php'; sendForumEmailNotification('forum_post_topic', $_REQUEST['forumId'], $forum_info, $_REQUEST["comments_title"], $_REQUEST["comments_data"], $user, $_REQUEST["comments_title"], $message_id, '', $threadId); } } // PROCESS ATTACHMENT HERE if ($threadId && isset($_FILES['userfile1']) && is_uploaded_file($_FILES['userfile1']['tmp_name'])) { check_ticket('view-forum'); $fp = fopen($_FILES['userfile1']['tmp_name'], "rb"); $commentslib->add_thread_attachment($forum_info, $threadId, $fp, '', $_FILES['userfile1']['name'], $_FILES['userfile1']['type'], $_FILES['userfile1']['size']); } //END ATTACHMENT PROCESSING $commentslib->register_forum_post($_REQUEST["forumId"], 0); } elseif ($tiki_p_admin_forum == 'y' || $commentslib->user_can_edit_post($user, $_REQUEST["comments_threadId"])) { $commentslib->update_comment($_REQUEST["comments_threadId"], $_REQUEST["comments_title"], '', $_REQUEST["comments_data"], $_REQUEST["comment_topictype"], $_REQUEST['comment_topicsummary'], $_REQUEST['comment_topicsmiley']); // PROCESS ATTACHMENT HERE if ($threadId && isset($_FILES['userfile1']) && is_uploaded_file($_FILES['userfile1']['tmp_name'])) { check_ticket('view-forum'); $fp = fopen($_FILES['userfile1']['tmp_name'], "rb"); $commentslib->add_thread_attachment($forum_info, $_REQUEST["comments_threadId"], $fp, '', $_FILES['userfile1']['name'], $_FILES['userfile1']['type'], $_FILES['userfile1']['size']); } //END ATTACHMENT PROCESSING } } } else { $smarty->assign('msg', tra("Please wait 2 minutes between posts")); $smarty->display("error.tpl"); die; } } else {
$parent_id = $_REQUEST["comments_parentId"]; } $qId = $commentslib->post_new_comment($comments_objectId, $parent_id, $user, $_REQUEST["comments_title"], $_REQUEST["comments_data"], $message_id, $in_reply_to); if ($object[0] != "forum") { $smarty->assign("comments_parentId", 0); // to display all the comments $_REQUEST["comments_parentId"] = 0; } $_REQUEST["comments_reply_threadId"] = $_REQUEST["comments_parentId"]; // to have the right re: $smarty->assign("comments_reply_threadId", $_REQUEST["comments_parentId"]); // without the flag } else { $qId = $_REQUEST["comments_threadId"]; if ($tiki_p_edit_comments == 'y' && (!isset($forum_mode) || $forum_mode == 'n') || ($tiki_p_forum_post == 'y' || $tiki_p_admin_forum == 'y') && isset($forum_mode) && $forum_mode == 'y' || $commentslib->user_can_edit_post($user, $_REQUEST["comments_threadId"])) { $commentslib->update_comment($_REQUEST["comments_threadId"], $_REQUEST["comments_title"], $_REQUEST["comment_rating"], $_REQUEST["comments_data"]); } } $object = explode(':', $comments_objectId); if ($object[0] == 'forum') { // Deal with attachment if (isset($_FILES['userfile1']) && is_uploaded_file($_FILES['userfile1']['tmp_name'])) { $fp = fopen($_FILES['userfile1']['tmp_name'], "rb"); $commentslib->add_thread_attachment($forum_info, $qId, $fp, '', $_FILES['userfile1']['name'], $_FILES['userfile1']['type'], $_FILES['userfile1']['size']); } // Deal with mail notifications. include_once 'lib/notifications/notificationemaillib.php'; sendForumEmailNotification('forum_post_thread', $qId, $forum_info, $_REQUEST["comments_title"], $_REQUEST["comments_data"], $user, $thread_info['title'], $message_id, $in_reply_to, $_REQUEST['comments_parentId'], $_REQUEST['comments_grandParentId']); $commentslib->register_forum_post($_REQUEST["forumId"], $_REQUEST["comments_parentId"]); } if ($feature_user_watches == 'y' && $wiki_watch_comments == 'y' && isset($_REQUEST["page"])) {
include_once 'lib/notifications/notificationemaillib.php'; sendForumEmailNotification('forum_post_topic', $_REQUEST['forumId'], $forum_info, $_REQUEST['comments_title'], $_REQUEST['comments_data'], $user, $_REQUEST['comments_title'], $message_id, '', $threadId, isset($_REQUEST['comments_parentId']) ? $_REQUEST['comments_parentId'] : 0, isset($_REQUEST['contributions']) ? $_REQUEST['contributions'] : ''); // Set watch if requested if ($prefs['feature_user_watches'] == 'y' && $user && isset($_REQUEST['set_thread_watch']) && $_REQUEST['set_thread_watch'] == 'y') { $tikilib->add_user_watch($user, 'forum_post_thread', $threadId, 'forum topic', $forum_info['name'] . ':' . $_REQUEST["comments_title"], "tiki-view_forum_thread.php?forumId=" . $forum_info['forumId'] . "&comments_parentId=" . $threadId); } } } elseif ($_REQUEST['forumId'] != $prefs['wiki_forum_id']) { // the threadId already exists $smarty->assign('duplic', 'y'); unset($_REQUEST['comments_postComment']); // not to go in the topic redirection } $commentslib->register_forum_post($_REQUEST["forumId"], 0); } elseif ($tiki_p_admin_forum == 'y' || $commentslib->user_can_edit_post($user, $_REQUEST["comments_threadId"])) { $commentslib->update_comment($_REQUEST["comments_threadId"], $_REQUEST["comments_title"], '', $_REQUEST["comments_data"], $_REQUEST["comment_topictype"], $_REQUEST['comment_topicsummary'], $_REQUEST['comment_topicsmiley'], 'forum:' . $_REQUEST["forumId"], isset($_REQUEST['contributions']) ? $_REQUEST['contributions'] : ''); // TAG Stuff $cat_type = 'forum post'; $cat_objid = $_REQUEST["comments_threadId"]; $cat_desc = substr($_REQUEST["comments_data"], 0, 200); $cat_name = $_REQUEST["comments_title"]; $cat_href = "tiki-view_forum_thread.php?comments_parentId=" . $_REQUEST["comments_threadId"] . "&forumId=" . $_REQUEST["forumId"]; include_once "freetag_apply.php"; // PROCESS ATTACHMENT HERE if ($_REQUEST['comments_threadId'] && isset($_FILES['userfile1']) && !empty($_FILES['userfile1']['name'])) { if (is_uploaded_file($_FILES['userfile1']['tmp_name'])) { check_ticket('view-forum'); $fp = fopen($_FILES['userfile1']['tmp_name'], "rb"); $commentslib->add_thread_attachment($forum_info, $_REQUEST["comments_threadId"], $fp, '', $_FILES['userfile1']['name'], $_FILES['userfile1']['type'], $_FILES['userfile1']['size']); } else { $smarty->assign('msg', $tikilib->uploaded_file_error($_FILES['userfile1']['error']));