| 1 | <?php |
|---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
|---|
| 3 | # |
|---|
| 4 | # This file is part of Dotclear 2. |
|---|
| 5 | # |
|---|
| 6 | # Copyright (c) 2003-2010 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 | |
|---|
| 13 | require dirname(__FILE__).'/../inc/admin/prepend.php'; |
|---|
| 14 | |
|---|
| 15 | dcPage::check('media,media_admin'); |
|---|
| 16 | |
|---|
| 17 | $post_id = !empty($_GET['post_id']) ? (integer) $_GET['post_id'] : null; |
|---|
| 18 | if ($post_id) { |
|---|
| 19 | $post = $core->blog->getPosts(array('post_id'=>$post_id)); |
|---|
| 20 | if ($post->isEmpty()) { |
|---|
| 21 | $post_id = null; |
|---|
| 22 | } |
|---|
| 23 | $post_title = $post->post_title; |
|---|
| 24 | unset($post); |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | $file = null; |
|---|
| 28 | $popup = (integer) !empty($_GET['popup']); |
|---|
| 29 | $page_url = 'media_item.php?popup='.$popup.'&post_id='.$post_id; |
|---|
| 30 | $media_page_url = 'media.php?popup='.$popup.'&post_id='.$post_id; |
|---|
| 31 | |
|---|
| 32 | $id = !empty($_REQUEST['id']) ? (integer) $_REQUEST['id'] : ''; |
|---|
| 33 | |
|---|
| 34 | if ($popup) { |
|---|
| 35 | $open_f = array('dcPage','openPopup'); |
|---|
| 36 | $close_f = array('dcPage','closePopup'); |
|---|
| 37 | } else { |
|---|
| 38 | $open_f = array('dcPage','open'); |
|---|
| 39 | $close_f = create_function('',"dcPage::helpBlock('core_media'); dcPage::close();"); |
|---|
| 40 | } |
|---|
| 41 | |
|---|
| 42 | $core_media_writable = false; |
|---|
| 43 | try |
|---|
| 44 | { |
|---|
| 45 | $core->media = new dcMedia($core); |
|---|
| 46 | |
|---|
| 47 | if ($id) { |
|---|
| 48 | $file = $core->media->getFile($id); |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | if ($file === null) { |
|---|
| 52 | throw new Exception(__('Not a valid file')); |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | $core->media->chdir(dirname($file->relname)); |
|---|
| 56 | $core_media_writable = $core->media->writable(); |
|---|
| 57 | |
|---|
| 58 | # Prepare directories combo box |
|---|
| 59 | $dirs_combo = array(); |
|---|
| 60 | foreach ($core->media->getRootDirs() as $v) { |
|---|
| 61 | if ($v->w) { |
|---|
| 62 | $dirs_combo['/'.$v->relname] = $v->relname; |
|---|
| 63 | } |
|---|
| 64 | } |
|---|
| 65 | ksort($dirs_combo); |
|---|
| 66 | } |
|---|
| 67 | catch (Exception $e) |
|---|
| 68 | { |
|---|
| 69 | $core->error->add($e->getMessage()); |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | # Upload a new file |
|---|
| 73 | if ($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 |
|---|
| 85 | if ($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'); |
|---|
| 106 | } catch (Exception $e) { |
|---|
| 107 | $core->error->add($e->getMessage()); |
|---|
| 108 | } |
|---|
| 109 | } |
|---|
| 110 | |
|---|
| 111 | # Update thumbnails |
|---|
| 112 | if (!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'); |
|---|
| 118 | } catch (Exception $e) { |
|---|
| 119 | $core->error->add($e->getMessage()); |
|---|
| 120 | } |
|---|
| 121 | } |
|---|
| 122 | |
|---|
| 123 | # Unzip file |
|---|
| 124 | if (!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 | # Function to get image title based on meta |
|---|
| 135 | function dcGetImageTitle($file,$pattern) |
|---|
| 136 | { |
|---|
| 137 | $res = array(); |
|---|
| 138 | $pattern = preg_split('/\s*;;\s*/',$pattern); |
|---|
| 139 | $sep = ', '; |
|---|
| 140 | |
|---|
| 141 | foreach ($pattern as $v) { |
|---|
| 142 | if ($v == 'Title') { |
|---|
| 143 | $res[] = $file->media_title; |
|---|
| 144 | } elseif ($file->media_meta->{$v}) { |
|---|
| 145 | $res[] = (string) $file->media_meta->{$v}; |
|---|
| 146 | } elseif (preg_match('/^Date\((.+?)\)$/u',$v,$m)) { |
|---|
| 147 | $res[] = dt::str($m[1],$file->media_dt); |
|---|
| 148 | } elseif (preg_match('/^DateTimeOriginal\((.+?)\)$/u',$v,$m) && $file->media_meta->DateTimeOriginal) { |
|---|
| 149 | $res[] = dt::dt2str($m[1],(string) $file->media_meta->DateTimeOriginal); |
|---|
| 150 | } elseif (preg_match('/^separator\((.*?)\)$/u',$v,$m)) { |
|---|
| 151 | $sep = $m[1]; |
|---|
| 152 | } |
|---|
| 153 | } |
|---|
| 154 | return implode($sep,$res); |
|---|
| 155 | } |
|---|
| 156 | |
|---|
| 157 | /* DISPLAY Main page |
|---|
| 158 | -------------------------------------------------------- */ |
|---|
| 159 | $starting_scripts = dcPage::jsLoad('js/_media_item.js'); |
|---|
| 160 | if ($popup) { |
|---|
| 161 | $starting_scripts .= |
|---|
| 162 | dcPage::jsLoad('js/jsToolBar/popup_media.js'); |
|---|
| 163 | } |
|---|
| 164 | call_user_func($open_f,__('Media manager'), |
|---|
| 165 | $starting_scripts. |
|---|
| 166 | dcPage::jsDatePicker(). |
|---|
| 167 | dcPage::jsPageTabs() |
|---|
| 168 | ); |
|---|
| 169 | |
|---|
| 170 | if ($file === null) { |
|---|
| 171 | call_user_func($close_f); |
|---|
| 172 | exit; |
|---|
| 173 | } |
|---|
| 174 | |
|---|
| 175 | if (!empty($_GET['fupd']) || !empty($_GET['fupl'])) { |
|---|
| 176 | echo '<p class="message">'.__('File has been successfully updated.').'</p>'; |
|---|
| 177 | } |
|---|
| 178 | if (!empty($_GET['thumbupd'])) { |
|---|
| 179 | echo '<p class="message">'.__('Thumbnails have been successfully updated.').'</p>'; |
|---|
| 180 | } |
|---|
| 181 | |
|---|
| 182 | echo '<h2><a href="'.html::escapeURL($media_page_url).'">'.__('Media manager').'</a>'. |
|---|
| 183 | ' / '.$core->media->breadCrumb(html::escapeURL($media_page_url).'&d=%s'). |
|---|
| 184 | $file->basename.'</h2>'; |
|---|
| 185 | |
|---|
| 186 | # Insertion popup |
|---|
| 187 | if ($popup) |
|---|
| 188 | { |
|---|
| 189 | $media_desc = $file->media_title; |
|---|
| 190 | |
|---|
| 191 | echo |
|---|
| 192 | '<div id="media-insert" class="multi-part" title="'.__('Insert media item').'">'. |
|---|
| 193 | '<form id="media-insert-form" action="" method="get">'; |
|---|
| 194 | |
|---|
| 195 | if ($file->media_type == 'image') |
|---|
| 196 | { |
|---|
| 197 | $media_type = 'image'; |
|---|
| 198 | $media_desc = dcGetImageTitle($file,$core->blog->settings->system->media_img_title_pattern); |
|---|
| 199 | if ($media_desc == $file->basename) { |
|---|
| 200 | $media_desc = ''; |
|---|
| 201 | } |
|---|
| 202 | |
|---|
| 203 | echo |
|---|
| 204 | '<h3>'.__('Image size:').'</h3> '; |
|---|
| 205 | |
|---|
| 206 | $s_checked = false; |
|---|
| 207 | echo '<p>'; |
|---|
| 208 | foreach (array_reverse($file->media_thumb) as $s => $v) { |
|---|
| 209 | $s_checked = ($s == 'm'); |
|---|
| 210 | echo '<label class="classic">'. |
|---|
| 211 | form::radio(array('src'),html::escapeHTML($v),$s_checked).' '. |
|---|
| 212 | $core->media->thumb_sizes[$s][2].'</label><br /> '; |
|---|
| 213 | } |
|---|
| 214 | $s_checked = (!isset($file->media_thumb['m'])); |
|---|
| 215 | echo '<label class="classic">'. |
|---|
| 216 | form::radio(array('src'),$file->file_url,$s_checked).' '.__('original').'</label><br /> '; |
|---|
| 217 | echo '</p>'; |
|---|
| 218 | |
|---|
| 219 | |
|---|
| 220 | echo '<h3>'.__('Image alignment').'</h3>'; |
|---|
| 221 | $i_align = array( |
|---|
| 222 | 'none' => array(__('None'),1), |
|---|
| 223 | 'left' => array(__('Left'),0), |
|---|
| 224 | 'right' => array(__('Right'),0), |
|---|
| 225 | 'center' => array(__('Center'),0) |
|---|
| 226 | ); |
|---|
| 227 | |
|---|
| 228 | echo '<p>'; |
|---|
| 229 | foreach ($i_align as $k => $v) { |
|---|
| 230 | echo '<label class="classic">'. |
|---|
| 231 | form::radio(array('alignment'),$k,$v[1]).' '.$v[0].'</label><br /> '; |
|---|
| 232 | } |
|---|
| 233 | echo '</p>'; |
|---|
| 234 | |
|---|
| 235 | echo |
|---|
| 236 | '<h3>'.__('Image insertion').'</h3>'. |
|---|
| 237 | '<p>'. |
|---|
| 238 | '<label for="insert1" class="classic">'.form::radio(array('insertion','insert1'),'simple',true). |
|---|
| 239 | __('As a single image').'</label><br />'. |
|---|
| 240 | '<label for="insert2" class="classic">'.form::radio(array('insertion','insert2'),'link',false). |
|---|
| 241 | __('As a link to original image').'</label>'. |
|---|
| 242 | '</p>'; |
|---|
| 243 | } |
|---|
| 244 | elseif ($file->type == 'audio/mpeg3') |
|---|
| 245 | { |
|---|
| 246 | $media_type = 'mp3'; |
|---|
| 247 | |
|---|
| 248 | echo '<h3>'.__('MP3 disposition').'</h3>'. |
|---|
| 249 | '<p class="message">'.__("Please note that you cannot insert mp3 files with visual editor.").'</p>'; |
|---|
| 250 | |
|---|
| 251 | $i_align = array( |
|---|
| 252 | 'none' => array(__('None'),0), |
|---|
| 253 | 'left' => array(__('Left'),0), |
|---|
| 254 | 'right' => array(__('Right'),0), |
|---|
| 255 | 'center' => array(__('Center'),1) |
|---|
| 256 | ); |
|---|
| 257 | |
|---|
| 258 | echo '<p>'; |
|---|
| 259 | foreach ($i_align as $k => $v) { |
|---|
| 260 | echo '<label for="alignment" class="classic">'. |
|---|
| 261 | form::radio(array('alignment'),$k,$v[1]).' '.$v[0].'</label><br /> '; |
|---|
| 262 | } |
|---|
| 263 | |
|---|
| 264 | $public_player_style = unserialize($core->blog->settings->themes->mp3player_style); |
|---|
| 265 | $public_player = dcMedia::mp3player($file->file_url,$core->blog->getQmarkURL().'pf=player_mp3.swf',$public_player_style); |
|---|
| 266 | echo form::hidden('public_player',html::escapeHTML($public_player)); |
|---|
| 267 | echo '</p>'; |
|---|
| 268 | } |
|---|
| 269 | elseif ($file->type == 'video/x-flv' || $file->type == 'video/mp4' || $file->type == 'video/x-m4v') |
|---|
| 270 | { |
|---|
| 271 | $media_type = 'flv'; |
|---|
| 272 | |
|---|
| 273 | echo |
|---|
| 274 | '<p class="message">'.__("Please note that you cannot insert video files with visual editor.").'</p>'; |
|---|
| 275 | |
|---|
| 276 | echo |
|---|
| 277 | '<h3>'.__('Video size').'</h3>'. |
|---|
| 278 | '<p><label for="video_w" class="classic">'.__('Width:').' '. |
|---|
| 279 | form::field('video_w',3,4,400).' '. |
|---|
| 280 | '<label for="video_h" class="classic">'.__('Height:').' '. |
|---|
| 281 | form::field('video_h',3,4,300). |
|---|
| 282 | '</p>'; |
|---|
| 283 | |
|---|
| 284 | echo '<h3>'.__('Video disposition').'</h3>'; |
|---|
| 285 | |
|---|
| 286 | $i_align = array( |
|---|
| 287 | 'none' => array(__('None'),0), |
|---|
| 288 | 'left' => array(__('Left'),0), |
|---|
| 289 | 'right' => array(__('Right'),0), |
|---|
| 290 | 'center' => array(__('Center'),1) |
|---|
| 291 | ); |
|---|
| 292 | |
|---|
| 293 | echo '<p>'; |
|---|
| 294 | foreach ($i_align as $k => $v) { |
|---|
| 295 | echo '<label for="alignment" class="classic">'. |
|---|
| 296 | form::radio(array('alignment'),$k,$v[1]).' '.$v[0].'</label><br /> '; |
|---|
| 297 | } |
|---|
| 298 | |
|---|
| 299 | $public_player_style = unserialize($core->blog->settings->themes->flvplayer_style); |
|---|
| 300 | $public_player = dcMedia::flvplayer($file->file_url,$core->blog->getQmarkURL().'pf=player_flv.swf',$public_player_style); |
|---|
| 301 | echo form::hidden('public_player',html::escapeHTML($public_player)); |
|---|
| 302 | echo '</p>'; |
|---|
| 303 | } |
|---|
| 304 | else |
|---|
| 305 | { |
|---|
| 306 | $media_type = 'default'; |
|---|
| 307 | echo '<p>'.__('Media item will be inserted as a link.').'</p>'; |
|---|
| 308 | } |
|---|
| 309 | |
|---|
| 310 | echo |
|---|
| 311 | '<p><a id="media-insert-cancel" class="button" href="#">'.__('Cancel').'</a> - '. |
|---|
| 312 | '<strong><a id="media-insert-ok" class="button" href="#">'.__('Insert').'</a></strong>'. |
|---|
| 313 | form::hidden(array('type'),html::escapeHTML($media_type)). |
|---|
| 314 | form::hidden(array('title'),html::escapeHTML($file->media_title)). |
|---|
| 315 | form::hidden(array('description'),html::escapeHTML($media_desc)). |
|---|
| 316 | form::hidden(array('url'),$file->file_url). |
|---|
| 317 | '</p>'; |
|---|
| 318 | |
|---|
| 319 | echo '</form></div>'; |
|---|
| 320 | } |
|---|
| 321 | |
|---|
| 322 | echo |
|---|
| 323 | '<div class="multi-part" title="'.__('Media details').'" id="media-details-tab">'. |
|---|
| 324 | '<p id="media-icon"><img src="'.$file->media_icon.'" alt="" /></p>'; |
|---|
| 325 | |
|---|
| 326 | echo |
|---|
| 327 | '<div id="media-details">'; |
|---|
| 328 | |
|---|
| 329 | if ($file->media_image) |
|---|
| 330 | { |
|---|
| 331 | $thumb_size = !empty($_GET['size']) ? $_GET['size'] : 's'; |
|---|
| 332 | |
|---|
| 333 | if (!isset($core->media->thumb_sizes[$thumb_size]) && $thumb_size != 'o') { |
|---|
| 334 | $thumb_size = 's'; |
|---|
| 335 | } |
|---|
| 336 | |
|---|
| 337 | echo '<p>'.__('Available sizes:').' '; |
|---|
| 338 | foreach (array_reverse($file->media_thumb) as $s => $v) |
|---|
| 339 | { |
|---|
| 340 | $strong_link = ($s == $thumb_size) ? '<strong>%s</strong>' : '%s'; |
|---|
| 341 | printf($strong_link,'<a href="'.html::escapeURL($page_url). |
|---|
| 342 | '&id='.$id.'&size='.$s.'">'.$core->media->thumb_sizes[$s][2].'</a> | '); |
|---|
| 343 | } |
|---|
| 344 | echo '<a href="'.html::escapeURL($page_url).'&id='.$id.'&size=o">'.__('original').'</a>'; |
|---|
| 345 | echo '</p>'; |
|---|
| 346 | |
|---|
| 347 | if (isset($file->media_thumb[$thumb_size])) { |
|---|
| 348 | echo '<p><img src="'.$file->media_thumb[$thumb_size].'" alt="" /></p>'; |
|---|
| 349 | } elseif ($thumb_size == 'o') { |
|---|
| 350 | $S = getimagesize($file->file); |
|---|
| 351 | $class = ($S[1] > 500) ? ' class="overheight"' : ''; |
|---|
| 352 | unset($S); |
|---|
| 353 | echo '<p id="media-original-image"'.$class.'><img src="'.$file->file_url.'" alt="" /></p>'; |
|---|
| 354 | } |
|---|
| 355 | } |
|---|
| 356 | |
|---|
| 357 | if ($file->type == 'audio/mpeg3') |
|---|
| 358 | { |
|---|
| 359 | echo dcMedia::mp3player($file->file_url,'index.php?pf=player_mp3.swf'); |
|---|
| 360 | } |
|---|
| 361 | |
|---|
| 362 | if ($file->type == 'video/x-flv' || $file->type == 'video/mp4' || $file->type == 'video/x-m4v') |
|---|
| 363 | { |
|---|
| 364 | echo dcMedia::flvplayer($file->file_url,'index.php?pf=player_flv.swf'); |
|---|
| 365 | } |
|---|
| 366 | |
|---|
| 367 | echo |
|---|
| 368 | '<h3>'.__('Media details').'</h3>'. |
|---|
| 369 | '<ul>'. |
|---|
| 370 | '<li><strong>'.__('File owner:').'</strong> '.$file->media_user.'</li>'. |
|---|
| 371 | '<li><strong>'.__('File type:').'</strong> '.$file->type.'</li>'. |
|---|
| 372 | '<li><strong>'.__('File size:').'</strong> '.files::size($file->size).'</li>'. |
|---|
| 373 | '<li><strong>'.__('File URL:').'</strong> <a href="'.$file->file_url.'">'.$file->file_url.'</a></li>'. |
|---|
| 374 | '</ul>'; |
|---|
| 375 | |
|---|
| 376 | if (empty($_GET['find_posts'])) |
|---|
| 377 | { |
|---|
| 378 | echo |
|---|
| 379 | '<p><strong><a href="'.html::escapeHTML($page_url).'&id='.$id.'&find_posts=1">'. |
|---|
| 380 | __('Show entries containing this media').'</a></strong></p>'; |
|---|
| 381 | } |
|---|
| 382 | else |
|---|
| 383 | { |
|---|
| 384 | echo '<h3>'.__('Entries containing this media').'</h3>'; |
|---|
| 385 | $params = array( |
|---|
| 386 | 'post_type' => '', |
|---|
| 387 | 'from' => 'LEFT OUTER JOIN '.$core->prefix.'post_media PM ON P.post_id = PM.post_id ', |
|---|
| 388 | 'sql' => 'AND ('. |
|---|
| 389 | 'PM.media_id = '.(integer) $id.' '. |
|---|
| 390 | "OR post_content_xhtml LIKE '%".$core->con->escape($file->relname)."%' ". |
|---|
| 391 | "OR post_excerpt_xhtml LIKE '%".$core->con->escape($file->relname)."%' " |
|---|
| 392 | ); |
|---|
| 393 | |
|---|
| 394 | if ($file->media_image) |
|---|
| 395 | { # We look for thumbnails too |
|---|
| 396 | $media_root = $core->blog->host.path::clean($core->blog->settings->system->public_url).'/'; |
|---|
| 397 | foreach ($file->media_thumb as $v) { |
|---|
| 398 | $v = preg_replace('/^'.preg_quote($media_root,'/').'/','',$v); |
|---|
| 399 | $params['sql'] .= "OR post_content_xhtml LIKE '%".$core->con->escape($v)."%' "; |
|---|
| 400 | $params['sql'] .= "OR post_excerpt_xhtml LIKE '%".$core->con->escape($v)."%' "; |
|---|
| 401 | } |
|---|
| 402 | } |
|---|
| 403 | |
|---|
| 404 | $params['sql'] .= ') '; |
|---|
| 405 | |
|---|
| 406 | $rs = $core->blog->getPosts($params); |
|---|
| 407 | |
|---|
| 408 | if ($rs->isEmpty()) |
|---|
| 409 | { |
|---|
| 410 | echo '<p>'.__('No entry seems contain this media.').'</p>'; |
|---|
| 411 | } |
|---|
| 412 | else |
|---|
| 413 | { |
|---|
| 414 | echo '<ul>'; |
|---|
| 415 | while ($rs->fetch()) { |
|---|
| 416 | echo '<li><a href="'.$core->getPostAdminURL($rs->post_type,$rs->post_id).'">'. |
|---|
| 417 | $rs->post_title.'</a>'. |
|---|
| 418 | ($rs->post_type != 'post' ? ' ('.html::escapeHTML($rs->post_type).')' : ''). |
|---|
| 419 | ' - '.dt::dt2str(__('%Y-%m-%d %H:%M'),$rs->post_dt).'</li>'; |
|---|
| 420 | } |
|---|
| 421 | echo '</ul>'; |
|---|
| 422 | } |
|---|
| 423 | } |
|---|
| 424 | |
|---|
| 425 | if ($file->type == 'image/jpeg') |
|---|
| 426 | { |
|---|
| 427 | echo '<h3>'.__('Image details').'</h3>'; |
|---|
| 428 | |
|---|
| 429 | if (count($file->media_meta) == 0) |
|---|
| 430 | { |
|---|
| 431 | echo '<p>'.__('No detail').'</p>'; |
|---|
| 432 | } |
|---|
| 433 | else |
|---|
| 434 | { |
|---|
| 435 | echo '<ul>'; |
|---|
| 436 | foreach ($file->media_meta as $k => $v) |
|---|
| 437 | { |
|---|
| 438 | if ((string) $v) { |
|---|
| 439 | echo '<li><strong>'.$k.':</strong> '.html::escapeHTML($v).'</li>'; |
|---|
| 440 | } |
|---|
| 441 | } |
|---|
| 442 | echo '</ul>'; |
|---|
| 443 | } |
|---|
| 444 | } |
|---|
| 445 | |
|---|
| 446 | if ($file->editable && $core_media_writable) |
|---|
| 447 | { |
|---|
| 448 | if ($file->media_type == 'image') |
|---|
| 449 | { |
|---|
| 450 | echo |
|---|
| 451 | '<form class="clear" action="'.html::escapeURL($page_url).'" method="post">'. |
|---|
| 452 | '<fieldset><legend>'.__('Update thumbnails').'</legend>'. |
|---|
| 453 | '<p>'.__('This will create or update thumbnails for this image.').'</p>'. |
|---|
| 454 | '<p><input type="submit" name="thumbs" value="'.__('update thumbnails').'" />'. |
|---|
| 455 | form::hidden(array('id'),$id). |
|---|
| 456 | $core->formNonce().'</p>'. |
|---|
| 457 | '</fieldset></form>'; |
|---|
| 458 | } |
|---|
| 459 | |
|---|
| 460 | if ($file->type == 'application/zip') |
|---|
| 461 | { |
|---|
| 462 | $inflate_combo = array( |
|---|
| 463 | __('Extract in a new directory') => 'new', |
|---|
| 464 | __('Extract in current directory') => 'current' |
|---|
| 465 | ); |
|---|
| 466 | |
|---|
| 467 | echo |
|---|
| 468 | '<form class="clear" id="file-unzip" action="'.html::escapeURL($page_url).'" method="post">'. |
|---|
| 469 | '<fieldset><legend>'.__('Extract archive').'</legend>'. |
|---|
| 470 | '<ul>'. |
|---|
| 471 | '<li><strong>'.__('Extract in a new directory').'</strong> : '. |
|---|
| 472 | __('This will extract archive in a new directory that should not exist yet.').'</li>'. |
|---|
| 473 | '<li><strong>'.__('Extract in current directory').'</strong> : '. |
|---|
| 474 | __('This will extract archive in current directory and will overwrite existing files or directory.').'</li>'. |
|---|
| 475 | '</ul>'. |
|---|
| 476 | '<p><label for="inflate_mode" class="classic">'.__('Extract mode:').' '. |
|---|
| 477 | form::combo('inflate_mode',$inflate_combo,'new').'</label> '. |
|---|
| 478 | '<input type="submit" name="unzip" value="'.__('extract').'" />'. |
|---|
| 479 | form::hidden(array('id'),$id). |
|---|
| 480 | $core->formNonce().'</p>'. |
|---|
| 481 | '</fieldset></form>'; |
|---|
| 482 | } |
|---|
| 483 | |
|---|
| 484 | echo |
|---|
| 485 | '<form class="clear" action="'.html::escapeURL($page_url).'" method="post">'. |
|---|
| 486 | '<fieldset><legend>'.__('Change media properties').'</legend>'. |
|---|
| 487 | '<p><label for="media_file">'.__('File name:'). |
|---|
| 488 | form::field('media_file',30,255,html::escapeHTML($file->basename)).'</label></p>'. |
|---|
| 489 | '<p><label for="media_title">'.__('File title:'). |
|---|
| 490 | form::field('media_title',30,255,html::escapeHTML($file->media_title)).'</label></p>'. |
|---|
| 491 | '<p><label for="media_dt">'.__('File date:'). |
|---|
| 492 | form::field('media_dt',16,16,html::escapeHTML($file->media_dtstr)).'</label></p>'. |
|---|
| 493 | '<p><label for="media_private" class="classic">'.form::checkbox('media_private',1,$file->media_priv).' '. |
|---|
| 494 | __('Private').'</label></p>'. |
|---|
| 495 | '<p><label for="media_path">'.__('New directory:'). |
|---|
| 496 | form::combo('media_path',$dirs_combo,dirname($file->relname)).'</label></p>'. |
|---|
| 497 | '<p><input type="submit" accesskey="s" value="'.__('save').'" />'. |
|---|
| 498 | form::hidden(array('id'),$id). |
|---|
| 499 | $core->formNonce().'</p>'. |
|---|
| 500 | '</fieldset></form>'; |
|---|
| 501 | |
|---|
| 502 | echo |
|---|
| 503 | '<form class="clear" action="'.html::escapeURL($page_url).'" method="post" enctype="multipart/form-data">'. |
|---|
| 504 | '<fieldset><legend>'.__('Change file').'</legend>'. |
|---|
| 505 | '<div>'.form::hidden(array('MAX_FILE_SIZE'),DC_MAX_UPLOAD_SIZE).'</div>'. |
|---|
| 506 | '<p><label for="upfile">'.__('Choose a file:'). |
|---|
| 507 | ' ('.sprintf(__('Maximum size %s'),files::size(DC_MAX_UPLOAD_SIZE)).') '. |
|---|
| 508 | '<input type="file" id="upfile" name="upfile" size="35" />'. |
|---|
| 509 | '</label></p>'. |
|---|
| 510 | '<p><input type="submit" value="'.__('send').'" />'. |
|---|
| 511 | form::hidden(array('id'),$id). |
|---|
| 512 | $core->formNonce().'</p>'. |
|---|
| 513 | '</fieldset></form>'; |
|---|
| 514 | |
|---|
| 515 | # --BEHAVIOR-- adminMediaItemForm |
|---|
| 516 | $core->callBehavior('adminMediaItemForm',$file); |
|---|
| 517 | } |
|---|
| 518 | |
|---|
| 519 | echo |
|---|
| 520 | '</div>'. |
|---|
| 521 | '</div>'; |
|---|
| 522 | |
|---|
| 523 | call_user_func($close_f); |
|---|
| 524 | ?> |
|---|