x
Toggle Content    Register or Login  -  November 14, 2018, 12:00 am  
Toggle Content Commercial Themes
This is an opportunity for you to preview TCD commercial themes. All themes seen here can be purchased from the store.
Toggle Content User Info

Welcome Anonymous

Toggle Content Navigation
Toggle Content Project Status
Support Forums » DragonflyCMS » Theme Support » Forum Center Block
Please use the forum search before making a post. Your question might have been previously answered.

Forum Center Block
General theme support for all themes not created nor worked on by TCD.
Basically community theme support.

Post new topic   Reply to topic    Forum Index » Theme Support Printer Friendly Page

View previous topic :: View next topic  
Author Message
Newbie


PostPosted: Wed Jan 07, 2009 1:33 pm Reply with quote

Hello
I have a problem, I use TCD_Natural.
The Forum Center Block leuft with each pack themes outer TCD_Natural
can someone help me to adapt so that the runs with TCD_Natural thank

Code:
<?php

########################################################################
#                                                                      #
# Inspired by the Forum Center Block by Made by coldblooded            #
# http://www.hellhole.org                                              #
#                                                                      #
# Edited by William Wickings http://www.amateur-online.net             #
#                                                                      #
# Ported to CPGNuke by emanoyhl (aka masterbeta) - 8/24/04             #
#                                                                      #
########################################################################
#                                                                      #
# Completely Rewritten for CPG-Nuke 9.X Dragonfly (TM)                 #
# http://dragonflycms.org/                                             #
#                                                                      #
# by Daimos                                                            #
# http://www.iMeshChat.net/  Daimos @ online.ms IRC: Daimos- @ DAL.net    #
# May 3rd 2005                                                         #
#                                                                      #
# Version:     1.4.0                                                   #
# Last Update: May 3rd 2005                                            #
#                                                                      #
# This program is free software. You can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License.       #
# Please notify the author of any changes you make.                    #
#                                                                      #
# Bug report or suggest:  Daimos @ online.ms                              #
########################################################################

if (!defined('CPG_NUKE')) { exit; }

global $prefix, $user_prefix, $db, $lang, $MAIN_CFG;
get_lang('forums');

if (!is_active('Forums')) {
	$content = 'ERROR';
	return trigger_error('Forums module is inactive. Please activate the Forums in order to use this block.', E_USER_WARNING);
}

// Configuration (Options: 1 = YES, 0 = NO)

// Hide posts from forums with restricted access for all users. If this is disabled, group memberships
// or admin status are used to display/ hide posts
$Hide_ViewReadOnly = 1;

// Change this to the number of topics you would like to be displayed
$LastNewTopics  = 5;

// Show date and time of the last post
$ShowDate = 1;
$ShowTime = 1;

// Show FORUM, REPLIES, VIEWS, TOPIC AUTHOR, ADMIN (01 = Topic Author, 02 = Last Poster, IconIP = Admin Button), LAST POSTER,
// LAST POSTER'S IP, FORUM LINKS, FORUM STATS, TOP 5 POSTERS + AVATARS, REPLY BUTTON (IconReply = Reply Button)
$ShowForum = 1;
$ShowReplies = 1;
$ShowViews = 1;
$ShowAuthor = 1;
$ShowAdmin01 = 1;
$ShowAdmin02 = 1;
$IconIP = "/themes/TCD_Natural/images/forums/icon_ip.gif";
$ShowLastPoster = 1;
$ShowIP = 1;
$ShowForumLinks = 1;
$ShowForumStats = 1;
$ShowTopPosters = 1;
$ShowTopPostersAvatar = 1;
$ShowReplyButton = 1;
$IconReply = "/themes/TCD_Natural/images/forums/topic_move.gif";

// Show a short preview of the post in an info box (mouse over topic title)
$ShowPreview = 1;

