From: Eloi G. <ada...@us...> - 2006-02-24 06:46:13
|
Update of /cvsroot/phpwsbb/phpwsbb/inc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9201/inc Modified Files: runtime.php Log Message: Eliminated cpu load of instantiating PHPWSBB_Runtime and PHPWSBB_Forum on every homepage request. /class/Runtime.php is now obsolete. It only queries mod_phpwsbb_settings once now. Index: runtime.php =================================================================== RCS file: /cvsroot/phpwsbb/phpwsbb/inc/runtime.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** runtime.php 13 Sep 2004 21:41:56 -0000 1.7 --- runtime.php 24 Feb 2006 06:45:57 -0000 1.8 *************** *** 24,36 **** */ ! require_once(PHPWS_SOURCE_DIR . 'mod/phpwsbb/class/Runtime.php'); if($GLOBALS['module'] == 'home') { ! // Display Forum List ! PHPWSBB_Runtime::showForumsBlock(); ! // Display Latest Threads Block ! PHPWSBB_Runtime::showLatestThreadsBlock(); ! } ?> --- 24,93 ---- */ ! //require_once(PHPWS_SOURCE_DIR . 'mod/phpwsbb/class/Runtime.php'); if($GLOBALS['module'] == 'home') { ! // Retrieve settings ! $result = $GLOBALS['core']->sqlSelect('mod_phpwsbb_settings'); ! $showforumsblock = $result[0]['showforumsblock']; ! $forumsblocktitle = $result[0]['forumsblocktitle']; ! $allow_anon_view = $result[0]['allow_anon_view']; ! $bboffline = $result[0]['bboffline']; ! $showlatestthreadsblock = $result[0]['showlatestthreadsblock']; ! $latestthreadsblocktitle = $result[0]['latestthreadsblocktitle']; ! $maxlatestthreads = $result[0]['maxlatestthreads']; ! if (($bboffline && !$_SESSION['OBJ_user']->isDeity()) ! || (!$allow_anon_view && !$_SESSION['OBJ_user']->username)) ! return; + /** + * Displays block with today's posts in it + * + * @author Don Seiler <do...@NO...> + */ + if($showforumsblock) { + $block = NULL; + $result = $GLOBALS['core']->sqlSelect('mod_phpwsbb_forums', 'hidden', 0, 'sortorder'); + if($result) { + $block .= '<ul>'; + foreach($result as $row) { + $block .= '<li>' . PHPWS_Text::moduleLink(PHPWS_Text::parseOutput($row['label']), 'phpwsbb', array('PHPWSBB_MAN_OP'=>'viewforum', 'PHPWS_MAN_ITEMS'=>$row['id'])) . '</li>'; + } + $block .= '</ul>'; + $GLOBALS['CNT_phpwsbb_forumsblock']['title'] = $forumsblocktitle; + $GLOBALS['CNT_phpwsbb_forumsblock']['content'] = $block; + } + } + // END showForumsBlock + + + /** + * Displays block with recently changed threads in it + * + * @author Don Seiler <do...@NO...> + */ + if($showlatestthreadsblock) { + $c=0; + $block = NULL; + $result = $GLOBALS['core']->sqlSelect('mod_phpwsbb_threads', 'hidden', 0, 'lastpost DESC', NULL, NULL, $maxlatestthreads); + if($result) { + $block .= '<ul>'; + foreach($result as $row) { + if(strlen($row['label']) > 15) + $lbl = substr(PHPWS_Text::parseOutput($row['label']),0,15) . ' ...'; + else + $lbl = PHPWS_Text::parseOutput($row['label']); + $block .= '<li>' . PHPWS_Text::moduleLink($lbl, 'phpwsbb', array('PHPWSBB_MAN_OP'=>'view', 'PHPWS_MAN_ITEMS'=>$row['id'])) . '</li>'; + $c++; + } + $block .= '</ul>'; + $GLOBALS['CNT_phpwsbb_latestthreadsblock']['title'] = $latestthreadsblocktitle; + $GLOBALS['CNT_phpwsbb_latestthreadsblock']['content'] = $block; + if($_SESSION['OBJ_user']->username) + $GLOBALS['CNT_phpwsbb_latestthreadsblock']['footer'] = '<a href="index.php?module=phpwsbb&PHPWSBB_MAN_OP=getnew">'.$_SESSION['translate']->it('View All New Posts').'</a>'; + } + } + // END showLatestThreadsBlock + + } ?> |