summaryrefslogtreecommitdiff
path: root/inc/media.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-11-08 23:15:08 +0100
committerAndreas Gohr <andi@splitbrain.org>2012-11-08 23:15:08 +0100
commit04924b7a9d090c0814cfff3e6706263e4d5a46e8 (patch)
treed83fc6b5683fbc9c639bfd1832f96dca2f3c8646 /inc/media.php
parent1ea7a6bada66fc9b7a45f61b4892e4ea23196d89 (diff)
parenta731ed1d6736ca405b3559adfd9500affcc59412 (diff)
downloadrpg-04924b7a9d090c0814cfff3e6706263e4d5a46e8.tar.gz
rpg-04924b7a9d090c0814cfff3e6706263e4d5a46e8.tar.bz2
Merge branch 'master' into proxyconnect
* master: (169 commits) added PCRE UTF-8 checks to do=check FS#2636 avoid multiple paralell update checks fix regression bug in HTTPClient FS#2621 changed PAGEUTILS_ID_HIDEPAGE to has BEFORE/AFTER TarLib code cleanup TarLib: fixed appending in non-dynamic mode fixed third method of adding files in TarLib fix lone zero block in TarLib created archives fix use of constructor in TarLib Slovak language update Korean language update Latvian language update added event PAGEUTILS_ID_HIDEPAGE added test for isHiddenPage() removed redundant variables in tpl_include_page() (because of 3ff8773b) added cut off points for mobile devices as parameters to style.ini Corrected typo: ruke -> rule Persian language update Spanish language update russian language update ...
Diffstat (limited to 'inc/media.php')
-rw-r--r--inc/media.php32
1 files changed, 25 insertions, 7 deletions
diff --git a/inc/media.php b/inc/media.php
index 35112f274..6335bf210 100644
--- a/inc/media.php
+++ b/inc/media.php
@@ -296,7 +296,7 @@ function media_upload($ns,$auth,$file=false){
$res = media_save(array('name' => $file['tmp_name'],
'mime' => $imime,
'ext' => $iext), $ns.':'.$id,
- $INPUT->post->bool('ow'), $auth, 'move_uploaded_file');
+ $INPUT->post->bool('ow'), $auth, 'copy_uploaded_file');
if (is_array($res)) {
msg($res[0], $res[1]);
return false;
@@ -305,6 +305,23 @@ function media_upload($ns,$auth,$file=false){
}
/**
+ * An alternative to move_uploaded_file that copies
+ *
+ * Using copy, makes sure any setgid bits on the media directory are honored
+ *
+ * @see move_uploaded_file()
+ * @param string $from
+ * @param string $to
+ * @return bool
+ */
+function copy_uploaded_file($from, $to){
+ if(!is_uploaded_file($from)) return false;
+ $ok = copy($from, $to);
+ @unlink($from);
+ return $ok;
+}
+
+/**
* This generates an action event and delegates to _media_upload_action().
* Action plugins are allowed to pre/postprocess the uploaded file.
* (The triggered event is preventable.)
@@ -646,6 +663,7 @@ function media_tab_files_options(){
global $lang;
global $NS;
global $INPUT;
+ global $ID;
$form = new Doku_Form(array('class' => 'options', 'method' => 'get',
'action' => wl($ID)));
$media_manager_params = media_managerURL(array(), '', false, true);
@@ -1365,9 +1383,9 @@ function media_printfile($item,$auth,$jump,$display_namespace=false){
// output
echo '<div class="'.$zebra.'"'.$jump.' title="'.hsc($item['id']).'">'.NL;
if (!$display_namespace) {
- echo '<a name="h_:'.$item['id'].'" class="'.$class.'">'.hsc($file).'</a> ';
+ echo '<a id="h_:'.$item['id'].'" class="'.$class.'">'.hsc($file).'</a> ';
} else {
- echo '<a name="h_:'.$item['id'].'" class="'.$class.'">'.hsc($item['id']).'</a><br/>';
+ echo '<a id="h_:'.$item['id'].'" class="'.$class.'">'.hsc($item['id']).'</a><br/>';
}
echo '<span class="info">('.$info.')</span>'.NL;
@@ -1431,7 +1449,7 @@ function media_printfile_thumbs($item,$auth,$jump=false,$display_namespace=false
media_printimgdetail($item, true);
} else {
- echo '<a name="d_:'.$item['id'].'" class="image" title="'.$item['id'].'" href="'.
+ 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']);
@@ -1444,7 +1462,7 @@ function media_printfile_thumbs($item,$auth,$jump=false,$display_namespace=false
$name = hsc($item['id']);
}
echo '<dd class="name"><a href="'.media_managerURL(array('image' => hsc($item['id']), 'ns' => getNS($item['id']),
- 'tab_details' => 'view')).'" name="h_:'.$item['id'].'">'.$name.'</a></dd>'.NL;
+ 'tab_details' => 'view')).'" id="h_:'.$item['id'].'">'.$name.'</a></dd>'.NL;
if($item['isimg']){
$size = '';
@@ -1492,7 +1510,7 @@ function media_printimgdetail($item, $fullscreen=false){
// output
if ($fullscreen) {
- echo '<a name="l_:'.$item['id'].'" class="image thumb" href="'.
+ echo '<a id="l_:'.$item['id'].'" class="image thumb" href="'.
media_managerURL(array('image' => hsc($item['id']), 'ns' => getNS($item['id']), 'tab_details' => 'view')).'">';
echo '<img src="'.$src.'" '.$att.' />';
echo '</a>';
@@ -1502,7 +1520,7 @@ function media_printimgdetail($item, $fullscreen=false){
echo '<div class="detail">';
echo '<div class="thumb">';
- echo '<a name="d_:'.$item['id'].'" class="select">';
+ echo '<a id="d_:'.$item['id'].'" class="select">';
echo '<img src="'.$src.'" '.$att.' />';
echo '</a>';
echo '</div>';