size
This commit is contained in:
parent
0d12ce7dcd
commit
9c61fd740c
@ -39,7 +39,7 @@ define ('M_TOO_LONG_LOGGED', "Temps de connexion dépassé.");
|
||||
define ('M_EMAIL_CONTENT', "Bonjour,<br/><br/>Ceci est un message automatique, car vous venez de cliquer sur une demande de consultation de vos pièces jointes.<br/><br/>!!! Si vous n'êtes pas à l'origine de cette demande, ne cliquez sur aucun lien de ce message. !!!<br/><br/>Le lien de connexion suivant est valable 15 minutes.<br/><a href=\"___LINK___\">___LINK___</a><br/><br/>Vous pouvez signaler des abus auprès de Kaz en faisant suivre ce message qui contient les traces de son émetteur (___IP___, ___DATE___).<br/><br/>Bonne navigation.<br/>.");
|
||||
define ('M_DOWNLOAD', "Télécharger");
|
||||
define ('M_UPDATE', "Prolonger");
|
||||
define ('M_EMAIL_SUBJECT', "Lien de consultation des envoies de pièces jointes.");
|
||||
define ('M_EMAIL_SUBJECT', "Lien de consultation des envois de pièces jointes.");
|
||||
define ('M_FILE', " fichier.");
|
||||
define ('M_FILES', " fichiers.");
|
||||
define ('M_FILES_NOT_FOUND', " fichiers sont expirés.");
|
||||
@ -170,6 +170,7 @@ function getPeriod ($sender) {
|
||||
|
||||
// ========================================
|
||||
function setFake ($sender, $dir_link, $dirTime) {
|
||||
return;
|
||||
if (!$sender)
|
||||
return;
|
||||
if (!file_exists (VAR_FAKE))
|
||||
@ -191,13 +192,18 @@ function isKazArchive ($link) {
|
||||
jirafeau_escape ($link ['mime_type']) == T_ARCHIVE_MIME;
|
||||
}
|
||||
// ========================================
|
||||
function getFileName ($hash) {
|
||||
$p = s2p ($hash);
|
||||
return VAR_FILES.$p.$hash;
|
||||
}
|
||||
|
||||
function getTimeFile ($hash) {
|
||||
$p = s2p ("$hash");
|
||||
$f = VAR_FILES . $p . $hash;
|
||||
$f = getFileName ($hash);
|
||||
return file_exists ($f) ? filemtime ($f) : 0;
|
||||
}
|
||||
|
||||
function valideTime ($t1, $t2) {
|
||||
return true;
|
||||
return abs ($t1 - $t2) < 60; // XXX delay
|
||||
}
|
||||
|
||||
@ -255,33 +261,37 @@ function read_archive_info ($link) {
|
||||
|
||||
// ========================================
|
||||
function send_email ($receiver, $receiver_name, $subject, $body_string){
|
||||
// SERVER SETTINGS
|
||||
$mail = new PHPMailer (true);
|
||||
$mail->isSMTP ();
|
||||
$mail->Host = 'smtp';
|
||||
$mail->SMTPAuth = false;
|
||||
$mail->SMTPAutoTLS = false;
|
||||
$mail->SMTPSecure = "none";
|
||||
$mail->Port = 25;
|
||||
$mail->charSet = "UTF-8";
|
||||
$mail->ContentType = 'text/html';
|
||||
try {
|
||||
// SERVER SETTINGS
|
||||
$mail = new PHPMailer (true);
|
||||
$mail->isSMTP ();
|
||||
$mail->Host = 'smtp';
|
||||
$mail->SMTPAuth = false;
|
||||
$mail->SMTPAutoTLS = false;
|
||||
$mail->SMTPSecure = "none";
|
||||
$mail->Port = 25;
|
||||
$mail->charSet = "UTF-8";
|
||||
$mail->ContentType = 'text/html';
|
||||
|
||||
//Recipients (change this for every project)
|
||||
$mail->setFrom ('no-reply@kaz.local', '');
|
||||
$mail->addAddress ($receiver, $receiver_name);
|
||||
//Recipients (change this for every project)
|
||||
$mail->setFrom ('no-reply@kaz.local', '');
|
||||
$mail->addAddress ($receiver, $receiver_name);
|
||||
|
||||
//Content
|
||||
$mail->isHTML (true);
|
||||
$mail->Subject = $subject;
|
||||
$mail->Body = $body_string;
|
||||
//Content
|
||||
$mail->isHTML (true);
|
||||
$mail->Subject = $subject;
|
||||
$mail->Body = $body_string;
|
||||
|
||||
//send the message, check for errors
|
||||
if (!$mail->send ()) {
|
||||
//echo 'Mailer Error: ' . $mail->ErrorInfo;
|
||||
//send the message, check for errors
|
||||
if (!$mail->send ()) {
|
||||
//echo 'Mailer Error: ' . $mail->ErrorInfo;
|
||||
return 0;
|
||||
} else {
|
||||
//echo 'Message sent!';
|
||||
return 1;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return 0;
|
||||
} else {
|
||||
//echo 'Message sent!';
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -599,7 +609,11 @@ if (isset ($_REQUEST [A_ACTION]) && $_REQUEST [A_ACTION] == T_SEND && $sender) {
|
||||
$result = send_email ($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));
|
||||
echo M_SEND_TOKEN;
|
||||
if ($result)
|
||||
echo M_SEND_TOKEN;
|
||||
else
|
||||
echo
|
||||
"Erreur dans l'envoi. Véritiez votre mèl.";
|
||||
}
|
||||
require (JIRAFEAU_ROOT.'lib/template/footer.php');
|
||||
exit;
|
||||
@ -655,19 +669,20 @@ function deleteAction ($link_name) {
|
||||
global $sender, $token, $message, $doLogout;
|
||||
|
||||
$link = jirafeau_get_link ($link_name);
|
||||
//$message .= "ln: ".$link_name." l: "."<pre>".print_r ($link, 1)."</pre> mt: ".getTimeFile ($link ['hash'])."</br>";
|
||||
if (!count ($link))
|
||||
return;
|
||||
if (isKazArchive ($link)) {
|
||||
$dir_name = $link_name;
|
||||
$dir_link = $link;
|
||||
$dirTime = getTimeFile ($dir_name);
|
||||
$dirTime = getTimeFile ($dir_link ['hash']);
|
||||
$archive_info = read_archive_info ($dir_link);
|
||||
if (! count ($archive_info))
|
||||
return;
|
||||
if ($sender != $archive_info [T_SENDER]) {
|
||||
setFake ($sender, $dir_link, $dirTime);
|
||||
$message .= "Tentative de supprimer un envoi dont vous n'êtes pas le propriétaire";
|
||||
$doLogout = true;
|
||||
$message .= "Tentative de supprimer un envoi dont vous n'êtes pas le propriétaire. (F1 ".$sender." != ".$archive_info [T_SENDER].")";
|
||||
//XXX $doLogout = true;
|
||||
return;
|
||||
}
|
||||
if ($archive_info [T_NEW])
|
||||
@ -675,11 +690,13 @@ function deleteAction ($link_name) {
|
||||
$file_link = jirafeau_get_link ($file_name);
|
||||
if (! count ($file_link))
|
||||
continue;
|
||||
$fileTime = getTimeFile ($file_name);
|
||||
$fileTime = getTimeFile ($file_link ['hash']);
|
||||
if (! valideTime ($dirTime, $fileTime)) {
|
||||
setFake ($sender, $dir_link, $dirTime);
|
||||
$message .= "Cet envoie a été forgée (dates incohéantes).";
|
||||
$doLogout = true;
|
||||
$message .= "Cet envoi a été forgée (dates incohéantes). (F2 ".
|
||||
getFileName ($dir_link ['hash'])." =? ".getFileName ($file_link ['hash'])." ".
|
||||
date ("Y-m-d H:i:s", $dirTime)." != ".date ("Y-m-d H:i:s", $fileTime).")";
|
||||
// XXX $doLogout = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -713,7 +730,7 @@ function deleteAction ($link_name) {
|
||||
}
|
||||
/* Read link informations. */
|
||||
$dir_link = jirafeau_get_link ($dir_name);
|
||||
$dirTime = getTimeFile ($dir_name);
|
||||
$dirTime = getTimeFile ($dir_link ['hash']);
|
||||
if (!count ($dir_link))
|
||||
continue;
|
||||
if (!isKazArchive ($dir_link))
|
||||
@ -745,18 +762,18 @@ function deleteAction ($link_name) {
|
||||
break;
|
||||
}
|
||||
setFake ($sender, $dir_link, $dirTime);
|
||||
$message .= "Cet envoie a été forgée (dates incohéantes ".$dirTime. " ".$fileTime.").";
|
||||
$dologout = true;
|
||||
$message .= "Cet envoi a été forgée. (F3 ".date ("Y-m-d H:i:s", $dirTime)." != ".date ("Y-m-d H:i:s", $fileTime).")";
|
||||
// XXX $dologout = true;
|
||||
break;
|
||||
}
|
||||
if (valideTime ($dirTime, $fileTime)) {
|
||||
setFake ($sender, $dir_link, $dirTime);
|
||||
$message .= "Tentative de supprimer un envoi dont vous n'êtes pas le propriétaire";
|
||||
$doLogout = true;
|
||||
$message .= "Tentative de supprimer un envoi dont vous n'êtes pas le propriétaire. (F4 ".date ("Y-m-d H:i:s", $dirTime)." != ".date ("Y-m-d H:i:s", $fileTime).")";
|
||||
// XXX $doLogout = true;
|
||||
break;
|
||||
}
|
||||
setFake ($archive_info [T_SENDER], $dir_link, $dirTime);
|
||||
$message .= "Quelqu'un avétait revandiqué cet envoi";
|
||||
$message .= "Quelqu'un avétait revandiqué cet envoi. (F5 ".$sender." != ".$archive_info [T_SENDER].")";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -830,8 +847,9 @@ while ( ($d = array_shift ($stack)) && $d != null) {
|
||||
if ($sender != $archive_info [T_SENDER])
|
||||
continue;
|
||||
$archive_info ['link'] = $dir_name;
|
||||
$archive_info ['time'] = $l ['time'];
|
||||
$archive_info ['key'] = $l ['key'];
|
||||
$archive_info ['time'] = $l ['time'];
|
||||
$archive_info ['hash'] = $l ['hash'];
|
||||
$archives [] = $archive_info;
|
||||
}
|
||||
}
|
||||
@ -899,7 +917,7 @@ $defaultChecked [getTrack ($sender) ? "on" : "off"] = ' checked="checked"';
|
||||
$defaultChecked [getPeriod ($sender)] = ' selected="selected"';
|
||||
echo
|
||||
'<form method="post">'.
|
||||
'Je veux que Kaz suive tous mes futurs envoies: '.
|
||||
'Je veux que Kaz suive tous mes futurs envois: '.
|
||||
'<input type="hidden" name="'.A_SENDER.'" value="'.$sender.'"/>'.
|
||||
'<input type="hidden" name="'.A_TOKEN.'" value="'.$token.'"/>';
|
||||
foreach ($trackText as $item => $text)
|
||||
@ -921,30 +939,14 @@ echo
|
||||
'<input type="hidden" name="'.A_SENDER.'" value="'.$sender.'"/>'.
|
||||
'<input type="hidden" name="'.A_TOKEN.'" value="'.$token.'"/>'.
|
||||
'<button type="submit">'.M_REFRESH.'</button>'.
|
||||
' la page.</form>'.
|
||||
'<form method="post">'.
|
||||
'Je veux me '.
|
||||
'<input type="hidden" name="'.A_ACTION.'" value="'.T_LOGOUT.'" />'.
|
||||
'<input type="hidden" name="'.A_SENDER.'" value="'.$sender.'"/>'.
|
||||
'<input type="hidden" name="'.A_TOKEN.'" value="'.$token.'"/>'.
|
||||
'<button type="submit">'.M_LOGOUT.'</button>'.
|
||||
'.</form>';
|
||||
' la page.</form>';
|
||||
|
||||
$userSise = 0;
|
||||
$userTab = [];
|
||||
if ($archives) {
|
||||
foreach ($archives as $archive_info) {
|
||||
echo
|
||||
'<div class="frame" width="100%" >';
|
||||
$la = $archive_info ['link'];
|
||||
$ka = $archive_info ['key'];
|
||||
echo
|
||||
'<a data-tooltip="voir" href="javascript:getKazArchive (\''.$la.'\', \''.$ka.'\');"> 👁 </a>'.
|
||||
'<a data-tooltip="voir le lien" href="javascript:showLink (\''.$la.'\', \''.$ka.'\');"> 🔗 </a>';
|
||||
foreach ($periodButton as $item => $bt)
|
||||
echo '<a data-tooltip="'.$bt[1].'" href="javascript:ajaxUpdate (\''.$la.'\', \''.$ka.'\');"> '.$bt[0].' </a>';
|
||||
echo
|
||||
'<strong>'.$archive_info [T_TIMESTAMP].'</strong>'.
|
||||
'<a data-tooltip="supprimer tous" href="javascript:rmFile (\''.$la.'\');"> ♺ </a>';
|
||||
echo '<br/>=> '. ($archive_info ['time'] == -1 ? '∞' : jirafeau_get_datetimefield ($archive_info ['time'])).'<ul>';
|
||||
$contentSize = 0;
|
||||
$archContent = '';
|
||||
foreach ([T_NEW, T_OLD] as $cat) {
|
||||
$li_style = $cat == T_NEW ? "font-weight: bold;" : "font-style: italic;";
|
||||
if (isset ($archive_info [$cat]))
|
||||
@ -952,27 +954,64 @@ if ($archives) {
|
||||
$link = jirafeau_get_link ($link_name);
|
||||
if (count ($link) == 0)
|
||||
continue;
|
||||
if ($cat == T_NEW )
|
||||
$contentSize += $link ['file_size'];
|
||||
$lf = $link_name;
|
||||
$kf = $link ['key'];
|
||||
echo
|
||||
'<li style="list-style:none; '.$li_style.'">'.
|
||||
'<a data-tooltip="voir" href="javascript:getKazFile (\''.$lf.'\', \''.$kf.'\');"> 👁 </a>'.
|
||||
'<a data-tooltip="voir le lien" href="javascript:showLink (\''.$lf.'\', \''.$kf.'\');"> 🔗 </a>';
|
||||
foreach ($periodButton as $item => $bt)
|
||||
echo '<a data-tooltip="'.$bt[1].'" href="javascript:ajaxUpdate (\''.$lf.'\', \''.$kf.'\');"> '.$bt[0].' </a>';
|
||||
echo
|
||||
jirafeau_escape ($link ['file_name']).
|
||||
' ('.jirafeau_escape ($link ['mime_type']).
|
||||
' '.jirafeau_human_size ($link ['file_size']).')';
|
||||
$archContent .=
|
||||
'<li style="list-style:none; '.$li_style.'">'.
|
||||
'<a data-tooltip="voir" href="javascript:getKazFile (\''.$lf.'\', \''.$kf.'\');"> 👁 </a>'.
|
||||
'<a data-tooltip="voir le lien" href="javascript:showLink (\''.$lf.'\', \''.$kf.'\');"> 🔗 </a>';
|
||||
// foreach ($periodButton as $item => $bt)
|
||||
// echo '<a data-tooltip="'.$bt[1].'" href="javascript:ajaxUpdate (\''.$lf.'\', \''.$kf.'\');"> '.$bt[0].' </a>';
|
||||
$archContent .=
|
||||
jirafeau_escape ($link ['file_name']).
|
||||
' ('.jirafeau_escape ($link ['mime_type']).
|
||||
' '.jirafeau_human_size ($link ['file_size']).')';
|
||||
if ($cat == T_NEW)
|
||||
echo '<a data-tooltip="supprimer" href="javascript:rmFile (\''.$lf.'\');"> ♺ </a>';
|
||||
echo'</li>';
|
||||
$archContent .=
|
||||
'<a data-tooltip="supprimer" href="javascript:rmFile (\''.$lf.'\');"> ♺ </a>';
|
||||
$archContent .=
|
||||
'</li>';
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
$archEntry =
|
||||
'<div class="frame" width="100%" >';
|
||||
$la = $archive_info ['link'];
|
||||
$ka = $archive_info ['key'];
|
||||
$archEntry .=
|
||||
'<a data-tooltip="voir" href="javascript:getKazArchive (\''.$la.'\', \''.$ka.'\');"> 👁 </a>'.
|
||||
'<a data-tooltip="voir le lien" href="javascript:showLink (\''.$la.'\', \''.$ka.'\');"> 🔗 </a>';
|
||||
foreach ($periodButton as $item => $bt)
|
||||
$archEntry .=
|
||||
'<a data-tooltip="'.$bt[1].'" href="javascript:ajaxUpdate (\''.$la.'\', \''.$ka.'\');"> '.$bt[0].' </a>';
|
||||
$archEntry .=
|
||||
'<strong>'.$archive_info [T_TIMESTAMP].' ('.jirafeau_human_size ($contentSize).')</strong>'.
|
||||
'<a data-tooltip="supprimer tous" href="javascript:rmFile (\''.$la.'\');"> ♺ </a>'.
|
||||
'<br/>=> '. ($archive_info ['time'] == -1 ? '∞' : jirafeau_get_datetimefield ($archive_info ['time'])).'<ul>'.
|
||||
$archContent.
|
||||
'</div>';
|
||||
$userSise += $contentSize;
|
||||
$userTab [getTimeFile ($archive_info ['hash'])] = $archEntry;
|
||||
}
|
||||
ksort ($userTab);
|
||||
}
|
||||
|
||||
echo
|
||||
'<p>Votre compte occupe '.jirafeau_human_size ($userSise).'.</p>'.
|
||||
'<form method="post">'.
|
||||
'Je veux me '.
|
||||
'<input type="hidden" name="'.A_ACTION.'" value="'.T_LOGOUT.'" />'.
|
||||
'<input type="hidden" name="'.A_SENDER.'" value="'.$sender.'"/>'.
|
||||
'<input type="hidden" name="'.A_TOKEN.'" value="'.$token.'"/>'.
|
||||
'<button type="submit">'.M_LOGOUT.'</button>'.
|
||||
'.</form>';
|
||||
if (count ($userTab)) {
|
||||
foreach ($userTab as $time => $entry)
|
||||
echo $entry;
|
||||
} else
|
||||
echo "Il n'y a aucune information vous concernant.";
|
||||
echo
|
||||
"<p>Il n'y a aucune information vous concernant.</p>";
|
||||
|
||||
require (JIRAFEAU_ROOT.'lib/template/footer.php');
|
||||
exit;
|
||||
|
@ -51,7 +51,7 @@ INSPECT_DIR=/var/spool/filter
|
||||
FIC_LOG=/var/log/mail/filter.log
|
||||
SENDMAIL="/usr/sbin/sendmail -G -i"
|
||||
MAILS=/tmp/FILTER
|
||||
MAX_KEEP_IN_MAIL=24ki
|
||||
MAX_KEEP_IN_MAIL=5ki
|
||||
MAX_UPLOAD_SIZE=100Mi
|
||||
SHRINK_CMD=/home/filter/eMailShrinker
|
||||
JIRAFEAU_CMD=/home/filter/jirafeauAPI
|
||||
|
Loading…
Reference in New Issue
Block a user