// Show topic icons an icon to display if no topic icon exists or topic icons are disabled
$ShowTopicIcon = 1;
$IconNoIcon = "/themes/TCD_Natural/images/forums/folder_new.gif";

// Show attachment icon (taken from your configuration) and enable attachment link
$ShowAttachment = 1;
$ShowAttachmentLink = 1;

// End of Configuration

list($attach_icon) = $db->sql_fetchrow($db->sql_query('SELECT config_value FROM '.$prefix.'_bbattachments_config where config_name="topic_icon"'));

$access = ' AND f.auth_view=0';

if ($Hide_ViewReadOnly == 0) {
    if (can_admin('forums')) {
        $access = '';
    } else if (is_user() && count($userinfo['_mem_of_groups'])) {
	    foreach ($userinfo['_mem_of_groups'] as $id => $name) {
		    $groups[] = $id;
	    }
        $result01 = $db->sql_query("SELECT forum_id FROM ".$prefix."_bbauth_access WHERE group_id IN (".implode(',', $groups).") AND (auth_mod = 1 OR auth_view = 1) GROUP BY forum_id", false, __FILE__, '', true);
     	while ($row = $db->sql_fetchrow($result01)) {
		    $forums[] = $row[0];
	    }
    	if (count($forums)) {
		$access = ' AND (f.auth_view=0 OR f.forum_id IN ('.implode(',', $forums).'))';
	    }
    }
}

