"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/action/upload.php" between
wacko.6.1.18.zip and wacko.6.1.19.zip

About: WackoWiki is a multilingual Wiki-engine that supports WYTIWYG-editing, page rights (ACLs), design themes (skins), file upload, email notification and much more.

upload.php  (wacko.6.1.18):upload.php  (wacko.6.1.19)
skipping to change at line 19 skipping to change at line 19
{{upload {{upload
[global=1] [global=1]
[maxsize=200] [maxsize=200]
[hide_description=1] [hide_description=1]
}} }}
*/ */
// set defaults // set defaults
$global ??= 0; $global ??= 0;
$hide_description ??= ''; $hide_description ??= '';
$maxsize ??= ''; $maxsize ??= null;
if ($global) $global = 'global'; if ($global) $global = 'global';
// functions
$accept_types = function($types)
{
$accept_types = array_map('trim', explode(',', $types));
foreach($accept_types as $type)
{
if ($this->validate_extension($type))
{
$result[] = '.' . $type;
}
}
return implode(',', $result);
};
// check who u are, can u upload? // check who u are, can u upload?
if ($this->can_upload(true)) if ($this->can_upload(true))
{ {
if ($maxsize) if ($maxsize)
{ {
$tpl->u_s_maxsize = floor(1 * $maxsize); $tpl->u_s_maxsize = floor(1 * $maxsize);
} }
// if you have no write access and you are not admin, you can upload only "global" file // if you have no write access and you are not admin, you can upload only "global" file
if (!( $this->has_access('read') if (!( $this->has_access('read')
&& $this->has_access('write') && $this->has_access('write')
&& $this->has_access('upload')) && $this->has_access('upload'))
&& !$this->is_admin()) && !$this->is_admin())
{ {
$global = 'global'; $global = 'global';
} }
$maxfilesize = $this->db->upload_max_size; $maxfilesize = $this->get_max_upload_size();
$allowed_types = $this->db->upload_allowed_exts ?? '';
if ($maxsize && ($maxfilesize > 1 * $maxsize)) if ($maxsize && ($maxfilesize > 1 * $maxsize))
{ {
$maxfilesize = 1 * $maxsize; $maxfilesize = 1 * $maxsize;
} }
$tpl->u_maxfilesize = $maxfilesize; $tpl->u_maxfilesize = $maxfilesize;
// adds 'accept' attribute depending on config settings if ($this->db->upload_images_only && !$this->is_admin())
// https://www.w3.org/TR/html5/forms.html#attr-input-accept {
if ($this->db->upload_images_only) $allowed_types = implode(', ' , self::EXT['bitmap']);
}
if ($allowed_types)
{ {
$tpl->u_accecpt = 'accept=".avif,.gif,.jpg,.jxl,.png,.svg,.webp,i // adds 'accept' attribute depending on config settings
mage/avif,image/gif,image/jpeg,image/jxl,image/png,image/svg+xml,image/webp"'; // https://www.w3.org/TR/html5/forms.html#attr-input-accept
$tpl->u_accecpt = 'accept="' . $accept_types($allowed_types) . '"
';
$tpl->u_allowed = Ut::perc_replace($this->_t('PermittedFiletype')
, $allowed_types);
} }
$tpl->u_size = $this->binary_multiples($maxfilesize, false, true, true); $tpl->u_size = $this->binary_multiples($maxfilesize, false, true, true);
if ($global) if ($global)
{ {
$tpl->u_global = true; $tpl->u_global = true;
} }
else else
{ {
 End of changes. 6 change blocks. 
8 lines changed or deleted 32 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)