mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-11 20:21:16 +00:00
from and to date can be given as a '-' separeted date
This commit is contained in:
parent
f28657a96d
commit
db56298e79
|
@ -32,11 +32,11 @@ if ($user->isGuest()) {
|
|||
UI::exitError(getMLText("edit_event"),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if (!isset($_POST["frommonth"]) || !isset($_POST["fromday"]) || !isset($_POST["fromyear"]) ) {
|
||||
if (!isset($_POST["from"]) && !(isset($_POST["frommonth"]) && isset($_POST["fromday"]) && isset($_POST["fromyear"])) ) {
|
||||
UI::exitError(getMLText("add_event"),getMLText("error_occured"));
|
||||
}
|
||||
|
||||
if (!isset($_POST["tomonth"]) || !isset($_POST["today"]) || !isset($_POST["toyear"]) ) {
|
||||
if (!isset($_POST["to"]) && !(isset($_POST["tomonth"]) && isset($_POST["today"]) && isset($_POST["toyear"])) ) {
|
||||
UI::exitError(getMLText("add_event"),getMLText("error_occured"));
|
||||
}
|
||||
|
||||
|
@ -46,11 +46,21 @@ if (!isset($_POST["name"]) || !isset($_POST["comment"]) ) {
|
|||
|
||||
$name = $_POST["name"];
|
||||
$comment = $_POST["comment"];
|
||||
$from = mktime(0,0,0, intval($_POST["frommonth"]), intval($_POST["fromday"]), intval($_POST["fromyear"]));
|
||||
$to = mktime(23,59,59, intval($_POST["tomonth"]), intval($_POST["today"]), intval($_POST["toyear"]));
|
||||
if(isset($_POST["from"])) {
|
||||
$tmp = explode('-', $_POST["from"]);
|
||||
$from = mktime(0,0,0, $tmp[1], $tmp[0], $tmp[2]);
|
||||
} else {
|
||||
$from = mktime(0,0,0, intval($_POST["frommonth"]), intval($_POST["fromday"]), intval($_POST["fromyear"]));
|
||||
}
|
||||
if(isset($_POST["to"])) {
|
||||
$tmp = explode('-', $_POST["to"]);
|
||||
$to = mktime(23,59,59, $tmp[1], $tmp[0], $tmp[2]);
|
||||
} else {
|
||||
$to = mktime(23,59,59, intval($_POST["tomonth"]), intval($_POST["today"]), intval($_POST["toyear"]));
|
||||
}
|
||||
|
||||
if ($to<$from){
|
||||
$to= mktime(23,59,59, intval($_POST["frommonth"]), intval($_POST["fromday"]), intval($_POST["fromyear"]));
|
||||
if ($to<=$from){
|
||||
$to = $from + 86400 -1;
|
||||
}
|
||||
|
||||
$res = addEvent($from, $to, $name, $comment);
|
||||
|
|
Loading…
Reference in New Issue
Block a user