home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 April (DVD) / PCWorld_2008-04_DVD.iso / temadvd / phpbb / phpBB-2.0.22.exe / phpBB2 / admin / index.php < prev    next >
Encoding:
PHP Script  |  2006-12-19  |  17.8 KB  |  657 lines

  1. <?php
  2. /***************************************************************************
  3.  *                             (admin) index.php
  4.  *                            -------------------
  5.  *   begin                : Saturday, Feb 13, 2001
  6.  *   copyright            : (C) 2001 The phpBB Group
  7.  *   email                : support@phpbb.com
  8.  *
  9.  *   $Id: index.php,v 1.40.2.10 2005/12/04 12:55:28 grahamje Exp $
  10.  *
  11.  *
  12.  ***************************************************************************/
  13.  
  14. /***************************************************************************
  15.  *
  16.  *   This program is free software; you can redistribute it and/or modify
  17.  *   it under the terms of the GNU General Public License as published by
  18.  *   the Free Software Foundation; either version 2 of the License, or
  19.  *   (at your option) any later version.
  20.  *
  21.  ***************************************************************************/
  22.  
  23. define('IN_PHPBB', 1);
  24.  
  25. //
  26. // Load default header
  27. //
  28. $no_page_header = TRUE;
  29. $phpbb_root_path = "./../";
  30. require($phpbb_root_path . 'extension.inc');
  31. require('./pagestart.' . $phpEx);
  32.  
  33. // ---------------
  34. // Begin functions
  35. //
  36. function inarray($needle, $haystack)
  37.     for($i = 0; $i < sizeof($haystack); $i++ )
  38.     { 
  39.         if( $haystack[$i] == $needle )
  40.         { 
  41.             return true; 
  42.         } 
  43.     } 
  44.     return false; 
  45. }
  46. //
  47. // End functions
  48. // -------------
  49.  
  50. //
  51. // Generate relevant output
  52. //
  53. if( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'left' )
  54. {
  55.     $dir = @opendir(".");
  56.  
  57.     $setmodules = 1;
  58.     while( $file = @readdir($dir) )
  59.     {
  60.         if( preg_match("/^admin_.*?\." . $phpEx . "$/", $file) )
  61.         {
  62.             include('./' . $file);
  63.         }
  64.     }
  65.  
  66.     @closedir($dir);
  67.  
  68.     unset($setmodules);
  69.  
  70.     include('./page_header_admin.'.$phpEx);
  71.  
  72.     $template->set_filenames(array(
  73.         "body" => "admin/index_navigate.tpl")
  74.     );
  75.  
  76.     $template->assign_vars(array(
  77.         "U_FORUM_INDEX" => append_sid("../index.$phpEx"),
  78.         "U_ADMIN_INDEX" => append_sid("index.$phpEx?pane=right"),
  79.  
  80.         "L_FORUM_INDEX" => $lang['Main_index'],
  81.         "L_ADMIN_INDEX" => $lang['Admin_Index'], 
  82.         "L_PREVIEW_FORUM" => $lang['Preview_forum'])
  83.     );
  84.  
  85.     ksort($module);
  86.  
  87.     while( list($cat, $action_array) = each($module) )
  88.     {
  89.         $cat = ( !empty($lang[$cat]) ) ? $lang[$cat] : preg_replace("/_/", " ", $cat);
  90.  
  91.         $template->assign_block_vars("catrow", array(
  92.             "ADMIN_CATEGORY" => $cat)
  93.         );
  94.  
  95.         ksort($action_array);
  96.  
  97.         $row_count = 0;
  98.         while( list($action, $file)    = each($action_array) )
  99.         {
  100.             $row_color = ( !($row_count%2) ) ? $theme['td_color1'] : $theme['td_color2'];
  101.             $row_class = ( !($row_count%2) ) ? $theme['td_class1'] : $theme['td_class2'];
  102.  
  103.             $action = ( !empty($lang[$action]) ) ? $lang[$action] : preg_replace("/_/", " ", $action);
  104.  
  105.             $template->assign_block_vars("catrow.modulerow", array(
  106.                 "ROW_COLOR" => "#" . $row_color,
  107.                 "ROW_CLASS" => $row_class, 
  108.  
  109.                 "ADMIN_MODULE" => $action,
  110.                 "U_ADMIN_MODULE" => append_sid($file))
  111.             );
  112.             $row_count++;
  113.         }
  114.     }
  115.  
  116.     $template->pparse("body");
  117.  
  118.     include('./page_footer_admin.'.$phpEx);
  119. }
  120. elseif( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
  121. {
  122.  
  123.     include('./page_header_admin.'.$phpEx);
  124.  
  125.     $template->set_filenames(array(
  126.         "body" => "admin/index_body.tpl")
  127.     );
  128.  
  129.     $template->assign_vars(array(
  130.         "L_WELCOME" => $lang['Welcome_phpBB'],
  131.         "L_ADMIN_INTRO" => $lang['Admin_intro'],
  132.         "L_FORUM_STATS" => $lang['Forum_stats'],
  133.         "L_WHO_IS_ONLINE" => $lang['Who_is_Online'],
  134.         "L_USERNAME" => $lang['Username'],
  135.         "L_LOCATION" => $lang['Location'],
  136.         "L_LAST_UPDATE" => $lang['Last_updated'],
  137.         "L_IP_ADDRESS" => $lang['IP_Address'],
  138.         "L_STATISTIC" => $lang['Statistic'],
  139.         "L_VALUE" => $lang['Value'],
  140.         "L_NUMBER_POSTS" => $lang['Number_posts'],
  141.         "L_POSTS_PER_DAY" => $lang['Posts_per_day'],
  142.         "L_NUMBER_TOPICS" => $lang['Number_topics'],
  143.         "L_TOPICS_PER_DAY" => $lang['Topics_per_day'],
  144.         "L_NUMBER_USERS" => $lang['Number_users'],
  145.         "L_USERS_PER_DAY" => $lang['Users_per_day'],
  146.         "L_BOARD_STARTED" => $lang['Board_started'],
  147.         "L_AVATAR_DIR_SIZE" => $lang['Avatar_dir_size'],
  148.         "L_DB_SIZE" => $lang['Database_size'], 
  149.         "L_FORUM_LOCATION" => $lang['Forum_Location'],
  150.         "L_STARTED" => $lang['Login'],
  151.         "L_GZIP_COMPRESSION" => $lang['Gzip_compression'])
  152.     );
  153.  
  154.     //
  155.     // Get forum statistics
  156.     //
  157.     $total_posts = get_db_stat('postcount');
  158.     $total_users = get_db_stat('usercount');
  159.     $total_topics = get_db_stat('topiccount');
  160.  
  161.     $start_date = create_date($board_config['default_dateformat'], $board_config['board_startdate'], $board_config['board_timezone']);
  162.  
  163.     $boarddays = ( time() - $board_config['board_startdate'] ) / 86400;
  164.  
  165.     $posts_per_day = sprintf("%.2f", $total_posts / $boarddays);
  166.     $topics_per_day = sprintf("%.2f", $total_topics / $boarddays);
  167.     $users_per_day = sprintf("%.2f", $total_users / $boarddays);
  168.  
  169.     $avatar_dir_size = 0;
  170.  
  171.     if ($avatar_dir = @opendir($phpbb_root_path . $board_config['avatar_path']))
  172.     {
  173.         while( $file = @readdir($avatar_dir) )
  174.         {
  175.             if( $file != "." && $file != ".." )
  176.             {
  177.                 $avatar_dir_size += @filesize($phpbb_root_path . $board_config['avatar_path'] . "/" . $file);
  178.             }
  179.         }
  180.         @closedir($avatar_dir);
  181.  
  182.         //
  183.         // This bit of code translates the avatar directory size into human readable format
  184.         // Borrowed the code from the PHP.net annoted manual, origanally written by:
  185.         // Jesse (jesse@jess.on.ca)
  186.         //
  187.         if($avatar_dir_size >= 1048576)
  188.         {
  189.             $avatar_dir_size = round($avatar_dir_size / 1048576 * 100) / 100 . " MB";
  190.         }
  191.         else if($avatar_dir_size >= 1024)
  192.         {
  193.             $avatar_dir_size = round($avatar_dir_size / 1024 * 100) / 100 . " KB";
  194.         }
  195.         else
  196.         {
  197.             $avatar_dir_size = $avatar_dir_size . " Bytes";
  198.         }
  199.  
  200.     }
  201.     else
  202.     {
  203.         // Couldn't open Avatar dir.
  204.         $avatar_dir_size = $lang['Not_available'];
  205.     }
  206.  
  207.     if($posts_per_day > $total_posts)
  208.     {
  209.         $posts_per_day = $total_posts;
  210.     }
  211.  
  212.     if($topics_per_day > $total_topics)
  213.     {
  214.         $topics_per_day = $total_topics;
  215.     }
  216.  
  217.     if($users_per_day > $total_users)
  218.     {
  219.         $users_per_day = $total_users;
  220.     }
  221.  
  222.     //
  223.     // DB size ... MySQL only
  224.     //
  225.     // This code is heavily influenced by a similar routine
  226.     // in phpMyAdmin 2.2.0
  227.     //
  228.     if( preg_match("/^mysql/", SQL_LAYER) )
  229.     {
  230.         $sql = "SELECT VERSION() AS mysql_version";
  231.         if($result = $db->sql_query($sql))
  232.         {
  233.             $row = $db->sql_fetchrow($result);
  234.             $version = $row['mysql_version'];
  235.  
  236.             if( preg_match("/^(3\.23|4\.|5\.)/", $version) )
  237.             {
  238.                 $db_name = ( preg_match("/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)|(5\.)/", $version) ) ? "`$dbname`" : $dbname;
  239.  
  240.                 $sql = "SHOW TABLE STATUS 
  241.                     FROM " . $db_name;
  242.                 if($result = $db->sql_query($sql))
  243.                 {
  244.                     $tabledata_ary = $db->sql_fetchrowset($result);
  245.  
  246.                     $dbsize = 0;
  247.                     for($i = 0; $i < count($tabledata_ary); $i++)
  248.                     {
  249.                         if( $tabledata_ary[$i]['Type'] != "MRG_MyISAM" )
  250.                         {
  251.                             if( $table_prefix != "" )
  252.                             {
  253.                                 if( strstr($tabledata_ary[$i]['Name'], $table_prefix) )
  254.                                 {
  255.                                     $dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length'];
  256.                                 }
  257.                             }
  258.                             else
  259.                             {
  260.                                 $dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length'];
  261.                             }
  262.                         }
  263.                     }
  264.                 } // Else we couldn't get the table status.
  265.             }
  266.             else
  267.             {
  268.                 $dbsize = $lang['Not_available'];
  269.             }
  270.         }
  271.         else
  272.         {
  273.             $dbsize = $lang['Not_available'];
  274.         }
  275.     }
  276.     else if( preg_match("/^mssql/", SQL_LAYER) )
  277.     {
  278.         $sql = "SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize 
  279.             FROM sysfiles"; 
  280.         if( $result = $db->sql_query($sql) )
  281.         {
  282.             $dbsize = ( $row = $db->sql_fetchrow($result) ) ? intval($row['dbsize']) : $lang['Not_available'];
  283.         }
  284.         else
  285.         {
  286.             $dbsize = $lang['Not_available'];
  287.         }
  288.     }
  289.     else
  290.     {
  291.         $dbsize = $lang['Not_available'];
  292.     }
  293.  
  294.     if ( is_integer($dbsize) )
  295.     {
  296.         if( $dbsize >= 1048576 )
  297.         {
  298.             $dbsize = sprintf("%.2f MB", ( $dbsize / 1048576 ));
  299.         }
  300.         else if( $dbsize >= 1024 )
  301.         {
  302.             $dbsize = sprintf("%.2f KB", ( $dbsize / 1024 ));
  303.         }
  304.         else
  305.         {
  306.             $dbsize = sprintf("%.2f Bytes", $dbsize);
  307.         }
  308.     }
  309.  
  310.     $template->assign_vars(array(
  311.         "NUMBER_OF_POSTS" => $total_posts,
  312.         "NUMBER_OF_TOPICS" => $total_topics,
  313.         "NUMBER_OF_USERS" => $total_users,
  314.         "START_DATE" => $start_date,
  315.         "POSTS_PER_DAY" => $posts_per_day,
  316.         "TOPICS_PER_DAY" => $topics_per_day,
  317.         "USERS_PER_DAY" => $users_per_day,
  318.         "AVATAR_DIR_SIZE" => $avatar_dir_size,
  319.         "DB_SIZE" => $dbsize, 
  320.         "GZIP_COMPRESSION" => ( $board_config['gzip_compress'] ) ? $lang['ON'] : $lang['OFF'])
  321.     );
  322.     //
  323.     // End forum statistics
  324.     //
  325.  
  326.     //
  327.     // Get users online information.
  328.     //
  329.     $sql = "SELECT u.user_id, u.username, u.user_session_time, u.user_session_page, s.session_logged_in, s.session_ip, s.session_start 
  330.         FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE . " s
  331.         WHERE s.session_logged_in = " . TRUE . " 
  332.             AND u.user_id = s.session_user_id 
  333.             AND u.user_id <> " . ANONYMOUS . " 
  334.             AND s.session_time >= " . ( time() - 300 ) . " 
  335.         ORDER BY u.user_session_time DESC";
  336.     if(!$result = $db->sql_query($sql))
  337.     {
  338.         message_die(GENERAL_ERROR, "Couldn't obtain regd user/online information.", "", __LINE__, __FILE__, $sql);
  339.     }
  340.     $onlinerow_reg = $db->sql_fetchrowset($result);
  341.  
  342.     $sql = "SELECT session_page, session_logged_in, session_time, session_ip, session_start   
  343.         FROM " . SESSIONS_TABLE . "
  344.         WHERE session_logged_in = 0
  345.             AND session_time >= " . ( time() - 300 ) . "
  346.         ORDER BY session_time DESC";
  347.     if(!$result = $db->sql_query($sql))
  348.     {
  349.         message_die(GENERAL_ERROR, "Couldn't obtain guest user/online information.", "", __LINE__, __FILE__, $sql);
  350.     }
  351.     $onlinerow_guest = $db->sql_fetchrowset($result);
  352.  
  353.     $sql = "SELECT forum_name, forum_id
  354.         FROM " . FORUMS_TABLE;
  355.     if($forums_result = $db->sql_query($sql))
  356.     {
  357.         while($forumsrow = $db->sql_fetchrow($forums_result))
  358.         {
  359.             $forum_data[$forumsrow['forum_id']] = $forumsrow['forum_name'];
  360.         }
  361.     }
  362.     else
  363.     {
  364.         message_die(GENERAL_ERROR, "Couldn't obtain user/online forums information.", "", __LINE__, __FILE__, $sql);
  365.     }
  366.  
  367.     $reg_userid_ary = array();
  368.  
  369.     if( count($onlinerow_reg) )
  370.     {
  371.         $registered_users = 0;
  372.  
  373.         for($i = 0; $i < count($onlinerow_reg); $i++)
  374.         {
  375.             if( !inarray($onlinerow_reg[$i]['user_id'], $reg_userid_ary) )
  376.             {
  377.                 $reg_userid_ary[] = $onlinerow_reg[$i]['user_id'];
  378.  
  379.                 $username = $onlinerow_reg[$i]['username'];
  380.  
  381.                 if( $onlinerow_reg[$i]['user_allow_viewonline'] || $userdata['user_level'] == ADMIN )
  382.                 {
  383.                     $registered_users++;
  384.                     $hidden = FALSE;
  385.                 }
  386.                 else
  387.                 {
  388.                     $hidden_users++;
  389.                     $hidden = TRUE;
  390.                 }
  391.  
  392.                 if( $onlinerow_reg[$i]['user_session_page'] < 1 )
  393.                 {
  394.                     switch($onlinerow_reg[$i]['user_session_page'])
  395.                     {
  396.                         case PAGE_INDEX:
  397.                             $location = $lang['Forum_index'];
  398.                             $location_url = "index.$phpEx?pane=right";
  399.                             break;
  400.                         case PAGE_POSTING:
  401.                             $location = $lang['Posting_message'];
  402.                             $location_url = "index.$phpEx?pane=right";
  403.                             break;
  404.                         case PAGE_LOGIN:
  405.                             $location = $lang['Logging_on'];
  406.                             $location_url = "index.$phpEx?pane=right";
  407.                             break;
  408.                         case PAGE_SEARCH:
  409.                             $location = $lang['Searching_forums'];
  410.                             $location_url = "index.$phpEx?pane=right";
  411.                             break;
  412.                         case PAGE_PROFILE:
  413.                             $location = $lang['Viewing_profile'];
  414.                             $location_url = "index.$phpEx?pane=right";
  415.                             break;
  416.                         case PAGE_VIEWONLINE:
  417.                             $location = $lang['Viewing_online'];
  418.                             $location_url = "index.$phpEx?pane=right";
  419.                             break;
  420.                         case PAGE_VIEWMEMBERS:
  421.                             $location = $lang['Viewing_member_list'];
  422.                             $location_url = "index.$phpEx?pane=right";
  423.                             break;
  424.                         case PAGE_PRIVMSGS:
  425.                             $location = $lang['Viewing_priv_msgs'];
  426.                             $location_url = "index.$phpEx?pane=right";
  427.                             break;
  428.                         case PAGE_FAQ:
  429.                             $location = $lang['Viewing_FAQ'];
  430.                             $location_url = "index.$phpEx?pane=right";
  431.                             break;
  432.                         default:
  433.                             $location = $lang['Forum_index'];
  434.                             $location_url = "index.$phpEx?pane=right";
  435.                     }
  436.                 }
  437.                 else
  438.                 {
  439.                     $location_url = append_sid("admin_forums.$phpEx?mode=editforum&" . POST_FORUM_URL . "=" . $onlinerow_reg[$i]['user_session_page']);
  440.                     $location = $forum_data[$onlinerow_reg[$i]['user_session_page']];
  441.                 }
  442.  
  443.                 $row_color = ( $registered_users % 2 ) ? $theme['td_color1'] : $theme['td_color2'];
  444.                 $row_class = ( $registered_users % 2 ) ? $theme['td_class1'] : $theme['td_class2'];
  445.  
  446.                 $reg_ip = decode_ip($onlinerow_reg[$i]['session_ip']);
  447.  
  448.                 $template->assign_block_vars("reg_user_row", array(
  449.                     "ROW_COLOR" => "#" . $row_color,
  450.                     "ROW_CLASS" => $row_class,
  451.                     "USERNAME" => $username, 
  452.                     "STARTED" => create_date($board_config['default_dateformat'], $onlinerow_reg[$i]['session_start'], $board_config['board_timezone']), 
  453.                     "LASTUPDATE" => create_date($board_config['default_dateformat'], $onlinerow_reg[$i]['user_session_time'], $board_config['board_timezone']),
  454.                     "FORUM_LOCATION" => $location,
  455.                     "IP_ADDRESS" => $reg_ip, 
  456.  
  457.                     "U_WHOIS_IP" => "http://network-tools.com/default.asp?host=$reg_ip", 
  458.                     "U_USER_PROFILE" => append_sid("admin_users.$phpEx?mode=edit&" . POST_USERS_URL . "=" . $onlinerow_reg[$i]['user_id']),
  459.                     "U_FORUM_LOCATION" => append_sid($location_url))
  460.                 );
  461.             }
  462.         }
  463.  
  464.     }
  465.     else
  466.     {
  467.         $template->assign_vars(array(
  468.             "L_NO_REGISTERED_USERS_BROWSING" => $lang['No_users_browsing'])
  469.         );
  470.     }
  471.  
  472.     //
  473.     // Guest users
  474.     //
  475.     if( count($onlinerow_guest) )
  476.     {
  477.         $guest_users = 0;
  478.  
  479.         for($i = 0; $i < count($onlinerow_guest); $i++)
  480.         {
  481.             $guest_userip_ary[] = $onlinerow_guest[$i]['session_ip'];
  482.             $guest_users++;
  483.  
  484.             if( $onlinerow_guest[$i]['session_page'] < 1 )
  485.             {
  486.                 switch( $onlinerow_guest[$i]['session_page'] )
  487.                 {
  488.                     case PAGE_INDEX:
  489.                         $location = $lang['Forum_index'];
  490.                         $location_url = "index.$phpEx?pane=right";
  491.                         break;
  492.                     case PAGE_POSTING:
  493.                         $location = $lang['Posting_message'];
  494.                         $location_url = "index.$phpEx?pane=right";
  495.                         break;
  496.                     case PAGE_LOGIN:
  497.                         $location = $lang['Logging_on'];
  498.                         $location_url = "index.$phpEx?pane=right";
  499.                         break;
  500.                     case PAGE_SEARCH:
  501.                         $location = $lang['Searching_forums'];
  502.                         $location_url = "index.$phpEx?pane=right";
  503.                         break;
  504.                     case PAGE_PROFILE:
  505.                         $location = $lang['Viewing_profile'];
  506.                         $location_url = "index.$phpEx?pane=right";
  507.                         break;
  508.                     case PAGE_VIEWONLINE:
  509.                         $location = $lang['Viewing_online'];
  510.                         $location_url = "index.$phpEx?pane=right";
  511.                         break;
  512.                     case PAGE_VIEWMEMBERS:
  513.                         $location = $lang['Viewing_member_list'];
  514.                         $location_url = "index.$phpEx?pane=right";
  515.                         break;
  516.                     case PAGE_PRIVMSGS:
  517.                         $location = $lang['Viewing_priv_msgs'];
  518.                         $location_url = "index.$phpEx?pane=right";
  519.                         break;
  520.                     case PAGE_FAQ:
  521.                         $location = $lang['Viewing_FAQ'];
  522.                         $location_url = "index.$phpEx?pane=right";
  523.                         break;
  524.                     default:
  525.                         $location = $lang['Forum_index'];
  526.                         $location_url = "index.$phpEx?pane=right";
  527.                 }
  528.             }
  529.             else
  530.             {
  531.                 $location_url = append_sid("admin_forums.$phpEx?mode=editforum&" . POST_FORUM_URL . "=" . $onlinerow_guest[$i]['session_page']);
  532.                 $location = $forum_data[$onlinerow_guest[$i]['session_page']];
  533.             }
  534.  
  535.             $row_color = ( $guest_users % 2 ) ? $theme['td_color1'] : $theme['td_color2'];
  536.             $row_class = ( $guest_users % 2 ) ? $theme['td_class1'] : $theme['td_class2'];
  537.  
  538.             $guest_ip = decode_ip($onlinerow_guest[$i]['session_ip']);
  539.  
  540.             $template->assign_block_vars("guest_user_row", array(
  541.                 "ROW_COLOR" => "#" . $row_color,
  542.                 "ROW_CLASS" => $row_class,
  543.                 "USERNAME" => $lang['Guest'],
  544.                 "STARTED" => create_date($board_config['default_dateformat'], $onlinerow_guest[$i]['session_start'], $board_config['board_timezone']), 
  545.                 "LASTUPDATE" => create_date($board_config['default_dateformat'], $onlinerow_guest[$i]['session_time'], $board_config['board_timezone']),
  546.                 "FORUM_LOCATION" => $location,
  547.                 "IP_ADDRESS" => $guest_ip, 
  548.  
  549.                 "U_WHOIS_IP" => "http://network-tools.com/default.asp?host=$guest_ip", 
  550.                 "U_FORUM_LOCATION" => append_sid($location_url))
  551.             );
  552.         }
  553.  
  554.     }
  555.     else
  556.     {
  557.         $template->assign_vars(array(
  558.             "L_NO_GUESTS_BROWSING" => $lang['No_users_browsing'])
  559.         );
  560.     }
  561.  
  562.     // Check for new version
  563.     $current_version = explode('.', '2' . $board_config['version']);
  564.     $minor_revision = (int) $current_version[2];
  565.  
  566.     $errno = 0;
  567.     $errstr = $version_info = '';
  568.  
  569.     if ($fsock = @fsockopen('www.phpbb.com', 80, $errno, $errstr, 10))
  570.     {
  571.         @fputs($fsock, "GET /updatecheck/20x.txt HTTP/1.1\r\n");
  572.         @fputs($fsock, "HOST: www.phpbb.com\r\n");
  573.         @fputs($fsock, "Connection: close\r\n\r\n");
  574.  
  575.         $get_info = false;
  576.         while (!@feof($fsock))
  577.         {
  578.             if ($get_info)
  579.             {
  580.                 $version_info .= @fread($fsock, 1024);
  581.             }
  582.             else
  583.             {
  584.                 if (@fgets($fsock, 1024) == "\r\n")
  585.                 {
  586.                     $get_info = true;
  587.                 }
  588.             }
  589.         }
  590.         @fclose($fsock);
  591.  
  592.         $version_info = explode("\n", $version_info);
  593.         $latest_head_revision = (int) $version_info[0];
  594.         $latest_minor_revision = (int) $version_info[2];
  595.         $latest_version = (int) $version_info[0] . '.' . (int) $version_info[1] . '.' . (int) $version_info[2];
  596.  
  597.         if ($latest_head_revision == 2 && $minor_revision == $latest_minor_revision)
  598.         {
  599.             $version_info = '<p style="color:green">' . $lang['Version_up_to_date'] . '</p>';
  600.         }
  601.         else
  602.         {
  603.             $version_info = '<p style="color:red">' . $lang['Version_not_up_to_date'];
  604.             $version_info .= '<br />' . sprintf($lang['Latest_version_info'], $latest_version) . ' ' . sprintf($lang['Current_version_info'], '2' . $board_config['version']) . '</p>';
  605.         }
  606.     }
  607.     else
  608.     {
  609.         if ($errstr)
  610.         {
  611.             $version_info = '<p style="color:red">' . sprintf($lang['Connect_socket_error'], $errstr) . '</p>';
  612.         }
  613.         else
  614.         {
  615.             $version_info = '<p>' . $lang['Socket_functions_disabled'] . '</p>';
  616.         }
  617.     }
  618.     
  619.     $version_info .= '<p>' . $lang['Mailing_list_subscribe_reminder'] . '</p>';
  620.     
  621.  
  622.     $template->assign_vars(array(
  623.         'VERSION_INFO'    => $version_info,
  624.         'L_VERSION_INFORMATION'    => $lang['Version_information'])
  625.     );
  626.  
  627.     $template->pparse("body");
  628.  
  629.     include('./page_footer_admin.'.$phpEx);
  630.  
  631. }
  632. else
  633. {
  634.     //
  635.     // Generate frameset
  636.     //
  637.     $template->set_filenames(array(
  638.         "body" => "admin/index_frameset.tpl")
  639.     );
  640.  
  641.     $template->assign_vars(array(
  642.         "S_FRAME_NAV" => append_sid("index.$phpEx?pane=left"),
  643.         "S_FRAME_MAIN" => append_sid("index.$phpEx?pane=right"))
  644.     );
  645.  
  646.     header ("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
  647.     header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  648.  
  649.     $template->pparse("body");
  650.  
  651.     $db->sql_close();
  652.     exit;
  653.  
  654. }
  655.  
  656. ?>