CRM_Core_BAO_Setting - Don't prefill settings
[civicrm-core.git] / CRM / Core / Page / AJAX.php
index 21adef2cefd486c6d9b94c2a2ae1196b9744d8f6..95fc8566deb2085b7197d02b2a846871c807fbb6 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
@@ -189,7 +189,7 @@ class CRM_Core_Page_AJAX {
 
     // CRM-11831 @see http://www.malsup.com/jquery/form/#file-upload
     if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
-      header('Content-Type: application/json');
+      CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     }
     else {
       $output = "<textarea>$output</textarea>";
@@ -209,34 +209,9 @@ class CRM_Core_Page_AJAX {
       // Encourage browsers to cache for a long time - 1 year
       $ttl = 60 * 60 * 24 * 364;
     }
-    header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + $ttl));
-    header('Content-Type:      application/javascript');
-    header("Cache-Control: max-age=$ttl, public");
-  }
-
-  /**
-   * Send autocomplete results to the client. Input can be a simple or nested array.
-   * @param array $results
-   *   If nested array, also provide:.
-   * @param string $val
-   *   Array key to use as the value.
-   * @param string $key
-   *   Array key to use as the key.
-   * @deprecated
-   */
-  public static function autocompleteResults($results, $val = 'label', $key = 'id') {
-    $output = array();
-    if (is_array($results)) {
-      foreach ($results as $k => $v) {
-        if (is_array($v)) {
-          echo $v[$val] . '|' . $v[$key] . "\n";
-        }
-        else {
-          echo "$v|$k\n";
-        }
-      }
-    }
-    CRM_Utils_System::civiExit();
+    CRM_Utils_System::setHttpHeader('Expires', gmdate('D, d M Y H:i:s \G\M\T', time() + $ttl));
+    CRM_Utils_System::setHttpHeader('Content-Type', 'application/javascript');
+    CRM_Utils_System::setHttpHeader('Cache-Control', "max-age=$ttl, public");
   }
 
 }