You are here

function security_review_page in Security Review 7

Same name and namespace in other branches
  1. 6 security_review.module \security_review_page()

Page callback for run & review.

1 string reference to 'security_review_page'
security_review_menu in ./security_review.module
Implements hook_menu().

File

./security_review.pages.inc, line 10
security_review.pages.inc

Code

function security_review_page() {
  $checks = array();
  $output = array();

  // Retrieve the checklist.
  module_load_include('inc', 'security_review');
  $checklist = security_review_get_checklist();

  // Retrieve results from last run of the checklist.
  $checks = security_review_get_stored_results();

  // Only users with the proper permission can run the checklist.
  if (user_access('run security checks')) {
    $output += drupal_get_form('security_review_run_form', $checks);
  }
  if (!empty($checks)) {

    // We have prior results, so display them.
    $output['results'] = security_review_reviewed($checklist, $checks);
  }
  else {

    // If they haven't configured the site, prompt them to do so.
    $variable = variable_get('security_review_log', FALSE);
    if (!$variable) {
      drupal_set_message(t('It appears this is your first time using the Security Review checklist. Before running the checklist please review the settings page at !link to set which roles are untrusted.', array(
        '!link' => l('admin/reports/security-review/settings', 'admin/reports/security-review/settings'),
      )));
    }
  }
  return $output;
}