Hi, sorry for the delay. I'm here in New York and I just got up. Anyway, here's the code for cat_directory.php. The script works, but would the devs check the code to see if there are any potential problems. If ok, I'll upload the plugin later.
cat_directory.php:
<?php
/*************************
Coppermine Photo Gallery
************************
Copyright (c) 2003-2006 Coppermine Dev Team
v1.1 originally written by Gregory DEMAR
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
/*************************
Gallery Directory plugin v1.0 by wirewolf for Coppermine 1.4.10
**************************/
require('include/init.inc.php');
require ('plugins/cat_directory/include/init.inc.php');
if (isset($_POST['submit'])) {
$category = $_POST['category'];
$values = explode(",", $category);
$valtwo = $values[1];
$page = $valtwo;
} else {
$page = $lang_plugin_cat_directory['name'];
}
pageheader($page);
starttable("100%", $page, 1);
$category = '';
$albcount = '';
$imagecount = '';
$form_action = "index.php?file=cat_directory/cat_directory";
echo "<tr>\n";
echo "<td class=\"tableb\">\n";
echo "<tr>\n";
echo "<td class=\"tableb\">\n";
echo "<form action=\"$form_action\" method=\"post\" style=\"margin: 0\">\n";
echo "{$lang_plugin_cat_directory['directory_select']} \n";
echo "<select name=\"category\">\n";
$query = cpg_db_query("SELECT cid, name FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid != 1 ORDER BY name ASC ");
if (!mysql_num_rows($query)) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
while ($row = mysql_fetch_array($query)){
echo "<option value=\"$row[cid],{$lang_plugin_cat_directory['menu_link']} - $row[name]\">$row[name]</option>\n";
}
echo "</select>\n";
echo "<input title=\"{$lang_plugin_cat_directory['directory_select']}\" class=\"button\" type=\"submit\" name=\"submit\" value=\"Go!\" />\n";
echo "</form>\n";
echo "</td>\n";
echo "</tr>\n";
mysql_free_result($query);
if (isset($_POST['submit'])) {
$category = $_POST['category'];
$values = explode(",", $category);
$valone = $values[0];
echo "<tr>\n";
echo "<td class=\"tableb\">\n";
echo "<ul>\n";
$catquery = cpg_db_query("SELECT cid, name FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid = $valone ");
if (!mysql_num_rows($catquery)) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
while ($catrow = mysql_fetch_array($catquery)){
$albquery = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = '$catrow[cid]' AND visibility = 0 ORDER BY title ASC ");
if (!mysql_num_rows($albquery)) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
$albcount = mysql_num_rows($albquery);
echo "<li>{$lang_plugin_cat_directory['category']} - <a title=\"{$lang_plugin_cat_directory['category']} - $catrow[name]\" href=\"index.php?cat=$catrow[cid]\">$catrow[name]</a> <span class=\"footer\">(<strong>$albcount</strong> {$lang_plugin_cat_directory['albums']})</span></li>\n";
echo "<ul>\n";
while ($albrow = mysql_fetch_array($albquery)){
$imgquery = cpg_db_query("SELECT pid, title, filename FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = '$albrow[aid]' AND approved = 'yes' ORDER BY title ASC ");
$imagecount = mysql_num_rows($imgquery);
if ($imagecount >= 1) {
echo "<li>{$lang_plugin_cat_directory['album']} - <a title=\"{$lang_plugin_cat_directory['album']} - $albrow[title]\" href=\"thumbnails.php?album=$albrow[aid]\">$albrow[title]</a> <span class=\"footer\">(<strong>$imagecount</strong> {$lang_plugin_cat_directory['files']})</span></li>\n";
while ($picrow = mysql_fetch_array($imgquery)) {
if (!$picrow['title']){ $picrow['title'] = $picrow['filename']; }
echo "<ul>\n";
echo "<li><a title=\"{$lang_plugin_cat_directory['file']} - $picrow[title]\" href=\"displayimage.php?pos=-$picrow[pid]\">$picrow[title]</a></li>\n";
echo "</ul>\n";
}
}
}
echo "</ul>\n";
}
echo "</ul>\n";
echo "</td>\n";
echo "</tr>\n";
mysql_free_result($imgquery);
mysql_free_result($albquery);
mysql_free_result($catquery);
}
echo "</td>\n";
echo "</tr>\n";
endtable();
pagefooter();
ob_end_flush();
?>
Thanks, wirewolf