setQuery("SELECT catid FROM #__fb_messages WHERE id='{$id}'");
$msgcat = $kunena_db->loadResult();
check_dberror('Unable to check message.');
if ($msgcat) $catid = $msgcat;
}
//get the allowed forums and turn it into an array
$allow_forum = ($fbSession->allowed <> '')?explode(',', $fbSession->allowed):array();
if (!in_array($catid, $allow_forum))
{
echo _KUNENA_NO_ACCESS;
return;
}
//
//ob_start();
$pubwrite = (int)$fbConfig->pubwrite;
//ip for floodprotection, post logging, subscriptions, etcetera
$ip = $_SERVER["REMOTE_ADDR"];
//reset variables used
// ERROR: mixed global $editmode
global $editmode;
$kunena_my = &JFactory::getUser();
$kunena_acl = &JFactory::getACL();
$kunena_db = &JFactory::getDBO();
$editmode = 0;
$message = JRequest::getVar('message', '', 'REQUEST', 'string', JREQUEST_ALLOWRAW);
$resubject = JRequest::getVar('resubject', '', 'REQUEST', 'string');
$attachfile = JRequest::getVar('attachfile', NULL, 'FILES', 'array');
$attachimage = JRequest::getVar('attachimage', NULL, 'FILES', 'array');
//ip for floodprotection, post logging, subscriptions, etcetera
$ip = $_SERVER ["REMOTE_ADDR"];
//flood protection
$fbConfig->floodprotection = (int)$fbConfig->floodprotection;
// Flood protection
if ($fbConfig->floodprotection && ($action == "post" || $do == 'quote' || $do == 'reply') && ! $is_admin) {
$kunena_db->setQuery ( "SELECT MAX(time) FROM #__fb_messages WHERE ip='{$ip}'" );
$lastPostTime = $kunena_db->loadResult ();
check_dberror ( "Unable to load max time for current request from IP: $ip" );
if ($lastPostTime + $fbConfig->floodprotection > $systime) {
echo _POST_TOPIC_FLOOD1 . ' ' . $fbConfig->floodprotection . ' ' . _POST_TOPIC_FLOOD2 . '
';
echo _POST_TOPIC_FLOOD3;
return;
}
}
// Begin captcha
if ($fbConfig->captcha == 1 && $kunena_my->id < 1) {
$number = JRequest::getVar ( 'txtNumber', '', 'POST' );
if ($message != NULL)
{
$session =& JFactory::getSession();
$rand = $session->get('fb_image_random_value');
unset($session);
if (md5($number) != $rand)
{
$mess = _KUNENA_CAPERR;
echo "";
echo "";
return;
$app->close();
//break;
}
}
}
// Finish captcha
//Let's find out who we're dealing with if a registered user wants to make a post
if ($kunena_my->id) {
$my_name = $fbConfig->username ? $kunena_my->username : $kunena_my->name;
$user_email = $kunena_my->email;
$registeredUser = 1;
if ($is_Moderator) {
if (!empty($fb_authorname)) $my_name = $fb_authorname;
if(!empty($email))
$user_email = $email;
}
} else {
$my_name = $fb_authorname;
$user_email = (isset($email) && !empty($email))? $email:'';
$registeredUser = 0;
}
//Now find out the forumname to which the user wants to post (for reference only)
$kunena_db->setQuery("SELECT * FROM #__fb_categories WHERE id='{$catid}'");
$kunena_db->query() or trigger_dberror('Unable to load category.');
$objCatInfo = $kunena_db->loadObject();
$catName = $objCatInfo->name;
?>
id, $fbConfig->pubwrite, $is_Moderator)))
{
?>
' . _SUBMIT_CANCEL . " "; echo CKunenaLink::GetLatestPostAutoRedirectHTML($fbConfig, $pid, $fbConfig->messages_per_page, $catid); } else { if ($do == "quote" && (hasPostPermission($kunena_db, $catid, $id, $kunena_my->id, $fbConfig->pubwrite, $is_Moderator))) { //reply do quote $parentid = 0; $id = (int)$id; if ($id > 0) { $kunena_db->setQuery("SELECT m.*, t.mesid, t.message FROM #__fb_messages AS m, #__fb_messages_text AS t WHERE m.id='{$id}' AND t.mesid='{$id}'"); $kunena_db->query(); if ($kunena_db->getNumRows() > 0) { unset($message); $message = $kunena_db->loadObject(); // don't forget stripslashes //$message->message=smile::smileReplace($message->message,0); $table = array_flip(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES)); //$quote = strtr($message->message, $table); $quote = stripslashes($message->message); $htmlText = "[b]" . stripslashes($message->name) . " " . _POST_WROTE . ":[/b]\n"; $htmlText .= '[quote]' . $quote . "[/quote]"; //$quote = smile::fbStripHtmlTags($quote); $resubject = strtr($message->subject, $table); $resubject = strtolower(substr($resubject, 0, strlen(_POST_RE))) == strtolower(_POST_RE) ? stripslashes($resubject) : _POST_RE . stripslashes($resubject); //$resubject = kunena_htmlspecialchars($resubject); $resubject = smile::fbStripHtmlTags($resubject); //$resubject = smile::fbStripHtmlTags($resubject); $parentid = $message->id; $authorName = $my_name; } } ?> "; //} } else { $app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR); } } else if ($do == "editpostnow") { $modified_reason = addslashes(JRequest::getVar("modified_reason", null)); $modified_by = $kunena_my->id; $modified_time = CKunenaTools::fbGetInternalTime(); $id = (int) $id; $kunena_db->setQuery("SELECT * FROM #__fb_messages AS m LEFT JOIN #__fb_messages_text AS t ON m.id=t.mesid WHERE m.id='{$id}'"); $message1 = $kunena_db->loadObjectList(); check_dberror("Unable to load messages."); $mes = $message1[0]; $userid = $mes->userid; //Check for a moderator or superadmin if ($is_Moderator) { $allowEdit = 1; } if ($fbConfig->useredit == 1 && $kunena_my->id != "") { //Now, if the author==viewer and the viewer is allowed to edit his/her own post the let them edit if ($kunena_my->id == $userid) { if(((int)$fbConfig->useredittime)==0) { $allowEdit = 1; } else { $modtime = $mes->modified_time; if(!$modtime) { $modtime = $mes->time; } if(($modtime + ((int)$fbConfig->useredittime) + ((int)$fbConfig->useredittimegrace)) >= CKunenaTools::fbGetInternalTime()) { $allowEdit = 1; } } } } if ($allowEdit == 1) { if (is_array($attachfile) && $attachfile['error'] != UPLOAD_ERR_NO_FILE) { include KUNENA_PATH_LIB .DS. 'kunena.file.upload.php'; } if (is_array($attachimage) && $attachimage['error'] != UPLOAD_ERR_NO_FILE) { include KUNENA_PATH_LIB .DS. 'kunena.image.upload.php'; } //$message = trim(kunena_htmlspecialchars(addslashes($message))); $message = trim(addslashes($message)); //parse the message for some preliminary bbcode and stripping of HTML //$message = smile::bbencode_first_pass($message); if (count($message1) > 0) { // Re-check the hold. If post gets edited and review is set to ON for this category // check if the post must be reviewed by a Moderator prior to showing // doesn't apply to admin/moderator posts ;-) $holdPost = 0; if (!$is_Moderator) { $kunena_db->setQuery("SELECT review FROM #__fb_categories WHERE id='{$catid}'"); $kunena_db->query() or trigger_dberror('Unable to load review flag from categories.'); $holdPost = $kunena_db->loadResult(); } if (!$fbConfig->askemail){ if (empty($email)) { $email = $mes->email; } } if ( $mes->topic_emoticon == $topic_emoticon ) { $topic_emoticon = $mes->topic_emoticon; } $kunena_db->setQuery( "UPDATE #__fb_messages SET name=".$kunena_db->quote($fb_authorname).", email=".$kunena_db->quote(addslashes($email)) . (($fbConfig->editmarkup) ? " ,modified_by='" . $modified_by . "' ,modified_time='" . $modified_time . "' ,modified_reason=" . $kunena_db->quote($modified_reason) : "") . ", subject=" . $kunena_db->quote(addslashes($subject)) . ", topic_emoticon='" . ((int)$topic_emoticon) . "', hold='" . ((int)$holdPost) . "' WHERE id={$id}"); $dbr_nameset = $kunena_db->query(); $kunena_db->setQuery("UPDATE #__fb_messages_text SET message=".$kunena_db->quote($message)." WHERE mesid='{$id}'"); if ($kunena_db->query() && $dbr_nameset) { //Update the attachments table if an image has been attached if (!empty($imageLocation) && file_exists($imageLocation)) { $imageLocation = addslashes($imageLocation); $kunena_db->setQuery("INSERT INTO #__fb_attachments (mesid, filelocation) VALUES ('$id',".$kunena_db->quote($imageLocation).")"); if (!$kunena_db->query()) { echo "\n"; } } //Update the attachments table if an file has been attached if (!empty($fileLocation) && file_exists($fileLocation)) { $fileLocation = addslashes($fileLocation); $kunena_db->setQuery("INSERT INTO #__fb_attachments (mesid, filelocation) VALUES ('$id',".$kunena_db->quote($fileLocation).")"); if (!$kunena_db->query()) { echo "\n"; } } echo ' ' . _POST_SUCCESS_EDIT . " "; echo CKunenaLink::GetLatestPostAutoRedirectHTML($fbConfig, $id, $fbConfig->messages_per_page, $catid); } else { echo _POST_ERROR_MESSAGE_OCCURED; } } else { echo _POST_INVALID; } } else { $app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR); } } else if ($do == "delete") { if (!$is_Moderator) { $app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR); } $id = (int)$id; $kunena_db->setQuery("SELECT * FROM #__fb_messages WHERE id='{$id}'"); $message = $kunena_db->loadObjectList(); check_dberror("Unable to load messages."); foreach ($message as $mes) { ?> redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR); } $id = JRequest::getInt('id', 0); $dellattach = JRequest::getVar('delAttachments', '') == 'delAtt' ? 1 : 0; $thread = fb_delete_post($kunena_db, $id, $dellattach); CKunenaTools::reCountBoards(); switch ($thread) { case -1: echo _POST_ERROR_TOPIC . ' '; echo _KUNENA_POST_DEL_ERR_CHILD; break; case -2: echo _POST_ERROR_TOPIC . ' '; echo _KUNENA_POST_DEL_ERR_MSG; break; case -3: echo _POST_ERROR_TOPIC . ' '; $tmpstr = _KUNENA_POST_DEL_ERR_TXT; $tmpstr = str_replace('%id%', $id, $tmpstr); echo $tmpstr; break; case -4: echo _POST_ERROR_TOPIC . ' '; echo _KUNENA_POST_DEL_ERR_USR; break; case -5: echo _POST_ERROR_TOPIC . ' '; echo _KUNENA_POST_DEL_ERR_FILE; break; default: echo ' ' . _POST_SUCCESS_DELETE . " "; break; } echo CKunenaLink::GetLatestCategoryAutoRedirectHTML($catid); } //fi $do==deletepostnow else if ($do == "move") { if (!$is_Moderator) { $app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR); } $catid = (int)$catid; $id = (int)$id; //get list of available forums //$kunena_db->setQuery("SELECT id, name FROM #__fb_categories WHERE parent != '0'"); $kunena_db->setQuery("SELECT a.*, b.id AS catid, b.name AS category FROM #__fb_categories AS a LEFT JOIN #__fb_categories AS b ON b.id = a.parent WHERE a.parent!='0' AND a.id IN ($fbSession->allowed) ORDER BY parent, ordering"); $catlist = $kunena_db->loadObjectList(); check_dberror("Unable to load categories."); // get topic subject: $kunena_db->setQuery("SELECT subject, id FROM #__fb_messages WHERE id='{$id}'"); $topicSubject = $kunena_db->loadResult(); check_dberror("Unable to load messages."); ?> setQuery("SELECT id, subject, catid, time AS timestamp FROM #__fb_messages WHERE id='{$id}'"); $oldRecord = $kunena_db->loadObjectList(); check_dberror("Unable to load messages."); $newCatObj = new jbCategory($kunena_db, $oldRecord[0]->catid); if (!fb_has_moderator_permission($kunena_db, $newCatObj, $kunena_my->id, $is_admin)) { $app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR); } $newSubject = _MOVED_TOPIC . " " . $oldRecord[0]->subject; $kunena_db->setQuery("SELECT MAX(time) AS timestamp FROM #__fb_messages WHERE thread='{$id}'"); $lastTimestamp = $kunena_db->loadResult(); check_dberror("Unable to load last timestamp."); if ($lastTimestamp == "") { $lastTimestamp = $oldRecord[0]->timestamp; } //perform the actual move //Move topic post first $kunena_db->setQuery("UPDATE #__fb_messages SET `catid`='$catid' WHERE `id`='$id'"); $kunena_db->query() or trigger_dberror('Unable to move thread.'); $kunena_db->setQuery("UPDATE #__fb_messages set `catid`='$catid' WHERE `thread`='$id'"); $kunena_db->query() or trigger_dberror('Unable to move thread.'); // insert 'moved topic' notification in old forum if needed if ($bool_leaveGhost) { $kunena_db->setQuery("INSERT INTO #__fb_messages (`parent`, `subject`, `time`, `catid`, `moved`, `userid`, `name`) VALUES ('0',".$kunena_db->quote($newSubject).",'$lastTimestamp','{$oldRecord[0]->catid}','1', '{$kunena_my->id}', ".$kunena_db->quote(trim(addslashes($my_name))).")"); $kunena_db->query() or trigger_dberror('Unable to insert ghost message.'); //determine the new location for link composition $newId = $kunena_db->insertid(); $newURL = "catid=" . $catid . "&id=" . $id; $kunena_db->setQuery("INSERT INTO #__fb_messages_text (`mesid`, `message`) VALUES ('$newId', ".$kunena_db->quote($newURL).")"); $kunena_db->query() or trigger_dberror('Unable to insert ghost message.'); //and update the thread id on the 'moved' post for the right ordering when viewing the forum.. $kunena_db->setQuery("UPDATE #__fb_messages SET `thread`='$newId' WHERE `id`='$newId'"); $kunena_db->query() or trigger_dberror('Unable to move thread.'); } //move succeeded CKunenaTools::reCountBoards(); echo ' ' . _POST_SUCCESS_MOVE . " "; echo CKunenaLink::GetLatestPostAutoRedirectHTML($fbConfig, $id, $fbConfig->messages_per_page, $catid); } //begin merge function else if ($do == "merge") { if (!$is_Moderator) { $app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR); } $catid = (int)$catid; $id = (int)$id; //get list of available threads in same forum $kunena_db->setQuery("SELECT id, subject FROM #__fb_messages WHERE parent='0' AND catid='{$catid}' AND id!='{$id}'"); //$kunena_db->setQuery("SELECT a.*, b.name AS category" . "\nFROM #__fb_categories AS a" . "\nLEFT JOIN #__fb_categories AS b ON b.id = a.parent" . "\nWHERE a.parent != '0'" . "\nORDER BY parent, ordering"); $threadlist = $kunena_db->loadObjectList(); check_dberror("Unable to load categories."); // get topic subject: $kunena_db->setQuery("SELECT subject, id FROM #__fb_messages WHERE id='{$id}'"); $topicSubject = $kunena_db->loadResult(); check_dberror("Unable to load messages."); ?> redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR); } $catid = (int)$catid; $id = (int)$id; $target = JRequest::getInt('threadid', 0); $how = JRequest::getInt('how', 0); $bool_leaveGhost = JRequest::getInt('leaveGhost', 0); switch ($how) { case '0' : //attach first post in source to first post in target - merge (default) default : $attachid=$target; $targetid=$target; $sourceid=$id; break; case '1' : //attach first post in target to first post in source - inverse merge $attachid=$id; $sourceid=$target; $targetid=$id; break; } //get the some details from the original post for later $kunena_db->setQuery("SELECT subject, catid, ordering, time AS timestamp FROM #__fb_messages WHERE id='{$sourceid}'"); $oldRecord = $kunena_db->loadObjectList(); check_dberror("Unable to load messages."); $newSubject = _MOVED_TOPIC . " " . $oldRecord[0]->subject; $kunena_db->setQuery("SELECT MAX(time) AS timestamp FROM #__fb_messages WHERE thread='{$sourceid}'"); $lastTimestamp = $kunena_db->loadResult(); check_dberror("Unable to load messages."); $kunena_db->setQuery("SELECT MAX(ordering) AS timestamp FROM #__fb_messages WHERE thread='{$targetid}'"); $maxordering = $kunena_db->loadResult(); check_dberror("Unable to get max(ordering) from messages."); if ($lastTimestamp == "") { $lastTimestamp = $oldRecord[0]->timestamp; } //perform the actual merge //see if you can attach $kunena_db->setQuery("UPDATE #__fb_messages set `parent`='$attachid' WHERE `id`='$sourceid'"); if ($kunena_db->query()) { //succeeded; start moving posts //make sure default merged threads get sorted correcty $kunena_db->setQuery("UPDATE #__fb_messages set ordering='$maxordering' WHERE thread='$sourceid'"); $kunena_db->query(); //Now move first post $kunena_db->setQuery("UPDATE #__fb_messages SET `thread`='$targetid' WHERE `id`='$sourceid'"); if ($kunena_db->query()) { //Move the rest of the messages $kunena_db->setQuery("UPDATE #__fb_messages set `thread`='$targetid' WHERE `thread`='$sourceid'"); $kunena_db->query(); // insert 'moved topic' notification in old forum if needed if ($bool_leaveGhost) { $kunena_db->setQuery("INSERT INTO #__fb_messages (`parent`, `subject`, `time`, `catid`, `moved`) VALUES ('0',".$kunena_db->quote($newSubject).",'" . $lastTimestamp . "','" . $oldRecord[0]->catid . "','1')"); if ($kunena_db->query()) { //determine the new location for link composition $newId = $kunena_db->insertid(); $newURL = "catid=" . $catid . "&id=" . $sourceid; $kunena_db->setQuery("INSERT INTO #__fb_messages_text (`mesid`, `message`) VALUES ('$newId', ".$kunena_db->quote($newURL).")"); if (!$kunena_db->query()) { $kunena_db->stderr(true); } //and update the thread id on the 'moved' post for the right ordering when viewing the forum.. $kunena_db->setQuery("UPDATE #__fb_messages SET `thread`='$newId' WHERE `id`='$newId'"); if (!$kunena_db->query()) { $kunena_db->stderr(true); } } else echo ' ' . _POST_GHOST_FAILED . ' '; } //merge succeeded CKunenaTools::reCountBoards(); echo '' . _POST_SUCCESS_MERGE . " "; echo CKunenaLink::GetLatestPostAutoRedirectHTML($fbConfig, $targetid, $fbConfig->messages_per_page, $catid); } else { echo "Severe database error. Update your database manually so the replies to the topic are matched to the new forum as well"; //this is severe.. takes a lot of coding to programatically correct it. Won't do that. //chances of this happening are very slim. Disclaimer: this is software as-is *lol*; //go read the GPL and the header of this file.. } } else { echo ' ' . _POST_TOPIC_NOT_MERGED . " "; echo CKunenaLink::GetLatestPostAutoRedirectHTML($fbConfig, $id, $fbConfig->messages_per_page); } } // end merge function // begin split function else if ($do == "split") { if (!$is_Moderator) { $app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR); } $error = JRequest::getInt('error', 0); $id = (int)$id; $catid = (int)$catid; // TODO: Enable split when it's fixed $app->redirect(CKunenaLink::GetLatestPageAutoRedirectURL($fbConfig, $id, $fbConfig->messages_per_page, $catid), 'Split has been disabled'); //get list of posts in thread $kunena_db->setQuery("SELECT * FROM #__fb_messages AS a " ." LEFT JOIN #__fb_messages_text AS b ON a.id=b.mesid WHERE (a.thread='{$id}' OR a.id='{$id}') AND a.hold='0' AND a.catid='{$catid}' ORDER BY a.parent ASC, a.ordering, a.time"); $postlist = $kunena_db->loadObjectList(); check_dberror("Unable to load messages."); // get topic id: $kunena_db->setQuery("SELECT id FROM #__fb_messages WHERE id='{$id}' AND parent='0'"); $id = (int)$kunena_db->loadResult(); check_dberror("Unable to load messages."); ?> redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR); } $catid = (int)$catid; $id = JRequest::getInt('id', 0); $to_split = JRequest::getInt('to_split', 0); $how = JRequest::getInt('how', 0); $new_topic = JRequest::getInt('to_topic', 0); $topic_change = 0; // TODO: Enable split when it's fixed $app->redirect(CKunenaLink::GetLatestPageAutoRedirectURL($fbConfig, $id, $fbConfig->messages_per_page, $catid), 'Split has been disabled'); if (!$to_split) { if ($new_topic != 0 && $id != $new_topic) { $topic_change = 1; $to_split = array(); array_push($to_split, $new_topic); } else { echo ' Select at least one post to split.'; return; } } //store sticky bit from old topic $kunena_db->setQuery("SELECT ordering FROM #__fb_messages WHERE id='{$id}'"); $sticky_bit = (int)$kunena_db->loadResult(); //enter topic change only sequence if (in_array($id, $to_split) || $topic_change == 1) { echo ' Assuming that you want to change topic post. ' . _POST_SUCCESS_SPLIT_TOPIC_CHANGED . " "; echo CKunenaLink::GetLatestPostAutoRedirectHTML($fbConfig, $new_topic, $fbConfig->messages_per_page, $catid); return; } else { echo ' ' . _POST_SPLIT_TOPIC_NOT_CHANGED . " "; echo CKunenaLink::GetLatestPostAutoRedirectHTML($fbConfig, $id, $fbConfig->messages_per_page); echo ' Topic change failed. Select new topic.'; return; } if (!in_array($new_topic, $to_split)) { array_push($to_split, $new_topic); echo ' Selected topic post has been force-added to split group. ' . _POST_SUCCESS_SPLIT . " "; echo CKunenaLink::GetLatestPostAutoRedirectHTML($fbConfig, $new_topic, $fbConfig->messages_per_page, $catid); } // end split function else if ($do == "subscribe") { $catid = (int)$catid; $id = (int)$id; $success_msg = _POST_NO_SUBSCRIBED_TOPIC; $kunena_db->setQuery("SELECT thread, catid from #__fb_messages WHERE id='{$id}'"); if ($id && $kunena_my->id && $kunena_db->query()) { $row = $kunena_db->loadObject(); //check for permission if (!$is_Moderator) { if ($fbSession->allowed != "na") $allow_forum = explode(',', $fbSession->allowed); else $allow_forum = array (); $obj_fb_cat = new jbCategory($kunena_db, $row->catid); if (!fb_has_read_permission($obj_fb_cat, $allow_forum, $aro_group->id, $kunena_acl)) { $app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR); return; } } $thread = $row->thread; $kunena_db->setQuery("INSERT INTO #__fb_subscriptions (thread,userid) VALUES ('$thread','$kunena_my->id')"); if (@$kunena_db->query() && $kunena_db->getAffectedRows()==1) { $success_msg = _POST_SUBSCRIBED_TOPIC; } } $app->redirect(CKunenaLink::GetLatestPageAutoRedirectURL($fbConfig, $id, $fbConfig->messages_per_page), $success_msg); } else if ($do == "unsubscribe") { $catid = (int)$catid; $id = (int)$id; $success_msg = _POST_NO_UNSUBSCRIBED_TOPIC; $kunena_db->setQuery("SELECT MAX(thread) AS thread FROM #__fb_messages WHERE id='{$id}'"); if ($id && $kunena_my->id && $kunena_db->query()) { $thread = $kunena_db->loadResult(); $kunena_db->setQuery("DELETE FROM #__fb_subscriptions WHERE thread=$thread AND userid=$kunena_my->id"); if ($kunena_db->query() && $kunena_db->getAffectedRows()==1) { $success_msg = _POST_UNSUBSCRIBED_TOPIC; } } $app->redirect(CKunenaLink::GetLatestPageAutoRedirectURL($fbConfig, $id, $fbConfig->messages_per_page), $success_msg); } else if ($do == "favorite") { $catid = (int)$catid; $id = (int)$id; $success_msg = _POST_NO_FAVORITED_TOPIC; $kunena_db->setQuery("SELECT MAX(thread) AS thread FROM #__fb_messages WHERE id='{$id}'"); if ($id && $kunena_my->id && $kunena_db->query()) { $thread = $kunena_db->loadResult(); $kunena_db->setQuery("INSERT INTO #__fb_favorites (thread,userid) VALUES ('$thread','$kunena_my->id')"); if (@$kunena_db->query() && $kunena_db->getAffectedRows()==1) { $success_msg = _POST_FAVORITED_TOPIC; } } $app->redirect(CKunenaLink::GetLatestPageAutoRedirectURL($fbConfig, $id, $fbConfig->messages_per_page), $success_msg); } else if ($do == "unfavorite") { $catid = (int)$catid; $id = (int)$id; $success_msg = _POST_NO_UNFAVORITED_TOPIC; $kunena_db->setQuery("SELECT MAX(thread) AS thread FROM #__fb_messages WHERE id='{$id}'"); if ($id && $kunena_my->id && $kunena_db->query()) { $thread = $kunena_db->loadResult(); $kunena_db->setQuery("DELETE FROM #__fb_favorites WHERE thread=$thread AND userid=$kunena_my->id"); if ($kunena_db->query() && $kunena_db->getAffectedRows()==1) { $success_msg = _POST_UNFAVORITED_TOPIC; } } $app->redirect(CKunenaLink::GetLatestPageAutoRedirectURL($fbConfig, $id, $fbConfig->messages_per_page), $success_msg); } else if ($do == "sticky") { if (!$is_Moderator) { $app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR); } $id = (int)$id; $success_msg = _POST_STICKY_NOT_SET; $kunena_db->setQuery("update #__fb_messages set ordering=1 where id=$id"); if ($id && $kunena_db->query() && $kunena_db->getAffectedRows()==1) { $success_msg = _POST_STICKY_SET; } $app->redirect(CKunenaLink::GetLatestPageAutoRedirectURL($fbConfig, $id, $fbConfig->messages_per_page), $success_msg); } else if ($do == "unsticky") { if (!$is_Moderator) { $app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR); } $id = (int)$id; $success_msg = _POST_STICKY_NOT_UNSET; $kunena_db->setQuery("update #__fb_messages set ordering=0 where id=$id"); if ($id && $kunena_db->query() && $kunena_db->getAffectedRows()==1) { $success_msg = _POST_STICKY_UNSET; } $app->redirect(CKunenaLink::GetLatestPageAutoRedirectURL($fbConfig, $id, $fbConfig->messages_per_page), $success_msg); } else if ($do == "lock") { if (!$is_Moderator) { $app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR); } $id = (int)$id; $success_msg = _POST_LOCK_NOT_SET; $kunena_db->setQuery("update #__fb_messages set locked=1 where id=$id"); if ($id && $kunena_db->query() && $kunena_db->getAffectedRows()==1) { $success_msg = _POST_LOCK_SET; } $app->redirect(CKunenaLink::GetLatestPageAutoRedirectURL($fbConfig, $id, $fbConfig->messages_per_page), $success_msg); } else if ($do == "unlock") { if (!$is_Moderator) { $app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR); } $id = (int)$id; $success_msg = _POST_LOCK_NOT_UNSET; $kunena_db->setQuery("update #__fb_messages set locked=0 where id=$id"); if ($id && $kunena_db->query() && $kunena_db->getAffectedRows()==1) { $success_msg = _POST_LOCK_UNSET; } $app->redirect(CKunenaLink::GetLatestPageAutoRedirectURL($fbConfig, $id, $fbConfig->messages_per_page), $success_msg); } } ?> |
$lockedWhat " . _POST_LOCKED . "
";
echo _POST_NO_NEW . "
| name); ?> |
", "", $fb_message_txt); //Long Words Wrap: $fb_message_txt = smile::htmlwrap($fb_message_txt, $fbConfig->wrap); $fb_message_txt = CKunenaTools::prepareContent($fb_message_txt); echo $fb_message_txt; ?> |
| enableforumjump) { require_once (KUNENA_PATH_LIB .DS. 'kunena.forumjump.php'); } ?> |
|---|