X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/blobdiff_plain/218767ef1f78a6ba2ae62039f3a65d296d361930..6c49d9981c96cdd5d931cbd1eeb5cc584c1370ab:/lib/functions.php diff --git a/lib/functions.php b/lib/functions.php index aaa0daf..47fbc40 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -56,7 +56,7 @@ base_16_to_64 ($num) '1101', # d '1110', # e '1111'); # f - $o = ''; + $o = ''; $b = ''; $i = 0; # Convert long hex string to bin. @@ -114,7 +114,7 @@ jirafeau_human_size ($octets) $p = min (floor (($o ? log ($o) : 0) / log (1024)), count ($u) - 1); $o /= pow (1024, $p); return round ($o, 1) . $u[$p]; -} +} function jirafeau_clean_rm_link ($link) @@ -127,7 +127,7 @@ jirafeau_clean_rm_link ($link) while (file_exists ($parse) && ($scan = scandir ($parse)) && count ($scan) == 2 // '.' and '..' folders => empty. - && basename ($parse) != basename (VAR_LINKS)) + && basename ($parse) != basename (VAR_LINKS)) { rmdir ($parse); $parse = substr ($parse, 0, strlen($parse) - strlen(basename ($parse)) - 1); @@ -148,7 +148,7 @@ jirafeau_clean_rm_file ($md5) while (file_exists ($parse) && ($scan = scandir ($parse)) && count ($scan) == 2 // '.' and '..' folders => empty. - && basename ($parse) != basename (VAR_FILES)) + && basename ($parse) != basename (VAR_FILES)) { rmdir ($parse); $parse = substr ($parse, 0, strlen($parse) - strlen(basename ($parse)) - 1); @@ -284,7 +284,7 @@ jirafeau_delete_file ($md5) if (strcmp ($node, '.') == 0 || strcmp ($node, '..') == 0 || preg_match ('/\.tmp/i', "$node")) continue; - + if (is_dir ($d . $node)) { /* Push new found directory. */ @@ -300,7 +300,7 @@ jirafeau_delete_file ($md5) { $count++; jirafeau_delete_link ($node); - } + } } } } @@ -403,7 +403,7 @@ jirafeau_upload ($file, $one_time_download, $key, $time, $ip, $crypt, $link_name $handle = fopen ($link_tmp_name, 'w'); fwrite ($handle, $name . NL. $mime_type . NL. $size . NL. $password . NL. $time . - NL . $md5. NL . ($one_time_download ? 'O' : 'R') . NL . date ('U') . + NL . $md5. NL . ($one_time_download ? 'O' : 'R') . NL . time () . NL . $ip . NL. $delete_link_code . NL . ($crypted ? 'C' : 'O')); fclose ($handle); $md5_link = substr(base_16_to_64 (md5_file ($link_tmp_name)), 0, $link_name_length); @@ -413,7 +413,7 @@ jirafeau_upload ($file, $one_time_download, $key, $time, $ip, $crypt, $link_name { if (file_exists ($link_tmp_name)) unlink ($link_tmp_name); - + $counter--; if ($counter >= 1) { @@ -506,7 +506,7 @@ function check_errors ($cfg) if (file_exists (JIRAFEAU_ROOT . 'install.php') && !($cfg['installation_done'] === true)) { - header('Location: install.php'); + header('Location: install.php'); exit; } @@ -519,7 +519,7 @@ function check_errors ($cfg) if (!is_writable (VAR_LINKS)) add_error (t('The link directory is not writable!'), VAR_LINKS); - + if (!is_writable (VAR_ASYNC)) add_error (t('The async directory is not writable!'), VAR_ASYNC); } @@ -536,7 +536,7 @@ jirafeau_get_link ($hash) if (!file_exists ($link)) return $out; - + $c = file ($link); $out['file_name'] = trim ($c[0]); $out['mime_type'] = trim ($c[1]); @@ -549,7 +549,7 @@ jirafeau_get_link ($hash) $out['ip'] = trim ($c[8]); $out['link_code'] = trim ($c[9]); $out['crypted'] = trim ($c[10]) == 'C'; - + return $out; } @@ -613,21 +613,28 @@ jirafeau_admin_list ($name, $file_hash, $link_hash) /* Print link informations. */ echo '