<?php
if (!defined('ADMIN_FILE')) {
	die("Illegal File Access");
}

function editallcategories() {
	global $prefix, $imagepath, $gallerypath, $db, $admin_file;
	include("header.php");
	navigationAdmin("<b><a href=\"".$admin_file.".php?op=album&do=showoptions\">"._GALCONFIG."</a></b> &gt;&gt; <b>"._GALEDITALLCATEGORIES."</b>");
	OpenTable();
	echo "<center>"._GALECDCATEGORIESDESC."</center>";
	CloseTable();
	OpenTable();
	echo "<center><font class=\"option\"><b>"._GALEDITALLCATEGORIES."</b></font><br>";
	echo "[ <a href=\"".$admin_file.".php?op=album&do=editcategory_Album&amp;parent=-1\">"._GALCLICK2CREATECAT."</a> ]</center><br>";
	list($numcategories) = $db->sql_fetchrow($db->sql_query("SELECT count(*) from $prefix"._album_categories.""));
	if ($numcategories>0) {
		$categories = listcategories("$gallerypath");
		$categories = explode(" ", trim($categories));
		$cpt = 0;
		while(list($key, $val) = each($categories)) {
			$result = $db->sql_query("select gallid, galloc, gallname, parent, visible, gallimg from $prefix"._album_categories." where gallid=".$val);
			list ($gid, $galloc, $name, $parent, $visible, $gallimg) = $db->sql_fetchrow($result);
			$tab = indent($gid)*50;
			list($count) = $db->sql_fetchrow($db->sql_query("SELECT count(*) FROM $prefix"._album_pictures." WHERE gid=$gid"));
			echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><img src=\"$imagepath/blank.gif\" height=\"20\" width=\"$tab\"></td><td><table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" class=\"bodyline\"><tr><td>$name [<a href=\"".$admin_file.".php?op=album&do=editcategory_Album&amp;category=$gid\">"._GALCATEDIT."</a>] [<a href=\"".$admin_file.".php?op=album&do=editcategory_Album&type=move&category=$gid\">"._GALCATMOVE."</a>] [<a href=\"".$admin_file.".php?op=album&do=editcategory_Album&type=delete&category=$gid\" onClick=\"return confirm('"._GALSURE2DELETECAT."')\">"._GALCATDELETE."</a>] [<a href=\"".$admin_file.".php?op=album&do=editcategory_Album&parent=$gid\">"._GALCATCREATESUB."</a>]<hr><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"left\"><img src=\"$gallerypath/$galloc/$gallimg\" border=\"0\"></td><td align=\"right\">"._GALCATMEDIACOUNT." $count<br>"._GALCATSTATE." ";
			switch ($visible) {
				case 0:
				echo "<a href=\"".$admin_file.".php?op=album&do=editcategory_Album&amp;type=status&amp;visible=1&amp;category=$gid\" title=\""._GALVISIBLEADMIN."\">"._GALVISIBLEADMIN."&nbsp;<img src=\"$imagepath/red_dot.gif\" border=\"0\" width=\"10\" height=\"10\" alt=\""._GALVISIBLEADMIN."\"></a>&nbsp;";
				break;
				case 1:
				echo "<a href=\"".$admin_file.".php?op=album&do=editcategory_Album&amp;type=status&amp;visible=2&amp;category=$gid\" title=\""._GALVISIBLEMEMBER."\">"._GALVISIBLEMEMBER."&nbsp;<img src=\"$imagepath/yellow_dot.gif\" border=\"0\" width=\"10\" height=\"10\" alt=\""._GALVISIBLEMEMBER."\"></a>&nbsp;";
				break;
				default:
				echo "<a href=\"".$admin_file.".php?op=album&do=editcategory_Album&amp;type=status&amp;visible=0&amp;category=$gid\" title=\""._GALVISIBLEPUBLIC."\">"._GALVISIBLEPUBLIC."&nbsp;<img src=\"$imagepath/green_dot.gif\" border=\"0\" width=\"10\" height=\"10\" alt=\""._GALVISIBLEPUBLIC."\"></a>&nbsp;";
				break;
			}
			print "</td></tr></table></td></tr></table></td></tr></table><br>";
		}
	}
	CloseTable();
	include("footer.php");
}
?>