[geeklog-cvs] geeklog-1.3/plugins/staticpages config.php,1.3,1.4 functions.inc,1.22,1.23
geeklog-cvs-admin at lists.geeklog.net
geeklog-cvs-admin at lists.geeklog.net
Thu Jun 26 14:36:46 EDT 2003
Update of /usr/cvs/geeklog/geeklog-1.3/plugins/staticpages
In directory internal.geeklog.net:/tmp/cvs-serv32670
Modified Files:
config.php functions.inc
Log Message:
Display all static pages that have the center block flag set, not only the first one. Also added a sort option (sort by id, date, title) for those.
Index: config.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/plugins/staticpages/config.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** config.php 9 Mar 2003 11:47:22 -0000 1.3
--- config.php 26 Jun 2003 18:36:44 -0000 1.4
***************
*** 3,6 ****
--- 3,12 ----
$_SP_CONF['version'] = '1.3';
+ // If you have more than one static page that is to be displayed in Geeklog's
+ // center area, you can specify how to sort them:
+
+ $_SP_CONF['sort_by'] = 'id'; // can be 'id', 'title', 'date'
+
+
// If you experience timeout issues, you may need to set both of the
// following values to 0 as they are intensive
Index: functions.inc
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/plugins/staticpages/functions.inc,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** functions.inc 26 Jun 2003 04:09:04 -0000 1.22
--- functions.inc 26 Jun 2003 18:36:44 -0000 1.23
***************
*** 367,418 ****
}
$perms = SP_getPerms ();
if (!empty ($perms)) {
$perms = ' AND ' . $perms;
}
! $spsql = "SELECT sp_id,sp_content,sp_title,sp_format,sp_php FROM {$_TABLES['staticpage']} WHERE (sp_centerblock = 1) AND " . $moresql . $perms . " ORDER BY sp_date DESC";
$result = DB_query ($spsql);
! if (DB_numRows ($result) > 0) {
! $spresult = DB_fetchArray ($result);
! if ($where == 0) {
! switch ($spresult['sp_format']) {
! case 'noblocks':
! $retval .= COM_siteHeader ('none');
! break;
! case 'allblocks':
! case 'leftblocks':
! $retval .= COM_siteHeader ('menu');
! break;
}
- $retval .= COM_showMessage ($HTTP_GET_VARS['msg']);
- }
! if (($_SP_CONF['in_block'] == 1) && !empty ($spresult['sp_title'])) {
! $retval .= COM_startBlock ($spresult['sp_title']);
! }
! // Check for type (ie html or php)
! if ($spresult['sp_php'] == 1) {
! $retval .= eval (stripslashes ($spresult['sp_content']));
! } else {
! $retval .= stripslashes ($spresult['sp_content']);
! }
! if (($_SP_CONF['in_block'] == 1) && !empty ($spresult['sp_title'])) {
! $retval .= COM_endBlock ();
! }
! if ($where == 0) {
! if ($spresult['sp_format'] == 'allblocks') {
! $retval .= COM_siteFooter (true);
! } else if ($spresult['sp_format'] != 'blankpage') {
! $retval .= COM_siteFooter ();
}
- }
! // increment hit counter for page
! DB_query ("UPDATE {$_TABLES['staticpage']} SET sp_hits = sp_hits + 1 WHERE sp_id = '{$spresult['sp_id']}'");
}
--- 367,429 ----
}
+ if ($_SP_CONF['sort_by'] == 'date') {
+ $sort = 'sp_date DESC';
+ } else if ($_SP_CONF['sort_by'] == 'title') {
+ $sort = 'sp_title';
+ } else { // default to "sort by id"
+ $sort = 'sp_id';
+ }
+
$perms = SP_getPerms ();
if (!empty ($perms)) {
$perms = ' AND ' . $perms;
}
! $spsql = "SELECT sp_id,sp_content,sp_title,sp_format,sp_php FROM {$_TABLES['staticpage']} WHERE (sp_centerblock = 1) AND " . $moresql . $perms . " ORDER BY " . $sort;
$result = DB_query ($spsql);
! $pages = DB_numRows ($result);
! if ($pages > 0) {
! for ($i = 0; $i < $pages; $i++) {
! $spresult = DB_fetchArray ($result);
! if ($where == 0) {
! switch ($spresult['sp_format']) {
! case 'noblocks':
! $retval .= COM_siteHeader ('none');
! break;
! case 'allblocks':
! case 'leftblocks':
! $retval .= COM_siteHeader ('menu');
! break;
! }
! $retval .= COM_showMessage ($HTTP_GET_VARS['msg']);
}
! if (($_SP_CONF['in_block'] == 1) && !empty ($spresult['sp_title'])) {
! $retval .= COM_startBlock ($spresult['sp_title']);
! }
! // Check for type (ie html or php)
! if ($spresult['sp_php'] == 1) {
! $retval .= eval (stripslashes ($spresult['sp_content']));
! } else {
! $retval .= stripslashes ($spresult['sp_content']);
! }
! if (($_SP_CONF['in_block'] == 1) && !empty ($spresult['sp_title'])) {
! $retval .= COM_endBlock ();
! }
! if ($where == 0) {
! if ($spresult['sp_format'] == 'allblocks') {
! $retval .= COM_siteFooter (true);
! } else if ($spresult['sp_format'] != 'blankpage') {
! $retval .= COM_siteFooter ();
! }
}
! // increment hit counter for page
! DB_query ("UPDATE {$_TABLES['staticpage']} SET sp_hits = sp_hits + 1 WHERE sp_id = '{$spresult['sp_id']}'");
! }
}
More information about the geeklog-cvs
mailing list