Location: PHPKode > projects > Content*Builder > modules/forum/plugins/views/default/showThread.inc.php
<?php

/**
 * Flat Ausgabe eines Threads
 *
 * @version $Id: showThread.inc.php,v 1.1 2004/05/07 09:14:13 cb_fog Exp $
 * @copyright 2003 C*B Development Team
**/

/*
* check, ob messageID eine Zahl ist (flüchtiger Check)
*/
if(preg_match("/^([0-9]*)$/", $_REQUEST[messageID]) && $_REQUEST[messageID] != "") {
	$error = 0;
	
	/*
	* Zusätzliches SQL, um bei NestedSet Message Abfrage auch gleich die 
	* Autoren zu bekommen
	*/
	$additionalSQL = array (
		"field"   => ", user.fullname AS userName",
		"join"    => "LEFT JOIN ".TABLE."_community_user AS user ON user.userID = n.userID",
		"orderby" => "ORDER BY n.insertDate ASC"
	);
	
	/*
	* Abruf der aktuell ausgewählten Message
	* Check, ob Message überhaupt existiert (echter check)
	*/
	$actualMessageQuery = $nestedSet_message->getNode($_REQUEST[messageID], true, $additionalSQL);
	if($actualMessageQuery == false) {
		$forum_error['wrongMessageID'] = 1;
		$error = 1;
	}
	
	$threadRootID = $actualMessageQuery[root];
		
	/* 
	* Abruf der Thread Daten des Root Nodes ... Thread Daten sind in eigener Tabelle 
	*/
	$threadRootQuery = mysql_query("SELECT * FROM ".TABLE."_forum_thread WHERE rootID = '$threadRootID'");
	if(mysql_num_rows($threadRootQuery) == 0) {
		$error = 1;
	}
				
	if($error != 1) {
		$threadRootRow = mysql_fetch_assoc($threadRootQuery);
			
		/* Forum ID ermitteln */
		$tpl->assign("forumID", $threadRootRow[categoryID]);
			
		/* 
		* Pfad Menu aufbauen
		*/
		$categoryPathQuery = $nestedSet_category->getPath($threadRootRow[categoryID], true);
		$categoryPathName[] = "Top Level";
		$categoryPathID[]   = "noID";
		if($categoryPathQuery != false) {
			foreach($categoryPathQuery as $v) {
				$categoryPathName[] = $v[name];
				$categoryPathID[]   = $v[id];
			}
		}
				
		$threadSet = false;
		
		$messageQuery = $nestedSet_message->getBranch($threadRootID, true, $additionalSQL);
		if($messageQuery != false) {
			foreach($messageQuery as $messageRow) {
				$threadSet = true;
				
				if($messageRow[id] == $threadRootID) {
					$rootMessage = $messageRow;
				}
				
				$_editablePost = 0;
				if($messageRow[userID] == $_SESSION[community_uid]) {
					$_editablePost = 1;
				}
				
				$_modifiedPost = 0;
				if($messageRow[insertDate] != $messageRow[editDate]) {
					$_modifiedPost = 1;
				}
				
				$messageEditable[]     = $_editablePost;
				$messageModified[]     = $_modifiedPost;
				
				$messageMessageID[]    = $messageRow[id];
				$messageUserID[]       = $messageRow[userID];
				$messageUserName[]     = stripslashes($messageRow[userName]);
				$messageTitle[]        = stripslashes($messageRow[title]);
				$messageText[]         = stripslashes($messageRow[message]);
				$messageLastModified[] = $messageRow[editDate];
				$messageInsertDate[]   = $messageRow[insertDate];
			}
		}
		
		if(!$threadSet) {
			$forum_error['wrongThreadID'] = 1;
		}
	}
} else {
	$forum_error['wrongThreadID'] = 1;
}

if(!is_array($forum_error)) {
	/*
	* Ans Template senden
	*/
	$tpl->assign(
		array ( "message_messageID"    => $messageMessageID,
				"message_userID"       => $messageUserID,
				"message_userName"     => $messageUserName,
				"message_title"        => $messageTitle,
				"message_text"         => $messageText,
				"message_lastModified" => $messageLastModified,
				"message_insertDate"   => $messageInsertDate,
				"message_rootID"       => $threadRootID,
				"message_editable"     => $messageEditable,
				"message_modified"     => $messageModified
		)
	);
	
	$tpl->assign("root_thread", $rootMessage);
	
	$tpl->assign( "categoryPath",
		array ( "categoryID"    => $categoryPathID,
				"categoryName"  => $categoryPathName
		)
	);
	
	$forum_content[] = $tpl->fetch("plugins/views/".$forum_display_method."/showThread.template");
}
?>
Return current item: Content*Builder