projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #14854 from eileenmcnaughton/validate
[civicrm-core.git]
/
CRM
/
Utils
/
Weight.php
diff --git
a/CRM/Utils/Weight.php
b/CRM/Utils/Weight.php
index 349710694121cebb970250dc44d74d9fe298b47f..3e4add68b7cf54cfe1be34b3ffc72080118797da 100644
(file)
--- a/
CRM/Utils/Weight.php
+++ b/
CRM/Utils/Weight.php
@@
-35,8
+35,9
@@
class CRM_Utils_Weight {
* 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.
* 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.
/**
* Correct duplicate weight entries by putting them (duplicate weights) in sequence.
@@
-205,7
+206,7
@@
class CRM_Utils_Weight {
$selectField = "id AS fieldID, $weightField AS weight";
$field = CRM_Utils_Weight::query('SELECT', $daoName, $fieldValues, $selectField);
$sameWeightCount = 0;
$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++;
while ($field->fetch()) {
if (in_array($field->weight, $weights)) {
$sameWeightCount++;
@@
-308,11
+309,11
@@
class CRM_Utils_Weight {
$fields = &$dao->fields();
$fieldlist = array_keys($fields);
$fields = &$dao->fields();
$fieldlist = array_keys($fields);
- $whereConditions =
array()
;
+ $whereConditions =
[]
;
if ($additionalWhere) {
$whereConditions[] = $additionalWhere;
}
if ($additionalWhere) {
$whereConditions[] = $additionalWhere;
}
- $params =
array()
;
+ $params =
[]
;
$fieldNum = 0;
if (is_array($fieldValues)) {
foreach ($fieldValues as $fieldName => $value) {
$fieldNum = 0;
if (is_array($fieldValues)) {
foreach ($fieldValues as $fieldName => $value) {
@@
-323,7
+324,7
@@
class CRM_Utils_Weight {
$fieldNum++;
$whereConditions[] = "$fieldName = %$fieldNum";
$fieldType = $fields[$fieldName]['type'];
$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);
}
}
$where = implode(' AND ', $whereConditions);
@@
-386,13
+387,13
@@
class CRM_Utils_Weight {
$config = CRM_Core_Config::singleton();
$imageURL = $config->userFrameworkResourceURL . 'i/arrow';
$config = CRM_Core_Config::singleton();
$imageURL = $config->userFrameworkResourceURL . 'i/arrow';
- $queryParams =
array(
+ $queryParams =
[
'reset' => 1,
'dao' => $daoName,
'idName' => $idName,
'url' => $returnURL,
'filter' => $filter,
'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);
$signer = new CRM_Utils_Signer(CRM_Core_Key::privateKey(), self::$SIGNABLE_FIELDS);
$queryParams['_sgn'] = $signer->sign($queryParams);
@@
-403,7
+404,7
@@
class CRM_Utils_Weight {
$prevID = $ids[$i - 1];
$nextID = $ids[$i + 1];
$prevID = $ids[$i - 1];
$nextID = $ids[$i + 1];
- $links =
array()
;
+ $links =
[]
;
$url = "{$baseURL}&src=$id";
if ($prevID != 0) {
$url = "{$baseURL}&src=$id";
if ($prevID != 0) {
@@
-461,17
+462,17
@@
class CRM_Utils_Weight {
$tableName = $object->tableName();
$query = "UPDATE $tableName SET weight = %1 WHERE $idName = %2";
$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') {
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') {
CRM_Core_DAO::executeQuery($query, $params);
}
elseif ($dir == 'first') {
@@
-480,10
+481,10
@@
class CRM_Utils_Weight {
if ($filter) {
$query .= " AND $filter";
}
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') {
CRM_Core_DAO::executeQuery($query, $params);
}
elseif ($dir == 'last') {
@@
-492,10
+493,10
@@
class CRM_Utils_Weight {
if ($filter) {
$query .= " AND $filter";
}
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_Core_DAO::executeQuery($query, $params);
}
@@
-510,9
+511,9
@@
class CRM_Utils_Weight {
CRM_Utils_System::redirect($url);
}
CRM_Utils_System::redirect($url);
}
- CRM_Core_Page_AJAX::returnJsonResponse(
array(
+ CRM_Core_Page_AJAX::returnJsonResponse(
[
'userContext' => $url,
'userContext' => $url,
-
)
);
+
]
);
}
}
}
}