Gallery Directory Plugin for Coppermine v1.4.x Gallery Directory Plugin for Coppermine v1.4.x
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Gallery Directory Plugin for Coppermine v1.4.x

Started by wirewolf, November 30, 2006, 03:49:29 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wirewolf

I created a plugin that will add a menu link for a Gallery Directory (with out a lot of thumbnails to be displayed). The user can select from a Drop Down List of a Gallery's Categories. The resulting page displays a bulleted list of the Albums within that Category, and all of the files within each Album. The script will only show public albums and approved files. Also, if any file does not have a title, the script will substitute the filename on the list. See Directory as an example.

Works with v1.4.10, classic theme. Should work with other themes. It has only the english.php file, but easy for those who wish to provide translations, there are only 8 lines in the language file.

I have mod_rewrite on my site, but the script is written for the normal php paths'. (ie, Directory as written in the script)

Now, I only have two Categories on my site for now, but this could be useful for those with a lot of Categories. This plugin was inspired by the Photo Summary plugin by Frantz, Displaying an file index page.

If the devs like. I'll post the plugin. Also, before I post the plugin, if the devs would like to check my coding of the plugin's main script, cat_directory.php

wirewolf

Zip file for download below

Joachim Müller

Quote from: wirewolf on November 30, 2006, 03:49:29 AM
If the devs like. I'll post the plugin. Also, before I post the plugin, if the devs would like to check my coding of the plugin's main script, cat_directory.php
Looks interessting, please go ahead - looking forward to it.

Joachim

François Keller

Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

Pascal YAP

Mornin',

Nothing to add.... We're waiting for you  :)
Thanx by advance.

PYA

Hein Traag

Looks nice wirewolf. Good job!

Looking forward to testing it on my CPG  ;D

Hein

wirewolf

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%"$page1);
$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']}&nbsp;\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>&nbsp;&nbsp;<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>&nbsp;&nbsp;<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

Sami

It would be better if you put the whole plugin package for test ;)

BTW you can remove this (around line 55~57)

$category = $_POST['category'];
$values = explode(",", $category);


You've set those variables on first if (isset($_POST['submit'])) statment
‍I don't answer to PM with support question
Please post your issue to related board

wirewolf

#7
Ok, here's the zip file with the plugin. I did some slight modifications. After selecting a directory from the drop down menu, the resulting page will only show the directory selected. Added a link at the bottom of this page to return to the drop down. See - Directory. I have mod_rewrite, so the file and the directory listings will show a html extension. The plugin is written with the normal php paths and will work with the normal Coppermine script.

The zip file includes all the files and a README with instructions. If the devs like, please post accordingly.

Thanks, wirewolf

PS, Thank you Frantz for the inspiration.

Add-on, I've included Frantz's and Hein's French and Dutch laguage files in the zip file

Jan 1st, 2007 - Made some changes to the cat_directory.php file (made it a list of links for the categories and for mark-up validation). New zip file included (only file change is cat_directory.php, all others are the same)
wirewolf

François Keller

#8
Hey Wirewolf,

Good work, attached, french language file.  ;)
QuoteThank you Frantz for the inspiration.
Thank's, but my plugin was inspired by fotofreek's MOD  ;)
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

Hein Traag

Dutch language file. Good work wirewolf  :D

Hein

wirewolf

Thanks Frantz and Hein for the translations. Anyone else that would like to contribute a translation file, just post it right here.

For those wanting to download the plugin, I added the French and Dutch language files to the zip - http://forum.coppermine-gallery.net/index.php?topic=38927.msg184460#msg184460 , or if you have already installed the plugin, just download the language files and upload to the plugins' lang folder.

Anyone whos' installed the plugin, post a link to your site. I'd like to see it in action on other than my own site,

Cheers, wirewolf

hotkee

Hi wirewolf

I have installed the plugin but have a problem understanding how to get it display the menu.
Do I need to modify the theme?
And if so what should be added?

Anyone help please.


wirewolf

Quote from: hotkee on January 01, 2007, 02:03:39 PM
Hi wirewolf

I have installed the plugin but have a problem understanding how to get it display the menu.
Do I need to modify the theme?
And if so what should be added?

Anyone help please.


