+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2016 |
+ | Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
* This class handles all REST client requests.
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2016
+ * @copyright CiviCRM LLC (c) 2004-2017
*/
class CRM_Utils_REST {
$requestParams = CRM_Utils_Request::exportValues();
// Get the function name being called from the q parameter in the query string
- $q = CRM_Utils_array::value('q', $requestParams);
+ $q = CRM_Utils_Array::value('q', $requestParams);
// or for the rest interface, from fnName
- $r = CRM_Utils_array::value('fnName', $requestParams);
+ $r = CRM_Utils_Array::value('fnName', $requestParams);
if (!empty($r)) {
$q = $r;
}
- $entity = CRM_Utils_array::value('entity', $requestParams);
+ $entity = CRM_Utils_Array::value('entity', $requestParams);
if (empty($entity) && !empty($q)) {
$args = explode('/', $q);
// If the function isn't in the civicrm namespace, reject the request.
// or the api format (entity+action)
$args = array();
$args[0] = 'civicrm';
- $args[1] = CRM_Utils_array::value('entity', $requestParams);
- $args[2] = CRM_Utils_array::value('action', $requestParams);
+ $args[1] = CRM_Utils_Array::value('entity', $requestParams);
+ $args[2] = CRM_Utils_Array::value('action', $requestParams);
}
// Everyone should be required to provide the server key, so the whole
// first check for civicrm site key
if (!CRM_Utils_System::authenticateKey(FALSE)) {
$docLink = CRM_Utils_System::docURL2("Managing Scheduled Jobs", TRUE, NULL, NULL, NULL, "wiki");
- $key = CRM_Utils_array::value('key', $requestParams);
+ $key = CRM_Utils_Array::value('key', $requestParams);
if (empty($key)) {
return self::error("FATAL: mandatory param 'key' missing. More info at: " . $docLink);
}
*/
public function loadCMSBootstrap() {
$requestParams = CRM_Utils_Request::exportValues();
- $q = CRM_Utils_array::value('q', $requestParams);
+ $q = CRM_Utils_Array::value('q', $requestParams);
$args = explode('/', $q);
// Proceed with bootstrap for "?entity=X&action=Y"
// Proceed with bootstrap for "?q=civicrm/X/Y" but not "?q=civicrm/ping"
if (!empty($q)) {
if (count($args) == 2 && $args[1] == 'ping') {
+ CRM_Utils_System::loadBootStrap(array(), FALSE, FALSE);
return NULL; // this is pretty wonky but maybe there's some reason I can't see
}
if (count($args) != 3) {
// FIXME: At time of writing, this doesn't actually do anything because
// authenticateKey abends, but that's a bad behavior which sends a
// malformed response.
+ CRM_Utils_System::loadBootStrap(array(), FALSE, FALSE);
return self::error('Failed to authenticate key');
}
$store = NULL;
$api_key = CRM_Utils_Request::retrieve('api_key', 'String', $store, FALSE, NULL, 'REQUEST');
if (empty($api_key)) {
+ CRM_Utils_System::loadBootStrap(array(), FALSE, FALSE);
return self::error("FATAL: mandatory param 'api_key' (user key) missing");
}
$contact_id = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $api_key, 'id', 'api_key');
return NULL;
}
else {
+ CRM_Utils_System::loadBootStrap(array(), FALSE, FALSE);
return self::error('ERROR: No CMS user associated with given api-key');
}
}