-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex-workshop.php
More file actions
49 lines (30 loc) · 1.03 KB
/
index-workshop.php
File metadata and controls
49 lines (30 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
require __DIR__ . "/inc/bootstrap.php";
// CORS headers
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, OPTIONS");
header("Access-Control-Allow-Headers: Content-Type, Authorization");
//header("Content-Type: application/json");
// Handle preflight OPTIONS request
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
http_response_code(200);
exit();
}
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$uri = explode( '/', $uri );
//file_put_contents("log.txt","Getting Uri:". print_r($uri)."\n", FILE_APPEND );
if ((isset($uri[3]) && $uri[3] != 'workshop') || !isset($uri[4])) {
header("HTTP/1.1 404 Not Found");
exit();
}
require "controller/WorkshopController.php";
$objFeedController = new WorkshopController();
// Determine request method and call corresponding method
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$strMethodName = $uri[4] . 'Action';
$objFeedController->{$strMethodName}();
} else {
header("HTTP/1.1 405 Method Not Allowed");
exit();
}
?>