I've begun some coding around this feature in the past, but I have no time to finish this.
If someone want to use it....
<?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.
********************************************
Coppermine version: 1.4.10
$Source$
$Revision: 1 $
$Author: SaWey $
Parts of this script where borrowed from the searchnew.php file written by gaugau.
$Date: 2006-11-26 01:52:21 $
**********************************************/
define('IN_COPPERMINE', true);
define('SEARCH_PHP', true);
define('INDEX_PHP', true);
require('include/init.inc.php');
if (!USER_ID && $CONFIG['allow_unlogged_access'] == 0) {
$redirect = $redirect . "login.php";
header("Location: $redirect");
exit();
}
if (isset($_POST['search'])){
search();
}else{
start();
}
function start(){
$cat_array = array();
getallcatsindb($cat_array);
/**
*Create the select box
*/
$form = '
<form name="searchcpg" method="post" action="">
<input type="text" name="search" class="textinput"/>
<input type="hidden" name="album" value="search" />
<input type="hidden" name="title" value="title" />
<input type="hidden" name="caption" value="caption" />
<input type="hidden" name="keywords" value="keywords" />
<input type="hidden" name="owner_name" value="owner_name" />
<input type="hidden" name="filename" value="filename" />
<select name="album" size="1">
';
foreach($cat_array as $cat => $arr){
$form .= ' <option value="cat_' . $cat . '">'.$arr['name'].'</option>';
foreach($arr['albums'] as $key => $album){
$form .= ' <option value="alb_' . $key . '"> - '.$album.'</option>';
}
}
$form .= '</select>';
$form .= ' <input type="submit" value="' . 'Search" />';//$lang_search_php['submit_search'] . '" />';
$form .= '</form>';
print($form);
}
function search(){
$album = $_POST['album'];
if(substr($album,0,3)=="alb"){
//search in album
$album = substr($album,4);
}else{
//search in category
$category = substr($album,4);
}
}
/**
* getallcatsindb()
*
* Fill an array with all albums where keys are aid of albums and values are
* album title
*
* @param $cat_array the array to be filled
* @return
*/
function getallcatsindb(&$cat_array)
{
global $CONFIG;
$cats_sql = "SELECT cid, name " . "FROM {$CONFIG['TABLE_CATEGORIES']} " . "WHERE 1";
$cats_result = cpg_db_query($cats_sql);
while ($cats_row = mysql_fetch_array($cats_result)) {
$cat_array[$cats_row['cid']]['name'] = $cats_row['name'];
$cid = $cats_row['cid'];
$album_sql = "SELECT aid, title " . "FROM {$CONFIG['TABLE_ALBUMS']} " . "WHERE 1 AND category='$cid'";
//print($album_sql);
$album_result = cpg_db_query($album_sql);
while ($album_row = mysql_fetch_array($album_result)) {
$cat_array[$cats_row['cid']]['albums'][$album_row['aid']]=$album_row['title'];
}
mysql_free_result($album_result);
}
mysql_free_result($cats_result);
}
?>