Advanced search  

News:

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

Pages: [1]   Go Down

Author Topic: [Fixed]: Batch upload dupes?  (Read 25138 times)

0 Members and 1 Guest are viewing this topic.

SamBuca

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 10
  • Zend Certified Engineer #2157
[Fixed]: Batch upload dupes?
« on: January 25, 2009, 10:02:43 am »

Didn't see this bug anywhere and the bug forum appears to be locked....so here it is....

First, all the occurrences of readdir() may cause a problem because they don't do the boolean check.

Second, I had a problem when I upgraded to 1.4.19 where the batch upload function would put 2 of every picture on the page where you select the album, select the pictures, and press "insert selected files" (last step of the batch upload)....but ONLY if it was automatically renaming the files.  It seems that by using readdir(), the actively open file handle is returning the "new" files, and since you put the new file name into $pic_array already, it's putting everything on twice.  Using scandir() would solve that by taking a snapshot of the directory and then processing it, but a huge directory would create a huge array and eat up memory.  Therefore, keeping things the way they are and adding a simple in_array() check is a quick fix.  Here are the fixes I did:

searchnew.php line 225:
Code: [Select]
while ($file = readdir($dir)) {

BECOMES

while (false !== ($file = readdir($dir))) {

searchnew.php line 231:
Code: [Select]
if (is_file($CONFIG['fullpath'] . $folder . $file)) {

BECOMES

if (is_file($CONFIG['fullpath'] . $folder . $file) && !in_array($file, $pic_array)) {

To reproduce it:

1) Upload a directory of files which will be renamed (a space in the file name).
2) chmod -R 777
3) Batch add files
4) Browseable is ON but it doesn't make a difference.
5) Click on the directory and hit OK.
6) The list will double up on all the files that were renamed.

I'm not sure if this is because I'm still running PHP4....they may have changed under-the-hood of readdir() in PHP5.

Debugging output from the program:
==========================
VERSION INFO :
------------------
PHP version: 4.3.10 - OK
------------------
mySQL version: 4.0.24-log
------------------
Coppermine version: 1.4.19(stable)
==========================
Module: GD
------------------
GD Version: bundled (2.0.28 compatible)
FreeType Support:
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 1
Client API version 3.23.49
MYSQL_MODULE_TYPE builtin
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_INCLUDE no value
MYSQL_LIBS no value
==========================
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 | no value | no value
safe_mode_gid | Off | Off
safe_mode_include_dir | no value | no value
safe_mode_exec_dir | no value | no value
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 | localhost | localhost
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 | 2M | 2M
==========================

Since I've been using coppermine for years now....I should say thanks for a great piece of software :)
« Last Edit: May 25, 2009, 11:03:23 pm by Joachim Müller »
Logged

chelnov

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Batch upload dupes?
« Reply #1 on: April 26, 2009, 01:38:58 pm »

Hi,
I have the same problem with PHP5.
Coppermine UI says that there is 111 pictures in the gallery but when I do like:
ls | grep ^G | nl
index of last image is 101..
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Batch upload dupes?
« Reply #2 on: April 27, 2009, 10:00:43 am »

There's no support on the bugs board. Post relevant information or don't post at all.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Batch upload dupes?
« Reply #3 on: May 25, 2009, 11:03:02 pm »

@SamBuca: thanks for your suggestions - applied them to the SVN both for cpg1.4.x as well as cpg1.5.x. The changes will go into cpg1.4.24
Logged

derangedtaco

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 46
Re: [Fixed]: Batch upload dupes?
« Reply #4 on: August 24, 2009, 02:36:38 am »

This problem does not appear to be fixed in cpg1.4.24 :-\
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: [Fixed]: Batch upload dupes?
« Reply #5 on: August 24, 2009, 01:26:31 pm »

But the code changes you suggested are in the SVN and the package as far as I can see.
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 20 queries.