0) && ($da<32) && ($mo>0) && ($mo<13) ) {
// get a list of the entries for the current day
list($start_date, $stop_date) = getdaterange(sprintf("%02d-%02d-%02d-00-00",$ye,$mo, $da), 'day' );
} else if ( ($mo>0) && ($mo<13) ) {
// get a list of the entries for the current month
list($start_date, $stop_date) = getdaterange(sprintf("%02d-%02d-01-00-00",$ye,$mo), 'month' );
} else {
// get a list of the entries for the current year
list($start_date, $stop_date) = getdaterange(sprintf("%02d-%02d-01-00-00",$ye,$mo), 'year' );
}
$list_entries = $db->getlist_range($start_date, $stop_date,"","", FALSE);
$arc_list = "";
foreach ($list_entries as $list_entry) {
if ( !isset($filtercat) || (in_array($filtercat, $list_entry['category'] )) ) {
$diffdate = format_date( $list_entry['date'], $Weblogs[$Current_weblog]['diffdate_format']);
$date = format_date( $list_entry['date'], $Weblogs[$Current_weblog]['entrydate_format']);
$temp_entry = $list_entry;
$link = make_filelink($list_entry['code'], "", "");
if ($diffdate != $lastdiffdate) {
$arc_list.= "
".$diffdate."
\n";
$lastdiffdate = $diffdate;
}
$arc_list.= sprintf("%s %s
\n", $date , $link, implode(", ",$list_entry['category']),$list_entry['commcount'], trimtext($list_entry['title'], $maxlength) );
}
}
unset($temp_entry);
$template_html = load_template($Weblogs[$Current_weblog]['archive_template']);
if (preg_match_all('/\[\[weblog:(.*)?(:[0-9]*)?\]\]/siU', $template_html, $match)) {
if (count($match[1])==1) {
$template_html = str_replace($match[0][0], $arc_list, $template_html);
//echo "kaaa";
} else {
$template_html = preg_replace("/\[\[weblog:standard(:[0-9]*)?\]\]/siU", $arc_list, $template_html);
foreach ($match[0] as $name) {
$template_html = str_replace($name, "", $template_html);
}
}
}
$filename = $Weblogs[$Current_weblog]['archive_path'] . make_archive_name();
if (!($template_html)) {
ErrorOut("Could not load template file: $template [does not exist]");
} else {
$output=$template_html;
$output=parse_step4($output);
}
echo ($output);
}
function make_default() {
global $HTTP_SERVER_VARS, $Weblogs, $Current_weblog, $db, $base_url, $pivot_url, $pivot_path, $entry, $temp_entry, $pivotdir;
SpoofPaths();
reset ($Weblogs);
$Current_weblog = (key($Weblogs));
$db = new db();
/*
if ( ($da>0) && ($da<32) && ($mo>0) && ($mo<13) ) {
// get a list of the entries for the current day
list($start_date, $stop_date) = getdaterange(sprintf("%02d-%02d-%02d-00-00",$ye,$mo, $da), 'day' );
} else if ( ($mo>0) && ($mo<13) ) {
// get a list of the entries for the current month
list($start_date, $stop_date) = getdaterange(sprintf("%02d-%02d-01-00-00",$ye,$mo), 'month' );
} else {
// get a list of the entries for the current year
list($start_date, $stop_date) = getdaterange(sprintf("%02d-%02d-01-00-00",$ye,$mo), 'year' );
}
*/
/*
$list_entries = $db->getlist_range($start_date, $stop_date,"","", FALSE);
$arc_list = "";
foreach ($list_entries as $list_entry) {
$date = format_date( $list_entry['date'], $Weblogs[$Current_weblog]['fulldate_format']);
$temp_entry = $list_entry;
$link = make_filelink($list_entry['code']);
$arc_list.= sprintf("%s %s
\n", $date , $link, $list_entry['title']);
}
*/
//unset($temp_entry);
$template_html = load_template($Weblogs[$Current_weblog]['archive_template']);
if (preg_match_all('/\[\[weblog:(.*)?\]\]/siU', $template_html, $match)) {
if (count($match[1])==1) {
$template_html = str_replace("[[weblog:".$match[1][0]."]]", $arc_list, $template_html);
} else {
$template_html = str_replace("[[weblog:standard]]", $arc_list, $template_html);
foreach ($match[1] as $name) {
$template_html = str_replace("[[weblog:".$name."]]", "", $template_html);
}
}
}
$filename = $Weblogs[$Current_weblog]['archive_path'] . make_archive_name();
if (!($template_html)) {
ErrorOut("Could not load template file: $template [does not exist]");
} else {
$output=$template_html;
$output=parse_step4($output);
}
echo ($output);
}
list($dummy, $ye, $mo, $da, $name, $extra) = explode("/", $HTTP_SERVER_VARS['PATH_INFO']);
// if it's a single entry we want, just show it.
if ( (preg_match('/\(([0-9]+)/', $name, $match)) || (preg_match('/\[([0-9]+)/', $name, $match)) ){
// get a single entry
SpoofPaths();
// we just include entry.php and show this entry. But we need to set the path, and the id..
$HTTP_POST_VARS['id'] = $match[1];
$_POST['id'] = $match[1];
include ('entry.php');
die();
}
LoadLanguage(TRUE);
// check to see if we want to filter on category.
if (in_array($ye, explode("|", $Cfg['cats']))) {
// if the second 'directory' is a category, we use that to filter whatever comes after..
$filtercat = $ye;
// we need to shift the year, month and day;
$ye = $mo;
$mo = $da;
$da = $name;
}
//debug ("ye-mo-da = $ye - $mo - $da");
// show the appropriate pages:
if (isset($ye) && isset($mo) && isset($da) && is_numeric($ye) && is_numeric($mo) && is_numeric($da)) {
make_archive_list($ye, $mo, $da);
} else if (isset($ye) && isset($mo) && is_numeric($ye) && is_numeric($mo)) {
make_archive_list($ye, $mo, "");
} else if (isset($ye) && is_numeric($ye)) {
make_archive_list($ye, "", "");
} else {
//debug (" def: ye-mo-da = $ye - $mo - $da");
// just show the default page:
make_default();
}
?>