if ($tikilib->register_user_vote($user, 'comment' . $_REQUEST['comments_threadId'], $_REQUEST['comments_vote'], range(1, 5))) { $commentslib->vote_comment($_REQUEST['comments_threadId'], $user, $_REQUEST['comments_vote']); } $_REQUEST['comments_threadId'] = 0; $smarty->assign('comments_threadId', 0); } } if ($user) { $userinfo = $userlib->get_user_info($user); $smarty->assign_by_ref('userinfo', $userinfo); } if (isset($_REQUEST['comments_remove']) && isset($_REQUEST['comments_threadId'])) { if ($tiki_p_admin_forum == 'y' || ($commentslib->user_can_edit_post($user, $_REQUEST['comments_threadId']) && $tiki_p_forum_post_topic == 'y') ) { $access->check_authenticity(); $comments_show = 'y'; $commentslib->remove_comment($_REQUEST['comments_threadId']); $commentslib->register_remove_post($_REQUEST['forumId'], 0); } else { // user can't edit this post $smarty->assign('msg', tra('You are not permitted to remove someone else\'s post!')); $smarty->assign('errortype', 'no_redirect_login'); $smarty->display('error.tpl'); die; } unset($_REQUEST['comments_threadId']); } if ($_REQUEST['comments_threadId'] > 0) {
} // 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') {
// The thread *WAS* successfully created. 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; }