<?php
if(!defined('__KIMS__')) exit;

if (!is_string($a) || !preg_match('/^[A-Za-z0-9_-]+(?:\/[A-Za-z0-9_-]+)*$/', $a))
{
	http_response_code(400);
	exit('Invalid action.');
}
if (!kimsq_valid_action_request())
{
	http_response_code(403);
	exit('Invalid or expired request.');
}

$_filterSet = array('nic','name','id');
foreach ($_filterSet as $_ft)
{
	if (isset(${$_ft}) && is_string(${$_ft})) ${$_ft} = strip_tags(${$_ft});
}

$g['act_module0'] = $g['dir_module'].$a.'.php';
$g['act_module1'] = $g['dir_module'].'lang.'.$_HS['lang'].'/action/'.(strpos($a,'/')?str_replace('/','/a.',$a):'a.'.$a).'.php';
$g['act_module2'] = $g['dir_module'].'action/a.'.$a.'.php';

if (is_file($g['act_module0'])) include $g['act_module0'];
if (is_file($g['act_module1'])) include $g['act_module1'];
if (is_file($g['act_module2'])) include $g['act_module2'];
?>
