6 |
kaklik |
1 |
<?php
|
|
|
2 |
/*************************
|
|
|
3 |
Coppermine Photo Gallery
|
|
|
4 |
************************
|
|
|
5 |
Copyright (c) 2003-2005 Coppermine Dev Team
|
|
|
6 |
v1.1 originaly written by Gregory DEMAR
|
|
|
7 |
|
|
|
8 |
This program is free software; you can redistribute it and/or modify
|
|
|
9 |
it under the terms of the GNU General Public License as published by
|
|
|
10 |
the Free Software Foundation; either version 2 of the License, or
|
|
|
11 |
(at your option) any later version.
|
|
|
12 |
********************************************
|
|
|
13 |
Coppermine version: 1.3.3
|
|
|
14 |
$Source: /cvsroot/coppermine/stable/zipdownload.php,v $
|
|
|
15 |
$Revision: 1.5 $
|
|
|
16 |
$Author: gaugau $
|
|
|
17 |
$Date: 2005/04/19 03:17:11 $
|
|
|
18 |
**********************************************/
|
|
|
19 |
|
|
|
20 |
define('IN_COPPERMINE', true);
|
|
|
21 |
define('THUMBNAILS_PHP', true);
|
|
|
22 |
define('INDEX_PHP', true);
|
|
|
23 |
require('include/init.inc.php');
|
|
|
24 |
include ( 'include/archive.php');
|
|
|
25 |
|
|
|
26 |
if ($CONFIG['enable_zipdownload'] != 1) {
|
|
|
27 |
//someone has entered the url manually, while the admin has disabled zipdownload
|
|
|
28 |
pageheader($lang_error);
|
|
|
29 |
starttable('-2', $lang_error);
|
|
|
30 |
print <<<EOT
|
|
|
31 |
<tr>
|
|
|
32 |
<td align="center" class="tableb">
|
|
|
33 |
{$lang_errors['perm_denied']}
|
|
|
34 |
</td>
|
|
|
35 |
</tr>
|
|
|
36 |
EOT;
|
|
|
37 |
endtable();
|
|
|
38 |
pagefooter();
|
|
|
39 |
ob_end_flush();
|
|
|
40 |
} else {
|
|
|
41 |
// zipdownload allowed, go ahead...
|
|
|
42 |
|
|
|
43 |
$filelist= array();
|
|
|
44 |
|
|
|
45 |
if (count($FAVPICS)>0){
|
|
|
46 |
$favs = implode(",",$FAVPICS);
|
|
|
47 |
|
|
|
48 |
$select_columns = 'filepath,filename';
|
|
|
49 |
|
|
|
50 |
$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES'AND pid IN ($favs)");
|
|
|
51 |
$rowset = db_fetch_rowset($result);
|
|
|
52 |
foreach ($rowset as $key => $row){
|
|
|
53 |
|
|
|
54 |
$filelist[] = $rowset[$key]['filepath'].$rowset[$key]['filename'];
|
|
|
55 |
|
|
|
56 |
}
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
$flags['storepath'] = 0;
|
|
|
60 |
// $cwd = './albums';
|
|
|
61 |
$cwd = "./{$CONFIG['fullpath']}";
|
|
|
62 |
$cwd = substr($cwd, 0, -1);
|
|
|
63 |
|
|
|
64 |
$zip = new zipfile($cwd,$flags);
|
|
|
65 |
|
|
|
66 |
$zip->addfiles($filelist);
|
|
|
67 |
|
|
|
68 |
$zip->filedownload('pictures.zip');
|
|
|
69 |
}
|
|
|
70 |
?>
|