<?

/*
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
*/



	// ========================================================================================
	// Edit Board
	// ========================================================================================
	
	$PageTitle = '<img src="'.$ImagesURL.'/admin/admincp_messageboard.gif" width="26" height="18"> '.$MsgText[2][33];
	$BrowserTitle = $MsgText[2][33];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > <a href="' . $MainURL . '/admin/messageboard_boardsandcats.html">'.$MsgText[2][4].'</a> > '.$MsgText[2][33];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[204] == 'y') {
		
			$query = "select * from `".$Settings['DBPrefix']."mb-Boards` where RecordNumber=".intval($Arguments3)." limit 1";
			$result = mysql_query($query) or die (mysql_error());
			
			$row = mysql_fetch_array($result);
			
			
			$query2 = "select Level,Description from `".$Settings['DBPrefix']."core-Permissions` where Level<=".$UserLevel;
	   		$result2 = mysql_query($query2) or die (mysql_error());
			while ($row2 = mysql_fetch_array($result2)) {
				$LevelDescriptions[$row2['Level']] = $row2['Description'];
			}
			
			$LevelSelected[$row['MinLevel']] = ' selected';
		
			$PermissionsDropdown = '<option value="0" selected> 0 - '.$MsgText[0][162].'</option>';
			for ($i = 1; $i <= $UserLevel; $i++) {
				if ($LevelDescriptions[$i] != '') {
					$PermissionsDropdown .= '<option value="'.$i.'"'.$LevelSelected[$i].'> '.$i.' - '.$LevelDescriptions[$i].'</option>';
				}
				else {
					$PermissionsDropdown .= '<option value="'.$i.'"'.$LevelSelected[$i].'> '.$i.'</option>';
				}
			}
			
		
		
			$query2 = "select * from `".$Settings['DBPrefix']."mb-Categories` order by CategoryOrder asc, Title asc";
			$result2 = mysql_query($query2) or die (mysql_error());
			while ($row2 = mysql_fetch_array($result2)) {
				if ($row2['RecordNumber'] == $row['Category']) {
					$CategoriesDropdown .= '<option value="'.$row2['RecordNumber'].'" selected> '.$row2['Title'].'</option>';
				}
				else {
					$CategoriesDropdown .= '<option value="'.$row2['RecordNumber'].'"> '.$row2['Title'].'</option>';
				}
			}
		
		
						
			
			
			$PageContents .= '<form action="'.$MainURL.'/admin/messageboard_boardeditsave" method="post"><input type="hidden" name="BoardToEdit" value="'.$row['RecordNumber'].'"><b>'.$MsgText[2][20].':</b><br><input type="text" name="Title" size="50" value="'.str_replace('"','&#3'.'4;',$row['Title']).'"><br><br><b>'.$MsgText[2][21].':</b><br><input type="text" name="Description" size="70" value="'.str_replace('"','&#3'.'4;',$row['Description']).'"><br><br><b>'.$MsgText[2][22].':</b><br><select name="Category">'.$CategoriesDropdown.'</select><br><br><b>'.$MsgText[2][23].':</b><br><input type="text" name="BoardOrder" size="5" value="'.$row['BoardOrder'].'"><br><font size="1">'.$MsgText[2][138].'<br></font><br><b>'.$MsgText[2][24].':</b><br><select name="MinLevel">'.$PermissionsDropdown.'</select><br><br><br><br><br><input type="submit" value="'.$MsgText[0][123].'"></form>';
			
	
	
		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}
	

	// ========================================================================================




?>
