Example #1
0
# DO NOT CHANGE ANYTHING BELOW THIS LINE UNLESS
# YOU REALLY KNOW WHAT ARE YOU DOING
// Process the request
if ($restAPI->getAPIKey() !== NULL && $restAPI->isDefaultAPIKey()) {
    // API is set but not changed from the default API key.
    $restAPI->throwError(17);
} else {
    if ($restAPI->getAPIKey() !== NULL && !$restAPI->hasRequest('hash') && !$restAPI->isPublicAction()) {
        // Hash argument is required and was not found, throw error.
        $restAPI->throwError(3, 'hash');
    } else {
        if (!$restAPI->getHash() && !$restAPI->isPublicAction()) {
            // Hash argument is empty or not set, throw error.
            $restAPI->throwError(1, 'hash');
        } else {
            if (!$restAPI->isAuthenticated() && !$restAPI->isPublicAction()) {
                // Hash is not valid and action is not public, throw error.
                $restAPI->throwError(6, $restAPI->getHash(), 'hash');
            } else {
                if (!$restAPI->hasRequest('action')) {
                    // Action argument was not found, throw error.
                    $restAPI->throwError(3, 'action');
                } else {
                    if (!$restAPI->getAction()) {
                        // Action argument is empty or not set, throw error.
                        $restAPI->throwError(1, 'action');
                    } else {
                        if (!$restAPI->isSupportedAction()) {
                            // Action is not supported, throw error.
                            $restAPI->throwError(2, $restAPI->getAction());
                        } else {