phpBB SEO
Boards
Directory  
SEO  
Downloads
  phpBB SEO : Search Engine Optimization, Directory, Forums  
Index
Forums
Annuaire
Référencement
Télécharger
 
  Search Rechercher
    Register
Username :  Password :  Log me on automatically each visit  
S'enregistrer  
 
   
Index Refresh

 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB Forum
::  
Author Message
ultimatehandyman
PR2
PR2


Joined: 15 Mar 2007
Posts: 205

Index RefreshPosted: Tue Feb 05, 2008 8:57 pm    Post subject: Index Refresh

Hi,

I installed a mod a few years back, which makes the forum index refresh at a set period of time.

My site seems to be struggling at the moment, especially when there is more than 250 users at a time in the forum. I think it is because the index page is refreshing itself too often?

I think the code that does this is in the index page, but it could be elsewhere as there was a few files that required editing ( I think)

Can anyone point me to the correct part of code to modify to increase the length of time before the index page refreshes please-

I have included the index code, I hope it is in there!

Thanks in advance for any replies.

Code:
<?php
/***************************************************************************
 *                                index.php
 *                            -------------------
 *   begin                : Saturday, Feb 13, 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : support@phpbb.com
 *
 *   $Id: index.php,v 1.99.2.7 2006/01/28 11:13:39 acydburn Exp $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   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, or
 *   (at your option) any later version.
 *
 ***************************************************************************/


define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
$refresh_time_enable = TRUE;

$viewcat = ( !empty($HTTP_GET_VARS[POST_CAT_URL]) ) ? $HTTP_GET_VARS[POST_CAT_URL] : -1;

if( isset($HTTP_GET_VARS['mark']) || isset($HTTP_POST_VARS['mark']) )
{
   $mark_read = ( isset($HTTP_POST_VARS['mark']) ) ? $HTTP_POST_VARS['mark'] : $HTTP_GET_VARS['mark'];
}
else
{
   $mark_read = '';
}

