Dotclear

source: admin/media_item.php @ 2106:4765c2ddc532

Revision 2106:4765c2ddc532, 20.4 KB checked in by franck <carnet.franck.paul@…>, 12 years ago (diff)

Fixes JPG details block, closes #1594

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

Sites map