summaryrefslogtreecommitdiff
path: root/server/index.php
blob: 53a24c48a1d3811f9aa86891969757cb77145da8 (plain)
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
<?php
	require "vendor/autoload.php";
	include_once("config.inc.php");
	include_once("init.php");
	
	if(isset($_POST["task"]) && isset($_POST["action"])){
		$task = $_POST["task"];
		$action = $_POST["action"];
	}else if(isset($_POST["task"]) && $_POST["task"] == "Authenticate" || $_POST["task"] == "Deauthenticate"){
		$task = $_POST["task"];
	}else{
		//Gestion Erreur
	}
	
	if($task == "Authenticate"){
		
		$App->authenticate();
		$App->show();
		
	}else if($task == "Deauthenticate"){
		
		$App->deauthenticate();
		$App->show();
		
	}else if($App->checkToken()){
		switch($task)
		{
			case "identity":
				include_once("core/Identity.php");
				$identityObject = new identity($App);
				$identityObject->action($action);
				$App->show();
				break;
			
			case "network":
				include_once("core/Network.php");
				$networkObject = new network($App);
				$networkObject->action($action);
				$App->show();
				break;	
			
			case "image":
				include_once("core/Image.php");
				$imageObject = new image($App);
				$imageObject->action($action);
				$App->show();
				break;
	
			case "compute":
				include_once("core/Compute.php");
				$computeObject = new compute($App);
				$computeObject->action($action);
				$App->show();
				break;
				
			case "networkLayer3":
				include_once("core/NetworkLayer3.php");
				$computeObject = new networkLayer3($App);
				$computeObject->action($action);
				$App->show();
				break;
		}
		
	}else{
		$App->setOutput("Error", "Token Invalide");
		$App->show();
	}