Location: PHPKode > projects > SiteX > page.php
<?PHP
ob_start();
session_start();
include("includes/globals.php.inc");
include("includes/functions.php");
include("lang/English.php");
if(strtolower($sxSetup['Language']) != 'english') include("lang/".$sxSetup['Language'].".php");
include("themes/$THEME_FOLDER/config.php.inc");

if(isset($page))
{
	$sxSQLPage = str_replace('_', ' ', $page);
	$query = "SELECT * FROM $DB_Pages WHERE name='$sxSQLPage'";
	$result = mysql_query($query, $Link) or queryError("7", mysql_error());
	$ROW = mysql_fetch_object($result);
}
elseif(is_numeric($pageid))
{
	$sxPageID = intval($pageid);
	$query = "SELECT * FROM $DB_Pages WHERE id='$sxPageID'";
	$result = mysql_query($query, $Link) or queryError("7", mysql_error());
	$ROW = mysql_fetch_object($result);
}
else
{
	header("Location:".$sxThemeConfig['Homepage']);
	die();
}

if((!mysql_num_rows($result))AND(!userAdmin()))
{
	header("Location:".$sxThemeConfig['Homepage']);
	die();
}
if((!mysql_num_rows($result))AND(userAdmin()))
{
	header("Location: admin/page_add.php?sxPageName=".urlencode($page));
	die();
}
if(!protectPrivatePage($ROW->id))
{
	header("Location:".$sxThemeConfig['Homepage']);
	die();
}

// Form keyword array if search highlighting
$sxSearchKeywords = array();
if (strlen($sxSearchHighlight) > 0)
	$sxSearchKeywords = sxExtractKeywords(stripslashes(urldecode($sxSearchHighlight)));

$content = sxHighlightText(parseSpecial($ROW->content),$sxSearchKeywords);
$sxTitleAddendum = ($ROW->name);
if ($ROW->meta_title_ext) {
	$sxTitleAddendum = ($ROW->name) .", ". ($ROW->meta_title_ext);
}

include("themes/$THEME_FOLDER/header.php");
?>
 <div class="bodyWrapper">
	<h1><?PHP echo sxHighlightText($ROW->name,$sxSearchKeywords); ?></h1>
	<?PHP echoMessage($message); ?>
	<table cellpadding="0" cellspacing="0">
		<tr valign="top">
			<td >
		   		<div class="pageContent"><?PHP echo $content; ?></div>
			</td>
		</tr>
		<tr valign="top">
			<td valign="top" class="lastupdated">
				<?PHP echo $sxLang['PageLastUpdated']; ?> <?PHP echo fetchDate($ROW->lastupdated, 1, 1); ?>.
				<?PHP if(userAdmin()) echo '<br /><a href="admin/page_edit.php?pageid=' . $ROW->id . '">' . $sxLang['PageButtonEdit'] . '</a>'; ?>
			</td>
		</tr>
   </table>
</div> 
<?PHP
include("themes/$THEME_FOLDER/footer.php");
ob_end_flush();
?>
Return current item: SiteX