[geeklog-cvs] Geeklog-1.x/plugins/links functions.inc,1.89,1.90
Dirk Haun
dhaun at qs1489.pair.com
Fri Dec 28 10:41:29 EST 2007
Update of /cvsroot/geeklog/Geeklog-1.x/plugins/links
In directory qs1489.pair.com:/tmp/cvs-serv89500/plugins/links
Modified Files:
functions.inc
Log Message:
Got rid of the somewhat questionable links_get_tid() function. Use global variable $topic instead.
Index: functions.inc
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/plugins/links/functions.inc,v
retrieving revision 1.89
retrieving revision 1.90
diff -C2 -d -r1.89 -r1.90
*** functions.inc 25 Nov 2007 06:56:04 -0000 1.89
--- functions.inc 28 Dec 2007 15:41:26 -0000 1.90
***************
*** 34,38 ****
* @version 1.0.1
* @since GL 1.4.0
! * @copyright Copyright © 2005-2006
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @author Trinity Bays <trinity93 AT steubentech DOT com>
--- 34,38 ----
* @version 1.0.1
* @since GL 1.4.0
! * @copyright Copyright © 2005-2007
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @author Trinity Bays <trinity93 AT steubentech DOT com>
***************
*** 1486,1516 ****
!
! // +-----------------------------------------------------------------------------------------------+
! // | PHP Block functions |
! // | Functions for building php blocks |
! // +-----------------------------------------------------------------------------------------------+
/**
! * returns a list of links that belong to categories associated with the current topic
*/
! function phpblock_topic_links ()
{
! global $_TABLES, $LANG_LINKS, $_CONF;
$retval = '';
! $tid = links_get_tid();
! $result = DB_query("SELECT l.lid, l.title, c.cid FROM {$_TABLES['links']} AS l
! LEFT JOIN {$_TABLES['linkcategories']} AS c
! ON l.cid=c.cid
! WHERE c.tid='{$tid}'" . COM_getPermSQL('AND', 0, 2, 'c'));
! $nrows = DB_numRows($result);
! if ($nrows>0) {
! for ($i = 0; $i < $nrows; $i++) {
! $A = DB_fetchArray ($result);
! $content = stripslashes ($A['title']);
! $url = $_CONF['site_url'] . '/links/portal.php?what=link&item=' . $A['lid'];
! $retval .= COM_createLink ($content, $url) . '<br' . XHTML . '>';
}
}
return $retval;
}
--- 1486,1519 ----
! // +--------------------------------------------------------------------------+
! // | PHP Block functions |
! // +--------------------------------------------------------------------------+
/**
! * Returns a list of links that belong to categories associated with
! * the current topic
! *
! * Relies on the fact that $topic is set (and sanitized) in lib-common.php
*/
! function phpblock_topic_links()
{
! global $_CONF, $_TABLES, $LANG_LINKS, $topic;
!
$retval = '';
!
! if (!empty($topic)) {
! $tid = addslashes($topic);
! $result = DB_query("SELECT l.lid, l.title, c.cid FROM {$_TABLES['links']} AS l LEFT JOIN {$_TABLES['linkcategories']} AS c ON l.cid=c.cid WHERE c.tid='{$tid}'" . COM_getPermSQL('AND', 0, 2, 'c'));
! $nrows = DB_numRows($result);
! if ($nrows > 0) {
! for ($i = 0; $i < $nrows; $i++) {
! $A = DB_fetchArray($result);
! $content = stripslashes($A['title']);
! $url = $_CONF['site_url'] . '/links/portal.php?what=link&item=' . $A['lid'];
! $retval .= COM_createLink($content, $url) . '<br' . XHTML . '>';
! }
}
}
+
return $retval;
}
***************
*** 1518,1560 ****
/**
! * returns a list of categories that are associated with the current topic
*/
! function phpblock_topic_categories ()
{
! global $_TABLES, $LANG_LINKS, $_CONF;
$retval = '';
! $tid = links_get_tid();
! if (isset($tid)) {
! $result = DB_query("SELECT category, cid FROM {$_TABLES['linkcategories']}
! WHERE tid='{$tid}'" . COM_getPermSQL ('AND'));
! $nrows = DB_numRows ($result);
! if ($nrows>0) {
for ($i = 0; $i < $nrows; $i++) {
! $A = DB_fetchArray ($result);
! $content = stripslashes ($A['category']);
$url = $_CONF['site_url'] . '/links/portal.php?what=category&item=' . $A['cid'];
! $retval .= COM_createLink ($content, $url) . '<br' . XHTML . '>';
}
}
}
- return $retval;
- }
-
! /**
! * tries to establish the current topic and return tid
! */
! function links_get_tid ()
! {
! global $_TABLES;
! if (isset($_REQUEST['topic'])) {
! return $_REQUEST['topic'];
! } elseif (isset($_REQUEST['topic'])) {
! return DB_getItem($_TABLES['topics'], 'tid', "topic='{$_REQUEST['topic']}'");
! } elseif (isset($_REQUEST['story'])) {
! return DB_getItem($_TABLES['stories'], 'tid', "sid='{$_REQUEST['story']}'");
! } else {
! return;
! }
}
--- 1521,1549 ----
/**
! * Returns a list of categories that are associated with the current topic
! *
! * Relies on the fact that $topic is set (and sanitized) in lib-common.php
*/
! function phpblock_topic_categories()
{
! global $_CONF, $_TABLES, $LANG_LINKS, $topic;
!
$retval = '';
!
! if (!empty($topic)) {
! $tid = addslashes($topic);
! $result = DB_query("SELECT category, cid FROM {$_TABLES['linkcategories']} WHERE tid='{$tid}'" . COM_getPermSQL ('AND'));
! $nrows = DB_numRows($result);
! if ($nrows > 0) {
for ($i = 0; $i < $nrows; $i++) {
! $A = DB_fetchArray($result);
! $content = stripslashes($A['category']);
$url = $_CONF['site_url'] . '/links/portal.php?what=category&item=' . $A['cid'];
! $retval .= COM_createLink($content, $url) . '<br' . XHTML . '>';
}
}
}
! return $retval;
}
More information about the geeklog-cvs
mailing list