function jirafeau_get_max_upload_size_bytes()
{
return min(jirafeau_ini_to_bytes(ini_get('post_max_size')),
function jirafeau_get_max_upload_size_bytes()
{
return min(jirafeau_ini_to_bytes(ini_get('post_max_size')),
- return jirafeau_human_size(
- min(jirafeau_ini_to_bytes(ini_get('post_max_size')),
- jirafeau_ini_to_bytes(ini_get('upload_max_filesize'))));
+ return jirafeau_human_size(jirafeau_get_max_upload_size_bytes());
- echo '<td>' . t('FILENAME') . '</td>';
- echo '<td>' . t('TYPE') . '</td>';
- echo '<td>' . t('SIZE') . '</td>';
- echo '<td>' . t('EXPIRE') . '</td>';
- echo '<td>' . t('ONETIME') . '</td>';
- echo '<td>' . t('UPLOAD_DATE') . '</td>';
- echo '<td>' . t('ORIGIN') . '</td>';
- echo '<td>' . t('ACTION') . '</td>';
+ echo '<th>' . t('FILENAME') . '</th>';
+ echo '<th>' . t('TYPE') . '</th>';
+ echo '<th>' . t('SIZE') . '</th>';
+ echo '<th>' . t('EXPIRE') . '</th>';
+ echo '<th>' . t('ONETIME') . '</th>';
+ echo '<th>' . t('UPLOAD_DATE') . '</th>';
+ echo '<th>' . t('ORIGIN') . '</th>';
+ echo '<th>' . t('ACTION') . '</th>';
+ // Allow if ip is in array (no password)
+ foreach ($cfg['upload_ip_nopassword'] as $i) {
+ if ($i == $ip) {
+ return true;
+ }
+ // CIDR test for IPv4 only.
+ if (strpos ($i, '/') !== false)
+ {
+ list ($subnet, $mask) = explode('/', $i);
+ if ((ip2long ($ip) & ~((1 << (32 - $mask)) - 1) ) == ip2long ($subnet)) {
+ return true;
+ }
+ }
+ }
+