break;
case 2:
$print_html_link_use_alias = variable_get('print_html_link_use_alias', PRINT_HTML_LINK_USE_ALIAS_DEFAULT);
- $path = $print_html_link_use_alias ? $node->path : $node->nid;
+ $path = ($print_html_link_use_alias && isset($node->path)) ? $node->path : $node->nid;
break;
}
break;
case 'delete':
db_query("DELETE FROM {print_node_conf} WHERE nid = %d", $node->nid);
- db_query("DELETE FROM {print_page_counter} WHERE path = '%s'", $node->path);
+ db_query("DELETE FROM {print_page_counter} WHERE path = 'node/%d'", $node->nid);
break;
}
}
$print_html_node_link_visibility = variable_get('print_html_node_link_visibility', PRINT_HTML_NODE_LINK_VISIBILITY_DEFAULT);
$print_html_node_link_pages = variable_get('print_html_node_link_pages', PRINT_HTML_NODE_LINK_PAGES_DEFAULT);
- if (!empty($node->printing) ||
- !_print_page_match($print_html_node_link_visibility, $print_html_node_link_pages)) {
- // Page not in visibility list or we are working!
+ if (!_print_page_match($print_html_node_link_visibility, $print_html_node_link_pages)) {
+ // Page not in visibility list
return FALSE;
}
elseif (isset($args['type']) && ($args['type'] == 'comment') && isset($node_type)) {
*/
function print_controller_html() {
$args = func_get_args();
- // Remove the print/ prefix
$path = implode('/', $args);
$cid = isset($_GET['comment']) ? (int)$_GET['comment'] : NULL;
$node = $print['node'];
include_once(_print_get_template(PRINT_HTML_FORMAT, $print['type']));
- $nodepath = drupal_get_normal_path($node->path);
+ $nodepath = (isset($node->path)) ? drupal_get_normal_path($node->path) : 'node/'. $path;
db_query("UPDATE {print_page_counter} SET totalcount = totalcount + 1, timestamp = %d WHERE path = '%s'", time(), $nodepath);
// If we affected 0 rows, this is the first time viewing the node.
if (!db_affected_rows()) {
// Adapted from index.php.
$node = new stdClass();
$node->body = menu_execute_active_handler();
- $node->title = drupal_get_title();
- $node->path = $path;
// It may happen that a drupal_not_found is called in the above call
if (preg_match('/404 Not Found/', drupal_get_headers()) == 1) {
}
}
+ $node->title = drupal_get_title();
+ $node->path = $path;
+
// Delete any links area
$node->body = preg_replace('!\s*<div class="links">.*?</div>!sim', '', $node->body);
break;
case 'delete':
db_query("DELETE FROM {print_mail_node_conf} WHERE nid = %d", $node->nid);
- db_query("DELETE FROM {print_mail_page_counter} WHERE path = '%s'", $node->path);
+ db_query("DELETE FROM {print_mail_page_counter} WHERE path = 'node/%d'", $node->nid);
break;
}
}
$print_mail_node_link_visibility = variable_get('print_mail_node_link_visibility', PRINT_MAIL_NODE_LINK_VISIBILITY_DEFAULT);
$print_mail_node_link_pages = variable_get('print_mail_node_link_pages', PRINT_MAIL_NODE_LINK_PAGES_DEFAULT);
- if (!empty($node->printing) ||
- !_print_page_match($print_mail_node_link_visibility, $print_mail_node_link_pages)) {
- // Page not in visibility list or we are working!
+ if (!_print_page_match($print_mail_node_link_visibility, $print_mail_node_link_pages)) {
+ // Page not in visibility list
return FALSE;
}
elseif (isset($args['type']) && ($args['type'] == 'comment') && isset($node_type)) {
break;
case 'delete':
db_query("DELETE FROM {print_pdf_node_conf} WHERE nid = %d", $node->nid);
- db_query("DELETE FROM {print_pdf_page_counter} WHERE path = '%s'", $node->path);
+ db_query("DELETE FROM {print_pdf_page_counter} WHERE path = 'node/%d'", $node->nid);
break;
}
}
$print_pdf_node_link_visibility = variable_get('print_pdf_node_link_visibility', PRINT_PDF_NODE_LINK_VISIBILITY_DEFAULT);
$print_pdf_node_link_pages = variable_get('print_pdf_node_link_pages', PRINT_PDF_NODE_LINK_PAGES_DEFAULT);
- if (!empty($node->printing) ||
- !_print_page_match($print_pdf_node_link_visibility, $print_pdf_node_link_pages)) {
- // Page not in visibility list or we are working!
+ if (!_print_page_match($print_pdf_node_link_visibility, $print_pdf_node_link_pages)) {
+ // Page not in visibility list
return FALSE;
}
elseif (isset($args['type']) && ($args['type'] == 'comment') && isset($node_type)) {
$GLOBALS['conf']['cache'] = FALSE;
$args = func_get_args();
- // Remove the printpdf/ prefix
$path = implode('/', $args);
$cid = isset($_GET['comment']) ? (int)$_GET['comment'] : NULL;
return drupal_not_found();
}
- $nodepath = drupal_get_normal_path($node->path);
+ $nodepath = (isset($node->path)) ? drupal_get_normal_path($node->path) : 'node/'. $path;
db_query("UPDATE {print_pdf_page_counter} SET totalcount = totalcount + 1, timestamp = %d WHERE path = '%s'", time(), $nodepath);
// If we affected 0 rows, this is the first time viewing the node.
if (!db_affected_rows()) {