X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/blobdiff_plain/4e0365d789b224bb0cf31e7a92162e05d08c79f3..9cc17fe0ab37c643201faaa3879740bdb1937dc6:/lib/functions.php?ds=sidebyside diff --git a/lib/functions.php b/lib/functions.php index cf6b913..c234f4c 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -25,9 +25,16 @@ */ function s2p($s) { + $block_size = 8; $p = ''; for ($i = 0; $i < strlen($s); $i++) { - $p .= $s{$i} . '/'; + $p .= $s{$i}; + if (($i + 1) % $block_size == 0) { + $p .= '/'; + } + } + if (strlen($s) % $block_size != 0) { + $p .= '/'; } return $p; } @@ -560,16 +567,16 @@ function jirafeau_admin_list($name, $file_hash, $link_hash) echo t('LS_FILES'); } echo ''; - echo ''; + echo '
'; echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; echo ''; /* Get all links files. */ @@ -1108,6 +1115,21 @@ function jirafeau_challenge_upload ($cfg, $ip, $password) return true; } + // 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; + } + } + } + // Allow if ip is in array foreach ($cfg['upload_ip'] as $i) { if ($i == $ip) {
' . t('FILENAME') . '' . t('TYPE') . '' . t('SIZE') . '' . t('EXPIRE') . '' . t('ONETIME') . '' . t('UPLOAD_DATE') . '' . t('ORIGIN') . '' . t('ACTION') . '' . t('FILENAME') . '' . t('TYPE') . '' . t('SIZE') . '' . t('EXPIRE') . '' . t('ONETIME') . '' . t('UPLOAD_DATE') . '' . t('ORIGIN') . '' . t('ACTION') . '