Location: PHPKode > projects > PHPFreeNews > phpfn/Inc/AdminFunctions.php
<?php
// ==============================================================================================================================

// Set defaults for the admin-site restrictions
function SetAdminDefaultRestrictions()
{
	global $DefaultArchiveDays, $DefaultNewsPurgeDays, $DefaultPerPage;

	if (! isset($_SESSION['Info']))
		$_SESSION['Info'] = '';

	if (! isset($_SESSION['RestrictCategory']))
		$_SESSION['RestrictCategory'] = 'A';		// All

	if (! isset($_SESSION['RestrictArchived']))
		$_SESSION['RestrictArchived'] = '-';		// All

	if (! isset($_SESSION['RestrictApproved']))
		$_SESSION['RestrictApproved'] = '0';		// Not approved

	if (! isset($_SESSION['RestrictVisible']))
		$_SESSION['RestrictVisible'] = '-';			// All

	if (! isset($_SESSION['RestrictSticky']))
		$_SESSION['RestrictSticky'] = '-';			// All

	if (! isset($_SESSION['RestrictAuthor']))
		$_SESSION['RestrictAuthor'] = '-';			// All

	if (! isset($_SESSION['RestrictSortMode']))
		$_SESSION['RestrictSortMode'] = '1';

	if (! isset($_SESSION['RestrictSearchString']))
		$_SESSION['RestrictSearchString'] = '';

	if (! isset($_SESSION['RestrictArchiveDays']))
		$_SESSION['RestrictArchiveDays'] = $DefaultArchiveDays;

	if (! isset($_SESSION['RestrictPurgeDays']))
		$_SESSION['RestrictPurgeDays'] = $DefaultNewsPurgeDays;

	if (! isset($_SESSION['PerPage']))
		$_SESSION['PerPage'] = $DefaultPerPage;
}

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

// Update the admin-site restrictions
function SetAdminCurrentRestrictions()
{ 
	if (isset($_POST['SearchString']))
		$_SESSION['RestrictSearchString'] = $_POST['SearchString'];

	if (isset($_POST['RestrictCatId']))
		$_SESSION['RestrictCategory'] = $_POST['RestrictCatId'];

	if (isset($_POST['Archived']))
		$_SESSION['RestrictArchived'] = $_POST['Archived'];

	if (isset($_POST['Approved']))
		$_SESSION['RestrictApproved'] = $_POST['Approved'];

	if (isset($_POST['Visible']))
		$_SESSION['RestrictVisible'] = $_POST['Visible'];

	if (isset($_POST['Sticky']))
		$_SESSION['RestrictSticky'] = $_POST['Sticky'];

	if (isset($_POST['Author']))
		$_SESSION['RestrictAuthor'] = $_POST['Author'];

	if (isset($_POST['SortMode']))
		$_SESSION['RestrictSortMode'] = $_POST['SortMode'];

	if (isset($_POST['ArchiveDays']))
		$_SESSION['RestrictArchiveDays'] = $_POST['ArchiveDays'];

	if (isset($_POST['PurgeDays']))
		$_SESSION['RestrictPurgeDays'] = $_POST['PurgeDays'];

	if (isset($_POST['PerPage']))
		$_SESSION['PerPage'] = $_POST['PerPage'];
}

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

// Apply any admin-site category restrictions
function ApplyAdminCategoryRestriction($RestrictCatId)
{
	$ReturnText = "";
	switch ($RestrictCatId)
	{
		case '0':				// No restriction
			$ReturnText = " WHERE news_posts.ID != 0";
			break;
		case 'N':				// No categories (always select from left table)
			$ReturnText = " LEFT JOIN news_postcategories ON news_posts.ID = news_postcategories.ArticleID WHERE CatID IS NULL";
			break;
		case 'A':				// All categories
			$ReturnText = " WHERE news_posts.ID != 0";
			break;
		default:				// Specific category (must match)
			$ReturnText = " INNER JOIN news_postcategories ON news_posts.ID = news_postcategories.ArticleID WHERE CatID='" . $RestrictCatId ."'";
			break;
	}

	return $ReturnText;
}

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

