Please check the snippet code in MODX manager.";
}
else {
include_once AS_PATH . "classes/ajaxSearch.class.inc.php";
define('MODX_API_MODE', true);
include_once (MODX_MANAGER_PATH . 'includes/document.parser.class.inc.php');
if(!is_object($modx)) $modx = new DocumentParser;
$modx->db->connect();
$modx->getSettings();
startCMSSession();
$tstart = $modx->getMicroTime();
$default = AS_PATH . 'configs/default.config.php';
if (file_exists($default)) include $default;
else return "
AjaxSearch error: $default not found !
Check the existing of this file!
";
if (!isset($dcfg)) return "AjaxSearch error: default configuration array not defined in $default!
Check the content of this file!
";
$config = getUserConfigName((strip_tags($_POST['ucfg'])));
// Load the custom functions of the custom configuration file if needed
if ($config) {
if (substr($config, 0, 6) != "@FILE:") {
// remove all not alphanumeric chars exept underscore and minus in the filename
$config = preg_replace('/[^a-zA-Z0-9_-]/i','', $config);
$lconfig = AS_PATH . "configs/{$config}.config.php";
if (file_exists($lconfig)) {
include $lconfig;
} else {
return "AjaxSearch error: " . $lconfig . " not found !
Check your config parameter or your config file name!
";
}
} else {
return "AjaxSearch error: @FILE: prefix not allowed !
Check your config parameter or your config file name!
";
}
}
if ($dcfg['version'] != AS_VERSION) return "AjaxSearch error: Version number mismatch. Check the content of the default configuration file!
";
$as = new AjaxSearch();
$output = $as->run($tstart, $dcfg);
header("Content-type: text/html; charset=".$modx->getConfig('modx_charset'));
}
echo $output;
}