Merge pull request #6450 from civicrm/4.6
[civicrm-core.git] / CRM / Contact / Page / AJAX.php
index 8bf5d08e004f650b5732f2c4eff0c314a72b5213..a2a9b3bd9c54559ebc3f2dce95ba5092186e3795 100644 (file)
@@ -182,8 +182,8 @@ class CRM_Contact_Page_AJAX {
     }
 
     $offset = $count = 0;
-    if (!empty($_GET['page'])) {
-      $page = (int) $_GET['page'];
+    if (!empty($_GET['page_num'])) {
+      $page = (int) $_GET['page_num'];
       $offset = $limit * ($page - 1);
       $limit++;
     }
@@ -295,7 +295,7 @@ class CRM_Contact_Page_AJAX {
   }
 
   public static function groupTree() {
-    header('Content-Type: application/json');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     $gids = CRM_Utils_Type::escape($_GET['gids'], 'String');
     echo CRM_Contact_BAO_GroupNestingCache::json($gids);
     CRM_Utils_System::civiExit();
@@ -305,7 +305,7 @@ class CRM_Contact_Page_AJAX {
    * Delete custom value.
    */
   public static function deleteCustomValue() {
-    header('Content-Type: text/plain');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'text/plain');
     $customValueID = CRM_Utils_Type::escape($_REQUEST['valueID'], 'Positive');
     $customGroupID = CRM_Utils_Type::escape($_REQUEST['groupID'], 'Positive');
 
@@ -370,7 +370,7 @@ class CRM_Contact_Page_AJAX {
         $userEmail
         ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID);
 
-      header('Content-Type: text/plain');
+      CRM_Utils_System::setHttpHeader('Content-Type', 'text/plain');
       if ($userEmail) {
         echo $userEmail;
       }
@@ -713,7 +713,7 @@ LIMIT {$offset}, {$rowCount}
       }
     }
 
-    header('Content-Type: application/json');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     echo CRM_Utils_JSON::encodeDataTableSelector($searchRows, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
 
     CRM_Utils_System::civiExit();