You are here

function security_review_page in Security Review 6

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

Page callback for run & review.

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

File

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

Code

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

  // Retrieve the checklist.
  $checklist = module_invoke_all('security_checks');

  // Retrieve results from last run of the checklist.
  $results = db_query("SELECT namespace, reviewcheck, result, lastrun, skip, skiptime, skipuid FROM {security_review}");
  while ($result = db_fetch_array($results)) {
    $checks[] = $result;
  }

  // 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 .= 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;
}