コード例 #1
0
function getDataGridFilter($handler)
{
    $filter = array();
    $i = 0;
    //Filter filter parameters to valid enties
    while (isset($_REQUEST["fk{$i}"]) && isset($_REQUEST["fo{$i}"]) && isset($_REQUEST["fv{$i}"])) {
        if ($handler->hasField(unescaped($_REQUEST, "fk{$i}"))) {
            $filter[$i]['key'] = unescaped($_REQUEST, "fk{$i}");
            if (isLegalOperator(unescaped($_REQUEST, "fo{$i}"))) {
                $filter[$i]['op'] = unescaped($_REQUEST, "fo{$i}");
                try {
                    $filter[$i]['val'] = transferType($handler->getFieldType(unescaped($_REQUEST, "fk{$i}")), unescaped($_REQUEST, "fv{$i}"));
                } catch (TransferException $ex) {
                    //Untransferable Data Type
                    echo 'Illegal filter value: ' . $_REQUEST["fv{$i}"];
                    exit;
                }
            } else {
                //illegal filter operator
                echo 'Illegal filter operator: ' . $_REQUEST["fo{$i}"];
                exit;
            }
        } else {
            //unknown filter key
            echo 'Unknown filter key: ' . $_REQUEST["fk{$i}"];
            exit;
        }
        $i++;
    }
    return $filter;
}
コード例 #2
0
            //unknown order key
            echo 'Unknown order key: ' . $_GET["ok{$i}"];
            exit;
        }
    } else {
        //unset order key, do not process further
        break;
    }
}
$filter = array();
$i = 0;
//Filter filter parameters to valid enties
while (isset($_GET["fk{$i}"]) && isset($_GET["fo{$i}"]) && isset($_GET["fv{$i}"])) {
    if ($handler->hasField(unescaped($_GET, "fk{$i}"))) {
        $filter[$i]['key'] = unescaped($_GET, "fk{$i}");
        if (isLegalOperator(unescaped($_GET, "fo{$i}"))) {
            $filter[$i]['op'] = unescaped($_GET, "fo{$i}");
            try {
                $filter[$i]['val'] = transferType($handler->getFieldType(unescaped($_GET, "fk{$i}")), unescaped($_GET, "fv{$i}"));
            } catch (TransferException $ex) {
                //Untransferable Data Type
                echo 'Illegal filter value: ' . $_GET["fv{$i}"];
                exit;
            }
        } else {
            //illegal filter operator
            echo 'Illegal filter operator: ' . $_GET["fo{$i}"];
            exit;
        }
    } else {
        //unknown filter key