Index: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG	(revision 662)
+++ trunk/CHANGELOG	(revision 663)
@@ -10,7 +10,9 @@
 # = Bugfix
 ! = Update/Change
 
-------------------------------------- 2.7.0 -------------------------------------
+------------------------------------- 2.7.0 -------------------------------------
+03-Feb-2008 Thomas Hornik
+#	out-of-date default page isn't shown anymore, instead shows next public page.
 03-Feb-2008 Matthias Gallas
 +	added kewyword id to all new files
 02-Feb-2008 Christian Sommer
Index: trunk/wb/framework/class.frontend.php
===================================================================
--- trunk/wb/framework/class.frontend.php	(revision 662)
+++ trunk/wb/framework/class.frontend.php	(revision 663)
@@ -84,7 +84,17 @@
 		}
 		// Get default page
 		// Check for a page id
-		$query_default = "SELECT page_id,link FROM ".TABLE_PREFIX."pages WHERE parent = '0' AND visibility = 'public'$this->sql_where_language ORDER BY position ASC LIMIT 1";
+		$table_p = TABLE_PREFIX.'pages';
+		$table_s = TABLE_PREFIX.'sections';
+		$now = time();
+		$query_default = "
+			SELECT p.page_id, p.link
+			FROM $table_p AS p, $table_s AS s
+			WHERE p.page_id=s.page_id
+			AND p.parent = '0' AND p.visibility = 'public'
+			AND (($now>=s.publ_start OR s.publ_start=0) AND ($now<=s.publ_end OR s.publ_end=0))
+			$this->sql_where_language
+			ORDER BY p.position ASC LIMIT 1";
 		$get_default = $database->query($query_default);
 		$default_num_rows = $get_default->numRows();
 		if(!isset($page_id) OR !is_numeric($page_id)){
Index: trunk/wb/framework/frontend.functions.php
===================================================================
--- trunk/wb/framework/frontend.functions.php	(revision 662)
+++ trunk/wb/framework/frontend.functions.php	(revision 663)
@@ -209,8 +209,7 @@
 			while($section = $query_sections->fetchRow()) {
 				// skip this section if it is out of publication-date
 				$now = time();
-				if( !( $now<$section['publ_end'] && ($now>$section['publ_start'] || $section['publ_start']==0) ||
-					$now>$section['publ_start'] && $section['publ_end']==0) ) {
+				if( !(($now<=$section['publ_end'] || $section['publ_end']==0) && ($now>=$section['publ_start'] || $section['publ_start']==0)) ) {
 					continue;
 				}
 				$section_id = $section['section_id'];
