";
$sql_archive = "
SELECT
".JLOG_DB_CONTENT.".*,
".JLOG_DB_CONTENT.".date as mysql_date,
DATE_FORMAT(".JLOG_DB_CONTENT.".date, '%c') AS month,
DATE_FORMAT(".JLOG_DB_CONTENT.".date, '%Y') AS year,
UNIX_TIMESTAMP(".JLOG_DB_CONTENT.".date) AS date
FROM ".JLOG_DB_CONTENT."
LEFT JOIN ".JLOG_DB_CATASSIGN."
ON ".JLOG_DB_CONTENT.".id = ".JLOG_DB_CATASSIGN.".content_id
WHERE ".JLOG_DB_CATASSIGN.".cat_id = '".escape_for_mysql($categories->get_id($get['cat']))."'
AND YEAR(".JLOG_DB_CONTENT.".date) = '".escape_for_mysql($yl->get_selected_year())."'
ORDER BY mysql_date DESC;";
$c['main'] .= "
";
$sql_archive = "SELECT id, url, topic,
date as mysql_date,
DATE_FORMAT(date, '%c') AS month,
DATE_FORMAT(".JLOG_DB_CONTENT.".date, '%Y') AS year,
UNIX_TIMESTAMP(date) AS date,
teaser, teaserpic, teaserpiconblog, keywords, content,
comments, allowpingback, section
FROM ".JLOG_DB_CONTENT."
WHERE section = 'weblog'
ORDER BY mysql_date DESC
LIMIT ".$p.", ".$amount.";";
$sql_count = "SELECT count(*) AS count FROM ".JLOG_DB_CONTENT." WHERE section = 'weblog'";
$count_query = new Query($sql_count);
if($count_query->error()) {
echo "
";
$sql_archive = "SELECT id, url, topic,
date as mysql_date,
DATE_FORMAT(date, '%c') AS month,
DATE_FORMAT(".JLOG_DB_CONTENT.".date, '%Y') AS year,
UNIX_TIMESTAMP(date) AS date,
teaser, teaserpic, teaserpiconblog, keywords, content,
comments, allowpingback, section
FROM ".JLOG_DB_CONTENT.$where_from."
WHERE
YEAR(date) = '".escape_for_mysql($yl->get_selected_year())."'
".$where_month."
AND section = 'weblog'
ORDER BY mysql_date;";
$c['main'] .= "
\n";
die();
}
$months = array_flip($l['months']);
if($archive->numRows() > 0) {
// initialise variables to keep track of last posts month and year
$last_month = false;
$last_year = false;
while ($daten = $archive->fetch()) {
if(empty($daten)) break 1;
// did we already reach a new month or year?
if (($last_month != $daten['month']) OR ($last_year != $daten['year'])) {
if ($last_month) { $c['main'] .= " \n"; }
$c['main'] .= "
\n";
// set last month and year to values of current post
$last_month = $daten['month'];
$last_year = $daten['year'];
}
$c['main'] .= do_teaser($daten, $cc, "