Skip to content
This repository was archived by the owner on Oct 17, 2021. It is now read-only.

Commit f5ec66a

Browse files
committed
reorganize files
1 parent df927ed commit f5ec66a

21 files changed

+187
-189
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A drag & drop event calendar with data permanence.
44

5-
![FullCalendar with data permanence](img/main.png)
5+
![FullCalendar with data permanence](main.png)
66

77
## Purpose
88

class.Event.php

Lines changed: 0 additions & 51 deletions
This file was deleted.

class.Recurrence.php

Lines changed: 0 additions & 40 deletions
This file was deleted.

class.Week.php

Lines changed: 0 additions & 66 deletions
This file was deleted.

addEvent-json.php renamed to core/add-event-json.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
// ini_set('display_startup_errors', 1);
55
// error_reporting(E_ALL);
66

7-
require_once('sanitize.php');
7+
require_once('../utils/sanitize.php');
88

9-
require 'class.Event.php';
10-
require 'class.Recurrence.php';
11-
require 'class.Week.php';
9+
require '../logic/class.Event.php';
10+
require '../logic/class.Recurrence.php';
11+
require '../logic/class.Week.php';
1212

1313
// if event post
1414
if (isset($_POST['title'])) {
1515

1616
// get dates data
17-
$jsonString = file_get_contents('json/events.json');
17+
$jsonString = file_get_contents('../data/events.json');
1818
$data = json_decode($jsonString, true);
1919

2020
$id = end($data)['id'];
@@ -49,7 +49,7 @@
4949
// store dates
5050
$events = array_merge($data, $addRecurrenceEvents);
5151
$newJsonString = json_encode($events);
52-
file_put_contents('json/events.json', $newJsonString);
52+
file_put_contents('../data/events.json', $newJsonString);
5353

5454
// if single event
5555
} else {
@@ -68,7 +68,7 @@
6868
// store dates
6969
$data[] = $addSingleEvent;
7070
$newJsonString = json_encode($data);
71-
file_put_contents('json/events.json', $newJsonString);
71+
file_put_contents('../data/events.json', $newJsonString);
7272
}
7373
}
7474
// back to fullCalendar

addEvent.php renamed to core/add-event.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
2-
require_once('auth.php');
3-
require_once('sanitize.php');
2+
require_once('./utils/auth.php');
3+
require_once('./utils/sanitize.php');
44

55
if (isset($_POST['title'])) {
66
$title = sanitizeInput($_POST['title']);

editEventDate-json.php renamed to core/edit-date-json.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
if (isset($_POST['Event'][0]) && isset($_POST['Event'][1]) && isset($_POST['Event'][2])) {
4-
$jsonString = file_get_contents('json/events.json');
4+
$jsonString = file_get_contents('../data/events.json');
55
$data = json_decode($jsonString, true);
66

77
$start = explode(" ", $_POST['Event'][1]);
@@ -20,7 +20,7 @@
2020
}
2121
}
2222
$newJsonString = json_encode($data);
23-
file_put_contents('json/events.json', $newJsonString);
23+
file_put_contents('../data/events.json', $newJsonString);
2424

2525
}
2626
//header('Location: '.$_SERVER['HTTP_REFERER']);

editEventDate.php renamed to core/edit-date.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
// Connexion à la base de données
4-
require_once('auth.php');
4+
require_once('./utils/auth.php');
55

66
if (isset($_POST['Event'][0]) && isset($_POST['Event'][1]) && isset($_POST['Event'][2])){
77

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
<?php
22

33
if (isset($_POST['delete']) && isset($_POST['id'])) {
4-
$jsonString = file_get_contents('json/events.json');
4+
$jsonString = file_get_contents('../data/events.json');
55
$data = json_decode($jsonString, true);
66
foreach ($data as $key => $entry) {
77
if ($entry['id'] == $_POST['id']) {
88
unset($data[$key]);
99
}
1010
}
1111
$newJsonString = json_encode($data);
12-
file_put_contents('json/events.json', $newJsonString);
12+
file_put_contents('../data/events.json', $newJsonString);
1313

1414
} else if (isset($_POST['deleteRecurrence']) && isset($_POST['rid'])) {
15-
$jsonString = file_get_contents('json/events.json');
15+
$jsonString = file_get_contents('../data/events.json');
1616
$data = json_decode($jsonString, true);
1717
foreach ($data as $key => $entry) {
1818
if ($entry['rid'] == $_POST['rid']) {
1919
unset($data[$key]);
2020
}
2121
}
2222
$newJsonString = json_encode($data);
23-
file_put_contents('json/events.json', $newJsonString);
23+
file_put_contents('../data/events.json', $newJsonString);
2424

2525
} else if (isset($_POST['title']) && isset($_POST['description']) && isset($_POST['color']) && isset($_POST['id'])) {
26-
$jsonString = file_get_contents('json/events.json');
26+
$jsonString = file_get_contents('../data/events.json');
2727
$data = json_decode($jsonString, true);
2828
foreach ($data as $key => $entry) {
2929
if ($entry['id'] == $_POST['id']) {
@@ -33,9 +33,9 @@
3333
}
3434
}
3535
$newJsonString = json_encode($data);
36-
file_put_contents('json/events.json', $newJsonString);
36+
file_put_contents('../data/events.json', $newJsonString);
3737

3838
}
39-
header('Location: index-json.php');
39+
header('Location: ../index-json.php');
4040

4141
?>

editEventTitle.php renamed to core/editEventTitle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
require_once('auth.php');
3+
require_once('./utils/auth.php');
44
if (isset($_POST['delete']) && isset($_POST['id'])){
55

66

@@ -40,7 +40,7 @@
4040
}
4141

4242
}
43-
header('Location: index.php');
43+
header('Location: ../index.php');
4444

4545

4646
?>

0 commit comments

Comments
 (0)