Code coverage for /20081101/modules/tracker/tracker.module

Line #Times calledCode
1
<?php
2
// $Id: tracker.module,v 1.157 2008/05/06 12:18:51 dries Exp $
3
4
/**
5
 * @file
6
 * Enables tracking of recent posts for users.
7
 */
8
9
/**
10
 * Implementation of hook_help().
11
 */
1252
function tracker_help($path, $arg) {
13
  switch ($path) {
1439
    case 'admin/help#tracker':
150
      $output = '<p>' . t('The tracker module displays the most recently
added or updated content on your site, and provides user-level tracking to
follow the contributions of particular authors.') . '</p>';
160
      $output .= '<p>' . t("The <em>Recent posts</em> page is available via
a link in the navigation menu block and displays new and recently-updated
content (including the content type, the title, the author's name, number
of comments, and time of last update) in reverse chronological order. Posts
are marked updated when changes occur in the text, or when new comments are
added. To use the tracker module to follow a specific user's contributions,
select the <em>Track</em> tab from the user's profile page.") . '</p>';
170
      $output .= '<p>' . t('For more information, see the online handbook
entry for <a href="@tracker">Tracker module</a>.', array('@tracker' =>
'http://drupal.org/handbook/modules/tracker/')) . '</p>';
180
      return $output;
190
  }
2039
}
21
22
/**
23
 * Implementation of hook_menu().
24
 */
2552
function tracker_menu() {
261
  $items['tracker'] = array(
271
    'title' => 'Recent posts',
281
    'page callback' => 'tracker_page',
291
    'access arguments' => array('access content'),
301
    'weight' => 1,
31
  );
321
  $items['tracker/all'] = array(
331
    'title' => 'All recent posts',
341
    'type' => MENU_DEFAULT_LOCAL_TASK,
35
  );
361
  $items['tracker/%user_uid_optional'] = array(
371
    'title' => 'My recent posts',
381
    'access callback' => '_tracker_myrecent_access',
391
    'access arguments' => array(1),
401
    'page arguments' => array(1),
411
    'type' => MENU_LOCAL_TASK,
42
  );
43
441
  $items['user/%user/track'] = array(
451
    'title' => 'Track',
461
    'page callback' => 'tracker_page',
471
    'page arguments' => array(1, TRUE),
481
    'access callback' => '_tracker_user_access',
491
    'access arguments' => array(1),
501
    'type' => MENU_LOCAL_TASK,
51
  );
521
  $items['user/%user/track/posts'] = array(
531
    'title' => 'Track posts',
541
    'type' => MENU_DEFAULT_LOCAL_TASK,
55
  );
561
  return $items;
570
}
58
59
/**
60
 * Access callback for tracker/%user_uid_optional
61
 */
6252
function _tracker_myrecent_access($account) {
63
  // This path is only allowed for authenticated users looking at their own
posts.
640
  return $account->uid && ($GLOBALS['user']->uid == $account->uid) &&
user_access('access content');
650
}
66
67
/**
68
 * Access callback for user/%user/track
69
 */
7052
function _tracker_user_access($account) {
718
  return user_view_access($account) && user_access('access content');
720
}
73
7452