source: rest.php @ b65617

Revision b65617, 1.6 KB checked in by pierre-alain <pierre-alain@…>, 7 years ago (diff)

code cleaning

  • Property mode set to 100644
Line 
1<?php
2/**
3 * Handling REST requests
4 * Get the request and call the controller
5 *
6 * PHP 5
7 *
8 * OWR - OpenWebReader
9 *
10 * Copyright (c) 2009, Pierre-Alain Mignot
11 *
12 * Home page: http://openwebreader.org
13 *
14 * E-Mail: contact@openwebreader.org
15 *
16 * All Rights Reserved
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31 *
32 * @author Pierre-Alain Mignot <contact@openwebreader.org>
33 * @copyright Copyright (c) 2009, Pierre-Alain Mignot
34 * @licence http://www.gnu.org/copyleft/gpl.html
35 * @package OWR
36 */
37namespace OWR\REST;
38
39define('PATH', __DIR__.DIRECTORY_SEPARATOR); // define root path
40define('HOME_PATH', PATH.'OWR'.DIRECTORY_SEPARATOR); // define home path
41
42if(!file_exists(HOME_PATH.'cfg.php'))
43{ // not installed
44    exit;
45}
46
47// include the config file
48require HOME_PATH.'cfg.php';
49
50use OWR\Exception,
51    OWR\Logs;
52try
53{
54    Controller::iGet()->execute(new Request)->renderPage();
55}
56catch(Exception $e)
57{
58    Logs::iGet()->log($e->getContent(), $e->getCode());
59    Controller::iGet()->renderPage($e->getCode());
60}
61
62exit;
Note: See TracBrowser for help on using the repository browser.