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

if($delete)
{
	$query = "SELECT * FROM $DB_Title_Pictures WHERE id='$delete'";
	$result = mysql_query($query, $Link) or queryError("50", mysql_error());
	$ROW = mysql_fetch_object($result);
	
	@unlink("../content/title_pictures/$ROW->filename");
	
	$query = "DELETE FROM $DB_Title_Pictures WHERE id='$delete'";
	$result = mysql_query($query, $Link);
	
	$message = $sxLang['MessageTitleDeleted'];
}

if($activate)
{	
	$query = "UPDATE $DB_Title_Pictures SET active='1' WHERE id='$activate'";
	$result = mysql_query($query, $Link) or queryError("30", mysql_error());
}
if($deactivate)
{	
	$query = "UPDATE $DB_Title_Pictures SET active='0' WHERE id='$deactivate'";
	$result = mysql_query($query, $Link) or queryError("51", mysql_error());
}

$sxTitleAddendum = $sxLang['AdminHeading'];
include("../themes/$THEME_FOLDER/header.php");
?>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function confirmDelete(theID,theName){
	if(confirm("<?PHP echo $sxLang['GeneralJSDeleteEntry3']; ?> '"+theName+"' <?PHP echo $sxLang['GeneralJSDeleteEntry2']; ?>")){
		window.location='<?PHP print $PHP_SELF."?themeid=$themeid&delete="; ?>'+theID;
	}
}
//-->
</script>     
<div class="bodyWrapper">
   <h1 class="sxAdminHeading"><?PHP echo $sxLang['TitleHeadingManager']; ?></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 $sxLang['TitleHeadingManager']; ?></div>   
   <?PHP echoMessage($message); ?>
   <form name="sxThemeSelect">
   <select name="menu1" onchange="MM_jumpMenu('parent',this,0)">
		<option value="<?PHP echo $PHP_SELF; ?>"><?PHP echo $sxLang['TitleOptionThemesAll']; ?></option>
   <?PHP
	$query = "SELECT * FROM $DB_Themes ORDER BY name";
	$result = mysql_query($query, $Link) or queryError("12", mysql_error());
	while($ROW = mysql_fetch_object($result))
	{
		if($themeid)
		{
			if($ROW->id == $themeid)
				$selected = ' selected';
			else
				$selected = '';
		}
		else
		{
			if($ROW->id == $THEME)
				$selected = ' selected';
			else
				$selected = '';
		}
		echo '<option value="' . "$PHP_SELF?themeid=$ROW->id" . '"' . $selected . '>' . $ROW->name . '</option>';
	}
  ?>
   </select><br /><br />
	<table border="0" cellspacing="2" cellpadding="5">
	  <tr>
		<td class="tableColumn"><?PHP echo $sxLang['GeneralItemActive']; ?></td>
		<td class="tableColumn"><?PHP echo $sxLang['GeneralItemName']; ?></td>
		<td class="tableColumn"><?PHP echo $sxLang['ThemesItemTheme']; ?></td>
		<td class="tableColumn"><?PHP echo $sxLang['GeneralItemOptions']; ?></td>
	  </tr>
		<?PHP
		if($themeid)
			$where_theme = "WHERE themeid='$themeid'";
		else
			$where_theme = "WHERE themeid='$THEME'";
		
		$query = "SELECT * FROM $DB_Title_Pictures $where_theme ORDER BY name ASC";
		$result = mysql_query($query, $Link) or queryError("27", mysql_error());
		while($ROW = mysql_fetch_object($result))
		{
			$query2 = "SELECT name FROM $DB_Themes WHERE id='$ROW->themeid'";
			$result2 = mysql_query($query2, $Link) or queryError("12", mysql_error());
			$ROW2 = mysql_fetch_object($result2);

			echo '  <tr bgcolor="' . $sxTheme['ColorTableRow'] . '">';
			
			if($ROW->active)
				echo '     <td><a href="' . "$PHP_SELF?deactivate=$ROW->id&themeid=$themeid" . '" title="' . $sxLang['ImgAltDeactivate'] . '"><img alt="' . $sxLang['ImgAltDeactivate'] . '" src="../images/check.gif" style="border: 0;" /></a></td>';
			else
				echo '     <td><a href="' . "$PHP_SELF?activate=$ROW->id&themeid=$themeid" . '" title="' . $sxLang['ImgAltActivate'] . '"><img alt="' . $sxLang['ImgAltActivate'] . '" src="../images/x.gif" style="border: 0;" /></a></td>';
			
			echo '     <td>' . htmlspecialchars($ROW->name) . '</td>';
			echo '     <td>' . $ROW2->name . '</td>';
			echo '     <td><a href="#" onclick="confirmDelete(' . $ROW->id . ',\'' . htmlspecialchars(addslashes($ROW->name)) . '\')" 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="4"><em>' . $sxLang['NoTitlePictures'] . '</em></td></tr>';
		?></table>
  </form>
  <p><a href="title_add.php"><?PHP echo $sxLang['AdminLinkTitleAdd']; ?></a></p>
</div>
<?PHP
include("../themes/$THEME_FOLDER/footer.php");
ob_end_flush();
?>
Return current item: SiteX