defbfa55 |
<?php
|
deedc3e3 |
require_once('config.php');
|
defbfa55 |
require_once('inc/debug.php');
|
f20a077b |
require_once('inc/db_connect.php');
require_once("inc/base.php");
/*
read configuration from database
*/
$options = db_query( "SELECT `key`, value FROM misc.config" );
while( $object = mysql_fetch_assoc( $options ) ) {
// echo "1";
// echo $object['key'];
$config[$object['key']]=$object['value'];
}
//print_r($config);
|
defbfa55 |
$go = $_GET['go'];
/*
sanitize $go
*/
|
eb53bf91 |
// filenames can end with .php
if ( substr( $go, strlen( $go ) - 4 ) == '.php' ) {
$go = substr( $go, 0, strlen($go) - 4);
}
DEBUG($go);
if (strstr($go, "..") or strstr($go, "./") or strstr($go, ":") or (! file_exists("modules/$go.php")) or (! is_file("modules/$go.php")))
|
defbfa55 |
{
die("illegal command");
}
|
26afb797 |
$tmp = explode('/', $go, 2);
$module = $tmp[0];
if (! in_array($module, $config['modules']))
{
die("illegal command");
}
|
defbfa55 |
/*
|
228275dc |
construct prefix
|
defbfa55 |
*/
global $prefix;
$prefix = "../";
$count = 0;
str_replace("/", "x", $go, $count);
$prefix = $prefix.str_repeat("../", $count);
require_once('session/start.php');
$output = "";
|
ede58dec |
$html_header = "";
|
fb92f399 |
require_once("inc/base.php");
|
defbfa55 |
/* setup module include path */
|
6a9c38d8 |
ini_set('include_path',ini_get('include_path').':./modules/'.$module.'/include:');
|
defbfa55 |
|
228275dc |
/* Look where we are (but let the module override) */
|
19cf5340 |
$section = str_replace("/", "_", $go);
|
228275dc |
|
defbfa55 |
/* Let the module work */
|
eb53bf91 |
include("modules/".$go.".php");
|
defbfa55 |
include('inc/top.php');
print $output;
include('inc/bottom.php');
?>
|