You are here

function security_review_check_help in Security Review 6

Same name and namespace in other branches
  1. 7 security_review.pages.inc \security_review_check_help()

Page callback provides general help and check specific help documentation.

1 string reference to 'security_review_check_help'
security_review_menu in ./security_review.module
Implementation of hook_menu().

File

./security_review.module, line 123
Site security review and reporting Drupal module.

Code

function security_review_check_help($module = NULL, $check_name = NULL) {

  // Include checks and help files.
  $checklist = module_invoke_all('security_checks');
  module_load_include('inc', 'security_review', 'security_review.help');
  $output = '';
  if (!is_null($module) && !is_null($check_name)) {
    $check = $checklist[$module][$check_name];
    if (isset($check['help'])) {
      $output = $check['help'];
    }
    elseif (isset($check['callback'])) {
      if (isset($check['file'])) {

        // Handle Security Review defining checks for other modules.
        if (isset($check['module'])) {
          $module = $check['module'];
        }
        module_load_include('inc', $module, $check['file']);
      }
      $function = $check['callback'] . '_help';
      if (function_exists($function)) {
        $element = $function();
        $output = theme('security_review_check_help', $element);
      }
    }
  }
  else {
    $output = _security_review_help();

    // List all checks as links to specific help.
    $output .= '<h3>' . t('Check-specfic help') . '</h3>';
    $output .= '<p>' . t("Details and help on the security review checks. Checks are not always perfectly correct in their procedure and result. Refer to drupal.org handbook documentation if you are unsure how to make the recommended alterations to your configuration or consult the module's README.txt for support.") . '</p>';
    $checklist = module_invoke_all('security_checks');
    foreach ($checklist as $module => $checks) {
      foreach ($checks as $reviewcheck => $check) {
        $items[] = l($check['title'], 'admin/reports/security-review/help/' . $module . '/' . $reviewcheck);
      }
    }
    if ($items) {
      $output .= theme('item_list', $items);
    }
  }
  if (empty($output)) {
    return drupal_not_found();
  }
  return $output;
}