summaryrefslogtreecommitdiff
path: root/inc/media.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/media.php')
-rw-r--r--inc/media.php29
1 files changed, 18 insertions, 11 deletions
diff --git a/inc/media.php b/inc/media.php
index 2c1a3e8eb..9022858e1 100644
--- a/inc/media.php
+++ b/inc/media.php
@@ -203,7 +203,7 @@ define('DOKU_MEDIA_EMPTY_NS', 8);
*
* @author Andreas Gohr <andi@splitbrain.org>
* @param string $id media id
- * @param int $auth current auth check result
+ * @param int $auth no longer used
* @return int One of: 0,
* DOKU_MEDIA_DELETED,
* DOKU_MEDIA_DELETED | DOKU_MEDIA_EMPTY_NS,
@@ -212,6 +212,7 @@ define('DOKU_MEDIA_EMPTY_NS', 8);
*/
function media_delete($id,$auth){
global $lang;
+ $auth = auth_quickaclcheck(ltrim(getNS($id).':*', ':'));
if($auth < AUTH_DELETE) return DOKU_MEDIA_NOT_AUTH;
if(media_inuse($id)) return DOKU_MEDIA_INUSE;
@@ -1042,7 +1043,7 @@ function media_details($image, $auth, $rev=false, $meta=false) {
foreach($tags as $tag){
if ($tag['value']) {
$value = cleanText($tag['value']);
- echo '<dt>'.$lang[$tag['tag'][1]].':</dt><dd>';
+ echo '<dt>'.$lang[$tag['tag'][1]].'</dt><dd>';
if ($tag['tag'][2] == 'date') echo dformat($value);
else echo hsc($value);
echo '</dd>'.NL;
@@ -1225,7 +1226,7 @@ function media_file_diff($image, $l_rev, $r_rev, $ns, $auth, $fromajax){
foreach($tags as $tag){
$value = cleanText($tag['value']);
if (!$value) $value = '-';
- echo '<dt>'.$lang[$tag['tag'][1]].':</dt>';
+ echo '<dt>'.$lang[$tag['tag'][1]].'</dt>';
echo '<dd>';
if ($tag['highlighted']) {
echo '<strong>';
@@ -1448,17 +1449,23 @@ function media_printfile($item,$auth,$jump,$display_namespace=false){
echo '</div>'.NL;
}
-function media_printicon($filename){
+/**
+ * Display a media icon
+ *
+ * @param $filename
+ * @param string $size the size subfolder, if not specified 16x16 is used
+ * @return string
+ */
+function media_printicon($filename, $size=''){
list($ext) = mimetype(mediaFN($filename),false);
- if (@file_exists(DOKU_INC.'lib/images/fileicons/32x32/'.$ext.'.png')) {
- $icon = DOKU_BASE.'lib/images/fileicons/32x32/'.$ext.'.png';
+ if (@file_exists(DOKU_INC.'lib/images/fileicons/'.$size.'/'.$ext.'.png')) {
+ $icon = DOKU_BASE.'lib/images/fileicons/'.$size.'/'.$ext.'.png';
} else {
- $icon = DOKU_BASE.'lib/images/fileicons/32x32/file.png';
+ $icon = DOKU_BASE.'lib/images/fileicons/'.$size.'/file.png';
}
return '<img src="'.$icon.'" alt="'.$filename.'" class="icon" />';
-
}
/**
@@ -1482,7 +1489,7 @@ function media_printfile_thumbs($item,$auth,$jump=false,$display_namespace=false
echo '<a id="d_:'.$item['id'].'" class="image" title="'.$item['id'].'" href="'.
media_managerURL(array('image' => hsc($item['id']), 'ns' => getNS($item['id']),
'tab_details' => 'view')).'">';
- echo media_printicon($item['id']);
+ echo media_printicon($item['id'], '32x32');
echo '</a>';
}
echo '</dt>'.NL;
@@ -1648,10 +1655,10 @@ function media_uploadform($ns, $auth, $fullscreen = false){
$form->addElement(formSecurityToken());
$form->addHidden('ns', hsc($ns));
$form->addElement(form_makeOpenTag('p'));
- $form->addElement(form_makeFileField('upload', $lang['txt_upload'].':', 'upload__file'));
+ $form->addElement(form_makeFileField('upload', $lang['txt_upload'], 'upload__file'));
$form->addElement(form_makeCloseTag('p'));
$form->addElement(form_makeOpenTag('p'));
- $form->addElement(form_makeTextField('mediaid', noNS($id), $lang['txt_filename'].':', 'upload__name'));
+ $form->addElement(form_makeTextField('mediaid', noNS($id), $lang['txt_filename'], 'upload__name'));
$form->addElement(form_makeButton('submit', '', $lang['btn_upload']));
$form->addElement(form_makeCloseTag('p'));