X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/blobdiff_plain/c4b50888f400fd7e0442431e859010450b55af4b..3f8ba7f9359d8909300b01269056e5c2a578e310:/lib/functions.php diff --git a/lib/functions.php b/lib/functions.php index 1ad0e52..f1f8965 100755 --- a/lib/functions.php +++ b/lib/functions.php @@ -90,6 +90,18 @@ jirafeau_gen_random ($l) return $code; } +function is_ssl() { + if ( isset($_SERVER['HTTPS']) ) { + if ( 'on' == strtolower($_SERVER['HTTPS']) ) + return true; + if ( '1' == $_SERVER['HTTPS'] ) + return true; + } elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) { + return true; + } + return false; +} + function jirafeau_human_size ($octets) { @@ -389,7 +401,7 @@ jirafeau_upload ($file, $one_time_download, $key, $time, $ip, $crypt, $link_name $password = md5 ($key); /* create link file */ - $link_tmp_name = VAR_LINKS . $md5 . rand (0, 10000) . ' .tmp'; + $link_tmp_name = VAR_LINKS . $md5 . rand (0, 10000) . '.tmp'; $handle = fopen ($link_tmp_name, 'w'); fwrite ($handle, $name . NL. $mime_type . NL. $size . NL. $password . NL. $time . @@ -515,12 +527,6 @@ function check_errors () if (!is_writable (VAR_BLOCK)) add_error (t('The block directory is not writable!'), VAR_BLOCK); - - /* Check if the install.php script is still in the directory. */ - if (file_exists (JIRAFEAU_ROOT . 'install.php')) - add_error (t('Installer script still present'), - t('Please make sure to delete the installer script ' . - '"install.php" before continuing.')); } /** @@ -905,7 +911,7 @@ jirafeau_async_end ($ref, $code, $crypt, $link_name_length) $crypt_key = ''; if ($crypt == true && extension_loaded('mcrypt')) { - $cypt_key = jirafeau_encrypt_file ($p, $p); + $crypt_key = jirafeau_encrypt_file ($p, $p); if (strlen($crypt_key) > 0) $crypted = true; } @@ -934,7 +940,7 @@ jirafeau_async_end ($ref, $code, $crypt, $link_name_length) fclose ($handle); /* Create link. */ - $link_tmp_name = VAR_LINKS . $md5 . rand (0, 10000) . ' .tmp'; + $link_tmp_name = VAR_LINKS . $md5 . rand (0, 10000) . '.tmp'; $handle = fopen ($link_tmp_name, 'w'); fwrite ($handle, $a['file_name'] . NL . $a['mime_type'] . NL . $size . NL .