// Return a user's name
function GetUserName($UserID)
{
	$query = "SELECT FullName FROM news_users WHERE ID = '$UserID'";
	$result = mysql_query($query) or die('Query failed : ' . mysql_error());
	$row = mysql_fetch_array($result, MYSQL_ASSOC);
	return $row["FullName"];
}

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

// Function: CheckUserUnique -- See if a user-id is unique within the database
function UsernameIsUnique($UserName, $UserID = -1)
{
	// Construct the SQL
	$sql = "SELECT FullName FROM news_users WHERE Username = '$UserName'";

	// If we have been passed a user-id then we are in edit-mode, and therefore the user can exist if the ID is the same
	if ($UserID != -1)
		$sql .= " AND ID != $UserID";

	$Result = mysql_query($sql) or die('Query failed : ' . mysql_error());
	$NumRows = mysql_num_rows($Result);

	return ($NumRows == 0);
}

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

// Function: DisplayError -- Let the user know an error has occured
function DisplayError($ErrorMsg, $mysql_code)
{
	DisplayGroupHeading('Error!!!');
	?>
	<br />
	<table class="Admin">
		<tr>
			<td width="80">
				<center><img src="Inc/Images/Error.gif"></center>
			</td>
			<td>
				<center>
					<?=$ErrorMsg?>
					<?= ($mysql_code == 1 ? mysql_error() : '') ?>
				</center>
			</td>
		</tr>
	</table>

	<?php
	return;
}

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

// Function: DisplaySuccess - Let the user know the command went OK
function DisplaySuccess($SuccessMsg)
{
	DisplayGroupHeading('Success!');
	?>
	<br />
	<table class="Admin">
		<tr>
			<td width="80">
				<center><img src="Inc/Images/Info.gif"></center>
			</td>
			<td>
				<center><?=$SuccessMsg?></center>
			</td>
		</tr>
	</table>
	 <?php
}

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

// Function: DisplayGroupHeading - Display consistent group-heading text
function DisplayGroupHeading($HeadingText)
{
	?>
	<table class="Admin">
		<tr>
			<td colspan="3" class="GroupHeading">
				&nbsp;&nbsp;<?= $HeadingText ?>
			</td>
		</tr>
	</table>
	<?php
}

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

// Function: DisplayInfoMessage - Display any current Info message
function DisplayInfoMessage()
{ 
	if (isset($_SESSION['Info']) && $_SESSION['Info'] != '')
	{
		?>
		<table class="Admin">
			<tr>
				<td colspan="3" class="Info">
					<?= $_SESSION['Info'] ?>
				</td>
			</tr>
		</table>
		<?php
	}
	$_SESSION['Info'] = '';
}

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

// Check that the user is an Administrator
function CheckAuthority()
{
	global $LoggedInAccessLevel;
	if ($LoggedInAccessLevel != '2')
	{
		$errormsg = 'Your account type does not grant you access to this section.';
		DisplayError($errormsg, 0);
		exit();
	}
}


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

// Build a drop-down for images
function BuildImageDropdown($FieldName, $SelectedID, $ShowSelectOne = true)
{
	echo '<select name="' . $FieldName . '">';
	if ($ShowSelectOne)
		echo '<option value="0">Select One</option>';

	// Execute the query
	$query = "SELECT * FROM news_images ORDER BY ImageName ASC";
	$result = mysql_query($query) or die('Query failed : ' . mysql_error());
	while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
	{
		$ImageID = $row['ID'];
		$ImageName = $row['ImageName'];
		echo '<option value="' . $ImageID . '"' . ($ImageID == $SelectedID ? ' SELECTED' : '') . ">$ImageName</option>\n";
	}

	echo "</select>\n";
}

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

// Build a drop-down for users
function BuildUserDropdown($FieldName, $SelectedID, $ShowSelectOne = true, $ShowSelectAll = false)
{
	echo '<select name="' . $FieldName . '">';
	if ($ShowSelectOne)
		echo '<option value="0">Select One</option>';

	if ($ShowSelectAll)
		echo '<option value="0">All Users</option>';

	// Execute the query
	$query = "SELECT * FROM news_users ORDER BY Username ASC";
	$result = mysql_query($query) or die('Query failed : ' . mysql_error());
	while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
	{
		$UserID = $row['ID'];
		$Username = $row['Username'];
		echo '<option value="' . $UserID . '"' . ($UserID == $SelectedID ? ' SELECTED' : '') . ">$Username</option>\n";
	}

	echo "</select>\n";
}
// ==============================================================================================================================

