X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FREST.php;h=bd88f4202714681c10023630e54dd0cd59193c12;hb=1e1ed556e29f820a3834d8b1d45e979bca8c720f;hp=6cdb5fe1e10e03c5117dc3b5b7a80140702cd108;hpb=35f52ba93de1d2726ebeef726b4efad6db1c203f;p=civicrm-core.git diff --git a/CRM/Utils/REST.php b/CRM/Utils/REST.php index 6cdb5fe1e1..bd88f42027 100644 --- a/CRM/Utils/REST.php +++ b/CRM/Utils/REST.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.7 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2016 | + | Copyright CiviCRM LLC (c) 2004-2017 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -29,7 +29,7 @@ * 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 { @@ -282,13 +282,13 @@ 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. @@ -311,8 +311,8 @@ class CRM_Utils_REST { // 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 @@ -320,7 +320,7 @@ class CRM_Utils_REST { // 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); } @@ -669,13 +669,14 @@ class CRM_Utils_REST { */ 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) { @@ -691,6 +692,7 @@ class CRM_Utils_REST { // 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'); } @@ -699,6 +701,7 @@ class CRM_Utils_REST { $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'); @@ -718,6 +721,7 @@ class CRM_Utils_REST { return NULL; } else { + CRM_Utils_System::loadBootStrap(array(), FALSE, FALSE); return self::error('ERROR: No CMS user associated with given api-key'); } }