| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * @package Dotclear |
|---|
| 4 | * @subpackage Backend |
|---|
| 5 | * |
|---|
| 6 | * @copyright Olivier Meunier & Association Dotclear |
|---|
| 7 | * @copyright GPL-2.0-only |
|---|
| 8 | */ |
|---|
| 9 | |
|---|
| 10 | require dirname(__FILE__) . '/../inc/admin/prepend.php'; |
|---|
| 11 | |
|---|
| 12 | dcPage::check('media,media_admin'); |
|---|
| 13 | |
|---|
| 14 | $tab = empty($_REQUEST['tab']) ? '' : $_REQUEST['tab']; |
|---|
| 15 | |
|---|
| 16 | $post_id = !empty($_REQUEST['post_id']) ? (integer) $_REQUEST['post_id'] : null; |
|---|
| 17 | if ($post_id) { |
|---|
| 18 | $post = $core->blog->getPosts(array('post_id' => $post_id)); |
|---|
| 19 | if ($post->isEmpty()) { |
|---|
| 20 | $post_id = null; |
|---|
| 21 | } |
|---|
| 22 | $post_title = $post->post_title; |
|---|
| 23 | unset($post); |
|---|
| 24 | } |
|---|
| 25 | |
|---|
| 26 | // Attachement type if any |
|---|
| 27 | $link_type = !empty($_REQUEST['link_type']) ? $_REQUEST['link_type'] : null; |
|---|
| 28 | |
|---|
| 29 | $file = null; |
|---|
| 30 | $popup = (integer) !empty($_REQUEST['popup']); |
|---|
| 31 | $select = !empty($_REQUEST['select']) ? (integer) $_REQUEST['select'] : 0; // 0 : none, 1 : single media, >1 : multiple medias |
|---|
| 32 | $plugin_id = isset($_REQUEST['plugin_id']) ? html::sanitizeURL($_REQUEST['plugin_id']) : ''; |
|---|
| 33 | $page_url_params = array('popup' => $popup, 'select' => $select, 'post_id' => $post_id); |
|---|
| 34 | $media_page_url_params = array('popup' => $popup, 'select' => $select, 'post_id' => $post_id, 'link_type' => $link_type); |
|---|
| 35 | |
|---|
| 36 | if ($plugin_id != '') { |
|---|
| 37 | $page_url_params['plugin_id'] = $plugin_id; |
|---|
| 38 | $media_page_url_params['plugin_id'] = $plugin_id; |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | $id = !empty($_REQUEST['id']) ? (integer) $_REQUEST['id'] : ''; |
|---|
| 42 | |
|---|
| 43 | if ($id != '') { |
|---|
| 44 | $page_url_params['id'] = $id; |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | if ($popup) { |
|---|
| 48 | $open_f = array('dcPage', 'openPopup'); |
|---|
| 49 | $close_f = array('dcPage', 'closePopup'); |
|---|
| 50 | } else { |
|---|
| 51 | $open_f = array('dcPage', 'open'); |
|---|
| 52 | $close_f = function () { |
|---|
| 53 | dcPage::helpBlock('core_media'); |
|---|
| 54 | dcPage::close(); |
|---|
| 55 | }; |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | $core_media_writable = false; |
|---|
| 59 | try |
|---|
| 60 | { |
|---|
| 61 | $core->media = new dcMedia($core); |
|---|
| 62 | |
|---|
| 63 | if ($id) { |
|---|
| 64 | $file = $core->media->getFile($id); |
|---|
| 65 | } |
|---|
| 66 | |
|---|
| 67 | if ($file === null) { |
|---|
| 68 | throw new Exception(__('Not a valid file')); |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| 71 | $core->media->chdir(dirname($file->relname)); |
|---|
| 72 | $core_media_writable = $core->media->writable(); |
|---|
| 73 | |
|---|
| 74 | # Prepare directories combo box |
|---|
| 75 | $dirs_combo = array(); |
|---|
| 76 | foreach ($core->media->getDBDirs() as $v) { |
|---|
| 77 | $dirs_combo['/' . $v] = $v; |
|---|
| 78 | } |
|---|
| 79 | # Add parent and direct childs directories if any |
|---|
| 80 | $core->media->getFSDir(); |
|---|
| 81 | foreach ($core->media->dir['dirs'] as $k => $v) { |
|---|
| 82 | $dirs_combo['/' . $v->relname] = $v->relname; |
|---|
| 83 | } |
|---|
| 84 | ksort($dirs_combo); |
|---|
| 85 | } catch (Exception $e) { |
|---|
| 86 | $core->error->add($e->getMessage()); |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | # Upload a new file |
|---|
| 90 | if ($file && !empty($_FILES['upfile']) && $file->editable && $core_media_writable) { |
|---|
| 91 | try { |
|---|
| 92 | files::uploadStatus($_FILES['upfile']); |
|---|
| 93 | $core->media->uploadFile($_FILES['upfile']['tmp_name'], $file->basename, null, false, true); |
|---|
| 94 | |
|---|
| 95 | dcPage::addSuccessNotice(__('File has been successfully updated.')); |
|---|
| 96 | $core->adminurl->redirect('admin.media.item', $page_url_params); |
|---|
| 97 | } catch (Exception $e) { |
|---|
| 98 | $core->error->add($e->getMessage()); |
|---|
| 99 | } |
|---|
| 100 | } |
|---|
| 101 | |
|---|
| 102 | # Update file |
|---|
| 103 | if ($file && !empty($_POST['media_file']) && $file->editable && $core_media_writable) { |
|---|
| 104 | $newFile = clone $file; |
|---|
| 105 | |
|---|
| 106 | $newFile->basename = $_POST['media_file']; |
|---|
| 107 | |
|---|
| 108 | if ($_POST['media_path']) { |
|---|
| 109 | $newFile->dir = $_POST['media_path']; |
|---|
| 110 | $newFile->relname = $_POST['media_path'] . '/' . $newFile->basename; |
|---|
| 111 | } else { |
|---|
| 112 | $newFile->dir = ''; |
|---|
| 113 | $newFile->relname = $newFile->basename; |
|---|
| 114 | } |
|---|
| 115 | $newFile->media_title = html::escapeHTML($_POST['media_title']); |
|---|
| 116 | $newFile->media_dt = strtotime($_POST['media_dt']); |
|---|
| 117 | $newFile->media_dtstr = $_POST['media_dt']; |
|---|
| 118 | $newFile->media_priv = !empty($_POST['media_private']); |
|---|
| 119 | |
|---|
| 120 | try { |
|---|
| 121 | $core->media->updateFile($file, $newFile); |
|---|
| 122 | |
|---|
| 123 | dcPage::addSuccessNotice(__('File has been successfully updated.')); |
|---|
| 124 | $page_url_params['tab'] = 'media-details-tab'; |
|---|
| 125 | $core->adminurl->redirect('admin.media.item', $page_url_params); |
|---|
| 126 | } catch (Exception $e) { |
|---|
| 127 | $core->error->add($e->getMessage()); |
|---|
| 128 | } |
|---|
| 129 | } |
|---|
| 130 | |
|---|
| 131 | # Update thumbnails |
|---|
| 132 | if (!empty($_POST['thumbs']) && $file->media_type == 'image' && $file->editable && $core_media_writable) { |
|---|
| 133 | try { |
|---|
| 134 | $foo = null; |
|---|
| 135 | $core->media->mediaFireRecreateEvent($file); |
|---|
| 136 | |
|---|
| 137 | dcPage::addSuccessNotice(__('Thumbnails have been successfully updated.')); |
|---|
| 138 | $page_url_params['tab'] = 'media-details-tab'; |
|---|
| 139 | $core->adminurl->redirect('admin.media.item', $page_url_params); |
|---|
| 140 | } catch (Exception $e) { |
|---|
| 141 | $core->error->add($e->getMessage()); |
|---|
| 142 | } |
|---|
| 143 | } |
|---|
| 144 | |
|---|
| 145 | # Unzip file |
|---|
| 146 | if (!empty($_POST['unzip']) && $file->type == 'application/zip' && $file->editable && $core_media_writable) { |
|---|
| 147 | try { |
|---|
| 148 | $unzip_dir = $core->media->inflateZipFile($file, $_POST['inflate_mode'] == 'new'); |
|---|
| 149 | |
|---|
| 150 | dcPage::addSuccessNotice(__('Zip file has been successfully extracted.')); |
|---|
| 151 | $media_page_url_params['d'] = $unzip_dir; |
|---|
| 152 | $core->adminurl->redirect('admin.media', $media_page_url_params); |
|---|
| 153 | } catch (Exception $e) { |
|---|
| 154 | $core->error->add($e->getMessage()); |
|---|
| 155 | } |
|---|
| 156 | } |
|---|
| 157 | |
|---|
| 158 | # Save media insertion settings for the blog |
|---|
| 159 | if (!empty($_POST['save_blog_prefs'])) { |
|---|
| 160 | if (!empty($_POST['pref_src'])) { |
|---|
| 161 | foreach (array_reverse($file->media_thumb) as $s => $v) { |
|---|
| 162 | if ($v == $_POST['pref_src']) { |
|---|
| 163 | $core->blog->settings->system->put('media_img_default_size', $s); |
|---|
| 164 | break; |
|---|
| 165 | } |
|---|
| 166 | } |
|---|
| 167 | } |
|---|
| 168 | if (!empty($_POST['pref_alignment'])) { |
|---|
| 169 | $core->blog->settings->system->put('media_img_default_alignment', $_POST['pref_alignment']); |
|---|
| 170 | } |
|---|
| 171 | if (!empty($_POST['pref_insertion'])) { |
|---|
| 172 | $core->blog->settings->system->put('media_img_default_link', ($_POST['pref_insertion'] == 'link')); |
|---|
| 173 | } |
|---|
| 174 | if (!empty($_POST['pref_legend'])) { |
|---|
| 175 | $core->blog->settings->system->put('media_img_default_legend', $_POST['pref_legend']); |
|---|
| 176 | } |
|---|
| 177 | |
|---|
| 178 | dcPage::addSuccessNotice(__('Default media insertion settings have been successfully updated.')); |
|---|
| 179 | $core->adminurl->redirect('admin.media.item', $page_url_params); |
|---|
| 180 | } |
|---|
| 181 | |
|---|
| 182 | # Function to get image title based on meta |
|---|
| 183 | $get_img_title = function ($file, $pattern, $dto_first = false, $no_date_alone = false) { |
|---|
| 184 | $res = array(); |
|---|
| 185 | $pattern = preg_split('/\s*;;\s*/', $pattern); |
|---|
| 186 | $sep = ', '; |
|---|
| 187 | $dates = 0; |
|---|
| 188 | $items = 0; |
|---|
| 189 | |
|---|
| 190 | foreach ($pattern as $v) { |
|---|
| 191 | if ($v == 'Title') { |
|---|
| 192 | if ($file->media_title != '') { |
|---|
| 193 | $res[] = $file->media_title; |
|---|
| 194 | } |
|---|
| 195 | $items++; |
|---|
| 196 | } elseif ($file->media_meta->{$v}) { |
|---|
| 197 | if ((string) $file->media_meta->{$v} != '') { |
|---|
| 198 | $res[] = (string) $file->media_meta->{$v}; |
|---|
| 199 | } |
|---|
| 200 | $items++; |
|---|
| 201 | } elseif (preg_match('/^Date\((.+?)\)$/u', $v, $m)) { |
|---|
| 202 | if ($dto_first && ($file->media_meta->DateTimeOriginal != 0)) { |
|---|
| 203 | $res[] = dt::dt2str($m[1], (string) $file->media_meta->DateTimeOriginal); |
|---|
| 204 | } else { |
|---|
| 205 | $res[] = dt::str($m[1], $file->media_dt); |
|---|
| 206 | } |
|---|
| 207 | $items++; |
|---|
| 208 | $dates++; |
|---|
| 209 | } elseif (preg_match('/^DateTimeOriginal\((.+?)\)$/u', $v, $m) && $file->media_meta->DateTimeOriginal) { |
|---|
| 210 | $res[] = dt::dt2str($m[1], (string) $file->media_meta->DateTimeOriginal); |
|---|
| 211 | $items++; |
|---|
| 212 | $dates++; |
|---|
| 213 | } elseif (preg_match('/^separator\((.*?)\)$/u', $v, $m)) { |
|---|
| 214 | $sep = $m[1]; |
|---|
| 215 | } |
|---|
| 216 | } |
|---|
| 217 | if ($no_date_alone && $dates == count($res) && $dates < $items) { |
|---|
| 218 | // On ne laisse pas les dates seules, sauf si ce sont les seuls items du pattern (hors séparateur) |
|---|
| 219 | return ''; |
|---|
| 220 | } |
|---|
| 221 | return implode($sep, $res); |
|---|
| 222 | }; |
|---|
| 223 | |
|---|
| 224 | /* DISPLAY Main page |
|---|
| 225 | -------------------------------------------------------- */ |
|---|
| 226 | $starting_scripts = |
|---|
| 227 | '<script type="text/javascript">' . "\n" . |
|---|
| 228 | dcPage::jsVar('dotclear.msg.confirm_delete_media', __('Are you sure to delete this media?')) . "\n" . |
|---|
| 229 | "</script>" . |
|---|
| 230 | dcPage::jsModal() . |
|---|
| 231 | dcPage::jsLoad('js/_media_item.js'); |
|---|
| 232 | if ($popup && !empty($plugin_id)) { |
|---|
| 233 | $starting_scripts .= $core->callBehavior('adminPopupMedia', $plugin_id); |
|---|
| 234 | } |
|---|
| 235 | $temp_params = $media_page_url_params; |
|---|
| 236 | $temp_params['d'] = '%s'; |
|---|
| 237 | $breadcrumb = $core->media->breadCrumb($core->adminurl->get('admin.media', $temp_params, '&', true)) . |
|---|
| 238 | ($file === null ? '' : '<span class="page-title">' . $file->basename . '</span>'); |
|---|
| 239 | $temp_params['d'] = ''; |
|---|
| 240 | $home_url = $core->adminurl->get('admin.media', $temp_params); |
|---|
| 241 | call_user_func($open_f, __('Media manager'), |
|---|
| 242 | $starting_scripts . |
|---|
| 243 | dcPage::jsDatePicker() . |
|---|
| 244 | ($popup ? dcPage::jsPageTabs($tab) : ''), |
|---|
| 245 | dcPage::breadcrumb( |
|---|
| 246 | array( |
|---|
| 247 | html::escapeHTML($core->blog->name) => '', |
|---|
| 248 | __('Media manager') => $home_url, |
|---|
| 249 | $breadcrumb => '' |
|---|
| 250 | ), |
|---|
| 251 | array( |
|---|
| 252 | 'home_link' => !$popup, |
|---|
| 253 | 'hl' => false |
|---|
| 254 | ) |
|---|
| 255 | ) |
|---|
| 256 | ); |
|---|
| 257 | |
|---|
| 258 | if ($popup) { |
|---|
| 259 | // Display notices |
|---|
| 260 | echo dcPage::notices(); |
|---|
| 261 | } |
|---|
| 262 | |
|---|
| 263 | if ($file === null) { |
|---|
| 264 | call_user_func($close_f); |
|---|
| 265 | exit; |
|---|
| 266 | } |
|---|
| 267 | |
|---|
| 268 | if (!empty($_GET['fupd']) || !empty($_GET['fupl'])) { |
|---|
| 269 | dcPage::success(__('File has been successfully updated.')); |
|---|
| 270 | } |
|---|
| 271 | if (!empty($_GET['thumbupd'])) { |
|---|
| 272 | dcPage::success(__('Thumbnails have been successfully updated.')); |
|---|
| 273 | } |
|---|
| 274 | if (!empty($_GET['blogprefupd'])) { |
|---|
| 275 | dcPage::success(__('Default media insertion settings have been successfully updated.')); |
|---|
| 276 | } |
|---|
| 277 | |
|---|
| 278 | # Get major file type (first part of mime type) |
|---|
| 279 | $file_type = explode('/', $file->type); |
|---|
| 280 | |
|---|
| 281 | # Selection mode |
|---|
| 282 | if ($select) { |
|---|
| 283 | // Let user choose thumbnail size if image |
|---|
| 284 | $media_desc = $file->media_title; |
|---|
| 285 | |
|---|
| 286 | echo |
|---|
| 287 | '<div id="media-select" class="multi-part" title="' . __('Select media item') . '">' . |
|---|
| 288 | '<h3>' . __('Select media item') . '</h3>' . |
|---|
| 289 | '<form id="media-select-form" action="" method="get">'; |
|---|
| 290 | |
|---|
| 291 | $media_img_default_size = $core->blog->settings->system->media_img_default_size; |
|---|
| 292 | if ($media_img_default_size == '') { |
|---|
| 293 | $media_img_default_size = 'm'; |
|---|
| 294 | } |
|---|
| 295 | $media_img_default_alignment = $core->blog->settings->system->media_img_default_alignment; |
|---|
| 296 | if ($media_img_default_alignment == '') { |
|---|
| 297 | $media_img_default_alignment = 'none'; |
|---|
| 298 | } |
|---|
| 299 | $media_img_default_link = (boolean) $core->blog->settings->system->media_img_default_link; |
|---|
| 300 | $media_img_default_legend = $core->blog->settings->system->media_img_default_legend; |
|---|
| 301 | if ($media_img_default_legend == '') { |
|---|
| 302 | $media_img_default_legend = 'legend'; |
|---|
| 303 | } |
|---|
| 304 | |
|---|
| 305 | if ($file->media_type == 'image') { |
|---|
| 306 | $media_type = 'image'; |
|---|
| 307 | $media_desc = $get_img_title($file, |
|---|
| 308 | $core->blog->settings->system->media_img_title_pattern, |
|---|
| 309 | $core->blog->settings->system->media_img_use_dto_first, |
|---|
| 310 | $core->blog->settings->system->media_img_no_date_alone); |
|---|
| 311 | if ($media_desc == $file->basename) { |
|---|
| 312 | $media_desc = ''; |
|---|
| 313 | } |
|---|
| 314 | |
|---|
| 315 | echo |
|---|
| 316 | '<h3>' . __('Image size:') . '</h3> '; |
|---|
| 317 | |
|---|
| 318 | $s_checked = false; |
|---|
| 319 | echo '<p>'; |
|---|
| 320 | foreach (array_reverse($file->media_thumb) as $s => $v) { |
|---|
| 321 | $s_checked = ($s == $media_img_default_size); |
|---|
| 322 | echo '<label class="classic">' . |
|---|
| 323 | form::radio(array('src'), html::escapeHTML($v), $s_checked) . ' ' . |
|---|
| 324 | $core->media->thumb_sizes[$s][2] . '</label><br /> '; |
|---|
| 325 | } |
|---|
| 326 | $s_checked = (!isset($file->media_thumb[$media_img_default_size])); |
|---|
| 327 | echo '<label class="classic">' . |
|---|
| 328 | form::radio(array('src'), $file->file_url, $s_checked) . ' ' . __('original') . '</label><br /> '; |
|---|
| 329 | echo '</p>'; |
|---|
| 330 | |
|---|
| 331 | } elseif ($file_type[0] == 'audio') { |
|---|
| 332 | $media_type = 'mp3'; |
|---|
| 333 | } elseif ($file_type[0] == 'video') { |
|---|
| 334 | $media_type = 'flv'; |
|---|
| 335 | } else { |
|---|
| 336 | $media_type = 'default'; |
|---|
| 337 | } |
|---|
| 338 | |
|---|
| 339 | echo |
|---|
| 340 | '<p>' . |
|---|
| 341 | '<button type="button" id="media-select-ok" class="submit">' . __('Select') . '</button> ' . |
|---|
| 342 | '<button type="button" id="media-select-cancel">' . __('Cancel') . '</button>' . |
|---|
| 343 | form::hidden(array('type'), html::escapeHTML($media_type)) . |
|---|
| 344 | form::hidden(array('title'), html::escapeHTML($file->media_title)) . |
|---|
| 345 | form::hidden(array('description'), html::escapeHTML($media_desc)) . |
|---|
| 346 | form::hidden(array('url'), $file->file_url) . |
|---|
| 347 | '</p>'; |
|---|
| 348 | |
|---|
| 349 | echo '</form>'; |
|---|
| 350 | echo '</div>'; |
|---|
| 351 | } |
|---|
| 352 | |
|---|
| 353 | # Insertion popup |
|---|
| 354 | if ($popup && !$select) { |
|---|
| 355 | $media_desc = $file->media_title; |
|---|
| 356 | |
|---|
| 357 | echo |
|---|
| 358 | '<div id="media-insert" class="multi-part" title="' . __('Insert media item') . '">' . |
|---|
| 359 | '<h3>' . __('Insert media item') . '</h3>' . |
|---|
| 360 | '<form id="media-insert-form" action="" method="get">'; |
|---|
| 361 | |
|---|
| 362 | $media_img_default_size = $core->blog->settings->system->media_img_default_size; |
|---|
| 363 | if ($media_img_default_size == '') { |
|---|
| 364 | $media_img_default_size = 'm'; |
|---|
| 365 | } |
|---|
| 366 | $media_img_default_alignment = $core->blog->settings->system->media_img_default_alignment; |
|---|
| 367 | if ($media_img_default_alignment == '') { |
|---|
| 368 | $media_img_default_alignment = 'none'; |
|---|
| 369 | } |
|---|
| 370 | $media_img_default_link = (boolean) $core->blog->settings->system->media_img_default_link; |
|---|
| 371 | $media_img_default_legend = $core->blog->settings->system->media_img_default_legend; |
|---|
| 372 | if ($media_img_default_legend == '') { |
|---|
| 373 | $media_img_default_legend = 'legend'; |
|---|
| 374 | } |
|---|
| 375 | |
|---|
| 376 | if ($file->media_type == 'image') { |
|---|
| 377 | $media_type = 'image'; |
|---|
| 378 | $media_desc = $get_img_title($file, |
|---|
| 379 | $core->blog->settings->system->media_img_title_pattern, |
|---|
| 380 | $core->blog->settings->system->media_img_use_dto_first, |
|---|
| 381 | $core->blog->settings->system->media_img_no_date_alone); |
|---|
| 382 | if ($media_desc == $file->basename) { |
|---|
| 383 | $media_desc = ''; |
|---|
| 384 | } |
|---|
| 385 | |
|---|
| 386 | echo |
|---|
| 387 | '<div class="two-boxes">' . |
|---|
| 388 | '<h3>' . __('Image size:') . '</h3> '; |
|---|
| 389 | $s_checked = false; |
|---|
| 390 | echo '<p>'; |
|---|
| 391 | foreach (array_reverse($file->media_thumb) as $s => $v) { |
|---|
| 392 | $s_checked = ($s == $media_img_default_size); |
|---|
| 393 | echo '<label class="classic">' . |
|---|
| 394 | form::radio(array('src'), html::escapeHTML($v), $s_checked) . ' ' . |
|---|
| 395 | $core->media->thumb_sizes[$s][2] . '</label><br /> '; |
|---|
| 396 | } |
|---|
| 397 | $s_checked = (!isset($file->media_thumb[$media_img_default_size])); |
|---|
| 398 | echo '<label class="classic">' . |
|---|
| 399 | form::radio(array('src'), $file->file_url, $s_checked) . ' ' . __('original') . '</label><br /> '; |
|---|
| 400 | echo '</p>'; |
|---|
| 401 | echo '</div>'; |
|---|
| 402 | |
|---|
| 403 | echo |
|---|
| 404 | '<div class="two-boxes">' . |
|---|
| 405 | '<h3>' . __('Image legend and title') . '</h3>' . |
|---|
| 406 | '<p>' . |
|---|
| 407 | '<label for="legend1" class="classic">' . form::radio(array('legend', 'legend1'), 'legend', |
|---|
| 408 | ($media_img_default_legend == 'legend')) . |
|---|
| 409 | __('Legend and title') . '</label><br />' . |
|---|
| 410 | '<label for="legend2" class="classic">' . form::radio(array('legend', 'legend2'), 'title', |
|---|
| 411 | ($media_img_default_legend == 'title')) . |
|---|
| 412 | __('Title') . '</label><br />' . |
|---|
| 413 | '<label for="legend3" class="classic">' . form::radio(array('legend', 'legend3'), 'none', |
|---|
| 414 | ($media_img_default_legend == 'none')) . |
|---|
| 415 | __('None') . '</label>' . |
|---|
| 416 | '</p>' . |
|---|
| 417 | '</div>'; |
|---|
| 418 | |
|---|
| 419 | echo |
|---|
| 420 | '<div class="two-boxes">' . |
|---|
| 421 | '<h3>' . __('Image alignment') . '</h3>'; |
|---|
| 422 | $i_align = array( |
|---|
| 423 | 'none' => array(__('None'), ($media_img_default_alignment == 'none' ? 1 : 0)), |
|---|
| 424 | 'left' => array(__('Left'), ($media_img_default_alignment == 'left' ? 1 : 0)), |
|---|
| 425 | 'right' => array(__('Right'), ($media_img_default_alignment == 'right' ? 1 : 0)), |
|---|
| 426 | 'center' => array(__('Center'), ($media_img_default_alignment == 'center' ? 1 : 0)) |
|---|
| 427 | ); |
|---|
| 428 | |
|---|
| 429 | echo '<p>'; |
|---|
| 430 | foreach ($i_align as $k => $v) { |
|---|
| 431 | echo '<label class="classic">' . |
|---|
| 432 | form::radio(array('alignment'), $k, $v[1]) . ' ' . $v[0] . '</label><br /> '; |
|---|
| 433 | } |
|---|
| 434 | echo '</p>'; |
|---|
| 435 | echo '</div>'; |
|---|
| 436 | |
|---|
| 437 | echo |
|---|
| 438 | '<div class="two-boxes">' . |
|---|
| 439 | '<h3>' . __('Image insertion') . '</h3>' . |
|---|
| 440 | '<p>' . |
|---|
| 441 | '<label for="insert1" class="classic">' . form::radio(array('insertion', 'insert1'), 'simple', !$media_img_default_link) . |
|---|
| 442 | __('As a single image') . '</label><br />' . |
|---|
| 443 | '<label for="insert2" class="classic">' . form::radio(array('insertion', 'insert2'), 'link', $media_img_default_link) . |
|---|
| 444 | __('As a link to the original image') . '</label>' . |
|---|
| 445 | '</p>' . |
|---|
| 446 | '</div>'; |
|---|
| 447 | } elseif ($file_type[0] == 'audio') { |
|---|
| 448 | $media_type = 'mp3'; |
|---|
| 449 | |
|---|
| 450 | echo |
|---|
| 451 | '<div class="two-boxes">' . |
|---|
| 452 | '<h3>' . __('MP3 disposition') . '</h3>'; |
|---|
| 453 | dcPage::message(__("Please note that you cannot insert mp3 files with visual editor."), false); |
|---|
| 454 | |
|---|
| 455 | $i_align = array( |
|---|
| 456 | 'none' => array(__('None'), ($media_img_default_alignment == 'none' ? 1 : 0)), |
|---|
| 457 | 'left' => array(__('Left'), ($media_img_default_alignment == 'left' ? 1 : 0)), |
|---|
| 458 | 'right' => array(__('Right'), ($media_img_default_alignment == 'right' ? 1 : 0)), |
|---|
| 459 | 'center' => array(__('Center'), ($media_img_default_alignment == 'center' ? 1 : 0)) |
|---|
| 460 | ); |
|---|
| 461 | |
|---|
| 462 | echo '<p>'; |
|---|
| 463 | foreach ($i_align as $k => $v) { |
|---|
| 464 | echo '<label class="classic">' . |
|---|
| 465 | form::radio(array('alignment'), $k, $v[1]) . ' ' . $v[0] . '</label><br /> '; |
|---|
| 466 | } |
|---|
| 467 | |
|---|
| 468 | $public_player_style = unserialize($core->blog->settings->themes->mp3player_style); |
|---|
| 469 | $public_player = dcMedia::audioPlayer($file->type, $file->file_url, $core->blog->getQmarkURL() . 'pf=player_mp3.swf', $public_player_style, $core->blog->settings->system->media_flash_fallback); |
|---|
| 470 | echo form::hidden('public_player', html::escapeHTML($public_player)); |
|---|
| 471 | echo '</p>'; |
|---|
| 472 | echo '</div>'; |
|---|
| 473 | } elseif ($file_type[0] == 'video') { |
|---|
| 474 | $media_type = 'flv'; |
|---|
| 475 | |
|---|
| 476 | dcPage::message(__("Please note that you cannot insert video files with visual editor."), false); |
|---|
| 477 | |
|---|
| 478 | echo |
|---|
| 479 | '<div class="two-boxes">' . |
|---|
| 480 | '<h3>' . __('Video size') . '</h3>' . |
|---|
| 481 | '<p><label for="video_w" class="classic">' . __('Width:') . '</label> ' . |
|---|
| 482 | form::number('video_w', 0, 9999, $core->blog->settings->system->media_video_width) . ' ' . |
|---|
| 483 | '<label for="video_h" class="classic">' . __('Height:') . '</label> ' . |
|---|
| 484 | form::number('video_h', 0, 9999, $core->blog->settings->system->media_video_height) . |
|---|
| 485 | '</p>' . |
|---|
| 486 | '</div>'; |
|---|
| 487 | |
|---|
| 488 | echo |
|---|
| 489 | '<div class="two-boxes">' . |
|---|
| 490 | '<h3>' . __('Video disposition') . '</h3>'; |
|---|
| 491 | |
|---|
| 492 | $i_align = array( |
|---|
| 493 | 'none' => array(__('None'), ($media_img_default_alignment == 'none' ? 1 : 0)), |
|---|
| 494 | 'left' => array(__('Left'), ($media_img_default_alignment == 'left' ? 1 : 0)), |
|---|
| 495 | 'right' => array(__('Right'), ($media_img_default_alignment == 'right' ? 1 : 0)), |
|---|
| 496 | 'center' => array(__('Center'), ($media_img_default_alignment == 'center' ? 1 : 0)) |
|---|
| 497 | ); |
|---|
| 498 | |
|---|
| 499 | echo '<p>'; |
|---|
| 500 | foreach ($i_align as $k => $v) { |
|---|
| 501 | echo '<label class="classic">' . |
|---|
| 502 | form::radio(array('alignment'), $k, $v[1]) . ' ' . $v[0] . '</label><br /> '; |
|---|
| 503 | } |
|---|
| 504 | |
|---|
| 505 | $public_player_style = unserialize($core->blog->settings->themes->flvplayer_style); |
|---|
| 506 | $public_player = dcMedia::videoPlayer($file->type, $file->file_url, $core->blog->getQmarkURL() . 'pf=player_flv.swf', $public_player_style, $core->blog->settings->system->media_flash_fallback); |
|---|
| 507 | echo form::hidden('public_player', html::escapeHTML($public_player)); |
|---|
| 508 | echo '</p>'; |
|---|
| 509 | echo '</div>'; |
|---|
| 510 | } else { |
|---|
| 511 | $media_type = 'default'; |
|---|
| 512 | echo '<p>' . __('Media item will be inserted as a link.') . '</p>'; |
|---|
| 513 | } |
|---|
| 514 | |
|---|
| 515 | echo |
|---|
| 516 | '<p>' . |
|---|
| 517 | '<button type="button" id="media-insert-ok" class="submit">' . __('Insert') . '</button> ' . |
|---|
| 518 | '<button type="button" id="media-insert-cancel">' . __('Cancel') . '</button>' . |
|---|
| 519 | form::hidden(array('type'), html::escapeHTML($media_type)) . |
|---|
| 520 | form::hidden(array('title'), html::escapeHTML($file->media_title)) . |
|---|
| 521 | form::hidden(array('description'), html::escapeHTML($media_desc)) . |
|---|
| 522 | form::hidden(array('url'), $file->file_url) . |
|---|
| 523 | '</p>'; |
|---|
| 524 | |
|---|
| 525 | echo '</form>'; |
|---|
| 526 | |
|---|
| 527 | if ($media_type != 'default') { |
|---|
| 528 | echo |
|---|
| 529 | '<div class="border-top">' . |
|---|
| 530 | '<form id="save_settings" action="' . $core->adminurl->getBase('admin.media.item') . '" method="post">' . |
|---|
| 531 | '<p>' . __('Make current settings as default') . ' ' . |
|---|
| 532 | '<input class="reset" type="submit" name="save_blog_prefs" value="' . __('OK') . '" />' . |
|---|
| 533 | form::hidden(array('pref_src'), '') . |
|---|
| 534 | form::hidden(array('pref_alignment'), '') . |
|---|
| 535 | form::hidden(array('pref_insertion'), '') . |
|---|
| 536 | form::hidden(array('pref_legend'), '') . |
|---|
| 537 | $core->adminurl->getHiddenFormFields('admin.media.item', $page_url_params) . |
|---|
| 538 | $core->formNonce() . '</p>' . |
|---|
| 539 | '</form>' . '</div>'; |
|---|
| 540 | } |
|---|
| 541 | |
|---|
| 542 | echo '</div>'; |
|---|
| 543 | } |
|---|
| 544 | |
|---|
| 545 | if ($popup || $select) { |
|---|
| 546 | echo |
|---|
| 547 | '<div class="multi-part" title="' . __('Media details') . '" id="media-details-tab">'; |
|---|
| 548 | } else { |
|---|
| 549 | echo '<h3 class="out-of-screen-if-js">' . __('Media details') . '</h3>'; |
|---|
| 550 | } |
|---|
| 551 | echo |
|---|
| 552 | '<p id="media-icon"><img src="' . $file->media_icon . '?' . time() * rand() . '" alt="" /></p>'; |
|---|
| 553 | |
|---|
| 554 | echo |
|---|
| 555 | '<div id="media-details">' . |
|---|
| 556 | '<div class="near-icon">'; |
|---|
| 557 | |
|---|
| 558 | if ($file->media_image) { |
|---|
| 559 | $thumb_size = !empty($_GET['size']) ? $_GET['size'] : 's'; |
|---|
| 560 | |
|---|
| 561 | if (!isset($core->media->thumb_sizes[$thumb_size]) && $thumb_size != 'o') { |
|---|
| 562 | $thumb_size = 's'; |
|---|
| 563 | } |
|---|
| 564 | |
|---|
| 565 | if (isset($file->media_thumb[$thumb_size])) { |
|---|
| 566 | echo '<p><a class="modal-image" href="' . $file->file_url . '">' . |
|---|
| 567 | '<img src="' . $file->media_thumb[$thumb_size] . '?' . time() * rand() . '" alt="" />' . |
|---|
| 568 | '</a></p>'; |
|---|
| 569 | } elseif ($thumb_size == 'o') { |
|---|
| 570 | $S = getimagesize($file->file); |
|---|
| 571 | $class = ($S[1] > 500) ? ' class="overheight"' : ''; |
|---|
| 572 | unset($S); |
|---|
| 573 | echo '<p id="media-original-image"' . $class . '><a class="modal-image" href="' . $file->file_url . '">' . |
|---|
| 574 | '<img src="' . $file->file_url . '?' . time() * rand() . '" alt="" />' . |
|---|
| 575 | '</a></p>'; |
|---|
| 576 | } |
|---|
| 577 | |
|---|
| 578 | echo '<p>' . __('Available sizes:') . ' '; |
|---|
| 579 | foreach (array_reverse($file->media_thumb) as $s => $v) { |
|---|
| 580 | $strong_link = ($s == $thumb_size) ? '<strong>%s</strong>' : '%s'; |
|---|
| 581 | printf($strong_link, '<a href="' . $core->adminurl->get('admin.media.item', array_merge($page_url_params, |
|---|
| 582 | array("size" => $s, 'tab' => 'media-details-tab'))) . '">' . $core->media->thumb_sizes[$s][2] . '</a> | '); |
|---|
| 583 | } |
|---|
| 584 | echo '<a href="' . $core->adminurl->get('admin.media.item', array_merge($page_url_params, array("size" => "o", "tab" => "media-details-tab"))) . '">' . __('original') . '</a>'; |
|---|
| 585 | echo '</p>'; |
|---|
| 586 | |
|---|
| 587 | if ($thumb_size != 'o' && isset($file->media_thumb[$thumb_size])) { |
|---|
| 588 | $p = path::info($file->file); |
|---|
| 589 | $alpha = ($p['extension'] == 'png') || ($p['extension'] == 'PNG'); |
|---|
| 590 | $thumb = sprintf(($alpha ? $core->media->thumb_tp_alpha : $core->media->thumb_tp), $p['dirname'], $p['base'], '%s'); |
|---|
| 591 | $thumb_file = sprintf($thumb, $thumb_size); |
|---|
| 592 | $T = getimagesize($thumb_file); |
|---|
| 593 | $stats = stat($thumb_file); |
|---|
| 594 | echo |
|---|
| 595 | '<h3>' . __('Thumbnail details') . '</h3>' . |
|---|
| 596 | '<ul>' . |
|---|
| 597 | '<li><strong>' . __('Image width:') . '</strong> ' . $T[0] . ' px</li>' . |
|---|
| 598 | '<li><strong>' . __('Image height:') . '</strong> ' . $T[1] . ' px</li>' . |
|---|
| 599 | '<li><strong>' . __('File size:') . '</strong> ' . files::size($stats[7]) . '</li>' . |
|---|
| 600 | '<li><strong>' . __('File URL:') . '</strong> <a href="' . $file->media_thumb[$thumb_size] . '">' . |
|---|
| 601 | $file->media_thumb[$thumb_size] . '</a></li>' . |
|---|
| 602 | '</ul>'; |
|---|
| 603 | } |
|---|
| 604 | } |
|---|
| 605 | |
|---|
| 606 | // Show player if relevant |
|---|
| 607 | if ($file_type[0] == 'audio') { |
|---|
| 608 | echo dcMedia::audioPlayer($file->type, $file->file_url, $core->adminurl->get("admin.home", array('pf' => 'player_mp3.swf')), |
|---|
| 609 | null, $core->blog->settings->system->media_flash_fallback); |
|---|
| 610 | } |
|---|
| 611 | if ($file_type[0] == 'video') { |
|---|
| 612 | echo dcMedia::videoPlayer($file->type, $file->file_url, $core->adminurl->get("admin.home", array('pf' => 'player_flv.swf')), |
|---|
| 613 | null, $core->blog->settings->system->media_flash_fallback); |
|---|
| 614 | } |
|---|
| 615 | |
|---|
| 616 | echo |
|---|
| 617 | '<h3>' . __('Media details') . '</h3>' . |
|---|
| 618 | '<ul>' . |
|---|
| 619 | '<li><strong>' . __('File owner:') . '</strong> ' . $file->media_user . '</li>' . |
|---|
| 620 | '<li><strong>' . __('File type:') . '</strong> ' . $file->type . '</li>'; |
|---|
| 621 | if ($file->media_image) { |
|---|
| 622 | $S = getimagesize($file->file); |
|---|
| 623 | echo |
|---|
| 624 | '<li><strong>' . __('Image width:') . '</strong> ' . $S[0] . ' px</li>' . |
|---|
| 625 | '<li><strong>' . __('Image height:') . '</strong> ' . $S[1] . ' px</li>'; |
|---|
| 626 | unset($S); |
|---|
| 627 | } |
|---|
| 628 | echo |
|---|
| 629 | '<li><strong>' . __('File size:') . '</strong> ' . files::size($file->size) . '</li>' . |
|---|
| 630 | '<li><strong>' . __('File URL:') . '</strong> <a href="' . $file->file_url . '">' . $file->file_url . '</a></li>' . |
|---|
| 631 | '</ul>'; |
|---|
| 632 | |
|---|
| 633 | if (empty($_GET['find_posts'])) { |
|---|
| 634 | echo |
|---|
| 635 | '<p><a class="button" href="' . $core->adminurl->get('admin.media.item', array_merge($page_url_params, array("find_posts" => 1, "tab" => "media-details-tab"))) . '">' . |
|---|
| 636 | __('Show entries containing this media') . '</a></p>'; |
|---|
| 637 | } else { |
|---|
| 638 | echo '<h3>' . __('Entries containing this media') . '</h3>'; |
|---|
| 639 | $params = array( |
|---|
| 640 | 'post_type' => '', |
|---|
| 641 | 'from' => 'LEFT OUTER JOIN ' . $core->prefix . 'post_media PM ON P.post_id = PM.post_id ', |
|---|
| 642 | 'sql' => 'AND (' . |
|---|
| 643 | 'PM.media_id = ' . (integer) $id . ' ' . |
|---|
| 644 | "OR post_content_xhtml LIKE '%" . $core->con->escape($file->relname) . "%' " . |
|---|
| 645 | "OR post_excerpt_xhtml LIKE '%" . $core->con->escape($file->relname) . "%' " |
|---|
| 646 | ); |
|---|
| 647 | |
|---|
| 648 | if ($file->media_image) { |
|---|
| 649 | # We look for thumbnails too |
|---|
| 650 | if (preg_match('#^http(s)?://#', $core->blog->settings->system->public_url)) { |
|---|
| 651 | $media_root = $core->blog->settings->system->public_url; |
|---|
| 652 | } else { |
|---|
| 653 | $media_root = $core->blog->host . path::clean($core->blog->settings->system->public_url) . '/'; |
|---|
| 654 | } |
|---|
| 655 | foreach ($file->media_thumb as $v) { |
|---|
| 656 | $v = preg_replace('/^' . preg_quote($media_root, '/') . '/', '', $v); |
|---|
| 657 | $params['sql'] .= "OR post_content_xhtml LIKE '%" . $core->con->escape($v) . "%' "; |
|---|
| 658 | $params['sql'] .= "OR post_excerpt_xhtml LIKE '%" . $core->con->escape($v) . "%' "; |
|---|
| 659 | } |
|---|
| 660 | } |
|---|
| 661 | |
|---|
| 662 | $params['sql'] .= ') '; |
|---|
| 663 | |
|---|
| 664 | $rs = $core->blog->getPosts($params); |
|---|
| 665 | |
|---|
| 666 | if ($rs->isEmpty()) { |
|---|
| 667 | echo '<p>' . __('No entry seems contain this media.') . '</p>'; |
|---|
| 668 | } else { |
|---|
| 669 | echo '<ul>'; |
|---|
| 670 | while ($rs->fetch()) { |
|---|
| 671 | $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; |
|---|
| 672 | switch ($rs->post_status) { |
|---|
| 673 | case 1: |
|---|
| 674 | $img_status = sprintf($img, __('published'), 'check-on.png'); |
|---|
| 675 | break; |
|---|
| 676 | case 0: |
|---|
| 677 | $img_status = sprintf($img, __('unpublished'), 'check-off.png'); |
|---|
| 678 | break; |
|---|
| 679 | case -1: |
|---|
| 680 | $img_status = sprintf($img, __('scheduled'), 'scheduled.png'); |
|---|
| 681 | break; |
|---|
| 682 | case -2: |
|---|
| 683 | $img_status = sprintf($img, __('pending'), 'check-wrn.png'); |
|---|
| 684 | break; |
|---|
| 685 | } |
|---|
| 686 | echo '<li>' . $img_status . ' ' . '<a href="' . $core->getPostAdminURL($rs->post_type, $rs->post_id) . '">' . |
|---|
| 687 | $rs->post_title . '</a>' . |
|---|
| 688 | ($rs->post_type != 'post' ? ' (' . html::escapeHTML($rs->post_type) . ')' : '') . |
|---|
| 689 | ' - ' . dt::dt2str(__('%Y-%m-%d %H:%M'), $rs->post_dt) . '</li>'; |
|---|
| 690 | } |
|---|
| 691 | echo '</ul>'; |
|---|
| 692 | } |
|---|
| 693 | } |
|---|
| 694 | |
|---|
| 695 | if ($file->type == 'image/jpeg') { |
|---|
| 696 | echo '<h3>' . __('Image details') . '</h3>'; |
|---|
| 697 | |
|---|
| 698 | $details = ''; |
|---|
| 699 | if (count($file->media_meta) > 0) { |
|---|
| 700 | foreach ($file->media_meta as $k => $v) { |
|---|
| 701 | if ((string) $v) { |
|---|
| 702 | $details .= '<li><strong>' . $k . ':</strong> ' . html::escapeHTML($v) . '</li>'; |
|---|
| 703 | } |
|---|
| 704 | } |
|---|
| 705 | } |
|---|
| 706 | if ($details) { |
|---|
| 707 | echo '<ul>' . $details . '</ul>'; |
|---|
| 708 | } else { |
|---|
| 709 | echo '<p>' . __('No detail') . '</p>'; |
|---|
| 710 | } |
|---|
| 711 | } |
|---|
| 712 | |
|---|
| 713 | echo '</div>'; |
|---|
| 714 | |
|---|
| 715 | echo '<h3>' . __('Updates and modifications') . '</h3>'; |
|---|
| 716 | |
|---|
| 717 | if ($file->editable && $core_media_writable) { |
|---|
| 718 | if ($file->media_type == 'image') { |
|---|
| 719 | echo |
|---|
| 720 | '<form class="clear fieldset" action="' . $core->adminurl->get("admin.media.item") . '" method="post">' . |
|---|
| 721 | '<h4>' . __('Update thumbnails') . '</h4>' . |
|---|
| 722 | '<p class="more-info">' . __('This will create or update thumbnails for this image.') . '</p>' . |
|---|
| 723 | '<p><input type="submit" name="thumbs" value="' . __('Update thumbnails') . '" />' . |
|---|
| 724 | $core->adminurl->getHiddenFormFields('admin.media', $page_url_params) . |
|---|
| 725 | $core->formNonce() . '</p>' . |
|---|
| 726 | '</form>'; |
|---|
| 727 | } |
|---|
| 728 | |
|---|
| 729 | if ($file->type == 'application/zip') { |
|---|
| 730 | $inflate_combo = array( |
|---|
| 731 | __('Extract in a new directory') => 'new', |
|---|
| 732 | __('Extract in current directory') => 'current' |
|---|
| 733 | ); |
|---|
| 734 | |
|---|
| 735 | echo |
|---|
| 736 | '<form class="clear fieldset" id="file-unzip" action="' . $core->adminurl->get("admin.media.item") . '" method="post">' . |
|---|
| 737 | '<h4>' . __('Extract archive') . '</h4>' . |
|---|
| 738 | '<ul>' . |
|---|
| 739 | '<li><strong>' . __('Extract in a new directory') . '</strong> : ' . |
|---|
| 740 | __('This will extract archive in a new directory that should not exist yet.') . '</li>' . |
|---|
| 741 | '<li><strong>' . __('Extract in current directory') . '</strong> : ' . |
|---|
| 742 | __('This will extract archive in current directory and will overwrite existing files or directory.') . '</li>' . |
|---|
| 743 | '</ul>' . |
|---|
| 744 | '<p><label for="inflate_mode" class="classic">' . __('Extract mode:') . '</label> ' . |
|---|
| 745 | form::combo('inflate_mode', $inflate_combo, 'new') . |
|---|
| 746 | '<input type="submit" name="unzip" value="' . __('Extract') . '" />' . |
|---|
| 747 | $core->adminurl->getHiddenFormFields('admin.media', $page_url_params) . |
|---|
| 748 | $core->formNonce() . '</p>' . |
|---|
| 749 | '</form>'; |
|---|
| 750 | } |
|---|
| 751 | |
|---|
| 752 | echo |
|---|
| 753 | '<form class="clear fieldset" action="' . $core->adminurl->get("admin.media.item") . '" method="post">' . |
|---|
| 754 | '<h4>' . __('Change media properties') . '</h4>' . |
|---|
| 755 | '<p><label for="media_file">' . __('File name:') . '</label>' . |
|---|
| 756 | form::field('media_file', 30, 255, html::escapeHTML($file->basename)) . '</p>' . |
|---|
| 757 | '<p><label for="media_title">' . __('File title:') . '</label>' . |
|---|
| 758 | form::field('media_title', 30, 255, html::escapeHTML($file->media_title)) . '</p>' . |
|---|
| 759 | '<p><label for="media_dt">' . __('File date:') . '</label>' . |
|---|
| 760 | form::field('media_dt', 16, 16, html::escapeHTML($file->media_dtstr)) . |
|---|
| 761 | /* |
|---|
| 762 | Previous line will be replaced by this one as soon as every browser will support datetime-local input type |
|---|
| 763 | Dont forget to remove call to datepicker in media_item.js |
|---|
| 764 | |
|---|
| 765 | form::datetime('media_dt', array('default' => html::escapeHTML(dt::str('%Y-%m-%dT%H:%M', $file->media_dt)))) . |
|---|
| 766 | */ |
|---|
| 767 | '</p>' . |
|---|
| 768 | '<p><label for="media_private" class="classic">' . form::checkbox('media_private', 1, $file->media_priv) . ' ' . |
|---|
| 769 | __('Private') . '</label></p>' . |
|---|
| 770 | '<p><label for="media_path">' . __('New directory:') . '</label>' . |
|---|
| 771 | form::combo('media_path', $dirs_combo, dirname($file->relname)) . '</p>' . |
|---|
| 772 | '<p><input type="submit" accesskey="s" value="' . __('Save') . '" />' . |
|---|
| 773 | $core->adminurl->getHiddenFormFields('admin.media.item', $page_url_params) . |
|---|
| 774 | $core->formNonce() . '</p>' . |
|---|
| 775 | '</form>'; |
|---|
| 776 | |
|---|
| 777 | echo |
|---|
| 778 | '<form class="clear fieldset" action="' . $core->adminurl->get("admin.media.item") . '" method="post" enctype="multipart/form-data">' . |
|---|
| 779 | '<h4>' . __('Change file') . '</h4>' . |
|---|
| 780 | '<div>' . form::hidden(array('MAX_FILE_SIZE'), DC_MAX_UPLOAD_SIZE) . '</div>' . |
|---|
| 781 | '<p><label for="upfile">' . __('Choose a file:') . |
|---|
| 782 | ' (' . sprintf(__('Maximum size %s'), files::size(DC_MAX_UPLOAD_SIZE)) . ') ' . |
|---|
| 783 | '<input type="file" id="upfile" name="upfile" size="35" />' . |
|---|
| 784 | '</label></p>' . |
|---|
| 785 | '<p><input type="submit" value="' . __('Send') . '" />' . |
|---|
| 786 | $core->adminurl->getHiddenFormFields('admin.media', $page_url_params) . |
|---|
| 787 | $core->formNonce() . '</p>' . |
|---|
| 788 | '</form>'; |
|---|
| 789 | |
|---|
| 790 | if ($file->del) { |
|---|
| 791 | echo |
|---|
| 792 | '<form id="delete-form" method="post" action="' . $core->adminurl->getBase("admin.media") . '">' . |
|---|
| 793 | '<p><input name="delete" type="submit" class="delete" value="' . __('Delete this media') . '" />' . |
|---|
| 794 | form::hidden('remove', rawurlencode($file->basename)) . |
|---|
| 795 | form::hidden('rmyes', 1) . |
|---|
| 796 | $core->adminurl->getHiddenFormFields('admin.media', $media_page_url_params) . |
|---|
| 797 | $core->formNonce() . '</p>' . |
|---|
| 798 | '</form>'; |
|---|
| 799 | } |
|---|
| 800 | |
|---|
| 801 | # --BEHAVIOR-- adminMediaItemForm |
|---|
| 802 | $core->callBehavior('adminMediaItemForm', $file); |
|---|
| 803 | } |
|---|
| 804 | |
|---|
| 805 | echo |
|---|
| 806 | '</div>'; |
|---|
| 807 | if ($popup || $select) { |
|---|
| 808 | echo |
|---|
| 809 | '</div>'; |
|---|
| 810 | } |
|---|
| 811 | |
|---|
| 812 | call_user_func($close_f); |
|---|