From: Tim Otten Date: Mon, 10 Mar 2014 00:40:31 +0000 (-0700) Subject: CRM_Utils_Check_Security - Represent messages as objects X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a2600a6db1a8c24bfc46745cdd5c78fdfaf5e828;p=civicrm-core.git CRM_Utils_Check_Security - Represent messages as objects --- diff --git a/CRM/Utils/Check/Message.php b/CRM/Utils/Check/Message.php new file mode 100644 index 0000000000..3f3cd2e0a3 --- /dev/null +++ b/CRM/Utils/Check/Message.php @@ -0,0 +1,74 @@ +name = $name; + $this->message = $message; + } + + /** + * @return string + */ + function getName() { + return $this->name; + } + + /** + * @return string + */ + function getMessage() { + return $this->message; + } + + /** + * @return array + */ + function toArray() { + return array( + 'name' => $this->name, + 'message' => $this->message, + ); + } +} diff --git a/CRM/Utils/Check/Security.php b/CRM/Utils/Check/Security.php index 3e2b6716a0..c6cd89ac2c 100644 --- a/CRM/Utils/Check/Security.php +++ b/CRM/Utils/Check/Security.php @@ -90,7 +90,7 @@ class CRM_Utils_Check_Security { $config->cleanup(0, FALSE); foreach ($this->checkAll() as $message) { - CRM_Core_Session::setStatus($message, ts('Security Warning')); + CRM_Core_Session::setStatus($message->getMessage(), ts('Security Warning')); } } } @@ -160,7 +160,10 @@ class CRM_Utils_Check_Security { $msg = 'The CiviCRM debug log should not be downloadable.' . '
' . 'Read more about this warning'; - $messages[] = ts($msg, array(1 => $log_url, 2 => $docs_url)); + $messages[] = new CRM_Utils_Check_Message( + 'checkLogFileIsNotAccessible', + ts($msg, array(1 => $log_url, 2 => $docs_url)) + ); } } } @@ -201,7 +204,10 @@ class CRM_Utils_Check_Security { . '
' . 'Read more about this warning'; $docs_url = $this->createDocUrl('checkUploadsAreNotAccessible'); - $messages[] = ts($msg, array(1 => $docs_url)); + $messages[] = new CRM_Utils_Check_Message( + 'checkUploadsAreNotAccessible', + ts($msg, array(1 => $docs_url)) + ); } } } @@ -245,7 +251,10 @@ class CRM_Utils_Check_Security { . '
' . 'Read more about this warning'; $docs_url = $this->createDocUrl('checkDirectoriesAreNotBrowseable'); - $messages[] = ts($msg, array(1 => $publicDir, 2 => $publicDir, 3 => $docs_url)); + $messages[] = new CRM_Utils_Check_Message( + 'checkDirectoriesAreNotBrowseable', + ts($msg, array(1 => $publicDir, 2 => $publicDir, 3 => $docs_url)) + ); } }