All pastes #741466 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-10-18 18:46 UTC
rendered paste body
<?php

// wbb imports
require_once(WBB_DIR.'lib/data/board/BoardList.class.php');

// wcf imports
require_once(WCF_DIR.'lib/page/AbstractPage.class.php');


// Johns Extra Stuff
session_start();


if(!isset($_SESSION['check']))  {

$_SESSION['check'] = '1';

if(isset($_COOKIE['OWN_userID']))       {

$templateName = 'index2';
                                        }

                                }

else    {

$templateName = 'index';

        }

/**
 * Shows the start page of the forum.
 *
 * @package     com.woltlab.wbb.page
 * @author      Marcel Werk
 * @copyright   2001-2007 WoltLab GmbH
 * @license     WoltLab Burning Board License <http://www.woltlab.com/products/burning_board/license.php>
 */

class IndexPage extends AbstractPage {
        public $templateName

        /**
         * @see Page::readParameters()
         */
        public function readParameters() {
                parent::readParameters();

                if ($this->action == 'markAsRead') {
                        WCF::getUser()->setLastVisitTime(TIME_NOW + (WCF::getUser()->userID ? VISIT_TIME_FRAME : 0));
                        WCF::getSession()->resetUserData();
                        header('Location: '.FileUtil::addTrailingSlash(dirname(WCF::getSession()->requestURI)).'index.php'.SID_ARG_1ST);
                        exit;
                }
        }

        /**
         * @see Page::assignVariables();
         */
        public function assignVariables() {
                parent::assignVariables();

                $this->renderBoards();
                if (INDEX_ENABLE_STATS)         $this->renderStats();
                if (INDEX_ENABLE_ONLINE_LIST)   $this->renderOnlineList();
                WCF::getTPL()->assign(array(
                        'selfLink' => 'index.php?page=Index'.SID_ARG_2ND_NOT_ENCODED,
                        'allowSpidersToIndexThisPage' => true
                ));

                if (WCF::getSession()->spiderID) {
                        if ($lastChangeTime = @filemtime(WBB_DIR.'cache/cache.stat.php')) {
                                @header('Last-Modified: '.gmdate('D, d M Y H:i:s', $lastChangeTime).' GMT');
                        }
                }
        }

        /**
         * Renders the forum stats on the index page.
         */
        protected function renderStats() {
                $stats = WCF::getCache()->get('stat');
                WCF::getTPL()->assign('stats', $stats);
        }

        /**
         * @see BoardList::renderBoards()
         */
        protected function renderBoards() {
                $boardList = new BoardList();
                $boardList->renderBoards();
        }

        /**
         * Wrapper for UsersOnlineList->renderOnlineList()
         * @see UsersOnlineList::renderOnlineList()
         */
        protected function renderOnlineList() {
                require_once(WCF_DIR.'lib/data/user/usersOnline/UsersOnlineList.class.php');
                $usersOnlineList = new UsersOnlineList('', true);
                $usersOnlineList->renderOnlineList();

                // check users online record
                if ($usersOnlineList->getUsersOnlineTotal() > USERS_ONLINE_RECORD) {
                        // save new users online record
                        $sql = "UPDATE  wcf".WCF_N."_option
                                SET     optionValue = ".$usersOnlineList->getUsersOnlineTotal()."
                                WHERE   optionName = 'users_online_record'
                                        AND packageID = ".PACKAGE_ID;
                        WCF::getDB()->registerShutdownUpdate($sql);

                        // save new record time
                        if (TIME_NOW != USERS_ONLINE_RECORD_TIME) {
                                $sql = "UPDATE  wcf".WCF_N."_option
                                        SET     optionValue = ".TIME_NOW."
                                        WHERE   optionName = 'users_online_record_time'
                                                AND packageID = ".PACKAGE_ID;
                                WCF::getDB()->registerShutdownUpdate($sql);
                        }

                        // delete options file
                        @unlink(WBB_DIR.'options.inc.php');
                }
        }
}
?>