Merge pull request #2173 from webpartners/master
[civicrm-core.git] / CRM / Core / IDS.php
index cfc0e62ffa5d8f811189b20b6170363adb81d069..4ad8ed61d05ac773d98cb56cef5b2918995626b2 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
@@ -254,10 +254,16 @@ class CRM_Core_IDS {
     $session = CRM_Core_Session::singleton();
     $session->reset(2);
 
+    $msg = ts('There is a validation error with your HTML input. Your activity is a bit suspicious, hence aborting');
+
     $path = implode('/', $args);
-    if ($path == in_array("civicrm/ajax/rest", "civicrm/api/json")) {
-      require ("api/v3/utils.php");
-      $error = civicrm_api3_create_error(ts('There is a validation error with your HTML input. Your activity is a bit suspicious, hence aborting'),
+    if (in_array(
+        $path,
+        array("civicrm/ajax/rest", "civicrm/api/json")
+      )) {
+      require_once "api/v3/utils.php";
+      $error = civicrm_api3_create_error(
+        $msg,
         array(
           'IP' => $_SERVER['REMOTE_ADDR'],
           'error_code' => 'IDS_KICK',
@@ -269,7 +275,7 @@ class CRM_Core_IDS {
       echo json_encode($error);
       CRM_Utils_System::civiExit();
     }
-    CRM_Core_Error::fatal(ts('There is a validation error with your HTML input. Your activity is a bit suspicious, hence aborting'));
+    CRM_Core_Error::fatal($msg);
   }
 }