-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.php
35 lines (28 loc) · 1011 Bytes
/
index.php
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
<?php
namespace ExternalModules;
require_once dirname(__FILE__) . '/classes/ExternalModules.php';
$id = $_GET['id'];
$page = $_GET['page'];
$pid = @$_GET['pid'];
$prefix = ExternalModules::getPrefixForID($id);
if(empty($prefix)){
die("A module with id $id could not be found!");
}
$version = ExternalModules::getSystemSetting($prefix, ExternalModules::KEY_VERSION);
if(empty($version)){
die("The requested module is currently disabled systemwide.");
}
if($pid != null){
$enabled = ExternalModules::getProjectSetting($prefix, $pid, ExternalModules::KEY_ENABLED);
if(!$enabled){
die("The requested module is currently disabled on this project.");
}
}
if (preg_match("/^https:\/\//", $page) || preg_match("/^http:\/\//", $page)) {
header( 'Location: '.$page ) ;
}
$pagePath = ExternalModules::$MODULES_PATH . ExternalModules::getModuleDirectoryName($prefix, $version) . "/$page.php";
if(!file_exists($pagePath)){
die("The specified page does not exist for this module.");
}
require_once $pagePath;