|
From: Paul S. O. <ps...@us...> - 2002-07-14 14:45:30
|
Update of /cvsroot/phpbb/phpBB2
In directory usw-pr-cvs1:/tmp/cvs-serv15403
Modified Files:
common.php faq.php groupcp.php index.php login.php
memberlist.php modcp.php posting.php privmsg.php profile.php
search.php viewforum.php viewonline.php viewtopic.php
Log Message:
Updates for permissions, sessions, lots of things ... note that _many_ things _do_not_work_ now ... I'm commiting them to stop people complaining about my holding on to everything :) There is _no_ update script at present for all these changes, you'll have to work out what's needed yourselves till I finish various things
Index: common.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/common.php,v
retrieving revision 1.77
retrieving revision 1.78
diff -C2 -r1.77 -r1.78
*** common.php 9 May 2002 14:07:52 -0000 1.77
--- common.php 14 Jul 2002 14:45:20 -0000 1.78
***************
*** 9,13 ****
* $Id$
*
- *
***************************************************************************/
--- 9,12 ----
***************
*** 23,27 ****
if ( !defined('IN_PHPBB') )
{
! die("Hacking attempt");
}
--- 22,26 ----
if ( !defined('IN_PHPBB') )
{
! die('Hacking attempt');
}
***************
*** 29,80 ****
set_magic_quotes_runtime(0); // Disable magic_quotes_runtime
! //
! // addslashes to vars if magic_quotes_gpc is off this is a security precaution
! // to prevent someone trying to break out of a SQL statement.
! //
! function slash_input_data(&$data)
! {
! if ( is_array($data) )
! {
! while( list($k, $v) = each($data) )
! {
! $data[$k] = ( is_array($v) ) ? slash_input_data($v) : addslashes($v);
! }
!
! @reset($data);
! }
! return $data;
! }
! if ( !get_magic_quotes_gpc() )
{
! $HTTP_GET_VARS = slash_input_data($HTTP_GET_VARS);
! $HTTP_POST_VARS = slash_input_data($HTTP_POST_VARS);
! $HTTP_COOKIE_VARS = slash_input_data($HTTP_COOKIE_VARS);
}
//
! // Define some basic configuration arrays this also prevents
! // malicious rewriting of language and otherarray values via
! // URI params
//
- $board_config = array();
- $userdata = array();
- $theme = array();
- $images = array();
- $lang = array();
- $gen_simple_header = FALSE;
-
- require($phpbb_root_path . 'config.'.$phpEx);
-
- if( !defined("PHPBB_INSTALLED") )
- {
- header("Location: install.$phpEx");
- }
-
- // Debug Level
- define('DEBUG', 1); // Debugging on
- //define('DEBUG', 0); // Debugging off
-
// User Levels <- Do not change the values of USER or ADMIN
--- 28,42 ----
set_magic_quotes_runtime(0); // Disable magic_quotes_runtime
! require($phpbb_root_path . 'config.'.$phpEx);
! if ( !defined('PHPBB_INSTALLED') )
{
! header('Location: install/install.'.$phpEx);
! exit;
}
//
! // Define some constants/variables
//
// User Levels <- Do not change the values of USER or ADMIN
***************
*** 84,92 ****
define('MOD', 2);
-
// User related
define('USER_ACTIVATION_NONE', 0);
define('USER_ACTIVATION_SELF', 1);
define('USER_ACTIVATION_ADMIN', 2);
define('USER_AVATAR_NONE', 0);
--- 46,54 ----
define('MOD', 2);
// User related
define('USER_ACTIVATION_NONE', 0);
define('USER_ACTIVATION_SELF', 1);
define('USER_ACTIVATION_ADMIN', 2);
+ define('USER_ACTIVATION_CLOSED', 3);
define('USER_AVATAR_NONE', 0);
***************
*** 95,99 ****
define('USER_AVATAR_GALLERY', 3);
-
// Group settings
define('GROUP_OPEN', 0);
--- 57,60 ----
***************
*** 101,117 ****
define('GROUP_HIDDEN', 2);
-
// Forum state
define('FORUM_UNLOCKED', 0);
define('FORUM_LOCKED', 1);
-
// Topic status
define('TOPIC_UNLOCKED', 0);
define('TOPIC_LOCKED', 1);
define('TOPIC_MOVED', 2);
- define('TOPIC_WATCH_NOTIFIED', 1);
- define('TOPIC_WATCH_UN_NOTIFIED', 0);
-
// Topic types
--- 62,73 ----
***************
*** 119,136 ****
define('POST_STICKY', 1);
define('POST_ANNOUNCE', 2);
- define('POST_GLOBAL_ANNOUNCE', 3);
-
-
- // SQL codes
- define('BEGIN_TRANSACTION', 1);
- define('END_TRANSACTION', 2);
-
// Error codes
! define('GENERAL_MESSAGE', 200);
! define('GENERAL_ERROR', 202);
! define('CRITICAL_MESSAGE', 203);
! define('CRITICAL_ERROR', 204);
!
// Private messaging
--- 75,82 ----
define('POST_STICKY', 1);
define('POST_ANNOUNCE', 2);
// Error codes
! define('MESSAGE', 200);
! define('ERROR', 201);
// Private messaging
***************
*** 142,211 ****
define('PRIVMSGS_UNREAD_MAIL', 5);
-
- // URL PARAMETERS
- define('POST_TOPIC_URL', 't');
- define('POST_CAT_URL', 'c');
- define('POST_FORUM_URL', 'f');
- define('POST_USERS_URL', 'u');
- define('POST_POST_URL', 'p');
- define('POST_GROUPS_URL', 'g');
-
// Session parameters
define('SESSION_METHOD_COOKIE', 100);
define('SESSION_METHOD_GET', 101);
-
- // Page numbers for session handling
- define('PAGE_INDEX', 0);
- define('PAGE_LOGIN', -1);
- define('PAGE_SEARCH', -2);
- define('PAGE_REGISTER', -3);
- define('PAGE_PROFILE', -4);
- define('PAGE_VIEWONLINE', -6);
- define('PAGE_VIEWMEMBERS', -7);
- define('PAGE_FAQ', -8);
- define('PAGE_POSTING', -9);
- define('PAGE_PRIVMSGS', -10);
- define('PAGE_GROUPCP', -11);
- define('PAGE_TOPIC_OFFSET', 5000);
-
-
- // Auth settings
- define('AUTH_LIST_ALL', 0);
- define('AUTH_ALL', 0);
-
- define('AUTH_REG', 1);
- define('AUTH_ACL', 2);
- define('AUTH_MOD', 3);
- define('AUTH_ADMIN', 5);
-
- define('AUTH_VIEW', 1);
- define('AUTH_READ', 2);
- define('AUTH_POST', 3);
- define('AUTH_REPLY', 4);
- define('AUTH_EDIT', 5);
- define('AUTH_DELETE', 6);
- define('AUTH_ANNOUNCE', 7);
- define('AUTH_STICKY', 8);
- define('AUTH_POLLCREATE', 9);
- define('AUTH_VOTE', 10);
- define('AUTH_ATTACH', 11);
-
-
// Table names
! define('AUTH_ACCESS_TABLE', $table_prefix.'auth_access');
define('BANLIST_TABLE', $table_prefix.'banlist');
! define('CATEGORIES_TABLE', $table_prefix.'categories');
define('CONFIG_TABLE', $table_prefix.'config');
! define('DISALLOW_TABLE', $table_prefix.'disallow');
define('FORUMS_TABLE', $table_prefix.'forums');
define('FORUMS_WATCH_TABLE', $table_prefix.'forums_watch');
define('GROUPS_TABLE', $table_prefix.'groups');
define('POSTS_TABLE', $table_prefix.'posts');
define('POSTS_TEXT_TABLE', $table_prefix.'posts_text');
define('PRIVMSGS_TABLE', $table_prefix.'privmsgs');
define('PRIVMSGS_TEXT_TABLE', $table_prefix.'privmsgs_text');
- define('PRIVMSGS_IGNORE_TABLE', $table_prefix.'privmsgs_ignore');
- define('PRUNE_TABLE', $table_prefix.'forum_prune');
define('RANKS_TABLE', $table_prefix.'ranks');
define('SEARCH_TABLE', $table_prefix.'search_results');
--- 88,114 ----
define('PRIVMSGS_UNREAD_MAIL', 5);
// Session parameters
define('SESSION_METHOD_COOKIE', 100);
define('SESSION_METHOD_GET', 101);
// Table names
! define('ACL_GROUPS_TABLE', $table_prefix.'auth_groups');
! define('ACL_OPTIONS_TABLE', $table_prefix.'auth_options');
! define('ACL_PREFETCH_TABLE', $table_prefix.'auth_prefetch');
! define('ACL_USERS_TABLE', $table_prefix.'auth_users');
define('BANLIST_TABLE', $table_prefix.'banlist');
! define('CATEGORIES_TABLE', $table_prefix.'categories'); //
define('CONFIG_TABLE', $table_prefix.'config');
! define('DISALLOW_TABLE', $table_prefix.'disallow'); //
define('FORUMS_TABLE', $table_prefix.'forums');
define('FORUMS_WATCH_TABLE', $table_prefix.'forums_watch');
define('GROUPS_TABLE', $table_prefix.'groups');
+ define('ICONS_TABLE', $table_prefix.'icons');
+ define('LOG_ADMIN_TABLE', $table_prefix.'log_admin');
+ define('LOG_MOD_TABLE', $table_prefix.'log_moderators');
define('POSTS_TABLE', $table_prefix.'posts');
define('POSTS_TEXT_TABLE', $table_prefix.'posts_text');
define('PRIVMSGS_TABLE', $table_prefix.'privmsgs');
define('PRIVMSGS_TEXT_TABLE', $table_prefix.'privmsgs_text');
define('RANKS_TABLE', $table_prefix.'ranks');
define('SEARCH_TABLE', $table_prefix.'search_results');
***************
*** 214,220 ****
define('SESSIONS_TABLE', $table_prefix.'sessions');
define('SMILIES_TABLE', $table_prefix.'smilies');
! define('THEMES_TABLE', $table_prefix.'themes');
! define('THEMES_NAME_TABLE', $table_prefix.'themes_name');
define('TOPICS_TABLE', $table_prefix.'topics');
define('TOPICS_WATCH_TABLE', $table_prefix.'topics_watch');
define('USER_GROUP_TABLE', $table_prefix.'user_group');
--- 117,126 ----
define('SESSIONS_TABLE', $table_prefix.'sessions');
define('SMILIES_TABLE', $table_prefix.'smilies');
! define('STYLES_TABLE', $table_prefix.'styles');
! define('STYLES_TPL_TABLE', $table_prefix.'styles_template');
! define('STYLES_CSS_TABLE', $table_prefix.'styles_theme');
! define('STYLES_IMAGE_TABLE', $table_prefix.'styles_imageset');
define('TOPICS_TABLE', $table_prefix.'topics');
+ define('TOPICS_RATINGS_TABLE', $table_prefix.'topics_rating');
define('TOPICS_WATCH_TABLE', $table_prefix.'topics_watch');
define('USER_GROUP_TABLE', $table_prefix.'user_group');
***************
*** 225,303 ****
define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');
! include($phpbb_root_path . 'includes/template.'.$phpEx);
! include($phpbb_root_path . 'includes/sessions.'.$phpEx);
! include($phpbb_root_path . 'includes/auth.'.$phpEx);
! include($phpbb_root_path . 'includes/functions.'.$phpEx);
!
! switch($dbms)
{
! case 'mysql':
! include($phpbb_root_path . 'db/mysql.'.$phpEx);
! break;
!
! case 'mysql4':
! include($phpbb_root_path . 'db/mysql4.'.$phpEx);
! break;
!
! case 'postgres':
! include($phpbb_root_path . 'db/postgres7.'.$phpEx);
! break;
!
! case 'mssql':
! include($phpbb_root_path . 'db/mssql.'.$phpEx);
! break;
!
! case 'oracle':
! include($phpbb_root_path . 'db/oracle.'.$phpEx);
! break;
!
! case 'msaccess':
! include($phpbb_root_path . 'db/msaccess.'.$phpEx);
! break;
!
! case 'mssql-odbc':
! include($phpbb_root_path . 'db/mssql-odbc.'.$phpEx);
! break;
}
! // Make the database connection.
! $db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false);
! if ( !$db->db_connect_id )
! {
! message_die(CRITICAL_ERROR, "Could not connect to the database");
! }
//
! // Mozilla navigation bar
! // Default items that should be valid on all pages.
! // Defined here and not in page_header.php so they can be redefined in the code
! //
! $nav_links['top'] = array (
! 'url' => append_sid($phpbb_root_dir."index.".$phpEx),
! 'title' => sprintf($lang['Forum_Index'], $board_config['sitename'])
! );
! $nav_links['search'] = array (
! 'url' => append_sid($phpbb_root_dir."search.".$phpEx),
! 'title' => $lang['Search']
! );
! $nav_links['help'] = array (
! 'url' => append_sid($phpbb_root_dir."faq.".$phpEx),
! 'title' => $lang['FAQ']
! );
! $nav_links['author'] = array (
! 'url' => append_sid($phpbb_root_dir."memberlist.".$phpEx),
! 'title' => $lang['Memberlist']
! );
//
! // Obtain and encode users IP
//
! if( getenv('HTTP_X_FORWARDED_FOR') != '' )
{
$user_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : $REMOTE_ADDR );
! if ( preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", getenv('HTTP_X_FORWARDED_FOR'), $ip_list) )
{
! $private_ip = array('/^127\.0\.0\.1/', '/^192\.168\..*/', '/^172\.16\..*/', '/^10..*/', '/^224..*/', '/^240..*/');
$user_ip = preg_replace($private_ip, $client_ip, $ip_list[1]);
}
--- 131,169 ----
define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');
! if ( !get_magic_quotes_gpc() )
{
! $HTTP_GET_VARS = slash_input_data($HTTP_GET_VARS);
! $HTTP_POST_VARS = slash_input_data($HTTP_POST_VARS);
! $HTTP_COOKIE_VARS = slash_input_data($HTTP_COOKIE_VARS);
}
! $board_config = array();
! $userdata = array();
! $theme = array();
! $images = array();
! $lang = array();
//
! // Include files
! //
! require($phpbb_root_path . 'includes/template.'.$phpEx);
! require($phpbb_root_path . 'includes/session.'.$phpEx);
! require($phpbb_root_path . 'includes/functions.'.$phpEx);
! require($phpbb_root_path . 'db/' . $dbms . '.'.$phpEx);
!
! $session = new session();
! $db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
//
! // Obtain users IP, not encoded in 2.2
//
! if ( $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'] != '' || $HTTP_ENV_VARS['HTTP_X_FORWARDED_FOR'] != '' )
{
$user_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : $REMOTE_ADDR );
+ $x_ip = ( !empty($HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR']) ) ? $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'] : $HTTP_ENV_VARS['HTTP_X_FORWARDED_FOR'];
! if ( preg_match('/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/', $x_ip, $ip_list) )
{
! $private_ip = array('/^0\./', '/^127\.0\.0\.1/', '/^192\.168\..*/', '/^172\.16\..*/', '/^10\..*/', '/^224\..*/', '/^240\..*/');
$user_ip = preg_replace($private_ip, $client_ip, $ip_list[1]);
}
***************
*** 309,324 ****
//
! // Setup forum wide options, if this fails
! // then we output a CRITICAL_ERROR since
// basic forum information is not available
//
$sql = "SELECT *
FROM " . CONFIG_TABLE;
! if ( !($result = $db->sql_query($sql)) )
! {
! message_die(CRITICAL_ERROR, 'Could not query config information', '', __LINE__, __FILE__, $sql);
! }
! while($row = $db->sql_fetchrow($result))
{
$board_config[$row['config_name']] = $row['config_value'];
--- 175,186 ----
//
! // Setup forum wide options, if this fails we output a CRITICAL_ERROR since
// basic forum information is not available
//
$sql = "SELECT *
FROM " . CONFIG_TABLE;
! $result = $db->sql_query($sql);
! while ( $row = $db->sql_fetchrow($result) )
{
$board_config[$row['config_name']] = $row['config_value'];
***************
*** 330,334 ****
if ( $board_config['board_disable'] && !defined('IN_ADMIN') && !defined('IN_LOGIN') )
{
! message_die(GENERAL_MESSAGE, 'Board_disable', 'Information');
}
--- 192,215 ----
if ( $board_config['board_disable'] && !defined('IN_ADMIN') && !defined('IN_LOGIN') )
{
! $message = ( !empty($board_config['board_disable_msg']) ) ? $board_config['board_disable_msg'] : 'Board_disable';
! message_die(MESSAGE, $message, 'Information');
! }
!
! //
! // addslashes to vars if magic_quotes_gpc is off this is a security precaution
! // to prevent someone trying to break out of a SQL statement.
! //
! function slash_input_data(&$data)
! {
! if ( is_array($data) )
! {
! while ( list($k, $v) = each($data) )
! {
! $data[$k] = ( is_array($v) ) ? slash_input_data($v) : addslashes($v);
! }
!
! @reset($data);
! }
! return $data;
}
Index: faq.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/faq.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** faq.php 31 Mar 2002 00:06:33 -0000 1.14
--- faq.php 14 Jul 2002 14:45:20 -0000 1.15
***************
*** 29,34 ****
// Start session management
//
! $userdata = session_pagestart($user_ip, PAGE_FAQ);
! init_userprefs($userdata);
//
// End session management
--- 29,34 ----
// Start session management
//
! $userdata = $session->start();
! $acl = new auth('list', $userdata);
//
// End session management
***************
*** 36,42 ****
//
// Load the appropriate faq file
//
! if( isset($HTTP_GET_VARS['mode']) )
{
switch( $HTTP_GET_VARS['mode'] )
--- 36,47 ----
//
+ // Configure style, language, etc.
+ //
+ $session->configure($userdata);
+
+ //
// Load the appropriate faq file
//
! if ( isset($HTTP_GET_VARS['mode']) )
{
switch( $HTTP_GET_VARS['mode'] )
***************
*** 70,74 ****
for($i = 0; $i < count($faq); $i++)
{
! if( $faq[$i][0] != '--' )
{
$faq_block[$j][$counter]['id'] = $counter_2;
--- 75,79 ----
for($i = 0; $i < count($faq); $i++)
{
! if ( $faq[$i][0] != '--' )
{
$faq_block[$j][$counter]['id'] = $counter_2;
***************
*** 92,103 ****
// Lets build a page ...
//
- $page_title = $l_title;
- include($phpbb_root_path . 'includes/page_header.'.$phpEx);
-
- $template->set_filenames(array(
- 'body' => 'faq_body.tpl')
- );
- make_jumpbox('viewforum.'.$phpEx, $forum_id);
-
$template->assign_vars(array(
'L_FAQ_TITLE' => $l_title,
--- 97,100 ----
***************
*** 107,111 ****
for($i = 0; $i < count($faq_block); $i++)
{
! if( count($faq_block[$i]) )
{
$template->assign_block_vars('faq_block', array(
--- 104,108 ----
for($i = 0; $i < count($faq_block); $i++)
{
! if ( count($faq_block[$i]) )
{
$template->assign_block_vars('faq_block', array(
***************
*** 122,125 ****
--- 119,123 ----
$template->assign_block_vars('faq_block.faq_row', array(
+ 'ROW_COUNT' => $j,
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
***************
*** 131,134 ****
--- 129,133 ----
$template->assign_block_vars('faq_block_link.faq_row_link', array(
+ 'ROW_COUNT' => $j,
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
***************
*** 141,145 ****
}
! $template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
--- 140,150 ----
}
! $page_title = $l_title;
! include($phpbb_root_path . 'includes/page_header.'.$phpEx);
!
! $template->set_filenames(array(
! 'body' => 'faq_body.html')
! );
! make_jumpbox('viewforum.'.$phpEx, $forum_id);
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
Index: groupcp.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/groupcp.php,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -r1.59 -r1.60
*** groupcp.php 20 Apr 2002 00:22:27 -0000 1.59
--- groupcp.php 14 Jul 2002 14:45:20 -0000 1.60
***************
*** 112,117 ****
// Start session management
//
! $userdata = session_pagestart($user_ip, PAGE_GROUPCP);
! init_userprefs($userdata);
//
// End session management
--- 112,117 ----
// Start session management
//
! $userdata = $session->start();
! $acl = new auth('list', $userdata);
//
// End session management
***************
*** 167,171 ****
if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, 'Could not obtain user and group information', '', __LINE__, __FILE__, $sql);
}
--- 167,171 ----
if ( !($result = $db->sql_query($sql)) )
{
! message_die(ERROR, 'Could not obtain user and group information', '', __LINE__, __FILE__, $sql);
}
***************
*** 180,184 ****
$message = $lang['Not_group_moderator'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
! message_die(GENERAL_MESSAGE, $message);
}
--- 180,184 ----
$message = $lang['Not_group_moderator'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
! message_die(MESSAGE, $message);
}
***************
*** 188,192 ****
if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, 'Could not obtain user and group information', '', __LINE__, __FILE__, $sql);
}
--- 188,192 ----
if ( !($result = $db->sql_query($sql)) )
{
! message_die(ERROR, 'Could not obtain user and group information', '', __LINE__, __FILE__, $sql);
}
***************
*** 197,201 ****
$message = $lang['Group_type_updated'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
! message_die(GENERAL_MESSAGE, $message);
}
--- 197,201 ----
$message = $lang['Group_type_updated'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
! message_die(MESSAGE, $message);
}
***************
*** 218,222 ****
if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, 'Could not obtain user and group information', '', __LINE__, __FILE__, $sql);
}
--- 218,222 ----
if ( !($result = $db->sql_query($sql)) )
{
! message_die(ERROR, 'Could not obtain user and group information', '', __LINE__, __FILE__, $sql);
}
***************
*** 235,239 ****
$message = $lang['Already_member_group'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
! message_die(GENERAL_MESSAGE, $message);
}
} while ( $row = $db->sql_fetchrow($result) );
--- 235,239 ----
$message = $lang['Already_member_group'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
! message_die(MESSAGE, $message);
}
} while ( $row = $db->sql_fetchrow($result) );
***************
*** 247,256 ****
$message = $lang['This_closed_group'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
! message_die(GENERAL_MESSAGE, $message);
}
}
else
{
! message_die(GENERAL_MESSAGE, $lang['No_groups_exist']);
}
--- 247,256 ----
$message = $lang['This_closed_group'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
! message_die(MESSAGE, $message);
}
}
else
{
! message_die(MESSAGE, $lang['No_groups_exist']);
}
***************
*** 259,263 ****
if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, "Error inserting user group subscription", "", __LINE__, __FILE__, $sql);
}
--- 259,263 ----
if ( !($result = $db->sql_query($sql)) )
{
! message_die(ERROR, "Error inserting user group subscription", "", __LINE__, __FILE__, $sql);
}
***************
*** 268,272 ****
if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, "Error getting group moderator data", "", __LINE__, __FILE__, $sql);
}
--- 268,272 ----
if ( !($result = $db->sql_query($sql)) )
{
! message_die(ERROR, "Error getting group moderator data", "", __LINE__, __FILE__, $sql);
}
***************
*** 299,303 ****
$message = $lang['Group_joined'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
! message_die(GENERAL_MESSAGE, $message);
}
else if ( isset($HTTP_POST_VARS['unsub']) || isset($HTTP_POST_VARS['unsubpending']) && $group_id )
--- 299,303 ----
$message = $lang['Group_joined'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
! message_die(MESSAGE, $message);
}
else if ( isset($HTTP_POST_VARS['unsub']) || isset($HTTP_POST_VARS['unsubpending']) && $group_id )
***************
*** 323,327 ****
if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, 'Could not delete group memebership data', '', __LINE__, __FILE__, $sql);
}
--- 323,327 ----
if ( !($result = $db->sql_query($sql)) )
{
! message_die(ERROR, 'Could not delete group memebership data', '', __LINE__, __FILE__, $sql);
}
***************
*** 335,339 ****
if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, 'Could not obtain moderator status', '', __LINE__, __FILE__, $sql);
}
--- 335,339 ----
if ( !($result = $db->sql_query($sql)) )
{
! message_die(ERROR, 'Could not obtain moderator status', '', __LINE__, __FILE__, $sql);
}
***************
*** 345,349 ****
if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql);
}
}
--- 345,349 ----
if ( !($result = $db->sql_query($sql)) )
{
! message_die(ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql);
}
}
***************
*** 356,360 ****
$message = $lang['Usub_success'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
! message_die(GENERAL_MESSAGE, $message);
}
else
--- 356,360 ----
$message = $lang['Usub_success'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
! message_die(MESSAGE, $message);
}
else
***************
*** 438,442 ****
if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, 'Could not get moderator information', '', __LINE__, __FILE__, $sql);
}
--- 438,442 ----
if ( !($result = $db->sql_query($sql)) )
{
! message_die(ERROR, 'Could not get moderator information', '', __LINE__, __FILE__, $sql);
}
***************
*** 468,472 ****
$message = $lang['Not_group_moderator'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
! message_die(GENERAL_MESSAGE, $message);
}
--- 468,472 ----
$message = $lang['Not_group_moderator'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
! message_die(MESSAGE, $message);
}
***************
*** 480,484 ****
if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, "Could not get user information", $lang['Error'], __LINE__, __FILE__, $sql);
}
--- 480,484 ----
if ( !($result = $db->sql_query($sql)) )
{
! message_die(ERROR, "Could not get user information", $lang['Error'], __LINE__, __FILE__, $sql);
}
***************
*** 491,495 ****
$message = $lang['Could_not_add_user'] . "<br /><br />" . sprintf($lang['Click_return_group'], "<a href=\"" . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_index'], "<a href=\"" . append_sid("index.$phpEx") . "\">", "</a>");
! message_die(GENERAL_MESSAGE, $message);
}
--- 491,495 ----
$message = $lang['Could_not_add_user'] . "<br /><br />" . sprintf($lang['Click_return_group'], "<a href=\"" . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_index'], "<a href=\"" . append_sid("index.$phpEx") . "\">", "</a>");
! message_die(MESSAGE, $message);
}
***************
*** 502,506 ****
$message = $lang['Could_not_anon_user'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
! message_die(GENERAL_MESSAGE, $message);
}
--- 502,506 ----
$message = $lang['Could_not_anon_user'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
! message_die(MESSAGE, $message);
}
***************
*** 512,516 ****
if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, 'Could not get user information', '', __LINE__, __FILE__, $sql);
}
--- 512,516 ----
if ( !($result = $db->sql_query($sql)) )
{
! message_die(ERROR, 'Could not get user information', '', __LINE__, __FILE__, $sql);
}
***************
*** 521,525 ****
if ( !$db->sql_query($sql) )
{
! message_die(GENERAL_ERROR, 'Could not add user to group', '', __LINE__, __FILE__, $sql);
}
--- 521,525 ----
if ( !$db->sql_query($sql) )
{
! message_die(ERROR, 'Could not add user to group', '', __LINE__, __FILE__, $sql);
}
***************
*** 531,535 ****
if ( !$db->sql_query($sql) )
{
! message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql);
}
}
--- 531,535 ----
if ( !$db->sql_query($sql) )
{
! message_die(ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql);
}
}
***************
*** 544,548 ****
if ( !($result = $db->sql_query($group_sql)) )
{
! message_die(GENERAL_ERROR, 'Could not get group information', '', __LINE__, __FILE__, $group_sql);
}
--- 544,548 ----
if ( !($result = $db->sql_query($group_sql)) )
{
! message_die(ERROR, 'Could not get group information', '', __LINE__, __FILE__, $group_sql);
}
***************
*** 579,583 ****
$message = $lang['User_is_member_group'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
! message_die(GENERAL_MESSAGE, $message);
}
}
--- 579,583 ----
$message = $lang['User_is_member_group'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
! message_die(MESSAGE, $message);
}
}
***************
*** 605,609 ****
if ( !$db->sql_query($sql) )
{
! message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql);
}
}
--- 605,609 ----
if ( !$db->sql_query($sql) )
{
! message_die(ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql);
}
}
***************
*** 630,634 ****
if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, 'Could not obtain moderator status', '', __LINE__, __FILE__, $sql);
}
--- 630,634 ----
if ( !($result = $db->sql_query($sql)) )
{
! message_die(ERROR, 'Could not obtain moderator status', '', __LINE__, __FILE__, $sql);
}
***************
*** 660,664 ****
if ( !$db->sql_query($sql) )
{
! message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql);
}
}
--- 660,664 ----
if ( !$db->sql_query($sql) )
{
! message_die(ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql);
}
}
***************
*** 673,677 ****
if ( !$db->sql_query($sql) )
{
! message_die(GENERAL_ERROR, 'Could not update user group table', '', __LINE__, __FILE__, $sql);
}
--- 673,677 ----
if ( !$db->sql_query($sql) )
{
! message_die(ERROR, 'Could not update user group table', '', __LINE__, __FILE__, $sql);
}
***************
*** 683,687 ****
if ( !($result = $db->sql_query($sql_select)) )
{
! message_die(GENERAL_ERROR, 'Could not get user email information', '', __LINE__, __FILE__, $sql);
}
--- 683,687 ----
if ( !($result = $db->sql_query($sql_select)) )
{
! message_die(ERROR, 'Could not get user email information', '', __LINE__, __FILE__, $sql);
}
***************
*** 700,704 ****
if ( !($result = $db->sql_query($group_sql)) )
{
! message_die(GENERAL_ERROR, 'Could not get group information', '', __LINE__, __FILE__, $group_sql);
}
--- 700,704 ----
if ( !($result = $db->sql_query($group_sql)) )
{
! message_die(ERROR, 'Could not get group information', '', __LINE__, __FILE__, $group_sql);
}
***************
*** 735,739 ****
else
{
! message_die(GENERAL_MESSAGE, $lang['No_groups_exist']);
}
--- 735,739 ----
else
{
! message_die(MESSAGE, $lang['No_groups_exist']);
}
***************
*** 747,756 ****
if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql);
}
if ( !($group_info = $db->sql_fetchrow($result)) )
{
! message_die(GENERAL_MESSAGE, $lang['Group_not_exist']);
}
--- 747,756 ----
if ( !($result = $db->sql_query($sql)) )
{
! message_die(ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql);
}
if ( !($group_info = $db->sql_fetchrow($result)) )
{
! message_die(MESSAGE, $lang['Group_not_exist']);
}
***************
*** 763,767 ****
if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, 'Error getting user list for group', '', __LINE__, __FILE__, $sql);
}
--- 763,767 ----
if ( !($result = $db->sql_query($sql)) )
{
! message_die(ERROR, 'Error getting user list for group', '', __LINE__, __FILE__, $sql);
}
***************
*** 780,784 ****
if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, 'Error getting user list for group', '', __LINE__, __FILE__, $sql);
}
--- 780,784 ----
if ( !($result = $db->sql_query($sql)) )
{
! message_die(ERROR, 'Error getting user list for group', '', __LINE__, __FILE__, $sql);
}
***************
*** 796,800 ****
if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, 'Error getting user pending information', '', __LINE__, __FILE__, $sql);
}
--- 796,800 ----
if ( !($result = $db->sql_query($sql)) )
{
! message_die(ERROR, 'Error getting user pending information', '', __LINE__, __FILE__, $sql);
}
***************
*** 1154,1158 ****
if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql);
}
--- 1154,1158 ----
if ( !($result = $db->sql_query($sql)) )
{
! message_die(ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql);
}
***************
*** 1193,1197 ****
if ( !($result = $db->sql_query($sql)) )
{
! message_die(GENERAL_ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql);
}
--- 1193,1197 ----
if ( !($result = $db->sql_query($sql)) )
{
! message_die(ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql);
}
***************
*** 1262,1266 ****
else
{
! message_die(GENERAL_MESSAGE, $lang['No_groups_exist']);
}
--- 1262,1266 ----
else
{
! message_die(MESSAGE, $lang['No_groups_exist']);
}
Index: index.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/index.php,v
retrieving revision 1.100
retrieving revision 1.101
diff -C2 -r1.100 -r1.101
*** index.php 30 Apr 2002 17:56:50 -0000 1.100
--- index.php 14 Jul 2002 14:45:20 -0000 1.101
***************
*** 9,13 ****
* $Id$
*
- *
***************************************************************************/
--- 9,12 ----
***************
*** 29,41 ****
// Start session management
//
! $userdata = session_pagestart($user_ip, PAGE_INDEX);
! init_userprefs($userdata);
//
// End session management
//
! $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'];
--- 28,46 ----
// Start session management
//
! $userdata = $session->start();
! $acl = new auth('list', $userdata);
//
// End session management
//
! //
! // Configure style, language, etc.
! //
! $session->configure($userdata);
!
! $viewcat = ( !empty($HTTP_GET_VARS['c']) ) ? intval($HTTP_GET_VARS['c']) : -1;
! $forum_id = ( !empty($HTTP_GET_VARS['f']) ) ? intval($HTTP_GET_VARS['f']) : 0;
! 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'];
***************
*** 49,55 ****
// 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']);
--- 54,60 ----
// Handle marking posts
//
! if ( $mark_read == 'forums' )
{
! if ( $userdata['user_id'] != ANONYMOUS )
{
setcookie($board_config['cookie_name'] . '_f_all', time(), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
***************
*** 57,66 ****
$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);
}
//
--- 62,70 ----
$template->assign_vars(array(
! 'META' => '<meta http-equiv="refresh" content="3;url=' . "index.$phpEx$SID" . '">')
);
! $message = $lang['Forums_marked_read'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . "index.$phpEx$SID" . '">', '</a> ');
! message_die(MESSAGE, $message);
}
//
***************
*** 68,73 ****
//
! $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();
//
--- 72,77 ----
//
! $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();
//
***************
*** 76,92 ****
//
$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'];
$total_users = $board_config['num_users'];
$newest_user = $board_config['newest_username'];
$newest_uid = $board_config['newest_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'];
--- 80,92 ----
//
$total_posts = get_db_stat('postcount');
$total_users = $board_config['num_users'];
$newest_user = $board_config['newest_username'];
$newest_uid = $board_config['newest_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'];
***************
*** 97,105 ****
}
! 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'];
--- 97,105 ----
}
! 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'];
***************
*** 111,114 ****
--- 111,282 ----
+ /*
+ switch ( SQL_LAYER )
+ {
+ case 'oracle':
+ break;
+
+ default:
+ $sql = "SELECT f1.*, p.post_time, p.post_username, u.username, u.user_id
+ FROM ((( " . FORUMS_TABLE . " f1
+ LEFT JOIN " . FORUMS_TABLE . " f2
+ LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f2.forum_last_post_id )
+ LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )
+ WHERE f1.forum_left_id BETWEEN f2.forum_left_id AND f2.forum_right_id
+ ORDER BY f2.forum_id";
+ break;
+ }
+ $result = $db->sql_query($sql);
+
+ $forum_data = array();
+ if ( $row = $db->sql_fetchrow($result) )
+ {
+ do
+ {
+ $forum_data[] = $row;
+ }
+ while ( $row = $db->sql_fetchrow($result) );
+
+ $total_forums = sizeof($forum_data);
+ }
+
+ if ( $total_forums > 1 )
+ {
+ $last_forum_right_id = 0;
+ for( $i = 0; $i < $total_forums; $i++)
+ {
+ $row_forum_id = $forum_data[$i]['forum_id'];
+
+ //
+ // A non-postable forum on the index is treated as a category
+ //
+ if ( $forum_data[$i]['forum_status'] == 2 || $row_forum_id == $forum_id )
+ {
+ $template->assign_block_vars('catrow', array(
+ 'CAT_ID' => $forum_id,
+ 'CAT_DESC' => $forum_data[$i]['forum_name'],
+ 'U_VIEWCAT' => "index.$phpEx?$SID&" . POST_FORUM_URL . "=$forum_id")
+ );
+
+ $current_parent = $row_forum_id;
+ }
+ else
+ {
+ if ( $forum_data[$i]['parent_id'] == $current_parent )
+ {
+ if ( $acl->get_acl($row_forum_id, 'forum', 'list') )
+ {
+ if ( $forum_data[$i]['forum_status'] == FORUM_LOCKED )
+ {
+ $folder_image = $theme['forum_locked'];
+ $folder_alt = $lang['Forum_locked'];
+ }
+ else
+ {
+ $unread_topics = false;
+ if ( $userdata['user_id'] != ANONYMOUS )
+ {
+ if ( !empty($new_topic_data[$row_forum_id]) )
+ {
+ $forum_last_post_time = 0;
+
+ while( list($check_topic_id, $check_post_time) = @each($new_topic_data[$row_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[$row_forum_id]) )
+ {
+ if ( $tracking_forums[$row_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 ) ? $theme['forum_new'] : $theme['forum'];
+ $folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts'];
+ }
+
+ $posts = $forum_data[$i]['forum_posts'];
+ $topics = $forum_data[$i]['forum_topics'];
+
+ if ( $forum_data[$i]['forum_last_post_id'] )
+ {
+ $last_post_time = create_date($board_config['default_dateformat'], $forum_data[$i]['post_time'], $board_config['board_timezone']);
+
+ $last_post = $last_post_time . '<br />';
+
+ $last_post .= ( $forum_data[$i]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$i]['post_username'] != '' ) ? $forum_data[$i]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . "profile.$phpEx$SID&mode=viewprofile&" . POST_USERS_URL . '=' . $forum_data[$i]['user_id'] . '">' . $forum_data[$i]['username'] . '</a> ';
+
+ $last_post .= '<a href="' . "viewtopic.$phpEx$SID&" . POST_POST_URL . '=' . $forum_data[$i]['forum_last_post_id'] . '#' . $forum_data[$i]['forum_last_post_id'] . '"><img src="' . $theme['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
+ }
+ else
+ {
+ $last_post = $lang['No_Posts'];
+ }
+
+ if ( count($forum_moderators[$row_forum_id]) > 0 )
+ {
+ $l_moderators = ( count($forum_moderators[$row_forum_id]) == 1 ) ? $lang['Moderator'] : $lang['Moderators'];
+ $moderator_list = implode(', ', $forum_moderators[$row_forum_id]);
+ }
+ else
+ {
+ $l_moderators = ' ';
+ $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[$i]['forum_name'],
+ 'FORUM_DESC' => $forum_data[$i]['forum_desc'],
+ 'POSTS' => $forum_data[$i]['forum_posts'],
+ 'TOPICS' => $forum_data[$i]['forum_topics'],
+ 'LAST_POST' => $last_post,
+ 'MODERATORS' => $moderator_list,
+
+ 'L_MODERATOR' => $l_moderators,
+ 'L_FORUM_FOLDER_ALT' => $folder_alt,
+
+ 'U_VIEWFORUM' => "viewforum.$phpEx$SID&" . POST_FORUM_URL . "=$row_forum_id")
+ );
+ }
+ }
+ }
+ }
+
+ $template->assign_var_from_handle('SUB_FORUM', 'forum');
+ }
+ */
+
//
// Start page proper
***************
*** 117,151 ****
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);
! }
! while( $category_rows[] = $db->sql_fetchrow($result) );
! 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
--- 285,299 ----
FROM " . CATEGORIES_TABLE . " c
ORDER BY c.cat_order";
! $result = $db->sql_query($sql);
! while ( $category_rows[] = $db->sql_fetchrow($result) );
! if ( ( $total_categories = count($category_rows) ) )
{
//
// Define appropriate SQL
//
! switch ( SQL_LAYER )
{
case 'oracle':
$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
***************
*** 164,188 ****
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;
}
- if ( !($total_forums = count($forum_data)) )
- {
- message_die(GENERAL_MESSAGE, $lang['No_forums']);
- }
-
//
// Obtain a list of topic ids which contain
// posts made since user last visited
//
! if ( $userdata['session_logged_in'] )
{
$sql = "SELECT t.forum_id, t.topic_id, p.post_time
--- 312,328 ----
break;
}
! $result = $db->sql_query($sql);
$forum_data = array();
! while ( $row = $db->sql_fetchrow($result) )
{
$forum_data[] = $row;
}
//
// Obtain a list of topic ids which contain
// posts made since user last visited
//
! /* if ( $userdata['user_id'] != ANONYMOUS )
{
$sql = "SELECT t.forum_id, t.topic_id, p.post_time
***************
*** 191,198 ****
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();
--- 331,335 ----
AND p.post_time > " . $userdata['user_lastvisit'] . "
AND t.topic_moved_id = 0";
! $result = $db->sql_query($sql);
$new_topic_data = array();
***************
*** 202,273 ****
}
}
!
//
// 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&" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</a>';
! }
!
! $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>';
! }
!
! //
! // 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
! //
! $page_title = $lang['Index'];
! include($phpbb_root_path . 'includes/page_header.'.$phpEx);
!
! $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&" . 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'],
--- 339,358 ----
}
}
! */
//
// Obtain list of moderators of each forum
// First users, then groups ... broken into two queries
//
$forum_moderators = array();
! get_moderators($forum_moderators);
$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="' . "profile.$phpEx$SID&mode=viewprofile&u=$newest_uid" . '">', $newest_user, '</a>'),
! 'FORUM_IMG' => create_img($theme['forum'], $lang['No_new_posts']),
! 'FORUM_NEW_IMG' => create_img($theme['forum_new'], $lang['New_posts']),
! 'FORUM_LOCKED_IMG' => create_img($theme['forum_locked'], $lang['No_new_posts_locked']),
'L_FORUM' => $lang['Forum'],
***************
*** 283,291 ****
'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"))
);
--- 368,380 ----
'L_ONLINE_EXPLAIN' => $lang['Online_explain'],
! 'L_VIEW_MODERATORS' => $lang['View_moderators'],
'L_FORUM_LOCKED' => $lang['Forum_is_locked'],
'L_MARK_FORUMS_READ' => $lang['Mark_all_forums'],
+ 'L_LEGEND' => $lang['Legend'],
+ 'L_NO_FORUMS' => $lang['No_forums'],
! 'S_LEGEND' => $legend,
!
! 'U_MARK_READ' => "index.$phpEx$SID&mark=forums")
);
***************
*** 301,307 ****
//
$display_forums = false;
! for($j = 0; $j < $total_forums; $j++)
{
! if ( $is_auth_ary[$forum_data[$j]['forum_id']]['auth_view'] && $forum_data[$j]['cat_id'] == $cat_id )
{
$display_forums = true;
--- 390,396 ----
//
$display_forums = false;
! for($j = 0; $j < sizeof($forum_data); $j++)
{
! if ( $acl->get_acl($forum_data[$j]['forum_id'], 'forum', 'list') && $forum_data[$j]['cat_id'] == $cat_id )
{
$display_forums = true;
***************
*** 318,337 ****
'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'] )
{
if ( $forum_data[$j]['forum_status'] == FORUM_LOCKED )
{
! $folder_image = $images['forum_locked'];
$folder_alt = $lang['Forum_locked'];
}
--- 407,427 ----
'CAT_ID' => $cat_id,
'CAT_DESC' => $category_rows[$i]['cat_title'],
! 'U_VIEWCAT' => "index.$phpEx$SID&c=$cat_id",
! 'HAVE_FORUMS' => true)
);
if ( $viewcat == $cat_id || $viewcat == -1 )
{
! for($j = 0; $j < sizeof($forum_data); $j++)
{
if ( $forum_data[$j]['cat_id'] == $cat_id )
{
! $row_forum_id = $forum_data[$j]['forum_id'];
! if ( $acl->get_acl($row_forum_id, 'forum', 'list') )
{
if ( $forum_data[$j]['forum_status'] == FORUM_LOCKED )
{
! $folder_image = $theme['forum_locked'];
$folder_alt = $lang['Forum_locked'];
}
***************
*** 339,349 ****
{
$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]) )
--- 429,439 ----
{
$unread_topics = false;
! if ( $userdata['user_id'] != ANONYMOUS )
{
! if ( !empty($new_topic_data[$row_forum_id]) )
{
$forum_last_post_time = 0;
! foreach ( $new_topic_data[$row_forum_id] as $check_topic_id => $check_post_time )
{
if ( empty($tracking_topics[$check_topic_id]) )
***************
*** 363,369 ****
}
! if ( !empty($tracking_forums[$forum_id]) )
{
! if ( $tracking_forums[$forum_id] > $forum_last_post_time )
{
$unread_topics = false;
--- 453,459 ----
}
! if ( !empty($tracking_forums[$row_forum_id]) )
{
! if ( $tracking_forums[$row_forum_id] > $forum_last_post_time )
{
$unread_topics = false;
***************
*** 382,386 ****
}
! $folder_image = ( $unread_topics ) ? $images['forum_new'] : $images['forum'];
$folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts'];
}
--- 472,476 ----
}
! $folder_image = ( $unread_topics ) ? $theme['forum_new'] : $theme['forum'];
$folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts'];
}
***************
*** 395,401 ****
$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&" . 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>';
}
else
--- 485,491 ----
$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="' . "profile.$phpEx$SID&mode=viewprofile&u=" . $forum_data[$j]['user_id'] . '">' . $forum_data[$j]['username'] . '</a> ';
! $last_post .= '<a href="' . "viewtopic.$phpEx$SID&f=$row_forum_id&p=" . $forum_data[$j]['forum_last_post_id'] . '#' . $forum_data[$j]['forum_last_post_id'] . '">' . create_img($theme['goto_post_latest'], $lang['View_latest_post']) . '</a>';
}
else
***************
*** 404,411 ****
}
! 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
--- 494,501 ----
}
! if ( count($forum_moderators[$row_forum_id]) > 0 )
{
! $l_moderators = ( count($forum_moderators[$row_forum_id]) == 1 ) ? $lang['Moderator'] . ':' : $lang['Moderators'] . ':' ;
! $moderator_list = implode(', ', $forum_moderators[$row_forum_id]);
}
else
***************
*** 415,425 ****
}
- $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'],
...
[truncated message content] |