<?

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



	// ========================================================================================
	//  Sticky/UnSticky Thread
	// ========================================================================================
	
			
		
		ReadPermissions();
		Global $Permissions;
		
		
		$ThreadID = intval($Arguments3);
		
		if ($ThreadID > 0) {
		
			if ($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);
				
				$BoardID = $row['BoardID'];
				$StickyStatus = $row['Sticky'];
				
				if ($StickyStatus == 'y') {
					$StickyStatus = '';
				}
				else {
					$StickyStatus = 'y';
				}
				
					
				$query = "update `".$Settings['DBPrefix']."mb-Threads` set Sticky='".$StickyStatus."' where RecordNumber=".$ThreadID." limit 1";
				$result = mysql_query($query) or die (mysql_error());
				
					
				
				header('Location: ' . $MainURL . '/forum/'.$BoardID.'.html');
					
					
				
				
			}		
			else {
			
				$PageContents = $MsgText[2][100];
			
			}	
		
	}
	else {
	
		$PageContents = $MsgText[2][58];
	
	}

	
	
?>
