mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 23:42:11 +00:00
fix setting of expiration date
This commit is contained in:
parent
0bb1035261
commit
2a234307a3
|
@ -362,17 +362,35 @@ else
|
|||
}
|
||||
}
|
||||
|
||||
$expires = false;
|
||||
if (!isset($_POST['expires']) || $_POST["expires"] != "false") {
|
||||
if($_POST["expdate"]) {
|
||||
$tmp = explode('-', $_POST["expdate"]);
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[0], $tmp[2]);
|
||||
} else {
|
||||
$expires = mktime(0,0,0, $_POST["expmonth"], $_POST["expday"], $_POST["expyear"]);
|
||||
}
|
||||
$oldexpires = $document->getExpires();
|
||||
switch($_POST["presetexpdate"]) {
|
||||
case "date":
|
||||
$tmp = explode('-', $_POST["expdate"]);
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]);
|
||||
break;
|
||||
case "1w":
|
||||
$tmp = explode('-', date('Y-m-d'));
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2]+7, $tmp[0]);
|
||||
break;
|
||||
case "1m":
|
||||
$tmp = explode('-', date('Y-m-d'));
|
||||
$expires = mktime(0,0,0, $tmp[1]+1, $tmp[2], $tmp[0]);
|
||||
break;
|
||||
case "1y":
|
||||
$tmp = explode('-', date('Y-m-d'));
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]+1);
|
||||
break;
|
||||
case "2y":
|
||||
$tmp = explode('-', date('Y-m-d'));
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]+2);
|
||||
break;
|
||||
case "never":
|
||||
default:
|
||||
$expires = null;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($expires) {
|
||||
if($oldexpires != $expires) {
|
||||
if($document->setExpires($expires)) {
|
||||
if($notifier) {
|
||||
$notifyList = $document->getNotifyList();
|
||||
|
|
Loading…
Reference in New Issue
Block a user