| 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 | /* Upload backend |
|---|
| 14 | -------------------------------------------------------- */ |
|---|
| 15 | if (!empty($_POST['swfupload'])) |
|---|
| 16 | { |
|---|
| 17 | header('content-type: text/plain'); |
|---|
| 18 | try |
|---|
| 19 | { |
|---|
| 20 | if (empty($_POST['sess_id']) || empty($_POST['sess_uid'])) { |
|---|
| 21 | throw new Exception('No credentials.'); |
|---|
| 22 | } |
|---|
| 23 | define('DC_AUTH_SESS_ID',$_POST['sess_id']); |
|---|
| 24 | define('DC_AUTH_SESS_UID',$_POST['sess_uid']); |
|---|
| 25 | |
|---|
| 26 | require dirname(__FILE__).'/../inc/admin/prepend.php'; |
|---|
| 27 | |
|---|
| 28 | if (!$core->auth->check('media,media_admin',$core->blog->id)) { |
|---|
| 29 | throw new Exception('Permission denied.'); |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | $d = isset($_POST['d']) ? $_POST['d'] : null; |
|---|
| 33 | $core->media = new dcMedia($core); |
|---|
| 34 | $core->media->chdir($d); |
|---|
| 35 | $core->media->getDir(); |
|---|
| 36 | $dir =& $core->media->dir; |
|---|
| 37 | |
|---|
| 38 | if (empty($_FILES['Filedata'])) { |
|---|
| 39 | throw new Exception('No file to upload.'); |
|---|
| 40 | } |
|---|
| 41 | |
|---|
| 42 | files::uploadStatus($_FILES['Filedata']); |
|---|
| 43 | $core->media->uploadFile($_FILES['Filedata']['tmp_name'],$_FILES['Filedata']['name']); |
|---|
| 44 | |
|---|
| 45 | echo 'ok'; |
|---|
| 46 | } |
|---|
| 47 | catch (Exception $e) { |
|---|
| 48 | echo __('Error:').' '.__($e->getMessage()); |
|---|
| 49 | } |
|---|
| 50 | exit; |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | /* HTML page |
|---|
| 55 | -------------------------------------------------------- */ |
|---|
| 56 | require dirname(__FILE__).'/../inc/admin/prepend.php'; |
|---|
| 57 | |
|---|
| 58 | dcPage::check('media,media_admin'); |
|---|
| 59 | |
|---|
| 60 | $post_id = !empty($_GET['post_id']) ? (integer) $_GET['post_id'] : null; |
|---|
| 61 | if ($post_id) { |
|---|
| 62 | $post = $core->blog->getPosts(array('post_id'=>$post_id,'post_type'=>'')); |
|---|
| 63 | if ($post->isEmpty()) { |
|---|
| 64 | $post_id = null; |
|---|
| 65 | } |
|---|
| 66 | $post_title = $post->post_title; |
|---|
| 67 | $post_type = $post->post_type; |
|---|
| 68 | unset($post); |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| 71 | $d = isset($_REQUEST['d']) ? $_REQUEST['d'] : null; |
|---|
| 72 | $dir = null; |
|---|
| 73 | |
|---|
| 74 | $page = !empty($_GET['page']) ? $_GET['page'] : 1; |
|---|
| 75 | $nb_per_page = 30; |
|---|
| 76 | |
|---|
| 77 | # We are on home not comming from media manager |
|---|
| 78 | if ($d === null && isset($_SESSION['media_manager_dir'])) { |
|---|
| 79 | # We get session information |
|---|
| 80 | $d = $_SESSION['media_manager_dir']; |
|---|
| 81 | } |
|---|
| 82 | |
|---|
| 83 | if (!isset($_GET['page']) && isset($_SESSION['media_manager_page'])) { |
|---|
| 84 | $page = $_SESSION['media_manager_page']; |
|---|
| 85 | } |
|---|
| 86 | |
|---|
| 87 | # We set session information about directory and page |
|---|
| 88 | if ($d) { |
|---|
| 89 | $_SESSION['media_manager_dir'] = $d; |
|---|
| 90 | } else { |
|---|
| 91 | unset($_SESSION['media_manager_dir']); |
|---|
| 92 | } |
|---|
| 93 | if ($page != 1) { |
|---|
| 94 | $_SESSION['media_manager_page'] = $page; |
|---|
| 95 | } else { |
|---|
| 96 | unset($_SESSION['media_manager_page']); |
|---|
| 97 | } |
|---|
| 98 | |
|---|
| 99 | # Sort combo |
|---|
| 100 | $sort_combo = array( |
|---|
| 101 | __('By names, in ascending order') => 'name-asc', |
|---|
| 102 | __('By names, in descending order') => 'name-desc', |
|---|
| 103 | __('By dates, in ascending order') => 'date-asc', |
|---|
| 104 | __('By dates, in descending order') => 'date-desc' |
|---|
| 105 | ); |
|---|
| 106 | |
|---|
| 107 | if (!empty($_GET['file_sort']) && in_array($_GET['file_sort'],$sort_combo)) { |
|---|
| 108 | $_SESSION['media_file_sort'] = $_GET['file_sort']; |
|---|
| 109 | } |
|---|
| 110 | $file_sort = !empty($_SESSION['media_file_sort']) ? $_SESSION['media_file_sort'] : null; |
|---|
| 111 | |
|---|
| 112 | $popup = (integer) !empty($_GET['popup']); |
|---|
| 113 | |
|---|
| 114 | $page_url = 'media.php?popup='.$popup.'&post_id='.$post_id; |
|---|
| 115 | |
|---|
| 116 | if ($popup) { |
|---|
| 117 | $open_f = array('dcPage','openPopup'); |
|---|
| 118 | $close_f = array('dcPage','closePopup'); |
|---|
| 119 | } else { |
|---|
| 120 | $open_f = array('dcPage','open'); |
|---|
| 121 | $close_f = create_function('',"dcPage::helpBlock('core_media'); dcPage::close();"); |
|---|
| 122 | } |
|---|
| 123 | |
|---|
| 124 | $core_media_writable = false; |
|---|
| 125 | try { |
|---|
| 126 | $core->media = new dcMedia($core); |
|---|
| 127 | if ($file_sort) { |
|---|
| 128 | $core->media->setFileSort($file_sort); |
|---|
| 129 | } |
|---|
| 130 | $core->media->chdir($d); |
|---|
| 131 | $core->media->getDir(); |
|---|
| 132 | $core_media_writable = $core->media->writable(); |
|---|
| 133 | $dir =& $core->media->dir; |
|---|
| 134 | if (!$core_media_writable) { |
|---|
| 135 | throw new Exception('you do not have sufficient permissions to write to this folder: '); |
|---|
| 136 | } |
|---|
| 137 | } catch (Exception $e) { |
|---|
| 138 | $core->error->add($e->getMessage()); |
|---|
| 139 | } |
|---|
| 140 | |
|---|
| 141 | # Zip download |
|---|
| 142 | if (!empty($_GET['zipdl']) && $core->auth->check('media_admin',$core->blog->id)) |
|---|
| 143 | { |
|---|
| 144 | try |
|---|
| 145 | { |
|---|
| 146 | @set_time_limit(300); |
|---|
| 147 | $fp = fopen('php://output','wb'); |
|---|
| 148 | $zip = new fileZip($fp); |
|---|
| 149 | $zip->addExclusion('#(^|/).(.*?)_(m|s|sq|t).jpg$#'); |
|---|
| 150 | $zip->addDirectory($core->media->root.'/'.$d,'',true); |
|---|
| 151 | |
|---|
| 152 | header('Content-Disposition: attachment;filename='.($d ? $d : 'media').'.zip'); |
|---|
| 153 | header('Content-Type: application/x-zip'); |
|---|
| 154 | $zip->write(); |
|---|
| 155 | unset($zip); |
|---|
| 156 | exit; |
|---|
| 157 | } |
|---|
| 158 | catch (Exception $e) |
|---|
| 159 | { |
|---|
| 160 | $core->error->add($e->getMessage()); |
|---|
| 161 | } |
|---|
| 162 | } |
|---|
| 163 | |
|---|
| 164 | # New directory |
|---|
| 165 | if ($dir && !empty($_POST['newdir'])) |
|---|
| 166 | { |
|---|
| 167 | try { |
|---|
| 168 | $core->media->makeDir($_POST['newdir']); |
|---|
| 169 | http::redirect($page_url.'&d='.rawurlencode($d).'&mkdok=1'); |
|---|
| 170 | } catch (Exception $e) { |
|---|
| 171 | $core->error->add($e->getMessage()); |
|---|
| 172 | } |
|---|
| 173 | } |
|---|
| 174 | |
|---|
| 175 | # Adding a file |
|---|
| 176 | if ($dir && !empty($_FILES['upfile'])) |
|---|
| 177 | { |
|---|
| 178 | try |
|---|
| 179 | { |
|---|
| 180 | files::uploadStatus($_FILES['upfile']); |
|---|
| 181 | |
|---|
| 182 | $f_title = (isset($_POST['upfiletitle']) ? $_POST['upfiletitle'] : ''); |
|---|
| 183 | $f_private = (isset($_POST['upfilepriv']) ? $_POST['upfilepriv'] : false); |
|---|
| 184 | |
|---|
| 185 | $core->media->uploadFile($_FILES['upfile']['tmp_name'],$_FILES['upfile']['name'],$f_title,$f_private); |
|---|
| 186 | http::redirect($page_url.'&d='.rawurlencode($d).'&upok=1'); |
|---|
| 187 | } |
|---|
| 188 | catch (Exception $e) |
|---|
| 189 | { |
|---|
| 190 | $core->error->add($e->getMessage()); |
|---|
| 191 | } |
|---|
| 192 | } |
|---|
| 193 | |
|---|
| 194 | |
|---|
| 195 | # Removing item |
|---|
| 196 | if ($dir && !empty($_POST['rmyes']) && !empty($_POST['remove'])) |
|---|
| 197 | { |
|---|
| 198 | $_POST['remove'] = rawurldecode($_POST['remove']); |
|---|
| 199 | |
|---|
| 200 | try { |
|---|
| 201 | $core->media->removeItem($_POST['remove']); |
|---|
| 202 | http::redirect($page_url.'&d='.rawurlencode($d).'&rmfok=1'); |
|---|
| 203 | } catch (Exception $e) { |
|---|
| 204 | $core->error->add($e->getMessage()); |
|---|
| 205 | } |
|---|
| 206 | } |
|---|
| 207 | |
|---|
| 208 | # Rebuild directory |
|---|
| 209 | if ($dir && $core->auth->isSuperAdmin() && !empty($_POST['rebuild'])) |
|---|
| 210 | { |
|---|
| 211 | try { |
|---|
| 212 | $core->media->rebuild($d); |
|---|
| 213 | http::redirect($page_url.'&d='.rawurlencode($d).'&rebuildok=1'); |
|---|
| 214 | } catch (Exception $e) { |
|---|
| 215 | $core->error->add($e->getMessage()); |
|---|
| 216 | } |
|---|
| 217 | } |
|---|
| 218 | |
|---|
| 219 | |
|---|
| 220 | # DISPLAY confirm page for rmdir & rmfile |
|---|
| 221 | if ($dir && !empty($_GET['remove'])) |
|---|
| 222 | { |
|---|
| 223 | call_user_func($open_f,__('Media manager')); |
|---|
| 224 | |
|---|
| 225 | echo '<h2>'.html::escapeHTML($core->blog->name).' › '.__('Media manager').' › '.__('confirm removal').'</h2>'; |
|---|
| 226 | |
|---|
| 227 | echo |
|---|
| 228 | '<form action="'.html::escapeURL($page_url).'" method="post">'. |
|---|
| 229 | '<p>'.sprintf(__('Are you sure you want to remove %s?'), |
|---|
| 230 | html::escapeHTML($_GET['remove'])).'</p>'. |
|---|
| 231 | '<p><input type="submit" value="'.__('cancel').'" /> '. |
|---|
| 232 | ' <input type="submit" name="rmyes" value="'.__('yes').'" />'. |
|---|
| 233 | form::hidden('d',$d). |
|---|
| 234 | $core->formNonce(). |
|---|
| 235 | form::hidden('remove',html::escapeHTML($_GET['remove'])).'</p>'. |
|---|
| 236 | '</form>'; |
|---|
| 237 | |
|---|
| 238 | call_user_func($close_f); |
|---|
| 239 | exit; |
|---|
| 240 | } |
|---|
| 241 | |
|---|
| 242 | /* DISPLAY Main page |
|---|
| 243 | -------------------------------------------------------- */ |
|---|
| 244 | call_user_func($open_f,__('Media manager'), |
|---|
| 245 | dcPage::jsLoad('js/_media.js'). |
|---|
| 246 | ($core_media_writable ? dcPage::jsCandyUpload(array('d='.$d)) : '')); |
|---|
| 247 | |
|---|
| 248 | if (!empty($_GET['mkdok'])) { |
|---|
| 249 | echo '<p class="message">'.__('Directory has been successfully created.').'</p>'; |
|---|
| 250 | } |
|---|
| 251 | |
|---|
| 252 | if (!empty($_GET['upok'])) { |
|---|
| 253 | echo '<p class="message">'.__('Files have been successfully uploaded.').'</p>'; |
|---|
| 254 | } |
|---|
| 255 | |
|---|
| 256 | if (!empty($_GET['rmfok'])) { |
|---|
| 257 | echo '<p class="message">'.__('File has been successfully removed.').'</p>'; |
|---|
| 258 | } |
|---|
| 259 | |
|---|
| 260 | if (!empty($_GET['rmdok'])) { |
|---|
| 261 | echo '<p class="message">'.__('Directory has been successfully removed.').'</p>'; |
|---|
| 262 | } |
|---|
| 263 | |
|---|
| 264 | if (!empty($_GET['rebuildok'])) { |
|---|
| 265 | echo '<p class="message">'.__('Directory has been successfully rebuilt.').'</p>'; |
|---|
| 266 | } |
|---|
| 267 | |
|---|
| 268 | if (!empty($_GET['unzipok'])) { |
|---|
| 269 | echo '<p class="message">'.__('Zip file has been successfully extracted.').'</p>'; |
|---|
| 270 | } |
|---|
| 271 | |
|---|
| 272 | echo '<h2>'.html::escapeHTML($core->blog->name).' › <a href="'.html::escapeURL($page_url.'&d=').'">'.__('Media manager').'</a>'. |
|---|
| 273 | ' / '.(isset($core->media) ? $core->media->breadCrumb(html::escapeURL($page_url).'&d=%s') : '').'</h2>'; |
|---|
| 274 | |
|---|
| 275 | if (!$dir) { |
|---|
| 276 | call_user_func($close_f); |
|---|
| 277 | exit; |
|---|
| 278 | } |
|---|
| 279 | |
|---|
| 280 | if ($post_id) { |
|---|
| 281 | echo '<p><strong>'.sprintf(__('Choose a file to attach to entry %s by clicking on %s.'), |
|---|
| 282 | '<a href="'.$core->getPostAdminURL($post_type,$post_id).'">'.html::escapeHTML($post_title).'</a>', |
|---|
| 283 | '<img src="images/plus.png" alt="'.__('Attach this file to entry').'" />').'</strong></p>'; |
|---|
| 284 | } |
|---|
| 285 | if ($popup) { |
|---|
| 286 | echo '<p><strong>'.sprintf(__('Choose a file to insert into entry by clicking on %s.'), |
|---|
| 287 | '<img src="images/plus.png" alt="'.__('Attach this file to entry').'" />').'</strong></p>'; |
|---|
| 288 | } |
|---|
| 289 | |
|---|
| 290 | |
|---|
| 291 | $items = array_values(array_merge($dir['dirs'],$dir['files'])); |
|---|
| 292 | if (count($items) == 0) |
|---|
| 293 | { |
|---|
| 294 | echo '<p><strong>'.__('No file.').'</strong></p>'; |
|---|
| 295 | } |
|---|
| 296 | else |
|---|
| 297 | { |
|---|
| 298 | $pager = new pager($page,count($items),$nb_per_page,10); |
|---|
| 299 | $pager->html_prev = __($pager->html_prev); |
|---|
| 300 | $pager->html_next = __($pager->html_next); |
|---|
| 301 | |
|---|
| 302 | echo |
|---|
| 303 | '<form action="media.php" method="get">'. |
|---|
| 304 | '<p><label for="file_sort" class="classic">'.__('Sort files:').' '. |
|---|
| 305 | form::combo('file_sort',$sort_combo,$file_sort).'</label>'. |
|---|
| 306 | form::hidden(array('popup'),$popup). |
|---|
| 307 | form::hidden(array('post_id'),$post_id). |
|---|
| 308 | '<input type="submit" value="'.__('ok').'" /></p>'. |
|---|
| 309 | '</form>'. |
|---|
| 310 | |
|---|
| 311 | '<div class="media-list">'. |
|---|
| 312 | '<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>'; |
|---|
| 313 | |
|---|
| 314 | for ($i=$pager->index_start, $j=0; $i<=$pager->index_end; $i++, $j++) |
|---|
| 315 | { |
|---|
| 316 | echo mediaItemLine($items[$i],$j); |
|---|
| 317 | } |
|---|
| 318 | |
|---|
| 319 | echo |
|---|
| 320 | '<p class="clear">'.__('Page(s)').' : '.$pager->getLinks().'</p>'. |
|---|
| 321 | '</div>'; |
|---|
| 322 | } |
|---|
| 323 | |
|---|
| 324 | if ($core_media_writable) |
|---|
| 325 | { |
|---|
| 326 | echo '<div class="two-cols">'; |
|---|
| 327 | |
|---|
| 328 | echo |
|---|
| 329 | '<div class="col"><h3 id="add-file">'.__('Add files').'</h3>'. |
|---|
| 330 | '<form id="media-upload" class="clear" action="'.html::escapeURL($page_url).'" method="post" enctype="multipart/form-data">'. |
|---|
| 331 | '<div>'.form::hidden(array('MAX_FILE_SIZE'),DC_MAX_UPLOAD_SIZE). |
|---|
| 332 | $core->formNonce().'</div>'. |
|---|
| 333 | '<fieldset id="add-file-f">'. |
|---|
| 334 | '<p><label for="upfile">'.__('Choose a file:'). |
|---|
| 335 | ' ('.sprintf(__('Maximum size %s'),files::size(DC_MAX_UPLOAD_SIZE)).')'. |
|---|
| 336 | '<input type="file" id="upfile" name="upfile" size="20" />'. |
|---|
| 337 | '</label></p>'. |
|---|
| 338 | '<p><label for="upfiletitle">'.__('Title:').form::field(array('upfiletitle'),35,255).'</label></p>'. |
|---|
| 339 | '<p><label for="upfilepriv" class="classic">'.form::checkbox(array('upfilepriv'),1).' '. |
|---|
| 340 | __('Private').'</label></p>'. |
|---|
| 341 | '<p><input type="submit" value="'.__('send').'" />'. |
|---|
| 342 | form::hidden(array('d'),$d).'</p>'. |
|---|
| 343 | '</fieldset>'. |
|---|
| 344 | '</form>'. |
|---|
| 345 | '<p class="form-note">'.__('Please take care to publish media that you own and that are not protected by copyright.').'</p>'. |
|---|
| 346 | '</div>'; |
|---|
| 347 | |
|---|
| 348 | echo |
|---|
| 349 | '<div class="col"><h3 id="new-dir">'.__('New directory').'</h3>'. |
|---|
| 350 | '<form class="clear" action="'.html::escapeURL($page_url).'" method="post">'. |
|---|
| 351 | '<fieldset id="new-dir-f">'. |
|---|
| 352 | $core->formNonce(). |
|---|
| 353 | '<p><label for="newdir">'.__('Directory Name:'). |
|---|
| 354 | form::field(array('newdir'),35,255).'</label></p>'. |
|---|
| 355 | '<p><input type="submit" value="'.__('save').'" />'. |
|---|
| 356 | form::hidden(array('d'),html::escapeHTML($d)).'</p>'. |
|---|
| 357 | '</fieldset>'. |
|---|
| 358 | '</form></div>'; |
|---|
| 359 | |
|---|
| 360 | echo '</div>'; |
|---|
| 361 | } |
|---|
| 362 | |
|---|
| 363 | # Empty remove form (for javascript actions) |
|---|
| 364 | echo |
|---|
| 365 | '<form id="media-remove-hide" action="'.html::escapeURL($page_url).'" method="post"><div class="clear">'. |
|---|
| 366 | form::hidden('rmyes',1).form::hidden('d',html::escapeHTML($d)). |
|---|
| 367 | form::hidden('remove',''). |
|---|
| 368 | $core->formNonce(). |
|---|
| 369 | '</div></form>'; |
|---|
| 370 | |
|---|
| 371 | # Get zip directory |
|---|
| 372 | if ($core->auth->check('media_admin',$core->blog->id) && |
|---|
| 373 | !(count($items) == 0 || (count($items) == 1 && $items[0]->parent))) |
|---|
| 374 | { |
|---|
| 375 | echo |
|---|
| 376 | '<p class="zip-dl"><a href="'.html::escapeURL($page_url).'&zipdl=1">'. |
|---|
| 377 | __('Download this directory as a zip file').'</a></p>'; |
|---|
| 378 | } |
|---|
| 379 | |
|---|
| 380 | call_user_func($close_f); |
|---|
| 381 | |
|---|
| 382 | /* ----------------------------------------------------- */ |
|---|
| 383 | function mediaItemLine($f,$i) |
|---|
| 384 | { |
|---|
| 385 | global $core, $page_url, $popup, $post_id; |
|---|
| 386 | |
|---|
| 387 | $fname = $f->basename; |
|---|
| 388 | |
|---|
| 389 | if ($f->d) { |
|---|
| 390 | $link = html::escapeURL($page_url).'&d='.html::sanitizeURL($f->relname); |
|---|
| 391 | if ($f->parent) { |
|---|
| 392 | $fname = '..'; |
|---|
| 393 | } |
|---|
| 394 | } else { |
|---|
| 395 | $link = |
|---|
| 396 | 'media_item.php?id='.$f->media_id.'&popup='.$popup.'&post_id='.$post_id; |
|---|
| 397 | } |
|---|
| 398 | |
|---|
| 399 | $class = 'media-item media-col-'.($i%2); |
|---|
| 400 | |
|---|
| 401 | $res = |
|---|
| 402 | '<div class="'.$class.'"><a class="media-icon media-link" href="'.$link.'">'. |
|---|
| 403 | '<img src="'.$f->media_icon.'" alt="" /></a>'. |
|---|
| 404 | '<ul>'. |
|---|
| 405 | '<li><a class="media-link" href="'.$link.'">'.$fname.'</a></li>'; |
|---|
| 406 | |
|---|
| 407 | if (!$f->d) { |
|---|
| 408 | $res .= |
|---|
| 409 | '<li>'.$f->media_title.'</li>'. |
|---|
| 410 | '<li>'. |
|---|
| 411 | $f->media_dtstr.' - '. |
|---|
| 412 | files::size($f->size).' - '. |
|---|
| 413 | '<a href="'.$f->file_url.'">'.__('open').'</a>'. |
|---|
| 414 | '</li>'; |
|---|
| 415 | } |
|---|
| 416 | |
|---|
| 417 | $res .= '<li class="media-action"> '; |
|---|
| 418 | |
|---|
| 419 | if ($post_id && !$f->d) { |
|---|
| 420 | $res .= '<form action="post_media.php" method="post">'. |
|---|
| 421 | '<input type="image" src="images/plus.png" alt="'.__('Attach this file to entry').'" '. |
|---|
| 422 | 'title="'.__('Attach this file to entry').'" /> '. |
|---|
| 423 | form::hidden('media_id',$f->media_id). |
|---|
| 424 | form::hidden('post_id',$post_id). |
|---|
| 425 | form::hidden('attach',1). |
|---|
| 426 | $core->formNonce(). |
|---|
| 427 | '</form>'; |
|---|
| 428 | } |
|---|
| 429 | |
|---|
| 430 | if ($popup && !$f->d) { |
|---|
| 431 | $res .= '<a href="'.$link.'"><img src="images/plus.png" alt="'.__('Insert this file into entry').'" '. |
|---|
| 432 | 'title="'.__('Insert this file into entry').'" /></a> '; |
|---|
| 433 | } |
|---|
| 434 | |
|---|
| 435 | if ($f->del) { |
|---|
| 436 | $res .= '<a class="media-remove" '. |
|---|
| 437 | 'href="'.html::escapeURL($page_url).'&d='. |
|---|
| 438 | rawurlencode($GLOBALS['d']).'&remove='.rawurlencode($f->basename).'">'. |
|---|
| 439 | '<img src="images/trash.png" alt="'.__('delete').'" title="'.__('delete').'" /></a>'; |
|---|
| 440 | } |
|---|
| 441 | |
|---|
| 442 | $res .= '</li>'; |
|---|
| 443 | |
|---|
| 444 | if ($f->type == 'audio/mpeg3') { |
|---|
| 445 | $res .= '<li>'.dcMedia::mp3player($f->file_url,'index.php?pf=player_mp3.swf').'</li>'; |
|---|
| 446 | } |
|---|
| 447 | |
|---|
| 448 | $res .= '</ul></div>'; |
|---|
| 449 | |
|---|
| 450 | return $res; |
|---|
| 451 | } |
|---|
| 452 | ?> |
|---|