$result00 = $db->sql_query('SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_poster, t.topic_views, t.topic_replies, t.topic_type, 
t.topic_last_post_id, t.topic_first_post_id, t.topic_moved_id, t.topic_attachment, t.icon_id, 
f.forum_id, f.forum_name, 
u.user_id, u.username, u.user_avatar, v.user_id, v.username, i.icon_id, i.icon_url, a.attach_id, b.attach_id, 
p.poster_id, p.poster_ip, p.post_attachment, s.post_id, s.post_text, FROM_UNIXTIME(p.post_time,"%m/%d/%y") AS post_date, FROM_UNIXTIME(p.post_time,"%r") AS post_time 
FROM '.$prefix.'_bbtopics t, '.$prefix.'_bbforums f LEFT JOIN '.$prefix.'_bbposts p ON (p.post_id = t.topic_last_post_id) 
LEFT JOIN '.$user_prefix.'_users u ON (u.user_id = p.poster_id) LEFT JOIN '.$user_prefix.'_users v ON (v.user_id=t.topic_poster) 
LEFT JOIN '.$prefix.'_bbtopic_icons i ON (i.icon_id = t.icon_id) LEFT JOIN '.$prefix.'_bbattachments a ON (a.post_id=t.topic_first_post_id) 
LEFT JOIN '.$prefix.'_bbposts_text s ON (s.post_id=t.topic_last_post_id) 
LEFT JOIN '.$prefix.'_bbattachments b ON (b.post_id=t.topic_last_post_id) WHERE t.forum_id=f.forum_id '.$access.' 
ORDER BY t.topic_last_post_id DESC LIMIT '.$LastNewTopics.'', false, __FILE__, '');

list($Total_Topics, $Total_Topic_Views, $Total_Topic_Replies) = $db->sql_fetchrow($db ->sql_query('SELECT count(*), sum(topic_views), sum(topic_replies) FROM '.$prefix.'_bbtopics'));
list($Total_Posts) = $db->sql_fetchrow($db ->sql_query('SELECT count(*) FROM '.$prefix.'_bbposts'));

$viewlast = '';
$content = '';

while (list($topic_id, $topic_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_type, $topic_last_post_id, $topic_first_post_id, $topic_moved_id, $topic_attachment, $icon_id01, $forum_id, $forum_name, $pposter_id, $pposter_name, $pposter_avatar, $tposter_id, $tposter_name, $icon_id02, $icon_url, $attach_id01, $attach_id02, $poster_id, $poster_ip, $post_attachment, $post_id, $post_text, $post_date, $post_time) = $db->sql_fetchrow($result00)) {
    if ($ShowPreview == 1) {
        $ppost_text = preg_replace('/[\n\r]/is', '', $post_text); 
		$ppost_text = preg_replace('/\b&[a-z]+;\b/', '', $ppost_text); 
		$ppost_text = preg_replace('/\b[a-z0-9]+:\/\/[a-z0-9\.\-]+(\/[a-z0-9\?\.%_\-\+=&\/]+)?/', '', $ppost_text); 
	    $ppost_text = preg_replace('/\[img:[a-z0-9]{10,}\].*?\[\/img:[a-z0-9]{10,}\]/', ' ', $ppost_text); 
		$ppost_text = preg_replace('/\[\/?url(=.*?)?\]/', '', $ppost_text);
		$ppost_text = preg_replace('/\[\/?[a-z\*=\+\-]+(\:?[0-9a-z]+)?:[a-z0-9]{10,}(\:[a-z0-9]+)?=?.*?\]/', '', $ppost_text);
		$ppost_text = preg_replace('/\[[a-z0-9=\040]{0,}\]/', '', $ppost_text);
		$ppost_text = preg_replace('/\[\/[a-z0-9=\040]{0,}\]/', '', $ppost_text);
		$ppost_text = addslashes($ppost_text);
        $ppost_text = substr($ppost_text, 0, 150);
        $ppost_text = set_smilies($ppost_text);
                
        $content .= '<script type="text/javascript" language="JavaScript">
        <!--'."
        maketip('pposter".$topic_last_post_id."','".$lang['Preview'].": ".$topic_title."','".$pposter_name.": ".$ppost_text." ... ');
        ".'// -->
         </script>';
        $ppreview = ''.show_tooltip('pposter'.$topic_last_post_id.'')    .'';
    } else {
       $ppreview = '';
    }
    
    if($ShowDate == 1) $post_date = '<br>'.$post_date.''; else $post_date = ""; if($ShowTime == 1) $post_time = '<br>'.$post_time.''; else $post_time = "";
    if($ShowTopicIcon == 1 && $icon_id02 != 0) $icon_url = '<img src="'.$icon_url.'" border="0" alt="" title="'.$lang['Topic'].':&nbsp;'.$tposter_name.'"';
    else $icon_url = '<img src="'.$IconNoIcon.'" border="0" alt="" title="'.$lang['Topic'].':&nbsp;'.$tposter_name.'"';
      
    if( $ShowAttachment == 1 && $ShowAttachmentLink == 1 && $topic_attachment == 1 ) {
        if ( is_string($attach_id01) ) $attach_icon01 = '<a href="'.getlink('Forums&amp;file=download&amp;id='.$attach_id01.'').'"><img src="'.$attach_icon.'" alt="" title="'.$lang['Attachment'].'" border="0" /></a>&nbsp;';
        if ( is_string($attach_id02) ) $attach_icon01 = '<a href="'.getlink('Forums&amp;file=download&amp;id='.$attach_id02.'').'"><img src="'.$attach_icon.'" alt="" title="'.$lang['Attachment'].'" border="0" /></a>&nbsp;';
        if ( !is_string($attach_id01) && !is_string($attach_id02) ) $attach_icon01 = "";
    }
    if ( $ShowAttachment == 1 && $ShowAttachmentLink == 0 && $topic_attachment == 1 ) {
        $attach_icon01 = '<img src="'.$attach_icon.'" alt="" title="'.$lang['Attachment'].'" border="0" /></a>&nbsp;';
    }
    if ( $ShowAttachment == 0 && $ShowAttachmentLink == 0 || $topic_attachment == 0 ) $attach_icon01 = "";

    $pposter_ip =  decode_ip($poster_ip);
    if($ShowIP == 1 && is_admin()) $pposter_ip = '<br>[ <i><a href="'.getlink("Forums&amp;file=modcp&amp;mode=ip&amp;p=$topic_last_post_id&amp;t=$topic_id").'">'.$pposter_ip.'</a></i> ]';
    else $pposter_ip = '';

    $viewlast .= '<tr>
    <td class="row1" align="left" height="28" nowrap="nowrap"><a href="'.getlink("Forums&file=viewtopic&amp;t=$topic_id").'">'.$icon_url.'/></a></td>
    <td class="row1" width="100%"><span class="postdetails">'.$attach_icon01.'<a '.$ppreview.' href="'.getlink("Forums&amp;file=viewtopic&amp;p=$topic_last_post_id#$topic_last_post_id").'" title="'.$lang['New_post'].': '.$pposter_name.'">'.$topic_title.'</a></span></td>';
    if($ShowForum == 1) $viewlast .= '<td class="row2" align="center" nowrap="nowrap"><span class="postdetails"><a href="'.getlink('Forums&file=viewforum&amp;f='.$forum_id.'').'" title="'.$lang['Forum'].': '.$forum_name.'">'.$forum_name.'</a></span></td>';
    if($ShowReplies == 1) $viewlast .= '<td class="row2" align="center"><span class="postdetails">'.$topic_replies.'</span></td>';
    if($ShowAuthor == 1) $viewlast .= '<td class="row3" align="center"><span class="postdetails"><a href="'.getlink("Your_Account&amp;profile=$topic_poster").'" title="'.$tposter_name.'">'.$tposter_name.'</a></span></td>';
    if($ShowAdmin01 == 1 && $ShowAuthor == 1 && is_admin()) $viewlast .= '<td class="row1" align="center" height="28" nowrap="nowrap"><a href="'.getlink("Forums&amp;file=modcp&amp;mode=ip&amp;p=$topic_first_post_id&amp;t=$topic_id").'"><img src="'.$IconIP.'" alt="" title="'.$lang['Admin'].'" border="0" /></a></td>';
    if($ShowViews == 1) $viewlast .= '<td class="row2" align="center"><span class="postdetails">'.$topic_views.'</span></td>';
    if($ShowLastPoster == 1) $viewlast .= '<td class="row3" align="center" nowrap="nowrap"><span class="postdetails"><a href="'.getlink("Your_Account&amp;profile=$pposter_id").'" title="'.$pposter_name.'">'.$pposter_name.'</a>'.$pposter_ip.$post_date.$post_time.'</span></td>';
    if($ShowAdmin02 == 1 && $ShowLastPoster == 1 && is_admin()) $viewlast .= '<td class="row1" align="center" height="28" nowrap="nowrap"><a href="'.getlink("Forums&amp;file=modcp&amp;mode=ip&amp;p=$topic_last_post_id&amp;t=$topic_id").'"><img src="'.$IconIP.'" alt="" title="'.$lang['Admin'].'" border="0" /></a></td>';
    if($ShowReplyButton == 1) $viewlast .= '<td class="row1" align="center" height="28" nowrap="nowrap"><a href="'.getlink("Forums&amp;file=posting&amp;mode=reply&amp;t=$topic_id").'"><img src="'.$IconReply.'" alt="" title="'.$lang['Reply'].'" border="0" /></a></td>';
    $viewlast .= '</tr>';
	}

$content .= '
    <table border="0" cellpadding="0" cellspacing="0" width="100%" class="forumline">
    <tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr><td><table width="100%" border="0" cellpadding="1" cellspacing="1">
    <tr><th height="28" colspan="2" align="center" class="thcornerl" nowrap="nowrap">&nbsp;'.$lang['Topics'].'&nbsp;</th>';
    if($ShowForum == 1) $content .= '<th width="100" align="center" class="thtop">&nbsp;'.$lang['Forum'].'&nbsp;</th>';
    if($ShowReplies == 1) $content .= '<th width="50" align="center" class="thtop" nowrap="nowrap">&nbsp;'.$lang['Replies'].'&nbsp;</th>';
    if($ShowAuthor == 1) $content .= '<th width="100" align="center" class="thtop" nowrap="nowrap">&nbsp;'.$lang['Author'].'&nbsp;</th>';
    if($ShowAdmin01 == 1 && $ShowAuthor == 1 && is_admin()) $content .= '<th align="center" class="thcornerl" nowrap="nowrap"><img src="'.$IconIP.'" alt="IP Icon" title="'.$lang['Admin'].'" border="0" /></th>';
    if($ShowViews == 1 ) $content .= '<th width="50" align="center" class="thtop" nowrap="nowrap">&nbsp;'.$lang['Views'].'&nbsp;</th>';
    if($ShowLastPoster == 1) $content .= '<th align="center" class="thcornerr" nowrap="nowrap">&nbsp;'.$lang['Last_Post'].'&nbsp;</th>';
    if($ShowAdmin02 == 1 && $ShowLastPoster == 1 && is_admin()) $content .= '<th align="center" class="thcornerl" nowrap="nowrap"><img src="'.$IconIP.'" alt="" title="'.$lang['Admin'].'" border="0" /></th>';
    if($ShowReplyButton == 1) $content .= '<th align="center" class="thcornerl" nowrap="nowrap"><img src="'.$IconReply.'" alt="" title="'.$lang['Reply'].'" border="0" /></th>';
    $content .= '</tr>';
    $content .= $viewlast;
    $content .= '<tr><td height="10" colspan="10" align="center" class="spaceRow"></td></tr>';
    if($ShowForumLinks == 1) $content .= '<tr><td class="row1" colspan="10" align="center"><a href="'.getlink('Forums').'" title="'.$lang['Main_index'].'">'.$lang['Main_index'].'</a>&nbsp;|&nbsp;<a href="'.getlink('Forums&amp;file=search&amp;search_id=newposts').'" title="'.$lang['Search_new'].'">'.$lang['Search_new'].'</a>&nbsp;|&nbsp;<a href="'.getlink('Forums&amp;file=search&amp;search_id=unanswered').'" title="'.$lang['Search_unanswered'].'">'.$lang['Search_unanswered'].'</a>&nbsp;|&nbsp;<a href="'.getlink('Forums').'" title="'.$lang['Search'].'">'.$lang['Search'].'</a></td></tr>';
    if($ShowForumStats == 1) $content .= '<tr><td class="row1" colspan="10" align="center">[&nbsp;'.$lang['Topics'].':&nbsp;'.$Total_Topics.'&nbsp;|&nbsp;'.$lang['Posts'].':&nbsp;'.$Total_Posts.'&nbsp;|&nbsp;'.$lang['Views'].':&nbsp;'.$Total_Topic_Views.'&nbsp;|&nbsp;'.$lang['Replies'].':&nbsp;'.$Total_Topic_Replies.'&nbsp;]&nbsp;</td></tr>';
    $content .= '</table></td></tr></table></td></tr></table>';

if($ShowTopPosters == 1) {

 $content .= '<br/><table border="0" cellpadding="0" cellspacing="0" width="100%" class="forumline">
             <tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0">
             <tr><td><table width="100%" border="0" cellpadding="1" cellspacing="1">
             <tr>';
 $content01 = '<tr>';

 $result=$db->sql_query("SELECT user_id, username, user_posts, user_avatar FROM ".$user_prefix."_users ORDER BY user_posts DESC LIMIT 0,5");
 while(list($user_id, $username, $user_posts, $avatar) = $db->sql_fetchrow($result)) {
         if ($ShowTopPostersAvatar == 1) {
             if (eregi("http://", $avatar)) {
                 $content .= '<td align="center" class="row2"><a href="'.getlink('Private_Messages&amp;file=index&amp;mode=post&amp;u='.$user_id.'').'"><img src="'.$avatar.'" border ="0" width="32" height="32" alt="PM" title="'.$lang['Private_Message'].': '.$username.'"/></a><br />'.$lang['Posts'].': <a href="'.getlink('Forums&amp;file=search&amp;search_author='.$username.'').'" title="'.$lang['Posts'].': '.$username.'">'.$user_posts.'</a></td>';
             } elseif (eregi("/", $avatar)) {
                 $content .= '<td align="center" class="row2"><a href="'.getlink('Private_Messages&amp;file=index&amp;mode=post&amp;u='.$user_id.'').'"><img src="'.$MAIN_CFG['avatar']['gallery_path'].'/'.$avatar.'" border ="0" width="32" height="32" alt="PM" title="'.$lang['Private_Message'].': '.$username.'"/></a><br />'.$lang['Posts'].': <a href="'.getlink('Forums&amp;file=search&amp;search_author='.$username.'').'" title="'.$lang['Posts'].': '.$username.'">'.$user_posts.'</a></td>';
             } elseif (!$avatar) {
                 $content .= '<td align="center" class="row2"><a href="'.getlink('Private_Messages&amp;file=index&amp;mode=post&amp;u='.$user_id.'').'"><img src="'.$MAIN_CFG['avatar']['gallery_path'].'/blank.gif" border ="0" width="32" height="32" alt="PM" title="'.$lang['Private_Message'].': '.$username.'"/></a><br />'.$lang['Posts'].': <a href="'.getlink('Forums&amp;file=search&amp;search_author='.$username.'').'" title="'.$lang['Posts'].': '.$username.'">'.$user_posts.'</a></td>';
             } else {
              $content .= '<td align="center" class="row2"><a href="'.getlink('Private_Messages&amp;file=index&amp;mode=post&amp;u='.$user_id.'').'" target="_blank"><img src="'.$MAIN_CFG['avatar']['path'].'/'.$avatar.'" border ="0" width="32" alt="PM" height="32" title="'.$lang['Private_Message'].': '.$username.'"/></a><br />'.$lang['Posts'].': <a href="'.getlink('Forums&amp;file=search&amp;search_author='.$username.'').'" title="'.$lang['Posts'].': '.$username.'">'.$user_posts.'</a></td>';
             }
             $content01 .= '<td width="20%" colspan="1" align="center" class="spaceRow"><a href="'.getlink('Forums&amp;file=profile&amp;mode=viewprofile&amp;u='.$user_id.'').'" title="'.$lang['Profile'].': '.$username.'"><b>'.$username.'</b></a></td>';
             } else {
			 $content .= '<td align="center" class="row2">'.$lang['Posts'].': <a href="'.getlink('Forums&amp;file=search&amp;search_author='.$username.'').'" title="'.$lang['Posts'].': '.$username.'">'.$user_posts.'</a></td>';
             $content01 .= '<td width="20%" colspan="1" align="center" class="spaceRow"><a href="'.getlink('Forums&amp;file=profile&amp;mode=viewprofile&amp;u='.$user_id.'').'" title="'.$lang['Profile'].': '.$username.'"><b>'.$username.'</b></a></td>';
             }
 }
     $content01 .= '</tr>';
     $content .= '</tr>';
     $content .= $content01;
     $content .= '</table></td></tr></table></td></tr></table>';
}
?>


Back to top
View user's profile
  Page 1 of 1All times are GMT - 5 Hours

Post new topic   Reply to topic    Forum Index » Theme Support Printer Friendly Page

  
  
  
 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


RSS-News
RSS-Downloads
RSS-Forums
RSS-KnowledgeBase
Valid CSS!
Valid HTML 4.01!

Site Search | Support | Contact | Payments | Link to Us
All TCD logos and trademarks in this site are property of TreasureCoastDesigns.com
Interactive software released under GNU GPL, Code Credits, Privacy Policy
TCD_Natural © T.C.D.