FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
index.php
1 <?php
2 /***********************************************************
3  * Copyright (C) 2008-2011 Hewlett-Packard Development Company, L.P.
4  * Copyright (C) 2014 Siemens AG
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * version 2 as published by the Free Software Foundation.
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 along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  ***********************************************************/
19 
22 
28 /* initialize session variable to run test in cli mode */
29 if (! isset($_SESSION)) {
30  $_SESSION = array();
31 }
32 
33 $startTime = microtime(true);
34 require_once(__DIR__ . "/../../lib/php/bootstrap.php");
35 
36 $PG_CONN = 0; // Database connection
37 
38 /* Set SYSCONFDIR and set global (for backward compatibility) */
39 $SysConf = bootstrap();
40 
41 global $container;
43 $timingLogger = $container->get("log.timing");
44 $timingLogger->logWithStartTime("bootstrap", $startTime);
45 
46 /* Load UI templates */
47 $loader = $container->get('twig.loader');
48 $loader->addPath(dirname(__FILE__).'/template');
49 
50 /* Initialize global system configuration variables $SysConfig[] */
51 $timingLogger->tic();
52 ConfigInit($SYSCONFDIR, $SysConf);
53 $timingLogger->toc("setup init");
54 
55 $timingLogger->tic();
56 plugin_load();
57 plugin_preinstall();
58 plugin_postinstall();
59 $timingLogger->toc("setup plugins");
60 
61 $plugin = plugin_find(GetParm("mod", PARM_STRING) ?: HomePage::NAME);
62 if ($plugin) {
63  $timingLogger->tic();
64  $plugin->execute();
65  $timingLogger->toc("plugin execution");
66 } else {
67  $linkUri = Traceback_uri() . "?mod=auth";
68  $errorText = _("Module unavailable or your login session timed out.");
69  print "$errorText <P />";
70  $linkText = _("Click here to continue.");
71  print "<a href=\"$linkUri\">$linkText</a>";
72 }
73 plugin_unload();
74 
75 $container->get("db.manager")->flushStats();
76 return 0;
Traceback_uri()
Get the URI without query to this location.
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
Definition: common-parm.php:57
plugin_find($pluginName)
Given the official name of a plugin, return the $Plugins object.
const PARM_STRING
Definition: common-parm.php:29
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN
plugin_load()
Load every module ui found in mods-enabled.
bootstrap($sysconfdir="")
Bootstrap the fossology php library.
Definition: migratetest.php:93
ConfigInit($sysconfdir, &$SysConf)
Initialize the fossology system after bootstrap().