]> git.p6c8.net - jirafeau/jirafeau.git/blobdiff - lib/functions.php
Fixed temporary filenames of encrypted files during classic upload
[jirafeau/jirafeau.git] / lib / functions.php
index 5d4602e6c235fedb8e56e5ffb98c52b55fdc52fc..e5a05b0e559ebe520eb7e99b4a06f96c061a5bbd 100644 (file)
@@ -464,9 +464,9 @@ function jirafeau_handle_add_file_encryption($crypt_module_enabled, $file_path)
         error_log("PHP extension sodium not loaded, won't encrypt in Jirafeau");
     }
     if ($crypt_module_enabled == true && extension_loaded('sodium') == true) {
         error_log("PHP extension sodium not loaded, won't encrypt in Jirafeau");
     }
     if ($crypt_module_enabled == true && extension_loaded('sodium') == true) {
-        $crypt_key = jirafeau_encrypt_file($file_path, $file_path.'crypt');
+        $crypt_key = jirafeau_encrypt_file($file_path, $file_path.'.crypt');
         if (strlen($crypt_key) > 0) {
         if (strlen($crypt_key) > 0) {
-            if (rename($file_path.'crypt', $file_path) === true) {
+            if (rename($file_path.'.crypt', $file_path) === true) {
                 $crypted = true;
             }
         }
                 $crypted = true;
             }
         }
@@ -554,7 +554,7 @@ function jirafeau_add_file($file, $one_time_download, $key, $time, $ip, $crypt,
         $handle,
         $name . NL. $mime_type . NL. $size . NL. $password . NL. $time .
             NL . $hash. NL . ($one_time_download ? 'O' : 'R') . NL . time() .
         $handle,
         $name . NL. $mime_type . NL. $size . NL. $password . NL. $time .
             NL . $hash. NL . ($one_time_download ? 'O' : 'R') . NL . time() .
-            NL . $ip . NL. $delete_link_code . NL . ($crypted ? 'C' : 'O')
+            NL . $ip . NL. $delete_link_code . NL . ($crypted ? 'C2' : 'O')
     );
     fclose($handle);
     $hash_link = substr(base_16_to_64(md5_file($link_tmp_name)), 0, $link_name_length);
     );
     fclose($handle);
     $hash_link = substr(base_16_to_64(md5_file($link_tmp_name)), 0, $link_name_length);
@@ -771,6 +771,9 @@ function jirafeau_admin_list($name, $file_hash, $link_hash)
                     if (!empty($link_hash) && $link_hash != $node) {
                         continue;
                     }
                     if (!empty($link_hash) && $link_hash != $node) {
                         continue;
                     }
+
+                    /* Get download statistics */
+                    $ld = jirafeau_get_download_stats($node);
                     /* Print link information. */
                     echo '<tr>';
                     echo '<td><strong>';
                     /* Print link information. */
                     echo '<tr>';
                     echo '<td><strong>';
@@ -793,6 +796,11 @@ function jirafeau_admin_list($name, $file_hash, $link_hash)
                     if (strlen($l['ip']) > 0) {
                         echo t('ORIGIN') . ': ' . $l['ip'] . '<br/>';
                     }
                     if (strlen($l['ip']) > 0) {
                         echo t('ORIGIN') . ': ' . $l['ip'] . '<br/>';
                     }
+                    echo t('DOWNLOAD_COUNT') . ': ' . $ld['count'] . '<br/>';
+                    if ($ld['count'] > 0) {
+                        echo t('DOWNLOAD_DATE') . ': ' . jirafeau_get_datetimefield($ld['date']) . '<br/>';
+                        echo t('DOWNLOAD_IP') . ': ' . $ld['ip'] . '<br/>';
+                    }
                     echo '</td><td>';
 
                     if (!$l['crypted'] && !$l['crypted_legacy']) {
                     echo '</td><td>';
 
                     if (!$l['crypted'] && !$l['crypted_legacy']) {
@@ -1796,8 +1804,7 @@ function jirafeau_create_upload_finished_box($preview = true, $download_pass = n
     </p>
     </div>
 
     </p>
     </div>
 
-    <?php if (!is_null($download_pass)) {
-    ?>
+    <?php if (!is_null($download_pass)) { ?>
     <div id="show_password">
     <p><?php echo t('PSW') ?></p>
 
     <div id="show_password">
     <p><?php echo t('PSW') ?></p>
 

patrick-canterino.de