diff --git a/e107_admin/filemanager.php b/e107_admin/filemanager.php index 02856d3aa..a27260ca2 100644 --- a/e107_admin/filemanager.php +++ b/e107_admin/filemanager.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/filemanager.php,v $ -| $Revision: 1.3 $ -| $Date: 2008-04-01 20:06:24 $ +| $Revision: 1.4 $ +| $Date: 2008-05-25 09:04:16 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -23,6 +23,7 @@ if (!getperms("6")) { } $e_sub_cat = 'filemanage'; require_once("auth.php"); +require_once(e_HANDLER.'upload_handler.php'); $pubfolder = (str_replace("../","",e_QUERY) == str_replace("../","",e_FILE."public/")) ? TRUE : FALSE; @@ -204,9 +205,13 @@ $text .= "\n $ns->tablerender(FMLAN_34, $text); +// Get largest allowable file upload +$max_file_size = get_user_max_upload(); + + $text = "
- + "; $text .= " @@ -356,26 +361,6 @@ function dirsize($dir) { return parsesize($size); } -function parsesize($size) { - $kb = 1024; - $mb = 1024 * $kb; - $gb = 1024 * $mb; - $tb = 1024 * $gb; - if ($size < $kb) { - return $size." b"; - } - else if($size < $mb) { - return round($size/$kb, 2)." kb"; - } - else if($size < $gb) { - return round($size/$mb, 2)." mb"; - } - else if($size < $tb) { - return round($size/$gb, 2)." gb"; - } else { - return round($size/$tb, 2)." tb"; - } -} require_once("footer.php"); ?> \ No newline at end of file diff --git a/e107_admin/plugin.php b/e107_admin/plugin.php index 72da2fa56..81a9b4dc3 100644 --- a/e107_admin/plugin.php +++ b/e107_admin/plugin.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/plugin.php,v $ -| $Revision: 1.15 $ -| $Date: 2008-04-05 07:58:30 $ +| $Revision: 1.16 $ +| $Date: 2008-05-25 09:04:16 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -418,13 +418,17 @@ if(!is_writable(e_PLUGIN)) } else { - $text = "
+ // Get largest allowable file upload + require_once(e_HANDLER.'upload_handler.php'); + $max_file_size = get_user_max_upload(); + + $text = "
diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index d70644a0d..029c49516 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/theme_handler.php,v $ -| $Revision: 1.8 $ -| $Date: 2008-04-10 19:23:41 $ +| $Revision: 1.9 $ +| $Date: 2008-05-25 09:04:16 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -251,13 +251,18 @@ class themeHandler{ if(!is_writable(e_THEME)) { $ns->tablerender(TPVLAN_16, TPVLAN_15); $text = ""; - } else { - $text = "
+ } + else + { + require_once(e_HANDLER.'upload_handler.php'); + $max_file_size = get_user_max_upload(); + + $text = "
".EPL_ADLAN_37." - +
diff --git a/e107_handlers/upload_handler.php b/e107_handlers/upload_handler.php index 293b66536..dbc571149 100644 --- a/e107_handlers/upload_handler.php +++ b/e107_handlers/upload_handler.php @@ -12,20 +12,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/upload_handler.php,v $ -| $Revision: 1.13 $ -| $Date: 2008-04-22 20:32:40 $ +| $Revision: 1.14 $ +| $Date: 2008-05-25 09:04:16 $ | $Author: e107steved $ - - -********** TEST VERSION DOES INTERMEDIATE COPY *************** -Unaltered code to: - V0.7.x File V1.33 - V0.8.x File V1.12 - -To do: - 1. Criteria for intermediate copy - 2. Make get_file_types compatible with XML counterpart - array of filetype/max size - 3. Check sizes - may be different for various file types for non-admin user, for example +---------------------------------------------------------------+ */ @@ -821,4 +810,15 @@ function set_max_size(&$allowed_filetypes, $max_upload_size) } + +// Quick routine if all we want is the size of the largest file the current user can upload +function get_user_max_upload() +{ + $a_filetypes = get_filetypes(); + if (count($a_filetypes) == 0) return 0; // Return if no upload allowed + $max_upload_size = calc_max_upload_size(-1); // Find overriding maximum upload size + $max_upload_size = set_max_size($a_filetypes, $max_upload_size); + return $max_upload_size; +} + ?> \ No newline at end of file
".TPVLAN_13." - +