Commit b80ad20f authored by jcnventura's avatar jcnventura

Issue #1222198: fix error when node->path is an array.

parent f7f4b1d9
......@@ -30,14 +30,14 @@ function print_controller_html() {
drupal_send_headers();
print $html;
$nodepath = (isset($node->path)) ? drupal_get_normal_path($node->path) : 'node/' . $path;
$nodepath = (isset($node->path) && is_string($node->path)) ? drupal_get_normal_path($node->path) : 'node/' . $path;
db_merge('print_page_counter')
->key(array('path' => $nodepath))
->fields(array(
'totalcount' => 1,
'timestamp' => REQUEST_TIME,
))
->expression('totalcount', 'totalcount + :inc', array(':inc' => 1))
->expression('totalcount', 'totalcount + 1')
->execute();
}
}
......@@ -81,7 +81,7 @@ function print_controller($path, $cid = NULL, $format = PRINT_HTML_FORMAT, $teas
$path = $alias;
}
$parts = explode('/', $path);
if ($parts[0] == 'node') {
if (($parts[0] == 'node') && (count($parts) > 1)) {
array_shift($parts);
$path = implode('/', $parts);
}
......
......@@ -62,7 +62,7 @@ function print_mail_form($form, &$form_state) {
'totalcount' => 1,
'timestamp' => REQUEST_TIME,
))
->expression('totalcount', 'totalcount + :inc', array(':inc' => 1))
->expression('totalcount', 'totalcount + 1')
->execute();
}
......
......@@ -54,14 +54,14 @@ function print_pdf_controller() {
exit;
}
$nodepath = (isset($node->path)) ? drupal_get_normal_path($node->path) : 'node/' . $path;
$nodepath = (isset($node->path) && is_string($node->path)) ? drupal_get_normal_path($node->path) : 'node/' . $path;
db_merge('print_pdf_page_counter')
->key(array('path' => $nodepath))
->fields(array(
'totalcount' => 1,
'timestamp' => REQUEST_TIME,
))
->expression('totalcount', 'totalcount + :inc', array(':inc' => 1))
->expression('totalcount', 'totalcount + 1')
->execute();
}
......
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