--- month.module.orig 2007-06-10 16:11:20.000000000 +0200 +++ month.module 2007-06-10 16:47:14.000000000 +0200 @@ -22,13 +22,20 @@ } function month_links_query($nodes_to_include, $rev_chronsort = NULL, $limit = NULL) { + global $db_type; foreach ($nodes_to_include as $key => $value) { $nodes_to_include[$key] = "'". db_escape_string($value) . "'"; } //$query = 'SELECT YEARMONTH(FROM_UNIXTIME(changed),0) AS monthno FROM {node} n '; //$query = 'SELECT MONTH(FROM_UNIXTIME(changed)) AS monthno FROM {node} n '; //$query = 'SELECT FROM_UNIXTIME(changed) AS monthno FROM {node} n '; - $query = 'SELECT DATE_FORMAT(FROM_UNIXTIME(created),\'%Y-%m\') AS monthno,COUNT(*) AS nodenum FROM {node} n '; + switch ($db_type) { + case 'mysql': + case 'mysqli': + $query = 'SELECT DATE_FORMAT(FROM_UNIXTIME(created),\'%Y-%m\') AS monthno,COUNT(*) AS nodenum FROM {node} n '; + case 'pgsql': + $query = 'SELECT TO_CHAR(abstime(created), \'YYYY-MM\') AS monthno,COUNT(*) AS nodenum FROM {node} n '; + } $query .= 'WHERE n.created>0 AND (n.status=1) AND n.type IN (' . implode(',', $nodes_to_include) . ') '; $query .=' GROUP BY monthno '; $query .= $rev_chronsort ? '' : 'ORDER BY monthno DESC '; @@ -182,7 +189,7 @@ if ($month_paginate){ $output .= theme('pager', NULL, $_month_config['default_nodes_main'], 0); } - drupal_set_title('Month of '.date('F , Y', $query[1])); + drupal_set_title('Month of '.date('F, Y', $query[1])); // if there's no output, don't let them stare at a blank page $output = $output? $output:t('Sorry, there are no entries for this month.'); // return the output string