Hi hotkee, You shouldn't have to modify your theme. If you want, uninstall and delete the version 1.1 and install the version I just posted, v1.2 See above - http://forum.coppermine-gallery.net/index.php?topic=38927.msg184460#msg184460

Jan 1st, 2007 - I Made some changes to the cat_directory.php file (made it a list of links for the categories and for mark-up validation). New zip file included (only file change is cat_directory.php, all others are the same) See - http://academyphotos.net/photogallery/index.php?file=cat_directory/cat_directory

wirewolf

cocostaff

Hi wirewolf

I have installed the plugin, but it seems conflicting with the bridge of joomla. When i click on the directory menu i get : Critical error - There was an error while processing a database query.

i have many plugins installed (download image/ keyword tags/ Orderable Category List) and a modified theme (suppressed head and title). I've tried the elevate the plugin hierarchy to the highest rank to avoid conflicting with Orderable Category List but it still display the error message above.

Any ideas ?






wirewolf

Hi cocostaff, have you enabled 'debug mode'? Might give you a better idea of the problem. I'm not familiar with joomla, so I don't know what possible conflict, if any, there would be with the category plugin. Also, do you have a link to the cat directory?

cocostaff

Quote from: wirewolf on March 04, 2007, 03:51:56 AM
Hi cocostaff, have you enabled 'debug mode'? Might give you a better idea of the problem. I'm not familiar with joomla, so I don't know what possible conflict, if any, there would be with the category plugin. Also, do you have a link to the cat directory?

Here is the debug message i obtain, on cpg_folder/include/functions.inc.php - Line: 249
USER:
------------------
Array
(
    [ID] => 0252f5e65dc5d9b41ec6ac12c8d3cd23
    [am] => 1
    [lang] => french
    [liv] => Array
        (
            [0] => 295
            [1] => 294
            [2] => 4740
            [3] => 1968
            [4] => 1965
        )

    [sort] => td
    [search] => Array
        (
            [search] => michelange
            [album] => search
            [plugin_search_album] => true
            [title] => on
            [newer_than] =>
            [caption] => on
            [older_than] =>
            [keywords] => on
            [type] => AND
            [album_title] => on
            [album_description] => on
            [params] => Array
                (
                    [title] => on
                    [caption] => on
                    [keywords] => on
                )

        )

    [lap] => 7
)

==========================
USER DATA:
------------------
Array
(
    [user_id] => 62
    [user_name] => admin
    [groups] => Array
        (
            [0] => 1
        )

    [disk_max] => 0
    [disk_min] => 0
    [can_rate_pictures] => 1
    [can_send_ecards] => 1
    [ufc_max] => 3
    [ufc_min] => 3
    [custom_user_upload] => 0
    [num_file_upload] => 10
    [num_URI_upload] => 3
    [can_post_comments] => 1
    [can_upload_pictures] => 1
    [can_create_albums] => 1
    [has_admin_access] => 1
    [pub_upl_need_approval] => 0
    [priv_upl_need_approval] => 0
    [group_name] => Administrators
    [upload_form_config] => 3
    [group_quota] => 0
    [can_see_all_albums] => 1
    [group_id] => 1
)

==========================
Queries:
------------------
Array
(
    [0] => SELECT extension, mime, content, player FROM cp_filetypes; (0.006s)
    [1] => select * from cp_plugins order by priority asc; (0s)
    [2] => SELECT * FROM cp_bridge (0.002s)
    [3] => SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval FROM cp_usergroups WHERE group_id in (1) (0s)
    [4] => SELECT group_name FROM  cp_usergroups WHERE group_id= 1 (0s)
    [5] => SELECT user_favpics FROM cp_favpics WHERE user_id = 62 (0.003s)
    [6] => SELECT * FROM cp_final_extract_config (0.003s)
    [7] => DELETE FROM cp_banned WHERE expiry < '2007-03-04 22:00:26' (0.001s)
    [8] => SELECT * FROM cp_banned WHERE (ip_addr='84.97.212.186' OR ip_addr='84.97.212.186' OR user_id=62) AND brute_force=0 (0.004s)
    [9] => SELECT cid, name FROM cp_categories WHERE cid != 1 AND visible = 0 ORDER BY name ASC  (0s)
)

==========================
GET :
------------------
Array
(
    [file] => cat_directory/cat_directory
)

