More changes ... switched away from prefetch for now ...

git-svn-id: file:///svn/phpbb/trunk@2849 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-08-13 16:34:17 +00:00
parent a7cda845fa
commit 38b8e4b801
23 changed files with 1089 additions and 1443 deletions

View file

@ -155,10 +155,6 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators
<p><?php echo $l_title_explain; ?></p> <p><?php echo $l_title_explain; ?></p>
<p><?php echo $lang['Permissions_extra_explain']; ?></p>
<p><?php echo $lang['Permissions_extra2_explain']; ?></p>
<?php <?php
switch ( $mode ) switch ( $mode )
@ -175,7 +171,7 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators
case 'supermoderators': case 'supermoderators':
$type_sql = 'mod'; $type_sql = 'mod';
$forum_sql = "AND a.forum_id = $forum_id"; $forum_sql = '';
break; break;
case 'administrators': case 'administrators':
@ -340,7 +336,7 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators
case 'user': case 'user':
$l_type = 'User'; $l_type = 'User';
$sql = ( empty($HTTP_POST_VARS['new']) ) ? "SELECT u.user_id AS id, u.username AS name, u.user_founder, o.auth_option, a.auth_allow_deny FROM " . USERS_TABLE . " u, " . ACL_USERS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE o.auth_type LIKE '$type_sql' AND a.auth_option_id = o.auth_option_id $forum_sql AND u.user_id = a.user_id AND u.user_id IN ($where_sql) ORDER BY u.username, u.user_regdate ASC" : "SELECT user_id AS id, username AS name, u.user_founder FROM " . USERS_TABLE . " WHERE username IN ($where_sql) ORDER BY username, user_regdate ASC"; $sql = ( empty($HTTP_POST_VARS['new']) ) ? "SELECT u.user_id AS id, u.username AS name, u.user_founder, o.auth_option, a.auth_allow_deny FROM " . USERS_TABLE . " u, " . ACL_USERS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE o.auth_type LIKE '$type_sql' AND a.auth_option_id = o.auth_option_id $forum_sql AND u.user_id = a.user_id AND u.user_id IN ($where_sql) ORDER BY u.username, u.user_regdate ASC" : "SELECT user_id AS id, username AS name, user_founder FROM " . USERS_TABLE . " WHERE username IN ($where_sql) ORDER BY username, user_regdate ASC";
break; break;
} }
@ -363,6 +359,10 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators
?> ?>
<p><?php echo $lang['Permissions_extra_explain']; ?></p>
<p><?php echo $lang['Permissions_extra2_explain']; ?></p>
<form method="post" action="<?php echo "admin_permissions.$phpEx$SID&amp;mode=$mode"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> <form method="post" action="<?php echo "admin_permissions.$phpEx$SID&amp;mode=$mode"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr> <tr>
<th>&nbsp;<?php echo $lang[$l_type . $l_can]; ?>&nbsp;</th> <th>&nbsp;<?php echo $lang[$l_type . $l_can]; ?>&nbsp;</th>
@ -415,15 +415,17 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators
} }
else else
{ {
$sql = "SELECT forum_id, forum_name $sql = "SELECT left_id, right_id, forum_id, forum_name
FROM " . FORUMS_TABLE . " FROM " . FORUMS_TABLE . "
ORDER BY cat_id ASC, forum_order ASC"; ORDER BY forum_id ASC";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$select_list = ''; $select_list = '';
$sub_forum = '';
while ( $row = $db->sql_fetchrow($result) ) while ( $row = $db->sql_fetchrow($result) )
{ {
$select_list .= '<option value="' . $row['forum_id'] . '">' . $row['forum_name'] . '</option>'; $select_list .= '<option value="' . $row['forum_id'] . '">' . $sub_forum . $row['forum_name'] . '</option>';
$sub_forum .= ( $row['right_id'] - $row['left_id'] > 1 ) ? '&nbsp;&nbsp;' : '';
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
@ -435,8 +437,6 @@ else
<p><?php echo $l_title_explain ?></p> <p><?php echo $l_title_explain ?></p>
<p><?php echo $lang['Permissions_extra_explain']; ?></p>
<form method="post" action="<?php echo "admin_permissions.$phpEx$SID&amp;mode=$mode"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> <form method="post" action="<?php echo "admin_permissions.$phpEx$SID&amp;mode=$mode"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr> <tr>
<th align="center"><?php echo $lang['Select_a_Forum']; ?></th> <th align="center"><?php echo $lang['Select_a_Forum']; ?></th>

View file

@ -41,9 +41,6 @@ if ( !defined('PHPBB_INSTALLED') )
// User Levels <- Do not change the values of USER or ADMIN // User Levels <- Do not change the values of USER or ADMIN
define('ANONYMOUS', -1); define('ANONYMOUS', -1);
define('USER', 0);
define('ADMIN', 1);
define('MOD', 2);
// User related // User related
define('USER_ACTIVATION_NONE', 0); define('USER_ACTIVATION_NONE', 0);
@ -56,19 +53,21 @@ define('USER_AVATAR_UPLOAD', 1);
define('USER_AVATAR_REMOTE', 2); define('USER_AVATAR_REMOTE', 2);
define('USER_AVATAR_GALLERY', 3); define('USER_AVATAR_GALLERY', 3);
// ACL
define('ACL_PREVENT', 0);
define('ACL_DENY', 1);
define('ACL_ALLOW', 2);
define('ACL_PERMIT', 3);
// Group settings // Group settings
define('GROUP_OPEN', 0); define('GROUP_OPEN', 0);
define('GROUP_CLOSED', 1); define('GROUP_CLOSED', 1);
define('GROUP_HIDDEN', 2); define('GROUP_HIDDEN', 2);
// Forum state // Forum/Topic states
define('FORUM_UNLOCKED', 0); define('ITEM_UNLOCKED', 0);
define('FORUM_LOCKED', 1); define('ITEM_LOCKED', 1);
define('ITEM_MOVED', 2);
// Topic status
define('TOPIC_UNLOCKED', 0);
define('TOPIC_LOCKED', 1);
define('TOPIC_MOVED', 2);
// Topic types // Topic types
define('POST_NORMAL', 0); define('POST_NORMAL', 0);
@ -82,22 +81,15 @@ define('ERROR', 201);
// Private messaging // Private messaging
define('PRIVMSGS_READ_MAIL', 0); define('PRIVMSGS_READ_MAIL', 0);
define('PRIVMSGS_NEW_MAIL', 1); define('PRIVMSGS_NEW_MAIL', 1);
define('PRIVMSGS_SENT_MAIL', 2);
define('PRIVMSGS_SAVED_IN_MAIL', 3);
define('PRIVMSGS_SAVED_OUT_MAIL', 4);
define('PRIVMSGS_UNREAD_MAIL', 5); define('PRIVMSGS_UNREAD_MAIL', 5);
// Session parameters
define('SESSION_METHOD_COOKIE', 100);
define('SESSION_METHOD_GET', 101);
// Table names // Table names
define('ACL_GROUPS_TABLE', $table_prefix.'auth_groups'); define('ACL_GROUPS_TABLE', $table_prefix.'auth_groups');
define('ACL_OPTIONS_TABLE', $table_prefix.'auth_options'); define('ACL_OPTIONS_TABLE', $table_prefix.'auth_options');
define('ACL_PREFETCH_TABLE', $table_prefix.'auth_prefetch'); define('ACL_PREFETCH_TABLE', $table_prefix.'auth_prefetch');
define('ACL_USERS_TABLE', $table_prefix.'auth_users'); define('ACL_USERS_TABLE', $table_prefix.'auth_users');
define('BANLIST_TABLE', $table_prefix.'banlist'); define('BANLIST_TABLE', $table_prefix.'banlist');
define('CATEGORIES_TABLE', $table_prefix.'categories'); // define('CATEGORIES_TABLE', $table_prefix.'categories'); //
define('CONFIG_TABLE', $table_prefix.'config'); define('CONFIG_TABLE', $table_prefix.'config');
define('CONFIG_USER_TABLE', $table_prefix.'config_defaults'); define('CONFIG_USER_TABLE', $table_prefix.'config_defaults');
define('DISALLOW_TABLE', $table_prefix.'disallow'); // define('DISALLOW_TABLE', $table_prefix.'disallow'); //

View file

@ -8,7 +8,6 @@
* *
* $Id$ * $Id$
* *
*
***************************************************************************/ ***************************************************************************/
/*************************************************************************** /***************************************************************************
@ -29,7 +28,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Start session management // Start session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new auth('list', $userdata); $acl = new acl('list', $userdata);
// //
// End session management // End session management
// //
@ -97,7 +96,7 @@ for($i = 0; $i < count($faq); $i++)
// Lets build a page ... // Lets build a page ...
// //
$template->assign_vars(array( $template->assign_vars(array(
'L_FAQ_TITLE' => $l_title, 'L_FAQ_TITLE' => $l_title,
'L_BACK_TO_TOP' => $lang['Back_to_top']) 'L_BACK_TO_TOP' => $lang['Back_to_top'])
); );
@ -108,7 +107,7 @@ for($i = 0; $i < count($faq_block); $i++)
$template->assign_block_vars('faq_block', array( $template->assign_block_vars('faq_block', array(
'BLOCK_TITLE' => $faq_block_titles[$i]) 'BLOCK_TITLE' => $faq_block_titles[$i])
); );
$template->assign_block_vars('faq_block_link', array( $template->assign_block_vars('faq_block_link', array(
'BLOCK_TITLE' => $faq_block_titles[$i]) 'BLOCK_TITLE' => $faq_block_titles[$i])
); );
@ -118,20 +117,20 @@ for($i = 0; $i < count($faq_block); $i++)
$row_class = ( !($j % 2) ) ? $theme['td_class1'] : $theme['td_class2']; $row_class = ( !($j % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars('faq_block.faq_row', array( $template->assign_block_vars('faq_block.faq_row', array(
'ROW_COUNT' => $j, 'ROW_COUNT' => $j,
'ROW_COLOR' => '#' . $row_color, 'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class, 'ROW_CLASS' => $row_class,
'FAQ_QUESTION' => $faq_block[$i][$j]['question'], 'FAQ_QUESTION' => $faq_block[$i][$j]['question'],
'FAQ_ANSWER' => $faq_block[$i][$j]['answer'], 'FAQ_ANSWER' => $faq_block[$i][$j]['answer'],
'U_FAQ_ID' => $faq_block[$i][$j]['id']) 'U_FAQ_ID' => $faq_block[$i][$j]['id'])
); );
$template->assign_block_vars('faq_block_link.faq_row_link', array( $template->assign_block_vars('faq_block_link.faq_row_link', array(
'ROW_COUNT' => $j, 'ROW_COUNT' => $j,
'ROW_COLOR' => '#' . $row_color, 'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class, 'ROW_CLASS' => $row_class,
'FAQ_LINK' => $faq_block[$i][$j]['question'], 'FAQ_LINK' => $faq_block[$i][$j]['question'],
'U_FAQ_LINK' => '#' . $faq_block[$i][$j]['id']) 'U_FAQ_LINK' => '#' . $faq_block[$i][$j]['id'])
); );

View file

@ -112,7 +112,7 @@ function generate_user_info(&$row, $date_format, $group_mod, &$from, &$posts, &$
// Start session management // Start session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new auth('list', $userdata); $acl = new acl('list', $userdata);
// //
// End session management // End session management
// //
@ -161,8 +161,8 @@ if ( isset($HTTP_POST_VARS['groupstatus']) && $group_id )
header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true));
} }
$sql = "SELECT group_moderator $sql = "SELECT group_moderator
FROM " . GROUPS_TABLE . " FROM " . GROUPS_TABLE . "
WHERE group_id = $group_id"; WHERE group_id = $group_id";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -182,7 +182,7 @@ if ( isset($HTTP_POST_VARS['groupstatus']) && $group_id )
message_die(MESSAGE, $message); message_die(MESSAGE, $message);
} }
$sql = "UPDATE " . GROUPS_TABLE . " $sql = "UPDATE " . GROUPS_TABLE . "
SET group_type = " . intval($HTTP_POST_VARS['group_type']) . " SET group_type = " . intval($HTTP_POST_VARS['group_type']) . "
WHERE group_id = $group_id"; WHERE group_id = $group_id";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
@ -211,9 +211,9 @@ else if ( isset($HTTP_POST_VARS['joingroup']) && $group_id )
} }
$sql = "SELECT ug.user_id, g.group_type $sql = "SELECT ug.user_id, g.group_type
FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
WHERE g.group_id = $group_id WHERE g.group_id = $group_id
AND g.group_type <> " . GROUP_HIDDEN . " AND g.group_type <> " . GROUP_HIDDEN . "
AND ug.group_id = g.group_id"; AND ug.group_id = g.group_id";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -251,19 +251,19 @@ else if ( isset($HTTP_POST_VARS['joingroup']) && $group_id )
} }
else else
{ {
message_die(MESSAGE, $lang['No_groups_exist']); message_die(MESSAGE, $lang['No_groups_exist']);
} }
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending) $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
VALUES ($group_id, " . $userdata['user_id'] . ", 1)"; VALUES ($group_id, " . $userdata['user_id'] . ", 1)";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(ERROR, "Error inserting user group subscription", "", __LINE__, __FILE__, $sql); message_die(ERROR, "Error inserting user group subscription", "", __LINE__, __FILE__, $sql);
} }
$sql = "SELECT u.user_email, u.username, u.user_lang, g.group_name $sql = "SELECT u.user_email, u.username, u.user_lang, g.group_name
FROM ".USERS_TABLE . " u, " . GROUPS_TABLE . " g FROM ".USERS_TABLE . " u, " . GROUPS_TABLE . " g
WHERE u.user_id = g.group_moderator WHERE u.user_id = g.group_moderator
AND g.group_id = $group_id"; AND g.group_id = $group_id";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -283,9 +283,9 @@ else if ( isset($HTTP_POST_VARS['joingroup']) && $group_id )
$emailer->extra_headers($email_headers); $emailer->extra_headers($email_headers);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'SITENAME' => $board_config['sitename'], 'SITENAME' => $board_config['sitename'],
'GROUP_MODERATOR' => $moderator['username'], 'GROUP_MODERATOR' => $moderator['username'],
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . "=$group_id&validate=true") 'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . "=$group_id&validate=true")
); );
@ -317,8 +317,8 @@ else if ( isset($HTTP_POST_VARS['unsub']) || isset($HTTP_POST_VARS['unsubpending
if ( $confirm ) if ( $confirm )
{ {
$sql = "DELETE FROM " . USER_GROUP_TABLE . " $sql = "DELETE FROM " . USER_GROUP_TABLE . "
WHERE user_id = " . $userdata['user_id'] . " WHERE user_id = " . $userdata['user_id'] . "
AND group_id = $group_id"; AND group_id = $group_id";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -327,10 +327,10 @@ else if ( isset($HTTP_POST_VARS['unsub']) || isset($HTTP_POST_VARS['unsubpending
if ( $userdata['user_level'] != ADMIN && $userdata['user_level'] == MOD ) if ( $userdata['user_level'] != ADMIN && $userdata['user_level'] == MOD )
{ {
$sql = "SELECT COUNT(auth_mod) AS is_auth_mod $sql = "SELECT COUNT(auth_mod) AS is_auth_mod
FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug
WHERE ug.user_id = " . $userdata['user_id'] . " WHERE ug.user_id = " . $userdata['user_id'] . "
AND aa.group_id = ug.group_id AND aa.group_id = ug.group_id
AND aa.auth_mod = 1"; AND aa.auth_mod = 1";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -339,8 +339,8 @@ else if ( isset($HTTP_POST_VARS['unsub']) || isset($HTTP_POST_VARS['unsubpending
if ( !($row = $db->sql_fetchrow($result)) ) if ( !($row = $db->sql_fetchrow($result)) )
{ {
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_level = " . USER . " SET user_level = " . USER . "
WHERE user_id = " . $userdata['user_id']; WHERE user_id = " . $userdata['user_id'];
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -405,32 +405,32 @@ else if ( $group_id )
switch(SQL_LAYER) switch(SQL_LAYER)
{ {
case 'postgresql': case 'postgresql':
$sql = "SELECT g.group_moderator, g.group_type, aa.auth_mod $sql = "SELECT g.group_moderator, g.group_type, aa.auth_mod
FROM " . GROUPS_TABLE . " g, " . AUTH_ACCESS_TABLE . " aa FROM " . GROUPS_TABLE . " g, " . AUTH_ACCESS_TABLE . " aa
WHERE g.group_id = $group_id WHERE g.group_id = $group_id
AND aa.group_id = g.group_id AND aa.group_id = g.group_id
UNION ( UNION (
SELECT g.group_moderator, g.group_type, NULL SELECT g.group_moderator, g.group_type, NULL
FROM " . GROUPS_TABLE . " g FROM " . GROUPS_TABLE . " g
WHERE g.group_id = $group_id WHERE g.group_id = $group_id
AND NOT EXISTS ( AND NOT EXISTS (
SELECT aa.group_id SELECT aa.group_id
FROM " . AUTH_ACCESS_TABLE . " aa FROM " . AUTH_ACCESS_TABLE . " aa
WHERE aa.group_id = g.group_id WHERE aa.group_id = g.group_id
) )
)"; )";
break; break;
case 'oracle': case 'oracle':
$sql = "SELECT g.group_moderator, g.group_type, aa.auth_mod $sql = "SELECT g.group_moderator, g.group_type, aa.auth_mod
FROM " . GROUPS_TABLE . " g, " . AUTH_ACCESS_TABLE . " aa FROM " . GROUPS_TABLE . " g, " . AUTH_ACCESS_TABLE . " aa
WHERE g.group_id = $group_id WHERE g.group_id = $group_id
AND aa.group_id = g.group_id(+)"; AND aa.group_id = g.group_id(+)";
break; break;
default: default:
$sql = "SELECT g.group_moderator, g.group_type, aa.auth_mod $sql = "SELECT g.group_moderator, g.group_type, aa.auth_mod
FROM ( " . GROUPS_TABLE . " g FROM ( " . GROUPS_TABLE . " g
LEFT JOIN " . AUTH_ACCESS_TABLE . " aa ON aa.group_id = g.group_id ) LEFT JOIN " . AUTH_ACCESS_TABLE . " aa ON aa.group_id = g.group_id )
WHERE g.group_id = $group_id"; WHERE g.group_id = $group_id";
break; break;
@ -443,12 +443,12 @@ else if ( $group_id )
if ( $group_info = $db->sql_fetchrow($result) ) if ( $group_info = $db->sql_fetchrow($result) )
{ {
$group_moderator = $group_info['group_moderator']; $group_moderator = $group_info['group_moderator'];
if ( $group_moderator == $userdata['user_id'] || $userdata['user_level'] == ADMIN ) if ( $group_moderator == $userdata['user_id'] || $userdata['user_level'] == ADMIN )
{ {
$is_moderator = TRUE; $is_moderator = TRUE;
} }
// //
// Handle Additions, removals, approvals and denials // Handle Additions, removals, approvals and denials
// //
@ -473,9 +473,9 @@ else if ( $group_id )
if ( isset($HTTP_POST_VARS['add']) ) if ( isset($HTTP_POST_VARS['add']) )
{ {
$username = ( isset($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : ""; $username = ( isset($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : "";
$sql = "SELECT user_id, user_email, user_lang, user_level $sql = "SELECT user_id, user_email, user_lang, user_level
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE username = '" . str_replace("\'", "''", $username) . "'"; WHERE username = '" . str_replace("\'", "''", $username) . "'";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -503,11 +503,11 @@ else if ( $group_id )
message_die(MESSAGE, $message); message_die(MESSAGE, $message);
} }
$sql = "SELECT ug.user_id, u.user_level $sql = "SELECT ug.user_id, u.user_level
FROM " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u FROM " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u
WHERE u.user_id = " . $row['user_id'] . " WHERE u.user_id = " . $row['user_id'] . "
AND ug.user_id = u.user_id AND ug.user_id = u.user_id
AND ug.group_id = $group_id"; AND ug.group_id = $group_id";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -516,17 +516,17 @@ else if ( $group_id )
if ( !($db->sql_fetchrow($result)) ) if ( !($db->sql_fetchrow($result)) )
{ {
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending) $sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending)
VALUES (" . $row['user_id'] . ", $group_id, 0)"; VALUES (" . $row['user_id'] . ", $group_id, 0)";
if ( !$db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
message_die(ERROR, 'Could not add user to group', '', __LINE__, __FILE__, $sql); message_die(ERROR, 'Could not add user to group', '', __LINE__, __FILE__, $sql);
} }
if ( $row['user_level'] != ADMIN && $row['user_level'] != MOD && $group_info['auth_mod'] ) if ( $row['user_level'] != ADMIN && $row['user_level'] != MOD && $group_info['auth_mod'] )
{ {
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_level = " . MOD . " SET user_level = " . MOD . "
WHERE user_id = " . $row['user_id']; WHERE user_id = " . $row['user_id'];
if ( !$db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
@ -538,8 +538,8 @@ else if ( $group_id )
// Get the group name // Get the group name
// Email the user and tell them they're in the group // Email the user and tell them they're in the group
// //
$group_sql = "SELECT group_name $group_sql = "SELECT group_name
FROM " . GROUPS_TABLE . " FROM " . GROUPS_TABLE . "
WHERE group_id = $group_id"; WHERE group_id = $group_id";
if ( !($result = $db->sql_query($group_sql)) ) if ( !($result = $db->sql_query($group_sql)) )
{ {
@ -561,9 +561,9 @@ else if ( $group_id )
$emailer->extra_headers($email_headers); $emailer->extra_headers($email_headers);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'SITENAME' => $board_config['sitename'], 'SITENAME' => $board_config['sitename'],
'GROUP_NAME' => $group_name, 'GROUP_NAME' => $group_name,
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . "=$group_id") 'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . "=$group_id")
); );
@ -581,7 +581,7 @@ else if ( $group_id )
message_die(MESSAGE, $message); message_die(MESSAGE, $message);
} }
} }
else else
{ {
if ( ( ( isset($HTTP_POST_VARS['approve']) || isset($HTTP_POST_VARS['deny']) ) && isset($HTTP_POST_VARS['pending_members']) ) || ( isset($HTTP_POST_VARS['remove']) && isset($HTTP_POST_VARS['members']) ) ) if ( ( ( isset($HTTP_POST_VARS['approve']) || isset($HTTP_POST_VARS['deny']) ) && isset($HTTP_POST_VARS['pending_members']) ) || ( isset($HTTP_POST_VARS['remove']) && isset($HTTP_POST_VARS['members']) ) )
{ {
@ -598,9 +598,9 @@ else if ( $group_id )
{ {
if ( $group_info['auth_mod'] ) if ( $group_info['auth_mod'] )
{ {
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_level = " . MOD . " SET user_level = " . MOD . "
WHERE user_id IN ($sql_in) WHERE user_id IN ($sql_in)
AND user_level NOT IN (" . MOD . ", " . ADMIN . ")"; AND user_level NOT IN (" . MOD . ", " . ADMIN . ")";
if ( !$db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
@ -608,24 +608,24 @@ else if ( $group_id )
} }
} }
$sql = "UPDATE " . USER_GROUP_TABLE . " $sql = "UPDATE " . USER_GROUP_TABLE . "
SET user_pending = 0 SET user_pending = 0
WHERE user_id IN ($sql_in) WHERE user_id IN ($sql_in)
AND group_id = $group_id"; AND group_id = $group_id";
$sql_select = "SELECT user_email $sql_select = "SELECT user_email
FROM ". USERS_TABLE . " FROM ". USERS_TABLE . "
WHERE user_id IN ($sql_in)"; WHERE user_id IN ($sql_in)";
} }
else if ( isset($HTTP_POST_VARS['deny']) || isset($HTTP_POST_VARS['remove']) ) else if ( isset($HTTP_POST_VARS['deny']) || isset($HTTP_POST_VARS['remove']) )
{ {
if ( $group_info['auth_mod'] ) if ( $group_info['auth_mod'] )
{ {
$sql = "SELECT ug.user_id, ug.group_id $sql = "SELECT ug.user_id, ug.group_id
FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug
WHERE ug.user_id IN ($sql_in) WHERE ug.user_id IN ($sql_in)
AND aa.group_id = ug.group_id AND aa.group_id = ug.group_id
AND aa.auth_mod = 1 AND aa.auth_mod = 1
GROUP BY ug.user_id, ug.group_id GROUP BY ug.user_id, ug.group_id
ORDER BY ug.user_id, ug.group_id"; ORDER BY ug.user_id, ug.group_id";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -653,9 +653,9 @@ else if ( $group_id )
if ( $remove_mod_sql != '' ) if ( $remove_mod_sql != '' )
{ {
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_level = " . USER . " SET user_level = " . USER . "
WHERE user_id IN ($remove_mod_sql) WHERE user_id IN ($remove_mod_sql)
AND user_level NOT IN (" . ADMIN . ")"; AND user_level NOT IN (" . ADMIN . ")";
if ( !$db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
@ -665,8 +665,8 @@ else if ( $group_id )
} }
} }
$sql = "DELETE FROM " . USER_GROUP_TABLE . " $sql = "DELETE FROM " . USER_GROUP_TABLE . "
WHERE user_id IN ($sql_in) WHERE user_id IN ($sql_in)
AND group_id = $group_id"; AND group_id = $group_id";
} }
@ -694,8 +694,8 @@ else if ( $group_id )
// //
// Get the group name // Get the group name
// //
$group_sql = "SELECT group_name $group_sql = "SELECT group_name
FROM " . GROUPS_TABLE . " FROM " . GROUPS_TABLE . "
WHERE group_id = $group_id"; WHERE group_id = $group_id";
if ( !($result = $db->sql_query($group_sql)) ) if ( !($result = $db->sql_query($group_sql)) )
{ {
@ -716,9 +716,9 @@ else if ( $group_id )
$emailer->extra_headers($email_headers); $emailer->extra_headers($email_headers);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'SITENAME' => $board_config['sitename'], 'SITENAME' => $board_config['sitename'],
'GROUP_NAME' => $group_name, 'GROUP_NAME' => $group_name,
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . "=$group_id") 'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . "=$group_id")
); );
@ -751,38 +751,38 @@ else if ( $group_id )
if ( !($group_info = $db->sql_fetchrow($result)) ) if ( !($group_info = $db->sql_fetchrow($result)) )
{ {
message_die(MESSAGE, $lang['Group_not_exist']); message_die(MESSAGE, $lang['Group_not_exist']);
} }
// //
// Get moderator details for this group // Get moderator details for this group
// //
$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm $sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE user_id = " . $group_info['group_moderator']; WHERE user_id = " . $group_info['group_moderator'];
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(ERROR, 'Error getting user list for group', '', __LINE__, __FILE__, $sql); message_die(ERROR, 'Error getting user list for group', '', __LINE__, __FILE__, $sql);
} }
$group_moderator = $db->sql_fetchrow($result); $group_moderator = $db->sql_fetchrow($result);
// //
// Get user information for this group // Get user information for this group
// //
$sql = "SELECT u.username, u.user_id, u.user_viewemail, u.user_posts, u.user_regdate, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_msnm, ug.user_pending $sql = "SELECT u.username, u.user_id, u.user_viewemail, u.user_posts, u.user_regdate, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_msnm, ug.user_pending
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug
WHERE ug.group_id = $group_id WHERE ug.group_id = $group_id
AND u.user_id = ug.user_id AND u.user_id = ug.user_id
AND ug.user_pending = 0 AND ug.user_pending = 0
AND ug.user_id <> " . $group_moderator['user_id'] . " AND ug.user_id <> " . $group_moderator['user_id'] . "
ORDER BY u.username"; ORDER BY u.username";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(ERROR, 'Error getting user list for group', '', __LINE__, __FILE__, $sql); message_die(ERROR, 'Error getting user list for group', '', __LINE__, __FILE__, $sql);
} }
$group_members = $db->sql_fetchrowset($result); $group_members = $db->sql_fetchrowset($result);
$members_count = count($group_members); $members_count = count($group_members);
$db->sql_freeresult($result); $db->sql_freeresult($result);
@ -792,7 +792,7 @@ else if ( $group_id )
AND g.group_id = ug.group_id AND g.group_id = ug.group_id
AND ug.user_pending = 1 AND ug.user_pending = 1
AND u.user_id = ug.user_id AND u.user_id = ug.user_id
ORDER BY u.username"; ORDER BY u.username";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(ERROR, 'Error getting user pending information', '', __LINE__, __FILE__, $sql); message_die(ERROR, 'Error getting user pending information', '', __LINE__, __FILE__, $sql);
@ -809,7 +809,7 @@ else if ( $group_id )
{ {
if ( $group_members[$i]['user_id'] == $userdata['user_id'] && $userdata['session_logged_in'] ) if ( $group_members[$i]['user_id'] == $userdata['user_id'] && $userdata['session_logged_in'] )
{ {
$is_group_member = TRUE; $is_group_member = TRUE;
} }
} }
} }
@ -880,7 +880,7 @@ else if ( $group_id )
// Load templates // Load templates
// //
$template->set_filenames(array( $template->set_filenames(array(
'info' => 'groupcp_info_body.tpl', 'info' => 'groupcp_info_body.tpl',
'pendinginfo' => 'groupcp_pending_info.tpl') 'pendinginfo' => 'groupcp_pending_info.tpl')
); );
make_jumpbox('viewforum.'.$phpEx); make_jumpbox('viewforum.'.$phpEx);
@ -901,19 +901,19 @@ else if ( $group_id )
'L_GROUP_MEMBERSHIP' => $lang['Group_membership'], 'L_GROUP_MEMBERSHIP' => $lang['Group_membership'],
'L_SUBSCRIBE' => $lang['Subscribe'], 'L_SUBSCRIBE' => $lang['Subscribe'],
'L_UNSUBSCRIBE' => $lang['Unsubscribe'], 'L_UNSUBSCRIBE' => $lang['Unsubscribe'],
'L_JOIN_GROUP' => $lang['Join_group'], 'L_JOIN_GROUP' => $lang['Join_group'],
'L_UNSUBSCRIBE_GROUP' => $lang['Unsubscribe'], 'L_UNSUBSCRIBE_GROUP' => $lang['Unsubscribe'],
'L_GROUP_OPEN' => $lang['Group_open'], 'L_GROUP_OPEN' => $lang['Group_open'],
'L_GROUP_CLOSED' => $lang['Group_closed'], 'L_GROUP_CLOSED' => $lang['Group_closed'],
'L_GROUP_HIDDEN' => $lang['Group_hidden'], 'L_GROUP_HIDDEN' => $lang['Group_hidden'],
'L_UPDATE' => $lang['Update'], 'L_UPDATE' => $lang['Update'],
'L_GROUP_MODERATOR' => $lang['Group_Moderator'], 'L_GROUP_MODERATOR' => $lang['Group_Moderator'],
'L_GROUP_MEMBERS' => $lang['Group_Members'], 'L_GROUP_MEMBERS' => $lang['Group_Members'],
'L_PENDING_MEMBERS' => $lang['Pending_members'], 'L_PENDING_MEMBERS' => $lang['Pending_members'],
'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'], 'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'],
'L_PM' => $lang['Private_Message'], 'L_PM' => $lang['Private_Message'],
'L_EMAIL' => $lang['Email'], 'L_EMAIL' => $lang['Email'],
'L_POSTS' => $lang['Posts'], 'L_POSTS' => $lang['Posts'],
'L_WEBSITE' => $lang['Website'], 'L_WEBSITE' => $lang['Website'],
'L_FROM' => $lang['Location'], 'L_FROM' => $lang['Location'],
'L_ORDER' => $lang['Order'], 'L_ORDER' => $lang['Order'],
@ -938,8 +938,8 @@ else if ( $group_id )
'MOD_JOINED' => $joined, 'MOD_JOINED' => $joined,
'MOD_POSTS' => $posts, 'MOD_POSTS' => $posts,
'MOD_AVATAR_IMG' => $poster_avatar, 'MOD_AVATAR_IMG' => $poster_avatar,
'MOD_PROFILE_IMG' => $profile_img, 'MOD_PROFILE_IMG' => $profile_img,
'MOD_PROFILE' => $profile, 'MOD_PROFILE' => $profile,
'MOD_SEARCH_IMG' => $search_img, 'MOD_SEARCH_IMG' => $search_img,
'MOD_SEARCH' => $search, 'MOD_SEARCH' => $search,
'MOD_PM_IMG' => $pm_img, 'MOD_PM_IMG' => $pm_img,
@ -949,8 +949,8 @@ else if ( $group_id )
'MOD_WWW_IMG' => $www_img, 'MOD_WWW_IMG' => $www_img,
'MOD_WWW' => $www, 'MOD_WWW' => $www,
'MOD_ICQ_STATUS_IMG' => $icq_status_img, 'MOD_ICQ_STATUS_IMG' => $icq_status_img,
'MOD_ICQ_IMG' => $icq_img, 'MOD_ICQ_IMG' => $icq_img,
'MOD_ICQ' => $icq, 'MOD_ICQ' => $icq,
'MOD_AIM_IMG' => $aim_img, 'MOD_AIM_IMG' => $aim_img,
'MOD_AIM' => $aim, 'MOD_AIM' => $aim,
'MOD_MSN_IMG' => $msn_img, 'MOD_MSN_IMG' => $msn_img,
@ -958,8 +958,8 @@ else if ( $group_id )
'MOD_YIM_IMG' => $yim_img, 'MOD_YIM_IMG' => $yim_img,
'MOD_YIM' => $yim, 'MOD_YIM' => $yim,
'U_MOD_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$user_id"), 'U_MOD_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$user_id"),
'U_SEARCH_USER' => append_sid("search.$phpEx?mode=searchuser"), 'U_SEARCH_USER' => append_sid("search.$phpEx?mode=searchuser"),
'S_GROUP_OPEN_TYPE' => GROUP_OPEN, 'S_GROUP_OPEN_TYPE' => GROUP_OPEN,
'S_GROUP_CLOSED_TYPE' => GROUP_CLOSED, 'S_GROUP_CLOSED_TYPE' => GROUP_CLOSED,
@ -967,7 +967,7 @@ else if ( $group_id )
'S_GROUP_OPEN_CHECKED' => ( $group_info['group_type'] == GROUP_OPEN ) ? ' checked="checked"' : '', 'S_GROUP_OPEN_CHECKED' => ( $group_info['group_type'] == GROUP_OPEN ) ? ' checked="checked"' : '',
'S_GROUP_CLOSED_CHECKED' => ( $group_info['group_type'] == GROUP_CLOSED ) ? ' checked="checked"' : '', 'S_GROUP_CLOSED_CHECKED' => ( $group_info['group_type'] == GROUP_CLOSED ) ? ' checked="checked"' : '',
'S_GROUP_HIDDEN_CHECKED' => ( $group_info['group_type'] == GROUP_HIDDEN ) ? ' checked="checked"' : '', 'S_GROUP_HIDDEN_CHECKED' => ( $group_info['group_type'] == GROUP_HIDDEN ) ? ' checked="checked"' : '',
'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_MODE_SELECT' => $select_sort_mode, 'S_MODE_SELECT' => $select_sort_mode,
'S_ORDER_SELECT' => $select_sort_order, 'S_ORDER_SELECT' => $select_sort_order,
'S_GROUPCP_ACTION' => append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id")) 'S_GROUPCP_ACTION' => append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id"))
@ -995,10 +995,10 @@ else if ( $group_id )
'FROM' => $from, 'FROM' => $from,
'JOINED' => $joined, 'JOINED' => $joined,
'POSTS' => $posts, 'POSTS' => $posts,
'USER_ID' => $user_id, 'USER_ID' => $user_id,
'AVATAR_IMG' => $poster_avatar, 'AVATAR_IMG' => $poster_avatar,
'PROFILE_IMG' => $profile_img, 'PROFILE_IMG' => $profile_img,
'PROFILE' => $profile, 'PROFILE' => $profile,
'SEARCH_IMG' => $search_img, 'SEARCH_IMG' => $search_img,
'SEARCH' => $search, 'SEARCH' => $search,
'PM_IMG' => $pm_img, 'PM_IMG' => $pm_img,
@ -1008,15 +1008,15 @@ else if ( $group_id )
'WWW_IMG' => $www_img, 'WWW_IMG' => $www_img,
'WWW' => $www, 'WWW' => $www,
'ICQ_STATUS_IMG' => $icq_status_img, 'ICQ_STATUS_IMG' => $icq_status_img,
'ICQ_IMG' => $icq_img, 'ICQ_IMG' => $icq_img,
'ICQ' => $icq, 'ICQ' => $icq,
'AIM_IMG' => $aim_img, 'AIM_IMG' => $aim_img,
'AIM' => $aim, 'AIM' => $aim,
'MSN_IMG' => $msn_img, 'MSN_IMG' => $msn_img,
'MSN' => $msn, 'MSN' => $msn,
'YIM_IMG' => $yim_img, 'YIM_IMG' => $yim_img,
'YIM' => $yim, 'YIM' => $yim,
'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$user_id")) 'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$user_id"))
); );
@ -1042,7 +1042,7 @@ else if ( $group_id )
$template->assign_vars(array( $template->assign_vars(array(
'PAGINATION' => generate_pagination("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id", $members_count, $board_config['topics_per_page'], $start), 'PAGINATION' => generate_pagination("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id", $members_count, $board_config['topics_per_page'], $start),
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), $current_page ), 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), $current_page ),
'L_GOTO_PAGE' => $lang['Goto_page']) 'L_GOTO_PAGE' => $lang['Goto_page'])
); );
@ -1059,8 +1059,8 @@ else if ( $group_id )
} }
// //
// We've displayed the members who belong to the group, now we // We've displayed the members who belong to the group, now we
// do that pending memebers... // do that pending memebers...
// //
if ( $is_moderator ) if ( $is_moderator )
{ {
@ -1083,15 +1083,15 @@ else if ( $group_id )
$template->assign_block_vars('pending_members_row', array( $template->assign_block_vars('pending_members_row', array(
'ROW_CLASS' => $row_class, 'ROW_CLASS' => $row_class,
'ROW_COLOR' => '#' . $row_color, 'ROW_COLOR' => '#' . $row_color,
'USERNAME' => $username, 'USERNAME' => $username,
'FROM' => $from, 'FROM' => $from,
'JOINED' => $joined, 'JOINED' => $joined,
'POSTS' => $posts, 'POSTS' => $posts,
'USER_ID' => $user_id, 'USER_ID' => $user_id,
'AVATAR_IMG' => $poster_avatar, 'AVATAR_IMG' => $poster_avatar,
'PROFILE_IMG' => $profile_img, 'PROFILE_IMG' => $profile_img,
'PROFILE' => $profile, 'PROFILE' => $profile,
'SEARCH_IMG' => $search_img, 'SEARCH_IMG' => $search_img,
'SEARCH' => $search, 'SEARCH' => $search,
'PM_IMG' => $pm_img, 'PM_IMG' => $pm_img,
@ -1101,15 +1101,15 @@ else if ( $group_id )
'WWW_IMG' => $www_img, 'WWW_IMG' => $www_img,
'WWW' => $www, 'WWW' => $www,
'ICQ_STATUS_IMG' => $icq_status_img, 'ICQ_STATUS_IMG' => $icq_status_img,
'ICQ_IMG' => $icq_img, 'ICQ_IMG' => $icq_img,
'ICQ' => $icq, 'ICQ' => $icq,
'AIM_IMG' => $aim_img, 'AIM_IMG' => $aim_img,
'AIM' => $aim, 'AIM' => $aim,
'MSN_IMG' => $msn_img, 'MSN_IMG' => $msn_img,
'MSN' => $msn, 'MSN' => $msn,
'YIM_IMG' => $yim_img, 'YIM_IMG' => $yim_img,
'YIM' => $yim, 'YIM' => $yim,
'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$user_id")) 'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$user_id"))
); );
} }
@ -1123,7 +1123,7 @@ else if ( $group_id )
); );
$template->assign_var_from_handle('PENDING_USER_BOX', 'pendinginfo'); $template->assign_var_from_handle('PENDING_USER_BOX', 'pendinginfo');
} }
} }
@ -1143,11 +1143,11 @@ else
// Select all group that the user is a member of or where the user has // Select all group that the user is a member of or where the user has
// a pending membership. // a pending membership.
// //
if ( $userdata['session_logged_in'] ) if ( $userdata['session_logged_in'] )
{ {
$sql = "SELECT g.group_id, g.group_name, g.group_type, ug.user_pending $sql = "SELECT g.group_id, g.group_name, g.group_type, ug.user_pending
FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
WHERE ug.user_id = " . $userdata['user_id'] . " WHERE ug.user_id = " . $userdata['user_id'] . "
AND ug.group_id = g.group_id AND ug.group_id = g.group_id
AND g.group_single_user <> " . TRUE . " AND g.group_single_user <> " . TRUE . "
ORDER BY g.group_name, ug.user_id"; ORDER BY g.group_name, ug.user_id";
@ -1184,11 +1184,11 @@ else
// //
// Select all other groups i.e. groups that this user is not a member of // Select all other groups i.e. groups that this user is not a member of
// //
$ignore_group_sql = ( count($in_group) ) ? "AND group_id NOT IN (" . implode(', ', $in_group) . ")" : ''; $ignore_group_sql = ( count($in_group) ) ? "AND group_id NOT IN (" . implode(', ', $in_group) . ")" : '';
$sql = "SELECT group_id, group_name, group_type $sql = "SELECT group_id, group_name, group_type
FROM " . GROUPS_TABLE . " g FROM " . GROUPS_TABLE . " g
WHERE group_single_user <> " . TRUE . " WHERE group_single_user <> " . TRUE . "
$ignore_group_sql $ignore_group_sql
ORDER BY g.group_name"; ORDER BY g.group_name";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -1247,10 +1247,10 @@ else
'L_PENDING_GROUPS' => $lang['Memberships_pending'], 'L_PENDING_GROUPS' => $lang['Memberships_pending'],
'L_SUBSCRIBE' => $lang['Subscribe'], 'L_SUBSCRIBE' => $lang['Subscribe'],
'L_UNSUBSCRIBE' => $lang['Unsubscribe'], 'L_UNSUBSCRIBE' => $lang['Unsubscribe'],
'L_VIEW_INFORMATION' => $lang['View_Information'], 'L_VIEW_INFORMATION' => $lang['View_Information'],
'S_USERGROUP_ACTION' => append_sid("groupcp.$phpEx"), 'S_USERGROUP_ACTION' => append_sid("groupcp.$phpEx"),
'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_HIDDEN_FIELDS' => $s_hidden_fields,
'GROUP_LIST_SELECT' => $s_group_list, 'GROUP_LIST_SELECT' => $s_group_list,
'GROUP_PENDING_SELECT' => $s_pending_groups, 'GROUP_PENDING_SELECT' => $s_pending_groups,

View file

@ -8,7 +8,6 @@
* *
* $Id$ * $Id$
* *
*
***************************************************************************/ ***************************************************************************/
/*************************************************************************** /***************************************************************************
@ -1236,7 +1235,7 @@ function generate_smilies($mode, $page_id)
$row = 0; $row = 0;
$col = 0; $col = 0;
while ( list($smile_url, $data) = @each($rowset) ) foreach( $rowset as $smile_url => $data )
{ {
if ( !$col ) if ( !$col )
{ {
@ -1291,4 +1290,86 @@ function generate_smilies($mode, $page_id)
} }
} }
//
//
//
define('BBCODE_UID_LEN', 10);
//
//
//
class parse_message
{
var $message;
var $bbcode_tpl = null;
function parse_message($message, $html, $bbcode, $emoticons)
{
global $board_config;
$this->message = $message;
unset($message);
$this->html($html);
$this->bbcode($bbcode);
$this->emoticons($emoticons);
return $this->message;
}
function html($html)
{
global $board_config;
}
function bbcode($bbcode)
{
global $board_config;
}
function emoticons($emoticons)
{
global $board_config;
}
function attachments()
{
}
}
class parse_poll
{
function parse_poll()
{
global $board_config;
}
}
class parse_search
{
function parse_search()
{
}
function add()
{
}
function delete()
{
}
}
?> ?>

View file

@ -29,31 +29,11 @@ define('HEADER_INC', TRUE);
// //
// gzip_compression // gzip_compression
// //
$do_gzip_compress = FALSE;
if ( $board_config['gzip_compress'] ) if ( $board_config['gzip_compress'] )
{ {
$phpver = phpversion(); if ( extension_loaded('zlib') && strstr($HTTP_USER_AGENT,'compatible') && !headers_sent() )
if ( $phpver >= '4.0.4pl1' && strstr($HTTP_USER_AGENT,'compatible') )
{ {
if ( extension_loaded('zlib') ) ob_start('ob_gzhandler');
{
ob_start('ob_gzhandler');
}
}
else if ( $phpver > '4.0' )
{
if ( strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip') )
{
if ( extension_loaded('zlib') )
{
$do_gzip_compress = TRUE;
ob_start();
ob_implicit_flush(0);
header("Content-Encoding: gzip");
}
}
} }
} }
@ -82,7 +62,7 @@ $sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_colour, s.
FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE ." s FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE ." s
WHERE u.user_id = s.session_user_id WHERE u.user_id = s.session_user_id
AND s.session_time >= ".( time() - 300 ) . " AND s.session_time >= ".( time() - 300 ) . "
$user_forum_sql $user_forum_sql
ORDER BY u.username ASC, s.session_ip ASC"; ORDER BY u.username ASC, s.session_ip ASC";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -120,7 +100,7 @@ while( $row = $db->sql_fetchrow($result) )
$user_online_link = '<a href="' . "profile.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['user_id'] . '"><i>' . $row['username'] . '</i></a>'; $user_online_link = '<a href="' . "profile.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['user_id'] . '"><i>' . $row['username'] . '</i></a>';
$logged_hidden_online++; $logged_hidden_online++;
} }
if ( $row['user_allow_viewonline'] || $acl->get_admin_acl() ) if ( $row['user_allow_viewonline'] || $acl->get_admin_acl() )
{ {
$online_userlist .= ( $online_userlist != '' ) ? ', ' . $user_online_link : $user_online_link; $online_userlist .= ( $online_userlist != '' ) ? ', ' . $user_online_link : $user_online_link;
@ -145,7 +125,16 @@ if ( empty($online_userlist) )
{ {
$online_userlist = $lang['None']; $online_userlist = $lang['None'];
} }
$online_userlist = ( ( isset($forum_id) ) ? $lang['Browsing_forum'] : $lang['Registered_users'] ) . ' ' . $online_userlist;
if ( empty($forum_id) )
{
$online_userlist = $lang['Registered_users'] . ' ' . $online_userlist;
}
else
{
$l_online = ( $guests_online == 1 ) ? $lang['Browsing_forum_guest'] : $lang['Browsing_forum_guests'];
$online_userlist = sprintf($l_online, $online_userlist, $guests_online);
}
$total_online_users = $logged_visible_online + $logged_hidden_online + $guests_online; $total_online_users = $logged_visible_online + $logged_hidden_online + $guests_online;
@ -218,9 +207,9 @@ else
} }
$l_online_users = sprintf($l_t_user_s, $total_online_users); $l_online_users = sprintf($l_t_user_s, $total_online_users);
$l_online_users .= sprintf($l_r_user_s, $logged_visible_online); $l_online_users .= sprintf($l_r_user_s, $logged_visible_online);
$l_online_users .= sprintf($l_h_user_s, $logged_hidden_online); $l_online_users .= sprintf($l_h_user_s, $logged_hidden_online);
$l_online_users .= sprintf($l_g_user_s, $guests_online); $l_online_users .= sprintf($l_g_user_s, $guests_online);
// //
// Obtain number of new private messages // Obtain number of new private messages
@ -230,13 +219,13 @@ if ( $userdata['user_id'] != ANONYMOUS )
{ {
if ( $userdata['user_new_privmsg'] ) if ( $userdata['user_new_privmsg'] )
{ {
$l_message_new = ( $userdata['user_new_privmsg'] == 1 ) ? $lang['New_pm'] : $lang['New_pms']; $l_message_new = ( $userdata['user_new_privmsg'] == 1 ) ? $lang['New_pm'] : $lang['New_pms'];
$l_privmsgs_text = sprintf($l_message_new, $userdata['user_new_privmsg']); $l_privmsgs_text = sprintf($l_message_new, $userdata['user_new_privmsg']);
if ( $userdata['user_last_privmsg'] > $userdata['user_lastvisit'] ) if ( $userdata['user_last_privmsg'] > $userdata['user_lastvisit'] )
{ {
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_last_privmsg = " . $userdata['user_lastvisit'] . " SET user_last_privmsg = " . $userdata['user_lastvisit'] . "
WHERE user_id = " . $userdata['user_id']; WHERE user_id = " . $userdata['user_id'];
$db->sql_query($sql); $db->sql_query($sql);
@ -259,8 +248,8 @@ if ( $userdata['user_id'] != ANONYMOUS )
if ( $userdata['user_unread_privmsg'] ) if ( $userdata['user_unread_privmsg'] )
{ {
$l_message_unread = ( $userdata['user_unread_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms']; $l_message_unread = ( $userdata['user_unread_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms'];
$l_privmsgs_text_unread = sprintf($l_message_unread, $userdata['user_unread_privmsg']); $l_privmsgs_text_unread = sprintf($l_message_unread, $userdata['user_unread_privmsg']);
} }
else else
{ {
@ -291,49 +280,49 @@ foreach ( $nav_links as $nav_item => $nav_array )
{ {
// We have a nested array, used for items like <link rel='chapter'> that can occur more than once. // We have a nested array, used for items like <link rel='chapter'> that can occur more than once.
foreach ( $nav_array as $key => $nested_array ) foreach ( $nav_array as $key => $nested_array )
{ {
$nav_links_html .= sprintf($nav_link_proto, $nav_item, $nested_array['url'], $nested_array['title']); $nav_links_html .= sprintf($nav_link_proto, $nav_item, $nested_array['url'], $nested_array['title']);
} }
} }
} }
*/ */
// //
// The following assigns all _common_ variables that may be used at any point // The following assigns all _common_ variables that may be used at any point
// in a template. // in a template.
// //
$template->assign_vars(array( $template->assign_vars(array(
'SITENAME' => $board_config['sitename'], 'SITENAME' => $board_config['sitename'],
'SITE_DESCRIPTION' => $board_config['site_desc'], 'SITE_DESCRIPTION' => $board_config['site_desc'],
'PAGE_TITLE' => $page_title, 'PAGE_TITLE' => $page_title,
'LAST_VISIT_DATE' => sprintf($lang['You_last_visit'], $s_last_visit), 'LAST_VISIT_DATE' => sprintf($lang['You_last_visit'], $s_last_visit),
'CURRENT_TIME' => sprintf($lang['Current_time'], create_date($board_config['default_dateformat'], time(), $board_config['board_timezone'])), 'CURRENT_TIME' => sprintf($lang['Current_time'], create_date($board_config['default_dateformat'], time(), $board_config['board_timezone'])),
'TOTAL_USERS_ONLINE' => $l_online_users, 'TOTAL_USERS_ONLINE' => $l_online_users,
'LOGGED_IN_USER_LIST' => $online_userlist, 'LOGGED_IN_USER_LIST' => $online_userlist,
'RECORD_USERS' => sprintf($lang['Record_online_users'], $board_config['record_online_users'], create_date($board_config['default_dateformat'], $board_config['record_online_date'], $board_config['board_timezone'])), 'RECORD_USERS' => sprintf($lang['Record_online_users'], $board_config['record_online_users'], create_date($board_config['default_dateformat'], $board_config['record_online_date'], $board_config['board_timezone'])),
'PRIVATE_MESSAGE_INFO' => $l_privmsgs_text, 'PRIVATE_MESSAGE_INFO' => $l_privmsgs_text,
'PRIVATE_MESSAGE_INFO_UNREAD' => $l_privmsgs_text_unread, 'PRIVATE_MESSAGE_INFO_UNREAD' => $l_privmsgs_text_unread,
'PRIVATE_MESSAGE_NEW_FLAG' => $s_privmsg_new, 'PRIVATE_MESSAGE_NEW_FLAG' => $s_privmsg_new,
'PRIVMSG_IMG' => $icon_pm, 'PRIVMSG_IMG' => $icon_pm,
'L_USERNAME' => $lang['Username'], 'L_USERNAME' => $lang['Username'],
'L_PASSWORD' => $lang['Password'], 'L_PASSWORD' => $lang['Password'],
'L_LOGIN_LOGOUT' => $l_login_logout, 'L_LOGIN_LOGOUT' => $l_login_logout,
'L_LOGIN' => $lang['Login'], 'L_LOGIN' => $lang['Login'],
'L_LOG_ME_IN' => $lang['Log_me_in'], 'L_LOG_ME_IN' => $lang['Log_me_in'],
'L_AUTO_LOGIN' => $lang['Log_me_in'], 'L_AUTO_LOGIN' => $lang['Log_me_in'],
'L_INDEX' => sprintf($lang['Forum_Index'], $board_config['sitename']), 'L_INDEX' => sprintf($lang['Forum_Index'], $board_config['sitename']),
'L_REGISTER' => $lang['Register'], 'L_REGISTER' => $lang['Register'],
'L_PROFILE' => $lang['Profile'], 'L_PROFILE' => $lang['Profile'],
'L_SEARCH' => $lang['Search'], 'L_SEARCH' => $lang['Search'],
'L_PRIVATEMSGS' => $lang['Private_Messages'], 'L_PRIVATEMSGS' => $lang['Private_Messages'],
'L_WHO_IS_ONLINE' => $lang['Who_is_Online'], 'L_WHO_IS_ONLINE' => $lang['Who_is_Online'],
'L_MEMBERLIST' => $lang['Memberlist'], 'L_MEMBERLIST' => $lang['Memberlist'],
'L_FAQ' => $lang['FAQ'], 'L_FAQ' => $lang['FAQ'],
'L_USERGROUPS' => $lang['Usergroups'], 'L_USERGROUPS' => $lang['Usergroups'],
'L_SEARCH_NEW' => $lang['Search_new'], 'L_SEARCH_NEW' => $lang['Search_new'],
'L_SEARCH_UNANSWERED' => $lang['Search_unanswered'], 'L_SEARCH_UNANSWERED' => $lang['Search_unanswered'],
'L_SEARCH_SELF' => $lang['Search_your_posts'], 'L_SEARCH_SELF' => $lang['Search_your_posts'],
'U_SEARCH_UNANSWERED' => 'search.'.$phpEx.$SID.'&amp;search_id=unanswered', 'U_SEARCH_UNANSWERED' => 'search.'.$phpEx.$SID.'&amp;search_id=unanswered',
'U_SEARCH_SELF' => 'search.'.$phpEx.$SID.'&amp;search_id=egosearch', 'U_SEARCH_SELF' => 'search.'.$phpEx.$SID.'&amp;search_id=egosearch',
@ -344,26 +333,26 @@ $template->assign_vars(array(
'U_PRIVATEMSGS' => 'privmsg.'.$phpEx.$SID.'&amp;folder=inbox', 'U_PRIVATEMSGS' => 'privmsg.'.$phpEx.$SID.'&amp;folder=inbox',
'U_PRIVATEMSGS_POPUP' => 'privmsg.'.$phpEx.$SID.'&amp;mode=newpm', 'U_PRIVATEMSGS_POPUP' => 'privmsg.'.$phpEx.$SID.'&amp;mode=newpm',
'U_SEARCH' => 'search.'.$phpEx.$SID, 'U_SEARCH' => 'search.'.$phpEx.$SID,
'U_MEMBERLIST' => 'memberlist.'.$phpEx.$SID, 'U_MEMBERLIST' => 'memberlist.'.$phpEx.$SID,
'U_MODCP' => 'modcp.'.$phpEx.$SID, 'U_MODCP' => 'modcp.'.$phpEx.$SID,
'U_FAQ' => 'faq.'.$phpEx.$SID, 'U_FAQ' => 'faq.'.$phpEx.$SID,
'U_VIEWONLINE' => 'viewonline.'.$phpEx.$SID, 'U_VIEWONLINE' => 'viewonline.'.$phpEx.$SID,
'U_LOGIN_LOGOUT' => $u_login_logout, 'U_LOGIN_LOGOUT' => $u_login_logout,
'U_MEMBERSLIST' => 'memberlist.'.$phpEx.$SID, 'U_MEMBERSLIST' => 'memberlist.'.$phpEx.$SID,
'U_GROUP_CP' => 'groupcp.'.$phpEx.$SID, 'U_GROUP_CP' => 'groupcp.'.$phpEx.$SID,
'S_USER_LOGGED_IN' => ( $userdata['user_id'] == ANONYMOUS ) ? false : true, 'S_USER_LOGGED_IN' => ( $userdata['user_id'] == ANONYMOUS ) ? false : true,
'S_USER_PM_POPUP' => ( !empty($userdata['user_popup_pm']) ) ? true : false, 'S_USER_PM_POPUP' => ( !empty($userdata['user_popup_pm']) ) ? true : false,
'S_USER_BROWSER' => $userdata['session_browser'], 'S_USER_BROWSER' => $userdata['session_browser'],
'S_CONTENT_DIRECTION' => $lang['DIRECTION'], 'S_CONTENT_DIRECTION' => $lang['DIRECTION'],
'S_CONTENT_ENCODING' => $lang['ENCODING'], 'S_CONTENT_ENCODING' => $lang['ENCODING'],
'S_CONTENT_DIR_LEFT' => $lang['LEFT'], 'S_CONTENT_DIR_LEFT' => $lang['LEFT'],
'S_CONTENT_DIR_RIGHT' => $lang['RIGHT'], 'S_CONTENT_DIR_RIGHT' => $lang['RIGHT'],
'S_TIMEZONE' => sprintf($lang['All_times'], $lang[$board_config['board_timezone']]), 'S_TIMEZONE' => sprintf($lang['All_times'], $lang[$board_config['board_timezone']]),
'S_LOGIN_ACTION' => 'login.'.$phpEx.$SID, 'S_LOGIN_ACTION' => 'login.'.$phpEx.$SID,
'T_STYLESHEET_DATA' => $theme['css_data'], 'T_STYLESHEET_DATA' => $theme['css_data'],
'T_STYLESHEET_LINK' => 'templates/' . $theme['css_external'], 'T_STYLESHEET_LINK' => 'templates/' . $theme['css_external'],
'NAV_LINKS' => $nav_links_html) 'NAV_LINKS' => $nav_links_html)
); );

View file

@ -33,12 +33,12 @@ if ( defined('DEBUG') )
$mtime = explode(' ', $mtime); $mtime = explode(' ', $mtime);
$totaltime = ( $mtime[1] + $mtime[0] ) - $starttime; $totaltime = ( $mtime[1] + $mtime[0] ) - $starttime;
$debug_output = sprintf('<br /><br />[ Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . ( ( $board_config['gzip_compress'] ) ? 'On' : 'Off' ) . ' | Load : ' . (( $session->load ) ? $session->load : 'N/A') . ' ]', $totaltime); $debug_output = sprintf('<br /><br />[ Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . ( ( $board_config['gzip_compress'] ) ? 'On' : 'Off' ) . ' | Load : ' . ( ( $session->load ) ? $session->load : 'N/A') . ' ]', $totaltime);
} }
$template->assign_vars(array( $template->assign_vars(array(
'PHPBB_VERSION' => $board_config['version'], 'PHPBB_VERSION' => $board_config['version'],
'ADMIN_LINK' => ( $acl->get_acl_admin() ) ? '<a href="' . "admin/index.$phpEx$SID" . '">' . $lang['Admin_panel'] . '</a><br /><br />' : '', 'ADMIN_LINK' => ( $acl->get_acl_admin() ) ? '<a href="' . "admin/index.$phpEx$SID" . '">' . $lang['Admin_panel'] . '</a><br /><br />' : '',
'DEBUG_OUTPUT' => ( defined('DEBUG') ) ? $debug_output : '') 'DEBUG_OUTPUT' => ( defined('DEBUG') ) ? $debug_output : '')
); );
@ -49,29 +49,6 @@ $template->display('body');
// //
$db->sql_close(); $db->sql_close();
//
// Compress buffered output if required and send to browser
//
if ( $do_gzip_compress )
{
//
// Borrowed from php.net!
//
$gzip_contents = ob_get_contents();
ob_end_clean();
$gzip_size = strlen($gzip_contents);
$gzip_crc = crc32($gzip_contents);
$gzip_contents = gzcompress($gzip_contents, 9);
$gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);
echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
echo $gzip_contents;
echo pack("V", $gzip_crc);
echo pack("V", $gzip_size);
}
exit; exit;
?> ?>

View file

@ -84,7 +84,7 @@ class session {
{ {
// //
// Do not check IP assuming equivalence, if IPv4 we'll check only first 24 // Do not check IP assuming equivalence, if IPv4 we'll check only first 24
// bits ... I've been told (by vHiker) this should alleviate problems with // bits ... I've been told (by vHiker) this should alleviate problems with
// load balanced et al proxies while retaining some reliance on IP security. // load balanced et al proxies while retaining some reliance on IP security.
// //
$ip_check_s = explode('.', $userdata['session_ip']); $ip_check_s = explode('.', $userdata['session_ip']);
@ -97,8 +97,8 @@ class session {
// //
if ( ( $current_time - $userdata['session_time'] > 60 || $userdata['session_page'] != $user_page ) && $update ) if ( ( $current_time - $userdata['session_time'] > 60 || $userdata['session_page'] != $user_page ) && $update )
{ {
$sql = "UPDATE " . SESSIONS_TABLE . " $sql = "UPDATE " . SESSIONS_TABLE . "
SET session_time = $current_time, session_page = '$user_page' SET session_time = $current_time, session_page = '$user_page'
WHERE session_id = '" . $this->session_id . "'"; WHERE session_id = '" . $this->session_id . "'";
$db->sql_query($sql); $db->sql_query($sql);
@ -140,8 +140,8 @@ class session {
// //
// Limit sessions in 1 minute period // Limit sessions in 1 minute period
// //
$sql = "SELECT COUNT(*) AS sessions $sql = "SELECT COUNT(*) AS sessions
FROM " . SESSIONS_TABLE . " FROM " . SESSIONS_TABLE . "
WHERE session_time >= " . ( $current_time - 60 ); WHERE session_time >= " . ( $current_time - 60 );
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -156,8 +156,8 @@ class session {
// //
// Grab user data // Grab user data
// //
$sql = "SELECT * $sql = "SELECT *
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE user_id = $user_id"; WHERE user_id = $user_id";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -170,12 +170,12 @@ class session {
if ( $userdata['user_password'] != $autologin || !$userdata['user_active'] || $user_id == ANONYMOUS ) if ( $userdata['user_password'] != $autologin || !$userdata['user_active'] || $user_id == ANONYMOUS )
{ {
$autologin = ''; $autologin = '';
$userdata['user_id'] = $user_id = ANONYMOUS; $userdata['user_id'] = $user_id = ANONYMOUS;
} }
$sql = "SELECT ban_ip, ban_userid, ban_email $sql = "SELECT ban_ip, ban_userid, ban_email
FROM " . BANLIST_TABLE . " FROM " . BANLIST_TABLE . "
WHERE ban_end >= $current_time WHERE ban_end >= $current_time
OR ban_end = 0"; OR ban_end = 0";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -183,9 +183,9 @@ class session {
{ {
do do
{ {
if ( ( $row['user_id'] == $userdata['user_id'] || if ( ( $row['user_id'] == $userdata['user_id'] ||
( $row['ban_ip'] && preg_match('#^' . str_replace('*', '.*?', $row['ban_ip']) . '$#i', $user_ip) ) || ( $row['ban_ip'] && preg_match('#^' . str_replace('*', '.*?', $row['ban_ip']) . '$#i', $user_ip) ) ||
( $row['ban_email'] && preg_match('#^' . str_replace('*', '.*?', $row['ban_email']) . '$#i', $userdata['user_email']) ) ) ( $row['ban_email'] && preg_match('#^' . str_replace('*', '.*?', $row['ban_email']) . '$#i', $userdata['user_email']) ) )
&& !$userdata['user_founder'] ) && !$userdata['user_founder'] )
{ {
message_die(MESSAGE, 'You_been_banned'); message_die(MESSAGE, 'You_been_banned');
@ -243,13 +243,13 @@ class session {
// //
// Delete existing session, update last visit info first! // Delete existing session, update last visit info first!
// //
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_lastvisit = " . $userdata['session_time'] . ", user_session_page = '" . $userdata['session_page'] . "' SET user_lastvisit = " . $userdata['session_time'] . ", user_session_page = '" . $userdata['session_page'] . "'
WHERE user_id = " . $userdata['user_id']; WHERE user_id = " . $userdata['user_id'];
$db->sql_query($sql); $db->sql_query($sql);
$sql = "DELETE FROM " . SESSIONS_TABLE . " $sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE session_id = '" . $this->session_id . "' WHERE session_id = '" . $this->session_id . "'
AND session_user_id = " . $userdata['user_id']; AND session_user_id = " . $userdata['user_id'];
$db->sql_query($sql); $db->sql_query($sql);
@ -266,9 +266,10 @@ class session {
{ {
global $db, $board_config, $user_ip; global $db, $board_config, $user_ip;
$sql = "SELECT * $sql = "SELECT *
FROM " . SESSIONS_TABLE . " FROM " . SESSIONS_TABLE . "
WHERE session_time < " . ( $current_time - $board_config['session_length'] ); WHERE session_time < " . ( $current_time - $board_config['session_length'] ) . "
LIMIT 10";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$del_session_id = ''; $del_session_id = '';
@ -276,8 +277,8 @@ class session {
{ {
if ( $row['user_id'] != ANONYMOUS ) if ( $row['user_id'] != ANONYMOUS )
{ {
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_lastvisit = " . $row['session_time'] . ", user_session_page = '" . $row['session_page'] . "' SET user_lastvisit = " . $row['session_time'] . ", user_session_page = '" . $row['session_page'] . "'
WHERE user_id = " . $row['session_user_id']; WHERE user_id = " . $row['session_user_id'];
$db->sql_query($sql); $db->sql_query($sql);
} }
@ -290,13 +291,13 @@ class session {
// //
// Delete expired sessions // Delete expired sessions
// //
$sql = "DELETE FROM " . SESSIONS_TABLE . " $sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE session_id IN ($del_session_id)"; WHERE session_id IN ($del_session_id)";
$db->sql_query($sql); $db->sql_query($sql);
} }
$sql = "UPDATE " . CONFIG_TABLE . " $sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '$current_time' SET config_value = '$current_time'
WHERE config_name = 'session_last_gc'"; WHERE config_name = 'session_last_gc'";
$db->sql_query($sql); $db->sql_query($sql);
@ -341,11 +342,11 @@ class session {
// //
$style = ( !$board_config['override_user_style'] && $userdata['user_id'] != ANONYMOUS ) ? $userdata['user_style'] : $board_config['default_style']; $style = ( !$board_config['override_user_style'] && $userdata['user_id'] != ANONYMOUS ) ? $userdata['user_style'] : $board_config['default_style'];
$sql = "SELECT t.template_path, t.poll_length, t.pm_box_length, c.css_data, c.css_external, i.* $sql = "SELECT t.template_path, t.poll_length, t.pm_box_length, c.css_data, c.css_external, i.*
FROM " . STYLES_TABLE . " s, " . STYLES_TPL_TABLE . " t, " . STYLES_CSS_TABLE . " c, " . STYLES_IMAGE_TABLE . " i FROM " . STYLES_TABLE . " s, " . STYLES_TPL_TABLE . " t, " . STYLES_CSS_TABLE . " c, " . STYLES_IMAGE_TABLE . " i
WHERE s.style_id = $style WHERE s.style_id = $style
AND t.template_id = s.template_id AND t.template_id = s.template_id
AND c.theme_id = s.style_id AND c.theme_id = s.style_id
AND i.imageset_id = s.imageset_id"; AND i.imageset_id = s.imageset_id";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -371,47 +372,57 @@ class session {
} }
// //
// Note this doesn't use the prefetch at present and is very // Will be keeping my eye of 'other products' to ensure these things don't
// incomplete ... purely for testing ... will be keeping my
// eye of 'other products' to ensure these things don't
// mysteriously appear elsewhere, think up your own solutions! // mysteriously appear elsewhere, think up your own solutions!
// //
class auth { class acl
{
var $acl; function acl($mode, $userdata, $forum_id = false)
var $where_sql = '';
function auth($mode, $userdata, $forum_id = false)
{ {
global $db; global $db;
switch( $mode ) switch( $mode )
{ {
case 'admin':
$and_sql = "ao.auth_type LIKE 'admin'";
break;
case 'list': case 'list':
$and_sql = "AND ( ao.auth_option LIKE 'list' OR ao.auth_type LIKE 'admin' )"; $and_sql = "ao.auth_option LIKE 'list' OR ao.auth_type LIKE 'admin'";
break; break;
case 'read': case 'read':
$and_sql = "AND ( ao.auth_option LIKE 'read' OR ao.auth_type LIKE 'admin' )"; $and_sql = "ao.auth_option LIKE 'read' OR ao.auth_type LIKE 'admin'";
break; break;
case 'forum': case 'forum':
$and_sql = "AND ( ( au.forum_id = $forum_id ) OR ( au.forum_id <> $forum_id AND ( ao.auth_option LIKE 'list' OR ao.auth_type LIKE 'mod' OR ao.auth_type LIKE 'admin' ) ) )"; $and_sql = "( a.forum_id = $forum_id ) OR ( a.forum_id <> $forum_id AND ( ao.auth_option LIKE 'list' OR ao.auth_type LIKE 'mod' OR ao.auth_type LIKE 'admin' ) )";
break;
case 'admin':
$and_sql = "AND ( ao.auth_type LIKE 'admin' )";
break; break;
case 'listmod': case 'listmod':
$and_sql = "AND ( ao.auth_option LIKE 'list' OR ao.auth_type LIKE 'mod' OR ao.auth_type LIKE 'admin' )"; $and_sql = "ao.auth_option LIKE 'list' OR ao.auth_type LIKE 'mod' OR ao.auth_type LIKE 'admin'";
break;
case 'all':
$and_sql = '';
break; break;
} }
$sql = "SELECT au.forum_id, au.auth_allow_deny, ao.auth_type, ao.auth_option $sql = "SELECT a.forum_id, a.auth_allow_deny, ao.auth_type, ao.auth_option
FROM " . ACL_PREFETCH_TABLE . " au, " . ACL_OPTIONS_TABLE . " ao FROM " . ACL_GROUPS_TABLE . " a, " . ACL_OPTIONS_TABLE . " ao, " . USER_GROUP_TABLE . " ug
WHERE au.user_id = " . $userdata['user_id'] . " WHERE ug.user_id = " . $userdata['user_id'] . "
AND ao.auth_option_id = au.auth_option_id AND a.group_id = ug.group_id
$and_sql"; AND ao.auth_option_id = a.auth_option_id
AND ($and_sql)";
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
do
{
$this->acl[$row['forum_id']][$row['auth_type']][$row['auth_option']] = $row['auth_allow_deny'];
}
while ( $row = $db->sql_fetchrow($result) );
}
$db->sql_freeresult($result);
$sql = "SELECT a.forum_id, a.auth_allow_deny, ao.auth_type, ao.auth_option
FROM " . ACL_USERS_TABLE . " a, " . ACL_OPTIONS_TABLE . " ao
WHERE a.user_id = " . $userdata['user_id'] . "
AND ao.auth_option_id = a.auth_option_id
AND ($and_sql)";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) ) if ( $row = $db->sql_fetchrow($result) )
@ -446,14 +457,6 @@ class auth {
return $this->get_acl(0, 'admin', $auth_type); return $this->get_acl(0, 'admin', $auth_type);
} }
function get_acl_user($forum_id, $user_id, $acl = false)
{
}
function get_acl_group($forum_id, $group_id, $acl = false)
{
}
function set_acl($forum_id, $user_id = false, $group_id = false, $auth = false, $dependencies = array()) function set_acl($forum_id, $user_id = false, $group_id = false, $auth = false, $dependencies = array())
{ {
global $db; global $db;
@ -463,75 +466,6 @@ class auth {
return; return;
} }
$dependencies = array_merge_recursive($dependencies, array(
'mod' => array(
'forum' => array(
'list' => 1,
'read' => 1,
'post' => 1,
'reply' => 1,
'edit' => 1,
'delete' => 1,
'poll' => 1,
'vote' => 1,
'announce' => 1,
'sticky' => 1,
'attach' => 1,
'download' => 1,
'html' => 1,
'bbcode' => 1,
'smilies' => 1,
'img' => 1,
'flash' => 1,
'sigs' => 1,
'search' => 1,
'email' => 1,
'rate' => 1,
'print' => 1,
'ignoreflood' => 1,
'ignorequeue' => 1
),
),
'admin' => array(
'forum' => array(
'list' => 1,
'read' => 1,
'post' => 1,
'reply' => 1,
'edit' => 1,
'delete' => 1,
'poll' => 1,
'vote' => 1,
'announce' => 1,
'sticky' => 1,
'attach' => 1,
'download' => 1,
'html' => 1,
'bbcode' => 1,
'smilies' => 1,
'img' => 1,
'flash' => 1,
'sigs' => 1,
'search' => 1,
'email' => 1,
'rate' => 1,
'print' => 1,
'ignoreflood' => 1,
'ignorequeue' => 1
),
'mod' => array(
'edit' => 1,
'delete' => 1,
'move' => 1,
'lock' => 1,
'split' => 1,
'merge' => 1,
'approve' => 1,
'unrate' => 1
)
)
));
$forum_sql = ( $forum_id ) ? "AND a.forum_id IN ($forum_id, 0)" : ''; $forum_sql = ( $forum_id ) ? "AND a.forum_id IN ($forum_id, 0)" : '';
// //
@ -540,12 +474,12 @@ class auth {
$sql = ( $user_id !== false ) ? "SELECT a.user_id, o.auth_type, o.auth_option_id, o.auth_option, a.auth_allow_deny FROM " . ACL_USERS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o, " . USERS_TABLE . " u WHERE a.auth_option_id = o.auth_option_id $forum_sql AND u.user_id = a.user_id AND a.user_id = $user_id" : "SELECT ug.user_id, o.auth_type, o.auth_option, a.auth_allow_deny FROM " . USER_GROUP_TABLE . " ug, " . ACL_USERS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o, " . USERS_TABLE . " u WHERE a.auth_option_id = o.auth_option_id $forum_sql AND u.user_id = a.user_id AND a.user_id = ug.user_id AND ug.group_id = $group_id"; $sql = ( $user_id !== false ) ? "SELECT a.user_id, o.auth_type, o.auth_option_id, o.auth_option, a.auth_allow_deny FROM " . ACL_USERS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o, " . USERS_TABLE . " u WHERE a.auth_option_id = o.auth_option_id $forum_sql AND u.user_id = a.user_id AND a.user_id = $user_id" : "SELECT ug.user_id, o.auth_type, o.auth_option, a.auth_allow_deny FROM " . USER_GROUP_TABLE . " ug, " . ACL_USERS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o, " . USERS_TABLE . " u WHERE a.auth_option_id = o.auth_option_id $forum_sql AND u.user_id = a.user_id AND a.user_id = ug.user_id AND ug.group_id = $group_id";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$current_user_auth = array(); $user_auth = array();
if ( $row = $db->sql_fetchrow($result) ) if ( $row = $db->sql_fetchrow($result) )
{ {
do do
{ {
$current_user_auth[$row['user_id']][$row['auth_type']][$row['auth_option_id']] = $row['auth_allow_deny']; $user_auth[$row['user_id']][$row['auth_type']][$row['auth_option_id']] = $row['auth_allow_deny'];
} }
while ( $row = $db->sql_fetchrow($result) ); while ( $row = $db->sql_fetchrow($result) );
} }
@ -554,95 +488,70 @@ class auth {
$sql = ( $group_id !== false ) ? "SELECT a.group_id, o.auth_type, o.auth_option_id, o.auth_option, a.auth_allow_deny FROM " . ACL_GROUPS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $forum_sql AND a.group_id = $group_id" : "SELECT ug.group_id, o.auth_type, o.auth_option, a.auth_allow_deny FROM " . USER_GROUP_TABLE . " ug, " . ACL_GROUPS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $forum_sql AND a.group_id = ug.group_id AND ug.user_id = $user_id"; $sql = ( $group_id !== false ) ? "SELECT a.group_id, o.auth_type, o.auth_option_id, o.auth_option, a.auth_allow_deny FROM " . ACL_GROUPS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $forum_sql AND a.group_id = $group_id" : "SELECT ug.group_id, o.auth_type, o.auth_option, a.auth_allow_deny FROM " . USER_GROUP_TABLE . " ug, " . ACL_GROUPS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $forum_sql AND a.group_id = ug.group_id AND ug.user_id = $user_id";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$current_group_auth = array(); $group_auth = array();
if ( $row = $db->sql_fetchrow($result) ) if ( $row = $db->sql_fetchrow($result) )
{ {
do do
{ {
$current_group_auth[$row['group_id']][$row['auth_type']][$row['auth_option_id']] = $row['auth_allow_deny']; $group_auth[$row['group_id']][$row['auth_type']][$row['auth_option_id']] = $row['auth_allow_deny'];
} }
while ( $row = $db->sql_fetchrow($result) ); while ( $row = $db->sql_fetchrow($result) );
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
print_r($current_user_auth);
foreach ( $auth as $auth_type => $auth_option_ary ) foreach ( $auth as $auth_type => $auth_option_ary )
{ {
foreach ( $auth_option_ary as $auth_option => $allow ) foreach ( $auth_option_ary as $auth_option => $allow )
{ {
if ( $user_id !== false ) if ( $user_id !== false )
{ {
if ( !empty($current_user_auth) ) if ( !empty($user_auth) )
{ {
foreach ( $current_user_auth as $user => $user_auth_ary ) foreach ( $user_auth as $user => $user_auth_ary )
{ {
$user_auth[$user][$auth_type][$auth_option] = $allow;
$sql_ary[] = ( !isset($user_auth_ary[$auth_type][$auth_option]) ) ? "INSERT INTO " . ACL_USERS_TABLE . " (user_id, forum_id, auth_option_id, auth_allow_deny) VALUES ($user_id, $forum_id, $auth_option, $allow)" : ( ( $user_auth_ary[$auth_type][$auth_option] != $allow ) ? "UPDATE " . ACL_USERS_TABLE . " SET auth_allow_deny = $allow WHERE user_id = $user_id AND forum_id = $forum_id and auth_option_id = $auth_option" : '' ); $sql_ary[] = ( !isset($user_auth_ary[$auth_type][$auth_option]) ) ? "INSERT INTO " . ACL_USERS_TABLE . " (user_id, forum_id, auth_option_id, auth_allow_deny) VALUES ($user_id, $forum_id, $auth_option, $allow)" : ( ( $user_auth_ary[$auth_type][$auth_option] != $allow ) ? "UPDATE " . ACL_USERS_TABLE . " SET auth_allow_deny = $allow WHERE user_id = $user_id AND forum_id = $forum_id and auth_option_id = $auth_option" : '' );
} }
} }
else else
{ {
$user_auth[$user_id][$auth_type][$auth_option] = $allow;
$sql_ary[] = "INSERT INTO " . ACL_USERS_TABLE . " (user_id, forum_id, auth_option_id, auth_allow_deny) VALUES ($user_id, $forum_id, $auth_option, $allow)"; $sql_ary[] = "INSERT INTO " . ACL_USERS_TABLE . " (user_id, forum_id, auth_option_id, auth_allow_deny) VALUES ($user_id, $forum_id, $auth_option, $allow)";
} }
} }
if ( $group_id !== false ) if ( $group_id !== false )
{ {
if ( !empty($current_group_auth) ) if ( !empty($group_auth) )
{ {
foreach ( $current_group_auth as $group => $group_auth_ary ) foreach ( $group_auth as $group => $group_auth_ary )
{ {
$group_auth[$group][$auth_type][$auth_option] = $allow;
$sql_ary[] = ( !isset($group_auth_ary[$auth_type][$auth_option]) ) ? "INSERT INTO " . ACL_GROUPS_TABLE . " (group_id, forum_id, auth_option_id, auth_allow_deny) VALUES ($group_id, $forum_id, $auth_option, $allow)" : ( ( $group_auth_ary[$auth_type][$auth_option] != $allow ) ? "UPDATE " . ACL_GROUPS_TABLE . " SET auth_allow_deny = $allow WHERE group_id = $group_id AND forum_id = $forum_id and auth_option_id = $auth_option" : '' ); $sql_ary[] = ( !isset($group_auth_ary[$auth_type][$auth_option]) ) ? "INSERT INTO " . ACL_GROUPS_TABLE . " (group_id, forum_id, auth_option_id, auth_allow_deny) VALUES ($group_id, $forum_id, $auth_option, $allow)" : ( ( $group_auth_ary[$auth_type][$auth_option] != $allow ) ? "UPDATE " . ACL_GROUPS_TABLE . " SET auth_allow_deny = $allow WHERE group_id = $group_id AND forum_id = $forum_id and auth_option_id = $auth_option" : '' );
} }
} }
else else
{ {
$group_auth[$group_id][$auth_type][$auth_option] = $allow;
$sql_ary[] = "INSERT INTO " . ACL_GROUPS_TABLE . " (group_id, forum_id, auth_option_id, auth_allow_deny) VALUES ($group_id, $forum_id, $auth_option, $allow)"; $sql_ary[] = "INSERT INTO " . ACL_GROUPS_TABLE . " (group_id, forum_id, auth_option_id, auth_allow_deny) VALUES ($group_id, $forum_id, $auth_option, $allow)";
} }
} }
} }
} }
print_r($sql_ary); foreach ( $sql_ary as $sql )
//
// Need to update prefetch table ... the fun bit
//
$sql = ( $user_id !== false ) ? "SELECT a.user_id, o.auth_type, o.auth_option, a.auth_allow_deny FROM " . ACL_PREFETCH_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $forum_sql AND a.user_id = $user_id" : "SELECT ug.user_id, o.auth_type, o.auth_option, a.auth_allow_deny FROM " . USER_GROUP_TABLE . " ug, " . ACL_USERS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $forum_sql AND a.user_id = ug.user_id AND ug.group_id = $group_id";
$result = $db->sql_query($sql);
$prefetch_auth = array();
if ( $row = $db->sql_fetchrow($result) )
{ {
do $db->sql_query($sql);
{
$prefetch_auth[$row['user_id']][$row['auth_type']][$row['auth_option']] = $row['auth_allow_deny'];
}
while ( $row = $db->sql_fetchrow($result) );
}
$db->sql_freeresult($result);
print_r($prefetch_auth);
foreach ( $auth as $auth_type => $auth_option_ary )
{
foreach ( $dependencies[$auth_type] as $dep_sub_type => $dep_sub_type_ary )
{
foreach ( $dep_sub_type_ary as $dep_sub_option => $dep_sub_allow )
{
$auth[$dep_sub_type][$dep_sub_option] = $dep_sub_allow;
}
}
} }
unset($current_group_auth); unset($group_auth);
unset($current_user_auth); unset($user_auth);
} }
} }
// //
// Authentication plug-ins is largely down to // Authentication plug-ins is largely down to
// Sergey Kanareykin, our thanks to him. // Sergey Kanareykin, our thanks to him.
// //
class login class login
{ {

View file

@ -28,32 +28,17 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Start session management // Start session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new auth('list', $userdata); $acl = new acl('list', $userdata);
$session->configure($userdata);
// //
// End session management // 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'];
}
else
{
$mark_read = '';
}
// //
// Handle marking posts // Handle marking posts
// //
if ( $mark_read == 'forums' ) if ( isset($HTTP_GET_VARS['mark']) || isset($HTTP_POST_VARS['mark']) )
{ {
if ( $userdata['user_id'] != ANONYMOUS ) if ( $userdata['user_id'] != ANONYMOUS )
{ {
@ -74,6 +59,11 @@ if ( $mark_read == 'forums' )
$tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array(); $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(); $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();
//
//
//
$forum_id = ( !empty($HTTP_GET_VARS['f']) ) ? "WHERE f2.forum_id = " . intval($HTTP_GET_VARS['f']) : '';
// //
// If you don't use these stats on your index you may want to consider // If you don't use these stats on your index you may want to consider
// removing them // removing them
@ -83,46 +73,27 @@ $total_users = $board_config['num_users'];
$newest_user = $board_config['newest_username']; $newest_user = $board_config['newest_username'];
$newest_uid = $board_config['newest_user_id']; $newest_uid = $board_config['newest_user_id'];
if ( $total_posts == 0 ) $l_total_post_s = ( $total_posts > 1 ) ? $lang['Posted_articles_total'] : ( ( $total_posts == 0 ) ? $lang['Posted_articles_zero_total'] : $lang['Posted_article_total'] );
{ $l_total_user_s = ( $total_users > 1 ) ? $lang['Registered_users_total'] : ( ( $total_users == 1 ) ? $lang['Registered_user_total'] : $lang['Registered_users_zero_total'] );
$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'];
}
/*
switch ( SQL_LAYER ) switch ( SQL_LAYER )
{ {
case 'oracle': case 'oracle':
break; break;
default: default:
$sql = "SELECT f1.*, p.post_time, p.post_username, u.username, u.user_id /* $sql = "SELECT f1.*, u.username, u.user_id
FROM ((( " . FORUMS_TABLE . " f1 FROM ( " . FORUMS_TABLE . " f1
LEFT JOIN " . FORUMS_TABLE . " f2 LEFT JOIN " . USERS_TABLE . " u ON u.user_id = f1.forum_last_poster_id )
LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f2.forum_last_post_id ) $forum_id
LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id ) ORDER BY f1.forum_id";*/
WHERE f1.forum_left_id BETWEEN f2.forum_left_id AND f2.forum_right_id
$sql = "SELECT f1.*, u.username, u.user_id
FROM (( " . FORUMS_TABLE . " f1
LEFT JOIN " . FORUMS_TABLE . " f2 ON f1.left_id > f2.left_id AND f1.left_id < f2.right_id )
LEFT JOIN " . USERS_TABLE . " u ON u.user_id = f1.forum_last_poster_id )
$forum_id
ORDER BY f2.forum_id"; ORDER BY f2.forum_id";
break; break;
} }
@ -131,404 +102,113 @@ $result = $db->sql_query($sql);
$forum_data = array(); $forum_data = array();
if ( $row = $db->sql_fetchrow($result) ) if ( $row = $db->sql_fetchrow($result) )
{ {
$last_forum_right_id = 0;
do do
{ {
$forum_data[] = $row; $row_forum_id = $row['forum_id'];
}
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 // A non-postable forum on the index is treated as a category
// //
if ( $forum_data[$i]['forum_status'] == 2 || $row_forum_id == $forum_id ) if ( ( $row['forum_status'] == 2 || $row_forum_id == $forum_id ) && $row['right_id'] - $row['left_id'] > 1 )
{ {
$template->assign_block_vars('catrow', array( $template->assign_block_vars('catrow', array(
'CAT_ID' => $forum_id, 'CAT_ID' => $forum_id,
'CAT_DESC' => $forum_data[$i]['forum_name'], 'CAT_DESC' => $row['forum_name'],
'U_VIEWCAT' => "index.$phpEx?$SID&amp;" . POST_FORUM_URL . "=$forum_id")
);
$current_parent = $row_forum_id; 'U_VIEWCAT' => "index.$phpEx?$SID&amp;f=$row_forum_id")
);
} }
else else
{ {
if ( $forum_data[$i]['parent_id'] == $current_parent ) if ( $acl->get_acl($row_forum_id, 'forum', 'list') )
{ {
if ( $acl->get_acl($row_forum_id, 'forum', 'list') ) if ( $row['forum_status'] == FORUM_LOCKED )
{ {
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 )
{ {
$folder_image = $theme['forum_locked']; if ( $row['post_time'] > $last_visit )
$folder_alt = $lang['Forum_locked'];
}
else
{
$unread_topics = false;
if ( $userdata['user_id'] != ANONYMOUS )
{ {
if ( !empty($new_topic_data[$row_forum_id]) ) $unread_topics = true;
if ( !empty($tracking_forums[$row_forum_id]) )
{ {
$forum_last_post_time = 0; if ( $tracking_forums[$row_forum_id] > $last_visit )
while( list($check_topic_id, $check_post_time) = @each($new_topic_data[$row_forum_id]) )
{ {
if ( empty($tracking_topics[$check_topic_id]) ) $unread_topics = false;
{
$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 ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
{
if ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $last_visit )
{ {
if ( $tracking_forums[$row_forum_id] > $forum_last_post_time ) $unread_topics = false;
{
$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']; $folder_image = ( $unread_topics ) ? $theme['forum_new'] : $theme['forum'];
$topics = $forum_data[$i]['forum_topics']; $folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts'];
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&amp;mode=viewprofile&amp;" . POST_USERS_URL . '=' . $forum_data[$i]['user_id'] . '">' . $forum_data[$i]['username'] . '</a> ';
$last_post .= '<a href="' . "viewtopic.$phpEx$SID&amp;" . 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 = '&nbsp;';
$moderator_list = '&nbsp;';
}
$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&amp;" . POST_FORUM_URL . "=$row_forum_id")
);
} }
$posts = $row['forum_posts'];
$topics = $row['forum_topics'];
if ( $row['forum_last_post_id'] )
{
$last_post_time = create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']);
$last_post = $last_post_time . '<br />';
$last_post .= ( $row['user_id'] == ANONYMOUS ) ? ( ($row['post_username'] != '' ) ? $row['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . "profile.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['user_id'] . '">' . $row['username'] . '</a> ';
$last_post .= '<a href="' . "viewtopic.$phpEx$SID&amp;f=$row_forum_id&amp;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
{
$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 = '&nbsp;';
$moderator_list = '&nbsp;';
}
$template->assign_block_vars('catrow.forumrow', array(
'FORUM_FOLDER_IMG' => create_img($folder_image, $folder_alt),
'FORUM_NAME' => $row['forum_name'],
'FORUM_DESC' => $row['forum_desc'],
'POSTS' => $row['forum_posts'],
'TOPICS' => $row['forum_topics'],
'LAST_POST' => $last_post,
'MODERATORS' => $moderator_list,
'L_MODERATOR' => $l_moderators,
'L_FORUM_FOLDER_ALT' => $folder_alt,
'U_VIEWFORUM' => "viewforum.$phpEx$SID&amp;f=$row_forum_id")
);
} }
} }
} }
while ( $row = $db->sql_fetchrow($result) );
$template->assign_var_from_handle('SUB_FORUM', 'forum');
} }
*/
//
// Start page proper
//
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order
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
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;
}
$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
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";
$result = $db->sql_query($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'];
}
}
*/
//
// 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&amp;mode=viewprofile&amp;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'],
'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_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&amp;mark=forums")
);
//
// Okay, let's build the index
//
for($i = 0; $i < $total_categories; $i++)
{
$cat_id = $category_rows[$i]['cat_id'];
//
// Should we display this category/forum set?
//
$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;
}
}
//
// Yes, we should, so first dump out the category
// title, then, if appropriate the forum list
//
if ( $display_forums )
{
$template->assign_block_vars('catrow', array(
'CAT_ID' => $cat_id,
'CAT_DESC' => $category_rows[$i]['cat_title'],
'U_VIEWCAT' => "index.$phpEx$SID&amp;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'];
}
else
{
$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]) )
{
$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[$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="' . "profile.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $forum_data[$j]['user_id'] . '">' . $forum_data[$j]['username'] . '</a> ';
$last_post .= '<a href="' . "viewtopic.$phpEx$SID&amp;f=$row_forum_id&amp;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
{
$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 = '&nbsp;';
$moderator_list = '&nbsp;';
}
$template->assign_block_vars('catrow.forumrow', array(
'ROW_COUNT' => $i,
'FORUM_FOLDER_IMG' => create_img($folder_image, $folder_alt),
'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,
'MODERATORS' => $moderator_list,
'FORUM_IMG' => $forum_data[$j]['forum_image'],
'L_MODERATOR' => $l_moderators,
'L_FORUM_FOLDER_ALT' => $folder_alt,
'U_VIEWFORUM' => "viewforum.$phpEx$SID&amp;f=$row_forum_id")
);
}
}
}
}
}
} // for ... categories
}// if ... total_categories
// //
// Start output of page // Start output of page

View file

@ -219,7 +219,7 @@ $lang['Restore_Error_no_file'] = 'No file was uploaded';
$lang['Permissions'] = 'Permissions'; $lang['Permissions'] = 'Permissions';
$lang['Permissions_explain'] = 'Here you can alter which users and groups can access which forums. Permissions can be set for individual operations such as; reading, posting, voting, etc via the <i>Advanced</i> form. This page only applies to forum permissions. To assign moderators or define administrators please use the appropriate page (see left hand side menu).'; $lang['Permissions_explain'] = 'Here you can alter which users and groups can access which forums. Permissions can be set for individual operations such as; reading, posting, voting, etc via the <i>Advanced</i> form. This page only applies to forum permissions. To assign moderators or define administrators please use the appropriate page (see left hand side menu).';
$lang['Permissions_extra_explain'] = 'Permissions are based on a; PERMIT, ALLOW, DENY, PREVENT system. By default users and groups are set to DENY access to all operations, to do anything users or groups have to be granted ALLOW access. When conflicts exist, e.g. a user having ALLOW permissions to a function belongs to a group that is set to DENY such a function the user setting takes precidence, i.e. in this case the user would be ALLOWed access to this function. Similarly a user denied access to a function will be denied even if they belong to a group that grants them access.'; $lang['Permissions_extra_explain'] = 'Permissions are based on a; PERMIT, ALLOW, DENY, PREVENT system. By default users and groups are set to DENY access to all operations, to do anything users or groups have to be granted ALLOW access. When conflicts exist, e.g. a user having ALLOW permissions to a function belongs to a group that is set to DENY such a function the user setting takes precidence, i.e. in this case the user would be ALLOWed access to this function. Similarly a user denied access to a function will be denied even if they belong to a group that grants them access. If a user belongs to two groups one of which grants an ALLOW while another is set to DENY the user will be denied access.';
$lang['Permissions_extra2_explain'] = 'There may be times when you want to deny (or allow) access to a group no matter what their individual user settings are, this is what PERMIT and PREVENT are for. By setting a user (or more likely a group) to one of these will PERMIT (ALLOW) or PREVENT (DENY) access to a function no matter what their user settings are. You may find this useful for things such as "banned" groups, etc. doing away with any need to check for individual user permissions.'; $lang['Permissions_extra2_explain'] = 'There may be times when you want to deny (or allow) access to a group no matter what their individual user settings are, this is what PERMIT and PREVENT are for. By setting a user (or more likely a group) to one of these will PERMIT (ALLOW) or PREVENT (DENY) access to a function no matter what their user settings are. You may find this useful for things such as "banned" groups, etc. doing away with any need to check for individual user permissions.';
$lang['Moderators'] = 'Moderators'; $lang['Moderators'] = 'Moderators';

View file

@ -8,7 +8,6 @@
* *
* $Id$ * $Id$
* *
*
***************************************************************************/ ***************************************************************************/
/*************************************************************************** /***************************************************************************

View file

@ -8,7 +8,6 @@
* *
* $Id$ * $Id$
* *
*
***************************************************************************/ ***************************************************************************/
/*************************************************************************** /***************************************************************************

View file

@ -124,7 +124,8 @@ $lang['GUESTS'] = 'GUESTS';
// Global Header strings // Global Header strings
// //
$lang['Registered_users'] = 'Registered Users:'; $lang['Registered_users'] = 'Registered Users:';
$lang['Browsing_forum'] = 'Users browsing this forum:'; $lang['Browsing_forum_guest'] = 'Users browsing this forum: %s and %d guest';
$lang['Browsing_forum_guests'] = 'Users browsing this forum: %s and %d guests';
$lang['Online_users_zero_total'] = 'In total there are <b>0</b> users online :: '; $lang['Online_users_zero_total'] = 'In total there are <b>0</b> users online :: ';
$lang['Online_users_total'] = 'In total there are <b>%d</b> users online :: '; $lang['Online_users_total'] = 'In total there are <b>%d</b> users online :: ';
$lang['Online_user_total'] = 'In total there is <b>%d</b> user online :: '; $lang['Online_user_total'] = 'In total there is <b>%d</b> user online :: ';

View file

@ -30,7 +30,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Set page ID for session management // Set page ID for session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new auth('list', $userdata); $acl = new acl('list', $userdata);
$session->configure($userdata); $session->configure($userdata);
// //
@ -76,7 +76,7 @@ if ( isset($login) || isset($logout) )
message_die(MESSAGE, $message); message_die(MESSAGE, $message);
} }
} }
else if ( $userdata['user_id'] != ANONYMOUS ) else if ( $userdata['user_id'] != ANONYMOUS )
{ {
$session->destroy($userdata); $session->destroy($userdata);
} }
@ -92,11 +92,11 @@ if ( isset($login) || isset($logout) )
if ( $userdata['user_id'] == ANONYMOUS ) if ( $userdata['user_id'] == ANONYMOUS )
{ {
$template->assign_vars(array( $template->assign_vars(array(
'L_ENTER_PASSWORD' => $lang['Enter_password'], 'L_ENTER_PASSWORD' => $lang['Enter_password'],
'L_SEND_PASSWORD' => $lang['Forgotten_password'], 'L_SEND_PASSWORD' => $lang['Forgotten_password'],
'U_SEND_PASSWORD' => "profile.$phpEx$SID&amp;mode=sendpassword", 'U_SEND_PASSWORD' => "profile.$phpEx$SID&amp;mode=sendpassword",
'S_HIDDEN_FIELDS' => '<input type="hidden" name="redirect" value="' . $redirect . '" />') 'S_HIDDEN_FIELDS' => '<input type="hidden" name="redirect" value="' . $redirect . '" />')
); );

View file

@ -28,25 +28,45 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Start session management // Start session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new auth('list', $userdata); $acl = new acl('list', $userdata);
$session->configure($userdata);
// //
// End session management // End session management
// //
//
// Configure style, language, etc.
//
$session->configure($userdata);
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0; $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
$form = ( !empty($HTTP_GET_VARS['form']) ) ? $HTTP_GET_VARS['form'] : 0;
$field = ( isset($HTTP_GET_VARS['field']) ) ? $HTTP_GET_VARS['field'] : 'username';
$sort_by = ( !empty($HTTP_POST_VARS['sort_by']) ) ? intval($HTTP_POST_VARS['sort_by']) : ( ( !empty($HTTP_GET_VARS['sort_by']) ) ? $HTTP_GET_VARS['sort_by'] : '4' );
$sort_order = ( !empty($HTTP_POST_VARS['sort_order']) ) ? $HTTP_POST_VARS['sort_order'] : ( ( !empty($HTTP_GET_VARS['sort_order']) ) ? $HTTP_GET_VARS['sort_order'] : 'd' );
$username = ( !empty($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : ( ( !empty($HTTP_GET_VARS['username']) ) ? $HTTP_GET_VARS['username'] : '' );
$email = ( !empty($HTTP_POST_VARS['email']) ) ? $HTTP_POST_VARS['email'] : ( ( !empty($HTTP_GET_VARS['email']) ) ? $HTTP_GET_VARS['email'] : '' );
$icq = ( !empty($HTTP_POST_VARS['icq']) ) ? intval($HTTP_POST_VARS['icq']) : ( ( !empty($HTTP_GET_VARS['icq']) ) ? $HTTP_GET_VARS['icq'] : '' );
$aim = ( !empty($HTTP_POST_VARS['aim']) ) ? $HTTP_POST_VARS['aim'] : ( ( !empty($HTTP_GET_VARS['aim']) ) ? $HTTP_GET_VARS['aim'] : '' );
$yahoo = ( !empty($HTTP_POST_VARS['yahoo']) ) ? $HTTP_POST_VARS['yahoo'] : ( ( !empty($HTTP_GET_VARS['yahoo']) ) ? $HTTP_GET_VARS['yahoo'] : '' );
$msn = ( !empty($HTTP_POST_VARS['msn']) ) ? $HTTP_POST_VARS['msn'] : ( ( !empty($HTTP_GET_VARS['msn']) ) ? $HTTP_GET_VARS['msn'] : '' );
$joined_select = ( !empty($HTTP_POST_VARS['joined_select']) ) ? $HTTP_POST_VARS['joined_select'] : ( ( !empty($HTTP_GET_VARS['joined_select']) ) ? $HTTP_GET_VARS['joined_select'] : 'lt' );
$active_select = ( !empty($HTTP_POST_VARS['active_select']) ) ? $HTTP_POST_VARS['active_select'] : ( ( !empty($HTTP_GET_VARS['active_select']) ) ? $HTTP_GET_VARS['active_select'] : 'lt' );
$count_select = ( !empty($HTTP_POST_VARS['count_select']) ) ? $HTTP_POST_VARS['count_select'] : ( ( !empty($HTTP_GET_VARS['count_select']) ) ? $HTTP_GET_VARS['count_select'] : 'eq' );
$joined = ( !empty($HTTP_POST_VARS['joined']) ) ? explode('-', $HTTP_POST_VARS['joined']) : ( ( !empty($HTTP_GET_VARS['joined']) ) ? explode('-', $HTTP_GET_VARS['joined']) : array() );
$active = ( !empty($HTTP_POST_VARS['active']) ) ? explode('-', $HTTP_POST_VARS['active']) : ( ( !empty($HTTP_GET_VARS['active']) ) ? explode('-', $HTTP_GET_VARS['active']) : array() );
$count = ( !empty($HTTP_POST_VARS['count']) ) ? intval($HTTP_POST_VARS['count']) : ( ( !empty($HTTP_GET_VARS['count']) ) ? $HTTP_GET_VARS['count'] : '' );
if ( isset($HTTP_POST_VARS['order']) ) if ( isset($HTTP_POST_VARS['order']) )
{ {
$sort_order = ($HTTP_POST_VARS['order'] == 'ASC') ? 'ASC' : 'DESC'; $sort_order = ($HTTP_POST_VARS['order'] == 'a') ? 'ASC' : 'DESC';
} }
else if ( isset($HTTP_GET_VARS['order']) ) else if ( isset($HTTP_GET_VARS['order']) )
{ {
$sort_order = ($HTTP_GET_VARS['order'] == 'ASC') ? 'ASC' : 'DESC'; $sort_order = ($HTTP_GET_VARS['order'] == 'a') ? 'ASC' : 'DESC';
} }
else else
{ {
@ -68,12 +88,12 @@ for($i = 0; $i < count($mode_types_text); $i++)
$select_sort_mode .= '</select>'; $select_sort_mode .= '</select>';
$select_sort_order = '<select name="order">'; $select_sort_order = '<select name="order">';
$select_sort_order .= ( $sort_order == 'ASC' ) ? '<option value="ASC" selected="selected">' . $lang['Sort_Ascending'] . '</option><option value="DESC">' . $lang['Sort_Descending'] . '</option>' : '<option value="ASC">' . $lang['Sort_Ascending'] . '</option><option value="DESC" selected="selected">' . $lang['Sort_Descending'] . '</option>'; $select_sort_order .= ( $sort_order == 'a' ) ? '<option value="a" selected="selected">' . $lang['Sort_Ascending'] . '</option><option value="d">' . $lang['Sort_Descending'] . '</option>' : '<option value="a">' . $lang['Sort_Ascending'] . '</option><option value="d" selected="selected">' . $lang['Sort_Descending'] . '</option>';
$select_sort_order .= '</select>'; $select_sort_order .= '</select>';
if ( $mode != 'topten' || $board_config['topics_per_page'] < 10 ) if ( $mode != 'topten' || $board_config['topics_per_page'] < 10 )
{ {
$pagination = generate_pagination("memberlist.$phpEx?mode=$mode&amp;order=$sort_order", $board_config['num_users'], $board_config['topics_per_page'], $start). '&nbsp;'; $pagination = generate_pagination("memberlist.$phpEx$SID&amp;mode=$mode&amp;order=$sort_order", $board_config['num_users'], $board_config['topics_per_page'], $start). '&nbsp;';
$total_members = $board_config['num_users']; $total_members = $board_config['num_users'];
} }
else else
@ -87,7 +107,7 @@ else
// //
$template->assign_vars(array( $template->assign_vars(array(
'PAGINATION' => $pagination, 'PAGINATION' => $pagination,
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_members / $board_config['topics_per_page'] )), 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_members / $board_config['topics_per_page'] )),
'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'], 'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'],
'L_EMAIL' => $lang['Email'], 'L_EMAIL' => $lang['Email'],
@ -99,10 +119,10 @@ $template->assign_vars(array(
'L_AIM' => $lang['AIM'], 'L_AIM' => $lang['AIM'],
'L_YIM' => $lang['YIM'], 'L_YIM' => $lang['YIM'],
'L_MSNM' => $lang['MSNM'], 'L_MSNM' => $lang['MSNM'],
'L_ICQ' => $lang['ICQ'], 'L_ICQ' => $lang['ICQ'],
'L_JOINED' => $lang['Joined'], 'L_JOINED' => $lang['Joined'],
'L_POSTS' => $lang['Posts'], 'L_POSTS' => $lang['Posts'],
'L_GOTO_PAGE' => $lang['Goto_page'], 'L_GOTO_PAGE' => $lang['Goto_page'],
'S_MODE_SELECT' => $select_sort_mode, 'S_MODE_SELECT' => $select_sort_mode,
'S_ORDER_SELECT' => $select_sort_order, 'S_ORDER_SELECT' => $select_sort_order,
@ -146,7 +166,7 @@ else
$order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page']; $order_by = "user_regdate $sort_order LIMIT $start, " . $board_config['topics_per_page'];
} }
$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar $sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . " WHERE user_id <> " . ANONYMOUS . "
ORDER BY $order_by"; ORDER BY $order_by";
@ -233,14 +253,14 @@ if ( $row = $db->sql_fetchrow($result) )
$search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>'; $search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';
$template->assign_block_vars('memberrow', array( $template->assign_block_vars('memberrow', array(
'ROW_NUMBER' => $i + ( $start + 1 ), 'ROW_NUMBER' => $i + ( $start + 1 ),
'USERNAME' => $username, 'USERNAME' => $username,
'FROM' => $from, 'FROM' => $from,
'JOINED' => $joined, 'JOINED' => $joined,
'POSTS' => $posts, 'POSTS' => $posts,
'AVATAR_IMG' => $poster_avatar, 'AVATAR_IMG' => $poster_avatar,
'PROFILE_IMG' => $profile_img, 'PROFILE_IMG' => $profile_img,
'PROFILE' => $profile, 'PROFILE' => $profile,
'SEARCH_IMG' => $search_img, 'SEARCH_IMG' => $search_img,
'SEARCH' => $search, 'SEARCH' => $search,
'PM_IMG' => $pm_img, 'PM_IMG' => $pm_img,
@ -250,8 +270,8 @@ if ( $row = $db->sql_fetchrow($result) )
'WWW_IMG' => $www_img, 'WWW_IMG' => $www_img,
'WWW' => $www, 'WWW' => $www,
'ICQ_STATUS_IMG' => $icq_status_img, 'ICQ_STATUS_IMG' => $icq_status_img,
'ICQ_IMG' => $icq_img, 'ICQ_IMG' => $icq_img,
'ICQ' => $icq, 'ICQ' => $icq,
'AIM_IMG' => $aim_img, 'AIM_IMG' => $aim_img,
'AIM' => $aim, 'AIM' => $aim,
'MSN_IMG' => $msn_img, 'MSN_IMG' => $msn_img,
@ -259,8 +279,8 @@ if ( $row = $db->sql_fetchrow($result) )
'YIM_IMG' => $yim_img, 'YIM_IMG' => $yim_img,
'YIM' => $yim, 'YIM' => $yim,
'S_ROW_COUNT' => $i, 'S_ROW_COUNT' => $i,
'U_VIEWPROFILE' => "profile.$phpEx$SID&amp;mode=viewprofile&amp;u=$user_id") 'U_VIEWPROFILE' => "profile.$phpEx$SID&amp;mode=viewprofile&amp;u=$user_id")
); );
@ -273,7 +293,7 @@ $page_title = $lang['Memberlist'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
'body' => 'memberlist_body.html') 'body' => ( $mode == 'searchuser') ? 'search_username.html' : 'memberlist_body.html')
); );
make_jumpbox('viewforum.'.$phpEx); make_jumpbox('viewforum.'.$phpEx);

View file

@ -124,7 +124,7 @@ else
// Start session management // Start session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new auth('forum', $userdata, $forum_id); $acl = new acl('forum', $userdata, $forum_id);
// //
// End session management // End session management
// //
@ -193,8 +193,8 @@ switch( $mode )
$topic_id_sql .= ( ( $topic_id_sql != '' ) ? ', ' : '' ) . intval($topics[$i]); $topic_id_sql .= ( ( $topic_id_sql != '' ) ? ', ' : '' ) . intval($topics[$i]);
} }
$sql = "SELECT post_id $sql = "SELECT post_id
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE topic_id IN ($topic_id_sql)"; WHERE topic_id IN ($topic_id_sql)";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -205,8 +205,8 @@ switch( $mode )
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
$sql = "SELECT vote_id $sql = "SELECT vote_id
FROM " . VOTE_DESC_TABLE . " FROM " . VOTE_DESC_TABLE . "
WHERE topic_id IN ($topic_id_sql)"; WHERE topic_id IN ($topic_id_sql)";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -220,9 +220,9 @@ switch( $mode )
// //
// Got all required info so go ahead and start deleting everything // Got all required info so go ahead and start deleting everything
// //
$sql = "DELETE $sql = "DELETE
FROM " . TOPICS_TABLE . " FROM " . TOPICS_TABLE . "
WHERE topic_id IN ($topic_id_sql) WHERE topic_id IN ($topic_id_sql)
OR topic_moved_id IN ($topic_id_sql)"; OR topic_moved_id IN ($topic_id_sql)";
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) ) if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{ {
@ -231,13 +231,13 @@ switch( $mode )
if ( $post_id_sql != '' ) if ( $post_id_sql != '' )
{ {
$sql = "DELETE $sql = "DELETE
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE post_id IN ($post_id_sql)"; WHERE post_id IN ($post_id_sql)";
$db->sql_query($sql); $db->sql_query($sql);
$sql = "DELETE $sql = "DELETE
FROM " . POSTS_TEXT_TABLE . " FROM " . POSTS_TEXT_TABLE . "
WHERE post_id IN ($post_id_sql)"; WHERE post_id IN ($post_id_sql)";
$db->sql_query($sql); $db->sql_query($sql);
@ -246,24 +246,24 @@ switch( $mode )
if ( $vote_id_sql != '' ) if ( $vote_id_sql != '' )
{ {
$sql = "DELETE $sql = "DELETE
FROM " . VOTE_DESC_TABLE . " FROM " . VOTE_DESC_TABLE . "
WHERE vote_id IN ($vote_id_sql)"; WHERE vote_id IN ($vote_id_sql)";
$db->sql_query($sql); $db->sql_query($sql);
$sql = "DELETE $sql = "DELETE
FROM " . VOTE_RESULTS_TABLE . " FROM " . VOTE_RESULTS_TABLE . "
WHERE vote_id IN ($vote_id_sql)"; WHERE vote_id IN ($vote_id_sql)";
$db->sql_query($sql); $db->sql_query($sql);
$sql = "DELETE $sql = "DELETE
FROM " . VOTE_USERS_TABLE . " FROM " . VOTE_USERS_TABLE . "
WHERE vote_id IN ($vote_id_sql)"; WHERE vote_id IN ($vote_id_sql)";
$db->sql_query($sql); $db->sql_query($sql);
} }
$sql = "DELETE $sql = "DELETE
FROM " . TOPICS_WATCH_TABLE . " FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id IN ($topic_id_sql)"; WHERE topic_id IN ($topic_id_sql)";
if ( !$db->sql_query($sql, END_TRANSACTION) ) if ( !$db->sql_query($sql, END_TRANSACTION) )
{ {
@ -292,7 +292,7 @@ switch( $mode )
else else
{ {
// Not confirmed, show confirmation message // Not confirmed, show confirmation message
if ( empty($HTTP_POST_VARS['topic_id_list']) && empty($topic_id) ) if ( empty($HTTP_POST_VARS['topic_id_list']) && empty($topic_id) )
{ {
message_die(GENERAL_MESSAGE, $lang['None_selected']); message_die(GENERAL_MESSAGE, $lang['None_selected']);
@ -356,9 +356,9 @@ switch( $mode )
$topic_list .= ( ( $topic_list != '' ) ? ', ' : '' ) . intval($topics[$i]); $topic_list .= ( ( $topic_list != '' ) ? ', ' : '' ) . intval($topics[$i]);
} }
$sql = "SELECT * $sql = "SELECT *
FROM " . TOPICS_TABLE . " FROM " . TOPICS_TABLE . "
WHERE topic_id IN ($topic_list) WHERE topic_id IN ($topic_list)
AND topic_status <> " . TOPIC_MOVED; AND topic_status <> " . TOPIC_MOVED;
if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) ) if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
{ {
@ -371,7 +371,7 @@ switch( $mode )
for($i = 0; $i < count($row); $i++) for($i = 0; $i < count($row); $i++)
{ {
$topic_id = $row[$i]['topic_id']; $topic_id = $row[$i]['topic_id'];
if ( isset($HTTP_POST_VARS['move_leave_shadow']) ) if ( isset($HTTP_POST_VARS['move_leave_shadow']) )
{ {
// Insert topic in the old forum that indicates that the forum has moved. // Insert topic in the old forum that indicates that the forum has moved.
@ -383,16 +383,16 @@ switch( $mode )
} }
} }
$sql = "UPDATE " . TOPICS_TABLE . " $sql = "UPDATE " . TOPICS_TABLE . "
SET forum_id = $new_forum_id SET forum_id = $new_forum_id
WHERE topic_id = $topic_id"; WHERE topic_id = $topic_id";
if ( !$db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, 'Could not update old topic', '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not update old topic', '', __LINE__, __FILE__, $sql);
} }
$sql = "UPDATE " . POSTS_TABLE . " $sql = "UPDATE " . POSTS_TABLE . "
SET forum_id = $new_forum_id SET forum_id = $new_forum_id
WHERE topic_id = $topic_id"; WHERE topic_id = $topic_id";
if ( !$db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
@ -465,12 +465,12 @@ switch( $mode )
'MESSAGE_TITLE' => $lang['Confirm'], 'MESSAGE_TITLE' => $lang['Confirm'],
'MESSAGE_TEXT' => $lang['Confirm_move_topic'], 'MESSAGE_TEXT' => $lang['Confirm_move_topic'],
'L_MOVE_TO_FORUM' => $lang['Move_to_forum'], 'L_MOVE_TO_FORUM' => $lang['Move_to_forum'],
'L_LEAVESHADOW' => $lang['Leave_shadow_topic'], 'L_LEAVESHADOW' => $lang['Leave_shadow_topic'],
'L_YES' => $lang['Yes'], 'L_YES' => $lang['Yes'],
'L_NO' => $lang['No'], 'L_NO' => $lang['No'],
'S_FORUM_SELECT' => make_forum_select('new_forum', $forum_id), 'S_FORUM_SELECT' => make_forum_select('new_forum', $forum_id),
'S_MODCP_ACTION' => append_sid("modcp.$phpEx"), 'S_MODCP_ACTION' => append_sid("modcp.$phpEx"),
'S_HIDDEN_FIELDS' => $hidden_fields) 'S_HIDDEN_FIELDS' => $hidden_fields)
); );
@ -490,9 +490,9 @@ switch( $mode )
$topic_id_sql .= ( ( $topic_id_sql != '' ) ? ', ' : '' ) . $topics[$i]; $topic_id_sql .= ( ( $topic_id_sql != '' ) ? ', ' : '' ) . $topics[$i];
} }
$sql = "UPDATE " . TOPICS_TABLE . " $sql = "UPDATE " . TOPICS_TABLE . "
SET topic_status = " . TOPIC_LOCKED . " SET topic_status = " . TOPIC_LOCKED . "
WHERE topic_id IN ($topic_id_sql) WHERE topic_id IN ($topic_id_sql)
AND topic_moved_id = 0"; AND topic_moved_id = 0";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -529,9 +529,9 @@ switch( $mode )
$topic_id_sql .= ( ( $topic_id_sql != "") ? ', ' : '' ) . $topics[$i]; $topic_id_sql .= ( ( $topic_id_sql != "") ? ', ' : '' ) . $topics[$i];
} }
$sql = "UPDATE " . TOPICS_TABLE . " $sql = "UPDATE " . TOPICS_TABLE . "
SET topic_status = " . TOPIC_UNLOCKED . " SET topic_status = " . TOPIC_UNLOCKED . "
WHERE topic_id IN ($topic_id_sql) WHERE topic_id IN ($topic_id_sql)
AND topic_moved_id = 0"; AND topic_moved_id = 0";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -607,7 +607,7 @@ switch( $mode )
} }
$sql = "UPDATE " . POSTS_TABLE . " $sql = "UPDATE " . POSTS_TABLE . "
SET topic_id = $new_topic_id, forum_id = $new_forum_id SET topic_id = $new_topic_id, forum_id = $new_forum_id
WHERE post_id IN ($post_id_sql)"; WHERE post_id IN ($post_id_sql)";
} }
else if( !empty($HTTP_POST_VARS['split_type_beyond']) ) else if( !empty($HTTP_POST_VARS['split_type_beyond']) )
@ -672,15 +672,15 @@ switch( $mode )
'L_POSTED' => $lang['Posted'], 'L_POSTED' => $lang['Posted'],
'L_SPLIT_POSTS' => $lang['Split_posts'], 'L_SPLIT_POSTS' => $lang['Split_posts'],
'L_SUBMIT' => $lang['Submit'], 'L_SUBMIT' => $lang['Submit'],
'L_SPLIT_AFTER' => $lang['Split_after'], 'L_SPLIT_AFTER' => $lang['Split_after'],
'L_POST_SUBJECT' => $lang['Post_subject'], 'L_POST_SUBJECT' => $lang['Post_subject'],
'L_MARK_ALL' => $lang['Mark_all'], 'L_MARK_ALL' => $lang['Mark_all'],
'L_UNMARK_ALL' => $lang['Unmark_all'], 'L_UNMARK_ALL' => $lang['Unmark_all'],
'L_POST' => $lang['Post'], 'L_POST' => $lang['Post'],
'FORUM_NAME' => $forum_name, 'FORUM_NAME' => $forum_name,
'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"), 'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"),
'S_SPLIT_ACTION' => append_sid("modcp.$phpEx"), 'S_SPLIT_ACTION' => append_sid("modcp.$phpEx"),
'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_HIDDEN_FIELDS' => $s_hidden_fields,
@ -737,12 +737,12 @@ switch( $mode )
} }
$message = str_replace("\n", '<br />', $message); $message = str_replace("\n", '<br />', $message);
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$checkbox = ( $i > 0 ) ? '<input type="checkbox" name="post_id_list[]" value="' . $post_id . '" />' : '&nbsp;'; $checkbox = ( $i > 0 ) ? '<input type="checkbox" name="post_id_list[]" value="' . $post_id . '" />' : '&nbsp;';
$template->assign_block_vars('postrow', array( $template->assign_block_vars('postrow', array(
'ROW_COLOR' => '#' . $row_color, 'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class, 'ROW_CLASS' => $row_class,
@ -751,7 +751,7 @@ switch( $mode )
'POST_SUBJECT' => $post_subject, 'POST_SUBJECT' => $post_subject,
'MESSAGE' => $message, 'MESSAGE' => $message,
'POST_ID' => $post_id, 'POST_ID' => $post_id,
'S_SPLIT_CHECKBOX' => $checkbox) 'S_SPLIT_CHECKBOX' => $checkbox)
); );
} }
@ -780,14 +780,14 @@ switch( $mode )
); );
// Look up relevent data for this post // Look up relevent data for this post
$sql = "SELECT poster_ip, poster_id $sql = "SELECT poster_ip, poster_id
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE post_id = $post_id"; WHERE post_id = $post_id";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, 'Could not get poster IP information', '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not get poster IP information', '', __LINE__, __FILE__, $sql);
} }
if ( !($post_row = $db->sql_fetchrow($result)) ) if ( !($post_row = $db->sql_fetchrow($result)) )
{ {
message_die(GENERAL_MESSAGE, $lang['No_such_post']); message_die(GENERAL_MESSAGE, $lang['No_such_post']);
@ -803,23 +803,23 @@ switch( $mode )
'L_THIS_POST_IP' => $lang['This_posts_IP'], 'L_THIS_POST_IP' => $lang['This_posts_IP'],
'L_OTHER_IPS' => $lang['Other_IP_this_user'], 'L_OTHER_IPS' => $lang['Other_IP_this_user'],
'L_OTHER_USERS' => $lang['Users_this_IP'], 'L_OTHER_USERS' => $lang['Users_this_IP'],
'L_LOOKUP_IP' => $lang['Lookup_IP'], 'L_LOOKUP_IP' => $lang['Lookup_IP'],
'L_SEARCH' => $lang['Search'], 'L_SEARCH' => $lang['Search'],
'SEARCH_IMG' => $images['icon_search'], 'SEARCH_IMG' => $images['icon_search'],
'IP' => $ip_this_post,
'IP' => $ip_this_post,
'U_LOOKUP_IP' => append_sid("modcp.$phpEx?mode=ip&amp;" . POST_POST_URL . "=$post_id&amp;" . POST_TOPIC_URL . "=$topic_id&amp;rdns=" . $ip_this_post)) 'U_LOOKUP_IP' => append_sid("modcp.$phpEx?mode=ip&amp;" . POST_POST_URL . "=$post_id&amp;" . POST_TOPIC_URL . "=$topic_id&amp;rdns=" . $ip_this_post))
); );
// //
// Get other IP's this user has posted under // Get other IP's this user has posted under
// //
$sql = "SELECT poster_ip, COUNT(*) AS postings $sql = "SELECT poster_ip, COUNT(*) AS postings
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE poster_id = $poster_id WHERE poster_id = $poster_id
GROUP BY poster_ip GROUP BY poster_ip
ORDER BY postings DESC"; ORDER BY postings DESC";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -846,15 +846,15 @@ switch( $mode )
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars('iprow', array( $template->assign_block_vars('iprow', array(
'ROW_COLOR' => '#' . $row_color, 'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class, 'ROW_CLASS' => $row_class,
'IP' => $ip, 'IP' => $ip,
'POSTS' => $row['postings'] . ' ' . ( ( $row['postings'] == 1 ) ? $lang['Post'] : $lang['Posts'] ), 'POSTS' => $row['postings'] . ' ' . ( ( $row['postings'] == 1 ) ? $lang['Post'] : $lang['Posts'] ),
'U_LOOKUP_IP' => append_sid("modcp.$phpEx?mode=ip&amp;" . POST_POST_URL . "=$post_id&amp;" . POST_TOPIC_URL . "=$topic_id&amp;rdns=" . $row['poster_ip'])) 'U_LOOKUP_IP' => append_sid("modcp.$phpEx?mode=ip&amp;" . POST_POST_URL . "=$post_id&amp;" . POST_TOPIC_URL . "=$topic_id&amp;rdns=" . $row['poster_ip']))
); );
$i++; $i++;
} }
while ( $row = $db->sql_fetchrow($result) ); while ( $row = $db->sql_fetchrow($result) );
} }
@ -862,9 +862,9 @@ switch( $mode )
// //
// Get other users who've posted under this IP // Get other users who've posted under this IP
// //
$sql = "SELECT u.user_id, u.username, COUNT(*) as postings $sql = "SELECT u.user_id, u.username, COUNT(*) as postings
FROM " . USERS_TABLE ." u, " . POSTS_TABLE . " p FROM " . USERS_TABLE ." u, " . POSTS_TABLE . " p
WHERE p.poster_id = u.user_id WHERE p.poster_id = u.user_id
AND p.poster_ip = '" . $post_row['poster_ip'] . "' AND p.poster_ip = '" . $post_row['poster_ip'] . "'
GROUP BY u.user_id, u.username GROUP BY u.user_id, u.username
ORDER BY postings DESC"; ORDER BY postings DESC";
@ -885,17 +885,17 @@ switch( $mode )
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars('userrow', array( $template->assign_block_vars('userrow', array(
'ROW_COLOR' => '#' . $row_color, 'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class, 'ROW_CLASS' => $row_class,
'USERNAME' => $username, 'USERNAME' => $username,
'POSTS' => $row['postings'] . ' ' . ( ( $row['postings'] == 1 ) ? $lang['Post'] : $lang['Posts'] ), 'POSTS' => $row['postings'] . ' ' . ( ( $row['postings'] == 1 ) ? $lang['Post'] : $lang['Posts'] ),
'L_SEARCH_POSTS' => sprintf($lang['Search_user_posts'], $username), 'L_SEARCH_POSTS' => sprintf($lang['Search_user_posts'], $username),
'U_PROFILE' => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$id"), 'U_PROFILE' => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$id"),
'U_SEARCHPOSTS' => append_sid("search.$phpEx?search_author=" . urlencode($username) . "&amp;showresults=topics")) 'U_SEARCHPOSTS' => append_sid("search.$phpEx?search_author=" . urlencode($username) . "&amp;showresults=topics"))
); );
$i++; $i++;
} }
while ( $row = $db->sql_fetchrow($result) ); while ( $row = $db->sql_fetchrow($result) );
} }
@ -923,12 +923,12 @@ switch( $mode )
'L_MOVE' => $lang['Move'], 'L_MOVE' => $lang['Move'],
'L_LOCK' => $lang['Lock'], 'L_LOCK' => $lang['Lock'],
'L_UNLOCK' => $lang['Unlock'], 'L_UNLOCK' => $lang['Unlock'],
'L_TOPICS' => $lang['Topics'], 'L_TOPICS' => $lang['Topics'],
'L_REPLIES' => $lang['Replies'], 'L_REPLIES' => $lang['Replies'],
'L_LASTPOST' => $lang['Last_Post'], 'L_LASTPOST' => $lang['Last_Post'],
'L_SELECT' => $lang['Select'], 'L_SELECT' => $lang['Select'],
'U_VIEW_FORUM' => "viewforum.$phpEx$SID&amp;f=$forum_id", 'U_VIEW_FORUM' => "viewforum.$phpEx$SID&amp;f=$forum_id",
'S_HIDDEN_FIELDS' => '<input type="hidden" name="f" value="' . $forum_id . '">', 'S_HIDDEN_FIELDS' => '<input type="hidden" name="f" value="' . $forum_id . '">',
'S_MODCP_ACTION' => "modcp.$phpEx$SID") 'S_MODCP_ACTION' => "modcp.$phpEx$SID")
); );
@ -970,7 +970,7 @@ switch( $mode )
$folder_img = $images['folder_sticky']; $folder_img = $images['folder_sticky'];
$folder_alt = $lang['Sticky']; $folder_alt = $lang['Sticky'];
} }
else else
{ {
$folder_img = $images['folder']; $folder_img = $images['folder'];
$folder_alt = $lang['No_new_posts']; $folder_alt = $lang['No_new_posts'];
@ -980,7 +980,7 @@ switch( $mode )
$topic_id = $row['topic_id']; $topic_id = $row['topic_id'];
$topic_type = $row['topic_type']; $topic_type = $row['topic_type'];
$topic_status = $row['topic_status']; $topic_status = $row['topic_status'];
if ( $topic_type == POST_ANNOUNCE ) if ( $topic_type == POST_ANNOUNCE )
{ {
$topic_type = $lang['Topic_Announcement'] . ' '; $topic_type = $lang['Topic_Announcement'] . ' ';
@ -995,14 +995,14 @@ switch( $mode )
} }
else else
{ {
$topic_type = ''; $topic_type = '';
} }
if ( $row['topic_vote'] ) if ( $row['topic_vote'] )
{ {
$topic_type .= $lang['Topic_Poll'] . ' '; $topic_type .= $lang['Topic_Poll'] . ' ';
} }
$topic_title = $row['topic_title']; $topic_title = $row['topic_title'];
if ( count($orig_word) ) if ( count($orig_word) )
{ {
@ -1017,13 +1017,13 @@ switch( $mode )
$template->assign_block_vars('topicrow', array( $template->assign_block_vars('topicrow', array(
'U_VIEW_TOPIC' => $u_view_topic, 'U_VIEW_TOPIC' => $u_view_topic,
'TOPIC_FOLDER_IMG' => $folder_img, 'TOPIC_FOLDER_IMG' => $folder_img,
'TOPIC_TYPE' => $topic_type, 'TOPIC_TYPE' => $topic_type,
'TOPIC_TITLE' => $topic_title, 'TOPIC_TITLE' => $topic_title,
'REPLIES' => $topic_replies, 'REPLIES' => $topic_replies,
'LAST_POST_TIME' => $last_post_time, 'LAST_POST_TIME' => $last_post_time,
'TOPIC_ID' => $topic_id, 'TOPIC_ID' => $topic_id,
'L_TOPIC_FOLDER_ALT' => $folder_alt) 'L_TOPIC_FOLDER_ALT' => $folder_alt)
); );
} }
@ -1031,7 +1031,7 @@ switch( $mode )
$template->assign_vars(array( $template->assign_vars(array(
'PAGINATION' => generate_pagination("modcp.$phpEx$SID&amp;f=$forum_id", $forum_topics, $board_config['topics_per_page'], $start), 'PAGINATION' => generate_pagination("modcp.$phpEx$SID&amp;f=$forum_id", $forum_topics, $board_config['topics_per_page'], $start),
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $forum_topics / $board_config['topics_per_page'] )), 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $forum_topics / $board_config['topics_per_page'] )),
'L_GOTO_PAGE' => $lang['Goto_page']) 'L_GOTO_PAGE' => $lang['Goto_page'])
); );

View file

@ -104,7 +104,7 @@ if ( isset($HTTP_POST_VARS['cancel']) )
// Start session management // Start session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new auth('list', $userdata); $acl = new acl('list', $userdata);
// //
// End session management // End session management
// //
@ -165,8 +165,8 @@ switch ( $mode )
message_die(MESSAGE, $lang['Forum_not_exist']); message_die(MESSAGE, $lang['Forum_not_exist']);
} }
$sql = "SELECT * $sql = "SELECT *
FROM " . FORUMS_TABLE . " FROM " . FORUMS_TABLE . "
WHERE forum_id = $forum_id"; WHERE forum_id = $forum_id";
break; break;
@ -177,7 +177,7 @@ switch ( $mode )
message_die(MESSAGE, $lang['No_topic_id']); message_die(MESSAGE, $lang['No_topic_id']);
} }
$sql = "SELECT f.*, t.topic_status $sql = "SELECT f.*, t.topic_status
FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t
WHERE t.topic_id = $topic_id WHERE t.topic_id = $topic_id
AND f.forum_id = t.forum_id"; AND f.forum_id = t.forum_id";
@ -196,10 +196,10 @@ switch ( $mode )
$from_sql = ( !$submit ) ? ", " . POSTS_TEXT_TABLE . " pt, " . USERS_TABLE . " u" : ''; $from_sql = ( !$submit ) ? ", " . POSTS_TEXT_TABLE . " pt, " . USERS_TABLE . " u" : '';
$where_sql = ( !$submit ) ? "AND pt.post_id = p.post_id AND u.user_id = p.poster_id" : ''; $where_sql = ( !$submit ) ? "AND pt.post_id = p.post_id AND u.user_id = p.poster_id" : '';
$sql = "SELECT f.*, t.topic_id, t.topic_status, t.topic_type, t.topic_first_post_id, t.topic_last_post_id, t.topic_vote, p.post_id, p.poster_id" . $select_sql . " $sql = "SELECT f.*, t.topic_id, t.topic_status, t.topic_type, t.topic_first_post_id, t.topic_last_post_id, t.topic_vote, p.post_id, p.poster_id" . $select_sql . "
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $from_sql . " FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $from_sql . "
WHERE p.post_id = $post_id WHERE p.post_id = $post_id
AND t.topic_id = p.topic_id AND t.topic_id = p.topic_id
AND f.forum_id = p.forum_id AND f.forum_id = p.forum_id
$where_sql"; $where_sql";
break; break;
@ -221,14 +221,14 @@ if ( $result = $db->sql_query($sql) )
$forum_id = $post_info['forum_id']; $forum_id = $post_info['forum_id'];
$forum_name = $post_info['forum_name']; $forum_name = $post_info['forum_name'];
if ( $post_info['forum_status'] == FORUM_LOCKED && !$is_auth['auth_mod']) if ( $post_info['forum_status'] == FORUM_LOCKED && !$is_auth['auth_mod'])
{ {
message_die(MESSAGE, $lang['Forum_locked']); message_die(MESSAGE, $lang['Forum_locked']);
} }
else if ( $mode != 'newtopic' && $post_info['topic_status'] == TOPIC_LOCKED && !$is_auth['auth_mod']) else if ( $mode != 'newtopic' && $post_info['topic_status'] == TOPIC_LOCKED && !$is_auth['auth_mod'])
{ {
message_die(MESSAGE, $lang['Topic_locked']); message_die(MESSAGE, $lang['Topic_locked']);
} }
if ( $mode == 'editpost' || $mode == 'delete' || $mode == 'poll_delete' ) if ( $mode == 'editpost' || $mode == 'delete' || $mode == 'poll_delete' )
{ {
@ -238,16 +238,16 @@ if ( $result = $db->sql_query($sql) )
$post_data['first_post'] = ( $post_info['topic_first_post_id'] == $post_id ) ? true : false; $post_data['first_post'] = ( $post_info['topic_first_post_id'] == $post_id ) ? true : false;
$post_data['last_post'] = ( $post_info['topic_last_post_id'] == $post_id ) ? true : false; $post_data['last_post'] = ( $post_info['topic_last_post_id'] == $post_id ) ? true : false;
$post_data['last_topic'] = ( $post_info['forum_last_post_id'] == $post_id ) ? true : false; $post_data['last_topic'] = ( $post_info['forum_last_post_id'] == $post_id ) ? true : false;
$post_data['has_poll'] = ( $post_info['topic_vote'] ) ? true : false; $post_data['has_poll'] = ( $post_info['topic_vote'] ) ? true : false;
$post_data['topic_type'] = $post_info['topic_type']; $post_data['topic_type'] = $post_info['topic_type'];
$post_data['poster_id'] = $post_info['poster_id']; $post_data['poster_id'] = $post_info['poster_id'];
if ( $post_data['first_post'] && $post_data['has_poll'] ) if ( $post_data['first_post'] && $post_data['has_poll'] )
{ {
$sql = "SELECT * $sql = "SELECT *
FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
WHERE vd.topic_id = $topic_id WHERE vd.topic_id = $topic_id
AND vr.vote_id = vd.vote_id AND vr.vote_id = vd.vote_id
ORDER BY vr.vote_option_id"; ORDER BY vr.vote_option_id";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -261,7 +261,7 @@ if ( $result = $db->sql_query($sql) )
do do
{ {
$poll_options[$row['vote_option_id']] = $row['vote_option_text']; $poll_options[$row['vote_option_id']] = $row['vote_option_text'];
$poll_results_sum += $row['vote_result']; $poll_results_sum += $row['vote_result'];
} }
while ( $row = $db->sql_fetchrow($result) ); while ( $row = $db->sql_fetchrow($result) );
@ -273,7 +273,7 @@ if ( $result = $db->sql_query($sql) )
{ {
$post_data['edit_poll'] = false; $post_data['edit_poll'] = false;
} }
// //
// Can this user edit/delete the post/poll? // Can this user edit/delete the post/poll?
// //
@ -381,9 +381,9 @@ else
{ {
if ( $mode != 'newtopic' && $userdata['session_logged_in'] ) if ( $mode != 'newtopic' && $userdata['session_logged_in'] )
{ {
$sql = "SELECT topic_id $sql = "SELECT topic_id
FROM " . TOPICS_WATCH_TABLE . " FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = $topic_id WHERE topic_id = $topic_id
AND user_id = " . $userdata['user_id']; AND user_id = " . $userdata['user_id'];
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -441,10 +441,10 @@ else if ( $mode == 'vote' )
{ {
$vote_option_id = intval($HTTP_POST_VARS['vote_id']); $vote_option_id = intval($HTTP_POST_VARS['vote_id']);
$sql = "SELECT vd.vote_id $sql = "SELECT vd.vote_id
FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
WHERE vd.topic_id = $topic_id WHERE vd.topic_id = $topic_id
AND vr.vote_id = vd.vote_id AND vr.vote_id = vd.vote_id
AND vr.vote_option_id = $vote_option_id AND vr.vote_option_id = $vote_option_id
GROUP BY vd.vote_id"; GROUP BY vd.vote_id";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -453,24 +453,24 @@ else if ( $mode == 'vote' )
{ {
$vote_id = $vote_info['vote_id']; $vote_id = $vote_info['vote_id'];
$sql = "SELECT * $sql = "SELECT *
FROM " . VOTE_USERS_TABLE . " FROM " . VOTE_USERS_TABLE . "
WHERE vote_id = $vote_id WHERE vote_id = $vote_id
AND vote_user_id = " . $userdata['user_id']; AND vote_user_id = " . $userdata['user_id'];
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if ( !($row = $db->sql_fetchrow($result)) ) if ( !($row = $db->sql_fetchrow($result)) )
{ {
$sql = "UPDATE " . VOTE_RESULTS_TABLE . " $sql = "UPDATE " . VOTE_RESULTS_TABLE . "
SET vote_result = vote_result + 1 SET vote_result = vote_result + 1
WHERE vote_id = $vote_id WHERE vote_id = $vote_id
AND vote_option_id = $vote_option_id"; AND vote_option_id = $vote_option_id";
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) ) if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{ {
message_die(GENERAL_ERROR, 'Could not update poll result', '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not update poll result', '', __LINE__, __FILE__, $sql);
} }
$sql = "INSERT INTO " . VOTE_USERS_TABLE . " (vote_id, vote_user_id, vote_user_ip) $sql = "INSERT INTO " . VOTE_USERS_TABLE . " (vote_id, vote_user_id, vote_user_ip)
VALUES ($vote_id, " . $userdata['user_id'] . ", '$user_ip')"; VALUES ($vote_id, " . $userdata['user_id'] . ", '$user_ip')";
if ( !$db->sql_query($sql, END_TRANSACTION) ) if ( !$db->sql_query($sql, END_TRANSACTION) )
{ {
@ -584,7 +584,7 @@ if( $refresh || isset($HTTP_POST_VARS['del_poll_option']) || $error_msg != '' )
{ {
unset($poll_options[$option_id]); unset($poll_options[$option_id]);
} }
else if ( !empty($option_text) ) else if ( !empty($option_text) )
{ {
$poll_options[$option_id] = htmlspecialchars(trim(stripslashes($option_text))); $poll_options[$option_id] = htmlspecialchars(trim(stripslashes($option_text)));
} }
@ -604,7 +604,7 @@ if( $refresh || isset($HTTP_POST_VARS['del_poll_option']) || $error_msg != '' )
{ {
$user_sig = ( $post_info['user_sig'] != '' ) ? $post_info['user_sig'] : ''; $user_sig = ( $post_info['user_sig'] != '' ) ? $post_info['user_sig'] : '';
} }
if( $preview ) if( $preview )
{ {
$orig_word = array(); $orig_word = array();
@ -678,9 +678,9 @@ if( $refresh || isset($HTTP_POST_VARS['del_poll_option']) || $error_msg != '' )
'POST_DATE' => create_date($board_config['default_dateformat'], time(), $board_config['board_timezone']), 'POST_DATE' => create_date($board_config['default_dateformat'], time(), $board_config['board_timezone']),
'MESSAGE' => $preview_message, 'MESSAGE' => $preview_message,
'L_POST_SUBJECT' => $lang['Post_subject'], 'L_POST_SUBJECT' => $lang['Post_subject'],
'L_PREVIEW' => $lang['Preview'], 'L_PREVIEW' => $lang['Preview'],
'L_POSTED' => $lang['Posted'], 'L_POSTED' => $lang['Posted'],
'L_POST' => $lang['Post']) 'L_POST' => $lang['Post'])
); );
$template->assign_var_from_handle('POST_PREVIEW_BOX', 'preview'); $template->assign_var_from_handle('POST_PREVIEW_BOX', 'preview');
@ -727,7 +727,7 @@ else
if ( $mode == 'editpost' ) if ( $mode == 'editpost' )
{ {
$attach_sig = ( $post_info['enable_sig'] && $post_info['user_sig'] != '' ) ? TRUE : 0; $attach_sig = ( $post_info['enable_sig'] && $post_info['user_sig'] != '' ) ? TRUE : 0;
$user_sig = $post_info['user_sig']; $user_sig = $post_info['user_sig'];
$html_on = ( $post_info['enable_html'] ) ? true : false; $html_on = ( $post_info['enable_html'] ) ? true : false;
@ -914,8 +914,8 @@ generate_smilies('inline', PAGE_POSTING);
include($phpbb_root_path . 'includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
'body' => 'posting_body.html', 'body' => 'posting_body.html',
'pollbody' => 'posting_poll_body.html', 'pollbody' => 'posting_poll_body.html',
'reviewbody' => 'posting_topic_review.html') 'reviewbody' => 'posting_topic_review.html')
); );
make_jumpbox('viewforum.'.$phpEx); make_jumpbox('viewforum.'.$phpEx);
@ -923,7 +923,7 @@ make_jumpbox('viewforum.'.$phpEx);
$template->assign_vars(array( $template->assign_vars(array(
'FORUM_NAME' => $forum_name, 'FORUM_NAME' => $forum_name,
'L_POST_A' => $page_title, 'L_POST_A' => $page_title,
'L_POST_SUBJECT' => $lang['Post_subject'], 'L_POST_SUBJECT' => $lang['Post_subject'],
'U_VIEW_FORUM' => "viewforum.$phpEx$SID&amp;" . POST_FORUM_URL . "=$forum_id") 'U_VIEW_FORUM' => "viewforum.$phpEx$SID&amp;" . POST_FORUM_URL . "=$forum_id")
); );
@ -942,8 +942,8 @@ $template->assign_vars(array(
'SUBJECT' => $subject, 'SUBJECT' => $subject,
'MESSAGE' => $message, 'MESSAGE' => $message,
'HTML_STATUS' => $html_status, 'HTML_STATUS' => $html_status,
'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . "faq.$phpEx$SID&amp;mode=bbcode" . '" target="_phpbbcode">', '</a>'), 'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . "faq.$phpEx$SID&amp;mode=bbcode" . '" target="_phpbbcode">', '</a>'),
'SMILIES_STATUS' => $smilies_status, 'SMILIES_STATUS' => $smilies_status,
'L_SUBJECT' => $lang['Subject'], 'L_SUBJECT' => $lang['Subject'],
'L_MESSAGE_BODY' => $lang['Message_body'], 'L_MESSAGE_BODY' => $lang['Message_body'],
@ -953,64 +953,64 @@ $template->assign_vars(array(
'L_SUBMIT' => $lang['Submit'], 'L_SUBMIT' => $lang['Submit'],
'L_CANCEL' => $lang['Cancel'], 'L_CANCEL' => $lang['Cancel'],
'L_CONFIRM_DELETE' => $lang['Confirm_delete'], 'L_CONFIRM_DELETE' => $lang['Confirm_delete'],
'L_DISABLE_HTML' => $lang['Disable_HTML_post'], 'L_DISABLE_HTML' => $lang['Disable_HTML_post'],
'L_DISABLE_BBCODE' => $lang['Disable_BBCode_post'], 'L_DISABLE_BBCODE' => $lang['Disable_BBCode_post'],
'L_DISABLE_SMILIES' => $lang['Disable_Smilies_post'], 'L_DISABLE_SMILIES' => $lang['Disable_Smilies_post'],
'L_ATTACH_SIGNATURE' => $lang['Attach_signature'], 'L_ATTACH_SIGNATURE' => $lang['Attach_signature'],
'L_NOTIFY_ON_REPLY' => $lang['Notify'], 'L_NOTIFY_ON_REPLY' => $lang['Notify'],
'L_DELETE_POST' => $lang['Delete_post'], 'L_DELETE_POST' => $lang['Delete_post'],
'L_BBCODE_B_HELP' => $lang['bbcode_b_help'], 'L_BBCODE_B_HELP' => $lang['bbcode_b_help'],
'L_BBCODE_I_HELP' => $lang['bbcode_i_help'], 'L_BBCODE_I_HELP' => $lang['bbcode_i_help'],
'L_BBCODE_U_HELP' => $lang['bbcode_u_help'], 'L_BBCODE_U_HELP' => $lang['bbcode_u_help'],
'L_BBCODE_Q_HELP' => $lang['bbcode_q_help'], 'L_BBCODE_Q_HELP' => $lang['bbcode_q_help'],
'L_BBCODE_C_HELP' => $lang['bbcode_c_help'], 'L_BBCODE_C_HELP' => $lang['bbcode_c_help'],
'L_BBCODE_L_HELP' => $lang['bbcode_l_help'], 'L_BBCODE_L_HELP' => $lang['bbcode_l_help'],
'L_BBCODE_O_HELP' => $lang['bbcode_o_help'], 'L_BBCODE_O_HELP' => $lang['bbcode_o_help'],
'L_BBCODE_P_HELP' => $lang['bbcode_p_help'], 'L_BBCODE_P_HELP' => $lang['bbcode_p_help'],
'L_BBCODE_W_HELP' => $lang['bbcode_w_help'], 'L_BBCODE_W_HELP' => $lang['bbcode_w_help'],
'L_BBCODE_A_HELP' => $lang['bbcode_a_help'], 'L_BBCODE_A_HELP' => $lang['bbcode_a_help'],
'L_BBCODE_S_HELP' => $lang['bbcode_s_help'], 'L_BBCODE_S_HELP' => $lang['bbcode_s_help'],
'L_BBCODE_F_HELP' => $lang['bbcode_f_help'], 'L_BBCODE_F_HELP' => $lang['bbcode_f_help'],
'L_EMPTY_MESSAGE' => $lang['Empty_message'], 'L_EMPTY_MESSAGE' => $lang['Empty_message'],
'L_FONT_COLOR' => $lang['Font_color'], 'L_FONT_COLOR' => $lang['Font_color'],
'L_COLOR_DEFAULT' => $lang['color_default'], 'L_COLOR_DEFAULT' => $lang['color_default'],
'L_COLOR_DARK_RED' => $lang['color_dark_red'], 'L_COLOR_DARK_RED' => $lang['color_dark_red'],
'L_COLOR_RED' => $lang['color_red'], 'L_COLOR_RED' => $lang['color_red'],
'L_COLOR_ORANGE' => $lang['color_orange'], 'L_COLOR_ORANGE' => $lang['color_orange'],
'L_COLOR_BROWN' => $lang['color_brown'], 'L_COLOR_BROWN' => $lang['color_brown'],
'L_COLOR_YELLOW' => $lang['color_yellow'], 'L_COLOR_YELLOW' => $lang['color_yellow'],
'L_COLOR_GREEN' => $lang['color_green'], 'L_COLOR_GREEN' => $lang['color_green'],
'L_COLOR_OLIVE' => $lang['color_olive'], 'L_COLOR_OLIVE' => $lang['color_olive'],
'L_COLOR_CYAN' => $lang['color_cyan'], 'L_COLOR_CYAN' => $lang['color_cyan'],
'L_COLOR_BLUE' => $lang['color_blue'], 'L_COLOR_BLUE' => $lang['color_blue'],
'L_COLOR_DARK_BLUE' => $lang['color_dark_blue'], 'L_COLOR_DARK_BLUE' => $lang['color_dark_blue'],
'L_COLOR_INDIGO' => $lang['color_indigo'], 'L_COLOR_INDIGO' => $lang['color_indigo'],
'L_COLOR_VIOLET' => $lang['color_violet'], 'L_COLOR_VIOLET' => $lang['color_violet'],
'L_COLOR_WHITE' => $lang['color_white'], 'L_COLOR_WHITE' => $lang['color_white'],
'L_COLOR_BLACK' => $lang['color_black'], 'L_COLOR_BLACK' => $lang['color_black'],
'L_FONT_SIZE' => $lang['Font_size'], 'L_FONT_SIZE' => $lang['Font_size'],
'L_FONT_TINY' => $lang['font_tiny'], 'L_FONT_TINY' => $lang['font_tiny'],
'L_FONT_SMALL' => $lang['font_small'], 'L_FONT_SMALL' => $lang['font_small'],
'L_FONT_NORMAL' => $lang['font_normal'], 'L_FONT_NORMAL' => $lang['font_normal'],
'L_FONT_LARGE' => $lang['font_large'], 'L_FONT_LARGE' => $lang['font_large'],
'L_FONT_HUGE' => $lang['font_huge'], 'L_FONT_HUGE' => $lang['font_huge'],
'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'], 'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'],
'L_STYLES_TIP' => $lang['Styles_tip'], 'L_STYLES_TIP' => $lang['Styles_tip'],
'U_VIEWTOPIC' => ( $mode == 'reply' ) ? "viewtopic.$phpEx$SID&amp;m" . POST_TOPIC_URL . "=$topic_id&amp;postorder=desc" : '', 'U_VIEWTOPIC' => ( $mode == 'reply' ) ? "viewtopic.$phpEx$SID&amp;m" . POST_TOPIC_URL . "=$topic_id&amp;postorder=desc" : '',
'U_REVIEW_TOPIC' => ( $mode == 'reply' ) ? "posting.$phpEx$SID&amp;mmode=topicreview&amp;" . POST_TOPIC_URL . "=$topic_id" : '', 'U_REVIEW_TOPIC' => ( $mode == 'reply' ) ? "posting.$phpEx$SID&amp;mmode=topicreview&amp;" . POST_TOPIC_URL . "=$topic_id" : '',
'S_HTML_CHECKED' => ( !$html_on ) ? 'checked="checked"' : '', 'S_HTML_CHECKED' => ( !$html_on ) ? 'checked="checked"' : '',
'S_BBCODE_CHECKED' => ( !$bbcode_on ) ? 'checked="checked"' : '', 'S_BBCODE_CHECKED' => ( !$bbcode_on ) ? 'checked="checked"' : '',
'S_SMILIES_CHECKED' => ( !$smilies_on ) ? 'checked="checked"' : '', 'S_SMILIES_CHECKED' => ( !$smilies_on ) ? 'checked="checked"' : '',
'S_SIGNATURE_CHECKED' => ( $attach_sig ) ? 'checked="checked"' : '', 'S_SIGNATURE_CHECKED' => ( $attach_sig ) ? 'checked="checked"' : '',
'S_NOTIFY_CHECKED' => ( $notify_user ) ? 'checked="checked"' : '', 'S_NOTIFY_CHECKED' => ( $notify_user ) ? 'checked="checked"' : '',
'S_TYPE_TOGGLE' => $topic_type_toggle, 'S_TYPE_TOGGLE' => $topic_type_toggle,
'S_TOPIC_ID' => $topic_id, 'S_TOPIC_ID' => $topic_id,
'S_POST_ACTION' => "posting.$phpEx$SID", 'S_POST_ACTION' => "posting.$phpEx$SID",
'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields) 'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields)
); );
@ -1021,18 +1021,18 @@ $template->assign_vars(array(
if( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) ) && $is_auth['auth_pollcreate'] ) if( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) ) && $is_auth['auth_pollcreate'] )
{ {
$template->assign_vars(array( $template->assign_vars(array(
'L_ADD_A_POLL' => $lang['Add_poll'], 'L_ADD_A_POLL' => $lang['Add_poll'],
'L_ADD_POLL_EXPLAIN' => $lang['Add_poll_explain'], 'L_ADD_POLL_EXPLAIN' => $lang['Add_poll_explain'],
'L_POLL_QUESTION' => $lang['Poll_question'], 'L_POLL_QUESTION' => $lang['Poll_question'],
'L_POLL_OPTION' => $lang['Poll_option'], 'L_POLL_OPTION' => $lang['Poll_option'],
'L_ADD_OPTION' => $lang['Add_option'], 'L_ADD_OPTION' => $lang['Add_option'],
'L_UPDATE_OPTION' => $lang['Update'], 'L_UPDATE_OPTION' => $lang['Update'],
'L_DELETE_OPTION' => $lang['Delete'], 'L_DELETE_OPTION' => $lang['Delete'],
'L_POLL_LENGTH' => $lang['Poll_for'], 'L_POLL_LENGTH' => $lang['Poll_for'],
'L_DAYS' => $lang['Days'], 'L_DAYS' => $lang['Days'],
'L_POLL_LENGTH_EXPLAIN' => $lang['Poll_for_explain'], 'L_POLL_LENGTH_EXPLAIN' => $lang['Poll_for_explain'],
'L_POLL_DELETE' => $lang['Delete_poll'], 'L_POLL_DELETE' => $lang['Delete_poll'],
'POLL_TITLE' => $poll_title, 'POLL_TITLE' => $poll_title,
'POLL_LENGTH' => $poll_length) 'POLL_LENGTH' => $poll_length)
); );
@ -1047,7 +1047,7 @@ if( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] )
while( list($option_id, $option_text) = each($poll_options) ) while( list($option_id, $option_text) = each($poll_options) )
{ {
$template->assign_block_vars('poll_option_rows', array( $template->assign_block_vars('poll_option_rows', array(
'POLL_OPTION' => str_replace('"', '&quot;', $option_text), 'POLL_OPTION' => str_replace('"', '&quot;', $option_text),
'S_POLL_OPTION_NUM' => $option_id) 'S_POLL_OPTION_NUM' => $option_id)
); );

View file

@ -42,7 +42,7 @@ $html_entities_replace = array('&amp;', '&lt;', '&gt;');
// Parameters // Parameters
// //
$submit = ( isset($HTTP_POST_VARS['post']) ) ? TRUE : 0; $submit = ( isset($HTTP_POST_VARS['post']) ) ? TRUE : 0;
$submit_search = ( isset($HTTP_POST_VARS['usersubmit']) ) ? TRUE : 0; $submit_search = ( isset($HTTP_POST_VARS['usersubmit']) ) ? TRUE : 0;
$submit_msgdays = ( isset($HTTP_POST_VARS['submit_msgdays']) ) ? TRUE : 0; $submit_msgdays = ( isset($HTTP_POST_VARS['submit_msgdays']) ) ? TRUE : 0;
$cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? TRUE : 0; $cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? TRUE : 0;
$preview = ( isset($HTTP_POST_VARS['preview']) ) ? TRUE : 0; $preview = ( isset($HTTP_POST_VARS['preview']) ) ? TRUE : 0;
@ -69,7 +69,7 @@ else
} }
// //
// Cancel // Cancel
// //
if ( $cancel ) if ( $cancel )
{ {
@ -82,7 +82,7 @@ if ( $cancel )
// Start session management // Start session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new auth('list', $userdata); $acl = new acl('list', $userdata);
// //
// End session management // End session management
// //
@ -160,14 +160,14 @@ if ( $mode == 'newpm' )
} }
$template->assign_vars(array( $template->assign_vars(array(
'L_CLOSE_WINDOW' => $lang['Close_window'], 'L_CLOSE_WINDOW' => $lang['Close_window'],
'L_MESSAGE' => $l_new_message) 'L_MESSAGE' => $l_new_message)
); );
$template->pparse('body'); $template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
} }
else if ( $mode == 'read' ) else if ( $mode == 'read' )
{ {
@ -194,28 +194,28 @@ else if ( $mode == 'read' )
{ {
case 'inbox': case 'inbox':
$l_box_name = $lang['Inbox']; $l_box_name = $lang['Inbox'];
$pm_sql_user = "AND pm.privmsgs_to_userid = " . $userdata['user_id'] . " $pm_sql_user = "AND pm.privmsgs_to_userid = " . $userdata['user_id'] . "
AND ( pm.privmsgs_type = " . PRIVMSGS_READ_MAIL . " AND ( pm.privmsgs_type = " . PRIVMSGS_READ_MAIL . "
OR pm.privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR pm.privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
OR pm.privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )"; OR pm.privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )";
break; break;
case 'outbox': case 'outbox':
$l_box_name = $lang['Outbox']; $l_box_name = $lang['Outbox'];
$pm_sql_user = "AND pm.privmsgs_from_userid = " . $userdata['user_id'] . " $pm_sql_user = "AND pm.privmsgs_from_userid = " . $userdata['user_id'] . "
AND ( pm.privmsgs_type = " . PRIVMSGS_NEW_MAIL . " AND ( pm.privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
OR pm.privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " ) "; OR pm.privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " ) ";
break; break;
case 'sentbox': case 'sentbox':
$l_box_name = $lang['Sentbox']; $l_box_name = $lang['Sentbox'];
$pm_sql_user = "AND pm.privmsgs_from_userid = " . $userdata['user_id'] . " $pm_sql_user = "AND pm.privmsgs_from_userid = " . $userdata['user_id'] . "
AND pm.privmsgs_type = " . PRIVMSGS_SENT_MAIL; AND pm.privmsgs_type = " . PRIVMSGS_SENT_MAIL;
break; break;
case 'savebox': case 'savebox':
$l_box_name = $lang['Savebox']; $l_box_name = $lang['Savebox'];
$pm_sql_user .= "AND ( ( pm.privmsgs_to_userid = " . $userdata['user_id'] . " $pm_sql_user .= "AND ( ( pm.privmsgs_to_userid = " . $userdata['user_id'] . "
AND pm.privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " ) AND pm.privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " )
OR ( pm.privmsgs_from_userid = " . $userdata['user_id'] . " OR ( pm.privmsgs_from_userid = " . $userdata['user_id'] . "
AND pm.privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . " ) AND pm.privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . " )
)"; )";
break; break;
default: default:
@ -227,11 +227,11 @@ else if ( $mode == 'read' )
// Major query obtains the message ... // Major query obtains the message ...
// //
$sql = "SELECT u.username AS username_1, u.user_id AS user_id_1, u2.username AS username_2, u2.user_id AS user_id_2, u.user_sig_bbcode_uid, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_avatar, pm.*, pmt.privmsgs_bbcode_uid, pmt.privmsgs_text $sql = "SELECT u.username AS username_1, u.user_id AS user_id_1, u2.username AS username_2, u2.user_id AS user_id_2, u.user_sig_bbcode_uid, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_avatar, pm.*, pmt.privmsgs_bbcode_uid, pmt.privmsgs_text
FROM " . PRIVMSGS_TABLE . " pm, " . PRIVMSGS_TEXT_TABLE . " pmt, " . USERS_TABLE . " u, " . USERS_TABLE . " u2 FROM " . PRIVMSGS_TABLE . " pm, " . PRIVMSGS_TEXT_TABLE . " pmt, " . USERS_TABLE . " u, " . USERS_TABLE . " u2
WHERE pm.privmsgs_id = $privmsgs_id WHERE pm.privmsgs_id = $privmsgs_id
AND pmt.privmsgs_text_id = pm.privmsgs_id AND pmt.privmsgs_text_id = pm.privmsgs_id
$pm_sql_user $pm_sql_user
AND u.user_id = pm.privmsgs_from_userid AND u.user_id = pm.privmsgs_from_userid
AND u2.user_id = pm.privmsgs_to_userid"; AND u2.user_id = pm.privmsgs_to_userid";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -263,8 +263,8 @@ else if ( $mode == 'read' )
message_die(GENERAL_ERROR, 'Could not update private message read status', '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not update private message read status', '', __LINE__, __FILE__, $sql);
} }
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_unread_privmsg = user_unread_privmsg - 1 SET user_unread_privmsg = user_unread_privmsg - 1
WHERE user_id = " . $userdata['user_id']; WHERE user_id = " . $userdata['user_id'];
if ( !$db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
@ -274,9 +274,9 @@ else if ( $mode == 'read' )
// //
// Check to see if the poster has a 'full' sent box // Check to see if the poster has a 'full' sent box
// //
$sql = "SELECT COUNT(privmsgs_id) AS sent_items, MIN(privmsgs_date) AS oldest_post_time $sql = "SELECT COUNT(privmsgs_id) AS sent_items, MIN(privmsgs_date) AS oldest_post_time
FROM " . PRIVMSGS_TABLE . " FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_type = " . PRIVMSGS_SENT_MAIL . " WHERE privmsgs_type = " . PRIVMSGS_SENT_MAIL . "
AND privmsgs_from_userid = " . $privmsg['privmsgs_from_userid']; AND privmsgs_from_userid = " . $privmsg['privmsgs_from_userid'];
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -289,9 +289,9 @@ else if ( $mode == 'read' )
{ {
if ( $sent_info['sent_items'] >= $board_config['max_sentbox_privmsgs'] ) if ( $sent_info['sent_items'] >= $board_config['max_sentbox_privmsgs'] )
{ {
$sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . " $sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_type = " . PRIVMSGS_SENT_MAIL . " WHERE privmsgs_type = " . PRIVMSGS_SENT_MAIL . "
AND privmsgs_date = " . $sent_info['oldest_post_time'] . " AND privmsgs_date = " . $sent_info['oldest_post_time'] . "
AND privmsgs_from_userid = " . $privmsg['privmsgs_from_userid']; AND privmsgs_from_userid = " . $privmsg['privmsgs_from_userid'];
if ( !$db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
@ -419,26 +419,26 @@ else if ( $mode == 'read' )
make_jumpbox('viewforum.'.$phpEx); make_jumpbox('viewforum.'.$phpEx);
$template->assign_vars(array( $template->assign_vars(array(
'INBOX_IMG' => $inbox_img, 'INBOX_IMG' => $inbox_img,
'SENTBOX_IMG' => $sentbox_img, 'SENTBOX_IMG' => $sentbox_img,
'OUTBOX_IMG' => $outbox_img, 'OUTBOX_IMG' => $outbox_img,
'SAVEBOX_IMG' => $savebox_img, 'SAVEBOX_IMG' => $savebox_img,
'INBOX' => $inbox_url, 'INBOX' => $inbox_url,
'POST_PM_IMG' => $post_img, 'POST_PM_IMG' => $post_img,
'REPLY_PM_IMG' => $reply_img, 'REPLY_PM_IMG' => $reply_img,
'EDIT_PM_IMG' => $edit_img, 'EDIT_PM_IMG' => $edit_img,
'QUOTE_PM_IMG' => $quote_img, 'QUOTE_PM_IMG' => $quote_img,
'POST_PM' => $post, 'POST_PM' => $post,
'REPLY_PM' => $reply, 'REPLY_PM' => $reply,
'EDIT_PM' => $edit, 'EDIT_PM' => $edit,
'QUOTE_PM' => $quote, 'QUOTE_PM' => $quote,
'SENTBOX' => $sentbox_url, 'SENTBOX' => $sentbox_url,
'OUTBOX' => $outbox_url, 'OUTBOX' => $outbox_url,
'SAVEBOX' => $savebox_url, 'SAVEBOX' => $savebox_url,
'BOX_NAME' => $l_box_name, 'BOX_NAME' => $l_box_name,
'L_INBOX' => $lang['Inbox'], 'L_INBOX' => $lang['Inbox'],
'L_OUTBOX' => $lang['Outbox'], 'L_OUTBOX' => $lang['Outbox'],
@ -446,17 +446,17 @@ else if ( $mode == 'read' )
'L_SAVEBOX' => $lang['Saved'], 'L_SAVEBOX' => $lang['Saved'],
'L_FLAG' => $lang['Flag'], 'L_FLAG' => $lang['Flag'],
'L_SUBJECT' => $lang['Subject'], 'L_SUBJECT' => $lang['Subject'],
'L_POSTED' => $lang['Posted'], 'L_POSTED' => $lang['Posted'],
'L_DATE' => $lang['Date'], 'L_DATE' => $lang['Date'],
'L_FROM' => $lang['From'], 'L_FROM' => $lang['From'],
'L_TO' => $lang['To'], 'L_TO' => $lang['To'],
'L_SAVE_MSG' => $lang['Save_message'], 'L_SAVE_MSG' => $lang['Save_message'],
'L_DELETE_MSG' => $lang['Delete_message'], 'L_DELETE_MSG' => $lang['Delete_message'],
'S_PRIVMSGS_ACTION' => append_sid("privmsg.$phpEx?folder=$folder"), 'S_PRIVMSGS_ACTION' => append_sid("privmsg.$phpEx?folder=$folder"),
'S_HIDDEN_FIELDS' => $s_hidden_fields) 'S_HIDDEN_FIELDS' => $s_hidden_fields)
); );
$username_from = $privmsg['username_1']; $username_from = $privmsg['username_1'];
$user_id_from = $privmsg['user_id_1']; $user_id_from = $privmsg['user_id_1'];
$username_to = $privmsg['username_2']; $username_to = $privmsg['username_2'];
@ -593,11 +593,11 @@ else if ( $mode == 'read' )
'POSTER_FROM' => $poster_from, 'POSTER_FROM' => $poster_from,
'POSTER_AVATAR' => $poster_avatar, 'POSTER_AVATAR' => $poster_avatar,
'POST_SUBJECT' => $post_subject, 'POST_SUBJECT' => $post_subject,
'POST_DATE' => $post_date, 'POST_DATE' => $post_date,
'MESSAGE' => $private_message, 'MESSAGE' => $private_message,
'PROFILE_IMG' => $profile_img, 'PROFILE_IMG' => $profile_img,
'PROFILE' => $profile, 'PROFILE' => $profile,
'SEARCH_IMG' => $search_img, 'SEARCH_IMG' => $search_img,
'SEARCH' => $search, 'SEARCH' => $search,
'EMAIL_IMG' => $email_img, 'EMAIL_IMG' => $email_img,
@ -605,8 +605,8 @@ else if ( $mode == 'read' )
'WWW_IMG' => $www_img, 'WWW_IMG' => $www_img,
'WWW' => $www, 'WWW' => $www,
'ICQ_STATUS_IMG' => $icq_status_img, 'ICQ_STATUS_IMG' => $icq_status_img,
'ICQ_IMG' => $icq_img, 'ICQ_IMG' => $icq_img,
'ICQ' => $icq, 'ICQ' => $icq,
'AIM_IMG' => $aim_img, 'AIM_IMG' => $aim_img,
'AIM' => $aim, 'AIM' => $aim,
'MSN_IMG' => $msn_img, 'MSN_IMG' => $msn_img,
@ -653,7 +653,7 @@ else if ( ( $delete && $mark_list ) || $delete_all )
); );
$template->assign_vars(array( $template->assign_vars(array(
'MESSAGE_TITLE' => $lang['Information'], 'MESSAGE_TITLE' => $lang['Information'],
'MESSAGE_TEXT' => ( count($mark_list) == 1 ) ? $lang['Confirm_delete_pm'] : $lang['Confirm_delete_pms'], 'MESSAGE_TEXT' => ( count($mark_list) == 1 ) ? $lang['Confirm_delete_pm'] : $lang['Confirm_delete_pms'],
'L_YES' => $lang['Yes'], 'L_YES' => $lang['Yes'],
'L_NO' => $lang['No'], 'L_NO' => $lang['No'],
@ -687,9 +687,9 @@ else if ( ( $delete && $mark_list ) || $delete_all )
break; break;
case 'savebox': case 'savebox':
$delete_type = "( ( privmsgs_from_userid = " . $userdata['user_id'] . " $delete_type = "( ( privmsgs_from_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . " ) AND privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . " )
OR ( privmsgs_to_userid = " . $userdata['user_id'] . " OR ( privmsgs_to_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " ) )"; AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " ) )";
break; break;
} }
@ -721,10 +721,10 @@ else if ( ( $delete && $mark_list ) || $delete_all )
// //
if ( $folder == 'outbox' ) if ( $folder == 'outbox' )
{ {
$sql = "SELECT privmsgs_to_userid $sql = "SELECT privmsgs_to_userid
FROM " . PRIVMSGS_TABLE . " FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_id IN ($delete_sql_id) WHERE privmsgs_id IN ($delete_sql_id)
AND privmsgs_from_userid = " . $userdata['user_id'] . " AND privmsgs_from_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_NEW_MAIL; AND privmsgs_type = " . PRIVMSGS_NEW_MAIL;
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -739,8 +739,8 @@ else if ( ( $delete && $mark_list ) || $delete_all )
if ( $update_pm_sql != '' ) if ( $update_pm_sql != '' )
{ {
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_new_privmsg = user_new_privmsg - 1 SET user_new_privmsg = user_new_privmsg - 1
WHERE user_id IN ($update_pm_sql)"; WHERE user_id IN ($update_pm_sql)";
if ( !$db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
@ -748,10 +748,10 @@ else if ( ( $delete && $mark_list ) || $delete_all )
} }
} }
$sql = "SELECT privmsgs_to_userid $sql = "SELECT privmsgs_to_userid
FROM " . PRIVMSGS_TABLE . " FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_id IN ($delete_sql_id) WHERE privmsgs_id IN ($delete_sql_id)
AND privmsgs_from_userid = " . $userdata['user_id'] . " AND privmsgs_from_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_UNREAD_MAIL; AND privmsgs_type = " . PRIVMSGS_UNREAD_MAIL;
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -766,8 +766,8 @@ else if ( ( $delete && $mark_list ) || $delete_all )
if ( $update_pm_sql != '' ) if ( $update_pm_sql != '' )
{ {
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_unread_privmsg = user_unread_privmsg - 1 SET user_unread_privmsg = user_unread_privmsg - 1
WHERE user_id IN ($update_pm_sql)"; WHERE user_id IN ($update_pm_sql)";
if ( !$db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
@ -790,7 +790,7 @@ else if ( ( $delete && $mark_list ) || $delete_all )
break; break;
case 'outbox': case 'outbox':
$delete_sql .= "privmsgs_from_userid = " . $userdata['user_id'] . " AND ( $delete_sql .= "privmsgs_from_userid = " . $userdata['user_id'] . " AND (
privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )"; privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )";
break; break;
@ -799,9 +799,9 @@ else if ( ( $delete && $mark_list ) || $delete_all )
break; break;
case 'savebox': case 'savebox':
$delete_sql .= "( ( privmsgs_from_userid = " . $userdata['user_id'] . " $delete_sql .= "( ( privmsgs_from_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . " ) AND privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . " )
OR ( privmsgs_to_userid = " . $userdata['user_id'] . " OR ( privmsgs_to_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " ) )"; AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " ) )";
break; break;
} }
@ -829,11 +829,11 @@ else if ( $save && $mark_list && $folder != 'savebox' && $folder != 'outbox' )
// //
// See if recipient is at their savebox limit // See if recipient is at their savebox limit
// //
$sql = "SELECT COUNT(privmsgs_id) AS savebox_items, MIN(privmsgs_date) AS oldest_post_time $sql = "SELECT COUNT(privmsgs_id) AS savebox_items, MIN(privmsgs_date) AS oldest_post_time
FROM " . PRIVMSGS_TABLE . " FROM " . PRIVMSGS_TABLE . "
WHERE ( ( privmsgs_to_userid = " . $userdata['user_id'] . " WHERE ( ( privmsgs_to_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " ) AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " )
OR ( privmsgs_from_userid = " . $userdata['user_id'] . " OR ( privmsgs_from_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . ") )"; AND privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . ") )";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -846,11 +846,11 @@ else if ( $save && $mark_list && $folder != 'savebox' && $folder != 'outbox' )
{ {
if ( $saved_info['savebox_items'] >= $board_config['max_savebox_privmsgs'] ) if ( $saved_info['savebox_items'] >= $board_config['max_savebox_privmsgs'] )
{ {
$sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . " $sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . "
WHERE ( ( privmsgs_to_userid = " . $userdata['user_id'] . " WHERE ( ( privmsgs_to_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " ) AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " )
OR ( privmsgs_from_userid = " . $userdata['user_id'] . " OR ( privmsgs_from_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . ") ) AND privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . ") )
AND privmsgs_date = " . $saved_info['oldest_post_time']; AND privmsgs_date = " . $saved_info['oldest_post_time'];
if ( !$db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
@ -867,23 +867,23 @@ else if ( $save && $mark_list && $folder != 'savebox' && $folder != 'outbox' )
switch( $folder ) switch( $folder )
{ {
case 'inbox': case 'inbox':
$saved_sql .= " SET privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " $saved_sql .= " SET privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . "
WHERE privmsgs_to_userid = " . $userdata['user_id'] . " WHERE privmsgs_to_userid = " . $userdata['user_id'] . "
AND ( privmsgs_type = " . PRIVMSGS_READ_MAIL . " AND ( privmsgs_type = " . PRIVMSGS_READ_MAIL . "
OR privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . ")"; OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . ")";
break; break;
case 'outbox': case 'outbox':
$saved_sql .= " SET privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . " $saved_sql .= " SET privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . "
WHERE privmsgs_from_userid = " . $userdata['user_id'] . " WHERE privmsgs_from_userid = " . $userdata['user_id'] . "
AND ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " AND ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
OR privmsgs_type = " . PRIVMSGS_UNERAD_MAIL . " ) "; OR privmsgs_type = " . PRIVMSGS_UNERAD_MAIL . " ) ";
break; break;
case 'sentbox': case 'sentbox':
$saved_sql .= " SET privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . " $saved_sql .= " SET privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . "
WHERE privmsgs_from_userid = " . $userdata['user_id'] . " WHERE privmsgs_from_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SENT_MAIL; AND privmsgs_type = " . PRIVMSGS_SENT_MAIL;
break; break;
} }
@ -947,7 +947,7 @@ else if ( $submit || $refresh || $mode != '' )
$attach_sig = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['attach_sig']) ) ? TRUE : 0 ) : $userdata['user_attachsig']; $attach_sig = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['attach_sig']) ) ? TRUE : 0 ) : $userdata['user_attachsig'];
$user_sig = ( $userdata['user_sig'] != '' && $board_config['allow_sig'] ) ? $userdata['user_sig'] : ""; $user_sig = ( $userdata['user_sig'] != '' && $board_config['allow_sig'] ) ? $userdata['user_sig'] : "";
if ( $submit && $mode != 'edit' ) if ( $submit && $mode != 'edit' )
{ {
// //
@ -979,7 +979,7 @@ else if ( $submit || $refresh || $mode != '' )
{ {
$to_username = $HTTP_POST_VARS['username']; $to_username = $HTTP_POST_VARS['username'];
$sql = "SELECT user_id, user_notify_pm, user_email, user_lang, user_active $sql = "SELECT user_id, user_notify_pm, user_email, user_lang, user_active
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE username = '" . str_replace("\'", "''", $to_username) . "' WHERE username = '" . str_replace("\'", "''", $to_username) . "'
AND user_id <> " . ANONYMOUS; AND user_id <> " . ANONYMOUS;
@ -1042,11 +1042,11 @@ else if ( $submit || $refresh || $mode != '' )
// //
// See if recipient is at their inbox limit // See if recipient is at their inbox limit
// //
$sql = "SELECT COUNT(privmsgs_id) AS inbox_items, MIN(privmsgs_date) AS oldest_post_time $sql = "SELECT COUNT(privmsgs_id) AS inbox_items, MIN(privmsgs_date) AS oldest_post_time
FROM " . PRIVMSGS_TABLE . " FROM " . PRIVMSGS_TABLE . "
WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
OR privmsgs_type = " . PRIVMSGS_READ_MAIL . " OR privmsgs_type = " . PRIVMSGS_READ_MAIL . "
OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " ) OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )
AND privmsgs_to_userid = " . $to_userdata['user_id']; AND privmsgs_to_userid = " . $to_userdata['user_id'];
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -1059,11 +1059,11 @@ else if ( $submit || $refresh || $mode != '' )
{ {
if ( $inbox_info['inbox_items'] >= $board_config['max_inbox_privmsgs'] ) if ( $inbox_info['inbox_items'] >= $board_config['max_inbox_privmsgs'] )
{ {
$sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . " $sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . "
WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
OR privmsgs_type = " . PRIVMSGS_READ_MAIL . " OR privmsgs_type = " . PRIVMSGS_READ_MAIL . "
OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " ) OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )
AND privmsgs_date = " . $inbox_info['oldest_post_time'] . " AND privmsgs_date = " . $inbox_info['oldest_post_time'] . "
AND privmsgs_to_userid = " . $to_userdata['user_id']; AND privmsgs_to_userid = " . $to_userdata['user_id'];
if ( !$db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
@ -1078,7 +1078,7 @@ else if ( $submit || $refresh || $mode != '' )
else else
{ {
$sql_info = "UPDATE " . PRIVMSGS_TABLE . " $sql_info = "UPDATE " . PRIVMSGS_TABLE . "
SET privmsgs_type = " . PRIVMSGS_NEW_MAIL . ", privmsgs_subject = '" . str_replace("\'", "''", $privmsg_subject) . "', privmsgs_from_userid = " . $userdata['user_id'] . ", privmsgs_to_userid = " . $to_userdata['user_id'] . ", privmsgs_date = $msg_time, privmsgs_ip = '$user_ip', privmsgs_enable_html = $html_on, privmsgs_enable_bbcode = $bbcode_on, privmsgs_enable_smilies = $smilies_on, privmsgs_attach_sig = $attach_sig SET privmsgs_type = " . PRIVMSGS_NEW_MAIL . ", privmsgs_subject = '" . str_replace("\'", "''", $privmsg_subject) . "', privmsgs_from_userid = " . $userdata['user_id'] . ", privmsgs_to_userid = " . $to_userdata['user_id'] . ", privmsgs_date = $msg_time, privmsgs_ip = '$user_ip', privmsgs_enable_html = $html_on, privmsgs_enable_bbcode = $bbcode_on, privmsgs_enable_smilies = $smilies_on, privmsgs_attach_sig = $attach_sig
WHERE privmsgs_id = $privmsg_id"; WHERE privmsgs_id = $privmsg_id";
} }
@ -1097,7 +1097,7 @@ else if ( $submit || $refresh || $mode != '' )
else else
{ {
$sql = "UPDATE " . PRIVMSGS_TEXT_TABLE . " $sql = "UPDATE " . PRIVMSGS_TEXT_TABLE . "
SET privmsgs_text = '" . str_replace("\'", "''", $privmsg_message) . "', privmsgs_bbcode_uid = '$bbcode_uid' SET privmsgs_text = '" . str_replace("\'", "''", $privmsg_message) . "', privmsgs_bbcode_uid = '$bbcode_uid'
WHERE privmsgs_text_id = $privmsg_id"; WHERE privmsgs_text_id = $privmsg_id";
} }
@ -1112,8 +1112,8 @@ else if ( $submit || $refresh || $mode != '' )
// Add to the users new pm counter // Add to the users new pm counter
// //
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . " SET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . "
WHERE user_id = " . $to_userdata['user_id']; WHERE user_id = " . $to_userdata['user_id'];
if ( !$status = $db->sql_query($sql) ) if ( !$status = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, 'Could not update private message new/read status for user', '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not update private message new/read status for user', '', __LINE__, __FILE__, $sql);
@ -1131,16 +1131,16 @@ else if ( $submit || $refresh || $mode != '' )
include($phpbb_root_path . 'includes/emailer.'.$phpEx); include($phpbb_root_path . 'includes/emailer.'.$phpEx);
$emailer = new emailer($board_config['smtp_delivery']); $emailer = new emailer($board_config['smtp_delivery']);
$emailer->use_template('privmsg_notify', $to_userdata['user_lang']); $emailer->use_template('privmsg_notify', $to_userdata['user_lang']);
$emailer->extra_headers($email_headers); $emailer->extra_headers($email_headers);
$emailer->email_address($to_userdata['user_email']); $emailer->email_address($to_userdata['user_email']);
$emailer->set_subject(); //$lang['Notification_subject'] $emailer->set_subject(); //$lang['Notification_subject']
$emailer->assign_vars(array( $emailer->assign_vars(array(
'USERNAME' => $to_username, 'USERNAME' => $to_username,
'SITENAME' => $board_config['sitename'], 'SITENAME' => $board_config['sitename'],
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox') 'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox')
); );
@ -1196,9 +1196,9 @@ else if ( $submit || $refresh || $mode != '' )
{ {
$page_title = $lang['Edit_privmsg']; $page_title = $lang['Edit_privmsg'];
$sql = "SELECT u.user_id, u.user_sig $sql = "SELECT u.user_id, u.user_sig
FROM " . PRIVMSGS_TABLE . " pm, " . USERS_TABLE . " u FROM " . PRIVMSGS_TABLE . " pm, " . USERS_TABLE . " u
WHERE pm.privmsgs_id = $privmsg_id WHERE pm.privmsgs_id = $privmsg_id
AND u.user_id = pm.privmsgs_from_userid"; AND u.user_id = pm.privmsgs_from_userid";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -1216,7 +1216,7 @@ else if ( $submit || $refresh || $mode != '' )
} }
} }
} }
else else
{ {
if ( !$privmsg_id && ( $mode == 'reply' || $mode == 'edit' || $mode == 'quote' ) ) if ( !$privmsg_id && ( $mode == 'reply' || $mode == 'edit' || $mode == 'quote' ) )
{ {
@ -1245,13 +1245,13 @@ else if ( $submit || $refresh || $mode != '' )
if ( $mode == 'edit' ) if ( $mode == 'edit' )
{ {
$sql = "SELECT pm.*, pmt.privmsgs_bbcode_uid, pmt.privmsgs_text, u.username, u.user_id, u.user_sig $sql = "SELECT pm.*, pmt.privmsgs_bbcode_uid, pmt.privmsgs_text, u.username, u.user_id, u.user_sig
FROM " . PRIVMSGS_TABLE . " pm, " . PRIVMSGS_TEXT_TABLE . " pmt, " . USERS_TABLE . " u FROM " . PRIVMSGS_TABLE . " pm, " . PRIVMSGS_TEXT_TABLE . " pmt, " . USERS_TABLE . " u
WHERE pm.privmsgs_id = $privmsg_id WHERE pm.privmsgs_id = $privmsg_id
AND pmt.privmsgs_text_id = pm.privmsgs_id AND pmt.privmsgs_text_id = pm.privmsgs_id
AND pm.privmsgs_from_userid = " . $userdata['user_id'] . " AND pm.privmsgs_from_userid = " . $userdata['user_id'] . "
AND ( pm.privmsgs_type = " . PRIVMSGS_NEW_MAIL . " AND ( pm.privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
OR pm.privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " ) OR pm.privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )
AND u.user_id = pm.privmsgs_to_userid"; AND u.user_id = pm.privmsgs_to_userid";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -1273,7 +1273,7 @@ else if ( $submit || $refresh || $mode != '' )
{ {
$privmsg_message = preg_replace("/\:(([a-z0-9]:)?)$privmsg_bbcode_uid/si", '', $privmsg_message); $privmsg_message = preg_replace("/\:(([a-z0-9]:)?)$privmsg_bbcode_uid/si", '', $privmsg_message);
} }
$privmsg_message = str_replace('<br />', "\n", $privmsg_message); $privmsg_message = str_replace('<br />', "\n", $privmsg_message);
$privmsg_message = preg_replace('#</textarea>#si', '&lt;/textarea&gt;', $privmsg_message); $privmsg_message = preg_replace('#</textarea>#si', '&lt;/textarea&gt;', $privmsg_message);
@ -1316,8 +1316,8 @@ else if ( $submit || $refresh || $mode != '' )
$privmsg_message = preg_replace("/\:(([a-z0-9]:)?)$privmsg_bbcode_uid/si", '', $privmsg_message); $privmsg_message = preg_replace("/\:(([a-z0-9]:)?)$privmsg_bbcode_uid/si", '', $privmsg_message);
$privmsg_message = str_replace('<br />', "\n", $privmsg_message); $privmsg_message = str_replace('<br />', "\n", $privmsg_message);
$privmsg_message = preg_replace('#</textarea>#si', '&lt;/textarea&gt;', $privmsg_message); $privmsg_message = preg_replace('#</textarea>#si', '&lt;/textarea&gt;', $privmsg_message);
$msg_date = create_date($board_config['default_dateformat'], $privmsg['privmsgs_date'], $board_config['board_timezone']); $msg_date = create_date($board_config['default_dateformat'], $privmsg['privmsgs_date'], $board_config['board_timezone']);
$privmsg_message = '[quote="' . $to_username . '"]' . $privmsg_message . '[/quote]'; $privmsg_message = '[quote="' . $to_username . '"]' . $privmsg_message . '[/quote]';
@ -1380,7 +1380,7 @@ else if ( $submit || $refresh || $mode != '' )
{ {
$preview_message = $preview_message . '<br /><br />_________________<br />' . $user_sig; $preview_message = $preview_message . '<br /><br />_________________<br />' . $user_sig;
} }
if ( count($orig_word) ) if ( count($orig_word) )
{ {
$preview_subject = preg_replace($orig_word, $replacement_word, $privmsg_subject); $preview_subject = preg_replace($orig_word, $replacement_word, $privmsg_subject);
@ -1414,8 +1414,8 @@ else if ( $submit || $refresh || $mode != '' )
$template->assign_vars(array( $template->assign_vars(array(
'TOPIC_TITLE' => $preview_subject, 'TOPIC_TITLE' => $preview_subject,
'POST_SUBJECT' => $preview_subject, 'POST_SUBJECT' => $preview_subject,
'MESSAGE_TO' => $to_username, 'MESSAGE_TO' => $to_username,
'MESSAGE_FROM' => $userdata['username'], 'MESSAGE_FROM' => $userdata['username'],
'POST_DATE' => create_date($board_config['default_dateformat'], time(), $board_config['board_timezone']), 'POST_DATE' => create_date($board_config['default_dateformat'], time(), $board_config['board_timezone']),
'MESSAGE' => $preview_message, 'MESSAGE' => $preview_message,
@ -1534,23 +1534,23 @@ else if ( $submit || $refresh || $mode != '' )
generate_smilies('inline', PAGE_PRIVMSGS); generate_smilies('inline', PAGE_PRIVMSGS);
$template->assign_vars(array( $template->assign_vars(array(
'SUBJECT' => preg_replace($html_entities_match, $html_entities_replace, $privmsg_subject), 'SUBJECT' => preg_replace($html_entities_match, $html_entities_replace, $privmsg_subject),
'USERNAME' => preg_replace($html_entities_match, $html_entities_replace, $to_username), 'USERNAME' => preg_replace($html_entities_match, $html_entities_replace, $to_username),
'MESSAGE' => $privmsg_message, 'MESSAGE' => $privmsg_message,
'HTML_STATUS' => $html_status, 'HTML_STATUS' => $html_status,
'SMILIES_STATUS' => $smilies_status, 'SMILIES_STATUS' => $smilies_status,
'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid("faq.$phpEx?mode=bbcode") . '" target="_phpbbcode">', '</a>'), 'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid("faq.$phpEx?mode=bbcode") . '" target="_phpbbcode">', '</a>'),
'FORUM_NAME' => $lang['Private_message'], 'FORUM_NAME' => $lang['Private_message'],
'BOX_NAME' => $l_box_name, 'BOX_NAME' => $l_box_name,
'INBOX_IMG' => $inbox_img, 'INBOX_IMG' => $inbox_img,
'SENTBOX_IMG' => $sentbox_img, 'SENTBOX_IMG' => $sentbox_img,
'OUTBOX_IMG' => $outbox_img, 'OUTBOX_IMG' => $outbox_img,
'SAVEBOX_IMG' => $savebox_img, 'SAVEBOX_IMG' => $savebox_img,
'INBOX' => $inbox_url, 'INBOX' => $inbox_url,
'SENTBOX' => $sentbox_url, 'SENTBOX' => $sentbox_url,
'OUTBOX' => $outbox_url, 'OUTBOX' => $outbox_url,
'SAVEBOX' => $savebox_url, 'SAVEBOX' => $savebox_url,
'L_SUBJECT' => $lang['Subject'], 'L_SUBJECT' => $lang['Subject'],
'L_MESSAGE_BODY' => $lang['Message_body'], 'L_MESSAGE_BODY' => $lang['Message_body'],
@ -1562,61 +1562,61 @@ else if ( $submit || $refresh || $mode != '' )
'L_POST_A' => $post_a, 'L_POST_A' => $post_a,
'L_FIND_USERNAME' => $lang['Find_username'], 'L_FIND_USERNAME' => $lang['Find_username'],
'L_FIND' => $lang['Find'], 'L_FIND' => $lang['Find'],
'L_DISABLE_HTML' => $lang['Disable_HTML_pm'], 'L_DISABLE_HTML' => $lang['Disable_HTML_pm'],
'L_DISABLE_BBCODE' => $lang['Disable_BBCode_pm'], 'L_DISABLE_BBCODE' => $lang['Disable_BBCode_pm'],
'L_DISABLE_SMILIES' => $lang['Disable_Smilies_pm'], 'L_DISABLE_SMILIES' => $lang['Disable_Smilies_pm'],
'L_ATTACH_SIGNATURE' => $lang['Attach_signature'], 'L_ATTACH_SIGNATURE' => $lang['Attach_signature'],
'L_BBCODE_B_HELP' => $lang['bbcode_b_help'], 'L_BBCODE_B_HELP' => $lang['bbcode_b_help'],
'L_BBCODE_I_HELP' => $lang['bbcode_i_help'], 'L_BBCODE_I_HELP' => $lang['bbcode_i_help'],
'L_BBCODE_U_HELP' => $lang['bbcode_u_help'], 'L_BBCODE_U_HELP' => $lang['bbcode_u_help'],
'L_BBCODE_Q_HELP' => $lang['bbcode_q_help'], 'L_BBCODE_Q_HELP' => $lang['bbcode_q_help'],
'L_BBCODE_C_HELP' => $lang['bbcode_c_help'], 'L_BBCODE_C_HELP' => $lang['bbcode_c_help'],
'L_BBCODE_L_HELP' => $lang['bbcode_l_help'], 'L_BBCODE_L_HELP' => $lang['bbcode_l_help'],
'L_BBCODE_O_HELP' => $lang['bbcode_o_help'], 'L_BBCODE_O_HELP' => $lang['bbcode_o_help'],
'L_BBCODE_P_HELP' => $lang['bbcode_p_help'], 'L_BBCODE_P_HELP' => $lang['bbcode_p_help'],
'L_BBCODE_W_HELP' => $lang['bbcode_w_help'], 'L_BBCODE_W_HELP' => $lang['bbcode_w_help'],
'L_BBCODE_A_HELP' => $lang['bbcode_a_help'], 'L_BBCODE_A_HELP' => $lang['bbcode_a_help'],
'L_BBCODE_S_HELP' => $lang['bbcode_s_help'], 'L_BBCODE_S_HELP' => $lang['bbcode_s_help'],
'L_BBCODE_F_HELP' => $lang['bbcode_f_help'], 'L_BBCODE_F_HELP' => $lang['bbcode_f_help'],
'L_EMPTY_MESSAGE' => $lang['Empty_message'], 'L_EMPTY_MESSAGE' => $lang['Empty_message'],
'L_FONT_COLOR' => $lang['Font_color'], 'L_FONT_COLOR' => $lang['Font_color'],
'L_COLOR_DEFAULT' => $lang['color_default'], 'L_COLOR_DEFAULT' => $lang['color_default'],
'L_COLOR_DARK_RED' => $lang['color_dark_red'], 'L_COLOR_DARK_RED' => $lang['color_dark_red'],
'L_COLOR_RED' => $lang['color_red'], 'L_COLOR_RED' => $lang['color_red'],
'L_COLOR_ORANGE' => $lang['color_orange'], 'L_COLOR_ORANGE' => $lang['color_orange'],
'L_COLOR_BROWN' => $lang['color_brown'], 'L_COLOR_BROWN' => $lang['color_brown'],
'L_COLOR_YELLOW' => $lang['color_yellow'], 'L_COLOR_YELLOW' => $lang['color_yellow'],
'L_COLOR_GREEN' => $lang['color_green'], 'L_COLOR_GREEN' => $lang['color_green'],
'L_COLOR_OLIVE' => $lang['color_olive'], 'L_COLOR_OLIVE' => $lang['color_olive'],
'L_COLOR_CYAN' => $lang['color_cyan'], 'L_COLOR_CYAN' => $lang['color_cyan'],
'L_COLOR_BLUE' => $lang['color_blue'], 'L_COLOR_BLUE' => $lang['color_blue'],
'L_COLOR_DARK_BLUE' => $lang['color_dark_blue'], 'L_COLOR_DARK_BLUE' => $lang['color_dark_blue'],
'L_COLOR_INDIGO' => $lang['color_indigo'], 'L_COLOR_INDIGO' => $lang['color_indigo'],
'L_COLOR_VIOLET' => $lang['color_violet'], 'L_COLOR_VIOLET' => $lang['color_violet'],
'L_COLOR_WHITE' => $lang['color_white'], 'L_COLOR_WHITE' => $lang['color_white'],
'L_COLOR_BLACK' => $lang['color_black'], 'L_COLOR_BLACK' => $lang['color_black'],
'L_FONT_SIZE' => $lang['Font_size'], 'L_FONT_SIZE' => $lang['Font_size'],
'L_FONT_TINY' => $lang['font_tiny'], 'L_FONT_TINY' => $lang['font_tiny'],
'L_FONT_SMALL' => $lang['font_small'], 'L_FONT_SMALL' => $lang['font_small'],
'L_FONT_NORMAL' => $lang['font_normal'], 'L_FONT_NORMAL' => $lang['font_normal'],
'L_FONT_LARGE' => $lang['font_large'], 'L_FONT_LARGE' => $lang['font_large'],
'L_FONT_HUGE' => $lang['font_huge'], 'L_FONT_HUGE' => $lang['font_huge'],
'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'], 'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'],
'L_STYLES_TIP' => $lang['Styles_tip'], 'L_STYLES_TIP' => $lang['Styles_tip'],
'S_HTML_CHECKED' => ( !$html_on ) ? ' checked="checked"' : '', 'S_HTML_CHECKED' => ( !$html_on ) ? ' checked="checked"' : '',
'S_BBCODE_CHECKED' => ( !$bbcode_on ) ? ' checked="checked"' : '', 'S_BBCODE_CHECKED' => ( !$bbcode_on ) ? ' checked="checked"' : '',
'S_SMILIES_CHECKED' => ( !$smilies_on ) ? ' checked="checked"' : '', 'S_SMILIES_CHECKED' => ( !$smilies_on ) ? ' checked="checked"' : '',
'S_SIGNATURE_CHECKED' => ( $attach_sig ) ? ' checked="checked"' : '', 'S_SIGNATURE_CHECKED' => ( $attach_sig ) ? ' checked="checked"' : '',
'S_NAMES_SELECT' => $user_names_select, 'S_NAMES_SELECT' => $user_names_select,
'S_HIDDEN_FORM_FIELDS' => $s_hidden_fields, 'S_HIDDEN_FORM_FIELDS' => $s_hidden_fields,
'S_POST_ACTION' => append_sid("privmsg.$phpEx"), 'S_POST_ACTION' => append_sid("privmsg.$phpEx"),
'U_SEARCH_USER' => append_sid("search.$phpEx?mode=searchuser"), 'U_SEARCH_USER' => append_sid("search.$phpEx?mode=searchuser"),
'U_VIEW_FORUM' => append_sid("privmsg.$phpEx")) 'U_VIEW_FORUM' => append_sid("privmsg.$phpEx"))
); );
@ -1635,10 +1635,10 @@ if ( !$userdata['session_logged_in'] )
} }
// //
// Update unread status // Update unread status
// //
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_unread_privmsg = user_unread_privmsg + user_new_privmsg, user_new_privmsg = 0, user_last_privmsg = " . $userdata['session_start'] . " SET user_unread_privmsg = user_unread_privmsg + user_new_privmsg, user_new_privmsg = 0, user_last_privmsg = " . $userdata['session_start'] . "
WHERE user_id = " . $userdata['user_id']; WHERE user_id = " . $userdata['user_id'];
if ( !$db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
@ -1646,8 +1646,8 @@ if ( !$db->sql_query($sql) )
} }
$sql = "UPDATE " . PRIVMSGS_TABLE . " $sql = "UPDATE " . PRIVMSGS_TABLE . "
SET privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " SET privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . "
WHERE privmsgs_type = " . PRIVMSGS_NEW_MAIL . " WHERE privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
AND privmsgs_to_userid = " . $userdata['user_id']; AND privmsgs_to_userid = " . $userdata['user_id'];
if ( !$db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
@ -1682,22 +1682,22 @@ $post_new_mesg_url = '<a href="' . append_sid("privmsg.$phpEx?mode=post") . '"><
// //
// General SQL to obtain messages // General SQL to obtain messages
// //
$sql_tot = "SELECT COUNT(privmsgs_id) AS total $sql_tot = "SELECT COUNT(privmsgs_id) AS total
FROM " . PRIVMSGS_TABLE . " "; FROM " . PRIVMSGS_TABLE . " ";
$sql = "SELECT pm.privmsgs_type, pm.privmsgs_id, pm.privmsgs_date, pm.privmsgs_subject, u.user_id, u.username $sql = "SELECT pm.privmsgs_type, pm.privmsgs_id, pm.privmsgs_date, pm.privmsgs_subject, u.user_id, u.username
FROM " . PRIVMSGS_TABLE . " pm, " . USERS_TABLE . " u "; FROM " . PRIVMSGS_TABLE . " pm, " . USERS_TABLE . " u ";
switch( $folder ) switch( $folder )
{ {
case 'inbox': case 'inbox':
$sql_tot .= "WHERE privmsgs_to_userid = " . $userdata['user_id'] . " $sql_tot .= "WHERE privmsgs_to_userid = " . $userdata['user_id'] . "
AND ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " AND ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
OR privmsgs_type = " . PRIVMSGS_READ_MAIL . " OR privmsgs_type = " . PRIVMSGS_READ_MAIL . "
OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )"; OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )";
$sql .= "WHERE pm.privmsgs_to_userid = " . $userdata['user_id'] . " $sql .= "WHERE pm.privmsgs_to_userid = " . $userdata['user_id'] . "
AND u.user_id = pm.privmsgs_from_userid AND u.user_id = pm.privmsgs_from_userid
AND ( pm.privmsgs_type = " . PRIVMSGS_NEW_MAIL . " AND ( pm.privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
OR pm.privmsgs_type = " . PRIVMSGS_READ_MAIL . " OR pm.privmsgs_type = " . PRIVMSGS_READ_MAIL . "
OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )"; OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )";
break; break;
@ -1722,14 +1722,14 @@ switch( $folder )
break; break;
case 'savebox': case 'savebox':
$sql_tot .= "WHERE ( ( privmsgs_to_userid = " . $userdata['user_id'] . " $sql_tot .= "WHERE ( ( privmsgs_to_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " ) AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " )
OR ( privmsgs_from_userid = " . $userdata['user_id'] . " OR ( privmsgs_from_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . ") )"; AND privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . ") )";
$sql .= "WHERE ( ( pm.privmsgs_to_userid = " . $userdata['user_id'] . " $sql .= "WHERE ( ( pm.privmsgs_to_userid = " . $userdata['user_id'] . "
AND pm.privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " AND pm.privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . "
AND u.user_id = pm.privmsgs_from_userid ) AND u.user_id = pm.privmsgs_from_userid )
OR ( pm.privmsgs_from_userid = " . $userdata['user_id'] . " OR ( pm.privmsgs_from_userid = " . $userdata['user_id'] . "
AND pm.privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . " AND pm.privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . "
AND u.user_id = pm.privmsgs_from_userid ) )"; AND u.user_id = pm.privmsgs_from_userid ) )";
@ -1889,22 +1889,22 @@ if ( $folder != 'outbox' )
// Dump vars to template // Dump vars to template
// //
$template->assign_vars(array( $template->assign_vars(array(
'BOX_NAME' => $l_box_name, 'BOX_NAME' => $l_box_name,
'INBOX_IMG' => $inbox_img, 'INBOX_IMG' => $inbox_img,
'SENTBOX_IMG' => $sentbox_img, 'SENTBOX_IMG' => $sentbox_img,
'OUTBOX_IMG' => $outbox_img, 'OUTBOX_IMG' => $outbox_img,
'SAVEBOX_IMG' => $savebox_img, 'SAVEBOX_IMG' => $savebox_img,
'INBOX' => $inbox_url, 'INBOX' => $inbox_url,
'SENTBOX' => $sentbox_url, 'SENTBOX' => $sentbox_url,
'OUTBOX' => $outbox_url, 'OUTBOX' => $outbox_url,
'SAVEBOX' => $savebox_url, 'SAVEBOX' => $savebox_url,
'POST_PM_IMG' => $post_pm_img, 'POST_PM_IMG' => $post_pm_img,
'INBOX_LIMIT_IMG_WIDTH' => $inbox_limit_img_length, 'INBOX_LIMIT_IMG_WIDTH' => $inbox_limit_img_length,
'INBOX_LIMIT_PERCENT' => $inbox_limit_pct, 'INBOX_LIMIT_PERCENT' => $inbox_limit_pct,
'BOX_SIZE_STATUS' => $l_box_size_status, 'BOX_SIZE_STATUS' => $l_box_size_status,
'L_INBOX' => $lang['Inbox'], 'L_INBOX' => $lang['Inbox'],
'L_OUTBOX' => $lang['Outbox'], 'L_OUTBOX' => $lang['Outbox'],
@ -1915,12 +1915,12 @@ $template->assign_vars(array(
'L_SUBJECT' => $lang['Subject'], 'L_SUBJECT' => $lang['Subject'],
'L_DATE' => $lang['Date'], 'L_DATE' => $lang['Date'],
'L_DISPLAY_MESSAGES' => $lang['Display_messages'], 'L_DISPLAY_MESSAGES' => $lang['Display_messages'],
'L_FROM_OR_TO' => ( $folder == 'inbox' || $folder == 'savebox' ) ? $lang['From'] : $lang['To'], 'L_FROM_OR_TO' => ( $folder == 'inbox' || $folder == 'savebox' ) ? $lang['From'] : $lang['To'],
'L_MARK_ALL' => $lang['Mark_all'], 'L_MARK_ALL' => $lang['Mark_all'],
'L_UNMARK_ALL' => $lang['Unmark_all'], 'L_UNMARK_ALL' => $lang['Unmark_all'],
'L_DELETE_MARKED' => $lang['Delete_marked'], 'L_DELETE_MARKED' => $lang['Delete_marked'],
'L_DELETE_ALL' => $lang['Delete_all'], 'L_DELETE_ALL' => $lang['Delete_all'],
'L_SAVE_MARKED' => $lang['Save_marked'], 'L_SAVE_MARKED' => $lang['Save_marked'],
'S_PRIVMSGS_ACTION' => append_sid("privmsg.$phpEx?folder=$folder"), 'S_PRIVMSGS_ACTION' => append_sid("privmsg.$phpEx?folder=$folder"),
'S_HIDDEN_FIELDS' => '', 'S_HIDDEN_FIELDS' => '',
@ -1960,7 +1960,7 @@ if ( $row = $db->sql_fetchrow($result) )
{ {
$msg_subject = preg_replace($orig_word, $replacement_word, $msg_subject); $msg_subject = preg_replace($orig_word, $replacement_word, $msg_subject);
} }
$u_subject = append_sid("privmsg.$phpEx?folder=$folder&amp;mode=read&amp;" . POST_POST_URL . "=$privmsg_id"); $u_subject = append_sid("privmsg.$phpEx?folder=$folder&amp;mode=read&amp;" . POST_POST_URL . "=$privmsg_id");
$msg_date = create_date($board_config['default_dateformat'], $row['privmsgs_date'], $board_config['board_timezone']); $msg_date = create_date($board_config['default_dateformat'], $row['privmsgs_date'], $board_config['board_timezone']);
@ -1983,9 +1983,9 @@ if ( $row = $db->sql_fetchrow($result) )
'DATE' => $msg_date, 'DATE' => $msg_date,
'PRIVMSG_FOLDER_IMG' => $icon_flag, 'PRIVMSG_FOLDER_IMG' => $icon_flag,
'L_PRIVMSG_FOLDER_ALT' => $icon_flag_alt, 'L_PRIVMSG_FOLDER_ALT' => $icon_flag_alt,
'S_MARK_ID' => $privmsg_id, 'S_MARK_ID' => $privmsg_id,
'U_READ' => $u_subject, 'U_READ' => $u_subject,
'U_FROM_USER_PROFILE' => $u_from_user_profile) 'U_FROM_USER_PROFILE' => $u_from_user_profile)
@ -1995,7 +1995,7 @@ if ( $row = $db->sql_fetchrow($result) )
$template->assign_vars(array( $template->assign_vars(array(
'PAGINATION' => generate_pagination("privmsg.$phpEx?folder=$folder", $pm_total, $board_config['topics_per_page'], $start), 'PAGINATION' => generate_pagination("privmsg.$phpEx?folder=$folder", $pm_total, $board_config['topics_per_page'], $start),
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $pm_total / $board_config['topics_per_page'] )), 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $pm_total / $board_config['topics_per_page'] )),
'L_GOTO_PAGE' => $lang['Goto_page']) 'L_GOTO_PAGE' => $lang['Goto_page'])
); );

View file

@ -29,7 +29,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Start session management // Start session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new auth('list', $userdata); $acl = new acl('list', $userdata);
// //
// End session management // End session management
// //
@ -56,10 +56,10 @@ $server_url = $server_protocol . $server_name . $server_port . $script_name;
function gen_rand_string($hash) function gen_rand_string($hash)
{ {
$chars = array( 'a', 'A', 'b', 'B', 'c', 'C', 'd', 'D', 'e', 'E', 'f', 'F', 'g', 'G', 'h', 'H', 'i', 'I', 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'N', 'o', 'O', 'p', 'P', 'q', 'Q', 'r', 'R', 's', 'S', 't', 'T', 'u', 'U', 'v', 'V', 'w', 'W', 'x', 'X', 'y', 'Y', 'z', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'); $chars = array( 'a', 'A', 'b', 'B', 'c', 'C', 'd', 'D', 'e', 'E', 'f', 'F', 'g', 'G', 'h', 'H', 'i', 'I', 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'N', 'o', 'O', 'p', 'P', 'q', 'Q', 'r', 'R', 's', 'S', 't', 'T', 'u', 'U', 'v', 'V', 'w', 'W', 'x', 'X', 'y', 'Y', 'z', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0');
$max_chars = count($chars) - 1; $max_chars = count($chars) - 1;
srand( (double) microtime()*1000000); srand( (double) microtime()*1000000);
$rand_str = ''; $rand_str = '';
for($i = 0; $i < 8; $i++) for($i = 0; $i < 8; $i++)
{ {

View file

@ -30,7 +30,7 @@ include($phpbb_root_path . 'includes/functions_posting.'.$phpEx);
// Start session management // Start session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new auth('read', $userdata); $acl = new acl('read', $userdata);
// //
// End session management // End session management
// //
@ -145,8 +145,8 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
{ {
if ( $userdata['session_logged_in'] ) if ( $userdata['session_logged_in'] )
{ {
$sql = "SELECT post_id $sql = "SELECT post_id
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE post_time >= " . $userdata['user_lastvisit']; WHERE post_time >= " . $userdata['user_lastvisit'];
} }
else else
@ -163,8 +163,8 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
{ {
if ( $userdata['session_logged_in'] ) if ( $userdata['session_logged_in'] )
{ {
$sql = "SELECT post_id $sql = "SELECT post_id
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE poster_id = " . $userdata['user_id'];; WHERE poster_id = " . $userdata['user_id'];;
} }
else else
@ -180,7 +180,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
else else
{ {
$search_author = str_replace('*', '%', trim($search_author)); $search_author = str_replace('*', '%', trim($search_author));
$sql = "SELECT user_id $sql = "SELECT user_id
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE username LIKE '" . str_replace("\'", "''", $search_author) . "'"; WHERE username LIKE '" . str_replace("\'", "''", $search_author) . "'";
@ -203,8 +203,8 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
message_die(MESSAGE, $lang['No_search_match']); message_die(MESSAGE, $lang['No_search_match']);
} }
$sql = "SELECT post_id $sql = "SELECT post_id
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE poster_id IN ($matching_userids)"; WHERE poster_id IN ($matching_userids)";
} }
@ -225,9 +225,9 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
} }
else if ( $search_keywords != '' ) else if ( $search_keywords != '' )
{ {
$stopword_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_stopwords.txt'); $stopword_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_stopwords.txt');
$synonym_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_synonyms.txt'); $synonym_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_synonyms.txt');
$split_search = array(); $split_search = array();
$cleaned_search = clean_words('search', stripslashes($search_keywords), $stopword_array, $synonym_array); $cleaned_search = clean_words('search', stripslashes($search_keywords), $stopword_array, $synonym_array);
$split_search = split_words($cleaned_search, 'search'); $split_search = split_words($cleaned_search, 'search');
@ -264,11 +264,11 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$match_word = str_replace('*', '%', $split_search[$i]); $match_word = str_replace('*', '%', $split_search[$i]);
$sql = "SELECT m.post_id $sql = "SELECT m.post_id
FROM " . SEARCH_WORD_TABLE . " w, " . SEARCH_MATCH_TABLE . " m FROM " . SEARCH_WORD_TABLE . " w, " . SEARCH_MATCH_TABLE . " m
WHERE w.word_text LIKE '$match_word' WHERE w.word_text LIKE '$match_word'
AND m.word_id = w.word_id AND m.word_id = w.word_id
AND w.word_common <> 1 AND w.word_common <> 1
$search_msg_only"; $search_msg_only";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -321,8 +321,8 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
{ {
$search_ids[] = $post_id; $search_ids[] = $post_id;
} }
} }
unset($result_list); unset($result_list);
$total_match_count = count($search_ids); $total_match_count = count($search_ids);
} }
@ -350,7 +350,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$auth_sql = "f.cat_id = $search_cat"; $auth_sql = "f.cat_id = $search_cat";
} }
$auth_ary = $acl->get_acl(); $auth_ary = $acl->get_acl();
@reset($auth_ary); @reset($auth_ary);
$allowed_forum_sql = ''; $allowed_forum_sql = '';
@ -366,7 +366,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
} }
// //
// Author name search // Author name search
// //
if ( $search_author != '' ) if ( $search_author != '' )
{ {
@ -386,15 +386,15 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
if ( $search_author == '' && $auth_sql == '' ) if ( $search_author == '' && $auth_sql == '' )
{ {
$sql = "SELECT topic_id $sql = "SELECT topic_id
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE post_id IN (" . implode(", ", $search_ids) . ") WHERE post_id IN (" . implode(", ", $search_ids) . ")
$where_sql $where_sql
GROUP BY topic_id"; GROUP BY topic_id";
} }
else else
{ {
$from_sql = POSTS_TABLE . " p"; $from_sql = POSTS_TABLE . " p";
if ( $search_author != '' ) if ( $search_author != '' )
{ {
@ -408,10 +408,10 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$where_sql .= " AND f.forum_id = p.forum_id AND $auth_sql"; $where_sql .= " AND f.forum_id = p.forum_id AND $auth_sql";
} }
$sql = "SELECT p.topic_id $sql = "SELECT p.topic_id
FROM $from_sql FROM $from_sql
WHERE p.post_id IN (" . implode(", ", $search_ids) . ") WHERE p.post_id IN (" . implode(", ", $search_ids) . ")
$where_sql $where_sql
GROUP BY p.topic_id"; GROUP BY p.topic_id";
} }
@ -428,7 +428,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$db->sql_freeresult($result); $db->sql_freeresult($result);
$total_match_count = sizeof($search_ids); $total_match_count = sizeof($search_ids);
} }
else if ( $search_author != '' || $search_time || $auth_sql != '' ) else if ( $search_author != '' || $search_time || $auth_sql != '' )
{ {
@ -452,8 +452,8 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$where_sql .= " AND u.user_id = p.poster_id AND u.username LIKE '$search_author'"; $where_sql .= " AND u.user_id = p.poster_id AND u.username LIKE '$search_author'";
} }
$sql = "SELECT p.post_id $sql = "SELECT p.post_id
FROM $from_sql FROM $from_sql
WHERE $where_sql"; WHERE $where_sql";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -477,19 +477,19 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
{ {
$sql = "SELECT t.topic_id, f.forum_id $sql = "SELECT t.topic_id, f.forum_id
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
WHERE t.topic_replies = 0 WHERE t.topic_replies = 0
AND t.forum_id = f.forum_id AND t.forum_id = f.forum_id
AND t.topic_moved_id = 0 AND t.topic_moved_id = 0
AND $auth_sql"; AND $auth_sql";
} }
else else
{ {
$sql = "SELECT topic_id $sql = "SELECT topic_id
FROM " . TOPICS_TABLE . " FROM " . TOPICS_TABLE . "
WHERE topic_replies = 0 WHERE topic_replies = 0
AND topic_moved_id = 0"; AND topic_moved_id = 0";
} }
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(ERROR, 'Could not obtain post ids', '', __LINE__, __FILE__, $sql); message_die(ERROR, 'Could not obtain post ids', '', __LINE__, __FILE__, $sql);
@ -520,7 +520,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
// Finish building query (for all combinations) // Finish building query (for all combinations)
// and run it ... // and run it ...
// //
$sql = "SELECT session_id $sql = "SELECT session_id
FROM " . SESSIONS_TABLE; FROM " . SESSIONS_TABLE;
if ( $result = $db->sql_query($sql) ) if ( $result = $db->sql_query($sql) )
{ {
@ -532,7 +532,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
if ( count($delete_search_ids) ) if ( count($delete_search_ids) )
{ {
$sql = "DELETE FROM " . SEARCH_TABLE . " $sql = "DELETE FROM " . SEARCH_TABLE . "
WHERE session_id NOT IN (" . implode(", ", $delete_search_ids) . ")"; WHERE session_id NOT IN (" . implode(", ", $delete_search_ids) . ")";
if ( !$result = $db->sql_query($sql) ) if ( !$result = $db->sql_query($sql) )
{ {
@ -563,12 +563,12 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
mt_srand ((double) microtime() * 1000000); mt_srand ((double) microtime() * 1000000);
$search_id = mt_rand(); $search_id = mt_rand();
$sql = "UPDATE " . SEARCH_TABLE . " $sql = "UPDATE " . SEARCH_TABLE . "
SET search_id = $search_id, search_array = '$result_array' SET search_id = $search_id, search_array = '$result_array'
WHERE session_id = '" . $userdata['session_id'] . "'"; WHERE session_id = '" . $userdata['session_id'] . "'";
if ( !($result = $db->sql_query($sql)) || !$db->sql_affectedrows() ) if ( !($result = $db->sql_query($sql)) || !$db->sql_affectedrows() )
{ {
$sql = "INSERT INTO " . SEARCH_TABLE . " (search_id, session_id, search_array) $sql = "INSERT INTO " . SEARCH_TABLE . " (search_id, session_id, search_array)
VALUES($search_id, '" . $userdata['session_id'] . "', '" . str_replace("\'", "''", $result_array) . "')"; VALUES($search_id, '" . $userdata['session_id'] . "', '" . str_replace("\'", "''", $result_array) . "')";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -580,9 +580,9 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
{ {
if ( intval($search_id) ) if ( intval($search_id) )
{ {
$sql = "SELECT search_array $sql = "SELECT search_array
FROM " . SEARCH_TABLE . " FROM " . SEARCH_TABLE . "
WHERE search_id = $search_id WHERE search_id = $search_id
AND session_id = '". $userdata['session_id'] . "'"; AND session_id = '". $userdata['session_id'] . "'";
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
@ -607,8 +607,8 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
{ {
if ( $show_results == 'posts' ) if ( $show_results == 'posts' )
{ {
$sql = "SELECT pt.post_text, pt.bbcode_uid, pt.post_subject, p.*, f.forum_id, f.forum_name, t.*, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid $sql = "SELECT pt.post_text, pt.bbcode_uid, pt.post_subject, p.*, f.forum_id, f.forum_name, t.*, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid
FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt
WHERE p.post_id IN ($search_results) WHERE p.post_id IN ($search_results)
AND pt.post_id = p.post_id AND pt.post_id = p.post_id
AND f.forum_id = p.forum_id AND f.forum_id = p.forum_id
@ -617,11 +617,11 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
} }
else else
{ {
$sql = "SELECT t.*, f.forum_id, f.forum_name, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time $sql = "SELECT t.*, f.forum_id, f.forum_name, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2 FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
WHERE t.topic_id IN ($search_results) WHERE t.topic_id IN ($search_results)
AND t.topic_poster = u.user_id AND t.topic_poster = u.user_id
AND f.forum_id = t.forum_id AND f.forum_id = t.forum_id
AND p.post_id = t.topic_first_post_id AND p.post_id = t.topic_first_post_id
AND p2.post_id = t.topic_last_post_id AND p2.post_id = t.topic_last_post_id
AND u2.user_id = p2.poster_id"; AND u2.user_id = p2.poster_id";
@ -660,9 +660,9 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
{ {
$searchset[] = $row; $searchset[] = $row;
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
// //
// Define censored word matches // Define censored word matches
// //
@ -674,7 +674,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
// Output header // Output header
// //
$page_title = $lang['Search']; $page_title = $lang['Search'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
if ( $show_results == 'posts' ) if ( $show_results == 'posts' )
{ {
@ -693,7 +693,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$l_search_matches = ( $total_match_count == 1 ) ? sprintf($lang['Found_search_match'], $total_match_count) : sprintf($lang['Found_search_matches'], $total_match_count); $l_search_matches = ( $total_match_count == 1 ) ? sprintf($lang['Found_search_match'], $total_match_count) : sprintf($lang['Found_search_matches'], $total_match_count);
$template->assign_vars(array( $template->assign_vars(array(
'L_SEARCH_MATCHES' => $l_search_matches, 'L_SEARCH_MATCHES' => $l_search_matches,
'L_TOPIC' => $lang['Topic']) 'L_TOPIC' => $lang['Topic'])
); );
@ -709,15 +709,15 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$highlight_active .= " " . $split_word; $highlight_active .= " " . $split_word;
for ($k = 0; $k < count($synonym_array); $k++) for ($k = 0; $k < count($synonym_array); $k++)
{ {
list($replace_synonym, $match_synonym) = split(' ', trim(strtolower($synonym_array[$k]))); list($replace_synonym, $match_synonym) = split(' ', trim(strtolower($synonym_array[$k])));
if ( $replace_synonym == $split_word ) if ( $replace_synonym == $split_word )
{ {
$highlight_match[] = '#\b(' . str_replace("*", "([\w]+)?", $replace_synonym) . ')\b#is'; $highlight_match[] = '#\b(' . str_replace("*", "([\w]+)?", $replace_synonym) . ')\b#is';
$highlight_active .= ' ' . $match_synonym; $highlight_active .= ' ' . $match_synonym;
} }
} }
} }
} }
@ -908,7 +908,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$mini_post_alt = $lang['Post']; $mini_post_alt = $lang['Post'];
} }
$template->assign_block_vars("searchresults", array( $template->assign_block_vars("searchresults", array(
'TOPIC_TITLE' => $topic_title, 'TOPIC_TITLE' => $topic_title,
'FORUM_NAME' => $searchset[$i]['forum_name'], 'FORUM_NAME' => $searchset[$i]['forum_name'],
'POST_SUBJECT' => $post_subject, 'POST_SUBJECT' => $post_subject,
@ -917,9 +917,9 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
'TOPIC_REPLIES' => $searchset[$i]['topic_replies'], 'TOPIC_REPLIES' => $searchset[$i]['topic_replies'],
'TOPIC_VIEWS' => $searchset[$i]['topic_views'], 'TOPIC_VIEWS' => $searchset[$i]['topic_views'],
'MESSAGE' => $message, 'MESSAGE' => $message,
'MINI_POST_IMG' => $mini_post_img, 'MINI_POST_IMG' => $mini_post_img,
'L_MINI_POST_ALT' => $mini_post_alt, 'L_MINI_POST_ALT' => $mini_post_alt,
'U_POST' => $post_url, 'U_POST' => $post_url,
'U_TOPIC' => $topic_url, 'U_TOPIC' => $topic_url,
@ -1027,7 +1027,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
if ( $userdata['session_logged_in'] ) if ( $userdata['session_logged_in'] )
{ {
if ( $searchset[$i]['post_time'] > $userdata['user_lastvisit'] ) if ( $searchset[$i]['post_time'] > $userdata['user_lastvisit'] )
{ {
if ( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) ) if ( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
{ {
@ -1075,14 +1075,14 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
} }
} }
else if ( $searchset[$i]['post_time'] > $userdata['user_lastvisit'] ) else if ( $searchset[$i]['post_time'] > $userdata['user_lastvisit'] )
{ {
$folder_image = $folder_new; $folder_image = $folder_new;
$folder_alt = $lang['New_posts']; $folder_alt = $lang['New_posts'];
$newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> '; $newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
} }
else else
{ {
$folder_image = $folder; $folder_image = $folder;
$folder_alt = ( $searchset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts']; $folder_alt = ( $searchset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
@ -1118,27 +1118,27 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$last_post_url = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $searchset[$i]['topic_last_post_id']) . '#' . $searchset[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>'; $last_post_url = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $searchset[$i]['topic_last_post_id']) . '#' . $searchset[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>';
$template->assign_block_vars('searchresults', array( $template->assign_block_vars('searchresults', array(
'FORUM_NAME' => $searchset[$i]['forum_name'], 'FORUM_NAME' => $searchset[$i]['forum_name'],
'FORUM_ID' => $forum_id, 'FORUM_ID' => $forum_id,
'TOPIC_ID' => $topic_id, 'TOPIC_ID' => $topic_id,
'FOLDER' => $folder_image, 'FOLDER' => $folder_image,
'NEWEST_POST_IMG' => $newest_post_img, 'NEWEST_POST_IMG' => $newest_post_img,
'TOPIC_FOLDER_IMG' => $folder_image, 'TOPIC_FOLDER_IMG' => $folder_image,
'GOTO_PAGE' => $goto_page, 'GOTO_PAGE' => $goto_page,
'REPLIES' => $replies, 'REPLIES' => $replies,
'TOPIC_TITLE' => $topic_title, 'TOPIC_TITLE' => $topic_title,
'TOPIC_TYPE' => $topic_type, 'TOPIC_TYPE' => $topic_type,
'VIEWS' => $views, 'VIEWS' => $views,
'TOPIC_AUTHOR' => $topic_author, 'TOPIC_AUTHOR' => $topic_author,
'FIRST_POST_TIME' => $first_post_time, 'FIRST_POST_TIME' => $first_post_time,
'LAST_POST_TIME' => $last_post_time, 'LAST_POST_TIME' => $last_post_time,
'LAST_POST_AUTHOR' => $last_post_author, 'LAST_POST_AUTHOR' => $last_post_author,
'LAST_POST_IMG' => $last_post_url, 'LAST_POST_IMG' => $last_post_url,
'L_TOPIC_FOLDER_ALT' => $folder_alt, 'L_TOPIC_FOLDER_ALT' => $folder_alt,
'U_VIEW_FORUM' => $forum_url, 'U_VIEW_FORUM' => $forum_url,
'U_VIEW_TOPIC' => $topic_url) 'U_VIEW_TOPIC' => $topic_url)
); );
} }
@ -1148,7 +1148,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$template->assign_vars(array( $template->assign_vars(array(
'PAGINATION' => generate_pagination($base_url, $total_match_count, $per_page, $start), 'PAGINATION' => generate_pagination($base_url, $total_match_count, $per_page, $start),
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $per_page ) + 1 ), ceil( $total_match_count / $per_page )), 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $per_page ) + 1 ), ceil( $total_match_count / $per_page )),
'L_AUTHOR' => $lang['Author'], 'L_AUTHOR' => $lang['Author'],
'L_MESSAGE' => $lang['Message'], 'L_MESSAGE' => $lang['Message'],
@ -1157,8 +1157,8 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
'L_REPLIES' => $lang['Replies'], 'L_REPLIES' => $lang['Replies'],
'L_VIEWS' => $lang['Views'], 'L_VIEWS' => $lang['Views'],
'L_POSTS' => $lang['Posts'], 'L_POSTS' => $lang['Posts'],
'L_LASTPOST' => $lang['Last_Post'], 'L_LASTPOST' => $lang['Last_Post'],
'L_POSTED' => $lang['Posted'], 'L_POSTED' => $lang['Posted'],
'L_SUBJECT' => $lang['Subject'], 'L_SUBJECT' => $lang['Subject'],
'L_GOTO_PAGE' => $lang['Goto_page']) 'L_GOTO_PAGE' => $lang['Goto_page'])
@ -1177,9 +1177,9 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
// //
// Search forum // Search forum
// //
$sql = "SELECT c.cat_title, c.cat_id, f.forum_name, f.forum_id $sql = "SELECT c.cat_title, c.cat_id, f.forum_name, f.forum_id
FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f
WHERE f.cat_id = c.cat_id WHERE f.cat_id = c.cat_id
ORDER BY c.cat_id, f.forum_order"; ORDER BY c.cat_id, f.forum_order";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -1251,33 +1251,33 @@ for($i = 0; $i < count($previous_days); $i++)
} }
$template->assign_vars(array( $template->assign_vars(array(
'L_SEARCH_QUERY' => $lang['Search_query'], 'L_SEARCH_QUERY' => $lang['Search_query'],
'L_SEARCH_OPTIONS' => $lang['Search_options'], 'L_SEARCH_OPTIONS' => $lang['Search_options'],
'L_SEARCH_KEYWORDS' => $lang['Search_keywords'], 'L_SEARCH_KEYWORDS' => $lang['Search_keywords'],
'L_SEARCH_KEYWORDS_EXPLAIN' => $lang['Search_keywords_explain'], 'L_SEARCH_KEYWORDS_EXPLAIN' => $lang['Search_keywords_explain'],
'L_SEARCH_AUTHOR' => $lang['Search_author'], 'L_SEARCH_AUTHOR' => $lang['Search_author'],
'L_SEARCH_AUTHOR_EXPLAIN' => $lang['Search_author_explain'], 'L_SEARCH_AUTHOR_EXPLAIN' => $lang['Search_author_explain'],
'L_SEARCH_ANY_TERMS' => $lang['Search_for_any'], 'L_SEARCH_ANY_TERMS' => $lang['Search_for_any'],
'L_SEARCH_ALL_TERMS' => $lang['Search_for_all'], 'L_SEARCH_ALL_TERMS' => $lang['Search_for_all'],
'L_SEARCH_MESSAGE_ONLY' => $lang['Search_msg_only'], 'L_SEARCH_MESSAGE_ONLY' => $lang['Search_msg_only'],
'L_SEARCH_MESSAGE_TITLE' => $lang['Search_title_msg'], 'L_SEARCH_MESSAGE_TITLE' => $lang['Search_title_msg'],
'L_CATEGORY' => $lang['Category'], 'L_CATEGORY' => $lang['Category'],
'L_RETURN_FIRST' => $lang['Return_first'], 'L_RETURN_FIRST' => $lang['Return_first'],
'L_CHARACTERS' => $lang['characters_posts'], 'L_CHARACTERS' => $lang['characters_posts'],
'L_SORT_BY' => $lang['Sort_by'], 'L_SORT_BY' => $lang['Sort_by'],
'L_SORT_ASCENDING' => $lang['Sort_Ascending'], 'L_SORT_ASCENDING' => $lang['Sort_Ascending'],
'L_SORT_DESCENDING' => $lang['Sort_Descending'], 'L_SORT_DESCENDING' => $lang['Sort_Descending'],
'L_SEARCH_PREVIOUS' => $lang['Search_previous'], 'L_SEARCH_PREVIOUS' => $lang['Search_previous'],
'L_DISPLAY_RESULTS' => $lang['Display_results'], 'L_DISPLAY_RESULTS' => $lang['Display_results'],
'L_FORUM' => $lang['Forum'], 'L_FORUM' => $lang['Forum'],
'L_TOPICS' => $lang['Topics'], 'L_TOPICS' => $lang['Topics'],
'L_POSTS' => $lang['Posts'], 'L_POSTS' => $lang['Posts'],
'S_SEARCH_ACTION' => "search.$phpEx$SID&amp;mode=results", 'S_SEARCH_ACTION' => "search.$phpEx$SID&amp;mode=results",
'S_CHARACTER_OPTIONS' => $s_characters, 'S_CHARACTER_OPTIONS' => $s_characters,
'S_FORUM_OPTIONS' => $s_forums, 'S_FORUM_OPTIONS' => $s_forums,
'S_CATEGORY_OPTIONS' => $s_categories, 'S_CATEGORY_OPTIONS' => $s_categories,
'S_TIME_OPTIONS' => $s_time, 'S_TIME_OPTIONS' => $s_time,
'S_SORT_OPTIONS' => $s_sort_by, 'S_SORT_OPTIONS' => $s_sort_by,
'S_HIDDEN_FIELDS' => $s_hidden_fields) 'S_HIDDEN_FIELDS' => $s_hidden_fields)
); );
@ -1385,9 +1385,9 @@ function username_search()
$order_by = $sort_by_types[$sort_by] . ' ' . ( ( $sort_order == 'a' ) ? 'ASC' : 'DESC' ); $order_by = $sort_by_types[$sort_by] . ' ' . ( ( $sort_order == 'a' ) ? 'ASC' : 'DESC' );
$sql = "SELECT COUNT(user_id) AS total_users $sql = "SELECT COUNT(user_id) AS total_users
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . " WHERE user_id <> " . ANONYMOUS . "
$where_sql"; $where_sql";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -1406,54 +1406,54 @@ function username_search()
); );
$template->assign_vars(array( $template->assign_vars(array(
'USERNAME' => $username, 'USERNAME' => $username,
'EMAIL' => $email, 'EMAIL' => $email,
'ICQ' => $icq, 'ICQ' => $icq,
'AIM' => $aim, 'AIM' => $aim,
'YAHOO' => $yahoo, 'YAHOO' => $yahoo,
'MSNM' => $msn, 'MSNM' => $msn,
'JOINED' => implode('-', $joined), 'JOINED' => implode('-', $joined),
'ACTIVE' => implode('-', $active), 'ACTIVE' => implode('-', $active),
'COUNT' => $count, 'COUNT' => $count,
'PAGINATION' => $pagination, 'PAGINATION' => $pagination,
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_users / $board_config['topics_per_page'] )), 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_users / $board_config['topics_per_page'] )),
'L_SEARCH_USERNAME' => $lang['Find_username'], 'L_SEARCH_USERNAME' => $lang['Find_username'],
'L_SEARCH_EXPLAIN' => $lang['Find_username_explain'], 'L_SEARCH_EXPLAIN' => $lang['Find_username_explain'],
'L_RESET' => $lang['Reset'], 'L_RESET' => $lang['Reset'],
'L_EMAIL' => $lang['Email'], 'L_EMAIL' => $lang['Email'],
'L_ICQ_NUMBER' => $lang['ICQ'], 'L_ICQ_NUMBER' => $lang['ICQ'],
'L_MESSENGER' => $lang['MSNM'], 'L_MESSENGER' => $lang['MSNM'],
'L_YAHOO' => $lang['YIM'], 'L_YAHOO' => $lang['YIM'],
'L_AIM' => $lang['AIM'], 'L_AIM' => $lang['AIM'],
'L_JOINED' => $lang['Joined'], 'L_JOINED' => $lang['Joined'],
'L_ACTIVE' => $lang['Last_active'], 'L_ACTIVE' => $lang['Last_active'],
'L_POSTS' => $lang['Posts'], 'L_POSTS' => $lang['Posts'],
'L_SORT_BY' => $lang['Sort_by'], 'L_SORT_BY' => $lang['Sort_by'],
'L_SORT_ASCENDING' => $lang['Sort_Ascending'], 'L_SORT_ASCENDING' => $lang['Sort_Ascending'],
'L_SORT_DESCENDING' => $lang['Sort_Descending'], 'L_SORT_DESCENDING' => $lang['Sort_Descending'],
'L_SELECT_MARKED' => $lang['Select_marked'], 'L_SELECT_MARKED' => $lang['Select_marked'],
'L_MARK' => $lang['Mark'], 'L_MARK' => $lang['Mark'],
'L_MARK_ALL' => $lang['Mark_all'], 'L_MARK_ALL' => $lang['Mark_all'],
'L_UNMARK_ALL' => $lang['Unmark_all'], 'L_UNMARK_ALL' => $lang['Unmark_all'],
'S_FORM_NAME' => $form, 'S_FORM_NAME' => $form,
'S_FIELD_NAME' => $field, 'S_FIELD_NAME' => $field,
'S_COUNT_OPTIONS' => $s_find_count, 'S_COUNT_OPTIONS' => $s_find_count,
'S_JOINED_TIME_OPTIONS' => $s_find_join_time, 'S_JOINED_TIME_OPTIONS' => $s_find_join_time,
'S_ACTIVE_TIME_OPTIONS' => $s_find_active_time, 'S_ACTIVE_TIME_OPTIONS' => $s_find_active_time,
'S_SORT_OPTIONS' => $s_sort_by, 'S_SORT_OPTIONS' => $s_sort_by,
'S_SORT_ORDER' => $s_sort_order, 'S_SORT_ORDER' => $s_sort_order,
'S_USERNAME_OPTIONS' => $username_list, 'S_USERNAME_OPTIONS' => $username_list,
'S_SEARCH_ACTION' => "search.$phpEx$SID&amp;mode=searchuser&amp;field=$field") 'S_SEARCH_ACTION' => "search.$phpEx$SID&amp;mode=searchuser&amp;field=$field")
); );
$sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_email, user_lastvisit $sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_email, user_lastvisit
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . " WHERE user_id <> " . ANONYMOUS . "
$where_sql $where_sql
ORDER BY $order_by ORDER BY $order_by
LIMIT $start, " . $board_config['topics_per_page']; LIMIT $start, " . $board_config['topics_per_page'];
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -1474,13 +1474,13 @@ function username_search()
$profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>'; $profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>';
$template->assign_block_vars('memberrow', array( $template->assign_block_vars('memberrow', array(
'ROW_NUMBER' => $i + ( $start + 1 ), 'ROW_NUMBER' => $i + ( $start + 1 ),
'USERNAME' => $username, 'USERNAME' => $username,
'JOINED' => $joined, 'JOINED' => $joined,
'POSTS' => $posts, 'POSTS' => $posts,
'ACTIVE' => $active, 'ACTIVE' => $active,
'PROFILE_IMG' => $profile_img, 'PROFILE_IMG' => $profile_img,
'PROFILE' => $profile) 'PROFILE' => $profile)
); );
$i++; $i++;

View file

@ -82,7 +82,7 @@ if ( !($forum_data = $db->sql_fetchrow($result)) )
// //
// Configure style, language, etc. // Configure style, language, etc.
// //
$acl = new auth('forum', $userdata, $forum_id); $acl = new acl('forum', $userdata, $forum_id);
$userdata['user_style'] = ( $forum_data['forum_style'] ) ? $forum_data['user_style'] : $userdata['user_style']; $userdata['user_style'] = ( $forum_data['forum_style'] ) ? $forum_data['user_style'] : $userdata['user_style'];
$session->configure($userdata); $session->configure($userdata);

View file

@ -28,7 +28,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Start session management // Start session management
// //
$userdata = $session->start(); $userdata = $session->start();
$acl = new auth('list', $userdata); $acl = new acl('list', $userdata);
// //
// End session management // End session management
// //
@ -41,7 +41,7 @@ $session->configure($userdata);
// //
// Forum info // Forum info
// //
$sql = "SELECT forum_id, forum_name $sql = "SELECT forum_id, forum_name
FROM " . FORUMS_TABLE; FROM " . FORUMS_TABLE;
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -73,7 +73,7 @@ while ( $row = $db->sql_fetchrow($result) )
{ {
$view_online = false; $view_online = false;
if ( $row['user_id'] != ANONYMOUS ) if ( $row['user_id'] != ANONYMOUS )
{ {
$user_id = $row['user_id']; $user_id = $row['user_id'];
@ -111,7 +111,7 @@ while ( $row = $db->sql_fetchrow($result) )
$username = $lang['Guest']; $username = $lang['Guest'];
$view_online = true; $view_online = true;
$guest_users++; $guest_users++;
$which_counter = 'guest_counter'; $which_counter = 'guest_counter';
$which_row = 'guest_user_row'; $which_row = 'guest_user_row';
} }
@ -196,7 +196,7 @@ while ( $row = $db->sql_fetchrow($result) )
'LASTUPDATE' => create_date($board_config['default_dateformat'], $row['session_time'], $board_config['board_timezone']), 'LASTUPDATE' => create_date($board_config['default_dateformat'], $row['session_time'], $board_config['board_timezone']),
'FORUM_LOCATION' => $location, 'FORUM_LOCATION' => $location,
'S_ROW_COUNT' => $$which_counter, 'S_ROW_COUNT' => $$which_counter,
'U_USER_PROFILE' => "profile.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $user_id, 'U_USER_PROFILE' => "profile.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $user_id,
'U_FORUM_LOCATION' => $location_url) 'U_FORUM_LOCATION' => $location_url)
@ -246,14 +246,14 @@ else
} }
$template->assign_vars(array( $template->assign_vars(array(
'TOTAL_REGISTERED_USERS_ONLINE' => sprintf($l_r_user_s, $registered_users) . sprintf($l_h_user_s, $hidden_users), 'TOTAL_REGISTERED_USERS_ONLINE' => sprintf($l_r_user_s, $registered_users) . sprintf($l_h_user_s, $hidden_users),
'TOTAL_GUEST_USERS_ONLINE' => sprintf($l_g_user_s, $guest_users), 'TOTAL_GUEST_USERS_ONLINE' => sprintf($l_g_user_s, $guest_users),
'L_WHOSONLINE' => $lang['Who_is_online'], 'L_WHOSONLINE' => $lang['Who_is_online'],
'L_ONLINE_EXPLAIN' => $lang['Online_explain'], 'L_ONLINE_EXPLAIN' => $lang['Online_explain'],
'L_USERNAME' => $lang['Username'], 'L_USERNAME' => $lang['Username'],
'L_FORUM_LOCATION' => $lang['Forum_Location'], 'L_FORUM_LOCATION' => $lang['Forum_Location'],
'L_LAST_UPDATE' => $lang['Last_updated'], 'L_LAST_UPDATE' => $lang['Last_updated'],
'L_NO_GUESTS_BROWSING' => $lang['No_users_browsing'], 'L_NO_GUESTS_BROWSING' => $lang['No_users_browsing'],
'L_NO_REGISTERED_USERS_BROWSING' => $lang['No_users_browsing']) 'L_NO_REGISTERED_USERS_BROWSING' => $lang['No_users_browsing'])
); );

View file

@ -165,7 +165,7 @@ if ( !(extract($db->sql_fetchrow($result))) )
$userdata['user_style'] = ( $default_style ) ? $default_style : $userdata['user_style']; $userdata['user_style'] = ( $default_style ) ? $default_style : $userdata['user_style'];
$session->configure($userdata); $session->configure($userdata);
$acl = new auth('forum', $userdata, $forum_id); $acl = new acl('forum', $userdata, $forum_id);
// //
// Start auth check // Start auth check