equal
deleted
inserted
replaced
|
1 <?php |
|
2 |
|
3 require_once(realpath(dirname(__FILE__) . "/../resources/config.php")); |
|
4 |
|
5 require_once(LIBRARY_PATH . "/templateFunctions.php"); |
|
6 require_once(LIBRARY_PATH . "/utilsFunctions.php"); |
|
7 require_once(LIBRARY_PATH . "/renkanFunctions.php"); |
|
8 require_once(LIBRARY_PATH . "/dbFunctions.php"); |
|
9 |
|
10 if ($_SERVER['REQUEST_METHOD'] === 'PUT' || $_SERVER['REQUEST_METHOD'] === 'POST') { |
|
11 |
|
12 //TODO implement CSRF with https://github.com/BKcore/NoCSRF for example |
|
13 $renkanId = genUuid4(); |
|
14 $title = isset($_POST['title']) ? $_POST['title'] : ""; |
|
15 if(empty($title)) { |
|
16 $title = "new Renkan"; |
|
17 } |
|
18 |
|
19 $description = isset($_POST['description']) ? $_POST['description'] : "New renkan"; |
|
20 |
|
21 insertProject($renkanId, $title, emptyRenkan($title, $description, $renkanId)); |
|
22 |
|
23 header('Location: '.selfURL()."?renkanId=$renkanId"); |
|
24 die(); |
|
25 } |
|
26 |
|
27 $variables = ['config' => $config, 'renkanId' => $_GET['renkanId']]; |
|
28 $css = [ |
|
29 'static/lib/renkan/css/renkan.css' |
|
30 ]; |
|
31 |
|
32 renderLayoutWithContentFile("renkan_edit.php", $variables, $css); |