diff --git a/print.module b/print.module
index 5be876d127b6b1fdde2c7bbe655e4011e8428f58..448efb9b116b66697228856491c9f19579395867 100644
--- a/print.module
+++ b/print.module
@@ -247,7 +247,7 @@ function print_link_alter(&$node, &$links) {
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;
}
@@ -317,7 +317,7 @@ function print_nodeapi(&$node, $op = 'view', $teaser, $page) {
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;
}
}
@@ -683,9 +683,8 @@ function print_link_allowed($args) {
$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)) {
diff --git a/print.pages.inc b/print.pages.inc
index 4cc6b5abc438ec7e8de26a708ab791fad979765c..9970e45de55766141ba0d6ea360761200bf2559a 100644
--- a/print.pages.inc
+++ b/print.pages.inc
@@ -20,7 +20,6 @@ $_print_urls = PRINT_URLS_DEFAULT;
*/
function print_controller_html() {
$args = func_get_args();
- // Remove the print/ prefix
$path = implode('/', $args);
$cid = isset($_GET['comment']) ? (int)$_GET['comment'] : NULL;
@@ -29,7 +28,7 @@ function print_controller_html() {
$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()) {
@@ -662,8 +661,6 @@ function _print_generate_path($path, $format = PRINT_HTML_FORMAT, $teaser = FALS
// 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) {
@@ -683,6 +680,9 @@ function _print_generate_path($path, $format = PRINT_HTML_FORMAT, $teaser = FALS
}
}
+ $node->title = drupal_get_title();
+ $node->path = $path;
+
// Delete any links area
$node->body = preg_replace('!\s*
.*?
!sim', '', $node->body);
diff --git a/print_mail/print_mail.module b/print_mail/print_mail.module
index e653bbe8f01f928a625e9265fa49c505dab98faf..f63e44e5287e2156477638402cfdcad45892d5bc 100644
--- a/print_mail/print_mail.module
+++ b/print_mail/print_mail.module
@@ -229,7 +229,7 @@ function print_mail_nodeapi(&$node, $op = 'view', $teaser, $page) {
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;
}
}
@@ -452,9 +452,8 @@ function print_mail_link_allowed($args) {
$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)) {
diff --git a/print_pdf/print_pdf.module b/print_pdf/print_pdf.module
index 54c37549d17e295f3d1136db589b0bf15942f230..3e8ede8ed93f99a1afc6d0ad35bf083272f0bed6 100644
--- a/print_pdf/print_pdf.module
+++ b/print_pdf/print_pdf.module
@@ -228,7 +228,7 @@ function print_pdf_nodeapi(&$node, $op = 'view', $teaser, $page) {
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;
}
}
@@ -443,9 +443,8 @@ function print_pdf_link_allowed($args) {
$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)) {
diff --git a/print_pdf/print_pdf.pages.inc b/print_pdf/print_pdf.pages.inc
index eb95405ffbf5f496f2089711aa3e7a47e6a02a1b..3de5544cc1bf31d167965d18755d714ac09e2460 100644
--- a/print_pdf/print_pdf.pages.inc
+++ b/print_pdf/print_pdf.pages.inc
@@ -26,7 +26,6 @@ function print_pdf_controller() {
$GLOBALS['conf']['cache'] = FALSE;
$args = func_get_args();
- // Remove the printpdf/ prefix
$path = implode('/', $args);
$cid = isset($_GET['comment']) ? (int)$_GET['comment'] : NULL;
@@ -82,7 +81,7 @@ function print_pdf_controller() {
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()) {