summaryrefslogtreecommitdiff
path: root/server/doc/files/init.php.txt
blob: 8bfc0aa8fb3bc6f1b738486e30cbf4ac19120eeb (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
<?php
/**
 * File containing the initialisation of the API.
 *
 * @version 1.0 Initialisation of this file
 * @since 1.0 Core application's file
 * 
 * @author Eole 'eoledev at outlook . fr'
 * 
 */

/*
* Include Main Api Class
*/ 
include_once("core/App.php");

$user = "";
$password = "";
$project = "";


//token processing
if(isset($_POST["token"])){
	
	$token = $_POST["token"];
	
}else if(isset($_POST["user"]) && isset($_POST["password"]) && isset($_POST["project"]) ){	
	
	$user = $_POST["user"];
	$password = $_POST["password"];
	$project = $_POST["project"];
	
}

//Library args
$Args = Array(
	"user" => Array(
		"name" => $user,
		"password" => $password,
		"domain" => Array(
			"name" => "Default")
	),
	"scope" => Array(
		"project" => Array(
			"name" => $project,
			"domain" => Array(
				"name" => "Default")
			)
		),
	"authUrl" => $config["urlAuth"]
);

//Init core Api
$App = new App($Args);

if(isset($token))
	$App->setToken($token);
?>