Beispiel #1
0
/**
 * Global Hook to interact with the REST api
 * Pass the variables in the REST object to 
 * make request 
 * 
 * variables REST object expects
 * url --> on which request is to be made
 * appkey --> app key for authentication
 * host --> host from which request have been sent
 * 
 * @return $achievements_return_set global array returns the template data
 */
function achievements_hook_call_rest()
{
    // defined the variables
    global $var_set;
    global $achievements_return_set;
    if (isset($_POST['get_data'])) {
        hook_variable_set();
        // here we make the REST connection
        $rest_api = new Rest_Api();
        $ach_data = $rest_api->request($var_set['url'], $var_set['app_key'], $var_set['host'], $var_set['items']);
        // here we store the response we get from the server
        $achievements_return_set['char_achievements'] = $ach_data;
    }
}
Beispiel #2
0
    {
        if ($this->get_request_method() != "DELETE") {
            $this->response('', 406);
        }
        $uploader = $this->getUploader();
        if (!$uploader->delete_file()) {
            $this->response("Not enough rights", 403);
        }
    }
    public function updatefile()
    {
        if ($this->get_request_method() != "POST") {
            $this->response('', 406);
        }
        $uploader = $this->getUploader();
        if (!$uploader->update_file()) {
            $this->response("Not enough rights", 403);
        }
    }
    public function uploadfiles()
    {
        if ($this->get_request_method() != "POST") {
            $this->response('', 406);
        }
        $uploader = $this->getUploader();
        $uploader->upload_files();
    }
}
// Initiiate Library
$api = new Rest_Api();
$api->processApi();
<?php

include 'Rest/Api.php';
$api = new Rest_Api();
$api->process();