Location: PHPKode > projects > Content*Builder > modules/forum/messageAddReply.inc.php
<?php

/*
* messageAdd.inc.php
*
* @version $Id: messageAddReply.inc.php,v 1.4 2004/09/16 19:19:06 cb_fog Exp $
* @copyright 2003 
*/
$error = 0;
$display = "postForm";
if(!empty($messagePostSubmit)) {
	// Errors while adding
	$addError = array();
	if($_REQUEST[action] == "addReply") {
		// Title empty
		if(trim($messagePostSubject) == "") {
			$addError['noTitle'] = 1;
		}
		
		// Text empty
		if(trim($messagePostText) == "") {
			$addError['noText'] = 1;
		}
		
		if(count($addError > 0)) {
			$tpl->assign("messageInsertError", $addError);
			
			$tpl->assign(
				array ( "messagePostText"    => $forumObj->getEditableContent($messagePostText),
						"messagePostSubject" => $forumObj->getEditableContent($messagePostSubject)
				)
			);
			$display = "postForm";
		}
		
		if(!empty($_SESSION[community_uid]) && count($addError) == 0) {
			$messageAdditionalArr = array (
				"title"      => $messagePostSubject,
				"message"    => $messagePostText
			);
			
			if($forum_display_method == "threaded" && isset($_REQUEST[parentID]) && $_REQUEST[parentID] != "noID") {
				$actualParentID = $_REQUEST[parentID];
			} else {
				$actualParentID = $_REQUEST[threadID];
			}
			
			$_REQUEST[messageID] = $forumObj->addMessage($messageAdditionalArr, $actualParentID);	
			
			// alles korrekt, Thread wieder anzeigen
			$display = "thread";
		}
	}
}

if($display == "postForm") {
	if($_REQUEST[action] == "addReply") {
		$tpl->assign("ACTION", $action);
		$tpl->assign("messageThreadID", $threadID);
		
		if($forum_display_method == "threaded") {
			$tpl->assign("messageParentID", $_REQUEST[parentID]);
		}
		
		$additionalSQL = array (
			"field" => ", user.fullname",
			"join"  => "LEFT JOIN ".TABLE."_community_user AS user ON user.userID = n.userID"
		);
		
		/*
		* direkten Vorfahr abrufen, sofern ID korrekt
		*/
		$parentNode = $nestedSet_message->getNode($_REQUEST[parentID], true, $additionalSQL);
		
		if($parentNode == false) {
			$error = 1;
		}
		
		$actualForumID = false;
		if($error != 1) {
			/*
			* Thread Daten abrufen, um zB. Kategorie zu erfahren
			*/
			$threadData = mysql_fetch_assoc(mysql_query("SELECT * FROM ".TABLE."_forum_thread WHERE rootID = '".$parentNode[root]."'"));
			
			/*
			* Abruf der Wurzel Message
			*/
			$rootMessage = $nestedSet_message->getNode($parentNode[root], true);
			$tpl->assign("root_thread", $rootMessage);
			$tpl->assign("root_thread_set", 1);
			
			$actualForumID = $threadData['categoryID'];
		}
		
		/* 
		* Pfad Menu aufbauen
		*/
		$categoryPath = $forumObj->getForumPath($actualForumID);
		
		// Ans Template senden
		$tpl->assign( "categoryPath",
			array ( "categoryID"    => $categoryPath['id'],
					"categoryName"  => $categoryPath['name']
			)
		);
		
		require_once($actualModuleDir."messagePost.inc.php");
	}
} elseif ($display == "thread") {
	require_once($actualModuleDir."showThread.inc.php");
}
?>
Return current item: Content*Builder