<?php
if (!isset($SAJAX_INCLUDED)) {
/*
* GLOBALS AND DEFAULTS
*
*/
$GLOBALS['sajax_version'] = "0.13";
$GLOBALS['sajax_debug_mode'] = false;
$GLOBALS['sajax_export_array'] = array();
$GLOBALS['sajax_export_list'] = array();
$GLOBALS['sajax_remote_uri'] = "";
$GLOBALS['sajax_failure_redirect'] = "";
$GLOBALS['sajax_request_type'] = "GET";
/*
* CODE
*
*/
function sajax_handle_client_request() {
return;
if (!empty($_GET["rs"])) {
// Always call server
header ("Cache-Control: max-age=0, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
$func_name = $_GET["rs"];
if (! empty($_GET["rsargs"]))
$args = $_GET["rsargs"];
} else {
$func_name = $_POST["rs"];
if (! empty($_POST["rsargs"]))
$args = $_POST["rsargs"];
}
function array_addslashes($value) {
return array_map("array_addslashes", $value);
else
}
$args = array_map("array_addslashes", $args);
}
} else {
}
global $sajax_export_list;
if (! in_array($func_name, $sajax_export_list)) {
$error = $func_name." not callable";
} else {
}
header('Content-Type: text/plain; charset=UTF-8');
echo '-:'.$error;
} else {
}
}
$sajax_js_has_been_shown = false;
function sajax_show_javascript()
{
global $sajax_js_has_been_shown;
global $sajax_debug_mode;
global $sajax_failure_redirect;
if (! $sajax_js_has_been_shown) {
?>
sajax_debug_mode = <?php echo($sajax_debug_mode ? "true" : "false"); ?>;
sajax_failure_redirect = "<?php echo($sajax_failure_redirect); ?>";
<?php
global $sajax_export_array;
foreach($sajax_export_array as $function) {
?>
function x_<?php echo($function["name"]); ?>() {
return sajax_do_call("<?php echo($function["name"]); ?>", arguments, "<?php echo($function["method"]); ?>", <?php echo($function["asynchronous"] ? 'true' : 'false'); ?>, "<?php echo($function["uri"]); ?>");
}
<?php
}
$sajax_js_has_been_shown = true;
}
}
function sajax_export() {
global $sajax_export_array;
global $sajax_export_list;
global $sajax_request_type;
global $sajax_remote_uri;
for ($i=0; $i<$num; $i++) {
$function = array("name" => $function);
if(!isset($function["method"]))
$function["method"] = $sajax_request_type;
if(!isset($function["asynchronous"]))
$function["asynchronous"] = true;
if(!isset($function["uri"]))
$function["uri"] = $sajax_remote_uri;
if ($key === false) {
$sajax_export_array[] = $function;
$sajax_export_list[] = $function["name"];
} else {
//Overwrite old function
$sajax_export_array[$key] = $function;
$sajax_export_list[$key] = $function["name"];
}
}
}
$SAJAX_INCLUDED = 1;
}
?>