Location: PHPKode > projects > PHPFreeNews > phpfn/Admin.php
<?php

/*	+--------------------------------------------------------------
	| PHPFreeNews - News Headlines on your website                |
	| Developed by Jim Willsher.                                  |
	| http://www.phpfreenews.co.uk                                |
	+-------------------------------------------------------------+
*/
require_once('Config/Config.php');
require_once('Inc/AdminFunctions.php');

$AdminScript = $_SERVER['PHP_SELF'];

// Is the installer still enabled?
if ($AllowInstall)
{ 
   print '<HR><CENTER><B>ERROR!!!!<br />Please disable installation (within the Config file) urgently!</B></CENTER><HR>';
   exit();
}

// Make sure we're authorised
require_once ('Inc/AccessControl.php');

// Activate buffering
ob_start();

// Determine the action. No action? Default to a news-list
$Action = isset($_GET['action']) ? $_GET['action'] : 'NewsList';
$Mode = isset($_GET['mode']) ? $_GET['mode'] : '';

// If session restrictions do not exists, make defaults
SetAdminDefaultRestrictions();

// Record this user's activity
mysql_query("UPDATE news_users SET LastActivityDateTime=now(), LastActivity='$Action' WHERE ID = $LoggedInUserId");

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<title><?= $SiteDescription ?> Administration</title>
		<link rel="stylesheet" href="Inc/Styles.css" type="text/css">
		<script type="text/javascript" language="javascript" src="Inc/AdminJavaScript.js"></script>

		<?php
		if ($UseTinyMCE == 1)
		{
			?>
			<!-- \\\\\\\\\\\\\ Begin TinyMCE 2.0RC3 \\\\\\\\\\\\\\\\ -->
			<script language="javascript" type="text/javascript" src="Inc/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
			<script language="javascript" type="text/javascript">
				tinyMCE.init({
					mode : "exact",
					elements : "ShortPost_news,LongPost_news",
					force_br_newlines : true,
					theme : "advanced",
					language : "en",
					plugins : 		"table,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu,filemanager,ibrowser",
					theme_advanced_buttons1_add_before : "save,separator",
					theme_advanced_buttons1_add : "fontselect,fontsizeselect",
					theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,separator,forecolor,backcolor,print",
					theme_advanced_buttons2_add_before: "cut,copy,paste,separator,replace,separator",
					theme_advanced_buttons3_add_before: "ibrowser,filemanager,tablecontrols,separator",
					theme_advanced_buttons3_add: "emotions,iespell,flash,advhr",
					theme_advanced_toolbar_location : "top",
					theme_advanced_toolbar_align : "left",
					theme_advanced_path_location : "bottom",
					plugin_insertdate_dateFormat : "%Y-%m-%d",
					plugin_insertdate_timeFormat : "%H:%M:%S",
					extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]"
				});
			</script>
			<?php
		}
		?>

	</head>
	<body>
		<table width="100%" border="0" align="center" cellspacing="0" cellpadding="3">
			<tr>
				<td valign="bottom" class="Welcome">
					<div align="center"><?= $WelcomeMessage . " " . $LoggedInFullName . " to " . $SiteDescription ?></div>
				</td>
				<td align="right">
					<a href="Admin.php"><img src="Inc/Images/<?= $AdminSiteLogo ?>" align="right" border="0" alt="Logo"></a>
				</td>
			</tr>
		</table>

		<table width="100%" border="1" align="center" cellspacing="0" cellpadding="0">
			<tr>
				<td width="130" valign="top">
					<table width="158" align="center" border="1" cellspacing="0" cellpadding="0">
						<tr>
							<td colspan="3" class="MenuHeading">
								&nbsp;&nbsp;News Tasks
							</td>
						</tr>
					</table>
					
					<table width="158" align="center" border="0" cellspacing="2" cellpadding="0">
						<tr>
							<td class="MenuOption">
								<a href="<?=$AdminScript?>?action=news&amp;mode=post">New Article</a><br />
								<a href="<?=$AdminScript?>?action=NewsList">Edit Articles</a><br />
								<?
								if (($LoggedInCanApprovePosts) && ($ArticlesRequireApproval))
								{
									?>
									<a href="<?=$AdminScript?>?action=PostsApproval">Approve Posts</a><br />
									<?
								}
								if ($EnableComments)
								{
									?>
									<a href="<?=$AdminScript?>?action=CommentsApproval">Approve Comments</a><br />
									<?
								}
								?>
								<a href="<?=$SiteDomain ?>" target="_blank">View Live Site</a><br />
								<a href="<?=$AdminScript?>?action=ImageList">Images</a><br />
							</td>
						</tr>
					</table>
					<br />

					<?php
					// Allow admin functions?
					if ($LoggedInAccessLevel == "2")
					{
						?>
						<table width="158" align="center" border="1" cellspacing="0" cellpadding="0">
							<tr>
								<td colspan="3" class="MenuHeading">
									&nbsp;&nbsp;Admin Tools
								</td>
							</tr>
						</table>

						<table width="158" align="center" border="0" cellspacing="2" cellpadding="0">
							<tr>
								<td class="MenuOption">
									<a href="<?=$AdminScript?>?action=Templates">Templates</a><br />
									<a href="<?=$AdminScript?>?action=UserCodes">User-Def. Codes</a><br />
									<a href="<?=$AdminScript?>?action=Categories">Categories</a><br />
									<a href="<?=$AdminScript?>?action=Users">Users</a><br />

									<?
									if ($EnableAudit == 1)
									{
										?>
										<a href="<?=$AdminScript?>?action=Audit">View Audit</a><br />
										<?
									}
									?>
									<a href="<?=$AdminScript?>?action=Statistics">Statistics</a><br />
									<a href="<?=$AdminScript?>?action=ActiveUsers">Active Users</a><br />
									<a href="<?=$AdminScript?>?action=Mass">Mass Maintenance</a><br />
								</td>
							</tr>
						</table>
						<br />

						<table width="158" align="center" border="1" cellspacing="0" cellpadding="0">
							<tr>
								<td colspan="3" class="MenuHeading">
									&nbsp;&nbsp;Housekeeping
								</td>
							</tr>
						</table>
						<table width="158" align="center" border="0" cellspacing="2" cellpadding="0">
							<tr>
								<td class="MenuOption">
									<?php

									if ($EnableArchive == 1)
									{
										?>
										<a href="<?=$AdminScript?>?action=Archive">Archive News</a><br />
										<?
									}

									if ($EnableNewsPurge == 1)
									{
										?>
										<a href="<?=$AdminScript?>?action=PurgeNews">Purge News</a><br />
										<?
									}

									if ($EnableAudit == 1)
									{
										?>
										<a href="<?=$AdminScript?>?action=PurgeAudit">Purge Audit</a><br />
										<?
									}
									?>
								</td>
							</tr>
						</table>
						<br />
						<?php
					}
					?>

					<table width="158" align="center" border="1" cellspacing="0" cellpadding="0">
						<tr>
							<td colspan="3" class="MenuHeading">
								&nbsp;&nbsp;User Options
							</td>
						</tr>
					</table>

					<table width="158" align="center" border="0" cellspacing="2" cellpadding="0">
						<tr>
							<td class="MenuOption">
								<a href="<?=$AdminScript?>?action=Password">Change&nbsp;Password</a><br />

								<?php
								if ($OnlineVersionCheck)
								{
									?>
									<a href="<?=$AdminScript?>?action=VersionCheck">Online&nbsp;Version&nbsp;Check</a><br />
									<?php
								}
								?>
								<a href="<?=$AdminScript?>?action=Logout">Log Out</a>
							</td>
						</tr>
					</table>
					<br />
				</td>

				<td valign="top" width="100%">
					<?php

					// Process the appropriate action
					if ($Action == 'Logout') {
						if ($Mode == 'Destroy')
							require ('Inc/Logout.php');
						else
							require ('Inc/CheckLogout.php');
					} elseif ($LoggedInMustChangePassword == '1') {
						$ErrorText = 'You must change your password before you can proceed';
						require ('Inc/Password.php');
					} elseif ($Action == 'Statistics') {
						require ('Inc/Statistics.php');
					} elseif ($Action == 'ActiveUsers') {
						require ('Inc/ActiveUsers.php');
					} elseif ($Action == 'NewsList') {
						require ('Inc/NewsList.php');
					} elseif ($Action == 'CommentsApproval') {
						require ('Inc/CommentsApproval.php');
					} elseif ($Action == 'PostsApproval') {
						require ('Inc/PostsApproval.php');
					} elseif ($Action == 'news') {
						require ('Inc/Post.php');
					} elseif ($Action == 'ImageList') {
						require ('Inc/Images.php');
					} elseif ($Action == 'Users') {
						require ('Inc/Users.php');
					} elseif ($Action == 'Password') {
						require ('Inc/Password.php');
					} elseif ($Action == 'Categories') {
						require ('Inc/Categories.php');
					} elseif ($Action == 'Templates') {
						require ('Inc/Templates.php');
					} elseif ($Action == 'UserCodes') {
						require ('Inc/UserDefinedCodes.php');
					} elseif ($Action == 'PurgeNews') {
						require ('Inc/PurgeOldNews.php');
					} elseif ($Action == 'PurgeAudit') {
						require ('Inc/PurgeOldAudit.php');
					} elseif ($Action == 'Archive') {
						require ('Inc/ArchiveOldNews.php');
					} elseif ($Action == 'Audit') {
						require ('Inc/ViewAudit.php');
					} elseif ($Action == 'DoSticky') {
						require ('Inc/SetSticky.php');
					} elseif ($Action == 'DoVisible') {
						require ('Inc/SetVisible.php');
					} elseif ($Action == 'DoLock') {
						require ('Inc/SetLock.php');
					} elseif ($Action == 'VersionCheck') {
						require ('Inc/VersionCheck.php');
					} elseif ($Action == 'Mass') {
						require ('Inc/MassMaintenance.php');
					} elseif ($Action == 'UserAuthCat') {
						require ('Inc/UserAuthCat.php');
					} elseif ($Action == 'CatAuthUser') {
						require ('Inc/CatAuthUser.php');
					} else {
						require ('Inc/NewsList.php');
					}
					// REMEMBER to update ActiveUsers.php when updating the above list!!!!!
				?>
				</td>
			</tr>
		</table>
		<?php
		include('Inc/Footer.php');
		ob_end_flush();
		?>
	</body>
</html>
Return current item: PHPFreeNews