diff options
Diffstat (limited to 'inc/media.php')
-rw-r--r-- | inc/media.php | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/inc/media.php b/inc/media.php index dc76521c6..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; @@ -501,7 +502,8 @@ function media_saveOldRevision($id){ $date = filemtime($oldf); if (!$conf['mediarevisions']) return $date; - if (!getRevisionInfo($id, $date, 8192, true)) { + $medialog = new MediaChangeLog($id); + if (!$medialog->getRevisionInfo($date)) { // there was an external edit, // there is no log entry for current version of file if (!@file_exists(mediaMetaFN($id,'.changes'))) { @@ -1041,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; @@ -1093,7 +1095,8 @@ function media_diff($image, $ns, $auth, $fromajax = false) { $l_rev = $rev1; }else{ // no revision was given, compare previous to current $r_rev = ''; - $revs = getRevisions($image, 0, 1, 8192, true); + $medialog = new MediaChangeLog($image); + $revs = $medialog->getRevisions(0, 1); if (file_exists(mediaFN($image, $revs[0]))) { $l_rev = $revs[0]; } else { @@ -1223,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>'; @@ -1446,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/'.$ext.'.png')) { - $icon = DOKU_BASE.'lib/images/fileicons/'.$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/file.png'; + $icon = DOKU_BASE.'lib/images/fileicons/'.$size.'/file.png'; } return '<img src="'.$icon.'" alt="'.$filename.'" class="icon" />'; - } /** @@ -1480,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; @@ -1646,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')); |