Member
Member
mrco   2007-11-08, 22:04
#1

Hi,
I am using zenphoto 1.1.1
when uploading zip file, the upload works fine but I finelly have the message :

"Fatal error: Call to undefined function unzip() in /home/www/web69/web/zenphoto/zp-core/admin.php on line 175"

any idea ?
thanks

Member
Member
sbillard   2007-11-08, 22:57
#2

I am not sure, but I have something for you to try.

at the bottom of the functions.php file you will find a line that reads:
if (!function_exists('zip_open')) { include('pclZip.php'); }

Try changing it to
if (!function_exists('zip_open')) { require('pclZip.php'); }

Your PHP apparently does not have zip support. That should have been taken care of by the line above. However, as written there would be no error if the file could not be loaded. The change will give an error. If you get the error, then somehow the pclZip.php file is missing.

Member
Member
mrco   2007-11-08, 23:19
#3

... same error message after changing functions.php
pclZip.php is present in my zp-core folder

Member
Member
sbillard   2007-11-08, 23:33
#4

OK, how about changing the line to: require('pclZip.php');?

Member
Member
mrco   2007-11-08, 23:47
#5

the error message is now :
"Fatal error: Cannot redeclare zip_open() in /home/www/web69/web/zenphoto/zp-core/pclZip.php on line 45"

Member
Member
sbillard   2007-11-08, 23:54
#6

ok, replace with
`

function unzip($file, $dir) {

$zip = zip_open($file);

if ($zip) {

 while ($zip_entry = zip_read($zip)) {

   // Skip non-images in the zip file.

   if (!is_image(zip_entry_name($zip_entry))) continue;

   if (zip_entry_open($zip, $zip_entry, "r")) {

     $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));

     $path_file = str_replace("/",DIRECTORY_SEPARATOR, $dir . '/' . zip_entry_name($zip_entry));

     $fp = fopen($path_file, "w");

     fwrite($fp, $buf);

     fclose($fp);

     zip_entry_close($zip_entry);

   }

 }

 zip_close($zip);

}

}`

Member
Member
mrco   2007-11-09, 00:18
#7

same thing :
"Fatal error: Cannot redeclare zip_open() in /home/www/web69/web/zenphoto/zp-core/pclZip.php on line 45"

... I did'nt see the difference between the original lines and those you ask me to write.

Member
Member
aitf311   2007-11-09, 00:25
#8

mrco, try this:

replace
`

if (!function_exists('zip_open')) { include('pclZip.php'); }

`

with

`

function unzip($file, $dir)

{ //check if zziplib is installed

if(function_exists('zip_open()'))

{

$zip = zip_open($file);

if ($zip) {

while ($zip_entry = zip_read($zip)) {

// Skip non-images in the zip file.

if (!is_image(zip_entry_name($zip_entry))) continue;

if (zip_entry_open($zip, $zip_entry, "r")) {

$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));

$path_file = str_replace("/",DIRECTORY_SEPARATOR, $dir . '/' . zip_entry_name($zip_entry));

$fp = fopen($path_file, "w");

fwrite($fp, $buf);

fclose($fp);

zip_entry_close($zip_entry);

}

}

zip_close($zip);

}

}else{

// Use Zlib

require_once('pclzip.php');

$zip = new PclZip($file);

if ($zip->extract(PCLZIP_OPT_PATH, $dir, PCLZIP_OPT_REMOVE_ALL_PATH) == 0) {

die("Error : ".$zip->errorInfo(true));

}

}

}

`

Member
Member
sbillard   2007-11-09, 00:26
#9

The code above should have replaced the require line. Without the require line there should be no inclusion of the pclZIP.php file.

So, you should not have the line if (!function_exists('zip_open')) { include('pclZip.php'); } (or whatever it looks like now.) You should just have the function unzip declaration above.

Member
Member
mrco   2007-11-09, 00:32
#10

ok,
now the error is :
"Fatal error: Call to undefined function zp_error() in /home/www/web69/web/zenphoto/zp-core/functions-db.php on line 31"

Member
Member
aitf311   2007-11-09, 00:34
#11

That has nothing to do with zip and the only reason why you would get that is if you do not have functions.php or you have messed with functions-db.php.

Member
Member
mrco   2007-11-09, 00:34
#12

sorry, the error is:
"Parse error: syntax error, unexpected $end in /home/www/web69/web/zenphoto/zp-core/functions.php on line 832"

Member
Member
aitf311   2007-11-09, 00:47
#13

Download pclzip.lib.php from here: http://www.phpconcept.net/download.php?file=pclzip-2-6.zip

and put the php file from the archive into your zp-core.

Then replace:
`

if (!function_exists('zip_open')) { include('pclZip.php'); }

`

with

`

function unzip($file, $dir)

{ //check if zziplib is installed

if(function_exists('zip_open()'))

{

$zip = zip_open($file);

if ($zip) {

while ($zip_entry = zip_read($zip)) {

// Skip non-images in the zip file.

if (!is_image(zip_entry_name($zip_entry))) continue;

if (zip_entry_open($zip, $zip_entry, "r")) {

$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));

$path_file = str_replace("/",DIRECTORY_SEPARATOR, $dir . '/' . zip_entry_name($zip_entry));

$fp = fopen($path_file, "w");

fwrite($fp, $buf);

fclose($fp);

zip_entry_close($zip_entry);

}

}

zip_close($zip);

}

}else{

// Use Zlib

require_once('pclzip.lib.php');

$zip = new PclZip($file);

if ($zip->extract(PCLZIP_OPT_PATH, $dir, PCLZIP_OPT_REMOVE_ALL_PATH) == 0) {

die("Error : ".$zip->errorInfo(true));

}

}

}

`

I just tried this and it works for me.

Member
Member
mrco   2007-11-09, 01:13
#14

I restarted with the original functions.php file and make the changes
I upload the pclzip.lib.php to the zp-core folder
now the error is :
"Fatal error: Cannot redeclare getoption() (previously declared in /home/www/web69/web/zenphoto/zp-core/template-functions.php:1646) in /home/www/web69/web/zenphoto/zp-core/functions.php on line 43"

what do I do wrong ?

I need some rest (it's 1 AM in France)
I talk to you tommorrow
thank you very much

Member
Member
sbillard   2007-11-09, 01:21
#15

The problem with getoption() sounds like you have mixed files from the 1.1 release with files from the 1.1.1 release. After you are rested (and can think straight again) install again the version 1.1.1 files unchanged and make sure things are working (other than the zip upload).

Then try the suggestion that aitf311 has posted.

Member
Member
aitf311   2007-11-09, 03:37
#16

The fix will be in the nightly or 1.1.2 if it is released tonight http://zenphoto.org/files/nightly

Member
Member
mrco   2007-11-09, 19:06
#17

effectively, I have the 1.1 release installed and not the 1.1.1

I follow aitf311's last post and ... everything works fine now !

again, thank you very much for your help

marc

Member
Member
aitf311   2007-11-09, 20:47
#18

thanks for the testing mrco, this fix is in 1.1.2

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.