Location: PHPKode > projects > SiteX > admin/journal_manager.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((!userEditor())AND(!userAdmin()))  loginError($sxLang['LoginRequired']);
if((userEditor())AND(!$sxSetup['EditorRightsJournalEdit']))  loginError($sxLang['LoginRequired']);

if($delete)
{
	$query = "DELETE FROM $DB_Journal WHERE id='$delete'";
	$result = mysql_query($query, $Link);
	
	$query = "DELETE FROM $DB_Comments WHERE sectionid='1' AND rowid='$delete'";
	$result = mysql_query($query, $Link);
	
	writeRSSXML();
	
	$message = $sxLang['MessageJournalDeleted'];
}

$query = "SELECT * FROM $DB_Journal";
$result = mysql_query($query, $Link) or queryError("55", mysql_error());
$totalElements = mysql_num_rows($result);

$elements_per_page = $sxThemeConfig['AdminJournalsPerPage'];
if(!$page)
	$page = 1;
$start = ($page - 1)*$elements_per_page;


$sxTitleAddendum = $sxLang['AdminHeading'];
include("../themes/$THEME_FOLDER/header.php");
?>
<script language="JavaScript" type="text/JavaScript">
<!--
function confirmDelete(theID,theName){
	if(confirm("<?PHP echo $sxLang['GeneralJSDeleteEntry3']; ?> '"+theName+"' <?PHP echo $sxLang['GeneralJSDeleteEntry2']; ?>")){
		window.location='<?PHP print $PHP_SELF."?page=$page&delete="; ?>'+theID;
	}
}
//-->
</script>     
<div class="bodyWrapper">
   <h1 class="sxAdminHeading"><?PHP echo getComponentName("1").' '.$sxLang['GeneralHeadingEntry'].' '.$sxLang['GeneralHeadingManager']; ?></h1>
   <div class="sxAdminBreadcrumbs"><?PHP if(userAdmin()) { ?><a href="index.php"><?PHP echo $sxLang['AdminBreadcrumb']; ?><?PHP }?><?PHP if(userEditor()) { ?><a href="editor_index.php"><?PHP echo $sxLang['EditorBreadcrumb']; ?><?PHP }?></a> > <?PHP echo getComponentName("1").' '.$sxLang['GeneralHeadingEntry'].' '.$sxLang['GeneralHeadingManager']; ?></div>   
   <?PHP echoMessage($message); ?>
	<table border="0" cellspacing="2" cellpadding="5">
	  <tr>
		<td colspan="3">
		  <table width="100%" border="0" cellspacing="0" cellpadding="0">
		  <tr>
			<td align="left">
			<div style="padding-top:8px;padding-bottom:8px;font-size:10px;"><?PHP pageTurns("$PHP_SELF?", $totalElements, $page, $elements_per_page); ?></div>
			</td>
			<td align="right">
			  <?PHP if((userAdmin())OR($sxSetup['EditorRightsJournalAdd'])) { ?>
			  <input name="AddEntry" style="width:150px;" type="button" value="<?PHP echo $sxLang['JournalButtonAddNew']; ?>" onclick="window.location='journal_add.php'" />
			  <?PHP }?>
			</td>
		  </tr>
		  </table>
		</td>
	  </tr>
	  <tr>
		<td class="tableColumn"><?PHP echo $sxLang['GeneralItemTitle']; ?></td>
		<td class="tableColumn"><?PHP echo $sxLang['GeneralItemDate']; ?></td>
		<td class="tableColumn"><?PHP echo $sxLang['GeneralItemOptions']; ?></td>
	 </tr>
	<?PHP
	$query = "SELECT * FROM $DB_Journal ORDER BY timestamp DESC LIMIT $start, $elements_per_page";
	$result = mysql_query($query, $Link) or queryError("20", mysql_error());
	while($ROW = mysql_fetch_object($result))
	{
		echo '  <tr bgcolor="' . $sxTheme['ColorTableRow'] . '">';
		
		if($ROW->title)
			echo '     <td><a href="journal_edit.php?entryid=' . $ROW->id . '">' . limitString($ROW->title, 50) . '</a></td>';
		else
			echo '     <td><a href="journal_edit.php?entryid=' . $ROW->id . '">[' . $sxLang['GeneralNoTitle'] . ']</a></td>';
		
		echo '     <td>' . fetchDate($ROW->timestamp, 1, 1) . '</td>';
		echo '     <td><a href="journal_edit.php?entryid=' . $ROW->id . '" title="' . $sxLang['ButtonEdit'] . '"><img src="../images/admin_edit.gif" style="border: 0;" alt="' . $sxLang['ButtonEdit'] . '" /></a> ';
		echo '         <a href="#"  onclick="confirmDelete(' . $ROW->id . ',\'' . fetchDate($ROW->timestamp, 1, 1) . '\')" title="' . $sxLang['ButtonDelete'] . '"><img src="../images/admin_delete.gif" style="border: 0;" alt="' . $sxLang['ButtonDelete'] . '" /></a></td>';
		echo '  </tr>';
	}
	if(mysql_num_rows($result) == 0)
		echo '<tr bgcolor="' . $sxTheme['ColorTableRow'] . '"><td colspan="3"><em>' . $sxLang['NoEntries'] . '</em></td></tr>';
	?>
	  <tr>
		<td colspan="3"><div style="padding-top:8px;padding-bottom:8px;font-size:10px;"><?PHP pageTurns("$PHP_SELF?", $totalElements, $page, $elements_per_page); ?></div></td>
	  </tr>
  </table>
</div>
<?PHP
include("../themes/$THEME_FOLDER/footer.php");
ob_end_flush();
?>
Return current item: SiteX