// Build a drop-down for access level
function BuildAccessLevelDropdown($FieldName, $CurrentLevel, $ShowSelectOne = true, $OnlyShowAdmin = false)
{
	echo '<select name="' . $FieldName . '">';
	if ($ShowSelectOne)
		echo '<option value="">Select One</option>';

	if ($OnlyShowAdmin != true)
	{
		echo '<option value="0"' . ($CurrentLevel == '0' ? ' SELECTED' : '') . ">Disabled</option>\n";
		echo '<option value="1"' . ($CurrentLevel == '1' ? ' SELECTED' : '') . ">Normal User</option>\n";
	}
	echo '<option value="2"' . ($CurrentLevel == '2' ? ' SELECTED' : '') . ">Administrator</option>\n";

	echo "</select>\n";
}

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

// Build a drop-down for "archived"
function BuildArchivedDropdown($FieldName, $CurrentMode, $ShowAll = false, $ShowNoChange = false)
{
	echo '<select name="' . $FieldName . '">';

	if ($ShowAll)
		echo '<option value="-"' . ($CurrentMode == '-' ? ' SELECTED' : '') . ">All Posts</option>\n";

	if ($ShowNoChange)
		echo '<option value="N/C"' . ($CurrentMode == 'N/C' ? ' SELECTED' : '') . ">No Change</option>\n";

	echo '<option value="0"' . ($CurrentMode == '0' ? ' SELECTED' : '') . ">Live</option>\n";
	echo '<option value="1"' . ($CurrentMode == '1' ? ' SELECTED' : '') . ">Archived</option>\n";

	echo "</select>\n";
}

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

// Build a drop-down for "newslist sorting"
function BuildNewsListSortDropdown($FieldName, $CurrentMode)
{
	echo '<select name="' . $FieldName . '">';
	echo '<option value="1"' . ($CurrentMode == '1' ? ' SELECTED' : '') . ">Archived, Priority, Date(D)</option>\n";
	echo '<option value="2"' . ($CurrentMode == '2' ? ' SELECTED' : '') . ">Archived(D), Sticky, Priority, Date(D)</option>\n";
	echo '<option value="3"' . ($CurrentMode == '3' ? ' SELECTED' : '') . ">Archived, Sticky, Priority, Date(D)</option>\n";
	echo '<option value="4"' . ($CurrentMode == '4' ? ' SELECTED' : '') . ">Headline, Date</option>\n";
	echo '<option value="5"' . ($CurrentMode == '5' ? ' SELECTED' : '') . ">Date, Headline</option>\n";
	echo '<option value="6"' . ($CurrentMode == '6' ? ' SELECTED' : '') . ">Date(D), Headline</option>\n";
	echo "</select>\n";
}

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

// Build a drop-down with numbers going up in logical "chunks"
function BuildPerPageDropdown($FieldName, $CurrentValue, $ShowAll = false)
{
	global $PerPageValues;

	echo '<select name="' . $FieldName . '">';

	foreach ($PerPageValues as $PerPageValue)
		echo '<option value="' .$PerPageValue . '"' . ($CurrentValue == $PerPageValue ? ' SELECTED' : '') . '>' .$PerPageValue . "</option>\n";

	if ($ShowAll)
		echo '<option value="999999"' . ($CurrentValue == '999999' ? ' SELECTED' : '') . ">All</option>\n";

	echo "</select>\n";
}

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

