From 23846a98488bec2aaade6d983b4c0b0db13af80c Mon Sep 17 00:00:00 2001 From: Kate Arzamastseva Date: Sun, 3 Jul 2011 19:00:54 +0300 Subject: ajax mediamanager --- inc/media.php | 64 ++++++++++++++++++++++++----------------------------------- 1 file changed, 26 insertions(+), 38 deletions(-) (limited to 'inc/media.php') diff --git a/inc/media.php b/inc/media.php index 34bdec42b..fd917a5a0 100644 --- a/inc/media.php +++ b/inc/media.php @@ -379,7 +379,7 @@ function media_upload_finish($fn_tmp, $fn, $id, $imime, $overwrite, $move = 'mov io_createNamespace($id, 'media'); if($move($fn_tmp, $fn)) { - clearstatcache(true,$fn); + @clearstatcache(true,$fn); $new = @filemtime($fn); // Set the correct permission here. // Always chmod media because they may be saved with different permissions than expected from the php umask. @@ -529,7 +529,7 @@ function media_filelist($ns,$auth=null,$jump='',$fullscreenview=false){ echo '
'.$lang['nothingfound'].'
'.NL; }else foreach($data as $item){ if (!$fullscreenview) media_printfile($item,$auth,$jump); - else if ($fullscreenview == 'thumbs') media_printfile_thumbs($item,$auth,$jump); + else media_printfile_thumbs($item,$auth,$jump); } } if (!$fullscreenview) media_searchform($ns); @@ -544,9 +544,8 @@ function media_filelist($ns,$auth=null,$jump='',$fullscreenview=false){ function media_tabs_files($selected=false){ global $lang; - echo '
'; - $tab = ''; + $tab = ''.$lang['mediaselect'].''; @@ -579,7 +578,7 @@ function media_tabs_files($selected=false){ function media_tabs_details($image, $selected=false){ global $lang; - echo '
'; + echo '
'; $tab = ''; - echo '
'; + echo '
'; echo ''. $lang['media_thumbsview'].''; @@ -639,24 +638,22 @@ function media_tab_files($ns,$auth=null,$jump='') { global $lang; if(is_null($auth)) $auth = auth_quickaclcheck("$ns:*"); - echo '
'; media_tab_files_options(); - echo '
'; + echo '
'; $view = $_REQUEST['view']; if($auth < AUTH_READ){ echo '
'.$lang['media_perm_read'].'
'.NL; }else{ if ($view == 'list') { - echo '
    '; + echo '
      '; } else { - echo '
        '; + echo '
          '; } - media_filelist($ns,$auth,$jump,'thumbs'); + media_filelist($ns,$auth,$jump,true); echo '
        '; } echo '
'; - echo '
'; } /** @@ -668,7 +665,6 @@ function media_tab_upload($ns,$auth=null,$jump='') { global $lang; if(is_null($auth)) $auth = auth_quickaclcheck("$ns:*"); - echo '
'; echo '
'; echo $lang['mediaupload']; echo '
'; @@ -676,7 +672,6 @@ function media_tab_upload($ns,$auth=null,$jump='') { echo '
'; media_uploadform($ns, $auth, true); echo '
'; - echo '
'; } /** @@ -691,7 +686,6 @@ function media_tab_search($ns,$auth=null) { $query = $_REQUEST['q']; if (!$query) $query = ''; - echo ''; - echo '
'; } /** @@ -715,7 +715,6 @@ function media_tab_view($image, $ns, $auth=null, $rev=false) { global $lang, $conf; if(is_null($auth)) $auth = auth_quickaclcheck("$ns:*"); - echo '
'; echo '
'; echo $image; echo '
'; @@ -724,7 +723,6 @@ function media_tab_view($image, $ns, $auth=null, $rev=false) { media_preview($image, $auth, $rev); media_details($image, $auth, $rev); echo '
'; - echo '
'; } /** @@ -736,7 +734,6 @@ function media_tab_edit($image, $ns, $auth=null) { global $lang; if(is_null($auth)) $auth = auth_quickaclcheck("$ns:*"); - echo '
'; echo '
'; echo $lang['media_edit']; echo '
'; @@ -747,7 +744,6 @@ function media_tab_edit($image, $ns, $auth=null) { if ($mime == 'image/jpeg') media_metaform($image,$auth,true); } echo '
'; - echo '
'; } /** @@ -760,7 +756,6 @@ function media_tab_history($image, $ns, $auth=null) { if(is_null($auth)) $auth = auth_quickaclcheck("$ns:*"); $do = $_REQUEST['mediado']; - echo '
'; echo '
'; echo $lang['media_history']; echo '
'; @@ -777,7 +772,6 @@ function media_tab_history($image, $ns, $auth=null) { echo '
'.$lang['media_perm_read'].'
'.NL; } echo '
'; - echo '
'; } /** @@ -1006,7 +1000,7 @@ function media_searchlist($query,$ns,$auth=null,$fullscreen=false){ echo '
'.$lang['nothingfound'].'
'.NL; }else foreach($evdata['data'] as $item){ if (!$fullscreen) media_printfile($item,$item['perm'],'',true); - else media_printfile_thumbs($item,$item['perm'],'',true); + else media_printfile_thumbs($item,$item['perm']); } } @@ -1106,7 +1100,7 @@ function media_printfile($item,$auth,$jump,$display_namespace=false){ * * @author Kate Arzamastseva */ -function media_printfile_thumbs($item,$auth,$jump){ +function media_printfile_thumbs($item,$auth,$jump=false){ global $lang; global $conf; @@ -1217,18 +1211,11 @@ function media_managerURL($params=false, $amp='&') { global $conf; global $ID; - $url = $_SERVER['REQUEST_URI']; - - $urlArray = explode('?', $url, 2); - $gets = @$urlArray[1]; - parse_str($gets, $gets); - - if ($gets['edit']) $gets['image'] = $gets['edit']; - unset($gets['edit']); - unset($gets['sectok']); - unset($gets['delete']); - unset($gets['rev']); - unset($gets['mediado']); + $gets = array('do' => 'media'); + $media_manager_params = array('tab_files', 'tab_details', 'image', 'ns', 'view'); + foreach ($media_manager_params as $x) { + if (isset($_REQUEST[$x])) $gets[$x] = $_REQUEST[$x]; + } if ($params) { foreach ($params as $k => $v) { @@ -1407,7 +1394,8 @@ function media_nstree_item($item){ $ret = ''; if (!($_REQUEST['do'] == 'media')) $ret .= ''; - else $ret .= ''; + else $ret .= ''; $ret .= $item['label']; $ret .= ''; return $ret; -- cgit v1.2.3