<?php
/*
- +--------------------------------------------------------------------+
- | CiviCRM version 5 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved. |
+ | |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
*/
/**
* To reduce the size of this patch, we only sign the exploitable fields
* which make up "$baseURL" in addOrder() (eg 'filter' or 'dao').
* Less-exploitable fields (eg 'dir') are left unsigned.
+ * 'id','src','dst','dir'
*/
- static $SIGNABLE_FIELDS = array('reset', 'dao', 'idName', 'url', 'filter'); // 'id','src','dst','dir'
+ public static $SIGNABLE_FIELDS = ['reset', 'dao', 'idName', 'url', 'filter'];
/**
* Correct duplicate weight entries by putting them (duplicate weights) in sequence.
$selectField = "id AS fieldID, $weightField AS weight";
$field = CRM_Utils_Weight::query('SELECT', $daoName, $fieldValues, $selectField);
$sameWeightCount = 0;
- $weights = array();
+ $weights = [];
while ($field->fetch()) {
if (in_array($field->weight, $weights)) {
$sameWeightCount++;
$fields = &$dao->fields();
$fieldlist = array_keys($fields);
- $whereConditions = array();
+ $whereConditions = [];
if ($additionalWhere) {
$whereConditions[] = $additionalWhere;
}
- $params = array();
+ $params = [];
$fieldNum = 0;
if (is_array($fieldValues)) {
foreach ($fieldValues as $fieldName => $value) {
$fieldNum++;
$whereConditions[] = "$fieldName = %$fieldNum";
$fieldType = $fields[$fieldName]['type'];
- $params[$fieldNum] = array($value, CRM_Utils_Type::typeToString($fieldType));
+ $params[$fieldNum] = [$value, CRM_Utils_Type::typeToString($fieldType)];
}
}
$where = implode(' AND ', $whereConditions);
$config = CRM_Core_Config::singleton();
$imageURL = $config->userFrameworkResourceURL . 'i/arrow';
- $queryParams = array(
+ $queryParams = [
'reset' => 1,
'dao' => $daoName,
'idName' => $idName,
'url' => $returnURL,
'filter' => $filter,
- );
+ ];
$signer = new CRM_Utils_Signer(CRM_Core_Key::privateKey(), self::$SIGNABLE_FIELDS);
$queryParams['_sgn'] = $signer->sign($queryParams);
$prevID = $ids[$i - 1];
$nextID = $ids[$i + 1];
- $links = array();
+ $links = [];
$url = "{$baseURL}&src=$id";
if ($prevID != 0) {
$tableName = $object->tableName();
$query = "UPDATE $tableName SET weight = %1 WHERE $idName = %2";
- $params = array(
- 1 => array($dstWeight, 'Integer'),
- 2 => array($src, 'Integer'),
- );
+ $params = [
+ 1 => [$dstWeight, 'Integer'],
+ 2 => [$src, 'Integer'],
+ ];
CRM_Core_DAO::executeQuery($query, $params);
if ($dir == 'swap') {
- $params = array(
- 1 => array($srcWeight, 'Integer'),
- 2 => array($dst, 'Integer'),
- );
+ $params = [
+ 1 => [$srcWeight, 'Integer'],
+ 2 => [$dst, 'Integer'],
+ ];
CRM_Core_DAO::executeQuery($query, $params);
}
elseif ($dir == 'first') {
if ($filter) {
$query .= " AND $filter";
}
- $params = array(
- 1 => array($src, 'Integer'),
- 2 => array($srcWeight, 'Integer'),
- );
+ $params = [
+ 1 => [$src, 'Integer'],
+ 2 => [$srcWeight, 'Integer'],
+ ];
CRM_Core_DAO::executeQuery($query, $params);
}
elseif ($dir == 'last') {
if ($filter) {
$query .= " AND $filter";
}
- $params = array(
- 1 => array($src, 'Integer'),
- 2 => array($srcWeight, 'Integer'),
- );
+ $params = [
+ 1 => [$src, 'Integer'],
+ 2 => [$srcWeight, 'Integer'],
+ ];
CRM_Core_DAO::executeQuery($query, $params);
}
CRM_Utils_System::redirect($url);
}
- CRM_Core_Page_AJAX::returnJsonResponse(array(
+ CRM_Core_Page_AJAX::returnJsonResponse([
'userContext' => $url,
- ));
+ ]);
}
}