// Build a drop-down for "event category"
function BuildEventCategoryDropdown($FieldName, $SelectedID, $ShowAll = false)
{
	echo '<select name="' . $FieldName . '">';

	if ($ShowAll)
		echo '<option value="-"' . ($SelectedID == '-' ? ' SELECTED' : '') . ">All Events</option>\n";

	// Execute the query
	$query = "SELECT * FROM news_audit_categories ORDER BY CatDesc ASC";
	$result = mysql_query($query) or die('Query failed : ' . mysql_error());
	while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
	{
		$CatID = $row['ID'];
		$CatDesc = $row['CatDesc'];
		echo "<option value=\"$CatID\"" . ($CatID == $SelectedID ? ' SELECTED' : '') . ">$CatDesc</option>\n";
	}

	echo "</select>\n";
}

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

function BuildVisibleDropdown($FieldName, $CurrentMode, $ShowAll = false, $ShowNoChange = false)
{
	echo "\n<select name=\"$FieldName\">\n";

	if ($ShowAll)
		echo '<option value="-"' . ($CurrentMode == '-' ? ' SELECTED' : '') . ">All Posts</option>\n";

	if ($ShowNoChange)
		echo '<option value="N/C"' . ($CurrentMode == 'N/C' ? ' SELECTED' : '') . ">No Change</option>\n";

	echo '<option value="0"' . ($CurrentMode == '0' ? ' SELECTED' : '') . ">Not Visible</option>\n";
	echo '<option value="1"' . ($CurrentMode == '1' ? ' SELECTED' : '') . ">Visible</option>\n";

	echo "</select>\n";
}
// ==============================================================================================================================

function BuildStickyDropdown($FieldName, $CurrentMode, $ShowAll = false, $ShowNoChange = false)
{
	echo "\n<select name=\"$FieldName\">\n";

	if ($ShowAll)
		echo '<option value="-"' . ($CurrentMode == '-' ? ' SELECTED' : '') . ">All Posts</option>\n";

	if ($ShowNoChange)
		echo '<option value="N/C"' . ($CurrentMode == 'N/C' ? ' SELECTED' : '') . ">No Change</option>\n";

	echo '<option value="0"' . ($CurrentMode == '0' ? ' SELECTED' : '') . ">Not Sticky</option>\n";
	echo '<option value="1"' . ($CurrentMode == '1' ? ' SELECTED' : '') . ">Sticky</option>\n";

	echo "</select>\n";
}

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

function BuildAuthorDropdown($FieldName, $CurrentMode, $ShowAll = false, $ShowNoChange = false)
{
	echo "\n<select name=\"$FieldName\">\n";

	if ($ShowAll)
		echo '<option value="-"' . ($CurrentMode == '-' ? ' SELECTED' : '') . ">All Authors</option>\n";

	if ($ShowNoChange)
		echo '<option value="N/C"' . ($CurrentMode == 'N/C' ? ' SELECTED' : '') . ">No Change</option>\n";

	// Execute the query
	$query = "SELECT ID, FullName FROM news_users ORDER BY FullName ASC";
	$result = mysql_query($query) or die('Query failed : ' . mysql_error());
	while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
	{
		$UserID = $row['ID'];
		$FullName = $row['FullName'];
		echo "<option value=\"$UserID\"" . ($UserID == $SelectedID ? ' SELECTED' : '') . ">$FullName</option>\n";
	}

	echo "</select>\n";
}

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

function BuildApprovedDropdown($FieldName, $CurrentMode, $ShowAll = false, $ShowNoChange = false)
{
	echo "\n<select name=\"$FieldName\">\n";

	if ($ShowAll)
		echo '<option value="-"' . ($CurrentMode == '-' ? ' SELECTED' : '') . ">All Items</option>\n";

	if ($ShowNoChange)
		echo '<option value="N/C"' . ($CurrentMode == 'N/C' ? ' SELECTED' : '') . ">No Change</option>\n";

	echo '<option value="0"' . ($CurrentMode == '0' ? ' SELECTED' : '') . ">Not Approved</option>\n";
	echo '<option value="1"' . ($CurrentMode == '1' ? ' SELECTED' : '') . ">Approved</option>\n";

	echo "</select>\n";
}

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

