forked from modxcms/evolution
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index-ajax.php
33 lines (29 loc) · 974 Bytes
/
index-ajax.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
<?php
// harden it
require_once('./manager/includes/protect.inc.php');
// initialize the variables prior to grabbing the config file
$database_type = "";
$database_server = "";
$database_user = "";
$database_password = "";
$dbase = "";
$table_prefix = "";
$base_url = "";
$base_path = "";
// get the required includes
if($database_user=='') {
if (!$rt = @include_once "manager/includes/config.inc.php") {
exit('Could not load MODx configuration file!');
}
}
if($axhandler = (strtoupper($_SERVER['REQUEST_METHOD'])=='GET') ? $_GET['q'] : $_POST['q']) {
$axhandler = preg_replace('/[^A-Za-z0-9_\-\.\/]/', '', $axhandler);
$axhandler = realpath($axhandler) or die();
$directory = realpath(MODX_BASE_PATH.DIRECTORY_SEPARATOR.'/assets/snippets');
$axhandler = realpath($directory.str_replace($directory, '', $axhandler));
if($axhandler && (strtolower(substr($axhandler,-4))=='.php')) {
include_once($axhandler);
exit;
}
}
?>