function node_gallery_upload_file_limits in Node Gallery 6.2
2 calls to node_gallery_upload_file_limits()
File
- ./
node_gallery.pages.inc, line 162 - Node gallery pages.
Code
function node_gallery_upload_file_limits($user, $config) {
$file_limit = $config['upload_limits']['general']['file_max_size'];
$user_limit = $config['upload_limits']['general']['user_max_size'];
$default_number = $config['upload_limits']['general']['user_max_number'];
$all_extensions = explode(' ', $config['upload_limits']['general']['file_extension']);
$resolution = $config['upload_limits']['general']['file_resolution'];
foreach ($user->roles as $rid => $name) {
if (empty($config['upload_limits']['role_' . $rid])) {
continue;
}
/*$extensions = $gconfig['upload_limits']['role_'. $rid]['file_extension'];
$user_extensions = explode(' ', $extensions);
$all_extensions = !empty($user_extensions) ? $user_extensions : (!empty($all_extensions) ? $all_extensions : array('jpg', 'png', 'gif', 'jpeg'));*/
// A zero value indicates no limit, take the least restrictive limit.
$file_size = $config['upload_limits']['role_' . $rid]['file_max_size'];
$file_limit = !empty($file_size) ? $file_size : (!empty($file_limit) ? $file_limit : 0);
$user_size = $config['upload_limits']['role_' . $rid]['user_max_size'];
$user_limit = !empty($user_size) ? $user_size : (!empty($user_limit) ? $user_limit : 0);
$user_number = $config['upload_limits']['role_' . $rid]['user_max_number'];
$default_number = !empty($user_number) ? $user_number : (!empty($default_number) ? $default_number : 0);
}
$all_extensions = implode(' ', array_unique($all_extensions));
return array(
'extensions' => $all_extensions,
'file_size' => $file_limit * 1024 * 1024,
'user_size' => $user_limit * 1024 * 1024,
'resolution' => $resolution,
'max_number' => $default_number,
);
}