function BuildCopyMoveDropdown($FieldName, $CurrentMode, $ShowNoChange = false)
{
	echo "\n<select name=\"$FieldName\">\n";

	if ($ShowNoChange)
		echo '<option value="-"' . ($CurrentMode == 'N/C' ? ' SELECTED' : '') . ">No Change</option>\n";

	echo '<option value="1"' . ($CurrentMode == '1' ? ' SELECTED' : '') . ">Assign</option>\n";
	echo '<option value="2"' . ($CurrentMode == '2' ? ' SELECTED' : '') . ">Remove</option>\n";

	echo "</select>\n";
}

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

// Build a drop-down for templates
function BuildTemplateDropdown($FieldName, $SelectedID, $ShowSelectOne = true, $ShowAllTemplates = false, $ShowNoChange = false)
{
	echo "\n<select name=\"$FieldName\">\n";

	if ($ShowSelectOne)
		echo '<option value="0">Select One</option>';

	if ($ShowNoChange)
		echo '<option value="-"' . ($CurrentMode == 'N/C' ? ' SELECTED' : '') . ">No Change</option>\n";

	if ($ShowAllTemplates)
		echo '<option value="0">All Templates</option>';

	// Execute the query
	$query = "SELECT * FROM news_templates ORDER BY TemplateName ASC";
	$result = mysql_query($query) or die('Query failed : ' . mysql_error());
	while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
	{
		$TemplateID = $row['ID'];
		$TemplateName = $row['TemplateName'];
		echo "<option value=\"$TemplateID\"" . ($TemplateID == $SelectedID ? ' SELECTED' : '') . ">$TemplateName</option>\n";
	}
	echo "</select>\n";
}

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

// Build a drop-down for months
function BuildMonthDropdown($FieldName, $SelectedMonth)
{
	global $MonthNames;

	echo '<select name="' . $FieldName . '">';

	for ($i = 1; $i <= 12; $i++)
	{
		$j = $i - 1;
		echo "<option value=\"$i\"" . ($i == $SelectedMonth ? ' SELECTED' : '') . ">$MonthNames[$j]</option>\n";
	}
	echo "</select>\n";
}

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

function SendNewsNotificationEmail($ToEmailAddress, $NewsID, $Mode)
{
	global $AdminEmail, $SiteDescription;

	// Execute the query
	$sql = "SELECT Headline, ShortPost, Sticky, Visible, Locked, FullName, EmailAddress FROM news_posts, news_users WHERE news_posts.AuthorID = news_users.ID AND news_posts.ID = $NewsID";
	$result = mysql_query($sql) or die('Query failed : ' . mysql_error());
	$row = mysql_fetch_array($result, MYSQL_ASSOC);

	// Extract the data
	$Headline = $row['Headline'];
	$ShortPost = $row['ShortPost'];
	$FullName = $row['FullName'];
	$EmailAddress = $row['EmailAddress'];
	$Sticky = $row['Sticky'];
	$Visible = $row['Visible'];

	// Format the short-post
	$UserCodes = BuildUserDefinedCodesList();
	$ShortPost = ParseUserDefinedCodes($UserCodes, $ShortPost);
	$ShortPost = StripBBCodes($ShortPost);
	$ShortPost = htmlspecialchars(strip_tags($ShortPost));

	$Subject = "$SiteDescription Content-Change Notification (article $Mode)";
	$Mailheader = "From: \"$FullName\" <$EmailAddress>\n";
	$Mailheader .= "Reply-To: $EmailAddress\n";

	$Message = "A News Article has been $Mode by $FullName .\n\n";
	$Message .= "Headline  : $Headline\n";
	$Message .= "Sticky    : " . ($Sticky == 1 ? "Yes" : "No") . "\n";
	$Message .= "Visible   : " . ($Visible == 1 ? "Yes" : "No") . "\n";
	$Message .= "Locked    : " . ($Locked == 1 ? "Yes" : "No") . "\n";
	$Message .= "Short Post:\n $ShortPost";

	// Send the email
	mail($ToEmailAddress, $Subject, $Message, $Mailheader) or die ('Failure sending notification email!');
}

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

function WriteAuditEvent($EventCatID, $EventType, $LinkedID, $Description)
{
	global $LoggedInUserId;
	$sql = "INSERT INTO news_audit SET EventDateTime = now(), EventCatID = '$EventCatID', EventType = '$EventType', EventUserID='$LoggedInUserId', LinkedID = '$LinkedID', Description = '$Description'";
	mysql_query($sql);
}

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

