Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 08-16-2005, 09:09 AM
AraServ AraServ is offline
 
Join Date: Apr 2004
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Using include() in Powered by vBulletin page!

i made this code depending on index.php from vBulletin ..


the code

PHP Code:
<?php


// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS'1);
define('THIS_SCRIPT''t7');

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array('holiday');

// get special data templates from the datastore
$specialtemplates = array(
    
'userstats',
    
'birthdaycache',
    
'maxloggedin',
    
'iconcache',
    
'eventcache',
    
'mailqueue'
);

// pre-cache templates used by all actions
$globaltemplates = array(
    
'FORUMHOME',
    
'forumhome_event',

    
'forumhome_loggedinuser',
    
'forumhome_moderator',
    
'forumhome_pmloggedin'
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once(
'./includes/functions_bigthree.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

// get permissions to view forumhome
if (!($permissions['forumpermissions'] & CANVIEW))
{
    
print_no_permission();
}




;


$path "/home/****/domains/*****/public_html/updn/"
include ( 
$path "form.php" );


// ### TODAY'S BIRTHDAYS #################################################
if ($vboptions['showbirthdays'])
{
    
$birthdaystore unserialize($datastore['birthdaycache']);
    if (!
is_array($birthdaystore) OR ($today != $birthdaystore['day1'] AND $today != $birthdaystore['day2']))
    {
        
// Need to update!
        
require_once('./includes/functions_databuild.php');
        
$birthdaystore build_birthdays();
        
DEVDEBUG('Updated Birthdays');
    }
    switch(
$today)
    {
        case 
$birthdaystore['day1']:
            
$birthdays $birthdaystore['users1'];
            break;

        case 
$birthdaystore['day2'];
            
$birthdays $birthdaystore['users2'];
            break;
    }
    
// memory saving
    
unset($birthdaystore);

    
$show['birthdays'] = iif ($birthdaystruefalse);
}
else
{
    
$show['birthdays'] = false;
}

// ### TODAY'S EVENTS #################################################
if ($vboptions['showevents'])
{
    require_once(
'./includes/functions_calendar.php');

    
$future gmdate('n-j-Y' TIMENOW 43200 + (86400 * ($vboptions['showevents'] - 1)));
    
$eventstore unserialize($datastore['eventcache']);

    if (!
is_array($eventstore) OR $future != $eventstore['date'])
    {
        
// Need to update!
        
require_once('./includes/functions_databuild.php');
        
$eventstore build_events();
        
DEVDEBUG('Updated Events');
    }

    unset(
$eventstore['date']);
    
$events = array();
    
$eventcount 0;
    foreach (
$eventstore AS $eventid => $eventinfo)
    {
        
$eventstore["$index"]['dateline_from_user'] = $eventinfo['dateline_from_user'] = $eventinfo['dateline_from'] + $bbuserinfo['timezoneoffset'] * 3600;
        
$eventstore["$index"]['dateline_to_user'] = $eventinfo['dateline_to_user'] = $eventinfo['dateline_to'] + $bbuserinfo['timezoneoffset'] * 3600;
        
$gettime TIMENOW $vboptions['hourdiff'];
        
$iterations 0;
        
$todaydate getdate($gettime);

        if (
$bbuserinfo['calendarpermissions']["$eventinfo[calendarid]"] & CANVIEWCALENDAR OR ($eventinfo['holidayid'] AND $vboptions['showholidays']))
        {
            if (
$eventinfo['userid'] == $bbuserinfo['userid'] OR $bbuserinfo['calendarpermissions']["$eventinfo[calendarid]"] & CANVIEWOTHERSEVENT OR ($eventinfo['holidayid'] AND $vboptions['showholidays']))
            {
                if (!
$eventinfo['recurring'] AND !$vboptions['showeventtype'] AND !$eventinfo['singleday'] AND cache_event_info($eventinfo$todaydate['mon'], $todaydate['mday'], $todaydate['year']))
                {
                    
$events["$eventid"][] = true;
                }
                else
                {
                    while (
$iterations $vboptions['showevents'])
                    {
                        
$addcache false;

                        
$todaydate getdate($gettime);
                        if (
$eventinfo['holidayid'] AND $eventinfo['recurring'] == 6)
                        {
                            if (
$eventinfo['recuroption'] == "$todaydate[mon]|$todaydate[mday]")
                            {
                                
$addcache true;
                            }
                        }
                        else if (
cache_event_info($eventinfo$todaydate['mon'], $todaydate['mday'], $todaydate['year']))
                        {
                            
$addcache true;
                        }

                        if (
$addcache)
                        {
                            if (!
$vboptions['showeventtype'])
                            {
                                
$events["$eventid"][] = $gettime;
                            }
                            else
                            {
                                
$events["$gettime"][] = $eventid;
                            }
                            
$eventcount++;
                        }

                        
$iterations++;
                        
$gettime += 86400;
                    }
                }
            }
        }
    }

    if (!empty(
$events))
    {
        
ksort($eventsSORT_NUMERIC);
        foreach(
$events AS $index => $value)
        {
            
$pastevent 0;
            
$pastcount 0;

            
$eventinfo $eventstore["$index"];

            
$comma $eventdates $daysevents '';
            if (!
$vboptions['showeventtype'])
            {    
// Group by Event // $index = $eventid
                
if (empty($eventinfo['recurring']) AND empty($eventinfo['singleday']))
                {    
// ranged event -- show it from its real start and real end date
                    
$eventdates construct_phrase($vbphrase['event_x_to_y'], vbdate($vboptions['dateformat'], $eventinfo['dateline_from_user'], falsetrue), vbdate($vboptions['dateformat'], $eventinfo['dateline_to_user'], falsetrue));
                    
$day vbdate('Y-n-j'$eventinfo['dateline_from_user'], falsefalse);
                }
                else
                {
                    unset(
$day);
                    foreach(
$value AS $key => $dateline)
                    {
                        if ((
$dateline 86400) == $pastevent AND !$eventinfo['holidayid'])
                        {
                            
$pastevent $dateline;
                            
$pastcount++;
                            continue;
                        }
                        else
                        {
                            if (
$pastcount)
                            {
                                
$eventdates construct_phrase($vbphrase['event_x_to_y'], $eventdatesvbdate($vboptions['dateformat'], $pasteventfalsetruefalse));
                            }
                            
$pastcount 0;
                            
$pastevent $dateline;
                        }
                        if (!
$day)
                        {
                            
$day vbdate('Y-n-j'$datelinefalsefalsefalse);
                        }
                        
$eventdates .= $comma vbdate($vboptions['dateformat'], $datelinefalsetruefalse);
                        
$comma ', ';
                    }
                    if (
$pastcount)
                    {
                        
$eventdates construct_phrase($vbphrase['event_x_to_y'], $eventdatesvbdate($vboptions['dateformat'], $pasteventfalsetruefalse));
                    }
                }

                if (
$eventinfo['holidayid'])
                {
                    
$callink "<a href=\"calendar.php?$session[sessionurl]do=getinfo&amp;day=$day\">" $vbphrase['holiday_title_' $eventinfo['varname']] . "</a>";
                }
                else
                {
                    
$callink "<a href=\"calendar.php?$session[sessionurl]do=getinfo&amp;day=$day&amp;e=$eventinfo[eventid]&amp;c=$eventinfo[calendarid]\">$eventinfo[title]</a>";
                }
            }
            else
            {    
// Group by Date
                
$eventdate vbdate($vboptions['dateformat'], $indexfalsetruefalse);
                
$day vbdate('Y-n-j'$indexfalsefalse);
                foreach(
$value AS $key => $eventid)
                {
                    
$eventinfo $eventstore["$eventid"];
                    if (
$eventinfo['holidayid'])
                    {
                        
$daysevents .= $comma "<a href=\"calendar.php?$session[sessionurl]do=getinfo&amp;day=$day\">" $vbphrase['holiday_title_' $eventinfo['varname']] . "</a>";
                    }
                    else
                    {
                        
$daysevents .= $comma "<a href=\"calendar.php?$session[sessionurl]do=getinfo&amp;day=$day&amp;e=$eventinfo[eventid]&amp;c=$eventinfo[calendarid]\">$eventinfo[title]</a>";
                    }
                    
$comma ', ';
                }
            }
            eval(
'$upcomingevents .= "' fetch_template('forumhome_event') . '";');
        }
        
// memory saving
        
unset($events$eventstore);
    }
    
$show['upcomingevents'] = iif ($upcomingeventstruefalse);
    
$show['todaysevents'] = iif ($vboptions['showevents'] == 1truefalse);
}
else
{
    
$show['upcomingevents'] = false;
}



// ############### Paul M - Who has visited today v2.31 #################

$tnow date('YmdHis',TIMENOW $vboptions['hourdiff']); 
$cutoff TIMENOW - (substr($tnow,8,2)*3600 substr($tnow,10,2)*60 substr($tnow,12,2)); 
//$cutoff = TIMENOW - 86400 ;  // ## Uncomment this line if you want a rolling 24 hours display ## //
$todaysusers $DB_site->query("SELECT userid, lastactivity, options, username, user.usergroupid, displaygroupid, 
groupa.opentag as opentaga, groupa.closetag as closetaga, groupb.opentag as opentagb, groupb.closetag as closetagb
FROM " 
TABLE_PREFIX "user as user
LEFT JOIN " 
TABLE_PREFIX "usergroup as groupa ON(user.usergroupid = groupa.usergroupid)
LEFT JOIN " 
TABLE_PREFIX "usergroup as groupb ON(user.displaygroupid = groupb.usergroupid)
WHERE lastactivity > " 
.$cutoff" ORDER BY username" ); 

$totaltoday 0;
unset (
$whotoday);
while (
$today $DB_site->fetch_array($todaysusers))
{
    
$totaltoday += 1;
    
$today['opentag'] = $today['opentaga'] ;
    
$today['closetag'] = $today['closetaga'] ;
    if (
$today['displaygroupid']) 
    {
        
$today['opentag'] = $today['opentagb'] ;
        
$today['closetag'] = $today['closetagb'] ;
    }
    
$today[visible] = ;
    if (
$today['options'] & $_USEROPTIONS['invisible']) 
    {
        
$today['visible'] = ;
        if ((
$permissions['genericpermissions'] & CANSEEHIDDEN) OR $today['userid'] == $bbuserinfo['userid'])
        {
            
$today['visible'] = ;
        }
    }
    if (
$today['visible']) 
    {
           
$wrdate vbdate($vboptions['timeformat'], $today['lastactivity']);
        
$whotoday .= "<a href='member.php?u=$today[userid]' title='$wrdate' >";
        if (
$today['visible'] == 2
        {
            
$whotoday .= $today['opentag'].$today['username'].$today['closetag']."</a>*, ";
        }
        else 
        {
            
$whotoday .= $today['opentag'].$today['username'].$today['closetag']."</a>, ";
        }
    }
}
if (
$whotoday)
{
    
$whotoday substr($whotoday0strlen($whotoday)-2);
}

// ############# End of Who has visited today ###############





// ### LOGGED IN USERS #################################################
$activeusers '';
if (
$vboptions['displayloggedin'])
{
    
$datecut TIMENOW $vboptions['cookietimeout'];
    
$numbervisible 0;
    
$numberregistered 0;
    
$numberguest 0;

    
$forumusers $DB_site->query("
        SELECT
            user.username, (user.options & 
$_USEROPTIONS[invisible]) AS invisible, user.usergroupid,
            session.userid, session.inforum, session.lastactivity,
            IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
        FROM " 
TABLE_PREFIX "session AS session
        LEFT JOIN " 
TABLE_PREFIX "user AS user ON(user.userid = session.userid)
        WHERE session.lastactivity > 
$datecut
        " 
iif($vboptions['displayloggedin'] == 1"ORDER BY username ASC") . "
    "
);

    if (
$bbuserinfo['userid'])
    {
        
// fakes the user being online for an initial page view of index.php
        
$bbuserinfo['joingroupid'] = iif($bbuserinfo['displaygroupid'], $bbuserinfo['displaygroupid'], $bbuserinfo['usergroupid']);
        
$userinfos = array
        (
            
$bbuserinfo['userid'] => array
            (
                
'userid' => $bbuserinfo['userid'],
                
'username' => $bbuserinfo['username'],
                
'invisible' => $bbuserinfo['invisible'],
                
'inforum' => 0,
                
'lastactivity' => TIMENOW,
                
'usergroupid' => $bbuserinfo['usergroupid'],
                
'displaygroupid' => $bbuserinfo['displaygroupid'],
            )
        );
    }
    else
    {
        
$userinfos = array();
    }
    
$inforum = array();

    while (
$loggedin $DB_site->fetch_array($forumusers))
    {
        
$userid $loggedin['userid'];
        if (!
$userid)
        {    
// Guest
            
$numberguest++;
            
$inforum["$loggedin[inforum]"]++;
        }
        else if (empty(
$userinfos["$userid"]) OR ($userinfos["$userid"]['lastactivity'] < $loggedin['lastactivity']))
        {
            
$userinfos["$userid"] = $loggedin;
        }
    }

    foreach(
$userinfos AS $userid => $loggedin)
    {
        
$numberregistered++;
        if (
$userid != $bbuserinfo['userid'])
        {
            
$inforum["$loggedin[inforum]"]++;
        }
        
$loggedin['musername'] = fetch_musername($loggedin);

        if (
fetch_online_status($loggedin))
        {
            
$numbervisible++;
            eval(
'$activeusers .= ", ' fetch_template('forumhome_loggedinuser') . '";');
        }
    }

    
// memory saving
    
unset($userinfos$loggedin);

    
$activeusers substr($activeusers 2); // get rid of initial comma

    
$DB_site->free_result($loggedins);

    
$totalonline $numberregistered $numberguest;
    
$numberinvisible $numberregistered $numbervisible;

    
// ### MAX LOGGEDIN USERS ################################
    
$maxusers unserialize($datastore['maxloggedin']);
    if (
intval($maxusers['maxonline']) <= $totalonline)
    {
        
$maxusers['maxonline'] = $totalonline;
        
$maxusers['maxonlinedate'] = TIMENOW;
        
build_datastore('maxloggedin'serialize($maxusers));
    }

    
$recordusers $maxusers['maxonline'];
    
$recorddate vbdate($vboptions['dateformat'], $maxusers['maxonlinedate'], true);
    
$recordtime vbdate($vboptions['timeformat'], $maxusers['maxonlinedate']);

    
$show['loggedinusers'] = true;
}
else
{
    
$show['loggedinusers'] = false;
}

// ### GET FORUMS & MODERATOR iCACHES ########################


// ### BOARD STATISTICS #################################################

// get total threads & posts from the forumcache
$totalthreads 0;
$totalposts 0;
if (
is_array($forumcache))
{
    foreach (
$forumcache AS $forum)
    {
        
$totalthreads += $forum['threadcount'];
        
$totalposts += $forum['replycount'];
    }
}
$totalthreads vb_number_format($totalthreads);
$totalposts vb_number_format($totalposts);

// get total members and newest member from template
$userstats unserialize($datastore['userstats']);
$numbermembers vb_number_format($userstats['numbermembers']);
$newusername $userstats['newusername'];
$newuserid $userstats['newuserid'];

// ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTA HERE... ###
$pagetitle "up"
//$HTML = include ( $path . "form.php" ); // PIECED TOGETHER IN SCRIPT 
$navbits = array();

$navbits construct_navbits($navbits);
eval(
'$navbar = "' fetch_template('navbar') . '";');
eval(
'print_output("' ''  fetch_template('t7') . '");');
?>
it is working fine BUT ..

THE Scripts THAT I CALL BY include COMING IN THE UPPER OF PAGE !!

then the vBulletin Powered page come after !!

i want print include function in the plase of $forumbit ( in middle ) !!


any help please ?!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:22 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04499 seconds
  • Memory Usage 2,381KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)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
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete