get($categories->get_id($get['cat']), 'name'); $c['main'] .= "

".$l['content_categories_header']." ".$categories->get($categories->get_id($get['cat']), 'name')." ".$yl->get_selected_year()."

"; $c['main'] .= "

".$categories->get($categories->get_id($get['cat']), 'description')."

"; $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'] .= "

".$yl->get_linklist()."

"; } elseif(empty($get['y'])) { $c['meta']['title'] = $l['content_archive_header']; $c['main'] = "

".$c['meta']['title']."

"; $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 "
\n";
                echo $count_query->getError();
                echo "
\n"; die(); } $_count = $count_query->fetch(); $count_query->free(); $count = $_count['count']; } else { if(!empty($get['m'])) $where_month = " AND MONTH(date) = '".escape_for_mysql($get['m'])."'"; $c['meta']['title'] = $l['content_archive_header']; $c['main'] = "

".$c['meta']['title']." ".$yl->get_selected_year()."

"; $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'] .= "

".$yl->get_linklist()."

"; } $cc = count_comments(); $archive = new Query($sql_archive); if($archive->error()) { echo "
\n";
        echo $archive->getError();
        echo "
\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'] .= "

".array_search($daten['month'], $months)." ".$daten['year']."

\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, "

", "

"); } if(empty($get['y'])) { $c['main'] .= "

"; if(($p - $amount) >= 0) { $c['main'] .= "<— ".$l['content_archive_preview'].""; $c['meta']['aditionalheader'] .= ' '."\n"; } if((($p - $amount) >= 0) && (($p + $amount) < $count)) $c['main'] .= " | "; if(($p + $amount) < $count) { $c['main'] .= "".$l['content_archive_next']." —>"; $c['meta']['aditionalheader'] .= ' '."\n"; } $c['main'] .= "

"; } $c['main'] .= "
\n"; } require(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'do_template.php'); echo $body; ?>