//
// Handle marking posts
//
if( $mark_read == 'forums' )
{
   if( $userdata['session_logged_in'] )
   {
      setcookie($board_config['cookie_name'] . '_f_all', time(), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
   }

   $template->assign_vars(array(
      "META" => '<meta http-equiv="refresh" content="3;url='  .append_sid("index.$phpEx") . '">')
   );

   $message = $lang['Forums_marked_read'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a> ');

   message_die(GENERAL_MESSAGE, $message);
}
//
// End handle marking posts
//

$tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t"]) : array();
$tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f"]) : array();

//
// If you don't use these stats on your index you may want to consider
// removing them
//
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];

if( $total_posts == 0 )
{
   $l_total_post_s = $lang['Posted_articles_zero_total'];
}
else if( $total_posts == 1 )
{
   $l_total_post_s = $lang['Posted_article_total'];
}
else
{
   $l_total_post_s = $lang['Posted_articles_total'];
}

if( $total_users == 0 )
{
   $l_total_user_s = $lang['Registered_users_zero_total'];
}
else if( $total_users == 1 )
{
   $l_total_user_s = $lang['Registered_user_total'];
}
else
{
   $l_total_user_s = $lang['Registered_users_total'];
}


//
// Start page proper
//
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order
   FROM " . CATEGORIES_TABLE . " c
   ORDER BY c.cat_order";
if( !($result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql);
}

$category_rows = array();
while ($row = $db->sql_fetchrow($result))
{
   $category_rows[] = $row;
   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   if ( $row['cat_id'] == $viewcat ) { $this_cat_title = $row['cat_title']; }
   // www.phpBB-SEO.com SEO TOOLKIT END
}
$db->sql_freeresult($result);
// Begin Simple Subforums MOD
$subforums_list = array();
// End Simple Subforums MOD
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
$uri = $phpbb_seo->seo_req_uri();
$phpbb_seo->seo_cond(!$userdata['session_logged_in'] && (strpos($uri, "sid=" ) !== FALSE ));
if ( $viewcat > 0 ) {
   $phpbb_seo->page_url = $phpbb_seo->format_url($this_cat_title, $phpbb_seo->seo_static['cat']) . $phpbb_seo->seo_delim['cat'] . $viewcat . $phpbb_seo->seo_ext['cat'];
   if ( $phpbb_seo->do_redir || strpos($uri, $phpbb_seo->page_url) === FALSE) {
      $phpbb_seo->seo_redirect($phpbb_seo->seo_path['phpbb_url'] . $phpbb_seo->page_url);
   }
} elseif ($viewcat == -1) {
   $mark_use = ($userdata['session_logged_in']) ? $mark_read : '';
   if (!empty($phpbb_seo->seo_static['index'])) {
      $phpbb_seo->seo_cond(( $mark_use == '' &&  strpos($uri, $phpbb_seo->seo_static['index']) === FALSE ), TRUE);
   } else {
      $phpbb_seo->seo_cond(( $mark_use == '' &&  strpos($uri, "index.$phpEx") !== FALSE ), TRUE);
   }
   if ( $phpbb_seo->do_redir) {
      $phpbb_seo->seo_redirect($phpbb_seo->seo_path['phpbb_url'] . $phpbb_seo->seo_static['index']);
   }
}
// www.phpBB-SEO.com SEO TOOLKIT END
if( ( $total_categories = count($category_rows) ) )
{
   //
   // Define appropriate SQL
   //
   switch(SQL_LAYER)
   {
      case 'postgresql':
         $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
            FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u
            WHERE p.post_id = f.forum_last_post_id
               AND u.user_id = p.poster_id 
               UNION (
                  SELECT f.*, NULL, NULL, NULL, NULL
                  FROM " . FORUMS_TABLE . " f
                  WHERE NOT EXISTS (
                     SELECT p.post_time
                     FROM " . POSTS_TABLE . " p
                     WHERE p.post_id = f.forum_last_post_id 
                  )
               )
               ORDER BY cat_id, forum_order";
         break;

      case 'oracle':
         $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
            FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u
            WHERE p.post_id = f.forum_last_post_id(+)
               AND u.user_id = p.poster_id(+)
            ORDER BY f.cat_id, f.forum_order";
         break;

      default:
         $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
            FROM (( " . FORUMS_TABLE . " f
            LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )
            LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )
            ORDER BY f.cat_id, f.forum_order";
         break;
   }
   if ( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
   }

   $forum_data = array();
   while( $row = $db->sql_fetchrow($result) )
   {
      $forum_data[] = $row;
   }
   $db->sql_freeresult($result);

   if ( !($total_forums = count($forum_data)) )
   {
      message_die(GENERAL_MESSAGE, $lang['No_forums']);
   }
//
// Begin USERS ONLINE TODAY
// http://russ.isitaboat.co.uk/
// 
$uot_this_timestamp_array = getdate();
$uot_when_from = mktime ( 0 , 0 , 0 , $uot_this_timestamp_array[mon] , $uot_this_timestamp_array[mday] , $uot_this_timestamp_array[year] );



$sql =  "SELECT count(*) cnt
   FROM ".USERS_TABLE." u
   WHERE u.user_session_time >= ". $uot_when_from . "
   ORDER BY u.username ASC";
if ( !($uot_result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, 'Could not obtain regd user/online information', '', __LINE__, __FILE__, $sql);
}

$row = $db->sql_fetchrow($uot_result);
$uot_count = $row['cnt'];



$sql =  "SELECT u.user_id, u.username, u.user_allow_viewonline, u.user_level, user_session_time
   FROM ".USERS_TABLE." u
   WHERE u.user_session_time >= ". $uot_when_from . "
   ORDER BY u.username ASC";
if ( !($uot_result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, 'Could not obtain regd user/online information', '', __LINE__, __FILE__, $sql);
}




$users_online_today=array();

$uot_hidden_count = 0;

while ( $row = $db->sql_fetchrow($uot_result) )
{
   //counter stuff
   $$which_counter++;
   $row_color = ( $$which_counter % 2 ) ? $theme['td_color1'] : $theme['td_color2'];
   $row_class = ( $$which_counter % 2 ) ? $theme['td_class1'] : $theme['td_class2'];
      
   //generate the user name (robbed from the code above)
   $uot_user_id = $row['user_id'];
   
   //reset the style...
   $uot_style = '';

   if ( $uot_user_id != $prev_user )
   {
      $uot_username_plain = $uot_username = $row['username'];

      if ( $row['user_level'] == ADMIN )
      {
         $uot_style = 'style="color:#' . $theme['fontcolor3'] . ';"';
         $uot_username = '<b>' . $uot_username . '</b>';
      }
      else if ( $row['user_level'] == MOD )
      {
         $uot_style = 'style="color:#' . $theme['fontcolor2'] . ';"';
         $uot_username = '<b>' . $uot_username . '</b>';
      }

      if ( !$row['user_allow_viewonline'] )
      {
         $uot_hidden_count++;
         $view_online = ( $userdata['user_level'] == ADMIN ) ? true : false;
         $uot_username = $lang['UOT_hidden_start'] . $uot_username . $lang['UOT_hidden_end'];
      }
      else
      {
         $view_online = true;
      }

   }

   //annon does not have a profile...
   if($row['user_id']>0){
      $uot_username = sprintf('<a href="profile.php?mode=viewprofile&u=%d" title="%s was last here at: %s" %s>%s</a>',$uot_user_id,$uot_username_plain,create_date('g:ia', $row['user_session_time'], $board_config['board_timezone']),$uot_style,$uot_username);
   }
   
   //this will show just the user's name, with the time in the tool tip.
   if($view_online)
   {
      array_push($users_online_today,$uot_username);
   }

}

if(count($users_online_today)==0){
   array_push($users_online_today,$lang['UOT_none']);
}

if( $userdata['user_level'] == ADMIN && $uot_hidden_count>0){
   array_push($users_online_today,sprintf($lang['UOT_hidden'], $uot_hidden_count));
}


$template->assign_vars(array(
   'UOT_TITLE' => $lang['UOT_title'],
   'UOT_COUNT' => $uot_count,
   'UOT_LIST' => implode(", ",$users_online_today)
   )
);
//end of UOT



   //
   // Obtain a list of topic ids which contain
   // posts made since user last visited
   //
   if ($userdata['session_logged_in'])
   {
      // 60 days limit
      if ($userdata['user_lastvisit'] < (time() - 5184000))
      {
         $userdata['user_lastvisit'] = time() - 5184000;
      }

      $sql = "SELECT t.forum_id, t.topic_id, p.post_time
         FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
         WHERE p.post_id = t.topic_last_post_id
            AND p.post_time > " . $userdata['user_lastvisit'] . "
            AND t.topic_moved_id = 0";
      if ( !($result = $db->sql_query($sql)) )
      {
         message_die(GENERAL_ERROR, 'Could not query new topic information', '', __LINE__, __FILE__, $sql);
      }

      $new_topic_data = array();
      while( $topic_data = $db->sql_fetchrow($result) )
      {
         $new_topic_data[$topic_data['forum_id']][$topic_data['topic_id']] = $topic_data['post_time'];
      }
      $db->sql_freeresult($result);
   }

   //
   // Obtain list of moderators of each forum
   // First users, then groups ... broken into two queries
   //
   $sql = "SELECT aa.forum_id, u.user_id, u.username
      FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u
      WHERE aa.auth_mod = " . TRUE . "
         AND g.group_single_user = 1
         AND ug.group_id = aa.group_id
         AND g.group_id = aa.group_id
         AND u.user_id = ug.user_id
      GROUP BY u.user_id, u.username, aa.forum_id
      ORDER BY aa.forum_id, u.user_id";
   if ( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);
   }

   $forum_moderators = array();
   while( $row = $db->sql_fetchrow($result) )
   {
      $forum_moderators[$row['forum_id']][] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</a>';
   }
   $db->sql_freeresult($result);

   $sql = "SELECT aa.forum_id, g.group_id, g.group_name
      FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
      WHERE aa.auth_mod = " . TRUE . "
         AND g.group_single_user = 0
         AND g.group_type <> " . GROUP_HIDDEN . "
         AND ug.group_id = aa.group_id
         AND g.group_id = aa.group_id
      GROUP BY g.group_id, g.group_name, aa.forum_id
      ORDER BY aa.forum_id, g.group_id";
   if ( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);
   }

   while( $row = $db->sql_fetchrow($result) )
   {
      $forum_moderators[$row['forum_id']][] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . $row['group_name'] . '</a>';
   }
   $db->sql_freeresult($result);

   //
   // Find which forums are visible for this user
   //
   $is_auth_ary = array();
   $is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data);

   //
   // Start output of page
   //
   define('SHOW_ONLINE', true);
   // www.phpBB-SEO.com SEO TOOLKIT BEGIN - TITLE
   $page_title = ($this_cat_title) ? $this_cat_title : $board_config['sitename'];
   // www.phpBB-SEO.com SEO TOOLKIT END - TITLE
   include($phpbb_root_path . 'includes/page_header.'.$phpEx);

   // www.phpBB-SEO.com SEO TOOLKIT BEGIN - META
   $phpbb_seo->seo_meta['meta_desc'] = $phpbb_seo->meta_filter_txt("$page_title : " . $phpbb_seo->seo_meta['meta_desc_def']);
   $phpbb_seo->seo_meta['keywords'] = $phpbb_seo->make_keywords($phpbb_seo->seo_meta['meta_desc']);
   // www.phpBB-SEO.com SEO TOOLKIT END - META
   
   $template->set_filenames(array(
      'body' => 'index_body.tpl')
   );

   $template->assign_vars(array(
      'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
      'TOTAL_USERS' => sprintf($l_total_user_s, $total_users),
      'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'),

      'FORUM_IMG' => $images['forum'],
      'FORUM_NEW_IMG' => $images['forum_new'],
      'FORUM_LOCKED_IMG' => $images['forum_locked'],

      'L_FORUM' => $lang['Forum'],
      // Begin Simple Subforums MOD
      'L_SUBFORUMS' => $lang['Subforums'],
      // End Simple Subforums MOD
      'L_TOPICS' => $lang['Topics'],
      'L_REPLIES' => $lang['Replies'],
      'L_VIEWS' => $lang['Views'],
      'L_POSTS' => $lang['Posts'],
      'L_LASTPOST' => $lang['Last_Post'],
      'L_NO_NEW_POSTS' => $lang['No_new_posts'],
      'L_NEW_POSTS' => $lang['New_posts'],
      'L_NO_NEW_POSTS_LOCKED' => $lang['No_new_posts_locked'],
      'L_NEW_POSTS_LOCKED' => $lang['New_posts_locked'],
      'L_ONLINE_EXPLAIN' => $lang['Online_explain'],

      'L_MODERATOR' => $lang['Moderators'],
      'L_FORUM_LOCKED' => $lang['Forum_is_locked'],
      'L_MARK_FORUMS_READ' => $lang['Mark_all_forums'],

      'U_MARK_READ' => append_sid("index.$phpEx?mark=forums"))
   );

   $sql = "SELECT * FROM " . STATS_CONFIG_TABLE;
   if ( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Could not query statistics config table', '', __LINE__, __FILE__, $sql);
   }
   $stats_config = array();
   while ($row = $db->sql_fetchrow($result))
   {
      $stats_config[$row['config_name']] = trim($row['config_value']);
   }
   if (intval($stats_config['stat_index']) != 0)
   {
      include_once($phpbb_root_path."statistics_index.$phpEx");
   }
   
   //
   // Let's decide which categories we should display
   //
   $display_categories = array();

   for ($i = 0; $i < $total_forums; $i++ )
   {
      if ($is_auth_ary[$forum_data[$i]['forum_id']]['auth_view'])
      {
         $display_categories[$forum_data[$i]['cat_id']] = true;
      }
   }

   //
   // Okay, let's build the index
   //
   for($i = 0; $i < $total_categories; $i++)
   {
      $cat_id = $category_rows[$i]['cat_id'];

      //
      // Yes, we should, so first dump out the category
      // title, then, if appropriate the forum list
      //
      if (isset($display_categories[$cat_id]) && $display_categories[$cat_id])
      {
         // www.phpBB-SEO.com SEO TOOLKIT BEGIN
         $phpbb_seo->seo_url['cat'][$cat_id] = $phpbb_seo->format_url($category_rows[$i]['cat_title'], $phpbb_seo->seo_static['cat']);
         // www.phpBB-SEO.com SEO TOOLKIT END

         $template->assign_block_vars('catrow', array(
            'CAT_ID' => $cat_id,
            'CAT_DESC' => $category_rows[$i]['cat_title'],
            'U_VIEWCAT' => append_sid("index.$phpEx?" . POST_CAT_URL . "=$cat_id"))
         );

         if ( $viewcat == $cat_id || $viewcat == -1 )
         {
            for($j = 0; $j < $total_forums; $j++)
            {
               if ( $forum_data[$j]['cat_id'] == $cat_id )
               {
                  $forum_id = $forum_data[$j]['forum_id'];

                  if ( $is_auth_ary[$forum_id]['auth_view'] )
                  {
                     // www.phpBB-SEO.com SEO TOOLKIT BEGIN
                     if ( !isset($phpbb_seo->seo_url['forum'][$forum_id]) ) {
                        $phpbb_seo->seo_url['forum'][$forum_id] = $phpbb_seo->format_url($forum_data[$j]['forum_name'], $phpbb_seo->seo_static['forum']);
                     }
                     // www.phpBB-SEO.com SEO TOOLKIT END

                     if ( $forum_data[$j]['forum_status'] == FORUM_LOCKED )
                     {
                        $folder_image = $images['forum_locked'];
                        $folder_alt = $lang['Forum_locked'];
                        // Begin Simple Subforums MOD
                        $unread_topics = false;
                        $folder_images = array(
                           'default'   => $folder_image,
                           'new'      => $images['forum_locked'],
                           'sub'      => ( isset($images['forums_locked']) ) ? $images['forums_locked'] : $images['forum_locked'],
                           'subnew'   => ( isset($images['forums_locked']) ) ? $images['forums_locked'] : $images['forum_locked'],
                           'subalt'   => $lang['Forum_locked'],
                           'subaltnew'   => $lang['Forum_locked'],
                           );
                        // End Simple Subforums MOD
                     }
                     else
                     {
                        $unread_topics = false;
                        if ( $userdata['session_logged_in'] )
                        {
                           if ( !empty($new_topic_data[$forum_id]) )
                           {
                              $forum_last_post_time = 0;

                              while( list($check_topic_id, $check_post_time) = @each($new_topic_data[$forum_id]) )
                              {
                                 if ( empty($tracking_topics[$check_topic_id]) )
                                 {
                                    $unread_topics = true;
                                    $forum_last_post_time = max($check_post_time, $forum_last_post_time);

                                 }
                                 else
                                 {
                                    if ( $tracking_topics[$check_topic_id] < $check_post_time )
                                    {
                                       $unread_topics = true;
                                       $forum_last_post_time = max($check_post_time, $forum_last_post_time);
                                    }
                                 }
                              }

                              if ( !empty($tracking_forums[$forum_id]) )
                              {
                                 if ( $tracking_forums[$forum_id] > $forum_last_post_time )
                                 {
                                    $unread_topics = false;
                                 }
                              }

                              if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
                              {
                                 if ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $forum_last_post_time )
                                 {
                                    $unread_topics = false;
                                 }
                              }

                           }
                        }

                        $folder_image = ( $unread_topics ) ? $images['forum_new'] : $images['forum'];
                        $folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts'];
                        // Begin Simple Subforums MOD
                        $folder_images = array(
                           'default'   => $folder_image,
                           'new'      => $images['forum_new'],
                           'sub'      => ( isset($images['forums']) ) ? $images['forums'] : $images['forum'],
                           'subnew'   => ( isset($images['forums_new']) ) ? $images['forums_new'] : $images['forum_new'],
                           'subalt'   => $lang['No_new_posts'],
                           'subaltnew'   => $lang['New_posts'],
                           );
                        // End Simple Subforums MOD
                     }

                     $posts = $forum_data[$j]['forum_posts'];
                     $topics = $forum_data[$j]['forum_topics'];

                     if ( $forum_data[$j]['forum_last_post_id'] )
                     {
                        $last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);

                        $last_post = $last_post_time . '<br />';

                        $last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '='  . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';
                        
                        $last_post .= '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
                        // Begin Simple Subforums MOD
                        $last_post_sub = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . ($unread_topics ? $images['icon_newest_reply'] : $images['icon_latest_reply']) . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
                        $last_post_time = $forum_data[$j]['post_time'];
                        // End Simple Subforums MOD
                     }
                     else
                     {
                        $last_post = $lang['No_Posts'];
                        // Begin Simple Subforums MOD
                        $last_post_sub = '<img src="' . $images['icon_minipost'] . '" border="0" alt="' . $lang['No_Posts'] . '" title="' . $lang['No_Posts'] . '" />';
                        $last_post_time = 0;
                        // End Simple Subforums MOD
                     }

                     if ( count($forum_moderators[$forum_id]) > 0 )
                     {
                        $l_moderators = ( count($forum_moderators[$forum_id]) == 1 ) ? $lang['Moderator'] : $lang['Moderators'];
                        $moderator_list = implode(', ', $forum_moderators[$forum_id]);
                     }
                     else
                     {
                        $l_moderators = '&nbsp;';
                        $moderator_list = '';
                     }

                     $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
                     $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

                     $template->assign_block_vars('catrow.forumrow',   array(
                        'ROW_COLOR' => '#' . $row_color,
                        'ROW_CLASS' => $row_class,
                        'FORUM_FOLDER_IMG' => $folder_image,
                        'FORUM_NAME' => $forum_data[$j]['forum_name'],
                        'FORUM_DESC' => $forum_data[$j]['forum_desc'],
                        'POSTS' => $forum_data[$j]['forum_posts'],
                        'TOPICS' => $forum_data[$j]['forum_topics'],
                        'LAST_POST' => $last_post,
                        'INDEXR' => append_sid("index.$phpEx"),
                        'MODERATORS' => $moderator_list,

                        'L_MODERATOR' => $l_moderators,
                        'L_FORUM_FOLDER_ALT' => $folder_alt,
                        // Begin Simple Subforums MOD
                        'FORUM_FOLDERS' => serialize($folder_images),
                        'HAS_SUBFORUMS' => 0,
                        'PARENT' => $forum_data[$j]['forum_parent'],
                        'ID' => $forum_data[$j]['forum_id'],
                        'UNREAD' => intval($unread_topics),
                        'TOTAL_UNREAD' => intval($unread_topics),
                        'TOTAL_POSTS' => $forum_data[$j]['forum_posts'],
                        'TOTAL_TOPICS' => $forum_data[$j]['forum_topics'],
                        'LAST_POST_FORUM' => $last_post,
                        'LAST_POST_TIME' => $last_post_time,
                        'LAST_POST_TIME_FORUM' => $last_post_time,
                        // End Simple Subforums MOD

                        'U_VIEWFORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"))
                     );
                     // Begin Simple Subforums MOD
                     if( $forum_data[$j]['forum_parent'] )
                     {
                        $subforums_list[] = array(
                           'forum_data'   => $forum_data[$j],
                           'folder_image'   => $folder_image,
                           'last_post'      => $last_post,
                           'last_post_sub'   => $last_post_sub,
                           'moderator_list'   => $moderator_list,
                           'unread_topics'   => $unread_topics,
                           'l_moderators'   => $l_moderators,
                           'folder_alt'   => $folder_alt,
                           'last_post_time'   => $last_post_time,
                           'desc'         => $forum_data[$j]['forum_desc'],
                           );
                     }
                     // End Simple Subforums MOD
                  }
               }
            }
         }
      }
   } // for ... categories

}// if ... total_categories
else
{
   message_die(GENERAL_MESSAGE, $lang['No_forums']);
}

