Example #1
0
require "../../plugins/php/ricoXmlResponse.php";
$id = isset($_GET["id"]) ? $_GET["id"] : "";
$parent = isset($_GET["Parent"]) ? $_GET["Parent"] : "";
echo "\n<ajax-response><response type='object' id='" . $id . "_updater'>";
if ($id == "") {
    echo "\n<rows update_ui='false' /><error>";
    echo "\nNo ID provided!";
    echo "\n</error>";
} elseif (!OpenDB()) {
    echo "\n<rows update_ui='false' /><error>";
    echo "\n" . htmlspecialchars($oDB->LastErrorMsg);
    echo "\n</error>";
} else {
    $oDB->DisplayErrors = false;
    $oDB->ErrMsgFmt = "MULTILINE";
    $oXmlResp = new ricoXmlResponse();
    echo "\n<rows update_ui='true' offset='0'>";
    if ($parent) {
        $oXmlResp->Query2xmlRaw("SELECT '{$parent}',CustomerID,CompanyName,'L',1 FROM customers where CompanyName like '{$parent}%'", 0, 99);
    } else {
        $oXmlResp->WriteTreeRow("", "root", "Customer names starting with...", "C", 0);
        $oXmlResp->Query2xmlRaw("SELECT distinct 'root',left(CompanyName,1),left(CompanyName,1),'C',0 FROM customers", 0, 99);
    }
    print "\n" . "</rows>";
    if (!empty($oDB->LastErrorMsg)) {
        echo "\n<error>";
        echo "\n" . htmlspecialchars($oDB->LastErrorMsg);
        echo "\n</error>";
    }
    $oXmlResp = NULL;
}
Example #2
0
<?php

header("Cache-Control: no-cache");
header("Pragma: no-cache");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + -1 * 60) . " GMT");
header("Content-type: text/xml");
echo "<?xml version='1.0' encoding='iso-8859-1'?>\n";
require "../../plugins/php/ricoXmlResponse.php";
$id = isset($_GET["id"]) ? $_GET["id"] : "";
$parent = isset($_GET["Parent"]) ? $_GET["Parent"] : "";
$numdigits = isset($_GET["digits"]) ? $_GET["digits"] : "5";
echo "\n<ajax-response><response type='object' id='" . $id . "_updater'>";
$oXmlResp = new ricoXmlResponse();
echo "\n<rows update_ui='true' offset='0'>";
if ($parent == "") {
    $oXmlResp->WriteTreeRow("", "", "Select a " . $numdigits . "-digit number", "C", 0);
}
$digitsRemaining = intval($numdigits) - strlen($parent);
if ($digitsRemaining > 1) {
    $suffix0 = str_repeat("0", $digitsRemaining - 1);
    $suffix9 = str_repeat("9", $digitsRemaining - 1);
    for ($i = 0; $i < 10; $i++) {
        $oXmlResp->WriteTreeRow($parent, $parent . $i, $parent . $i . $suffix0 . "-" . $parent . $i . $suffix9, "C", 0);
    }
} else {
    for ($i = 0; $i < 10; $i++) {
        $oXmlResp->WriteTreeRow($parent, $parent . $i, $parent . $i, "L", 1);
    }
}
echo "\n</rows>";
$oXmlResp = NULL;
Example #3
0
    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 {
    $filters = isset($_SESSION[$id . ".filters"]) ? $_SESSION[$id . ".filters"] : array();
    $oDB->DisplayErrors = false;
    $oDB->ErrMsgFmt = "MULTILINE";
    $oXmlResp = new ricoXmlResponse();
    $oXmlResp->sendDebugMsgs = true;
    $oXmlResp->convertCharSet = true;
    // MySQL sample database is encoded with ISO-8859-1
    if ($distinct == "") {
        $oXmlResp->Query2xml($_SESSION[$id], intval($offset), intval($size), $total != "false", $filters);
    } else {
        $oXmlResp->Query2xmlDistinct($_SESSION[$id], intval($distinct), -1, $filters);
    }
    if (!empty($oDB->LastErrorMsg)) {
        echo ",\n\"error\": " . json_encode($oDB->LastErrorMsg);
    }
    if (!empty($oXmlResp->LastErrorMsg)) {
        echo ",\n\"error\": " . json_encode($oXmlResp->LastErrorMsg);
    }
    $oXmlResp = NULL;
Example #4
0
$total = isset($_GET["get_total"]) ? strtolower($_GET["get_total"]) : "false";
echo "\n<ajax-response><response type='object' id='" . $id . "_updater'>";
if (empty($id)) {
    ErrorResponse("No ID provided!");
} elseif (!is_numeric($offset)) {
    ErrorResponse("Invalid offset!");
} elseif (!is_numeric($size)) {
    ErrorResponse("Invalid size!");
} 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 {
    $oDB->DisplayErrors = false;
    $oDB->ErrMsgFmt = "MULTILINE";
    $oXmlResp = new ricoXmlResponse();
    $oXmlResp->sendDebugMsgs = true;
    $oXmlResp->Query2xml($_SESSION[$id], intval($offset), intval($size), $total != "false", $_SESSION[$id . ".filters"]);
    if (!empty($oDB->LastErrorMsg)) {
        echo "\n<error>";
        echo "\n" . htmlspecialchars($oDB->LastErrorMsg);
        echo "\n</error>";
    }
    $oXmlResp = NULL;
    CloseApp();
}
echo "\n</response></ajax-response>";
function ErrorResponse($msg)
{
    echo "\n<rows update_ui='false' /><error>" . $msg . "</error>";
}