Completed
Push — feature/fixing_cost ( 414fbf...99877f )
by Laurent
01:40
created

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/* Copyright (C) 2007-2015 Laurent Destailleur  <[email protected]>
3
 * Copyright (C) ---Put here your own copyright and developer email---
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
 */
18
19
/**
20
 *    \file       flightlog/bbcvols_card.php
21
 *        \ingroup    flightlog
22
 *        \brief      This file is an example of a php page
23
 *                    Initialy built by build_class_from_table on 2017-02-09 11:10
24
 */
25
26
$res = 0;
27
if (!$res && file_exists("../main.inc.php")) {
28
    $res = @include '../main.inc.php';
29
}                    // to work if your module directory is into dolibarr root htdocs directory
30
if (!$res && file_exists("../../main.inc.php")) {
31
    $res = @include '../../main.inc.php';
32
}            // to work if your module directory is into a subdir of root htdocs directory
33
if (!$res && file_exists("../../../dolibarr/htdocs/main.inc.php")) {
34
    $res = @include '../../../dolibarr/htdocs/main.inc.php';
35
}     // Used on dev env only
36
if (!$res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) {
37
    $res = @include '../../../../dolibarr/htdocs/main.inc.php';
38
}   // Used on dev env only
39
if (!$res) {
40
    die("Include of main fails");
41
}
42
// Change this following line to use the correct relative path from htdocs
43
include_once(DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php');
44
45
dol_include_once('/flightlog/flightlog.inc.php');
46
47
$langs->load("mymodule@flightlog");
48
$langs->load("other");
49
50
global $db, $user;
51
52
$routes = require './Infrastructure/Common/Routes/routes.conf.php';
53
$routesGuards = require './Infrastructure/Common/Routes/guards.conf.php';
54
55
$response = null;
56
try{
57
    $routeName = GETPOST('r');
58
59
    $routeManager = new \FlightLog\Infrastructure\Common\Routes\RouteManager($db);
60
    $routeManager->load($routes);
61
    $routeManager->loadGuards($routesGuards);
62
63
    $response = $routeManager->__invoke($routeName, $user);
64
65 View Code Duplication
    if($response instanceof \FlightLog\Http\Web\Response\Redirect){
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
66
        if (headers_sent()) {
67
            echo(sprintf("<script>location.href='%s'</script>", $response->getUrl()));
68
            exit;
69
        }
70
71
        header(sprintf("Location: %s", $response->getUrl()));
72
        exit;
73
    }
74
75
}catch (\Exception $e){
76
    dol_syslog($e->getMessage(), LOG_ERR);
77
    $response = new \FlightLog\Http\Web\Response\Response($e->getMessage());
78
}
79
80
llxHeader('', 'Carnet de vol', '');
81
82
include $response->getTemplate();
83
84
// End of page
85
llxFooter();
86
$db->close();
87