<$MTCCLicenseRDF$> <$MTInclude module="Script"$>
<$MTInclude module="Alpha"$> <$MTInclude module="Gamma_BlogList"$>
Sort by Author Categories Show Dates END; for( $i=0; $i<$cat_cnt; $i++ ) { echo ""; } echo << END; ?>
$y[DATE] ) return -1; else return 1; } /* compareDate */ function compareDateR($x, $y) { if ( $x[DATE] == $y[DATE] ) return 0; else if ( $x[DATE] < $y[DATE] ) return -1; else return 1; } /* compareDateR */ function NormalizeTitle( $title ) { $idx = 0; while( ($title[$idx]== "\"") || ($title[$idx] == "'") ) { $idx = $idx+1; } if( $idx == 0 ) return $title; $newstr == ""; $len = strlen( $title ); for( $i=$idx;$i<$len;$i++ ) { $newstr .= $title[$i]; } return $newstr; } /* NormalizeTitle */ function compareName($x, $y) { // $x_title = $x[TITLE]; // $y_title = $y[TITLE]; $x_title = NormalizeTitle( $x[TITLE] ); $y_title = NormalizeTitle( $y[TITLE] ); return strcasecmp( $x_title, $y_title ); } /* compareName */ /* * * back to the main line * */ /* * sort the data */ if( $sort == "Date - Newest First" ) { usort($keywords, 'compareDate'); } else if( $sort == "Date - Oldest First" ) { usort($keywords, 'compareDateR'); } else { usort($keywords, 'compareName'); } /* * output all the blogs */ $months = array( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ); $last_firstletter = ''; $lastyear = (int) 0; $lastmonth = (int) 0; $lastday = (int) 0; $count = 0; $veryfirst = true; for( $k = 0; $k<$entries; $k++ ) { $a = $keywords[$k]; /* * if filtering by author, then check if this blog is by the specified author */ if( $author!= ALLAUTHORS ) { $keepgoing = (int) 0; if( isset( $a[AUTHOR] ) ) { $s = trim( $a[AUTHOR] ); if( $s == $author ) { $keepgoing = (int) 1; } } if( $keepgoing == 0 ) { continue; } } /* * if filtering by catgory, then check if this blog is is in the specified category */ if( $category != ALLBLOGS ) { $keepgoing = (int) 0; $c = CATEGORY; while( isset( $a[$c] ) ) { $s = trim( $a[$c] ); if( $s == $category ) { $keepgoing = (int) 1; break; } $c = $c + 1; } if( $keepgoing == 0 ) { continue; } } /* * get the date & title */ $title = $a[TITLE]; $date = preg_split("/[-]+/", $a[DATE]); $firstletter = strtoupper( $title[0] ); $idx = 0; while( $firstletter == "'" || $firstletter == "\"" ) { $idx = $idx+1; $firstletter = strtoupper( $title[$idx] ); } /* * if we are sorting by blog title, and the first letter changes, then we need to spit out a letter header */ if( ($sort[0] == "B") && ($last_firstletter != $firstletter) ) { $last_firstletter = $firstletter; if( $perline > 1 && $count != 0 ) { echo( "
" ); $count = 0; } if( $veryfirst ) { $veryfirst = false; } else { echo "
"; } echo "

$last_firstletter


"; } /* * if we are sorting by date, and the month changes, then we need to spit out a month header */ else if( ($sort[0] == "D") && ($lastyear != $date[DATE_YEAR] || $lastmonth != $date[DATE_MONTH]) ) { $lastyear = (int) $date[DATE_YEAR]; $lastmonth = (int) $date[DATE_MONTH]; $tmp = ((int) $lastmonth) - 1; if( $perline > 1 && $count != 0 ) { echo( "
" ); $count = 0; } if( $veryfirst ) { $veryfirst = false; } else { echo "
"; } echo "

$months[$tmp] $lastyear


"; } /* * if we are asked to show the dates and the day changes, output a day header */ if( ($showdate == "Yes") && ($sort[0]=="D") && ($lastday != $date[DATE_DAY]) ) { $lastday = (int) $date[DATE_DAY]; if( $perline > 1 && $count != 0 ) { echo( "
" ); $count = 0; } $tmp = ((int) $date[DATE_MONTH]) - 1; echo "$months[$tmp] $lastday
"; } /* * if sorting by title and asked to show the dates, then ad a date to the front of the title */ if( $showdate == "Yes" && $sort == "Blog Title" ) { $pdate = sprintf(" (%04d/%02d/%02d)", $date[DATE_YEAR],$date[DATE_MONTH],$date[DATE_DAY]); } else { $pdate = ""; } $dir = $a[URL]; if( $count != 0 && $perline > 1 ) { echo "   "; } echo "$title$pdate"; $count = $count +1; if( $count >= $perline ) { $count = 0; echo "
"; } } ?>
<$MTStats$>