function GetLatestVersionNumber()
{
	$errno = 0;
	$errstr = $VersionInfo = '';

	if ($fsock = @fsockopen('www.phpfreenews.co.uk', 80, $errno, $errstr))
	{
		@fputs($fsock, "GET /Version.txt HTTP/1.1\r\n");
		@fputs($fsock, "HOST: www.phpfreenews.co.uk\r\n");
		@fputs($fsock, "Connection: close\r\n\r\n");

		$get_info = false;
		while (!@feof($fsock))
		{
			if ($get_info)
				$VersionInfo .= @fread($fsock, 1024);
			else
				if (@fgets($fsock, 1024) == "\r\n")
					$get_info = true;
		}
		@fclose($fsock);
		$VersionInfo = explode("\n", $VersionInfo);
		return $VersionInfo;
	}
	else
	{
		if ($errstr)
			return -1;					// Unable to connect
		else
			return -2;					// Unable to use Socket functions
	}
}

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

// Apply a sort-order in the admin script
function ApplyAdminSort($SortMode)
{
	$Sort = " ORDER BY";

	switch ($SortMode)
	{
		case 1:
			$Sort .= " Archived, Priority, PostDateTime DESC, ID DESC";
			break;
		case 2:
			$Sort .= " Archived DESC, Sticky DESC, Priority, PostDateTime DESC, ID DESC";
			break;
		case 3:
			$Sort .= " Sticky DESC, Archived DESC, Priority, PostDateTime DESC, ID DESC";
			break;
		case 4:
			$Sort .= " Headline, PostDateTime DESC, ID DESC";
			break;
		case 5:
			$Sort .= " PostDateTime, Headline";
			break;
		case 6:
			$Sort .= " PostDateTime DESC, Headline";
			break;
		default:
			$Sort .= " Archived, Priority, PostDateTime DESC, ID DESC";
			break;
	}
	return $Sort;
}

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

// Delete a single news article
function DeleteNewsArticle($ArticleID)
{
	$Success = true;

	// Delete the news-categories information
	@mysql_query("DELETE FROM news_postcategories WHERE ArticleID='$ArticleID'");
		
	// Now delete any comments
	@mysql_query("DELETE FROM news_comments WHERE ArticleID='$ArticleID'");

	// Now delete any ratings
	@mysql_query("DELETE FROM news_ratings WHERE ArticleID='$ArticleID'");

	// Finally, delete the article
	$Success = mysql_query("DELETE FROM news_posts WHERE ID='$ArticleID'");

	return $Success;
}


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

// Build a drop-down for categories, retricting it to the current user's permissions
function BuildUserCategoryDropdown($FieldName, $SelectedID, $ShowSelectOne = true, $ShowAllCategories = false, $ShowNoCategories = false)
{
	global $LoggedInUserId;

	echo "\n<select name=\"$FieldName\">\n";

	if ($ShowSelectOne)
		echo '<option value="0"' . ($SelectedID == '0' ? ' SELECTED' : '') . ">Select One</option>\n";

	if ($ShowAllCategories)
		echo '<option value="A"' . ($SelectedID == 'A' ? ' SELECTED' : '') . ">All Categories</option>\n";

	if ($ShowNoCategories)
		echo '<option value="N"' . ($SelectedID == 'N' ? ' SELECTED' : '') . ">In No Categories</option>\n";

	// Execute the query
//	$sql = "SELECT * FROM news_categories";
	$sql = "SELECT * FROM news_categories, news_users_categories WHERE news_categories.ID = news_users_categories.CatID AND UserID = '$LoggedInUserId' ORDER BY CatDesc ASC";

	$result = mysql_query($sql) or die('Query failed : ' . mysql_error());
	while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
	{
		$CatID = $row['ID'];
		$CatDesc = $row['CatDesc'];
		echo "<option value=\"$CatID\"" . ($CatID == $SelectedID ? ' SELECTED' : '') . ">$CatDesc</option>\n";
	}
	echo "</select>\n";
}
?>
Return current item: PHPFreeNews