<?

/*
FlexCMS (http://www.flexcms.com)
Flexible, Powerful, Affordable.

Contents of this file are protected by the copyright
notice found at http://www.flexcms.com/flex/pages/copyright.html,
and its usage is subject to the terms of the licensing agreement 
available at http://www.flexcms.com/flex/pages/license.html
*/



	// ========================================================================================
	// delete existing message
	// ========================================================================================
	

	ReadPermissions();
	Global $Permissions;
	

	$Arguments3 = intval($Arguments3);
	
	if ($Arguments3 > 0) {	

		$query = "select * from `".$Settings['DBPrefix']."mb-Messages` where RecordNumber=".$Arguments3." limit 1";
		$result = mysql_query($query) or die (mysql_error());
		$row = mysql_fetch_array($result);
		
		$ThreadID = $row['ThreadID'];
		$MessageID = $row['RecordNumber'];
		
		$MessageSubject = $row['Subject'];
		$MessagePoster = $row['Poster'];
		$PostTime = $row['DateCode'];
		
				
		// if this user is the owner of the message, or has moderator permissions
		if ($row['Poster'] == $ThisUserNumber || $Permissions[202] == 'y') {
		
			
			$query = "select * from `".$Settings['DBPrefix']."mb-Threads` where RecordNumber=".$ThreadID." limit 1";
			$result = mysql_query($query) or die (mysql_error());
			$row = mysql_fetch_array($result);
			
			$MessagesCount = ($row['Replies'] + 1);
			$ThreadTitle = $row['Title'];
			$BoardID = $row['BoardID'];
			$ViewsCount = $row['Views'];
			$RepliesCount = $row['Replies'];
		
		
			$query = "select Title,Category,Description from `".$Settings['DBPrefix']."mb-Boards` where RecordNumber=".$BoardID." limit 1";
			$result = mysql_query($query) or die (mysql_error());
			$row = mysql_fetch_array($result);
			
			$BoardTitle = $row['Title'];
			$BoardDescription = $row['Description'];
			$CategoryID = $row['Category'];
			
			
			
			$query = "select Title,Description from `".$Settings['DBPrefix']."mb-Categories` where RecordNumber=".$CategoryID." limit 1";
			$result = mysql_query($query) or die (mysql_error());
			$row = mysql_fetch_array($result);
			
			$CategoryTitle = $row['Title'];
			//$CategoryDescription = $row['Description'];
			
			
				
			
			$PageTitle = '<div align="'.$AlignmentCodes[$mbSettings['TitleAlignment']].'">'.$mbSettings['PageTitle'].'</div>';
			$BrowserTitle = $mbSettings['PageTitle'] . ' - '.$MsgText[2][75];
			$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="'.$MainURL.'/forum.html">'.$mbSettings['PageTitle'].'</a> > <a href="'.$MainURL.'/forum.html#'.$CategoryID.'">'.$CategoryTitle.'</a> > <a href="'.$MainURL.'/forum/'.$BoardID.'.html">'.$BoardTitle.'</a> > <a href="'.$MainURL.'/forum/'.$BoardID.'/'.$ThreadID.'.html">'.$ThreadTitle.'</a> > '.$MsgText[2][75];


			if ($MessageSubject == '') {
				$MessageSubject = '('.$MsgText[2][10].')';
			}
			
			
			if (date("j/n/Y",GetTimestamp()) == date("j/n/Y",$PostTime)) {
				$PostDate = $MsgText[2][66].' @ '.date("g:ia",$PostTime);
			}
			else if (date("j/n/Y",(GetTimestamp()-(60*60*24))) == date("j/n/Y",$PostTime)) {
				$PostDate = $MsgText[2][67].' @ '.date("g:ia",$PostTime);
			}
			else {
				$PostDate = date("j-M-Y @ g:ia",$PostTime);
			}
			


			$PageContents = '<b>'.$MsgText[2][76].' "'.$MessageSubject.'" '.$MsgText[2][77].' '.$PostDate.' '.$MsgText[2][78].' '.$DisplayNames[$MessagePoster].'?</b><br><br><br><form name="PostForm" action="'.$MainURL.'/forum/message-delete-confirm" method="post">
<input type="hidden" name="BoardID" value="'.$BoardID.'">
<input type="hidden" name="ThreadID" value="'.$ThreadID.'">
<input type="hidden" name="MessageID" value="'.$MessageID.'">
<input type="submit" value="'.$MsgText[0][237].'" style="'.$FormStyle.'"><br><br><br><input type="button" value="'.$MsgText[0][238].'" onClick="window.location.href=\''.$MainURL.'/forum/'.$BoardID.'/'.$ThreadID.'.html\'" style="'.$FormStyle.'"></form>';
			
		
		}
		else {
		
			$PageContents = $MsgText[2][79];
		
		}	
	
	}
	else {
	
		$PageContents = $MsgText[2][80];
	
	}
	
?>
