-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroute.php
More file actions
86 lines (78 loc) · 2.27 KB
/
route.php
File metadata and controls
86 lines (78 loc) · 2.27 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
define('BASE_URL', '//' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . dirname($_SERVER['PHP_SELF']) . '/');
require_once 'controller/ProductController.php';
require_once 'controller/BrandController.php';
require_once 'controller/UserController.php';
require_once 'controller/CommentController.php';
$productController = new ProductController();
$brandController = new BrandController();
$userController = new UserController();
$commentController = new CommentController();
if (!empty($_GET['action'])) {
$action = $_GET['action'];
} else {
$action = "home";
}
$params = explode('/', $action);
switch ($params[0]) {
case 'home':
$productController->getFilteredProducts($params[1],$params[2],$params[3]);
break;
case 'admins':
$productController->adminView();
break;
case 'deleteProduct':
$productController->deleteProduct($params[1]);
break;
case 'newProduct':
$productController->newProduct();
break;
case 'editProduct':
$productController->edit();
break;
case 'newBrand':
$brandController->new();
break;
case 'deleteBrand':
$brandController->delete($params[1]);
break;
case 'editBrand':
$brandController->edit();
break;
case 'showProduct':
$productController->getProduct($params[1]);
break;
case 'newAdmin':
$userController->newAdmin();
break;
case 'signIn':
$userController->signIn();
break;
case 'logOut':
$userController->logOut();
break;
case 'registration':
$userController->showSignInView();
break;
case 'newAccount':
$userController->logInView();
break;
case 'newUser':
$userController->newUser();
break;
case 'userRole':
$userController->edit($params[1],$params[2]);
break;
case 'deleteUser':
$userController->delete($params[1]);
break;
case 'adminComments':
$commentController->showComments();
break;
case 'deleteImageProduct':
$productController->deleteImageProduct($params[1]);
break;
default:
$productController->getFilteredProducts($params[1],$params[2],$params[3]);
break;
}