|
|
@ -1,5 +1,6 @@ |
|
|
<?php |
|
|
<?php |
|
|
session_start(); |
|
|
session_start(); |
|
|
|
|
|
|
|
|
include_once('databaseOperations.php'); |
|
|
include_once('databaseOperations.php'); |
|
|
include('datetimeOperations.php'); |
|
|
include('datetimeOperations.php'); |
|
|
$db = connect(); |
|
|
$db = connect(); |
|
|
@ -7,18 +8,36 @@ if(isset($_POST['id'])) |
|
|
$id = intval($_POST['id']); |
|
|
$id = intval($_POST['id']); |
|
|
$titre = htmlentities($_POST['title']); |
|
|
$titre = htmlentities($_POST['title']); |
|
|
$localisation = htmlentities($_POST['address']); |
|
|
$localisation = htmlentities($_POST['address']); |
|
|
$dtstart = strtotime($_POST['dtstart']); |
|
|
|
|
|
$dtend = strtotime($_POST['dtend']); |
|
|
|
|
|
$description = htmlentities($_POST['description']); |
|
|
$description = htmlentities($_POST['description']); |
|
|
$url = htmlspecialchars($_POST['site']); |
|
|
$url = htmlspecialchars($_POST['site']); |
|
|
$urlImage = htmlspecialchars($_POST['urlImage']); |
|
|
$urlImage = htmlspecialchars($_POST['urlImage']); |
|
|
$contact = htmlspecialchars($_POST['contact']); |
|
|
$contact = htmlspecialchars($_POST['contact']); |
|
|
$catArray = htmlspecialchars($_POST['chk_group']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$dateTypes = array('debut', 'fin'); |
|
|
|
|
|
foreach($dateTypes as $dateType) |
|
|
|
|
|
{ |
|
|
|
|
|
$year = intval($_POST[$dateType.'-select-year']); |
|
|
|
|
|
$month = sprintf('%02d', intval($_POST[$dateType.'-select-mois'])); |
|
|
|
|
|
$day = sprintf('%02d', intval($_POST[$dateType.'-select-jour'])); |
|
|
|
|
|
|
|
|
|
|
|
$hour = sprintf('%02d', intval($_POST[$dateType.'-select-hour'])); |
|
|
|
|
|
$minutes = sprintf('%02d', intval($_POST[$dateType.'-select-minutes'])); |
|
|
|
|
|
|
|
|
|
|
|
$date[$dateType] = strtotime($year.'-'.$month.'-'.$day.' '.$hour.':'.$minutes); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$availableCategories = getCategories($db); |
|
|
|
|
|
$catArray = array(); |
|
|
|
|
|
foreach($availableCategories as $cat) |
|
|
|
|
|
{ |
|
|
|
|
|
if(isset($_POST['checkbox-cat-'.$cat['cat_id']])) |
|
|
|
|
|
$catArray[] = $cat['cat_id']; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(!isset($_POST['id'])) |
|
|
if(!isset($_POST['id'])) |
|
|
addEvent($db, $titre, $catArray, $localisation, $dtstart, $dtend, $description, $url, $urlImage, $contact); |
|
|
|
|
|
|
|
|
addEvent($db, $titre, $catArray, $localisation, $date['debut'], $date['fin'], $description, $url, $urlImage, $contact); |
|
|
else |
|
|
else |
|
|
updateEvent($db, $id, $titre, $catArray, $localisation, $dtstart, $dtend, $description, $url, $urlImage, $contact); |
|
|
|
|
|
|
|
|
updateEvent($db, $id, $titre, $catArray, $localisation, $date['debut'], $date['fin'], $description, $url, $urlImage, $contact); |
|
|
header('Location:./'); |
|
|
header('Location:./'); |
|
|
exit; |
|
|
exit; |
|
|
?>
|
|
|
?>
|