Commit a01ab7bd authored by jcnventura's avatar jcnventura

Fix #428024: use build_mode in hook_nodeapi and elsewhere

Hide TCPDF notices
Filter node titles using check_plain
parent f76a10f2
......@@ -299,7 +299,7 @@ function print_node_view($node, $teaser) {
'#weight' => -101,
);
if (($teaser === FALSE) && !empty($print_html_link_pos['corner']) &&
(preg_match('!^print!i', $_GET['q']) == 0)) {
isset($node->build_mode) && ($node->build_mode == NODE_BUILD_NORMAL)) {
$link = print_insert_link(NULL, $node);
if ($link) {
$node->content['print_links']['#markup'] = preg_replace('!</span>$!', $link . '</span>', $node->content['print_links']['#markup']);
......@@ -698,7 +698,7 @@ 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) ||
if ((isset($node->build_mode) && ($node->build_mode == NODE_BUILD_PRINT)) ||
!_print_page_match($print_html_node_link_visibility, $print_html_node_link_pages)) {
// Page not in visibility list or we are working!
return FALSE;
......
......@@ -170,7 +170,7 @@ function _print_var_generator($node, $message = NULL, $cid = NULL) {
$print_footer_user = variable_get('print_footer_user', PRINT_FOOTER_USER_DEFAULT);
$print['language'] = $language->language;
$print['title'] = $node->title;
$print['title'] = check_plain($node->title);
$print['head'] = drupal_get_html_head();
$print['scripts'] = drupal_get_js();
$print['robots_meta'] = _print_robots_meta_generator();
......@@ -559,11 +559,14 @@ function _print_generate_node($nid, $cid = NULL, $format = PRINT_HTML_FORMAT, $t
drupal_access_denied();
return FALSE;
}
drupal_set_title($node->title, PASS_THROUGH);
drupal_set_title($node->title);
//alert other modules that we are generating a printer-friendly page, so they can choose to show/hide info
$node->printing = TRUE;
//use the proper build_mode
$node->build_mode = NODE_BUILD_PRINT;
// Turn off Pagination by the Paging module
unset($node->pages);
unset($node->page_count);
......
......@@ -155,7 +155,7 @@ function print_mail_node_view($node, $teaser) {
// Insert content corner links
if (($teaser === FALSE) && !empty($print_mail_link_pos['corner']) &&
(preg_match('!^print!i', $_GET['q']) == 0)) {
isset($node->build_mode) && ($node->build_mode == NODE_BUILD_NORMAL)) {
$link = print_mail_insert_link(NULL, $node);
if ($link) {
$node->content['print_links']['#markup'] = preg_replace('!</span>$!', $link . '</span>', $node->content['print_links']['#markup']);
......@@ -427,7 +427,7 @@ 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) ||
if ((isset($node->build_mode) && ($node->build_mode == NODE_BUILD_PRINT)) ||
!_print_page_match($print_mail_node_link_visibility, $print_mail_node_link_pages)) {
// Page not in visibility list or we are working!
return FALSE;
......
......@@ -195,7 +195,7 @@ function print_pdf_node_view($node, $teaser) {
// Insert content corner links
if (($teaser === FALSE) && !empty($print_pdf_link_pos['corner']) &&
(preg_match('!^print!i', $_GET['q']) == 0)) {
isset($node->build_mode) && ($node->build_mode == NODE_BUILD_NORMAL)) {
$link = print_pdf_insert_link(NULL, $node);
if ($link) {
$node->content['print_links']['#markup'] = preg_replace('!</span>$!', $link . '</span>', $node->content['print_links']['#markup']);
......@@ -469,7 +469,7 @@ 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) ||
if ((isset($node->build_mode) && ($node->build_mode == NODE_BUILD_PRINT)) ||
!_print_page_match($print_pdf_node_link_visibility, $print_pdf_node_link_pages)) {
// Page not in visibility list or we are working!
return FALSE;
......
......@@ -372,7 +372,7 @@ function theme_print_pdf_tcpdf_content(&$pdf, &$html, $font) {
$matches[1] = preg_replace('!(</span>)<br />(\s*?</span><br />)!s', '$1$2', $matches[1]);
} while ($prev != $matches[1]);
$pdf->writeHTML($matches[1]);
@$pdf->writeHTML($matches[1]);
return $pdf;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment