One last eval CRM-12743
authorColeman Watts <coleman@civicrm.org>
Fri, 31 May 2013 21:23:04 +0000 (14:23 -0700)
committerColeman Watts <coleman@civicrm.org>
Fri, 31 May 2013 21:30:15 +0000 (14:30 -0700)
----------------------------------------
* CRM-12743: Eliminate use of eval in core code
  http://issues.civicrm.org/jira/browse/CRM-12743

----------------------------------------
* CRM-12743:
  http://issues.civicrm.org/jira/browse/CRM-12743
* CRM-12743::
  http://issues.civicrm.org/jira/browse/CRM-12743:

CRM/Activity/Page/AJAX.php

index c2e1bc75bd7409753f21e20ac871a7f224299e44..6b3b15f70685e7a13f2526085101f471d61bcf81 100644 (file)
@@ -142,9 +142,8 @@ class CRM_Activity_Page_AJAX {
     foreach ($clientRelationships as $key => $row) {
       $sortArray[$key]  = $row[$sort];
     }
-    $sort_type = "SORT_".strtoupper($sortOrder);
-    $sort_function = "array_multisort(\$sortArray, ".$sort_type.", \$clientRelationships);";
-    eval($sort_function);
+    $sort_type = "SORT_" . strtoupper($sortOrder);
+    array_multisort($sortArray, constant($sort_type), $clientRelationships);
 
     //limit the rows
     $allClientRelationships = $clientRelationships;
@@ -239,10 +238,8 @@ class CRM_Activity_Page_AJAX {
       $sortArray[$key]  = $row[$sort];
     }
 
-    $sort_type = "SORT_".strtoupper($sortOrder);
-
-    $sort_function = "array_multisort(\$sortArray, ".$sort_type.", \$caseRelationships);";
-    eval($sort_function);
+    $sort_type = "SORT_" . strtoupper($sortOrder);
+    array_multisort($sortArray, constant($sort_type), $caseRelationships);
 
     //limit rows display
     $allCaseRelationships = $caseRelationships;