+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
*
*/
public static function getPCPList() {
$name = CRM_Utils_Array::value('term', $_GET);
$name = CRM_Utils_Type::escape($name, 'String');
- $limit = '10';
+ $limit = $max = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'search_autocomplete_count', NULL, 10);
$where = ' AND pcp.page_id = cp.id AND pcp.contact_id = cc.id';
$whereClause = " WHERE ( sort_name LIKE '$strSearch' $includeNickName ) {$where} ";
}
- if (!empty($_GET['limit'])) {
- $limit = CRM_Utils_Type::escape($_GET['limit'], 'Positive');
+ $offset = $count = 0;
+ if (!empty($_GET['page_num'])) {
+ $page = (int) $_GET['page_num'];
+ $offset = $limit * ($page - 1);
+ $limit++;
}
$select = 'cc.sort_name, pcp.title, cp.title';
FROM civicrm_pcp pcp, civicrm_event cp, civicrm_contact cc
{$includeEmailFrom}
{$whereClause} AND pcp.page_type = 'event'
- LIMIT 0, {$limit}
) t
ORDER BY sort_name
+ LIMIT $offset, $limit
";
$dao = CRM_Core_DAO::executeQuery($query);
- $results = array();
+ $output = array('results' => array(), 'more' => FALSE);
while ($dao->fetch()) {
- $results[] = array('id' => $dao->id, 'text' => $dao->data);
+ if (++$count > $max) {
+ $output['more'] = TRUE;
+ }
+ else {
+ $output['results'][] = array('id' => $dao->id, 'text' => $dao->data);
+ }
}
- CRM_Utils_JSON::output($results);
+ CRM_Utils_JSON::output($output);
}
public static function relationship() {
$relType = CRM_Utils_Request::retrieve('rel_type', 'Positive', CRM_Core_DAO::$_nullObject, TRUE);
$relContactID = CRM_Utils_Request::retrieve('rel_contact', 'Positive', CRM_Core_DAO::$_nullObject, TRUE);
- $relationshipID = CRM_Utils_Array::value('rel_id', $_REQUEST); // this used only to determine add or update mode
+ $relationshipID = CRM_Utils_Request::retrieve('rel_id', 'Positive', CRM_Core_DAO::$_nullObject); // this used only to determine add or update mode
$caseID = CRM_Utils_Request::retrieve('case_id', 'Positive', CRM_Core_DAO::$_nullObject, TRUE);
// check if there are multiple clients for this case, if so then we need create
}
// create new or update existing relationship
- $return = CRM_Contact_BAO_Relationship::createMultiple($relationParams, $relationIds);
+ $return = CRM_Contact_BAO_Relationship::legacyCreateMultiple($relationParams, $relationIds);
if (!empty($return[4][0])) {
$relationshipID = $return[4][0];
header('Content-Type: text/plain');
$customValueID = CRM_Utils_Type::escape($_REQUEST['valueID'], 'Positive');
$customGroupID = CRM_Utils_Type::escape($_REQUEST['groupID'], 'Positive');
-
+ $contactId = CRM_Utils_Request::retrieve('contactId', 'Positive', CRM_Core_DAO::$_nullObject);
CRM_Core_BAO_CustomValue::deleteCustomValue($customValueID, $customGroupID);
- $contactId = CRM_Utils_Array::value('contactId', $_REQUEST);
if ($contactId) {
- echo CRM_Contact_BAO_Contact::getCountComponent('custom_' . $_REQUEST['groupID'], $contactId);
+ echo CRM_Contact_BAO_Contact::getCountComponent('custom_' . $customGroupID, $contactId);
}
// reset the group contact cache for this group
*/
static public function checkUserName() {
$signer = new CRM_Utils_Signer(CRM_Core_Key::privateKey(), array('for', 'ts'));
+ $sig = CRM_Utils_Request::retrieve('sig', 'String', CRM_Core_DAO::$_nullObject);
+ $for = CRM_Utils_Request::retrieve('for', 'String', CRM_Core_DAO::$_nullObject);
if (
CRM_Utils_Time::getTimeRaw() > $_REQUEST['ts'] + self::CHECK_USERNAME_TTL
- || $_REQUEST['for'] != 'civicrm/ajax/cmsuser'
- || !$signer->validate($_REQUEST['sig'], $_REQUEST)
+ || $for != 'civicrm/ajax/cmsuser'
+ || !$signer->validate($sig, $_REQUEST)
) {
$user = array('name' => 'error');
CRM_Utils_JSON::output($user);
}
$config = CRM_Core_Config::singleton();
- $username = trim($_REQUEST['cms_name']);
+ $username = trim(CRM_Utils_Array::value('cms_name', $_REQUEST));
$params = array('name' => $username);
else {
$cid = CRM_Utils_Array::value('cid', $_GET);
if ($cid) {
- //check cid for interger
+ //check cid for integer
$contIDS = explode(',', $cid);
foreach ($contIDS as $contID) {
CRM_Utils_Type::escape($contID, 'Integer');
// send query to hook to be modified if needed
CRM_Utils_Hook::contactListQuery($query,
$name,
- CRM_Utils_Array::value('context', $_GET),
- CRM_Utils_Array::value('cid', $_GET)
+ CRM_Utils_Request::retrieve('context', 'String', CRM_Core_DAO::$_nullObject),
+ CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject)
);
$dao = CRM_Core_DAO::executeQuery($query);
// send query to hook to be modified if needed
CRM_Utils_Hook::contactListQuery($query,
$name,
- CRM_Utils_Array::value('context', $_GET),
- CRM_Utils_Array::value('cid', $_GET)
+ CRM_Utils_Request::retrieve('context', 'String', CRM_Core_DAO::$_nullObject),
+ CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject)
);
$dao = CRM_Core_DAO::executeQuery($query);
// send query to hook to be modified if needed
CRM_Utils_Hook::contactListQuery($query,
$name,
- CRM_Utils_Array::value('context', $_GET),
- CRM_Utils_Array::value('cid', $_GET)
+ CRM_Utils_Request::retrieve('context', 'String', CRM_Core_DAO::$_nullObject),
+ CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject)
);
$dao = CRM_Core_DAO::executeQuery($query);
public static function buildSubTypes() {
- $parent = CRM_Utils_Array::value('parentId', $_REQUEST);
+ $parent = CRM_Utils_Request::retrieve('parentId', 'Positive', CRM_Core_DAO::$_nullObject);
switch ($parent) {
case 1:
}
public static function buildDedupeRules() {
- $parent = CRM_Utils_Array::value('parentId', $_REQUEST);
+ $parent = CRM_Utils_Request::retrieve('parentId', 'Positive', CRM_Core_DAO::$_nullObject);
switch ($parent) {
case 1:
}
public static function getAddressDisplay() {
- $contactId = CRM_Utils_Array::value('contact_id', $_REQUEST);
+ $contactId = CRM_Utils_Request::retrieve('contact_id', 'Positive', CRM_Core_DAO::$_nullObject);
if (!$contactId) {
$addressVal["error_message"] = "no contact id found";
}
public static function getContactRelationships() {
$contactID = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
$context = CRM_Utils_Type::escape($_GET['context'], 'String');
- $relationship_type_id = CRM_Utils_Type::escape($_GET['relationship_type_id'], 'Integer', FALSE);
+ $relationship_type_id = CRM_Utils_Type::escape(CRM_Utils_Array::value('relationship_type_id', $_GET), 'Integer',
+ FALSE);
if (!CRM_Contact_BAO_Contact_Permission::allow($contactID)) {
return CRM_Utils_System::permissionDenied();