View Single Post
  #4  
Old 09-09-2004, 02:27 AM
Blue Moose Aaron's Avatar
Blue Moose Aaron Blue Moose Aaron is offline
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here is the code used in my portal for the news

PHP Code:
// ######################### PROCESS NEWS ############################
// standard news block
if (($vbindex['options'] & VBI_SHOWNEWS) && !($vbindex['options'] & VBI_VBWAR) && !EXTRA_PAGE && $_REQUEST['action'] != 'shoutbox') {

    
$getnews $DB_site->query("
        ## GET NEWS ##
        SELECT thread.*,thread.iconid AS threadiconid, threadpost.pagetext AS pagetext,
        threadpost.attach AS attachcount,
        "
.iif($vbindex['options'] & VBI_SHOWNEWSAVATAR'avatarpath, NOT ISNULL(avatardata) AS customavatar, user.avatarrevision, customavatar.dateline AS customdateline,')."
        "
.iif(($vbindex['options'] & VBI_SUBNEWS) AND $bbuserinfo['userid'], 'NOT ISNULL(subscribethread.subscribethreadid) AS issubscribed,')."
        IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid
        FROM "
.TABLE_PREFIX."thread AS thread
        LEFT JOIN "
.TABLE_PREFIX."user AS user ON (thread.postuserid = user.userid)
        LEFT JOIN "
.TABLE_PREFIX."post AS threadpost ON (thread.firstpostid = threadpost.postid)
        LEFT JOIN "
.TABLE_PREFIX."deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND type = 'thread')
        "
.iif($vbindex['options'] & VBI_SHOWNEWSAVATAR'
        LEFT JOIN '
.TABLE_PREFIX.'customavatar AS customavatar ON (customavatar.userid = user.userid)
        LEFT JOIN '
.TABLE_PREFIX.'avatar AS avatar ON (avatar.avatarid = user.avatarid)'
        
)."
        "
.iif(($vbindex['options'] & VBI_SUBNEWS) AND $bbuserinfo['userid'], "
        LEFT JOIN "
.TABLE_PREFIX."subscribethread AS subscribethread ON(subscribethread.threadid = thread.threadid AND subscribethread.userid = $bbuserinfo[userid])"
        
)."
        WHERE forumid IN (
$vbindex[newsfid])
        AND deletionlog.primaryid IS NULL
        AND forumid NOT IN ("
.implode(','$limitfids).")
        AND thread.open <> 10
        AND thread.visible = '1'
        
$globalignore
        
$ignorelist
        ORDER BY "
.iif($vbindex['options'] & VBI_STICKYNEWS'thread.sticky DESC,''')." thread.dateline DESC
        LIMIT 
$vbindex[newsposts]");

    while(
$news $DB_site->fetch_array($getnews)) {

          
$news['title'] = fetch_censored_text($news['title']);
          
$news['time'] = vbdate($vboptions['timeformat'], $news['dateline']);
          
$news['date'] = vbdate($vboptions['dateformat'], $news['dateline'], 1);
          
$news['musername'] = fetch_musername($news'displaygroupid''postusername');
          
$news['attachcount'] = vb_number_format($news['attachcount']);
          
$news['replycount'] = vb_number_format($news['replycount']);

          if (
$news['iconid']) {
            
$news['showicon'] = true;
            
$news['threadiconpath'] = &$iconcache["$news[threadiconid]"]['iconpath'];
            
$news['threadicontitle'] = &$iconcache["$news[threadiconid]"]['title'];
        } elseif (!empty(
$vboptions['showdeficon'])) {
            
$news['showicon'] = true;
            
$news['threadiconpath'] = $vboptions['showdeficon'];
            
$news['threadicontitle'] = $vbphrase['default'];
        }

          
// ## CENSOR NEWS AND PARSE vB CODE ##
          
$news['pagetext'] = fetch_censored_text(parse_bbcode(strip_bbcode(fetch_trimmed_title($news['pagetext'], 394), truetrue), $news['forumid'], 1));

        
// ## GET POSTERS AVATAR ##
        
$news['avatar'] = false;
        if (
$vbindex['options'] & VBI_SHOWNEWSAVATAR) {

            if (!isset(
$avatarcache["$news[postuserid]"])) {

                if (
$news['customavatar']) {

                    if (
$vboptions['usefileavatar']) {
                        
$news['avatarurl'] = "$vboptions[avatarurl]/avatar$news[postuserid]_$news[avatarrevision].gif";
                    } else {
                        
$news['avatarurl'] = "$vboptions[bburl]/image".SCRIPT_EXTENSION."?userid=$news[postuserid]&amp;dateline=$news[customdateline]";
                    }

                    
$news['avatar'] = true;
                    
$avatarcache["$news[postuserid]"] = $news['avatarurl'];
                    
DEVDEBUG("cached avatar for userid $news[postuserid]");
                } elseif (!empty(
$news['avatarpath'])) {
                    
$news['avatarurl'] = $vboptions['bburl'].'/'.$news['avatarpath'];
                    
$news['avatar'] = true;
                    
$avatarcache["$news[postuserid]"] = $news['avatarurl'];
                    
DEVDEBUG("cached avatar for userid $news[postuserid]");
                } elseif (!empty(
$vbindex['useravatar'])) { // we have a default av specified
                    
$avatarurl $vbindex['useravatar'];
                    
$avatarcache["$bbuserinfo[userid]"] = $avatarurl;
                    
$news['avatar'] = true;
                }

              } else {
                
$news['avatar'] = true;
                
$news['avatarurl'] = $avatarcache["$news[postuserid]"];
            }
        }

          eval(
"\$home[news] .= \"".fetch_template('vbindex_newsbit')."\";");
    }
      
// memory saving
    
unset($news);
    
$DB_site->free_result($getnews);
}

// if vBwar is enabled then show that instead
if ((($vbindex['options'] & VBI_VBWAR) && !($vbindex['options'] & VBI_SHOWNEWS)) && !EXTRA_PAGE && $_REQUEST['action'] != 'shoutbox') {

    require_once(
'./vnews.php');


Can anyone help me make this work?
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01360 seconds
  • Memory Usage 1,883KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete