[geeklog-cvs] geeklog-1.3/public_html lib-common.php,1.321,1.322
dhaun at iowaoutdoors.org
dhaun at iowaoutdoors.org
Thu May 13 14:50:57 EDT 2004
Update of /var/cvs/geeklog-1.3/public_html
In directory www:/tmp/cvs-serv21580/public_html
Modified Files:
lib-common.php
Log Message:
Fixed handling of HTML entities in [code] sections (bug #159),
COM_undoSpecialChars() now also handles (bug #192),
Added {topic_image} variable that can be used in the Topics / Sections block (feature request #152)
Index: lib-common.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/lib-common.php,v
retrieving revision 1.321
retrieving revision 1.322
diff -C2 -d -r1.321 -r1.322
*** lib-common.php 11 May 2004 17:12:56 -0000 1.321
--- lib-common.php 13 May 2004 18:50:55 -0000 1.322
***************
*** 1897,1903 ****
{
global $_CONF, $_TABLES, $_USER, $_GROUPS, $LANG01, $HTTP_SERVER_VARS,
! $page, $newstories;
! $sql = "SELECT tid, topic FROM {$_TABLES['topics']}";
if( $_USER['uid'] > 1 ) {
$tids = DB_getItem( $_TABLES['userindex'], 'tids',
--- 1897,1903 ----
{
global $_CONF, $_TABLES, $_USER, $_GROUPS, $LANG01, $HTTP_SERVER_VARS,
! $_THEME_URL, $page, $newstories;
! $sql = "SELECT tid,topic,imageurl FROM {$_TABLES['topics']}";
if( $_USER['uid'] > 1 ) {
$tids = DB_getItem( $_TABLES['userindex'], 'tids',
***************
*** 1905,1909 ****
if (!empty ($tids)) {
$sql .= " WHERE (tid NOT IN ('" . str_replace( ' ', "','", $tids )
! . "'))" . COM_getPermSQL( 'AND ');
}
else
--- 1905,1909 ----
if (!empty ($tids)) {
$sql .= " WHERE (tid NOT IN ('" . str_replace( ' ', "','", $tids )
! . "'))" . COM_getPermSQL( 'AND' );
}
else
***************
*** 1918,1926 ****
if( $_CONF['sortmethod'] == 'alpha' )
{
! $sql .= " ORDER BY topic ASC";
}
else
{
! $sql .= " ORDER BY sortnum";
}
$result = DB_query( $sql );
--- 1918,1926 ----
if( $_CONF['sortmethod'] == 'alpha' )
{
! $sql .= ' ORDER BY topic ASC';
}
else
{
! $sql .= ' ORDER BY sortnum';
}
$result = DB_query( $sql );
***************
*** 1928,1932 ****
$retval = '';
$sections = new Template( $_CONF['path_layout'] );
! $sections->set_file( array( 'option' => 'topicoption.thtml',
'inactive' => 'topicoption_off.thtml' ));
$sections->set_var( 'site_url', $_CONF['site_url'] );
--- 1928,1932 ----
$retval = '';
$sections = new Template( $_CONF['path_layout'] );
! $sections->set_file( array( 'option' => 'topicoption.thtml',
'inactive' => 'topicoption_off.thtml' ));
$sections->set_var( 'site_url', $_CONF['site_url'] );
***************
*** 1960,1979 ****
}
! if( $_CONF['showstorycount'] ) {
$sql = "SELECT tid, count(*) AS count FROM {$_TABLES['stories']} "
. 'WHERE (draft_flag = 0) AND (date <= NOW()) '
. COM_getPermSQL( 'AND' )
. ' GROUP BY tid';
! $rcount = DB_query($sql);
! while ( $C = DB_fetchArray($rcount) ) {
$storycount[$C['tid']] = $C['count'];
}
}
! if( $_CONF['showsubmissioncount'] ) {
$sql = "SELECT tid, count(*) AS count FROM {$_TABLES['storysubmission']} "
. ' GROUP BY tid';
! $rcount = DB_query($sql);
! while ( $C = DB_fetchArray($rcount) ) {
$submissioncount[$C['tid']] = $C['count'];
}
--- 1960,1983 ----
}
! if( $_CONF['showstorycount'] )
! {
$sql = "SELECT tid, count(*) AS count FROM {$_TABLES['stories']} "
. 'WHERE (draft_flag = 0) AND (date <= NOW()) '
. COM_getPermSQL( 'AND' )
. ' GROUP BY tid';
! $rcount = DB_query( $sql );
! while ( $C = DB_fetchArray( $rcount ))
! {
$storycount[$C['tid']] = $C['count'];
}
}
! if( $_CONF['showsubmissioncount'] )
! {
$sql = "SELECT tid, count(*) AS count FROM {$_TABLES['storysubmission']} "
. ' GROUP BY tid';
! $rcount = DB_query( $sql );
! while ( $C = DB_fetchArray( $rcount ))
! {
$submissioncount[$C['tid']] = $C['count'];
}
***************
*** 1982,1988 ****
while ( $A = DB_fetchArray( $result ) )
{
$sections->set_var( 'option_url', $_CONF['site_url']
. '/index.php?topic=' . $A['tid'] );
! $sections->set_var( 'option_label', stripslashes( $A['topic'] ));
$countstring = '';
--- 1986,1993 ----
while ( $A = DB_fetchArray( $result ) )
{
+ $topicname = stripslashes( $A['topic'] );
$sections->set_var( 'option_url', $_CONF['site_url']
. '/index.php?topic=' . $A['tid'] );
! $sections->set_var( 'option_label', $topicname );
$countstring = '';
***************
*** 2017,2020 ****
--- 2022,2041 ----
$sections->set_var( 'option_count', $countstring );
+ $topicimage = '';
+ if( !empty( $A['imageurl'] ))
+ {
+ if( isset( $_THEME_URL ))
+ {
+ $imagebase = $_THEME_URL;
+ }
+ else
+ {
+ $imagebase = $_CONF['site_url'];
+ }
+ $topicimage = '<img src="' . $imagebase . $A['imageurl'] . '" alt="'
+ . $topicname . '" title="' . $topicname . '">';
+ }
+ $sections->set_var( 'topic_image', $topicimage );
+
if(( $A['tid'] == $topic ) && ( $page == 1 ))
{
***************
*** 3108,3111 ****
--- 3129,3133 ----
function COM_handleCode( $str )
{
+ $str = str_replace( '&', '&', $str );
$str = str_replace( '\\', '\', $str );
$str = str_replace( '<', '<', $str );
***************
*** 3210,3220 ****
function COM_undoSpecialChars( $string )
{
! $string = ereg_replace( '$', '$', $string );
! $string = ereg_replace( '{', '{', $string );
! $string = ereg_replace( '}', '}', $string );
! $string = ereg_replace( '>', '>', $string );
! $string = ereg_replace( '<', '<', $string );
! $string = ereg_replace( '"', "\"", $string );
! $string = ereg_replace( '&', '&', $string );
return( $string );
--- 3232,3243 ----
function COM_undoSpecialChars( $string )
{
! $string = str_replace( '$', '$', $string );
! $string = str_replace( '{', '{', $string );
! $string = str_replace( '}', '}', $string );
! $string = str_replace( '>', '>', $string );
! $string = str_replace( '<', '<', $string );
! $string = str_replace( '"', '"', $string );
! $string = str_replace( ' ', ' ', $string );
! $string = str_replace( '&', '&', $string );
return( $string );
More information about the geeklog-cvs
mailing list