<?

/*
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 Notification Preferences
	// ========================================================================================

	$PageTitle = '<img src="'.$ImagesURL.'/admin/admincp_account.gif" width="26" height="20"> '.$MsgText[2][11];
	$BrowserTitle = $MsgText[2][11];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="'.$MainURL.'/options.html">'.$MsgText[0][4].'</a> > '.$MsgText[2][11];
	
	
	if ($LoggedIn == 'y') {
	
	
				
		$query = "select * from `".$Settings['DBPrefix']."core-Users` where Username='".$CookieUsername."' limit 1";
	   	$result = mysql_query($query) or die (mysql_error());
		$row = mysql_fetch_array($result);
		
		if ($row['NotifyAllBoards'] == 'y') {
			$MonitorAllMessages = ' checked';
		}		
		
		$BoardsWorkingString = substr($row['NotifyBoards'],1,strlen($row['NotifyBoards'])-2);
		$ThreadsWorkingString = substr($row['NotifyThreads'],1,strlen($row['NotifyThreads'])-2);
			
		
		
		
		$NotifyBoardsArray = explode('-',$BoardsWorkingString);
				
		for ($i = 0; $i < count($NotifyBoardsArray); $i++) {
			if (intval($NotifyBoardsArray[$i]) > 0) {
				$BoardsArray[intval($NotifyBoardsArray[$i])] = 'y';
			}
		}
				
		$query = "select * from `".$Settings['DBPrefix']."mb-Boards` order by Title asc";
		$result = mysql_query($query) or die (mysql_error());
		while ($row = mysql_fetch_array($result)) {
		
			$BoardNames[$row['RecordNumber']] = $row['Title'];
		
			if ($BoardsArray[$row['RecordNumber']] != '') {
				$BoardsList .= '<input type="checkbox" name="b-'.$row['RecordNumber'].'" value="yes" checked> '.$row['Title'].'<br>';
			}
		}
		
		
		
			
		$NotifyThreadsArray = explode('-',$ThreadsWorkingString);
				
		for ($i = 0; $i < count($NotifyThreadsArray); $i++) {
			if (intval($NotifyThreadsArray[$i]) > 0) {
				$ThreadsArray[intval($NotifyThreadsArray[$i])] = 'y';
			}
		}
		
		$query = "select * from `".$Settings['DBPrefix']."mb-Threads` order by Title asc";
		$result = mysql_query($query) or die (mysql_error());
		while ($row = mysql_fetch_array($result)) {
			if ($ThreadsArray[$row['RecordNumber']] != '') {
				if ($row['Title'] == '') {
					$row['Title'] = '('.$MsgText[2][10].')';
				}
			
				$ThreadsList .= '<input type="checkbox" name="t-'.$row['RecordNumber'].'" value="yes" checked> '.$row['Title'].' ('.$MsgText[2][9].' '.$BoardNames[$row['BoardID']].')<br>';
			}
		}
		
			
		
		$PageContents = '<form action="'.$MainURL.'/notifications-save" method="post"><input type="hidden" name="GarbageData" value="asdf1234">'.
$MsgText[2][5].'<br><br><br><b>'.$MsgText[2][6].':</b><br>'.$ThreadsList.'<br><br><b>'.$MsgText[2][7].':</b><br>'.$BoardsList.'<br><br><b>'.$MsgText[2][8].':</b><br><input type="checkbox" name="MonitorAllMessages" value="yes"'.$MonitorAllMessages.'> '.$MsgText[0][118].'<br><br><br><br><input type="submit" value="'.$MsgText[0][123].'" style="'.$FormStyle.'">
</form>';
		
		
	}
	else {
	
		RedirectToLogin();
		
	}				

	

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




?>
