[0] | 1 | <?php |
---|
[3731] | 2 | /** |
---|
| 3 | * @package Dotclear |
---|
| 4 | * @subpackage Backend |
---|
| 5 | * |
---|
| 6 | * @copyright Olivier Meunier & Association Dotclear |
---|
| 7 | * @copyright GPL-2.0-only |
---|
| 8 | */ |
---|
[0] | 9 | |
---|
[3691] | 10 | require dirname(__FILE__) . '/../inc/admin/prepend.php'; |
---|
[0] | 11 | |
---|
| 12 | dcPage::check('media,media_admin'); |
---|
| 13 | |
---|
[861] | 14 | $tab = empty($_REQUEST['tab']) ? '' : $_REQUEST['tab']; |
---|
| 15 | |
---|
[2889] | 16 | $post_id = !empty($_REQUEST['post_id']) ? (integer) $_REQUEST['post_id'] : null; |
---|
[0] | 17 | if ($post_id) { |
---|
[3874] | 18 | $post = $core->blog->getPosts(['post_id' => $post_id]); |
---|
[3691] | 19 | if ($post->isEmpty()) { |
---|
| 20 | $post_id = null; |
---|
| 21 | } |
---|
| 22 | $post_title = $post->post_title; |
---|
| 23 | unset($post); |
---|
[0] | 24 | } |
---|
| 25 | |
---|
[3167] | 26 | // Attachement type if any |
---|
| 27 | $link_type = !empty($_REQUEST['link_type']) ? $_REQUEST['link_type'] : null; |
---|
| 28 | |
---|
[3691] | 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']) : ''; |
---|
[3874] | 33 | $page_url_params = ['popup' => $popup, 'select' => $select, 'post_id' => $post_id]; |
---|
| 34 | $media_page_url_params = ['popup' => $popup, 'select' => $select, 'post_id' => $post_id, 'link_type' => $link_type]; |
---|
[2852] | 35 | |
---|
| 36 | if ($plugin_id != '') { |
---|
[3691] | 37 | $page_url_params['plugin_id'] = $plugin_id; |
---|
| 38 | $media_page_url_params['plugin_id'] = $plugin_id; |
---|
[2852] | 39 | } |
---|
[0] | 40 | |
---|
| 41 | $id = !empty($_REQUEST['id']) ? (integer) $_REQUEST['id'] : ''; |
---|
| 42 | |
---|
[2852] | 43 | if ($id != '') { |
---|
[3691] | 44 | $page_url_params['id'] = $id; |
---|
[2852] | 45 | } |
---|
| 46 | |
---|
[0] | 47 | if ($popup) { |
---|
[3874] | 48 | $open_f = ['dcPage', 'openPopup']; |
---|
| 49 | $close_f = ['dcPage', 'closePopup']; |
---|
[0] | 50 | } else { |
---|
[3874] | 51 | $open_f = ['dcPage', 'open']; |
---|
[3691] | 52 | $close_f = function () { |
---|
| 53 | dcPage::helpBlock('core_media'); |
---|
| 54 | dcPage::close(); |
---|
| 55 | }; |
---|
[0] | 56 | } |
---|
| 57 | |
---|
| 58 | $core_media_writable = false; |
---|
| 59 | try |
---|
| 60 | { |
---|
[3691] | 61 | $core->media = new dcMedia($core); |
---|
[2529] | 62 | |
---|
[3691] | 63 | if ($id) { |
---|
| 64 | $file = $core->media->getFile($id); |
---|
| 65 | } |
---|
[2529] | 66 | |
---|
[3691] | 67 | if ($file === null) { |
---|
| 68 | throw new Exception(__('Not a valid file')); |
---|
| 69 | } |
---|
[2529] | 70 | |
---|
[3691] | 71 | $core->media->chdir(dirname($file->relname)); |
---|
| 72 | $core_media_writable = $core->media->writable(); |
---|
[2529] | 73 | |
---|
[3691] | 74 | # Prepare directories combo box |
---|
[3874] | 75 | $dirs_combo = []; |
---|
[3691] | 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()); |
---|
[0] | 87 | } |
---|
| 88 | |
---|
| 89 | # Upload a new file |
---|
[3691] | 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); |
---|
[2256] | 94 | |
---|
[3691] | 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 | } |
---|
[0] | 100 | } |
---|
| 101 | |
---|
| 102 | # Update file |
---|
[3691] | 103 | if ($file && !empty($_POST['media_file']) && $file->editable && $core_media_writable) { |
---|
| 104 | $newFile = clone $file; |
---|
[2529] | 105 | |
---|
[3691] | 106 | $newFile->basename = $_POST['media_file']; |
---|
[2529] | 107 | |
---|
[3691] | 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']); |
---|
[2529] | 119 | |
---|
[3691] | 120 | try { |
---|
| 121 | $core->media->updateFile($file, $newFile); |
---|
[2256] | 122 | |
---|
[3691] | 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 | } |
---|
[0] | 129 | } |
---|
| 130 | |
---|
| 131 | # Update thumbnails |
---|
[3691] | 132 | if (!empty($_POST['thumbs']) && $file->media_type == 'image' && $file->editable && $core_media_writable) { |
---|
| 133 | try { |
---|
| 134 | $foo = null; |
---|
| 135 | $core->media->mediaFireRecreateEvent($file); |
---|
[2529] | 136 | |
---|
[3691] | 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 | } |
---|
[0] | 143 | } |
---|
| 144 | |
---|
| 145 | # Unzip file |
---|
[3691] | 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'); |
---|
[2529] | 149 | |
---|
[3691] | 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 | } |
---|
[0] | 156 | } |
---|
| 157 | |
---|
[2093] | 158 | # Save media insertion settings for the blog |
---|
[3691] | 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 | } |
---|
[2529] | 177 | |
---|
[3691] | 178 | dcPage::addSuccessNotice(__('Default media insertion settings have been successfully updated.')); |
---|
| 179 | $core->adminurl->redirect('admin.media.item', $page_url_params); |
---|
[2093] | 180 | } |
---|
| 181 | |
---|
[0] | 182 | # Function to get image title based on meta |
---|
[3691] | 183 | $get_img_title = function ($file, $pattern, $dto_first = false, $no_date_alone = false) { |
---|
[3874] | 184 | $res = []; |
---|
[3691] | 185 | $pattern = preg_split('/\s*;;\s*/', $pattern); |
---|
| 186 | $sep = ', '; |
---|
| 187 | $dates = 0; |
---|
| 188 | $items = 0; |
---|
[2529] | 189 | |
---|
[3691] | 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); |
---|
[3353] | 222 | }; |
---|
[0] | 223 | |
---|
| 224 | /* DISPLAY Main page |
---|
| 225 | -------------------------------------------------------- */ |
---|
[2529] | 226 | $starting_scripts = |
---|
[3691] | 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'); |
---|
[2751] | 232 | if ($popup && !empty($plugin_id)) { |
---|
[3691] | 233 | $starting_scripts .= $core->callBehavior('adminPopupMedia', $plugin_id); |
---|
[0] | 234 | } |
---|
[3691] | 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( |
---|
[3874] | 246 | [ |
---|
[3691] | 247 | html::escapeHTML($core->blog->name) => '', |
---|
| 248 | __('Media manager') => $home_url, |
---|
| 249 | $breadcrumb => '' |
---|
[3874] | 250 | ], |
---|
| 251 | [ |
---|
[3691] | 252 | 'home_link' => !$popup, |
---|
| 253 | 'hl' => false |
---|
[3874] | 254 | ] |
---|
[3691] | 255 | ) |
---|
[0] | 256 | ); |
---|
| 257 | |
---|
[2529] | 258 | if ($popup) { |
---|
[3691] | 259 | // Display notices |
---|
| 260 | echo dcPage::notices(); |
---|
[2529] | 261 | } |
---|
| 262 | |
---|
[0] | 263 | if ($file === null) { |
---|
[3691] | 264 | call_user_func($close_f); |
---|
| 265 | exit; |
---|
[0] | 266 | } |
---|
| 267 | |
---|
| 268 | if (!empty($_GET['fupd']) || !empty($_GET['fupl'])) { |
---|
[3691] | 269 | dcPage::success(__('File has been successfully updated.')); |
---|
[0] | 270 | } |
---|
| 271 | if (!empty($_GET['thumbupd'])) { |
---|
[3691] | 272 | dcPage::success(__('Thumbnails have been successfully updated.')); |
---|
[0] | 273 | } |
---|
[2093] | 274 | if (!empty($_GET['blogprefupd'])) { |
---|
[3691] | 275 | dcPage::success(__('Default media insertion settings have been successfully updated.')); |
---|
[2093] | 276 | } |
---|
[0] | 277 | |
---|
[2767] | 278 | # Get major file type (first part of mime type) |
---|
[3691] | 279 | $file_type = explode('/', $file->type); |
---|
[2767] | 280 | |
---|
[3153] | 281 | # Selection mode |
---|
| 282 | if ($select) { |
---|
[3691] | 283 | // Let user choose thumbnail size if image |
---|
| 284 | $media_desc = $file->media_title; |
---|
[3153] | 285 | |
---|
[3691] | 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">'; |
---|
[3153] | 290 | |
---|
[3691] | 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 | } |
---|
[3153] | 304 | |
---|
[3691] | 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 | } |
---|
[3153] | 314 | |
---|
[3691] | 315 | echo |
---|
| 316 | '<h3>' . __('Image size:') . '</h3> '; |
---|
[3153] | 317 | |
---|
[3691] | 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">' . |
---|
[3874] | 323 | form::radio(['src'], html::escapeHTML($v), $s_checked) . ' ' . |
---|
[3691] | 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">' . |
---|
[3874] | 328 | form::radio(['src'], $file->file_url, $s_checked) . ' ' . __('original') . '</label><br /> '; |
---|
[3691] | 329 | echo '</p>'; |
---|
[3153] | 330 | |
---|
[3691] | 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 | } |
---|
[3153] | 338 | |
---|
[3691] | 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>' . |
---|
[3874] | 343 | form::hidden(['type'], html::escapeHTML($media_type)) . |
---|
| 344 | form::hidden(['title'], html::escapeHTML($file->media_title)) . |
---|
| 345 | form::hidden(['description'], html::escapeHTML($media_desc)) . |
---|
| 346 | form::hidden(['url'], $file->file_url) . |
---|
[3691] | 347 | '</p>'; |
---|
[3153] | 348 | |
---|
[3691] | 349 | echo '</form>'; |
---|
| 350 | echo '</div>'; |
---|
[3153] | 351 | } |
---|
| 352 | |
---|
[0] | 353 | # Insertion popup |
---|
[3691] | 354 | if ($popup && !$select) { |
---|
| 355 | $media_desc = $file->media_title; |
---|
[2529] | 356 | |
---|
[3691] | 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">'; |
---|
[2529] | 361 | |
---|
[3691] | 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 | } |
---|
[950] | 375 | |
---|
[3691] | 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 | } |
---|
[887] | 385 | |
---|
[3691] | 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">' . |
---|
[3874] | 394 | form::radio(['src'], html::escapeHTML($v), $s_checked) . ' ' . |
---|
[3691] | 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">' . |
---|
[3874] | 399 | form::radio(['src'], $file->file_url, $s_checked) . ' ' . __('original') . '</label><br /> '; |
---|
[3691] | 400 | echo '</p>'; |
---|
| 401 | echo '</div>'; |
---|
[3446] | 402 | |
---|
[3691] | 403 | echo |
---|
| 404 | '<div class="two-boxes">' . |
---|
| 405 | '<h3>' . __('Image legend and title') . '</h3>' . |
---|
| 406 | '<p>' . |
---|
[3874] | 407 | '<label for="legend1" class="classic">' . form::radio(['legend', 'legend1'], 'legend', |
---|
[3691] | 408 | ($media_img_default_legend == 'legend')) . |
---|
| 409 | __('Legend and title') . '</label><br />' . |
---|
[3874] | 410 | '<label for="legend2" class="classic">' . form::radio(['legend', 'legend2'], 'title', |
---|
[3691] | 411 | ($media_img_default_legend == 'title')) . |
---|
| 412 | __('Title') . '</label><br />' . |
---|
[3874] | 413 | '<label for="legend3" class="classic">' . form::radio(['legend', 'legend3'], 'none', |
---|
[3691] | 414 | ($media_img_default_legend == 'none')) . |
---|
| 415 | __('None') . '</label>' . |
---|
| 416 | '</p>' . |
---|
| 417 | '</div>'; |
---|
[2529] | 418 | |
---|
[3691] | 419 | echo |
---|
| 420 | '<div class="two-boxes">' . |
---|
| 421 | '<h3>' . __('Image alignment') . '</h3>'; |
---|
[3874] | 422 | $i_align = [ |
---|
| 423 | 'none' => [__('None'), ($media_img_default_alignment == 'none' ? 1 : 0)], |
---|
| 424 | 'left' => [__('Left'), ($media_img_default_alignment == 'left' ? 1 : 0)], |
---|
| 425 | 'right' => [__('Right'), ($media_img_default_alignment == 'right' ? 1 : 0)], |
---|
| 426 | 'center' => [__('Center'), ($media_img_default_alignment == 'center' ? 1 : 0)] |
---|
| 427 | ]; |
---|
[2529] | 428 | |
---|
[3691] | 429 | echo '<p>'; |
---|
| 430 | foreach ($i_align as $k => $v) { |
---|
| 431 | echo '<label class="classic">' . |
---|
[3874] | 432 | form::radio(['alignment'], $k, $v[1]) . ' ' . $v[0] . '</label><br /> '; |
---|
[3691] | 433 | } |
---|
| 434 | echo '</p>'; |
---|
| 435 | echo '</div>'; |
---|
[2529] | 436 | |
---|
[3691] | 437 | echo |
---|
| 438 | '<div class="two-boxes">' . |
---|
| 439 | '<h3>' . __('Image insertion') . '</h3>' . |
---|
| 440 | '<p>' . |
---|
[3874] | 441 | '<label for="insert1" class="classic">' . form::radio(['insertion', 'insert1'], 'simple', !$media_img_default_link) . |
---|
[3691] | 442 | __('As a single image') . '</label><br />' . |
---|
[3874] | 443 | '<label for="insert2" class="classic">' . form::radio(['insertion', 'insert2'], 'link', $media_img_default_link) . |
---|
[3691] | 444 | __('As a link to the original image') . '</label>' . |
---|
| 445 | '</p>' . |
---|
| 446 | '</div>'; |
---|
| 447 | } elseif ($file_type[0] == 'audio') { |
---|
| 448 | $media_type = 'mp3'; |
---|
[2529] | 449 | |
---|
[3691] | 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); |
---|
[2529] | 454 | |
---|
[3874] | 455 | $i_align = [ |
---|
| 456 | 'none' => [__('None'), ($media_img_default_alignment == 'none' ? 1 : 0)], |
---|
| 457 | 'left' => [__('Left'), ($media_img_default_alignment == 'left' ? 1 : 0)], |
---|
| 458 | 'right' => [__('Right'), ($media_img_default_alignment == 'right' ? 1 : 0)], |
---|
| 459 | 'center' => [__('Center'), ($media_img_default_alignment == 'center' ? 1 : 0)] |
---|
| 460 | ]; |
---|
[2529] | 461 | |
---|
[3691] | 462 | echo '<p>'; |
---|
| 463 | foreach ($i_align as $k => $v) { |
---|
| 464 | echo '<label class="classic">' . |
---|
[3874] | 465 | form::radio(['alignment'], $k, $v[1]) . ' ' . $v[0] . '</label><br /> '; |
---|
[3691] | 466 | } |
---|
[2529] | 467 | |
---|
[3691] | 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'; |
---|
[2529] | 475 | |
---|
[3691] | 476 | dcPage::message(__("Please note that you cannot insert video files with visual editor."), false); |
---|
[2529] | 477 | |
---|
[3691] | 478 | echo |
---|
| 479 | '<div class="two-boxes">' . |
---|
| 480 | '<h3>' . __('Video size') . '</h3>' . |
---|
| 481 | '<p><label for="video_w" class="classic">' . __('Width:') . '</label> ' . |
---|
[3725] | 482 | form::number('video_w', 0, 9999, $core->blog->settings->system->media_video_width) . ' ' . |
---|
[3691] | 483 | '<label for="video_h" class="classic">' . __('Height:') . '</label> ' . |
---|
[3725] | 484 | form::number('video_h', 0, 9999, $core->blog->settings->system->media_video_height) . |
---|
[3691] | 485 | '</p>' . |
---|
| 486 | '</div>'; |
---|
[2510] | 487 | |
---|
[3691] | 488 | echo |
---|
| 489 | '<div class="two-boxes">' . |
---|
| 490 | '<h3>' . __('Video disposition') . '</h3>'; |
---|
[2529] | 491 | |
---|
[3874] | 492 | $i_align = [ |
---|
| 493 | 'none' => [__('None'), ($media_img_default_alignment == 'none' ? 1 : 0)], |
---|
| 494 | 'left' => [__('Left'), ($media_img_default_alignment == 'left' ? 1 : 0)], |
---|
| 495 | 'right' => [__('Right'), ($media_img_default_alignment == 'right' ? 1 : 0)], |
---|
| 496 | 'center' => [__('Center'), ($media_img_default_alignment == 'center' ? 1 : 0)] |
---|
| 497 | ]; |
---|
[2529] | 498 | |
---|
[3691] | 499 | echo '<p>'; |
---|
| 500 | foreach ($i_align as $k => $v) { |
---|
| 501 | echo '<label class="classic">' . |
---|
[3874] | 502 | form::radio(['alignment'], $k, $v[1]) . ' ' . $v[0] . '</label><br /> '; |
---|
[3691] | 503 | } |
---|
[2529] | 504 | |
---|
[3691] | 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 | } |
---|
[2529] | 514 | |
---|
[3691] | 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>' . |
---|
[3874] | 519 | form::hidden(['type'], html::escapeHTML($media_type)) . |
---|
| 520 | form::hidden(['title'], html::escapeHTML($file->media_title)) . |
---|
| 521 | form::hidden(['description'], html::escapeHTML($media_desc)) . |
---|
| 522 | form::hidden(['url'], $file->file_url) . |
---|
[3691] | 523 | '</p>'; |
---|
[2093] | 524 | |
---|
[3691] | 525 | echo '</form>'; |
---|
[2529] | 526 | |
---|
[3691] | 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') . '" />' . |
---|
[3874] | 533 | form::hidden(['pref_src'], '') . |
---|
| 534 | form::hidden(['pref_alignment'], '') . |
---|
| 535 | form::hidden(['pref_insertion'], '') . |
---|
| 536 | form::hidden(['pref_legend'], '') . |
---|
[3691] | 537 | $core->adminurl->getHiddenFormFields('admin.media.item', $page_url_params) . |
---|
| 538 | $core->formNonce() . '</p>' . |
---|
| 539 | '</form>' . '</div>'; |
---|
| 540 | } |
---|
[2093] | 541 | |
---|
[3691] | 542 | echo '</div>'; |
---|
[0] | 543 | } |
---|
| 544 | |
---|
[3153] | 545 | if ($popup || $select) { |
---|
[3691] | 546 | echo |
---|
| 547 | '<div class="multi-part" title="' . __('Media details') . '" id="media-details-tab">'; |
---|
[1996] | 548 | } else { |
---|
[3691] | 549 | echo '<h3 class="out-of-screen-if-js">' . __('Media details') . '</h3>'; |
---|
[1996] | 550 | } |
---|
[0] | 551 | echo |
---|
[3691] | 552 | '<p id="media-icon"><img src="' . $file->media_icon . '?' . time() * rand() . '" alt="" /></p>'; |
---|
[0] | 553 | |
---|
| 554 | echo |
---|
[3691] | 555 | '<div id="media-details">' . |
---|
| 556 | '<div class="near-icon">'; |
---|
[0] | 557 | |
---|
[3691] | 558 | if ($file->media_image) { |
---|
| 559 | $thumb_size = !empty($_GET['size']) ? $_GET['size'] : 's'; |
---|
[2529] | 560 | |
---|
[3691] | 561 | if (!isset($core->media->thumb_sizes[$thumb_size]) && $thumb_size != 'o') { |
---|
| 562 | $thumb_size = 's'; |
---|
| 563 | } |
---|
[2529] | 564 | |
---|
[3691] | 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 | } |
---|
[2529] | 577 | |
---|
[3691] | 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, |
---|
[3874] | 582 | ["size" => $s, 'tab' => 'media-details-tab'])) . '">' . $core->media->thumb_sizes[$s][2] . '</a> | '); |
---|
[3691] | 583 | } |
---|
[3874] | 584 | echo '<a href="' . $core->adminurl->get('admin.media.item', array_merge($page_url_params, ["size" => "o", "tab" => "media-details-tab"])) . '">' . __('original') . '</a>'; |
---|
[3691] | 585 | echo '</p>'; |
---|
[3093] | 586 | |
---|
[3691] | 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 | } |
---|
[0] | 604 | } |
---|
| 605 | |
---|
[2767] | 606 | // Show player if relevant |
---|
[3691] | 607 | if ($file_type[0] == 'audio') { |
---|
[3874] | 608 | echo dcMedia::audioPlayer($file->type, $file->file_url, $core->adminurl->get("admin.home", ['pf' => 'player_mp3.swf']), |
---|
[3691] | 609 | null, $core->blog->settings->system->media_flash_fallback); |
---|
[0] | 610 | } |
---|
[3691] | 611 | if ($file_type[0] == 'video') { |
---|
[3874] | 612 | echo dcMedia::videoPlayer($file->type, $file->file_url, $core->adminurl->get("admin.home", ['pf' => 'player_flv.swf']), |
---|
[3691] | 613 | null, $core->blog->settings->system->media_flash_fallback); |
---|
[0] | 614 | } |
---|
| 615 | |
---|
| 616 | echo |
---|
[3691] | 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); |
---|
[3093] | 627 | } |
---|
| 628 | echo |
---|
[3691] | 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>'; |
---|
[0] | 632 | |
---|
[3691] | 633 | if (empty($_GET['find_posts'])) { |
---|
| 634 | echo |
---|
[3874] | 635 | '<p><a class="button" href="' . $core->adminurl->get('admin.media.item', array_merge($page_url_params, ["find_posts" => 1, "tab" => "media-details-tab"])) . '">' . |
---|
[3691] | 636 | __('Show entries containing this media') . '</a></p>'; |
---|
| 637 | } else { |
---|
| 638 | echo '<h3>' . __('Entries containing this media') . '</h3>'; |
---|
[3874] | 639 | $params = [ |
---|
[3691] | 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) . "%' " |
---|
[3874] | 646 | ]; |
---|
[2529] | 647 | |
---|
[3691] | 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 | } |
---|
[2529] | 661 | |
---|
[3691] | 662 | $params['sql'] .= ') '; |
---|
[2529] | 663 | |
---|
[3691] | 664 | $rs = $core->blog->getPosts($params); |
---|
[2529] | 665 | |
---|
[3691] | 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 | } |
---|
[0] | 693 | } |
---|
| 694 | |
---|
[3691] | 695 | if ($file->type == 'image/jpeg') { |
---|
| 696 | echo '<h3>' . __('Image details') . '</h3>'; |
---|
[2529] | 697 | |
---|
[3691] | 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 | } |
---|
[0] | 711 | } |
---|
| 712 | |
---|
[1454] | 713 | echo '</div>'; |
---|
| 714 | |
---|
[3691] | 715 | echo '<h3>' . __('Updates and modifications') . '</h3>'; |
---|
[1499] | 716 | |
---|
[3691] | 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 | } |
---|
[2529] | 728 | |
---|
[3691] | 729 | if ($file->type == 'application/zip') { |
---|
[3874] | 730 | $inflate_combo = [ |
---|
[3691] | 731 | __('Extract in a new directory') => 'new', |
---|
| 732 | __('Extract in current directory') => 'current' |
---|
[3874] | 733 | ]; |
---|
[2529] | 734 | |
---|
[3691] | 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 | } |
---|
[2529] | 751 | |
---|
[3691] | 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>' . |
---|
[3898] | 758 | form::field('media_title', 30, 255, |
---|
| 759 | [ |
---|
| 760 | 'default' => html::escapeHTML($file->media_title), |
---|
| 761 | 'extra_html' => 'lang="' . $core->auth->getInfo('user_lang') . '" spellcheck="true"' |
---|
| 762 | ]) . '</p>' . |
---|
[3691] | 763 | '<p><label for="media_dt">' . __('File date:') . '</label>' . |
---|
[3725] | 764 | form::field('media_dt', 16, 16, html::escapeHTML($file->media_dtstr)) . |
---|
| 765 | /* |
---|
| 766 | Previous line will be replaced by this one as soon as every browser will support datetime-local input type |
---|
| 767 | Dont forget to remove call to datepicker in media_item.js |
---|
| 768 | |
---|
[3874] | 769 | form::datetime('media_dt', ['default' => html::escapeHTML(dt::str('%Y-%m-%dT%H:%M', $file->media_dt))]) . |
---|
[3730] | 770 | */ |
---|
[3725] | 771 | '</p>' . |
---|
[3691] | 772 | '<p><label for="media_private" class="classic">' . form::checkbox('media_private', 1, $file->media_priv) . ' ' . |
---|
| 773 | __('Private') . '</label></p>' . |
---|
| 774 | '<p><label for="media_path">' . __('New directory:') . '</label>' . |
---|
| 775 | form::combo('media_path', $dirs_combo, dirname($file->relname)) . '</p>' . |
---|
| 776 | '<p><input type="submit" accesskey="s" value="' . __('Save') . '" />' . |
---|
| 777 | $core->adminurl->getHiddenFormFields('admin.media.item', $page_url_params) . |
---|
| 778 | $core->formNonce() . '</p>' . |
---|
| 779 | '</form>'; |
---|
[2529] | 780 | |
---|
[3691] | 781 | echo |
---|
| 782 | '<form class="clear fieldset" action="' . $core->adminurl->get("admin.media.item") . '" method="post" enctype="multipart/form-data">' . |
---|
| 783 | '<h4>' . __('Change file') . '</h4>' . |
---|
[3874] | 784 | '<div>' . form::hidden(['MAX_FILE_SIZE'], DC_MAX_UPLOAD_SIZE) . '</div>' . |
---|
[3691] | 785 | '<p><label for="upfile">' . __('Choose a file:') . |
---|
| 786 | ' (' . sprintf(__('Maximum size %s'), files::size(DC_MAX_UPLOAD_SIZE)) . ') ' . |
---|
| 787 | '<input type="file" id="upfile" name="upfile" size="35" />' . |
---|
| 788 | '</label></p>' . |
---|
| 789 | '<p><input type="submit" value="' . __('Send') . '" />' . |
---|
| 790 | $core->adminurl->getHiddenFormFields('admin.media', $page_url_params) . |
---|
| 791 | $core->formNonce() . '</p>' . |
---|
| 792 | '</form>'; |
---|
[0] | 793 | |
---|
[3691] | 794 | if ($file->del) { |
---|
| 795 | echo |
---|
| 796 | '<form id="delete-form" method="post" action="' . $core->adminurl->getBase("admin.media") . '">' . |
---|
| 797 | '<p><input name="delete" type="submit" class="delete" value="' . __('Delete this media') . '" />' . |
---|
| 798 | form::hidden('remove', rawurlencode($file->basename)) . |
---|
| 799 | form::hidden('rmyes', 1) . |
---|
| 800 | $core->adminurl->getHiddenFormFields('admin.media', $media_page_url_params) . |
---|
| 801 | $core->formNonce() . '</p>' . |
---|
| 802 | '</form>'; |
---|
| 803 | } |
---|
[947] | 804 | |
---|
[3691] | 805 | # --BEHAVIOR-- adminMediaItemForm |
---|
| 806 | $core->callBehavior('adminMediaItemForm', $file); |
---|
[0] | 807 | } |
---|
| 808 | |
---|
| 809 | echo |
---|
[3691] | 810 | '</div>'; |
---|
[3153] | 811 | if ($popup || $select) { |
---|
[3691] | 812 | echo |
---|
| 813 | '</div>'; |
---|
[1996] | 814 | } |
---|
[0] | 815 | |
---|
| 816 | call_user_func($close_f); |
---|