color log / manage "=" in adresses

This commit is contained in:
2022-02-25 08:52:09 +01:00
parent 5d53404735
commit 1ae35941b4
2 changed files with 61 additions and 33 deletions

View File

@ -124,8 +124,9 @@ $message = '';
// ========================================
if (isset ($_REQUEST [A_RECORD]) && !empty ($_REQUEST [A_RECORD])) {
if (!preg_match ("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/i", $_REQUEST [A_RECORD]))
returnError (M_BAD_SENDER_NAME);
$content = getSenderTrack ($_REQUEST [A_RECORD]).NL;
$content = false.NL;
else
$content = getSenderTrack ($_REQUEST [A_RECORD]).NL;
header ('HTTP/1.0 200 OK');
header ('Content-Length: ' . strlen ($content));
header ('Content-Type: text/plain');
@ -136,8 +137,9 @@ if (isset ($_REQUEST [A_RECORD]) && !empty ($_REQUEST [A_RECORD])) {
// ========================================
if (isset ($_REQUEST [A_PERIOD]) && !empty ($_REQUEST [A_PERIOD])) {
if (!preg_match ("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/i", $_REQUEST [A_PERIOD]))
returnError (M_BAD_SENDER_NAME);
$content = getSenderPeriod ($_REQUEST [A_PERIOD]).NL;
$content = DEFAULT_PERIOD.NL;
else
$content = getSenderPeriod ($_REQUEST [A_PERIOD]).NL;
header ('HTTP/1.0 200 OK');
header ('Content-Length: ' . strlen ($content));
header ('Content-Type: text/plain');
@ -308,13 +310,16 @@ function readArchiveFromLines ($lines) {
case preg_match ("/^\s*time:\s*(\d{4}([:-]\d{2}){5})\s*$/i", $line, $matches):
$archive [T_TIME] = $matches [1];
break;
case preg_match ("/^\s*sender:\s*(([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6})\s*$/i", $line, $matches):
// XXX
//case preg_match ("/^\s*sender:\s*(([a-z0-9_+-]+)(\.[a-z0-9_+-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6})\s*$/i", $line, $matches):
case preg_match ("/^\s*sender:\s*(([a-z0-9_=+-]+)(\.[a-z0-9_=+-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6})\s*$/i", $line, $matches):
$archive [T_SENDER] = $matches [1];
break;
case preg_match ("/^\s*new:\s*([0-9a-zA-Z_-]+)\s+([0-9a-zA-Z_-]+)\s*$/", $line, $matches):
// XXX issue ")"
case preg_match ("/^\s*new:\s*([0-9a-zA-Z_-]+)\s+([0-9a-zA-Z_-]+)\)?\s*$/", $line, $matches):
$archive [T_NEW][] = [$matches [1], $matches [2]];
break;
case preg_match ("/^\s*old:\s*([0-9a-zA-Z_-]+)\s+([0-9a-zA-Z_-]+)\s*$/", $line, $matches):
case preg_match ("/^\s*old:\s*([0-9a-zA-Z_-]+)\s+([0-9a-zA-Z_-]+)\)?\s*$/", $line, $matches):
$archive [T_OLD][] = [$matches [1], $matches [2]];
break;
case preg_match ("/^\s*sign:\s*([0-9a-zA-Z_-]+)\s*$/", $line, $matches):
@ -495,9 +500,10 @@ if ($doUpload) {
// ========================================
if ($doUpdate) {
$maxTime = time ()+period2seconds ($_REQUEST [A_UPDATE]);
$linkName = $_REQUEST [A_HASH];
if (!preg_match ('/[0-9a-zA-Z_-]+$/', $linkName))
// XXX issue ")"
if (!preg_match ('/([0-9a-zA-Z_-]+)\)?$/', $_REQUEST [A_HASH], $matches))
returnError (t ('FILE_404'));
$linkName = $matches [1];
$link = jirafeau_get_link ($linkName);
if (count ($link) == 0)
returnError (t ('FILE_404'));
@ -523,6 +529,8 @@ if ($doUpdate) {
$sender = '';
$senderError = false;
if (isset ($_REQUEST [A_SENDER]) && !empty ($_REQUEST [A_SENDER])) {
// XXX
//if (!preg_match ("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/i", $_REQUEST [A_SENDER]))
if (!preg_match ("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/i", $_REQUEST [A_SENDER]))
$senderError=true;
else {