==========================
POST :
------------------
Array
(
)

==========================
VERSION INFO :
------------------
PHP version: 4.3.11 - OK
------------------
mySQL version: 4.0.27-max-log
------------------
Coppermine version: 1.4.10(stable)
==========================
Module: GD
------------------
GD Version: bundled (2.0.28 compatible)
FreeType Support: 1
FreeType Linkage: with freetype
T1Lib Support:
GIF Read Support: 1
GIF Create Support: 1
JPG Support: 1
PNG Support: 1
WBMP Support: 1
XBM Support: 1
JIS-mapped Japanese Font Support:

==========================
Module: mysql
------------------
MySQL Supportenabled
Active Persistent Links 0
Active Links 2
Client API version 5.0.18
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /usr/local/mysql-5.0/data/mysql.sock
MYSQL_INCLUDE -I/usr/local/mysql-5.0/include/mysql
MYSQL_LIBS -L/usr/local/mysql-5.0/lib/mysql -lmysqlclient 
==========================
Module: zlib
------------------
ZLib Support enabled
Compiled Version 1.1.4
Linked Version 1.2.3
==========================
Server restrictions (safe mode)?
------------------
Directive | Local Value | Master Value
safe_mode | Off | Off
safe_mode_exec_dir | /usr/local/php/bin | /usr/local/php/bin
safe_mode_gid | Off | Off
safe_mode_include_dir | no value | no value
safe_mode_exec_dir | /usr/local/php/bin | /usr/local/php/bin
sql.safe_mode | Off | Off
disable_functions | no value | no value
file_uploads | On | On
include_path | .:/usr/local/lib/php | .:/usr/local/lib/php
open_basedir | no value | no value
==========================
email
------------------
Directive | Local Value | Master Value
sendmail_from | no value | no value
sendmail_path | /usr/sbin/sendmail -t -i  | /usr/sbin/sendmail -t -i
SMTP | relay-hosting.secureserver.net | relay-hosting.secureserver.net
smtp_port | 25 | 25
==========================
Size and Time
------------------
Directive | Local Value | Master Value
max_execution_time | 30 | 30
max_input_time | 60 | 60
upload_max_filesize | 2M | 2M
post_max_size | 8M | 8M
==========================
Page generated in 1.02 seconds - 10 queries in 0.019 seconds - Album set : ; Meta set: ;

omkarom

I have installed this plugin on my site having cpg 1.4.25,but getting critical error as shown below.

There was an error while processing a database query.

While executing query "SELECT cid, name FROM cpg_categories WHERE cid != 1 AND visible = 0 ORDER BY name ASC " on 0

mySQL error: Unknown column 'visible' in 'where clause'

File: /home/joywaves/public_html/coppermine/include/functions.inc.php - Line: 250

My site:http://joyadda.com



durangod

no affect at all, did nothing that i could see

Joachim Müller

Attached is version 1.3 of this plugin, where I have:

  • Added german language file
  • Added missing translation string if a category is empty
  • Removed unneeded strings from the translation files (they already reside in the core language files)
  • Fixed broken query (reported by omkarom)

However, there's a lot of issues in this plugin: it will consume a vast amount of resources on large galleries. It doesn't properly check against permissions, so you should only use this plugin if you run a free for all gallery. The PHP code is a mess (indentation!),  so it's quite hard to improve that file, but let's put it in a positive way: there's room for improvement. I'm not trying to bash wirewolf as a contributor, I just want to point out that you should be picky about the use of this plugin given the current status - I'd label it "alpha".

Quote from: durangod on January 06, 2010, 01:21:19 AM
no affect at all, did nothing that i could see
It adds a menu item (as suggested in the readme file that comes with it). Works fine for me. Maybe you haven't looked closely enough. Anyway, there's a set of board rules - please respect them in the future; yours is not a valid report nor a valid request for support.

@translators: "directory" does not mean "folder" in this plugin, but "overview" or "summary". Make sure not to use the word "folder", as this plugin does not work on file system level, but on the logical levels category -> sub category -> album -> file record.

@all: the subject is misleading - this plugin does not only work for cpg1.4.10, but for all versions of cpg1.4.x, so I'm changing the suvject of the original posting accordingly.