// Begin Simple Subforums MOD
unset($data);
unset($item);
unset($cat_item);
unset($row_item);
for( $i = 0; $i < count($subforums_list); $i++ )
{
   $forum_data = $subforums_list[$i]['forum_data'];
   $parent_id = $forum_data['forum_parent'];
   
   // Find parent item
   if( isset($template->_tpldata['catrow.']) )
   {
      $data = &$template->_tpldata['catrow.'];
      $count = count($data);
      for( $j = 0; $j < $count; $j++)
      {
         $cat_item = &$data[$j];
         $row_item = &$cat_item['forumrow.'];
         $count2 = count($row_item);
         for( $k = 0; $k < $count2; $k++)
         {
            if( $row_item[$k]['ID'] == $parent_id )
            {
               $item = &$row_item[$k];
               break;
            }
         }
         if( isset($item) )
         {
            break;
         }
      }
   }
   
   if( isset($item) )
   {
      if( isset($item['sub.']) )
      {
         $num = count($item['sub.']);
         $data = &$item['sub.'];
      }
      else
      {
         $num = 0;
         $item[] = 'sub.';
         $data = &$item['sub.'];
      }
      
      // Append new entry
      $data[] = array(
         'NUM' => $num,
         'FORUM_FOLDER_IMG' => $subforums_list[$i]['folder_image'],
         'FORUM_NAME' => $forum_data['forum_name'],
         'FORUM_DESC' => $forum_data['forum_desc'],
         'FORUM_DESC_HTML' => htmlspecialchars(preg_replace('@<[\/\!]*?[^<>]*?>@si', '', $forum_data['forum_desc'])),
         'POSTS' => $forum_data['forum_posts'],
         'TOPICS' => $forum_data['forum_topics'],
         'LAST_POST' => $subforums_list[$i]['last_post'],
         'LAST_POST_SUB' => $subforums_list[$i]['last_post_sub'],
         'LAST_TOPIC' => $forum_data['topic_title'],
         'MODERATORS' => $subforums_list[$i]['moderator_list'],
         'PARENT' => $forum_data['forum_parent'],
         'ID' => $forum_data['forum_id'],
         'UNREAD' => intval($subforums_list[$i]['unread_topics']),
   
         'L_MODERATOR' => $subforums_list[$i]['l_moderators'],
         'L_FORUM_FOLDER_ALT' => $subforums_list[$i]['folder_alt'],
   
         'U_VIEWFORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $forum_data['forum_id'])
      );
      $item['HAS_SUBFORUMS'] ++;
      $item['TOTAL_UNREAD'] += intval($subforums_list[$i]['unread_topics']);
      // Change folder image
      $images = unserialize($item['FORUM_FOLDERS']);
      $item['FORUM_FOLDER_IMG'] = $item['TOTAL_UNREAD'] ? $images['subnew'] : $images['sub'];
      $item['L_FORUM_FOLDER_ALT'] = $item['TOTAL_UNREAD'] ? $images['subaltnew'] : $images['subalt'];
      // Check last post
      if( $item['LAST_POST_TIME'] < $subforums_list[$i]['last_post_time'] )
      {
         $item['LAST_POST'] = $subforums_list[$i]['last_post'];
         $item['LAST_POST_TIME'] = $subforums_list[$i]['last_post_time'];
      }
      if( !$item['LAST_POST_TIME_FORUM'] )
      {
         $item['LAST_POST_FORUM'] = $item['LAST_POST'];
      }
      // Add topics/posts
      $item['TOTAL_POSTS'] += $forum_data['forum_posts'];
      $item['TOTAL_TOPICS'] += $forum_data['forum_topics'];
   }
   unset($item);
   unset($data);
   unset($cat_item);
   unset($row_item);
}
// End Simple Subforums MOD

