]> git.p6c8.net - jirafeau/jirafeau.git/commitdiff
Merge branch 'fix-onetime-download-stats' into 'next-release' 2954490479
authorPatrick Canterino <patrick@patrick-canterino.de>
Fri, 16 Oct 2026 09:29:39 +0000 (11:29 +0200)
committerPatrick Canterino <patrick@patrick-canterino.de>
Fri, 16 Oct 2026 09:29:39 +0000 (11:29 +0200)
Write download stats before deleting one-time link

See merge request jirafeau/Jirafeau!40

CHANGELOG.md
f.php
index.php
install.php
lib/settings.php
lib/template/footer.php
lib/template/header.php
script.php

index c03d0b51f0adcf3cd48587387861e176ab65ba8f..a85065ce8f489c14f4124d11e0c996334d286a4d 100644 (file)
 5. Follow the installation wizard, it should propose you the same data folder or even update automatically
 6. Check your `/lib/config.local.php` and compare it with the `/lib/config.original.php` to see if new configuration items are available. If a new item is missing in your `config.local.php`, this may trigger some errors as Jirafeau may expect to have them.
 
+## Version 4.7.x (not yet released)
+
+- ...
+
 ## Version 4.7.2
 
 - Added a button for showing the download password before uploading the file
diff --git a/f.php b/f.php
index 954b58823ad288a2d905b638a226fb16d8b74176..9454540c44ae0ff404b680cc9eb987ed032f8b7a 100644 (file)
--- a/f.php
+++ b/f.php
@@ -36,7 +36,7 @@ if (!isset($_GET['h']) || empty($_GET['h'])) {
 
 $link_name = $_GET['h'];
 
-if (!preg_match('/[0-9a-zA-Z_-]+$/', $link_name)) {
+if (!preg_match('/^[0-9a-zA-Z_-]+$/', $link_name)) {
     require(JIRAFEAU_ROOT.'lib/template/header.php');
     echo '<div class="error"><p>' . t('FILE_404') . '</p></div>';
     require(JIRAFEAU_ROOT.'lib/template/footer.php');
@@ -82,7 +82,7 @@ if (!file_exists(VAR_FILES . $p . $link['hash'])) {
     exit;
 }
 
-if (!empty($delete_code) && $delete_code == $link['link_code']) {
+if (!empty($delete_code) && hash_equals((string) $link['link_code'], (string) $delete_code)) {
     require(JIRAFEAU_ROOT.'lib/template/header.php');
     if (isset($_POST['do_delete'])) {
         jirafeau_delete_link($link_name);
index 82b3c8c9e7959fddd43f1ecee2300cb4a71953a8..d60cb1809dfebb56b6e8f8295ca6b054d6e43269 100644 (file)
--- a/index.php
+++ b/index.php
@@ -158,7 +158,7 @@ if ($cfg['download_password_requirement'] === 'generated') {
     echo '<tr><td><label for="input_key">' . t('PSW') . ':' . '</label></td>';
     echo '<td class="passwordcolumn"><input type="password" name="key" id="input_key" autocomplete = "new-password"';
     if ($cfg['download_password_policy'] === 'regex') {
-        echo ' pattern="' . substr($cfg['download_password_policy_regex'], 1, strlen($cfg['download_password_policy_regex']) - 2) . '"'; //remove php delimiters
+        echo ' pattern="' . jirafeau_escape(substr($cfg['download_password_policy_regex'], 1, strlen($cfg['download_password_policy_regex']) - 2)) . '"'; //remove php delimiters
     }
     if ($cfg['download_password_requirement'] === 'required') {
         echo ' required';
index ebda6f566af9d0de581c5a102101eac03687881e..808aad75d0e12a73fe7b4b6c3d236e62b8dd226a 100644 (file)
@@ -139,7 +139,7 @@ break;
         ?></label></td>
         <td class = "field"><input type = "text" name = "web_root"
         id = "input_web_root" value = "<?php
-               echo(empty($cfg['web_root']) ? jirafeau_default_web_root() : $cfg['web_root']);
+               echo htmlspecialchars(empty($cfg['web_root']) ? jirafeau_default_web_root() : $cfg['web_root'], ENT_QUOTES);
         ?>" size = "40" /></td>
         </tr> <tr> <td class = "info" colspan = "2"><?php
           echo t('DATA_DIR_EXPLAINATION');
@@ -158,7 +158,7 @@ break;
                 }
                 echo JIRAFEAU_ROOT . $var . '/';
             } else {
-                echo $cfg['var_root'];
+                echo htmlspecialchars($cfg['var_root'], ENT_QUOTES);
             }
         ?>" size = "40" /></td>
         </tr> <tr> <td colspan = "2"><input type = "submit"
index 5697c5455909f0141b583bafcd5e320675b21d11..e015067bd45e9345de460ff77f6536e77478d0ac 100644 (file)
@@ -43,7 +43,7 @@ if ($cfg['debug'] === true) {
 
 /* Jirafeau package */
 define('JIRAFEAU_PACKAGE', 'Jirafeau');
-define('JIRAFEAU_VERSION', '4.7.2');
+define('JIRAFEAU_VERSION', '4.7.x-dev');
 
 define('JIRAFEAU_WEBSITE', 'https://gitlab.com/jirafeau/Jirafeau');
 
index 64132c70966c4a6e5e2b0f8943422a245608764d..fdf488afe8781e1e586876df861fbdccf5f84f97 100644 (file)
@@ -11,7 +11,7 @@
         if (false === empty($cfg['installation_done'])) {
             if(false === empty($cfg['organisation'])) {
                 echo ' <span>|</span> ';
-                echo ' ' . t('DESIGNED')  . ' ' .  $cfg['organisation'];
+                echo ' ' . t('DESIGNED')  . ' ' .  jirafeau_escape($cfg['organisation']);
             }
 
             echo ' <span>|</span> ';
index 93f7e1843d0f55c9025c81547b7eb45f42694bc4..c1a94de6ce01b124429b67b9009dd730c7a1ef94 100644 (file)
@@ -6,10 +6,10 @@ header('x-ua-compatible: ie=edge');
 <html>
 <head>
   <meta charset="utf-8">
-  <title><?php echo (true === empty($cfg['title'])) ? t('JI_WEB_RE') : $cfg['title']; ?></title>
+  <title><?php echo (true === empty($cfg['title'])) ? t('JI_WEB_RE') : jirafeau_escape($cfg['title']); ?></title>
   <meta name="viewport" content="width=device-width, initial-scale=1">
-  <link id="shortcut_icon" rel="shortcut icon" href="<?php echo 'media/' . $cfg['style'] . '/favicon.ico'; ?>">
-  <link id="stylesheet" rel="stylesheet" href="<?php echo 'media/' . $cfg['style'] . '/style.css.php'; ?>" type="text/css" />
+  <link id="shortcut_icon" rel="shortcut icon" href="<?php echo jirafeau_escape('media/' . $cfg['style'] . '/favicon.ico'); ?>">
+  <link id="stylesheet" rel="stylesheet" href="<?php echo jirafeau_escape('media/' . $cfg['style'] . '/style.css.php'); ?>" type="text/css" />
 </head>
 <body>
 <script type="text/javascript" src="<?php echo 'lib/functions.js.php'; ?>"></script>
@@ -17,6 +17,6 @@ header('x-ua-compatible: ie=edge');
 <div id="content">
   <h1>
     <a href="./">
-      <?php echo (true === empty($cfg['title'])) ? t('JI_WEB_RE') : $cfg['title']; ?>
+      <?php echo (true === empty($cfg['title'])) ? t('JI_WEB_RE') : jirafeau_escape($cfg['title']); ?>
     </a>
   </h1>
index 301ebe8cb088e83e6d9774bdc852d36811e10c68..2fc297f3412302a0933ef91d3d85f82560c49df9 100644 (file)
@@ -163,7 +163,7 @@ if (isset($_FILES['file']) && is_writable(VAR_FILES)
         $d = $_GET['d'];
     }
 
-    if (!preg_match('/[0-9a-zA-Z_-]+$/', $link_name)) {
+    if (!preg_match('/^[0-9a-zA-Z_-]+$/', $link_name)) {
         echo 'Error 7';
         exit;
     }

patrick-canterino.de