Bulk rotate mod Bulk rotate mod
 

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

Bulk rotate mod

Started by olly69, July 18, 2006, 01:54:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

olly69

Hello

I am trying to adapt this mod: http://forum.coppermine-gallery.net/index.php?topic=9399.msg157988#msg157988  to 1.4 ( . 8 ) primarily for the bulk rotation function.

I am getting a "fatal error" with the following debug when I go to the login (or indeed any) page:


While executing query "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 MAX(can_rotate_images) as can_rotate_images FROM cpg148_usergroups WHERE group_id in (1)" on 0

mySQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MAX(can_rotate_images) as can_rotate_images FROM cpg148_usergroups WHERE group_i' at line 1


The fault (or at least the first one I have found ;) ) seems to be in udb_base.inc.php as if I rollback just this file then the error goes and coppermine appears OK (although no real testing done)


changes made to /bridge/udb_base.inc.php indicated **

        define('USER_ID', $USER_DATA['user_id']);
        define('USER_NAME', addslashes($USER_DATA['user_name']));
        define('USER_GROUP', $USER_DATA['group_name']);
        define('USER_GROUP_SET', $user_group_set);
        define('USER_IS_ADMIN', $USER_DATA['has_admin_access']);
        define('USER_CAN_SEND_ECARDS', (int)$USER_DATA['can_send_ecards']);
        define('USER_CAN_RATE_PICTURES', (int)$USER_DATA['can_rate_pictures']);
        define('USER_CAN_POST_COMMENTS', (int)$USER_DATA['can_post_comments']);
        define('USER_CAN_UPLOAD_PICTURES', (int)$USER_DATA['can_upload_pictures']);
        define('USER_CAN_CREATE_ALBUMS', (int)$USER_DATA['can_create_albums']);
        define('USER_UPLOAD_FORM', (int)$USER_DATA['upload_form_config']);
        define('CUSTOMIZE_UPLOAD_FORM', (int)$USER_DATA['custom_user_upload']);
        define('NUM_FILE_BOXES', (int)$USER_DATA['num_file_upload']);
        define('NUM_URI_BOXES', (int)$USER_DATA['num_URI_upload']);
  **    define('USER_CAN_ROTATE_IMAGES',(int)$USER_DATA['can_rotate_images']);

#####################################################################################

     $result = cpg_db_query("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 ".
**                          "MAX(can_rotate_images) as can_rotate_images " .
                            "FROM {$CONFIG['TABLE_USERGROUPS']} WHERE group_id in (" .  implode(",", $groups). ")");


Change made to db:

ALTER TABLE `cpg148_usergroups` ADD `can_rotate_images` TINYINT( 4 ) DEFAULT '0' NOT NULL ;


I'd be grateful if someone could point me in the right direction.  I can provide copies of all files I have modified as required.


Cheers



Olly.

.

Nibbler

You need a comma here

"MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval ".

"MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval, ".

The original instructions don't make this clear.

olly69

#2
Thanks Nibbler.  That comma fixed that prob.

Next problem is...  When I go to edit group settings to allow rotation, although the column is there, there are no buttons or textboxes in it.  It is completely empty.

I decided to leave that problem for later so just updated the appropriate field for administrators in the usergroups table directly in the database to 1.  Now the error I get when I try to do an "edit files" from the galleries list page is:

Fatal error: Cannot redeclare strip_iptc() (previously declared in /var/www/html/gallery/include/iptc.inc.php:20) in /var/www/html/gallery/include/iptc.inc.php on line 29


I'd appreciate any advice..

A copy of all the files I modified are here:
www.blatantsolutions.com/bulkrotate.tar.gz

Cheers

Olly.

.