Dotclear

source: admin/media_item.php @ 2211:dd80020754f1

Revision 2211:dd80020754f1, 20.5 KB checked in by franck <carnet.franck.paul@…>, 12 years ago (diff)

Set correct url for mediamanager root folder in breadcrumb, should fixes #1749

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

Sites map