//
// Generate the page
//
$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>

_________________
DIY | DIY directory |DIY forum
Back to top
HB
phpBB SEO Team
phpBB SEO Team


Joined: 16 Oct 2006
Posts: 786

Index RefreshPosted: Wed Feb 06, 2008 5:48 am    Post subject: Re: Index Refresh

ultimatehandyman wrote:
Hi,

I installed a mod a few years back, which makes the forum index refresh at a set period of time.

My site seems to be struggling at the moment, especially when there is more than 250 users at a time in the forum. I think it is because the index page is refreshing itself too often?

Egads, yes. It looks like you have a meta tag forcing a browser refresh:

Code:
<META http-equiv="refresh" content="120;url=">


It appears to be in overall_header.tpl.

_________________
Dan Kehn
Back to top
Visit poster's website
ultimatehandyman
PR2
PR2


Joined: 15 Mar 2007
Posts: 205

Index RefreshPosted: Wed Feb 06, 2008 4:48 pm    Post subject: Re: Index Refresh

HB wrote:
ultimatehandyman wrote:
Hi,

I installed a mod a few years back, which makes the forum index refresh at a set period of time.

My site seems to be struggling at the moment, especially when there is more than 250 users at a time in the forum. I think it is because the index page is refreshing itself too often?

Egads, yes. It looks like you have a meta tag forcing a browser refresh:

Code:
<META http-equiv="refresh" content="120;url=">


It appears to be in overall_header.tpl.


Thanks very much Dan.

I wondered why I could not find it in the index file, but as only the index file refreshes I though it must be in there somewhere.

Thanks again, this should help me sort out a persistant problem.

_________________
DIY | DIY directory |DIY forum
Back to top
HB
phpBB SEO Team
phpBB SEO Team


Joined: 16 Oct 2006
Posts: 786

Index RefreshPosted: Wed Feb 06, 2008 5:06 pm    Post subject: Re: Index Refresh

It could be in index_body.tpl, but it looked like the <meta> was before the index body content. Either way, a quick scan of your install should reveal all.

_________________
Dan Kehn
Back to top
Visit poster's website
ultimatehandyman
PR2
PR2


Joined: 15 Mar 2007
Posts: 205

Index RefreshPosted: Wed Feb 06, 2008 5:09 pm    Post subject: Re: Index Refresh

It was in Index_body.tpl

But was easy to find, once I knew what I was looking for

Thanks Dan Wink

_________________
DIY | DIY directory |DIY forum
Back to top
Display posts from previous:   
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB Forum
Page 1 of 1

Navigation Similar Topics

Jump to: