Dotclear

source: admin/media_item.php @ 2094:5751b50ddd0a

Revision 2094:5751b50ddd0a, 20.2 KB checked in by franck <carnet.franck.paul@…>, 12 years ago (diff)

Somre refinements are coming, fixes #1336

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK -----------------------------------------
12
13require dirname(__FILE__).'/../inc/admin/prepend.php';
14
15dcPage::check('media,media_admin');
16
17$tab = empty($_REQUEST['tab']) ? '' : $_REQUEST['tab'];
18
19$post_id = !empty($_GET['post_id']) ? (integer) $_GET['post_id'] : null;
20if ($post_id) {
21     $post = $core->blog->getPosts(array('post_id'=>$post_id));
22     if ($post->isEmpty()) {
23          $post_id = null;
24     }
25     $post_title = $post->post_title;
26     unset($post);
27}
28
29$file = null;
30$popup = (integer) !empty($_GET['popup']);
31$page_url = 'media_item.php?popup='.$popup.'&post_id='.$post_id;
32$media_page_url = 'media.php?popup='.$popup.'&post_id='.$post_id;
33
34$id = !empty($_REQUEST['id']) ? (integer) $_REQUEST['id'] : '';
35
36if ($popup) {
37     $open_f = array('dcPage','openPopup');
38     $close_f = array('dcPage','closePopup');
39} else {
40     $open_f = array('dcPage','open');
41     $close_f = create_function('',"dcPage::helpBlock('core_media'); dcPage::close();");
42}
43
44$core_media_writable = false;
45try
46{
47     $core->media = new dcMedia($core);
48     
49     if ($id) {
50          $file = $core->media->getFile($id);
51     }
52     
53     if ($file === null) {
54          throw new Exception(__('Not a valid file'));
55     }
56     
57     $core->media->chdir(dirname($file->relname));
58     $core_media_writable = $core->media->writable();
59     
60     # Prepare directories combo box
61     $dirs_combo = array();
62     foreach ($core->media->getDBDirs() as $v) {
63          $dirs_combo['/'.$v] = $v;
64     }
65     ksort($dirs_combo);
66}
67catch (Exception $e)
68{
69     $core->error->add($e->getMessage());
70}
71
72# Upload a new file
73if ($file && !empty($_FILES['upfile']) && $file->editable && $core_media_writable)
74{
75     try {
76          files::uploadStatus($_FILES['upfile']);
77          $core->media->uploadFile($_FILES['upfile']['tmp_name'],$file->basename,null,false,true);
78          http::redirect($page_url.'&id='.$id.'&fupl=1');
79     } catch (Exception $e) {
80          $core->error->add($e->getMessage());
81     }
82}
83
84# Update file
85if ($file && !empty($_POST['media_file']) && $file->editable && $core_media_writable)
86{
87     $newFile = clone $file;
88     
89     $newFile->basename = $_POST['media_file'];
90     
91     if ($_POST['media_path']) {
92          $newFile->dir = $_POST['media_path'];
93          $newFile->relname = $_POST['media_path'].'/'.$newFile->basename;
94     } else {
95          $newFile->dir = '';
96          $newFile->relname = $newFile->basename;
97     }
98     $newFile->media_title = $_POST['media_title'];
99     $newFile->media_dt = strtotime($_POST['media_dt']);
100     $newFile->media_dtstr = $_POST['media_dt'];
101     $newFile->media_priv = !empty($_POST['media_private']);
102     
103     try {
104          $core->media->updateFile($file,$newFile);
105          http::redirect($page_url.'&id='.$id.'&fupd=1&tab=media-details-tab');
106     } catch (Exception $e) {
107          $core->error->add($e->getMessage());
108     }
109}
110
111# Update thumbnails
112if (!empty($_POST['thumbs']) && $file->media_type == 'image' && $file->editable && $core_media_writable)
113{
114     try {
115          $foo = null;
116          $core->media->mediaFireRecreateEvent($file);
117          http::redirect($page_url.'&id='.$id.'&thumbupd=1&tab=media-details-tab');
118     } catch (Exception $e) {
119          $core->error->add($e->getMessage());
120     }
121}
122
123# Unzip file
124if (!empty($_POST['unzip']) && $file->type == 'application/zip' && $file->editable && $core_media_writable)
125{
126     try {
127          $unzip_dir = $core->media->inflateZipFile($file,$_POST['inflate_mode'] == 'new');
128          http::redirect($media_page_url.'&d='.$unzip_dir.'&unzipok=1');
129     } catch (Exception $e) {
130          $core->error->add($e->getMessage());
131     }
132}
133
134# Save media insertion settings for the blog
135if (!empty($_POST['save_blog_prefs']))
136{
137     if (!empty($_POST['pref_src'])) {
138          foreach (array_reverse($file->media_thumb) as $s => $v) {
139               if ($v == $_POST['pref_src']) {
140                    $core->blog->settings->system->put('media_img_default_size',$s);
141                    break;
142               }
143          }
144     }
145     if (!empty($_POST['pref_alignment'])) {
146          $core->blog->settings->system->put('media_img_default_alignment',$_POST['pref_alignment']);
147     }
148     if (!empty($_POST['pref_insertion'])) {
149          $core->blog->settings->system->put('media_img_default_link',($_POST['pref_insertion'] == 'link'));
150     }
151     http::redirect($page_url.'&id='.$id.'&blogprefupd=1');
152}
153
154# Function to get image title based on meta
155function dcGetImageTitle($file,$pattern,$dto_first=false)
156{
157     $res = array();
158     $pattern = preg_split('/\s*;;\s*/',$pattern);
159     $sep = ', ';
160     
161     foreach ($pattern as $v) {
162          if ($v == 'Title') {
163               $res[] = $file->media_title;
164          } elseif ($file->media_meta->{$v}) {
165               $res[] = (string) $file->media_meta->{$v};
166          } elseif (preg_match('/^Date\((.+?)\)$/u',$v,$m)) {
167               if ($dto_first && ($file->media_meta->DateTimeOriginal != 0)) {
168                    $res[] = dt::dt2str($m[1],(string) $file->media_meta->DateTimeOriginal);
169               } else {
170                    $res[] = dt::str($m[1],$file->media_dt);
171               }
172          } elseif (preg_match('/^DateTimeOriginal\((.+?)\)$/u',$v,$m) && $file->media_meta->DateTimeOriginal) {
173               $res[] = dt::dt2str($m[1],(string) $file->media_meta->DateTimeOriginal);
174          } elseif (preg_match('/^separator\((.*?)\)$/u',$v,$m)) {
175               $sep = $m[1];
176          }
177     }
178     return implode($sep,$res);
179}
180
181/* DISPLAY Main page
182-------------------------------------------------------- */
183$starting_scripts = 
184     '<script type="text/javascript">'."\n".
185     "//<![CDATA["."\n".
186     dcPage::jsVar('dotclear.msg.confirm_delete_media',__('Are you sure to delete this media?'))."\n".
187     "//]]>".
188     "</script>".
189     dcPage::jsLoad('js/_media_item.js');
190if ($popup) {
191     $starting_scripts .=
192     dcPage::jsLoad('js/jsToolBar/popup_media.js');
193}
194call_user_func($open_f,__('Media manager'),
195     $starting_scripts.
196     dcPage::jsDatePicker().
197     ($popup ? dcPage::jsPageTabs($tab) : ''),
198     dcPage::breadcrumb(
199          array(
200               html::escapeHTML($core->blog->name) => '',
201               __('Media manager') => html::escapeURL($media_page_url),
202               $core->media->breadCrumb(html::escapeURL($media_page_url).'&amp;d=%s').'<span class="page-title">'.$file->basename.'</span>' => ''
203          ),!$popup)
204);
205
206if ($file === null) {
207     call_user_func($close_f);
208     exit;
209}
210
211if (!empty($_GET['fupd']) || !empty($_GET['fupl'])) {
212     dcPage::success(__('File has been successfully updated.'));
213}
214if (!empty($_GET['thumbupd'])) {
215     dcPage::success(__('Thumbnails have been successfully updated.'));
216}
217if (!empty($_GET['blogprefupd'])) {
218     dcPage::success(__('Default media insertion settings have been successfully updated.'));
219}
220
221# Insertion popup
222if ($popup)
223{
224     $media_desc = $file->media_title;
225     
226     echo
227     '<div id="media-insert" class="multi-part" title="'.__('Insert media item').'">'.
228     '<h3>'.__('Insert media item').'</h3>'.
229     '<form id="media-insert-form" action="" method="get">';
230     
231     $media_img_default_size = $core->blog->settings->system->media_img_default_size;
232     if ($media_img_default_size == '') {
233          $media_img_default_size = 'm';
234     }
235     $media_img_default_alignment = $core->blog->settings->system->media_img_default_alignment;
236     if ($media_img_default_alignment == '') {
237          $media_img_default_alignment = 'none';
238     }
239     $media_img_default_link = (boolean)$core->blog->settings->system->media_img_default_link;
240
241     if ($file->media_type == 'image')
242     {
243          $media_type = 'image';
244          $media_desc = dcGetImageTitle($file,
245               $core->blog->settings->system->media_img_title_pattern,
246               $core->blog->settings->system->media_img_use_dto_first);
247          if ($media_desc == $file->basename) {
248               $media_desc = '';
249          }
250
251          echo
252          '<h3>'.__('Image size:').'</h3> ';
253         
254          $s_checked = false;
255          echo '<p>';
256          foreach (array_reverse($file->media_thumb) as $s => $v) {
257               $s_checked = ($s == $media_img_default_size);
258               echo '<label class="classic">'.
259               form::radio(array('src'),html::escapeHTML($v),$s_checked).' '.
260               $core->media->thumb_sizes[$s][2].'</label><br /> ';
261          }
262          $s_checked = (!isset($file->media_thumb[$media_img_default_size]));
263          echo '<label class="classic">'.
264          form::radio(array('src'),$file->file_url,$s_checked).' '.__('original').'</label><br /> ';
265          echo '</p>';
266         
267         
268          echo '<h3>'.__('Image alignment').'</h3>';
269          $i_align = array(
270               'none' => array(__('None'),($media_img_default_alignment == 'none' ? 1 : 0)),
271               'left' => array(__('Left'),($media_img_default_alignment == 'left' ? 1 : 0)),
272               'right' => array(__('Right'),($media_img_default_alignment == 'right' ? 1 : 0)),
273               'center' => array(__('Center'),($media_img_default_alignment == 'center' ? 1 : 0))
274          );
275         
276          echo '<p>';
277          foreach ($i_align as $k => $v) {
278               echo '<label class="classic">'.
279               form::radio(array('alignment'),$k,$v[1]).' '.$v[0].'</label><br /> ';
280          }
281          echo '</p>';
282         
283          echo
284          '<h3>'.__('Image insertion').'</h3>'.
285          '<p>'.
286          '<label for="insert1" class="classic">'.form::radio(array('insertion','insert1'),'simple',!$media_img_default_link).
287          __('As a single image').'</label><br />'.
288          '<label for="insert2" class="classic">'.form::radio(array('insertion','insert2'),'link',$media_img_default_link).
289          __('As a link to the original image').'</label>'.
290          '</p>';
291     }
292     elseif ($file->type == 'audio/mpeg3')
293     {
294          $media_type = 'mp3';
295         
296          echo '<h3>'.__('MP3 disposition').'</h3>';
297          dcPage::message(__("Please note that you cannot insert mp3 files with visual editor."),false);
298         
299          $i_align = array(
300               'none' => array(__('None'),($media_img_default_alignment == 'none' ? 1 : 0)),
301               'left' => array(__('Left'),($media_img_default_alignment == 'left' ? 1 : 0)),
302               'right' => array(__('Right'),($media_img_default_alignment == 'right' ? 1 : 0)),
303               'center' => array(__('Center'),($media_img_default_alignment == 'center' ? 1 : 0))
304          );
305         
306          echo '<p>';
307          foreach ($i_align as $k => $v) {
308               echo '<label class="classic">'.
309               form::radio(array('alignment'),$k,$v[1]).' '.$v[0].'</label><br /> ';
310          }
311         
312          $public_player_style = unserialize($core->blog->settings->themes->mp3player_style);
313          $public_player = dcMedia::mp3player($file->file_url,$core->blog->getQmarkURL().'pf=player_mp3.swf',$public_player_style);
314          echo form::hidden('public_player',html::escapeHTML($public_player));
315          echo '</p>';
316     }
317     elseif ($file->type == 'video/x-flv' || $file->type == 'video/mp4' || $file->type == 'video/x-m4v')
318     {
319          $media_type = 'flv';
320         
321          dcPage::message(__("Please note that you cannot insert video files with visual editor."),false);
322         
323          echo
324          '<h3>'.__('Video size').'</h3>'.
325          '<p><label for="video_w" class="classic">'.__('Width:').'</label> '.
326          form::field('video_w',3,4,400).'  '.
327          '<label for="video_h" class="classic">'.__('Height:').'</label> '.
328          form::field('video_h',3,4,300).
329          '</p>';
330         
331          echo '<h3>'.__('Video disposition').'</h3>';
332         
333          $i_align = array(
334               'none' => array(__('None'),($media_img_default_alignment == 'none' ? 1 : 0)),
335               'left' => array(__('Left'),($media_img_default_alignment == 'left' ? 1 : 0)),
336               'right' => array(__('Right'),($media_img_default_alignment == 'right' ? 1 : 0)),
337               'center' => array(__('Center'),($media_img_default_alignment == 'center' ? 1 : 0))
338          );
339         
340          echo '<p>';
341          foreach ($i_align as $k => $v) {
342               echo '<label class="classic">'.
343               form::radio(array('alignment'),$k,$v[1]).' '.$v[0].'</label><br /> ';
344          }
345         
346          $public_player_style = unserialize($core->blog->settings->themes->flvplayer_style);
347          $public_player = dcMedia::flvplayer($file->file_url,$core->blog->getQmarkURL().'pf=player_flv.swf',$public_player_style);
348          echo form::hidden('public_player',html::escapeHTML($public_player));
349          echo '</p>';
350     }
351     else
352     {
353          $media_type = 'default';
354          echo '<p>'.__('Media item will be inserted as a link.').'</p>';
355     }
356
357     echo
358     '<p>'.
359     '<a id="media-insert-ok" class="button submit" href="#">'.__('Insert').'</a> '.
360     '<a id="media-insert-cancel" class="button" href="#">'.__('Cancel').'</a>'.
361     form::hidden(array('type'),html::escapeHTML($media_type)).
362     form::hidden(array('title'),html::escapeHTML($file->media_title)).
363     form::hidden(array('description'),html::escapeHTML($media_desc)).
364     form::hidden(array('url'),$file->file_url).
365     '</p>';
366     
367     echo '</form>';
368
369     if ($media_type != 'default') {
370          echo
371          '<div class="border-top">'.
372          '<form id="save_settings" action="'.html::escapeURL($page_url).'" method="post">'.
373          '<p>'.__('Make current settings as default').' '.
374          '<input class="reset" type="submit" name="save_blog_prefs" value="'.__('OK').'" />'.
375          form::hidden(array('pref_src'),'').
376          form::hidden(array('pref_alignment'),'').
377          form::hidden(array('pref_insertion'),'').
378          form::hidden(array('id'),$id).
379          $core->formNonce().'</p>'.
380          '</form>'.'</div>';
381     }
382
383     echo '</div>';
384}
385
386if ($popup) {
387     echo
388     '<div class="multi-part" title="'.__('Media details').'" id="media-details-tab">';
389} else {
390     echo '<h3 class="out-of-screen-if-js">'.__('Media details').'</h3>';
391}
392echo
393'<p id="media-icon"><img src="'.$file->media_icon.'?'.time()*rand().'" alt="" /></p>';
394
395echo
396'<div id="media-details">'.
397'<div class="near-icon">';
398
399if ($file->media_image)
400{
401     $thumb_size = !empty($_GET['size']) ? $_GET['size'] : 's';
402     
403     if (!isset($core->media->thumb_sizes[$thumb_size]) && $thumb_size != 'o') {
404          $thumb_size = 's';
405     }
406     
407     if (isset($file->media_thumb[$thumb_size])) {
408          echo '<p><img src="'.$file->media_thumb[$thumb_size].'?'.time()*rand().'" alt="" /></p>';
409     } elseif ($thumb_size == 'o') {
410          $S = getimagesize($file->file);
411          $class = ($S[1] > 500) ? ' class="overheight"' : '';
412          unset($S);
413          echo '<p id="media-original-image"'.$class.'><img src="'.$file->file_url.'?'.time()*rand().'" alt="" /></p>';
414     }
415     
416     echo '<p>'.__('Available sizes:').' ';
417     foreach (array_reverse($file->media_thumb) as $s => $v)
418     {
419          $strong_link = ($s == $thumb_size) ? '<strong>%s</strong>' : '%s';
420          printf($strong_link,'<a href="'.html::escapeURL($page_url).
421          '&amp;id='.$id.'&amp;size='.$s.'&amp;tab=media-details-tab">'.$core->media->thumb_sizes[$s][2].'</a> | ');
422     }
423     echo '<a href="'.html::escapeURL($page_url).'&amp;id='.$id.'&amp;size=o&amp;tab=media-details-tab">'.__('original').'</a>';
424     echo '</p>';
425}
426
427if ($file->type == 'audio/mpeg3')
428{
429     echo dcMedia::mp3player($file->file_url,'index.php?pf=player_mp3.swf');
430}
431
432if ($file->type == 'video/x-flv' || $file->type == 'video/mp4' || $file->type == 'video/x-m4v')
433{
434     echo dcMedia::flvplayer($file->file_url,'index.php?pf=player_flv.swf');
435}
436
437echo
438'<h3>'.__('Media details').'</h3>'.
439'<ul>'.
440     '<li><strong>'.__('File owner:').'</strong> '.$file->media_user.'</li>'.
441     '<li><strong>'.__('File type:').'</strong> '.$file->type.'</li>'.
442     '<li><strong>'.__('File size:').'</strong> '.files::size($file->size).'</li>'.
443     '<li><strong>'.__('File URL:').'</strong> <a href="'.$file->file_url.'">'.$file->file_url.'</a></li>'.
444'</ul>';
445
446if (empty($_GET['find_posts']))
447{
448     echo
449     '<p><a class="button" href="'.html::escapeHTML($page_url).'&amp;id='.$id.'&amp;find_posts=1&amp;tab=media-details-tab">'.
450     __('Show entries containing this media').'</a></p>';
451}
452else
453{
454     echo '<h3>'.__('Entries containing this media').'</h3>';
455     $params = array(
456          'post_type' => '',
457          'from' => 'LEFT OUTER JOIN '.$core->prefix.'post_media PM ON P.post_id = PM.post_id ',
458          'sql' => 'AND ('.
459               'PM.media_id = '.(integer) $id.' '.
460               "OR post_content_xhtml LIKE '%".$core->con->escape($file->relname)."%' ".
461               "OR post_excerpt_xhtml LIKE '%".$core->con->escape($file->relname)."%' "
462     );
463     
464     if ($file->media_image)
465     { # We look for thumbnails too
466          if (preg_match('#^http(s)?://#',$core->blog->settings->system->public_url)) {
467               $media_root = $core->blog->settings->system->public_url;
468          } else {
469               $media_root = $core->blog->host.path::clean($core->blog->settings->system->public_url).'/';
470          }
471          foreach ($file->media_thumb as $v) {
472               $v = preg_replace('/^'.preg_quote($media_root,'/').'/','',$v);
473               $params['sql'] .= "OR post_content_xhtml LIKE '%".$core->con->escape($v)."%' ";
474               $params['sql'] .= "OR post_excerpt_xhtml LIKE '%".$core->con->escape($v)."%' ";
475          }
476     }
477     
478     $params['sql'] .= ') ';
479     
480     $rs = $core->blog->getPosts($params);
481     
482     if ($rs->isEmpty())
483     {
484          echo '<p>'.__('No entry seems contain this media.').'</p>';
485     }
486     else
487     {
488          echo '<ul>';
489          while ($rs->fetch()) {
490               $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />';
491               switch ($rs->post_status) {
492                    case 1:
493                         $img_status = sprintf($img,__('published'),'check-on.png');
494                         break;
495                    case 0:
496                         $img_status = sprintf($img,__('unpublished'),'check-off.png');
497                         break;
498                    case -1:
499                         $img_status = sprintf($img,__('scheduled'),'scheduled.png');
500                         break;
501                    case -2:
502                         $img_status = sprintf($img,__('pending'),'check-wrn.png');
503                         break;
504               }
505               echo '<li>'.$img_status.' '.'<a href="'.$core->getPostAdminURL($rs->post_type,$rs->post_id).'">'.
506                    $rs->post_title.'</a>'.
507                    ($rs->post_type != 'post' ? ' ('.html::escapeHTML($rs->post_type).')' : '').
508                    ' - '.dt::dt2str(__('%Y-%m-%d %H:%M'),$rs->post_dt).'</li>';
509          }
510          echo '</ul>';
511     }
512}
513
514if ($file->type == 'image/jpeg')
515{
516     echo '<h3>'.__('Image details').'</h3>';
517     
518     if (count($file->media_meta) == 0)
519     {
520          echo '<p>'.__('No detail').'</p>';
521     }
522     else
523     {
524          echo '<ul>';
525          foreach ($file->media_meta as $k => $v)
526          {
527               if ((string) $v) {
528                    echo '<li><strong>'.$k.':</strong> '.html::escapeHTML($v).'</li>';
529               }
530          }
531          echo '</ul>';
532     }
533}
534
535echo '</div>';
536
537echo '<h3>'.__('Updates and modifications').'</h3>';
538
539if ($file->editable && $core_media_writable)
540{
541     if ($file->media_type == 'image')
542     {
543          echo
544          '<form class="clear fieldset" action="'.html::escapeURL($page_url).'" method="post">'.
545          '<h4>'.__('Update thumbnails').'</h4>'.
546          '<p>'.__('This will create or update thumbnails for this image.').'</p>'.
547          '<p><input type="submit" name="thumbs" value="'.__('Update thumbnails').'" />'.
548          form::hidden(array('id'),$id).
549          $core->formNonce().'</p>'.
550          '</form>';
551     }
552     
553     if ($file->type == 'application/zip')
554     {
555          $inflate_combo = array(
556               __('Extract in a new directory') => 'new',
557               __('Extract in current directory') => 'current'
558          );
559         
560          echo
561          '<form class="clear fieldset" id="file-unzip" action="'.html::escapeURL($page_url).'" method="post">'.
562          '<h4>'.__('Extract archive').'</h4>'.
563          '<ul>'.
564          '<li><strong>'.__('Extract in a new directory').'</strong> : '.
565          __('This will extract archive in a new directory that should not exist yet.').'</li>'.
566          '<li><strong>'.__('Extract in current directory').'</strong> : '.
567          __('This will extract archive in current directory and will overwrite existing files or directory.').'</li>'.
568          '</ul>'.
569          '<p><label for="inflate_mode" class="classic">'.__('Extract mode:').'</label> '.
570          form::combo('inflate_mode',$inflate_combo,'new').
571          '<input type="submit" name="unzip" value="'.__('Extract').'" />'.
572          form::hidden(array('id'),$id).
573          $core->formNonce().'</p>'.
574          '</form>';
575     }
576     
577     echo
578     '<form class="clear fieldset" action="'.html::escapeURL($page_url).'" method="post">'.
579     '<h4>'.__('Change media properties').'</h4>'.
580     '<p><label for="media_file">'.__('File name:').'</label>'.
581     form::field('media_file',30,255,html::escapeHTML($file->basename)).'</p>'.
582     '<p><label for="media_title">'.__('File title:').'</label>'.
583     form::field('media_title',30,255,html::escapeHTML($file->media_title)).'</p>'.
584     '<p><label for="media_dt">'.__('File date:').'</label>'.
585     form::field('media_dt',16,16,html::escapeHTML($file->media_dtstr)).'</p>'.
586     '<p><label for="media_private" class="classic">'.form::checkbox('media_private',1,$file->media_priv).' '.
587     __('Private').'</label></p>'.
588     '<p><label for="media_path">'.__('New directory:').'</label>'.
589     form::combo('media_path',$dirs_combo,dirname($file->relname)).'</p>'.
590     '<p><input type="submit" accesskey="s" value="'.__('Save').'" />'.
591     form::hidden(array('id'),$id).
592     $core->formNonce().'</p>'.
593     '</form>';
594     
595     echo
596     '<form class="clear fieldset" action="'.html::escapeURL($page_url).'" method="post" enctype="multipart/form-data">'.
597     '<h4>'.__('Change file').'</h4>'.
598     '<div>'.form::hidden(array('MAX_FILE_SIZE'),DC_MAX_UPLOAD_SIZE).'</div>'.
599     '<p><label for="upfile">'.__('Choose a file:').
600     ' ('.sprintf(__('Maximum size %s'),files::size(DC_MAX_UPLOAD_SIZE)).') '.
601     '<input type="file" id="upfile" name="upfile" size="35" />'.
602     '</label></p>'.
603     '<p><input type="submit" value="'.__('Send').'" />'.
604     form::hidden(array('id'),$id).
605     $core->formNonce().'</p>'.
606     '</form>';
607
608     if ($file->del) {
609          echo
610          '<form id="delete-form" method="post" action="'.html::escapeURL($media_page_url).
611          '&amp;d='.rawurlencode(dirname($file->relname)).
612          '&amp;remove='.rawurlencode($file->basename).'">'.
613          '<p><input name="delete" type="submit" class="delete" value="'.__('Delete this media').'" />'.
614          form::hidden('remove',rawurlencode($file->basename)).
615          form::hidden('rmyes',1).
616          $core->formNonce().'</p>'.
617          '</form>';
618     }
619
620
621     # --BEHAVIOR-- adminMediaItemForm
622     $core->callBehavior('adminMediaItemForm',$file);
623}
624
625echo
626'</div>';
627if ($popup) {
628     echo
629     '</div>';
630}
631
632call_user_func($close_f);
633?>
Note: See TracBrowser for help on using the repository browser.

Sites map