function _print_mail_access in Printer, email and PDF versions 5.x
Same name and namespace in other branches
- 5.4 print_mail/print_mail.module \_print_mail_access()
- 6 print_mail/print_mail.module \_print_mail_access()
- 7.2 print_mail/print_mail.module \_print_mail_access()
- 7 print_mail/print_mail.module \_print_mail_access()
Access callback to check a combination of user_acess() and page access
Parameters
$permission: permission required to view the page
Return value
TRUE if the user has permission to view the page, FALSE otherwise
1 string reference to '_print_mail_access'
- print_mail_menu in print_mail/
print_mail.module - Implementation of hook_menu().
File
- print_mail/
print_mail.module, line 291 - Displays Printer-friendly versions of Drupal pages.
Code
function _print_mail_access($permission) {
$page_access = TRUE;
$parts = explode('/', $_GET['q']);
if ($parts[0] == PRINTMAIL_PATH) {
if (count($parts) > 1) {
unset($parts[0]);
$path = implode('/', $parts);
if (is_numeric($parts[1])) {
if (drupal_lookup_path('source', $path)) {
// This is a numeric alias
$path = drupal_get_normal_path($path);
}
else {
// normal nid
$path = 'node/' . $path;
}
}
// If the destination page is not accessible, don't show the form
if (!($router_item = menu_get_item($path)) || !$router_item['access']) {
$page_access = FALSE;
}
}
}
return user_access($permission) && $page_access;
}