You are here

function security_review_check_comments_help in Security Review 6

File

./security_review.help.inc, line 305
Main help definition.

Code

function security_review_check_comments_help($results = NULL) {
  $element['title'] = t('Dangerous tags in comments');
  $element['descriptions'][] = t("There is little reason for script and PHP tags to be in comments (unless they are code examples) and could be in use maliciously.");
  $last_check = security_review_get_last_check('security_review', 'comments');
  if ($last_check['skip'] == '1') {
    $element['findings']['descriptions'][] = _security_review_check_skipped($last_check);
  }
  elseif ($last_check['result'] == '0') {
    $element['findings']['descriptions'][] = t('The following comments have dangerous tags. The links go to the edit page.');
    if (is_null($results)) {
      $results = security_review_check_comments();

      // Don't pass $last_check because timestamp is wrong now.
    }
    $destination = drupal_get_destination();
    foreach ($results['value'] as $cid => $nid) {
      $comment = _comment_load($cid);

      // There is no access checking. We state that the use of this module should be granted to trusted users only.
      $node = node_load($nid);
      $title = t('!subject on !title', array(
        '!subject' => $comment->subject,
        '!title' => $node->title,
      ));
      $element['findings']['items'][] = array(
        'html' => l($title, 'comment/edit/' . $cid, array(
          'query' => $destination,
        )),
        'safe' => check_plain($title),
        'raw' => $title . ':' . url('comment/edit/' . $cid),
      );
    }
    $element['findings']['pager'] = theme('pager', NULL, 20);
  }
  return $element;
}