[geeklog-cvs] geeklog-1.3/plugins/staticpages functions.inc,1.47,1.48
dhaun at iowaoutdoors.org
dhaun at iowaoutdoors.org
Tue Jan 4 09:21:59 EST 2005
Update of /var/cvs/geeklog-1.3/plugins/staticpages
In directory www:/tmp/cvs-serv13672
Modified Files:
functions.inc
Log Message:
Reduced number of SQL requests in search and added support for $_CONF['show_fullname'] in the search results.
Index: functions.inc
===================================================================
RCS file: /var/cvs/geeklog-1.3/plugins/staticpages/functions.inc,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** functions.inc 22 Dec 2004 17:13:45 -0000 1.47
--- functions.inc 4 Jan 2005 14:21:57 -0000 1.48
***************
*** 11,20 ****
// | Pages' PHP files. |
// +---------------------------------------------------------------------------+
! // | Copyright (C) 2000-2004 by the following authors: |
// | |
! // | Authors: Tony Bibbs - tony at tonybibbs.com |
! // | Tom Willett - twillett at users.sourceforge.net |
! // | Blaine Lang - langmail at sympatico.ca |
! // | Dirk Haun - dirk at haun-online.de |
// +---------------------------------------------------------------------------+
// | |
--- 11,20 ----
// | Pages' PHP files. |
// +---------------------------------------------------------------------------+
! // | Copyright (C) 2000-2005 by the following authors: |
// | |
! // | Authors: Tony Bibbs - tony AT tonybibbs DOT com |
! // | Tom Willett - twillett AT users DOT sourceforge DOT net |
! // | Blaine Lang - langmail AT sympatico DOT ca |
! // | Dirk Haun - dirk AT haun-online DOT de |
// +---------------------------------------------------------------------------+
// | |
***************
*** 207,211 ****
// Build search SQL - exclude static PHP pages from search.
! $sql = "SELECT *,UNIX_TIMESTAMP(sp_date) AS day FROM " . $_TABLES['staticpage'] . " WHERE (sp_php != 1)";
if (!empty ($query)) {
--- 207,211 ----
// Build search SQL - exclude static PHP pages from search.
! $sql = "SELECT u.username,u.fullname,sp.sp_id,sp.sp_title,sp.sp_hits,sp.sp_uid,UNIX_TIMESTAMP(sp.sp_date) AS day FROM {$_TABLES['staticpage']} AS sp,{$_TABLES['users']} AS u WHERE (sp.sp_uid = u.uid) AND (sp_php != 1)" . COM_getPermSQL ('AND');
if (!empty ($query)) {
***************
*** 259,268 ****
$sql .= "AND (sp_uid = '$author')";
}
! $sql .= " ORDER BY sp_date desc";
// Perform search
$result = DB_query ($sql);
! // OK, now return coma delmited string of table header labels
$plugin_results = new Plugin();
$plugin_results->plugin_name = 'staticpages';
--- 259,268 ----
$sql .= "AND (sp_uid = '$author')";
}
! $sql .= " ORDER BY sp_date DESC";
// Perform search
$result = DB_query ($sql);
! // OK, now return table header labels
$plugin_results = new Plugin();
$plugin_results->plugin_name = 'staticpages';
***************
*** 277,295 ****
// make sure data elements are in an array and in the same order as your
// headings above!
! for ($i = 1; $i <= $mycount; $i++) {
$A = DB_fetchArray ($result);
! if (SEC_hasAccess ($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon'])) {
! $rcnt++;
! $thetime = COM_getUserDateTimeFormat ($A['day']);
! $A['sp_title'] = stripslashes ($A['sp_title']);
! $row = array ('<a href="' . COM_buildURL ($_CONF['site_url'] . '/staticpages/index.php?page=' . $A['sp_id']) . '">' . $A['sp_title'] . '</a>',
! $thetime[0],
! '<a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['sp_uid'] . '">' . DB_getItem ($_TABLES['users'], 'username', "uid = '{$A['sp_uid']}'") . '</a>',
! $A['sp_hits']);
! $plugin_results->addSearchResult ($row);
}
}
! $plugin_results->num_searchresults = $rcnt;
$plugin_results->num_itemssearched = DB_count ($_TABLES['staticpage']);
--- 277,302 ----
// make sure data elements are in an array and in the same order as your
// headings above!
! for ($i = 0; $i < $mycount; $i++) {
$A = DB_fetchArray ($result);
! $thetime = COM_getUserDateTimeFormat ($A['day']);
! $A['sp_title'] = stripslashes ($A['sp_title']);
! $pageurl = COM_buildURL ($_CONF['site_url']
! . '/staticpages/index.php?page=' . $A['sp_id']);
! if (isset ($_CONF['show_fullname']) && ($_CONF['show_fullname'] == 1) &&
! !empty ($A['fullname'])) {
! $author = $A['fullname'];
! } else {
! $author = $A['username'];
}
+ $profile = $_CONF['site_url'] . '/users.php?mode=profile&uid='
+ . $A['sp_uid'];
+ $row = array ('<a href="' . $pageurl . '">' . $A['sp_title'] . '</a>',
+ $thetime[0],
+ '<a href="' . $profile . '">' . $author . '</a>',
+ $A['sp_hits']);
+ $plugin_results->addSearchResult ($row);
}
! $plugin_results->num_searchresults = $mycount;
$plugin_results->num_itemssearched = DB_count ($_TABLES['staticpage']);
More information about the geeklog-cvs
mailing list