fix faille
This commit is contained in:
1 parent
bf96993c29
commit
818c83a99d
8 files changed
+57
-71
No files matched your search
@@ -8,7 +8,7 @@
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\SMTP;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
require 'vendor/autoload.php';
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/../');
|
||||
|
||||
@@ -146,7 +146,7 @@ define ('T_CRYPT_KEY', 'crypt_key');
|
||||
define ('T_ENTRIES', 'entries');
|
||||
define ('T_FILENAME', 'file_name');
|
||||
define ('T_HASH', 'hash');
|
||||
define ('T_NEW', 'new');
|
||||
define ('T_NEWKAZ', 'new');
|
||||
define ('T_SIGN', 'sign');
|
||||
define ('T_NOT_FOUND', 'not_found');
|
||||
define ('T_OLD', 'old');
|
||||
@@ -193,7 +193,7 @@ require (JIRAFEAU_ROOT . 'lib/template/page.php');
|
||||
function cleanToken () {
|
||||
if (!file_exists (VAR_TOKENS))
|
||||
mkdir (VAR_TOKENS, 0755);
|
||||
$d = dir (VAR_TOKENS);
|
||||
dir (VAR_TOKENS);
|
||||
$oldest = strtotime (TOKEN_USE_LIMIT);
|
||||
foreach (glob (VAR_TOKENS."*") as $file) {
|
||||
if (file_exists ($file) && filemtime ($file) <= $oldest)
|
||||
@@ -213,7 +213,7 @@ function rmToken ($sender) {
|
||||
|
||||
function setToken ($sender) {
|
||||
if (!$sender)
|
||||
return;
|
||||
return null;
|
||||
$token = md5 (rand ());
|
||||
if (file_put_contents (VAR_TOKENS.$sender, T_CREATE.": ".time ().NL.T_TOKEN.": ".$token.NL))
|
||||
return $token;
|
||||
@@ -235,7 +235,7 @@ function setLoggedToken ($sender, $token) {
|
||||
*/
|
||||
function getTokenVar ($sender, $varName) {
|
||||
if (!$sender)
|
||||
return;
|
||||
return null;
|
||||
if (!file_exists (VAR_TOKENS.$sender))
|
||||
return false;
|
||||
$content = file_get_contents (VAR_TOKENS.$sender);
|
||||
@@ -269,13 +269,13 @@ function setSenderFake ($error, $sender, $owner, $dirLink, $fileLink) {
|
||||
if (!file_exists (VAR_FAKE))
|
||||
mkdir (VAR_FAKE, 0755);
|
||||
$dirTime = $fileTime = $fileName = $fileType = $ip = '';
|
||||
if (count ($dirLink) != 0) {
|
||||
if (count ($dirLink) !== 0) {
|
||||
$dirTime = $dirLink ['upload_date'].date (" Y-m-d H:i:s", $dirLink ['upload_date']);
|
||||
$ip = $dirLink ['ip'];
|
||||
}
|
||||
if (!$sender)
|
||||
return;
|
||||
if (count ($fileLink) != 0) {
|
||||
if (count ($fileLink) !== 0) {
|
||||
$fileTime = $fileLink ['upload_date'].date (" Y-m-d H:i:s", $fileLink ['upload_date']);
|
||||
$fileName = $link ['file_name'];
|
||||
$fileType = $link ['mime_type'];
|
||||
@@ -292,7 +292,7 @@ function setSenderFake ($error, $sender, $owner, $dirLink, $fileLink) {
|
||||
"fileTime: ".$fileTime.NL.
|
||||
"fileType: <".$fileType.">".NL.
|
||||
"fileName: <".$fileName.">".NL;
|
||||
|
||||
|
||||
$log = $ip.$sender;
|
||||
if ($log)
|
||||
file_put_contents (VAR_FAKE.$log, $content);
|
||||
@@ -325,7 +325,7 @@ function sendEMail ($receiver, $receiver_name, $subject, $body_string){
|
||||
$mail->SMTPAutoTLS = false;
|
||||
$mail->SMTPSecure = "none";
|
||||
$mail->Port = 25;
|
||||
$mail->charSet = "UTF-8";
|
||||
$mail->CharSet = "UTF-8";
|
||||
$mail->ContentType = 'text/html';
|
||||
|
||||
global $domain;
|
||||
@@ -342,10 +342,9 @@ function sendEMail ($receiver, $receiver_name, $subject, $body_string){
|
||||
if (!$mail->send ()) {
|
||||
//echo 'Mailer Error: ' . $mail->ErrorInfo;
|
||||
return 0;
|
||||
} else {
|
||||
//echo 'Message sent!';
|
||||
return 1;
|
||||
}
|
||||
//echo 'Message sent!';
|
||||
return 1;
|
||||
} catch (Exception $e) {
|
||||
return 0;
|
||||
}
|
||||
@@ -388,7 +387,7 @@ if (isset ($_REQUEST [A_ACTION]) && $_REQUEST [A_ACTION] == T_LOGIN && $sender)
|
||||
$url .= "&".A_HASH."=".$_REQUEST [A_HASH];
|
||||
$result = sendEMail ($sender, "", M_EMAIL_SUBJECT,
|
||||
str_replace (["___LINK___", "___IP___", "___DATE___"],
|
||||
[$url, $_SERVER ['HTTP_X_REAL_IP'], date ("Y-m-d H:i:s")], M_EMAIL_CONTENT));
|
||||
[$url, isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : $_SERVER['REMOTE_ADDR'], date ("Y-m-d H:i:s")], M_EMAIL_CONTENT));
|
||||
if ($result)
|
||||
echo M_SEND_TOKEN;
|
||||
else
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Jirafeau, your web file repository
|
||||
* Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
|
||||
|
||||
@@ -51,7 +51,7 @@ define('VAR_ASYNC', $cfg['var_root'] . 'async/');
|
||||
// helping variable to build absolute link to
|
||||
// root of the domain without handling the URL scheme
|
||||
$absPrefix = parse_url($cfg['web_root'], PHP_URL_PATH);
|
||||
if (true === empty($absPrefix)) {
|
||||
if (empty($absPrefix)) {
|
||||
// fallback if installation isnt done yet: relative links to same level on the current page
|
||||
$absPrefix = './';
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
<div class="table">
|
||||
<form class="tr" action="<?php echo $_SERVER ['SCRIPT_NAME']; ?>" method="POST">
|
||||
<input type="email" name="<?php echo A_SENDER; ?>" size="40" value="<?php echo jirafeau_escape ($_REQUEST [A_SENDER]);?>" placeholder="Votre mél" required="required"/>
|
||||
<input type="email" name="<?php echo A_SENDER;?>" size="40" value="<?php echo jirafeau_escape ($_REQUEST [A_SENDER] ?? '');?>" placeholder="Votre mél" required="required"/>
|
||||
<?php echo getHiddenLink (); ?>
|
||||
<input type="hidden" name="<?php echo A_ACTION; ?>" value="<?php echo T_LOGIN; ?>" />
|
||||
<input type="submit" value="<?php echo M_SEND; ?>" />
|
||||
|
||||
Reference in new issue
Block a user