Exemplo n.º 1
0
    }
    echo '<a href="' . $core->adminurl->get('admin.media.item', array_merge($page_url_params, array("size" => "o", "tab" => "media-details-tab"))) . '">' . __('original') . '</a>';
    echo '</p>';
    if ($thumb_size != 'o' && isset($file->media_thumb[$thumb_size])) {
        $p = path::info($file->file);
        $alpha = $p['extension'] == 'png' || $p['extension'] == 'PNG';
        $thumb = sprintf($alpha ? $core->media->thumb_tp_alpha : $core->media->thumb_tp, $p['dirname'], $p['base'], '%s');
        $thumb_file = sprintf($thumb, $thumb_size);
        $T = getimagesize($thumb_file);
        $stats = stat($thumb_file);
        echo '<h3>' . __('Thumbnail details') . '</h3>' . '<ul>' . '<li><strong>' . __('Image width:') . '</strong> ' . $T[0] . ' px</li>' . '<li><strong>' . __('Image height:') . '</strong> ' . $T[1] . ' px</li>' . '<li><strong>' . __('File size:') . '</strong> ' . files::size($stats[7]) . '</li>' . '<li><strong>' . __('File URL:') . '</strong> <a href="' . $file->media_thumb[$thumb_size] . '">' . $file->media_thumb[$thumb_size] . '</a></li>' . '</ul>';
    }
}
// Show player if relevant
if ($file_type[0] == 'audio') {
    echo dcMedia::audioPlayer($file->type, $file->file_url, $core->adminurl->get("admin.home", array('pf' => 'player_mp3.swf')), null, $core->blog->settings->system->media_flash_fallback);
}
if ($file_type[0] == 'video') {
    echo dcMedia::videoPlayer($file->type, $file->file_url, $core->adminurl->get("admin.home", array('pf' => 'player_flv.swf')), null, $core->blog->settings->system->media_flash_fallback);
}
echo '<h3>' . __('Media details') . '</h3>' . '<ul>' . '<li><strong>' . __('File owner:') . '</strong> ' . $file->media_user . '</li>' . '<li><strong>' . __('File type:') . '</strong> ' . $file->type . '</li>';
if ($file->media_image) {
    $S = getimagesize($file->file);
    echo '<li><strong>' . __('Image width:') . '</strong> ' . $S[0] . ' px</li>' . '<li><strong>' . __('Image height:') . '</strong> ' . $S[1] . ' px</li>';
    unset($S);
}
echo '<li><strong>' . __('File size:') . '</strong> ' . files::size($file->size) . '</li>' . '<li><strong>' . __('File URL:') . '</strong> <a href="' . $file->file_url . '">' . $file->file_url . '</a></li>' . '</ul>';
if (empty($_GET['find_posts'])) {
    echo '<p><a class="button" href="' . $core->adminurl->get('admin.media.item', array_merge($page_url_params, array("find_posts" => 1, "tab" => "media-details-tab"))) . '">' . __('Show entries containing this media') . '</a></p>';
} else {
    echo '<h3>' . __('Entries containing this media') . '</h3>';
Exemplo n.º 2
0
function mediaItemLine($f, $i, $query, $table = false)
{
    global $core, $page_url, $popup, $select, $post_id, $plugin_id, $page_url_params;
    $fname = $f->basename;
    $file = $query ? $f->relname : $f->basename;
    $class = $table ? '' : 'media-item media-col-' . $i % 2;
    if ($f->d) {
        // Folder
        $link = $core->adminurl->get('admin.media', array_merge($page_url_params, array('d' => html::sanitizeURL($f->relname))));
        if ($f->parent) {
            $fname = '..';
            $class .= ' media-folder-up';
        } else {
            $class .= ' media-folder';
        }
    } else {
        // Item
        $params = new ArrayObject(array('id' => $f->media_id, 'plugin_id' => $plugin_id, 'popup' => $popup, 'select' => $select, 'post_id' => $post_id));
        $core->callBehavior('adminMediaURLParams', $params);
        $params = (array) $params;
        $link = $core->adminurl->get('admin.media.item', $params);
    }
    $maxchars = 36;
    if (strlen($fname) > $maxchars) {
        $fname = substr($fname, 0, $maxchars - 4) . '...' . ($f->d ? '' : files::getExtension($fname));
    }
    $act = '';
    if (!$f->d) {
        if ($select > 0) {
            if ($select == 1) {
                // Single media selection button
                $act .= '<a href="' . $link . '"><img src="images/plus.png" alt="' . __('Select this file') . '" ' . 'title="' . __('Select this file') . '" /></a> ';
            } else {
                // Multiple media selection checkbox
                $act .= form::checkbox(array('medias[]', 'media_' . rawurlencode($file)), $file);
            }
        } else {
            // Item
            if ($post_id) {
                // Media attachment button
                $act .= '<a class="attach-media" title="' . __('Attach this file to entry') . '" href="' . $core->adminurl->get("admin.post.media", array('media_id' => $f->media_id, 'post_id' => $post_id, 'attach' => 1)) . '">' . '<img src="images/plus.png" alt="' . __('Attach this file to entry') . '"/>' . '</a>';
            }
            if ($popup) {
                // Media insertion button
                $act .= '<a href="' . $link . '"><img src="images/plus.png" alt="' . __('Insert this file into entry') . '" ' . 'title="' . __('Insert this file into entry') . '" /></a> ';
            }
        }
    }
    if ($f->del) {
        // Deletion button or checkbox
        if (!$popup && !$f->d) {
            if ($select < 2) {
                // Already set for multiple media selection
                $act .= form::checkbox(array('medias[]', 'media_' . rawurlencode($file)), $file);
            }
        } else {
            $act .= '<a class="media-remove" ' . 'href="' . html::escapeURL($page_url) . '&amp;plugin_id=' . $plugin_id . '&amp;d=' . rawurlencode($GLOBALS['d']) . '&amp;q=' . rawurlencode($GLOBALS['q']) . '&amp;remove=' . rawurlencode($file) . '">' . '<img src="images/trash.png" alt="' . __('Delete') . '" title="' . __('delete') . '" /></a>';
        }
    }
    // Render markup
    if (!$table) {
        $res = '<div class="' . $class . '"><p><a class="media-icon media-link" href="' . rawurldecode($link) . '">' . '<img src="' . $f->media_icon . '" alt="" />' . ($query ? $file : $fname) . '</a></p>';
        $lst = '';
        if (!$f->d) {
            $lst .= '<li>' . $f->media_title . '</li>' . '<li>' . $f->media_dtstr . ' - ' . files::size($f->size) . ' - ' . '<a href="' . $f->file_url . '">' . __('open') . '</a>' . '</li>';
        }
        $lst .= $act != '' ? '<li class="media-action">&nbsp;' . $act . '</li>' : '';
        // Show player if relevant
        $file_type = explode('/', $f->type);
        if ($file_type[0] == 'audio') {
            $lst .= '<li>' . dcMedia::audioPlayer($f->type, $f->file_url, $core->adminurl->get("admin.home", array('pf' => 'player_mp3.swf')), null, $core->blog->settings->system->media_flash_fallback) . '</li>';
        }
        $res .= $lst != '' ? '<ul>' . $lst . '</ul>' : '';
        $res .= '</div>';
    } else {
        $res = '<tr class="' . $class . '">';
        $res .= '<td class="media-action">' . $act . '</td>';
        $res .= '<td class="maximal" scope="row"><a class="media-flag media-link" href="' . rawurldecode($link) . '">' . '<img src="' . $f->media_icon . '" alt="" />' . ($query ? $file : $fname) . '</a>' . '<br />' . ($f->d ? '' : $f->media_title) . '</td>';
        $res .= '<td class="nowrap count">' . ($f->d ? '' : $f->media_dtstr) . '</td>';
        $res .= '<td class="nowrap count">' . ($f->d ? '' : files::size($f->size) . ' - ' . '<a href="' . $f->file_url . '">' . __('open') . '</a>') . '</td>';
        $res .= '</tr>';
    }
    return $res;
}