source: admin/WebConsole/rest/index.php @ 74cd321

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Last change on this file since 74cd321 was 1485b99, checked in by ramon <ramongomez@…>, 9 years ago

#708: Usar parámetros id y name en lista de UOs.

git-svn-id: https://opengnsys.es/svn/branches/version1.1@4939 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[7829e4e]1<?php
2/**
3 * @file    index.php
4 * @brief   OpenGnsys REST API manager.
[b584da5]5 * @warning All input and output messages are formatted in JSON.
[7829e4e]6 * @note    Some ideas are based on article "How to create REST API for Android app using PHP, Slim and MySQL" by Ravi Tamada, thanx.
7 * @license GNU GPLv3+
8 * @author  Ramón M. Gómez, ETSII Univ. Sevilla
9 * @version 1.1
[1485b99]10 * @date    2016-05-19
[7829e4e]11 */
12
13// Inclussion files.
14
15// Server access data.
16include_once("../controlacceso.php");
17include_once("../clases/AdoPhp.php");
18include_once("../includes/CreaComando.php");
19// Connection class.
[c03c7c3]20@include_once("../includes/constantes.php");
[7829e4e]21include_once("../includes/comunes.php");
22include_once("../clases/SockHidra.php");
23               
24// Slim framework.
25include_once("Slim/Slim.php");
26\Slim\Slim::registerAutoloader();
27
28// Server access control.
29$cmd = CreaComando($cnx);
30if (!$cmd)
31        die("Access Error");
32
33// Install Slim application (development mode).
34//$app = new \Slim\Slim(array('mode' => 'production', 'debug' => false));
35$app = new \Slim\Slim(array(
36                'mode' => 'development',
37                'debug' => true));
38$app->setName('opengnsys');
39
40// Global variables.
[4454169b]41$userid = NULL;                 // User id. with access to REST API.
[7829e4e]42
[fb2ee20]43// Check if services are running.
44$config = parse_ini_file("/etc/default/opengnsys");
[7829e4e]45
[fb2ee20]46// If server is running, include its routes and OGAgent push routes.
47if ($config['RUN_OGADMSERVER'] === "yes") {
48    include("server.php");
49    include("ogagent.php");
[7829e4e]50}
51
[fb2ee20]52// If repository is running, include its routes.
53if ($config['RUN_OGADMREPO'] === "yes") {
54    include("repository.php");
[7829e4e]55}
56
[b1735a7]57
58// Execute REST using Slim.
[7829e4e]59$app->run();
60
61?>
62
Note: See TracBrowser for help on using the repository browser.