summaryrefslogtreecommitdiff
path: root/inc/media.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/media.php')
-rw-r--r--inc/media.php27
1 files changed, 12 insertions, 15 deletions
diff --git a/inc/media.php b/inc/media.php
index fbe1363ec..d69426414 100644
--- a/inc/media.php
+++ b/inc/media.php
@@ -90,7 +90,7 @@ function media_metasave($id,$auth,$data){
* @return bool
*/
function media_isexternal($id){
- if (preg_match('#^(https?|ftp)://#i', $id)) return true;
+ if (preg_match('#^(?:https?|ftp)://#i', $id)) return true;
return false;
}
@@ -178,7 +178,7 @@ function media_inuse($id) {
global $conf;
$mediareferences = array();
if($conf['refcheck']){
- $mediareferences = ft_mediause($id,$conf['refshow']);
+ $mediareferences = ft_mediause($id,true);
if(!count($mediareferences)) {
return false;
} else {
@@ -586,7 +586,10 @@ function media_filelist($ns,$auth=null,$jump='',$fullscreenview=false,$sort=fals
// FIXME: print permission warning here instead?
echo '<div class="nothing">'.$lang['nothingfound'].'</div>'.NL;
}else{
- if (!$fullscreenview) media_uploadform($ns, $auth);
+ if (!$fullscreenview) {
+ media_uploadform($ns, $auth);
+ media_searchform($ns);
+ }
$dir = utf8_encodeFN(str_replace(':','/',$ns));
$data = array();
@@ -609,7 +612,6 @@ function media_filelist($ns,$auth=null,$jump='',$fullscreenview=false,$sort=fals
if ($fullscreenview) echo '</ul>'.NL;
}
}
- if (!$fullscreenview) media_searchform($ns);
}
/**
@@ -1294,7 +1296,7 @@ function media_restore($image, $rev, $auth){
* @author Kate Arzamastseva <pshns@ukr.net>
* @triggers MEDIA_SEARCH
*/
-function media_searchlist($query,$ns,$auth=null,$fullscreen=false,$sort=''){
+function media_searchlist($query,$ns,$auth=null,$fullscreen=false,$sort='natural'){
global $conf;
global $lang;
@@ -1314,15 +1316,10 @@ function media_searchlist($query,$ns,$auth=null,$fullscreen=false,$sort=''){
$conf['mediadir'],
'search_media',
array('showmsg'=>false,'pattern'=>$pattern),
- $dir);
+ $dir,
+ 1,
+ $sort);
}
-
- $data = array();
- foreach ($evdata['data'] as $k => $v) {
- $data[$k] = ($sort == 'date') ? $v['mtime'] : $v['id'];
- }
- array_multisort($data, SORT_DESC, SORT_NUMERIC, $evdata['data']);
-
$evt->advise_after();
unset($evt);
}
@@ -1487,7 +1484,7 @@ function media_printfile_thumbs($item,$auth,$jump=false,$display_namespace=false
}
/**
- * Prints a thumbnail and metainfos
+ * Prints a thumbnail and metainfo
*/
function media_printimgdetail($item, $fullscreen=false){
// prepare thumbnail
@@ -1900,7 +1897,7 @@ function media_crop_image($file, $ext, $w, $h=0){
*/
function media_get_token($id,$w,$h){
// token is only required for modified images
- if ($w || $h) {
+ if ($w || $h || media_isexternal($id)) {
$token = $id;
if ($w) $token .= '.'.$w;
if ($h) $token .= '.'.$h;