\n";
require_once('../lib/dbase.php');
require_once('../lib/dbClass.php');
require_once('../lib/rico/ricoXmlResponse.php');
$id=isset($_GET["id"]) ? $_GET["id"] : "";
$offset=isset($_GET["offset"]) ? $_GET["offset"] : "0";
$size=isset($_GET["page_size"]) ? $_GET["page_size"] : "";
$total=isset($_GET["get_total"]) ? strtolower($_GET["get_total"]) : "false";
$distinct=isset($_GET["distinct"]) ? $_GET["distinct"] : "";
echo "\n";
if (empty($id)) {
ErrorResponse("No ID provided!");
} elseif ($distinct=="" && !is_numeric($offset)) {
ErrorResponse("Invalid offset!");
} elseif ($distinct=="" && !is_numeric($size)) {
ErrorResponse("Invalid size!");
} elseif ($distinct!="" && !is_numeric($distinct)) {
ErrorResponse("Invalid distinct parameter!");
} elseif (!isset($_SESSION[$id])) {
ErrorResponse("Your connection with the server was idle for too long and timed out. Please refresh this page and try again.");
} elseif (!OpenDB()) {
ErrorResponse(htmlspecialchars($oDB->LastErrorMsg));
} else {
if (empty($_GET['second_id'])) {
$fname = substr($id,5);
load_mask($fname);
grid_sql($fname, $mask);
}
$filters=isset($_SESSION[$id . ".filters"]) ? $_SESSION[$id . ".filters"] : array();
$oDB->DisplayErrors=false;
$oDB->ErrMsgFmt="MULTILINE";
$oXmlResp= new ricoXmlResponse();
$oXmlResp->sendDebugMsgs=true;
$oXmlResp->convertCharSet=false; // Database is already in UTF-8
if (isset($_GET['second_id']))
$query = str_replace('{id}', $_GET['second_id'], $_SESSION[$id]);
else
$query = $_SESSION[$id];
if ($distinct=="") {
$oXmlResp->Query2xml($query, intval($offset), intval($size), $total!="false", $filters);
} else {
if (isset($_SESSION[$id.'_distinct_'.$distinct]))
$oXmlResp->Query2xmlDistinct($query, intval($distinct), -1, $filters, $_SESSION[$id.'_distinct_'.$distinct]);
else
$oXmlResp->Query2xmlDistinct($query, intval($distinct), -1, $filters);
}
if (!empty($oDB->LastErrorMsg)) {
echo "\n";
echo "\n".htmlspecialchars($oDB->LastErrorMsg);
echo "\n";
}
$oXmlResp=NULL;
# CloseApp();
}
echo "\n";
function ErrorResponse($msg) {
echo "\n" . $msg . "";
}
?>