function linkchecker_user_report_page in Link checker 7
Same name and namespace in other branches
- 6.2 includes/linkchecker.pages.inc \linkchecker_user_report_page()
Menu callback for author specific reporting.
Parameters
object $account: The user account.
Return value
string Themed report page.
1 string reference to 'linkchecker_user_report_page'
- linkchecker_menu in ./
linkchecker.module - Implements hook_menu().
File
- ./
linkchecker.pages.inc, line 55 - User page callbacks for the linkchecker module.
Code
function linkchecker_user_report_page($account) {
drupal_set_title($account->name);
$ignore_response_codes = preg_split('/(\\r\\n?|\\n)/', variable_get('linkchecker_ignore_response_codes', "200\n206\n302\n304\n401\n403"));
// Build query for broken links in nodes of the current user.
$subquery2 = db_select('node', 'n');
$subquery2
->innerJoin('node_revision', 'r', 'r.vid = n.vid');
$subquery2
->innerJoin('linkchecker_node', 'ln', 'ln.nid = n.nid');
$subquery2
->innerJoin('linkchecker_link', 'll', 'll.lid = ln.lid');
$subquery2
->condition('ll.last_checked', 0, '<>');
$subquery2
->condition('ll.status', 1);
$subquery2
->condition('ll.code', $ignore_response_codes, 'NOT IN');
$subquery2
->condition(db_or()
->condition('n.uid', $account->uid)
->condition('r.uid', $account->uid));
$subquery2
->distinct();
$subquery2
->fields('ll', array(
'lid',
));
$comment_types = linkchecker_scan_comment_types();
if (!empty($comment_types)) {
// Build query for broken links in nodes and comments of the current user.
$subquery3 = db_select('comment', 'c');
$subquery3
->innerJoin('linkchecker_comment', 'lc', 'lc.cid = c.cid');
$subquery3
->innerJoin('linkchecker_link', 'll', 'll.lid = lc.lid');
$subquery3
->condition('ll.last_checked', 0, '<>');
$subquery3
->condition('ll.status', 1);
$subquery3
->condition('ll.code', $ignore_response_codes, 'NOT IN');
$subquery3
->condition('c.uid', $account->uid);
$subquery3
->distinct();
$subquery3
->fields('ll', array(
'lid',
));
// UNION the linkchecker_node and linkchecker_comment tables.
$subquery1 = db_select($subquery2
->union($subquery3), 'q1')
->fields('q1', array(
'lid',
));
}
else {
// Build query for broken links in nodes of the current user.
$subquery1 = db_select($subquery2, 'q1')
->fields('q1', array(
'lid',
));
}
// Build pager query.
$query = db_select('linkchecker_link', 'll')
->extend('PagerDefault')
->extend('TableSort');
$query
->innerJoin($subquery1, 'q2', 'q2.lid = ll.lid');
$query
->fields('ll');
$query
->condition('ll.last_checked', 0, '<>');
$query
->condition('ll.status', 1);
$query
->condition('ll.code', $ignore_response_codes, 'NOT IN');
return _linkchecker_report_page($query, $account);
}