[go: up one dir, main page]

Menu

[r5]: / VCF5-Core / trunk / index.php  Maximize  Restore  History

Download this file

94 lines (87 with data), 4.0 kB

 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/**
* VCF5 Project - Open Federated Microformat Project
*
* You may not change or alter any portion of this comment or credits
* of supporting developers from this source code or any supporting source code
* which is considered copyrighted (c) material of the original comment or credit authors.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* @copyright Chronolabs Cooperative http://syd.au.snails.email
* @license ACADEMIC APL 2 (https://sourceforge.net/u/chronolabscoop/wiki/Academic%20Public%20License%2C%20version%202.0/)
* @license GNU GPL 3 (http://www.gnu.org/licenses/gpl.html)
* @package vcf5.core
* @since 1.0.1
* @author Dr. Simon Antony Roberts <wishcraft@users.sourceforge.net>
* @version 1.0.0
* @description This is the core for the VCF5 the Variant Caller File is appified in version 5 for federation
* @link http://blog.vcf.email
* @link https://github.com/VCF5
* @link https://sourceforge.net/projects/vcf5
* @link https://facebook.com/vcf5project
* @link https://twitter.com/vcf5project
*
*/
if (file_exists(__DIR__ . '/mainfile.php')) {
include __DIR__ . '/mainfile.php';
}
if (!defined('VCF5_MAINFILE_INCLUDED')) {
if (file_exists(__DIR__ . '/install/index.php')) {
header('Location: install/index.php');
exit;
}
}
$vcf5Event = Vcf5Event::getInstance();
$vcf5Event->triggerEvent('core.index.start');
//check if start page is defined
if (isset($vcf5Config['startpage']) && $vcf5Config['startpage'] != '' && $vcf5Config['startpage'] != '--' && vcf5_isActiveApp($vcf5Config['startpage'])) {
// Temporary solution for start page redirection
define('VCF5_STARTPAGE_REDIRECTED', 1);
global $vcf5AppConfig;
/* @var $app_handler Vcf5AppHandler */
$app_handler = vcf5_getHandler('app');
$vcf5App = $app_handler->getByDirname($vcf5Config['startpage']);
if (!$vcf5App || !$vcf5App->getVar('isactive')) {
include_once $GLOBALS['vcf5']->path('header.php');
echo '<h4>' . _MODULENOEXIST . '</h4>';
include_once $GLOBALS['vcf5']->path('footer.php');
exit();
}
/* @var $appperm_handler Vcf5GroupPermHandler */
$appperm_handler = vcf5_getHandler('groupperm');
if ($vcf5User) {
if (!$appperm_handler->checkRight('app_read', $vcf5App->getVar('mid'), $vcf5User->getGroups())) {
redirect_header(VCF5_URL, 1, _NOPERM, false);
}
$vcf5UserIsAdmin = $vcf5User->isAdmin($vcf5App->getVar('mid'));
} else {
if (!$appperm_handler->checkRight('app_read', $vcf5App->getVar('mid'), VCF5_GROUP_ANONYMOUS)) {
redirect_header(VCF5_URL . '/user.php', 1, _NOPERM);
}
}
if ($vcf5App->getVar('hasconfig') == 1 || $vcf5App->getVar('hascomments') == 1 || $vcf5App->getVar('hasnotification') == 1) {
$vcf5AppConfig = $config_handler->getConfigsByCat(0, $vcf5App->getVar('mid'));
}
chdir('apps/' . $vcf5Config['startpage'] . '/');
vcf5_loadLanguage('main', $vcf5App->getVar('dirname', 'n'));
$parsed = parse_url(VCF5_URL);
$url = isset($parsed['scheme']) ? $parsed['scheme'] . '://' : 'http://';
if (isset($parsed['host'])) {
$url .= $parsed['host'];
if (isset($parsed['port'])) {
$url .= ':' . $parsed['port'];
}
} else {
$url .= $_SERVER['HTTP_HOST'];
}
$_SERVER['REQUEST_URI'] = substr(VCF5_URL, strlen($url)) . '/apps/' . $vcf5Config['startpage'] . '/index.php';
include $GLOBALS['vcf5']->path('apps/' . $vcf5Config['startpage'] . '/index.php');
exit();
} else {
$vcf5Option['show_cblock'] = 1;
$GLOBALS['vcf5Option']['template_main'] = 'db:system_homepage.html';
include $GLOBALS['vcf5']->path('header.php');
include $GLOBALS['vcf5']->path('footer.php');
}