Skip to content
Snippets Groups Projects
Commit 365be586 authored by Andreas Gohr's avatar Andreas Gohr
Browse files

replaced str_replace with sprintf in media manager

darcs-hash:20090116220659-7ad00-176afb347702b72fdb75faa3401b5c2c4b50c6a0.gz
parent 666cdec5
No related branches found
No related tags found
No related merge requests found
......@@ -144,19 +144,19 @@ function media_metaform($id,$auth){
* @author Michael Klier <chi@chimeric.de>
*/
function media_inuse($id) {
global $conf;
global $conf;
$mediareferences = array();
if($conf['refcheck']){
require_once(DOKU_INC.'inc/fulltext.php');
$mediareferences = ft_mediause($id,$conf['refshow']);
if(!count($mediareferences)) {
return true;
} else {
return $mediareferences;
}
if(!count($mediareferences)) {
return true;
} else {
return $mediareferences;
}
} else {
return false;
}
return false;
}
}
/**
......@@ -173,34 +173,34 @@ function media_delete($id,$auth){
global $conf;
global $lang;
$file = mediaFN($id);
// trigger an event - MEDIA_DELETE_FILE
$data['id'] = $id;
$data['name'] = basename($file);
$data['path'] = $file;
$data['size'] = (@file_exists($file)) ? filesize($file) : 0;
$data['unl'] = false;
$data['del'] = false;
$evt = new Doku_Event('MEDIA_DELETE_FILE',$data);
if ($evt->advise_before()) {
$data['unl'] = @unlink($file);
if($data['unl']){
$data['del'] = io_sweepNS($id,'mediadir');
}
}
$evt->advise_after();
unset($evt);
if($data['unl'] && $data['del']){
// current namespace was removed. redirecting to root ns passing msg along
header('Location: '.DOKU_URL.'lib/exe/mediamanager.php?msg1='.
rawurlencode(str_replace('%s',noNS($id),$lang['deletesucc'])));
exit;
}
return $data['unl'];
$file = mediaFN($id);
// trigger an event - MEDIA_DELETE_FILE
$data['id'] = $id;
$data['name'] = basename($file);
$data['path'] = $file;
$data['size'] = (@file_exists($file)) ? filesize($file) : 0;
$data['unl'] = false;
$data['del'] = false;
$evt = new Doku_Event('MEDIA_DELETE_FILE',$data);
if ($evt->advise_before()) {
$data['unl'] = @unlink($file);
if($data['unl']){
$data['del'] = io_sweepNS($id,'mediadir');
}
}
$evt->advise_after();
unset($evt);
if($data['unl'] && $data['del']){
// current namespace was removed. redirecting to root ns passing msg along
header('Location: '.DOKU_URL.'lib/exe/mediamanager.php?msg1='.
rawurlencode(sprintf(noNS($id),$lang['deletesucc'])));
exit;
}
return $data['unl'];
}
/**
......@@ -1020,3 +1020,4 @@ function media_resize_imageGD($ext,$from,$from_w,$from_h,$to,$to_w,$to_h,$ofs_x=
return $okay;
}
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
......@@ -80,14 +80,14 @@
$INUSE = media_inuse($DEL);
if(!$INUSE) {
if(media_delete($DEL,$AUTH)) {
msg(str_replace('%s',noNS($id),$lang['deletesucc']),1);
msg(sprintf(noNS($id),$lang['deletesucc']),1);
} else {
msg(str_replace('%s',noNS($DEL),$lang['deletefail']),-1);
msg(sprintf(noNS($DEL),$lang['deletefail']),-1);
}
} else {
} else {
if(!$conf['refshow']) {
unset($INUSE);
msg(str_replace('%s',noNS($DEL),$lang['mediainuse']),0);
msg(sprintf(noNS($DEL),$lang['mediainuse']),0);
}
}
}
......@@ -95,3 +95,5 @@
// finished - start output
header('Content-Type: text/html; charset=utf-8');
include(template('mediamanager.php'));
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment