diff options
Diffstat (limited to 'inc/media.php')
-rw-r--r-- | inc/media.php | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/inc/media.php b/inc/media.php index af4647ecb..c53e1f5fc 100644 --- a/inc/media.php +++ b/inc/media.php @@ -230,16 +230,18 @@ function media_upload_xhr($ns,$auth){ $id = $_GET['qqfile']; list($ext,$mime,$dl) = mimetype($id); $input = fopen("php://input", "r"); - $temp = tmpfile(); - $realSize = stream_copy_to_stream($input, $temp); - fclose($input); - if ($realSize != (int)$_SERVER["CONTENT_LENGTH"]) return false; if (!($tmp = io_mktmpdir())) return false; $path = $tmp.'/'.md5($id); $target = fopen($path, "w"); - fseek($temp, 0, SEEK_SET); - stream_copy_to_stream($temp, $target); + $realSize = stream_copy_to_stream($input, $target); fclose($target); + fclose($input); + if ($realSize != (int)$_SERVER["CONTENT_LENGTH"]){ + unlink($target); + unlink($path); + return false; + } + $res = media_save( array('name' => $path, 'mime' => $mime, @@ -757,7 +759,7 @@ function media_tab_search($ns,$auth=null) { echo '<div class="search">'.NL; media_searchform($ns, $query, true); - if ($do == 'searchlist') { + if ($do == 'searchlist' || $query) { media_searchlist($query,$ns,$auth,true,_media_get_sort_type()); } echo '</div>'.NL; @@ -830,6 +832,7 @@ function media_preview($image, $auth, $rev=false, $meta=false) { $size = media_image_preview_size($image, $rev, $meta); if ($size) { + global $lang; echo '<div class="image">'; $more = array(); @@ -843,7 +846,10 @@ function media_preview($image, $auth, $rev=false, $meta=false) { $more['w'] = $size[0]; $more['h'] = $size[1]; $src = ml($image, $more); + + echo '<a href="'.$src.'" target="_blank" title="'.$lang['mediaview'].'">'; echo '<img src="'.$src.'" alt="" style="max-width: '.$size[0].'px;" />'; + echo '</a>'; echo '</div>'.NL; } @@ -1350,7 +1356,7 @@ function media_printfile($item,$auth,$jump,$display_namespace=false){ $info .= filesize_h($item['size']); // output - echo '<div class="'.$zebra.'"'.$jump.'>'.NL; + echo '<div class="'.$zebra.'"'.$jump.' title="'.hsc($item['id']).'">'.NL; if (!$display_namespace) { echo '<a name="h_:'.$item['id'].'" class="'.$class.'">'.hsc($file).'</a> '; } else { @@ -1411,7 +1417,7 @@ function media_printfile_thumbs($item,$auth,$jump=false,$display_namespace=false $file = utf8_decodeFN($item['file']); // output - echo '<li><dl>'.NL; + echo '<li><dl title="'.hsc($item['id']).'">'.NL; echo '<dt>'; if($item['isimg']) { |