1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
|
<?php /** * provides the Upload tab of admin * @package admin */
// force UTF-8 Ø
define('OFFSET_PATH', 1);
require_once(dirname(__FILE__).'/admin-globals.php');
admin_securityChecks(UPLOAD_RIGHTS | FILES_RIGHTS, $return = currentRelativeURL());
if (isset($_GET['uploadtype'])) { $uploadtype = sanitize($_GET['uploadtype']) ; } else { $uploadtype = zp_getcookie('uploadtype'); }
$handlers = array_keys($uploadHandlers = zp_apply_filter('upload_handlers',array())); if (!zp_loggedin(UPLOAD_RIGHTS) || empty($handlers)) { // redirect to the files page if present if (isset($zenphoto_tabs['upload'])) { header('location: '.$zenphoto_tabs['upload']['link']); exit(); } $handlers = array(); }
if (count($handlers) > 0) { if (!isset($uploadHandlers[$uploadtype]) || !file_exists($uploadHandlers[$uploadtype].'/upload_form.php')) { $uploadtype = array_shift($handlers); } require_once($uploadHandlers[$uploadtype].'/upload_form.php'); zp_setCookie('uploadtype', $uploadtype); } else {
require_once(SERVERPATH.'/'.ZENFOLDER.'/no_uploader.php'); exitZP(); }
$page = "upload"; $_GET['page'] = 'upload';
printAdminHeader('upload','albums'); ?> <script type="text/javascript" src="<?php echo WEBPATH.'/'.ZENFOLDER;?>/js/upload.js"></script> <?php // load the uploader specific header stuff $formAction = upload_head();
echo "\n</head>"; echo "\n<body>"; printLogoAndLinks(); ?> <div id="main"> <?php printTabs(); ?> <div id="content"> <?php if (!empty($zenphoto_tabs['upload']['subtabs'])) { printSubtabs(); } $albumlist = array(); genAlbumList($albumlist); // remove dynamic albums--can't upload to them foreach ($albumlist as $key=>$albumname) { if(hasDynamicAlbumSuffix($key)) { unset($albumlist[$key]); } }
?> <script type="text/javascript"> // <!-- <![CDATA[ // Array of album names for javascript functions. var albumArray = new Array ( <?php $separator = ''; foreach($albumlist as $key => $value) { echo $separator . "'" . addslashes($key) . "'"; $separator = ", "; } ?> ); // ]]> --> </script>
<div class="tabbox"> <?php zp_apply_filter('admin_note','upload', 'images'); ?> <h1><?php echo gettext("Upload Images"); ?></h1> <p> <?php natcasesort($_zp_supported_images); $types = array_keys($_zp_extra_filetypes); $types = array_merge($_zp_supported_images, $types); $types[] = 'ZIP'; $types = zp_apply_filter('upload_filetypes',$types); natcasesort($types); $upload_extensions = $types; $last = strtoupper(array_pop($types)); $s1 = strtoupper(implode(', ', $types)); $used = 0;
if (count($types)>1) { printf(gettext('This web-based upload accepts the file formats: %s, and %s.'), $s1, $last); } else { printf(gettext('This web-based upload accepts the file formats: %s and %s.'), $s1, $last); } ?> </p> <p class="notebox"> <?php echo gettext('<strong>Note: </strong>'); ?> <br /> <?php if ($last == 'ZIP') { echo gettext('ZIP files must contain only Zenphoto supported <em>image</em> types.'); ?> <br /> <?php } $maxupload = ini_get('upload_max_filesize'); $maxpost = ini_get('post_max_size'); $maxuploadint = parse_size($maxupload); $maxpostint = parse_size($maxpost); if ($maxuploadint < $maxpostint) { echo sprintf(gettext("The maximum size for any one file is <strong>%sB</strong> and the maximum size for one total upload is <strong>%sB</strong> which are set by your PHP configuration <code>upload_max_filesize</code> and <code>post_max_size</code>."), $maxupload, $maxpost); } else { echo ' '.sprintf(gettext("The maximum size for your total upload is <strong>%sB</strong> which is set by your PHP configuration <code>post_max_size</code>."), $maxpost); } $uploadlimit = zp_apply_filter('get_upload_limit', $maxuploadint); $maxuploadint = min($maxuploadint, $uploadlimit); ?> <br /> <?php echo zp_apply_filter('get_upload_header_text', gettext('Don\'t forget, you can also use <acronym title="File Transfer Protocol">FTP</acronym> to upload folders of images into the albums directory!')); ?> </p> <?php if (isset($_GET['error'])) { $errormsg = sanitize($_GET['error']); ?> <div class="errorbox fade-message"> <h2><?php echo gettext("Upload Error"); ?></h2> <?php echo (empty($errormsg) ? gettext("There was an error submitting the form. Please try again.") : $errormsg); ?> </div> <?php } if (isset($_GET['uploaded'])) { ?> <div class="messagebox fade-message"> <h2><?php echo gettext("Upload complete"); ?></h2> <?php echo gettext('Your files have been uploaded.'); ?> </div> <?php } if (SAFE_MODE) { ?> <div class="warningbox fade-message"> <h2><?php echo gettext("PHP Safe Mode Restrictions in effect!"); ?></h2> <p><?php echo gettext("Zenphoto may be unable to perform uploads when PHP Safe Mode restrictions are in effect"); ?></p> </div> <?php } $rootrights = zp_apply_filter('upload_root_ui',accessAllAlbums(UPLOAD_RIGHTS)); if ($rootrights || !empty($albumlist)) { echo gettext("Upload to:"); if (isset($_GET['new'])) { $checked = ' checked="checked"'; } else { $checked = ''; } ?> <script type="text/javascript"> // <!-- <![CDATA[ <?php seoFriendlyJS(); ?> function buttonstate(good) { $('#albumtitleslot').val($('#albumtitle').val()); $('#publishalbumslot').val($('#publishalbum').prop('checked')); if (good) { $('#fileUploadbuttons').show(); } else { $('#fileUploadbuttons').hide(); } } function publishCheck() { $('#publishalbumslot').val($('#publishalbum').prop('checked')); } function albumSelect() { var sel = document.getElementById('albumselectmenu'); var selected = sel.options[sel.selectedIndex].value; $('#folderslot').val(selected); var state = albumSwitch(sel, true, '<?php echo gettext('That name is already used.'); ?>','<?php echo gettext('This upload has to have a folder. Type a title or folder name to continue...'); ?>'); buttonstate(state); } // ]]> --> </script> <div id="albumselect">
<form name="file_upload_datum" id="file_upload_datum" method="post" action="<?php echo $formAction; ?>" enctype="multipart/form-data" >
<select id="albumselectmenu" name="albumselect" onchange="albumSelect()"> <?php if ($rootrights) { ?> <option value="" selected="selected" style="font-weight: bold;">/</option> <?php } $bglevels = array('#fff','#f8f8f8','#efefef','#e8e8e8','#dfdfdf','#d8d8d8','#cfcfcf','#c8c8c8'); if (isset($_GET['album'])) { $passedalbum = sanitize($_GET['album']); } else { if ($rootrights) { $passedalbum = NULL; } else { $alist = array_keys($albumlist); $passedalbum = array_shift($alist); } } foreach ($albumlist as $fullfolder => $albumtitle) { $singlefolder = $fullfolder; $saprefix = ""; $salevel = 0; if (!is_null($passedalbum) && ($passedalbum == $fullfolder)) { $selected = " selected=\"selected\" "; } else { $selected = ""; } // Get rid of the slashes in the subalbum, while also making a subalbum prefix for the menu. while (strstr($singlefolder, '/') !== false) { $singlefolder = substr(strstr($singlefolder, '/'), 1); $saprefix = " » " . $saprefix; $salevel++; } echo '<option value="' . $fullfolder . '"' . ($salevel > 0 ? ' style="background-color: '.$bglevels[$salevel].'; border-bottom: 1px dotted #ccc;"' : '') . "$selected>" . $saprefix . $singlefolder . " (" . $albumtitle . ')' . "</option>\n"; } if (isset($_GET['publishalbum'])) { $publishchecked = ' checked="checked"'; } else { if ($albpublish = $_zp_gallery->getAlbumPublish()) { $publishchecked = ' checked="checked"'; } else { $publishchecked = ''; } } ?> </select>
<?php if (empty($passedalbum)) { $modified_rights = MANAGED_OBJECT_RIGHTS_EDIT; } else { $rightsalbum = $rightsalbum = newAlbum($passedalbum); $modified_rights = $rightsalbum->albumSubRights(); } if ($modified_rights & MANAGED_OBJECT_RIGHTS_EDIT) { // he has edit rights, allow new album creation $display = ''; } else { $display = ' display:none;'; } ?> <div id="newalbumbox" style="margin-top: 5px;<?php echo $display; ?>"> <div> <input type="checkbox" name="newalbum" id="newalbumcheckbox"<?php echo $checked; ?> onclick="albumSwitch(this.form.albumselect,false,'<?php echo gettext('That name is already used.'); ?>','<?php echo gettext('This upload has to have a folder. Type a title or folder name to continue...'); ?>')" /> <label for="newalbumcheckbox"><?php echo gettext("Make a new Album"); ?></label> </div> <div id="publishtext"><?php echo gettext("and"); ?> <input type="checkbox" name="publishalbum" id="publishalbum" value="1" <?php echo $publishchecked; ?> onchange="publishCheck();" /> <label for="publishalbum"><?php echo gettext("Publish the album so everyone can see it."); ?></label> </div> </div> <div id="albumtext" style="margin-top: 5px;<?php echo $display; ?>"> <?php echo gettext("titled:"); ?> <input type="text" name="albumtitle" id="albumtitle" size="42" onkeyup="buttonstate(updateFolder(this, 'folderdisplay', 'autogen','<?php echo gettext('That name is already used.'); ?>','<?php echo gettext('This upload has to have a folder. Type a title or folder name to continue...'); ?>'));" />
<div style="position: relative; margin-top: 4px;"> <?php echo gettext("with the folder name:"); ?> <div id="foldererror" style="display: none; color: #D66; position: absolute; z-index: 100; top: 2.5em; left: 0px;"></div> <input type="text" name="folderdisplay" disabled="disabled" id="folderdisplay" size="18" onkeyup="buttonstate(validateFolder(this,'<?php echo gettext('That name is already used.'); ?>','<?php echo gettext('This upload has to have a folder. Type a title or folder name to continue...'); ?>'));" /> <input type="checkbox" name="autogenfolder" id="autogen" checked="checked" onclick="buttonstate(toggleAutogen('folderdisplay', 'albumtitle', this));" /> <label for="autogen"><?php echo gettext("Auto-generate"); ?></label> <br /> <br /> </div> </div> <hr /> <?php upload_form($uploadlimit, $passedalbum); ?> </form> <div id="upload_action"> <?php // load the uploader specific form stuff upload_extra($uploadlimit, $passedalbum); ?> </div><!-- upload action -->
<script type="text/javascript"> //<!-- <![CDATA[ <?php echo zp_apply_filter('upload_helper_js', '')."\n"; if ($passedalbum) { ?> buttonstate(true); $('#folderdisplay').val('<?php echo html_encode($passedalbum); ?>'); <?php } ?> albumSwitch(document.getElementById('albumselectmenu'),false,'<?php echo gettext('That name is already used.'); ?>','<?php echo gettext('This upload has to have a folder. Type a title or folder name to continue...'); ?>'); <?php if (isset($_GET['folderdisplay'])) { ?> $('#folderdisplay').val('<?php echo html_encode(sanitize($_GET['folderdisplay'])); ?>'); <?php } if (isset($_GET['albumtitle'])) { ?> $('#albumtitle').val('<?php echo html_encode(sanitize($_GET['albumtitle'])); ?>'); <?php } if (isset($_GET['autogen']) && !$_GET['autogen']) { ?> $('#autogen').prop('checked',false); $('#folderdisplay').removeAttr('disabled'); if ($('#folderdisplay').val() != '') { $('#foldererror').hide(); } <?php } else { ?> $('#autogen').checked; $('#folderdisplay').attr('disabled', 'disabled'); if ($('#albumtitle').val() != '') { $('#foldererror').hide(); } <?php } ?> buttonstate($('#folderdisplay').val() != ''); // ]]> --> </script> <?php } else { echo gettext("There are no albums to which you can upload."); } ?> </div><!-- albumselect -->
</div><!-- tabbox --> </div><!-- content --> </div><!-- main --> <?php printAdminFooter(); ?> </body> </html>
|