1<?php
2/*************************
3  Coppermine Photo Gallery
4  ************************
5  Copyright (c) 2003-2016 Coppermine Dev Team
6  v1.0 originally 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 version 3
10  as published by the Free Software Foundation.
11
12  ********************************************
13  Coppermine version: 1.6.03
14  $HeadURL$
15**********************************************/
16
17define('IN_COPPERMINE', true);
18define('EDITPICS_PHP', true);
19require('include/init.inc.php');
20
21js_include('js/edit_one_pic.js');
22
23// Define the icons
24$icon_array = array(
25    'album_properties' => cpg_fetch_icon('modifyalb', 2),
26    'thumbnail_view'   => cpg_fetch_icon('thumbnails', 2),
27    'file_info'        => cpg_fetch_icon('info', 2),
28    'album'            => cpg_fetch_icon('alb_mgr', 2),
29    'move'             => cpg_fetch_icon('move', 2),
30    'title'            => cpg_fetch_icon('title', 2),
31    'file_name'        => cpg_fetch_icon('filename', 2),
32    'description'      => cpg_fetch_icon('text_left', 2),
33    'keyword'          => cpg_fetch_icon('keyword_mgr', 2),
34    'file_approval'    => cpg_fetch_icon('file_approval', 2),
35    'file_approve'     => cpg_fetch_icon('file_approve', 2),
36    'file_disapprove'  => cpg_fetch_icon('file_disapprove', 2),
37    'exif'             => cpg_fetch_icon('exif_mgr', 2),
38    'reset_views'      => cpg_fetch_icon('stats_delete', 2),
39    'reset_votes'      => cpg_fetch_icon('blank', 2),
40    'delete_comments'  => cpg_fetch_icon('comment_approval', 2),
41    'ok'               => cpg_fetch_icon('ok', 2),
42);
43
44$superCage = Inspekt::makeSuperCage();
45if ($superCage->get->keyExists('id')) {
46    $pid = $superCage->get->getInt('id');
47} elseif ($superCage->post->keyExists('id')) {
48    $pid = $superCage->post->getInt('id');
49} else {
50    $pid = -1;
51}
52
53/* --------------------------------------------------------------------------
54 * FUNCTION DEFINITIONS
55 * --------------------------------------------------------------------------*/
56
57function process_post_data()
58{
59    global $CONFIG, $USER_DATA, $lang_errors, $lang_editpics_php, $superCage;
60
61    //Check if the form token is valid
62    if(!checkFormToken()){
63        cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
64    }
65
66    $user_album_set = array();
67    $result = cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = " . (FIRST_USER_CAT + USER_ID) . " OR owner = " . USER_ID . " OR uploads = 'YES'");
68    while ($row = $result->fetchAssoc()) {
69        $user_album_set[$row['aid']] = 1;
70    }
71    $result->free();
72
73    $pid = $superCage->post->getInt('id');
74    $aid = $superCage->post->getInt('aid');
75    $pwidth = $superCage->post->getInt('pwidth');
76    $pheight = $superCage->post->getInt('pheight');
77    $title = cpgSanitizeUserTextInput($superCage->post->getEscaped('title'));
78    $caption = cpgSanitizeUserTextInput($superCage->post->getEscaped('caption'));
79    $keywords = cpgSanitizeUserTextInput(utf_replace($superCage->post->getEscaped('keywords')));
80    $user1 = cpgSanitizeUserTextInput($superCage->post->getEscaped('user1'));
81    $user2 = cpgSanitizeUserTextInput($superCage->post->getEscaped('user2'));
82    $user3 = cpgSanitizeUserTextInput($superCage->post->getEscaped('user3'));
83    $user4 = cpgSanitizeUserTextInput($superCage->post->getEscaped('user4'));
84
85    $galleryicon = $superCage->post->getInt('galleryicon');
86    $isgalleryicon = ($galleryicon == $pid);
87
88    $read_exif    = $superCage->post->keyExists('read_exif') ? $superCage->post->getInt('read_exif') : 0;
89    $reset_vcount = $superCage->post->keyExists('reset_vcount') ? $superCage->post->getInt('reset_vcount') : 0;
90    $reset_votes  = $superCage->post->keyExists('reset_votes') ? $superCage->post->getInt('reset_votes') : 0;
91    $del_comments = $superCage->post->keyExists('del_comments') ? $superCage->post->getInt('del_comments') : 0;
92
93    $result = cpg_db_query("SELECT category, owner_id, url_prefix, filepath, filename, pwidth, pheight, p.aid AS aid FROM {$CONFIG['TABLE_PICTURES']} AS p INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = p.aid WHERE pid = '$pid'");
94    if (!$result->numRows()) {
95        cpg_die(CRITICAL_ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
96    }
97    $pic = $result->fetchAssoc(true);
98
99    if (!GALLERY_ADMIN_MODE && !MODERATOR_MODE && !USER_ADMIN_MODE && !user_is_allowed() && !$CONFIG['users_can_edit_pics'] ) {
100
101        if ($pic['category'] != FIRST_USER_CAT + USER_ID) {
102            cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
103        }
104
105        if (!isset($user_album_set[$aid])) {
106            cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
107        }
108    }
109
110    if (!USER_ID
111        || !(GALLERY_ADMIN_MODE
112                || ($pic['category'] == FIRST_USER_CAT + USER_ID)
113                || ($CONFIG['users_can_edit_pics'] && $pic['owner_id'] == USER_ID)
114            )
115       ) {
116        cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
117    }
118
119    $result = cpg_db_query("SELECT category FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = '$aid'");
120    if (!$result->numRows()) {
121        cpg_die(CRITICAL_ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
122    }
123    $new_alb = $result->fetchAssoc(true);
124
125    cpg_trim_keywords($keywords);
126
127    $update  = "aid = '{$aid}'";
128
129    if (is_movie($pic['filename'])) {
130        $update .= ", pwidth = " . $pwidth;
131        $update .= ", pheight = " . $pheight;
132    }
133
134    $update .= ", title = '{$title}'";
135    $update .= ", caption = '{$caption}'";
136    $update .= ", keywords = '{$keywords}'";
137
138    if (GALLERY_ADMIN_MODE) {
139        $approved = $superCage->post->getAlpha('approved');
140        $update .= ", approved = '{$approved}'";
141    } elseif (($new_alb['category'] < FIRST_USER_CAT) && ($aid != $pic['aid'])) {
142        $approved = $USER_DATA['pub_upl_need_approval'] ? 'NO' : 'YES';
143        $update .= ", approved = '{$approved}'";
144    } elseif (($new_alb['category'] > FIRST_USER_CAT) && ($aid != $pic['aid']) && ($pic['category'] < FIRST_USER_CAT)) {
145        $approved = $USER_DATA['priv_upl_need_approval'] ? 'NO' : 'YES';
146        $update .= ", approved = '{$approved}'";
147    }
148
149    $update .= ", user1 = '{$user1}'";
150    $update .= ", user2 = '{$user2}'";
151    $update .= ", user3 = '{$user3}'";
152    $update .= ", user4 = '{$user4}'";
153
154    if ($isgalleryicon && $pic['category'] > FIRST_USER_CAT) {
155        $sql = "UPDATE {$CONFIG['TABLE_PICTURES']} SET galleryicon = 0 WHERE owner_id = {$pic['owner_id']}";
156        cpg_db_query($sql);
157        $update .= ", galleryicon = " . $galleryicon;
158    }
159
160    if ($reset_vcount) {
161        $update .= ", hits = 0";
162        resetDetailHits($pid);
163    }
164
165    if ($reset_votes) {
166        $update .= ", pic_rating = 0, votes = 0";
167        resetDetailVotes($pid);
168    }
169
170    if ($read_exif) {
171        // If "read exif info again" is checked then just delete the entry from the exif table.
172        // The new exif information will automatically be read when someone views the image.
173        $query = "DELETE FROM {$CONFIG['TABLE_EXIF']} WHERE pid = '$pid'";
174        cpg_db_query($query);
175    }
176
177    if ($del_comments) {
178        $query = "DELETE FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid = '$pid'";
179        cpg_db_query($query);
180    }
181
182    $query = "UPDATE {$CONFIG['TABLE_PICTURES']} SET $update WHERE pid='$pid' LIMIT 1";
183    cpg_db_query($query);
184
185    // Executes after a file update is committed
186    CPGPluginAPI::action('after_edit_file', $pid);
187
188    // rename a file
189    if ($superCage->post->keyExists('filename')) {
190        $post_filename = $superCage->post->getEscaped('filename');
191    }
192
193    if ($post_filename != $pic['filename']) {
194
195        if ($CONFIG['make_intermediate'] && cpg_picture_dimension_exceeds_intermediate_limit($pic['pwidth'], $pic['pheight'])) {
196            $prefixes = array('fullsize', 'normal', 'thumb');
197        } else {
198            $prefixes = array('fullsize', 'thumb');
199        }
200
201        if ($CONFIG['enable_watermark'] == '1' && ($CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original')) {
202            $prefixes[] = 'orig';
203        }
204
205        if (!is_image($pic['filename'])) {
206            $prefixes = array('fullsize');
207
208            // Check for custom thumbnails
209            $mime_content_old = cpg_get_type($pic['filename']);
210            $mime_content_new = cpg_get_type(replace_forbidden($post_filename));
211
212            $file_base_name_old = str_replace('.' . $mime_content_old['extension'], '', basename($pic['filename']));
213
214            foreach (array('.gif','.png','.jpg') as $thumb_extension) {
215                if (file_exists($CONFIG['fullpath'] . $pic['filepath'] . $CONFIG['thumb_pfx'] . $file_base_name_old . $thumb_extension)) {
216                    // Thumbnail found, check if it's the only file using that thumbnail
217                    $count = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} WHERE filepath = '{$pic['filepath']}' AND filename LIKE '{$file_base_name_old}.%'")->result(0);
218                    if ($count == 1) {
219                        $prefixes[] = 'thumb';
220                        $custom_thumb = TRUE;
221                        break;
222                    }
223                }
224            }
225        }
226
227        $pic_prefix = array(
228            'thumb'    => $CONFIG['thumb_pfx'],
229            'normal'   => $CONFIG['normal_pfx'],
230            'orig'     => $CONFIG['orig_pfx'],
231            'fullsize' => '',
232        );
233
234        $files_to_rename = array();
235
236        foreach ($prefixes as $prefix) {
237
238            $oldname = urldecode($CONFIG['fullpath'] . $pic['filepath'] . $pic_prefix[$prefix] . $pic['filename']);
239            $filename = replace_forbidden($post_filename);
240            $newname = str_replace($pic['filename'], $filename, $oldname);
241
242            if ($custom_thumb == TRUE && $prefix == 'thumb') {
243                $oldname = str_replace('.' . $mime_content_old['extension'], $thumb_extension, $oldname);
244                $newname = str_replace('.' . $mime_content_new['extension'], $thumb_extension, $newname);
245            }
246
247            $old_mime = cpg_get_type($oldname);
248            $new_mime = cpg_get_type($newname);
249
250            if (($old_mime['mime'] != $new_mime['mime']) && isset($new_mime['mime'])) {
251                cpg_die(CRITICAL_ERROR, sprintf($lang_editpics_php['mime_conv'], $old_mime['mime'], $new_mime['mime']), __FILE__, __LINE__);
252            }
253
254            if (!is_known_filetype($newname)) {
255                cpg_die(CRITICAL_ERROR, $lang_editpics_php['forb_ext'], __FILE__, __LINE__);
256            }
257
258            if (file_exists($newname)) {
259                cpg_die(CRITICAL_ERROR, sprintf($lang_editpics_php['file_exists'], $newname), __FILE__, __LINE__);
260            }
261
262            if (!file_exists($oldname)) {
263                cpg_die(CRITICAL_ERROR, sprintf($lang_editpics_php['src_file_missing'], $oldname), __FILE__, __LINE__);
264            }
265
266            // Check if there will be no conflicts before doing anything
267            $files_to_rename[] = array(
268                'oldname'   => $oldname,
269                'filename'  => $filename,
270                'newname'   => $newname
271            );
272        }
273
274        if (count($files_to_rename) > 0) {
275            foreach ($files_to_rename as $file) {
276                if (rename($file['oldname'], $file['newname'])) {
277                    cpg_db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET filename = '{$file['filename']}' WHERE pid = '$pid' LIMIT 1");
278                } else {
279                    cpg_die(CRITICAL_ERROR, sprintf($lang_editpics_php['rename_failed'], $oldname, $newname), __FILE__, __LINE__);
280                }
281            }
282        }
283    }
284} // end function process_post_data
285
286
287function form_alb_list_box()
288{
289    global $CURRENT_PIC;
290    global $lang_common, $icon_array;
291
292    $options = album_selection_options($CURRENT_PIC['aid']);
293    $icon_warning = cpg_fetch_icon('warning');
294
295    echo <<< EOT
296
297    <tr>
298        <td class="tableb" style="white-space: nowrap;" valign="top">
299            {$icon_array['album']}{$lang_common['album']}
300        </td>
301        <td class="tableb" valign="top">
302            {$icon_array['move']}
303            <select name="aid" id="album" class="listbox">
304            $options
305            </select>
306            <table id="wrapper_permissions" style="display:none; padding-top:6px;" cellspacing="0" cellpadding="0" border="0">
307                <tr>
308                    <td>$icon_warning</td>
309                    <td style="padding-left:10px;">
310                        <div id="note_permissions"></div>
311                    </td>
312                </tr>
313            </table>
314        </td>
315    </tr>
316
317EOT;
318} // end function form_alb_list_box
319
320
321/* --------------------------------------------------------------------------
322 * MAIN CODE
323 * --------------------------------------------------------------------------*/
324
325if ($superCage->post->keyExists('apply_changes')) {
326    process_post_data();
327}
328
329$result = cpg_db_query("SELECT *, p.title AS title, p.votes AS votes FROM {$CONFIG['TABLE_PICTURES']} AS p INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = p.aid WHERE pid = '$pid'");
330
331$CURRENT_PIC = $result->fetchAssoc(true);
332
333if (!(GALLERY_ADMIN_MODE || $CURRENT_PIC['category'] == FIRST_USER_CAT + USER_ID || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC['owner_id'] == USER_ID)) || !USER_ID) {
334    cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
335}
336
337$thumb_url = get_pic_url($CURRENT_PIC, 'thumb');
338$thumb_link = 'displayimage.php?pid='.$CURRENT_PIC['pid'];
339$filename = htmlspecialchars($CURRENT_PIC['filename']);
340$filepath = htmlspecialchars($CURRENT_PIC['filepath']);
341
342$THUMB_ROWSPAN = 7;
343if ($CONFIG['user_field1_name'] != '') {
344    $THUMB_ROWSPAN++;
345}
346if ($CONFIG['user_field2_name'] != '') {
347    $THUMB_ROWSPAN++;
348}
349if ($CONFIG['user_field3_name'] != '') {
350    $THUMB_ROWSPAN++;
351}
352if ($CONFIG['user_field4_name'] != '') {
353    $THUMB_ROWSPAN++;
354}
355
356$public_can_edit_pics = GALLERY_ADMIN_MODE ? 1 : $CONFIG['users_can_edit_pics'];
357set_js_var('confirm_move',          $lang_editpics_php['confirm_move']);
358set_js_var('note_approve_public',   $lang_editpics_php['note_approve_public']);
359set_js_var('note_approve_private',  $lang_editpics_php['note_approve_private']);
360set_js_var('note_edit_control',     $lang_editpics_php['note_edit_control']);
361set_js_var('public_need_approval',  $USER_DATA['pub_upl_need_approval']);
362set_js_var('private_need_approval', $USER_DATA['priv_upl_need_approval']);
363set_js_var('public_can_edit_pics',  $public_can_edit_pics);
364set_js_var('pic_currently_public',  $CURRENT_PIC['category'] < FIRST_USER_CAT ? 1 : 0);
365
366pageheader($lang_editpics_php['edit_pic']);
367
368if ($superCage->post->keyExists('apply_changes')) {
369    starttable('100%', cpg_fetch_icon('info', 2) . $lang_common['information'], 1);
370    echo <<< EOT
371    <tr>
372        <td class="tableb">
373            <ul>
374                <li style="list-style-image:url(images/icons/ok.png)">{$lang_editpics_php['success_changes']}</li>
375            </ul>
376        </td>
377    </tr>
378EOT;
379    endtable();
380}
381
382echo <<<EOT
383<form name="editonepicform" id="cpgform_editonepic" method="post" action="edit_one_pic.php">
384<input type="hidden" name="id" value="{$CURRENT_PIC['pid']}" />
385EOT;
386
387starttable("100%", cpg_fetch_icon('edit', 2) . $lang_editpics_php['edit_pic'], 3);
388
389if (!is_movie($CURRENT_PIC['filename'])) {
390    $pic_info = sprintf($lang_editpics_php['pic_info_str'], $CURRENT_PIC['pwidth'], $CURRENT_PIC['pheight'], ($CURRENT_PIC['filesize'] >> 10), $CURRENT_PIC['hits'], $CURRENT_PIC['votes']);
391} else {
392    $pic_info = sprintf($lang_editpics_php['pic_info_str'], '<input type="text" name="pwidth" value="'.$CURRENT_PIC['pwidth'].'" size="5" maxlength="5" class="textinput" />', '<input type="text" name="pheight" value="'.$CURRENT_PIC['pheight'].'" size="5" maxlength="5" class="textinput" />', ($CURRENT_PIC['filesize'] >> 10), $CURRENT_PIC['hits'], $CURRENT_PIC['votes']);
393}
394
395if (defined('UPLOAD_APPROVAL_MODE')) {
396    if ($CURRENT_PIC['owner_id']) {
397        $pic_info .= ' - <a href="profile.php?uid=' . $CURRENT_PIC['owner_id'] . '">' . $cpg_udb->get_user_name($CURRENT_PIC['owner_id']) . '</a>';
398    }
399}
400
401print <<< EOT
402
403    <tr>
404        <td class="tableh2" colspan="3">
405            <strong>{$filename}</strong>
406            &nbsp;&nbsp;-&nbsp;&nbsp;
407            <a href="modifyalb.php?album={$CURRENT_PIC['aid']}" class="admin_menu">
408                {$icon_array['album_properties']}{$lang_editpics_php['album_properties']}
409            </a>
410            &nbsp;&nbsp;-&nbsp;&nbsp;
411            <a href="thumbnails.php?album={$CURRENT_PIC['aid']}" class="admin_menu">
412                {$icon_array['thumbnail_view']}{$lang_editpics_php['thumbnail_view']}
413            </a>
414        </td>
415    </tr>
416    <tr>
417        <td class="tableb" style="white-space:nowrap;">
418            {$icon_array['file_info']}{$lang_editpics_php['pic_info']}
419        </td>
420        <td class="tableb">
421            $pic_info
422        </td>
423        <td class="tableb" align="center" rowspan="$THUMB_ROWSPAN">
424            <a href="$thumb_link">
425                <img src="$thumb_url" class="image" border="0" alt="{$CURRENT_PIC['title']}"/>
426            </a>
427            <br />
428        </td>
429    </tr>
430EOT;
431
432form_alb_list_box();
433
434if ($CONFIG['show_bbcode_help']) {
435    $captionLabel = '&nbsp;'. cpg_display_help('f=empty.html&amp;h=lang_bbcode_help_title&amp;t=lang_bbcode_help', 470, 245);
436}
437
438$keywords_insert1 = sprintf($lang_common['keywords_insert1'], $lang_common['keyword_separators'][$CONFIG['keyword_separator']]);
439
440print <<<EOT
441
442    <tr>
443        <td class="tableb" style="white-space: nowrap;">
444            {$icon_array['title']}{$lang_common['title']}
445        </td>
446        <td width="100%" class="tableb" valign="top">
447            <input type="text" style="width: 100%" name="title" maxlength="255" value="{$CURRENT_PIC['title']}" class="textinput" />
448        </td>
449    </tr>
450    <tr>
451        <td class="tableb" style="white-space: nowrap;">
452            {$icon_array['file_name']}{$lang_common['filename']}
453        </td>
454        <td width="100%" class="tableb" valign="top">
455            <tt>{$CONFIG['site_url']}{$CONFIG['fullpath']}{$filepath}</tt>
456            <input type="text" name="filename" maxlength="255" size="40" value="{$CURRENT_PIC['filename']}" class="textinput" />
457        </td>
458    </tr>
459    <tr>
460        <td class="tableb" valign="top" style="white-space: nowrap;">
461            {$icon_array['description']}{$lang_editpics_php['desc']}$captionLabel
462        </td>
463        <td class="tableb" valign="top">
464            <textarea name="caption" id="caption" rows="1" cols="60" class="elastic textinput" onkeydown="textCounter(this, {$CONFIG['max_img_desc_length']});" onkeyup="textCounter(this, {$CONFIG['max_img_desc_length']});" style="max-height:200px;">{$CURRENT_PIC['caption']}</textarea>
465        </td>
466    </tr>
467    <tr>
468        <td class="tableb" style="white-space: nowrap;">
469            {$icon_array['keyword']}{$keywords_insert1}<br />
470            <a href="keyword_select.php" class="greybox">{$lang_common['keywords_insert2']}</a>
471        </td>
472        <td width="100%" class="tableb" valign="top">
473            <input type="text" style="width: 100%" name="keywords" maxlength="255" value="{$CURRENT_PIC['keywords']}" id="keywords" class="textinput" />
474        </td>
475    </tr>
476EOT;
477
478if (GALLERY_ADMIN_MODE) {
479
480    $checkYes = ($CURRENT_PIC['approved'] == 'YES') ? 'checked="checked"' : '';
481    $checkNo = ($CURRENT_PIC['approved'] == 'NO') ? 'checked="checked"' : '';
482
483    echo <<< EOT
484
485    <tr>
486        <td class="tableb" style="white-space: nowrap;">
487            {$icon_array['file_approval']}{$lang_editpics_php['approval']}
488        </td>
489        <td width="100%" class="tableb" valign="top">
490            <input type="radio" id="approved_yes" name="approved" value="YES" $checkYes />
491            <label for="approved_yes" class="clickable_option">{$icon_array['file_approve']}{$lang_editpics_php['approved']}</label>
492            &nbsp;&nbsp;
493            <input type="radio" id="approved_no" name="approved" value="NO" $checkNo />
494            <label for="approved_no" class="clickable_option">{$icon_array['file_disapprove']}{$lang_editpics_php['unapproved']}</label>
495        </td>
496    </tr>
497EOT;
498} elseif ($CURRENT_PIC['approved'] == 'NO') {
499    echo <<< EOT
500
501    <tr>
502        <td class="tableb" style="white-space: nowrap;">
503            {$icon_array['file_approval']}{$lang_editpics_php['approval']}
504        </td>
505        <td width="100%" class="tableb" valign="top">
506            {$icon_array['file_disapprove']}{$lang_editpics_php['unapproved']}
507        </td>
508    </tr>
509EOT;
510}
511
512if ($CONFIG['user_field1_name'] != '') {
513
514    echo <<< EOT
515
516    <tr>
517        <td class="tableb" style="white-space: nowrap;">
518            {$CONFIG['user_field1_name']}
519        </td>
520        <td width="100%" class="tableb" valign="top">
521            <input type="text" style="width: 100%" name="user1" maxlength="255" value="{$CURRENT_PIC['user1']}" class="textinput" />
522        </td>
523    </tr>
524EOT;
525}
526
527if ($CONFIG['user_field2_name'] != '') {
528
529    echo <<< EOT
530
531    <tr>
532        <td class="tableb" style="white-space: nowrap;">
533            {$CONFIG['user_field2_name']}
534        </td>
535        <td width="100%" class="tableb" valign="top">
536            <input type="text" style="width: 100%" name="user2" maxlength="255" value="{$CURRENT_PIC['user2']}" class="textinput" />
537        </td>
538    </tr>
539EOT;
540}
541
542if ($CONFIG['user_field3_name'] != '') {
543
544    echo <<< EOT
545
546    <tr>
547        <td class="tableb" style="white-space: nowrap;">
548            {$CONFIG['user_field3_name']}
549        </td>
550        <td width="100%" class="tableb" valign="top">
551            <input type="text" style="width: 100%" name="user3" maxlength="255" value="{$CURRENT_PIC['user3']}" class="textinput" />
552        </td>
553    </tr>
554EOT;
555}
556
557if ($CONFIG['user_field4_name'] != '') {
558
559    echo <<< EOT
560
561    <tr>
562        <td class="tableb" style="white-space: nowrap;">
563            {$CONFIG['user_field4_name']}
564        </td>
565        <td width="100%" class="tableb" valign="top">
566            <input type="text" style="width: 100%" name="user4" maxlength="255" value="{$CURRENT_PIC['user4']}" class="textinput" />
567        </td>
568    </tr>
569EOT;
570}
571
572// If this is the users gallery icon then check it
573$isgalleryicon_selected = ($CURRENT_PIC['galleryicon']) ? 'checked="checked" ': '';
574$isgalleryicon_disabled = ($CURRENT_PIC['category'] < FIRST_USER_CAT) ? 'disabled="disabled" ':'';
575
576print <<<EOT
577
578    <tr>
579        <td class="tableb" colspan="3" align="center">
580            <table border="0" cellspacing="0" cellpadding="0" width="100%">
581                <tr>
582                    <td width="20%" align="center">
583                        <input type="checkbox" name="galleryicon" id="galleryicon" {$isgalleryicon_selected}{$isgalleryicon_disabled}value="{$CURRENT_PIC['pid']}" class="checkbox" />
584                        <label for="galleryicon">{$lang_editpics_php['gallery_icon']}</label>
585                    </td>
586                    <td width="20%" align="center">
587                        <input type="checkbox" name="read_exif" id="read_exif" value="1" class="checkbox" />
588                        <label for="read_exif">{$icon_array['exif']}{$lang_editpics_php['read_exif']}</label>
589                    </td>
590                    <td width="20%" align="center">
591                        <input type="checkbox" name="reset_vcount" id="reset_vcount" value="1" class="checkbox" />
592                        <label for="reset_vcount">{$icon_array['reset_views']}{$lang_editpics_php['reset_view_count']} ({$CURRENT_PIC['hits']})</label>
593                    </td>
594                    <td width="20%" align="center">
595                        <input type="checkbox" name="reset_votes" id="reset_votes" value="1" class="checkbox" />
596                        <label for="reset_votes">{$icon_array['reset_votes']}{$lang_editpics_php['reset_votes']} ({$CURRENT_PIC['votes']})</label>
597                    </td>
598                    <td width="20%" align="center">
599                        <input type="checkbox" name="del_comments" id="del_comments" value="1" class="checkbox" />
600                        <label for="del_comments">{$icon_array['delete_comments']}{$lang_editpics_php['del_comm']}</label>
601                    </td>
602                </tr>
603            </table>
604        </td>
605    </tr>
606    <tr>
607        <td colspan="3" align="center" class="tablef">
608            <button type="submit" class="button" name="apply_changes" value="{$lang_common['apply_changes']}">{$icon_array['ok']}{$lang_common['apply_changes']}</button>
609        </td>
610    </tr>
611
612EOT;
613
614endtable();
615list($timestamp, $form_token) = getFormToken();
616echo "<input type=\"hidden\" name=\"form_token\" value=\"{$form_token}\" />
617<input type=\"hidden\" name=\"timestamp\" value=\"{$timestamp}\" /></form>";
618
619pagefooter();
620
621//EOF