[geeklog-cvs] geeklog-1.3/plugins/staticpages functions.inc,1.30,1.31
dhaun at geeklog.net
dhaun at geeklog.net
Sat Jan 31 12:12:35 EST 2004
Update of /usr/cvs/geeklog/geeklog-1.3/plugins/staticpages
In directory geeklog_prod:/tmp/cvs-serv14428
Modified Files:
functions.inc
Log Message:
Make sure we display pages to be displayed after the featured story even when there is no featured story.
Index: functions.inc
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/plugins/staticpages/functions.inc,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** functions.inc 21 Jan 2004 19:13:34 -0000 1.30
--- functions.inc 31 Jan 2004 17:12:33 -0000 1.31
***************
*** 311,315 ****
if ($u_id == '') {
! $uid = $_USER['uid'];
$GROUPS = $_GROUPS;
} else {
--- 311,319 ----
if ($u_id == '') {
! if (isset ($_USER['uid'])) {
! $uid = $_USER['uid'];
! } else {
! $uid = 1;
! }
$GROUPS = $_GROUPS;
} else {
***************
*** 341,345 ****
* Display static pages in the center block.
*
! * @param where int where the static page will be displayed (0..2)
* @param page int page number
* @param topic string topic ID
--- 345,349 ----
* Display static pages in the center block.
*
! * @param where int where the static page will be displayed (0..3)
* @param page int page number
* @param topic string topic ID
***************
*** 357,360 ****
--- 361,378 ----
$moresql = "(sp_where = $where) AND ";
+ $displayFeatured = false;
+
+ // If there are no featured stories, we won't be called with $where == 2.
+ // So, if asked to display pages for the top of the page, check if we
+ // have pages to be displayed after the featured story and if there is
+ // no features story, display those pages as well.
+ if ($where == 1) {
+ if (DB_count ($_TABLES['stories'], 'featured', 1) == 0) {
+ // no featured story found - redefine $moresql
+ $moresql = "(sp_where = 1 OR sp_where = 2) AND ";
+ $displayFeatured = true;
+ }
+ }
+
if (empty ($topic)) {
$moresql .= "((sp_tid = 'none') OR (sp_tid = 'all'))";
***************
*** 369,372 ****
--- 387,393 ----
} else { // default to "sort by id"
$sort = 'sp_id';
+ }
+ if ($displayFeatured) {
+ $sort = 'sp_where,' . $sort;
}
More information about the geeklog-cvs
mailing list