CRM-19372 allow payment processors to define an array of accepted credit card types
[civicrm-core.git] / CRM / Core / Invoke.php
index 7c38eb6eb35991448f514ee8dc6e018ea57b945a..35158067b8b5ccee24e203919fa73de68d0ad0d9 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
+ | Copyright CiviCRM LLC (c) 2004-2016                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -31,7 +31,7 @@
  * Serves as a wrapper between the UserFrameWork and Core CRM
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
+ * @copyright CiviCRM LLC (c) 2004-2016
  * $Id$
  *
  */
@@ -344,54 +344,18 @@ class CRM_Core_Invoke {
   }
 
   /**
-   * Show status in the footer
+   * Show status in the footer (admin only)
    *
    * @param CRM_Core_Smarty $template
    */
   public static function statusCheck($template) {
-    if (CRM_Core_Config::isUpgradeMode()) {
+    if (CRM_Core_Config::isUpgradeMode() || !CRM_Core_Permission::check('administer CiviCRM')) {
       return;
     }
-    //  check date of last cache and compare to today's date
-    $systemCheckDate = Civi::cache()->get('systemCheckDate');
-    if ($systemCheckDate > strtotime("one day ago")) {
-      $statusSeverity = Civi::cache()->get('systemCheckSeverity');
-    }
-    //  calls helper function in CRM_Utils_Check
-    if (empty($statusSeverity)) {
-      $statusSeverity = CRM_Utils_Check::checkAll(TRUE);
-    }
-    switch ($statusSeverity) {
-      case 7:
-        $statusMessage = ts('System Status: Emergency');
-        break;
-
-      case 6:
-        $statusMessage = ts('System Status: Alert');
-        break;
-
-      case 5:
-        $statusMessage = ts('System Status: Critical');
-        break;
-
-      case 4:
-        $statusMessage = ts('System Status: Error');
-        break;
-
-      case 3:
-        $statusMessage = ts('System Status: Warning');
-        break;
-
-      case 2:
-        $statusMessage = ts('System Status: Notice');
-        break;
-
-      default:
-        $statusMessage = ts('System Status: Ok');
-    }
-    // TODO: get status from CRM_Utils_Check, if cached
-    $template->assign('footer_status_severity', $statusSeverity);
-    $template->assign('footer_status_message', $statusMessage);
+    // always use cached results - they will be refreshed by the session timer
+    $status = Civi::settings()->get('systemStatusCheckResult');
+    $template->assign('footer_status_severity', $status);
+    $template->assign('footer_status_message', CRM_Utils_Check::toStatusLabel($status));
   }
 
   /**