aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/develop/create_schema_files.php44
-rw-r--r--phpBB/includes/acp/acp_bbcodes.php2
-rw-r--r--phpBB/includes/acp/acp_board.php21
-rw-r--r--phpBB/includes/acp/acp_icons.php3
-rw-r--r--phpBB/includes/functions.php116
-rw-r--r--phpBB/includes/functions_display.php10
-rw-r--r--phpBB/includes/functions_posting.php29
-rw-r--r--phpBB/includes/functions_user.php6
-rw-r--r--phpBB/includes/ucp/ucp_attachments.php6
-rw-r--r--phpBB/includes/ucp/ucp_groups.php2
-rw-r--r--phpBB/language/en/acp/board.php2
-rw-r--r--phpBB/search.php4
-rw-r--r--phpBB/styles/subSilver/template/ucp_main_bookmarks.html2
-rw-r--r--phpBB/styles/subSilver/template/ucp_main_subscribed.html2
-rw-r--r--phpBB/viewforum.php72
-rw-r--r--phpBB/viewtopic.php30
16 files changed, 241 insertions, 110 deletions
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php
index 2758e88373..a853d8a032 100644
--- a/phpBB/develop/create_schema_files.php
+++ b/phpBB/develop/create_schema_files.php
@@ -42,7 +42,7 @@ $dbms_type_map = array(
'MTEXT' => 'mediumtext',
'TIMESTAMP' => 'int(11) UNSIGNED',
'DECIMAL' => 'decimal(5,2)',
- 'VCHAR_BIN' => 'varchar(252) BINARY',
+ 'VCHAR_BIN' => 'varchar(252) /*!40101 CHARACTER SET utf8 */ BINARY',
'VCHAR_CI' => 'varchar(252)',
'VARBINARY' => 'varbinary(255)',
),
@@ -64,7 +64,7 @@ $dbms_type_map = array(
'MTEXT' => 'BLOB SUB_TYPE TEXT',
'TIMESTAMP' => 'INTEGER',
'DECIMAL' => 'DOUBLE PRECISION',
- 'VCHAR_BIN' => 'VARCHAR(252)',
+ 'VCHAR_BIN' => 'VARCHAR(252) CHARACTER SET UNICODE_FSS',
'VCHAR_CI' => 'VARCHAR(252)',
'VARBINARY' => 'CHAR(255)',
),
@@ -108,7 +108,7 @@ $dbms_type_map = array(
'MTEXT' => 'clob',
'TIMESTAMP' => 'number(11)',
'DECIMAL' => 'number(5, 2)',
- 'VCHAR_BIN' => 'varchar2(252)',
+ 'VCHAR_BIN' => 'nvarchar2(252)',
'VCHAR_CI' => 'varchar2(252)',
'VARBINARY' => 'raw(255)',
),
@@ -130,7 +130,7 @@ $dbms_type_map = array(
'MTEXT' => 'mediumtext(16777215)',
'TIMESTAMP' => 'INTEGER UNSIGNED', //'int(11) UNSIGNED',
'DECIMAL' => 'decimal(5,2)',
- 'VCHAR_BIN' => 'varchar(252)',
+ 'VCHAR_BIN' => 'nvarchar(252)',
'VCHAR_CI' => 'varchar(252)',
'VARBINARY' => 'blob',
),
@@ -182,7 +182,7 @@ foreach ($supported_dbms as $dbms)
case 'sqlite':
$line = "#\n# SQLite Schema for phpBB 3.x - (c) phpBB Group, 2005\n#\n# \$I" . "d: $\n#\n\n";
- $line .= "BEGIN TRANSACTION;\n\n";
+ $line .= "BEGIN TRANSACTION;;\n\n";
break;
case 'mssql':
@@ -477,7 +477,7 @@ foreach ($supported_dbms as $dbms)
case 'sqlite':
// Remove last line delimiter...
$line = substr($line, 0, -2);
- $line .= "\n);\n\n";
+ $line .= "\n);;\n\n";
break;
}
@@ -526,6 +526,12 @@ foreach ($supported_dbms as $dbms)
break;
case 'sqlite':
+ $line .= ($key_data[0] == 'INDEX') ? 'CREATE INDEX' : '';
+ $line .= ($key_data[0] == 'UNIQUE') ? 'CREATE UNIQUE INDEX' : '';
+
+ $line .= " {$table_name}_{$key_name} ON {$table_name} (" . implode(', ', $key_data[1]) . ");;\n";
+ break;
+
case 'postgres':
$line .= ($key_data[0] == 'INDEX') ? 'CREATE INDEX' : '';
$line .= ($key_data[0] == 'UNIQUE') ? 'CREATE UNIQUE INDEX' : '';
@@ -653,6 +659,17 @@ EOF;
break;
case 'sqlite':
+ $line = '
+CREATE TRIGGER "t_phpbb_styles_template"
+AFTER INSERT ON "phpbb_styles_template"
+FOR EACH ROW WHEN NEW.bbcode_bitfield = \'\'
+BEGIN
+ UPDATE phpbb_styles_template SET bbcode_bitfield = binary_insert(1) WHERE template_id = NEW.template_id;
+END;;
+
+COMMIT;;';
+ break;
+
case 'postgres':
$line = "\nCOMMIT;";
break;
@@ -802,6 +819,12 @@ function get_schema_struct()
'ban_give_reason' => array('STEXT', ''),
),
'PRIMARY_KEY' => 'ban_id',
+ 'KEYS' => array(
+ 'ban_end' => array('INDEX', 'ban_end'),
+ 'ban_user' => array('INDEX', array('ban_userid', 'ban_exclude')),
+ 'ban_email' => array('INDEX', array('ban_email', 'ban_exclude')),
+ 'ban_ip' => array('INDEX', array('ban_ip', 'ban_exclude')),
+ ),
);
$schema_data['phpbb_bbcodes'] = array(
@@ -870,6 +893,9 @@ function get_schema_struct()
'code' => array('VCHAR:8', ''),
),
'PRIMARY_KEY' => array('session_id', 'confirm_id'),
+ 'KEYS' => array(
+ 'confirm_type' => array('INDEX', 'confirm_type'),
+ ),
);
$schema_data['phpbb_disallow'] = array(
@@ -1245,6 +1271,9 @@ function get_schema_struct()
'rule_folder_id' => array('INT:4', 0),
),
'PRIMARY_KEY' => 'rule_id',
+ 'KEYS' => array(
+ 'user_id' => array('INDEX', 'user_id'),
+ ),
);
$schema_data['phpbb_privmsgs_to'] = array(
@@ -1262,6 +1291,7 @@ function get_schema_struct()
),
'KEYS' => array(
'msg_id' => array('INDEX', 'msg_id'),
+ 'author_id' => array('INDEX', 'author_id'),
'usr_flder_id' => array('INDEX', array('user_id', 'folder_id')),
),
);
@@ -1386,6 +1416,7 @@ function get_schema_struct()
),
'KEYS' => array(
'word_id' => array('INDEX', 'word_id'),
+ 'post_id' => array('INDEX', 'post_id'),
),
);
@@ -1675,6 +1706,7 @@ function get_schema_struct()
'forum_id' => array('INDEX', 'forum_id'),
'forum_id_type' => array('INDEX', array('forum_id', 'topic_type')),
'last_post_time' => array('INDEX', 'topic_last_post_time'),
+ 'fid_time_moved' => array('INDEX', array('forum_id', 'topic_last_post_time', 'topic_moved_id')),
),
);
diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php
index 236043f339..a12e6e658b 100644
--- a/phpBB/includes/acp/acp_bbcodes.php
+++ b/phpBB/includes/acp/acp_bbcodes.php
@@ -38,7 +38,7 @@ class acp_bbcodes
break;
case 'edit':
- $sql = 'SELECT bbcode_match, bbcode_tpl, display_on_posting, bbcode_helpline, bbcode_helpline
+ $sql = 'SELECT bbcode_match, bbcode_tpl, display_on_posting, bbcode_helpline
FROM ' . BBCODES_TABLE . '
WHERE bbcode_id = ' . $bbcode_id;
$result = $db->sql_query($sql);
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 52890b4263..49e4b1eb1c 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -239,16 +239,17 @@ class acp_board
'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'type' => 'text:4:3', 'explain' => true),
'legend2' => 'GENERAL_OPTIONS',
- 'load_db_track' => array('lang' => 'YES_POST_MARKING', 'type' => 'radio:yes_no', 'explain' => true),
- 'load_db_lastread' => array('lang' => 'YES_READ_MARKING', 'type' => 'radio:yes_no', 'explain' => true),
- 'load_online' => array('lang' => 'YES_ONLINE', 'type' => 'radio:yes_no', 'explain' => true),
- 'load_online_guests' => array('lang' => 'YES_ONLINE_GUESTS', 'type' => 'radio:yes_no', 'explain' => true),
- 'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'type' => 'radio:yes_no', 'explain' => true),
- 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'type' => 'radio:yes_no', 'explain' => false),
- 'load_moderators' => array('lang' => 'YES_MODERATORS', 'type' => 'radio:yes_no', 'explain' => false),
- 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'type' => 'radio:yes_no', 'explain' => false),
- 'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY','type' => 'radio:yes_no', 'explain' => true),
- 'load_tplcompile' => array('lang' => 'RECOMPILE_TEMPLATES', 'type' => 'radio:yes_no', 'explain' => true),
+ 'load_db_track' => array('lang' => 'YES_POST_MARKING', 'type' => 'radio:yes_no', 'explain' => true),
+ 'load_db_lastread' => array('lang' => 'YES_READ_MARKING', 'type' => 'radio:yes_no', 'explain' => true),
+ 'load_anon_lastread' => array('lang' => 'YES_ANON_READ_MARKING', 'type' => 'radio:yes_no', 'explain' => true),
+ 'load_online' => array('lang' => 'YES_ONLINE', 'type' => 'radio:yes_no', 'explain' => true),
+ 'load_online_guests' => array('lang' => 'YES_ONLINE_GUESTS', 'type' => 'radio:yes_no', 'explain' => true),
+ 'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'type' => 'radio:yes_no', 'explain' => true),
+ 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'type' => 'radio:yes_no', 'explain' => false),
+ 'load_moderators' => array('lang' => 'YES_MODERATORS', 'type' => 'radio:yes_no', 'explain' => false),
+ 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'type' => 'radio:yes_no', 'explain' => false),
+ 'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY', 'type' => 'radio:yes_no', 'explain' => true),
+ 'load_tplcompile' => array('lang' => 'RECOMPILE_TEMPLATES', 'type' => 'radio:yes_no', 'explain' => true),
'legend3' => 'CUSTOM_PROFILE_FIELDS',
'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'type' => 'radio:yes_no', 'explain' => false),
diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php
index 0587122423..66aec3a90d 100644
--- a/phpBB/includes/acp/acp_icons.php
+++ b/phpBB/includes/acp/acp_icons.php
@@ -554,6 +554,9 @@ class acp_icons
$notice = $user->lang[$lang . '_DELETED'];
+ $cache->destroy('icons');
+ $cache->destroy('sql', $table);
+
break;
case 'move_up':
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 51c298a01d..48336727f0 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -539,7 +539,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
$db->sql_query('DELETE FROM ' . FORUMS_TRACK_TABLE . " WHERE user_id = {$user->data['user_id']}");
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_lastmark = ' . time() . " WHERE user_id = {$user->data['user_id']}");
}
- else
+ else if ($config['load_anon_lastread'] || $user->data['is_registered'])
{
$tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . '_track']) : $_COOKIE[$config['cookie_name'] . '_track']) : '';
$tracking_topics = ($tracking_topics) ? unserialize($tracking_topics) : array();
@@ -633,7 +633,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
}
}
}
- else
+ else if ($config['load_anon_lastread'] || $user->data['is_registered'])
{
$tracking = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . '_track']) : $_COOKIE[$config['cookie_name'] . '_track']) : '';
$tracking = ($tracking) ? unserialize($tracking) : array();
@@ -698,7 +698,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
$db->sql_return_on_error(false);
}
}
- else
+ else if ($config['load_anon_lastread'] || $user->data['is_registered'])
{
$tracking = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . '_track']) : $_COOKIE[$config['cookie_name'] . '_track']) : '';
$tracking = ($tracking) ? unserialize($tracking) : array();
@@ -745,7 +745,8 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
if ($user->data['is_registered'])
{
- $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_lastmark = ' . intval(base_convert(max($time_keys) + $config['board_startdate'], 36, 10)) . " WHERE user_id = {$user->data['user_id']}");
+ $user->data['user_lastmark'] = intval(base_convert(max($time_keys) + $config['board_startdate'], 36, 10));
+ $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_lastmark = ' . $user->data['user_lastmark'] . " WHERE user_id = {$user->data['user_id']}");
}
else
{
@@ -929,7 +930,7 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis
}
}
}
- else
+ else if ($config['load_anon_lastread'] || $user->data['is_registered'])
{
global $tracking_topics;
@@ -995,6 +996,111 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis
return $last_read;
}
+/**
+* Check for read forums and update topic tracking info accordingly
+*
+* @param int $forum_id the forum id to check
+* @param int $forum_last_post_time the forums last post time
+* @param int $f_mark_time the forums last mark time if user is registered and load_db_lastread enabled
+* @param int $mark_time_forum false if the mark time needs to be obtained, else the last users forum mark time
+*
+*/
+function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time = false, $mark_time_forum = false)
+{
+ global $db, $tracking_topics, $user, $config;
+
+ // Determine the users last forum mark time if not given.
+ if ($mark_time_forum === false)
+ {
+ if ($config['load_db_lastread'] && $user->data['is_registered'])
+ {
+ $mark_time_forum = (!empty($f_mark_time)) ? $f_mark_time : $user->data['user_lastmark'];
+ }
+ else if ($config['load_anon_lastread'] || $user->data['is_registered'])
+ {
+ if (!isset($tracking_topics) || !sizeof($tracking_topics))
+ {
+ $tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . '_track']) : $_COOKIE[$config['cookie_name'] . '_track']) : '';
+ $tracking_topics = ($tracking_topics) ? unserialize($tracking_topics) : array();
+ }
+
+ if (!$user->data['is_registered'])
+ {
+ $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0;
+ }
+
+ $mark_time_forum = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark'];
+ }
+ }
+
+ // Check the forum for any left unread topics.
+ // If there are none, we mark the forum as read.
+ if ($config['load_db_lastread'] && $user->data['is_registered'])
+ {
+ if ($mark_time_forum >= $forum_last_post_time)
+ {
+ // We do not need to mark read, this happened before. Therefore setting this to true
+ $row = true;
+ }
+ else
+ {
+ $sql = 'SELECT t.forum_id FROM ' . TOPICS_TABLE . ' t
+ LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id'] . ')
+ WHERE t.forum_id = ' . $forum_id . '
+ AND t.topic_last_post_time > ' . $mark_time_forum . '
+ AND t.topic_moved_id = 0
+ AND tt.topic_id IS NULL
+ GROUP BY t.forum_id';
+ $result = $db->sql_query_limit($sql, 1);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+ }
+ }
+ else if ($config['load_anon_lastread'] || $user->data['is_registered'])
+ {
+ // Get information from cookie
+ $row = false;
+
+ if (!isset($tracking_topics['tf'][$forum_id]))
+ {
+ // We do not need to mark read, this happened before. Therefore setting this to true
+ $row = true;
+ }
+ else
+ {
+ $sql = 'SELECT topic_id
+ FROM ' . TOPICS_TABLE . '
+ WHERE forum_id = ' . $forum_id . '
+ AND topic_last_post_time > ' . $mark_time_forum . '
+ AND topic_moved_id = 0';
+ $result = $db->sql_query($sql);
+
+ $check_forum = $tracking_topics['tf'][$forum_id];
+ $unread = false;
+ while ($row = $db->sql_fetchrow($result))
+ {
+ if (!in_array(base_convert($row['topic_id'], 10, 36), array_keys($check_forum)))
+ {
+ $unread = true;
+ break;
+ }
+ }
+ $db->sql_freeresult($result);
+
+ $row = $unread;
+ }
+ }
+ else
+ {
+ $row = true;
+ }
+
+ if (!$row)
+ {
+ markread('topics', $forum_id);
+ }
+}
+
// Pagination functions
/**
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 2d9512c779..05ab4afcbb 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -46,16 +46,16 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
// Display list of active topics for this category?
$show_active = (isset($root_data['forum_flags']) && $root_data['forum_flags'] & 16) ? true : false;
+ $sql_from = FORUMS_TABLE . ' f ';
+ $lastread_select = $sql_lastread = '';
+
if ($config['load_db_lastread'] && $user->data['is_registered'])
{
$sql_from = FORUMS_TABLE . ' f LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id)';
$lastread_select = ', ft.mark_time ';
}
- else
+ else if ($config['load_anon_lastread'] || $user->data['is_registered'])
{
- $sql_from = FORUMS_TABLE . ' f ';
- $lastread_select = $sql_lastread = '';
-
$tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . '_track']) : $_COOKIE[$config['cookie_name'] . '_track']) : '';
$tracking_topics = ($tracking_topics) ? unserialize($tracking_topics) : array();
@@ -116,7 +116,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
{
$forum_tracking_info[$forum_id] = (!empty($row['mark_time'])) ? $row['mark_time'] : $user->data['user_lastmark'];
}
- else
+ else if ($config['load_anon_lastread'] || $user->data['is_registered'])
{
if (!$user->data['is_registered'])
{
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 87a7b63533..3fe1fbab9f 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1905,6 +1905,35 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
// We do not use post_time here, this is intended (post_time can have a date in the past if editing a message)
markread('topic', $data['forum_id'], $data['topic_id'], time());
+ //
+ if ($config['load_db_lastread'] && $user->data['is_registered'])
+ {
+ $sql = 'SELECT mark_time
+ FROM ' . FORUMS_TRACK_TABLE . '
+ WHERE user_id = ' . $user->data['user_id'] . '
+ AND forum_id = ' . $data['forum_id'];
+ $result = $db->sql_query($sql);
+ $f_mark_time = (int) $db->sql_fetchfield('mark_time');
+ $db->sql_freeresult($result);
+ }
+ else if ($config['load_anon_lastread'] || $user->data['is_registered'])
+ {
+ $f_mark_time = false;
+ }
+
+ if ($config['load_db_lastread'] || $config['load_anon_lastread'] || $user->data['is_registered'])
+ {
+ // Update forum info
+ $sql = 'SELECT forum_last_post_time
+ FROM ' . FORUMS_TABLE . '
+ WHERE forum_id = ' . $data['forum_id'];
+ $result = $db->sql_query($sql);
+ $forum_last_post_time = (int) $db->sql_fetchfield('forum_last_post_time');
+ $db->sql_freeresult($result);
+
+ update_forum_tracking_info($data['forum_id'], $forum_last_post_time, $f_mark_time, false);
+ }
+
// Send Notifications
if ($mode != 'edit' && $mode != 'delete' && ($auth->acl_get('f_noapprove', $data['forum_id']) || $auth->acl_get('m_approve', $data['forum_id'])))
{
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index ef75b85a48..bc1c41b087 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -809,6 +809,12 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
$sql = 'DELETE FROM ' . SESSIONS_TABLE . "
$sql_where";
$db->sql_query($sql);
+
+ if ($mode == 'user')
+ {
+ $sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' ' . ((in_array('*', $banlist_ary)) ? '' : 'WHERE user_id IN (' . implode(', ', $banlist_ary) . ')');
+ $db->sql_query($sql);
+ }
}
}
diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php
index 1b2bd1d538..549e3a11b2 100644
--- a/phpBB/includes/ucp/ucp_attachments.php
+++ b/phpBB/includes/ucp/ucp_attachments.php
@@ -93,7 +93,7 @@ class ucp_attachments
LEFT JOIN ' . PRIVMSGS_TABLE . ' p ON (a.post_msg_id = p.msg_id AND a.in_message = 1)
WHERE a.poster_id = ' . $user->data['user_id'] . "
ORDER BY $order_by";
- $result = $db->sql_query_limit($sql, $config['posts_per_page'], $start);
+ $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
$row_count = 0;
if ($row = $db->sql_fetchrow($result))
@@ -138,8 +138,8 @@ class ucp_attachments
$db->sql_freeresult($result);
$template->assign_vars(array(
- 'PAGE_NUMBER' => on_page($num_attachments, $config['posts_per_page'], $start),
- 'PAGINATION' => generate_pagination($this->u_action . "&sk=$sort_key&sd=$sort_dir", $num_attachments, $config['posts_per_page'], $start),
+ 'PAGE_NUMBER' => on_page($num_attachments, $config['topics_per_page'], $start),
+ 'PAGINATION' => generate_pagination($this->u_action . "&sk=$sort_key&sd=$sort_dir", $num_attachments, $config['topics_per_page'], $start),
'TOTAL_ATTACHMENTS' => $num_attachments,
'L_TITLE' => $user->lang['UCP_ATTACHMENTS'],
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index 4dcacdc575..1943db0190 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -723,7 +723,7 @@ class ucp_groups
'PAGINATION' => generate_pagination($this->u_action . "&action=$action&g=$group_id", $total_members, $config['topics_per_page'], $start, true),
'U_ACTION' => $this->u_action . "&g=$group_id",
- 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=list&field=usernames'))
+ 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=ucp&field=usernames'))
);
break;
diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php
index e2fee6079e..bf47c1e709 100644
--- a/phpBB/language/en/acp/board.php
+++ b/phpBB/language/en/acp/board.php
@@ -267,6 +267,8 @@ $lang = array_merge($lang, array(
'LOAD_USER_ACTIVITY_EXPLAIN' => 'Displays active topic/forum in user profiles and user control panel. It is recommended to disable this on boards with more than one million posts.',
'RECOMPILE_TEMPLATES' => 'Recompile stale templates',
'RECOMPILE_TEMPLATES_EXPLAIN' => 'Check for updated template files on filesystem and recompile.',
+ 'YES_ANON_READ_MARKING' => 'Enable topic marking for guests',
+ 'YES_ANON_READ_MARKING_EXPLAIN' => 'Stores read/unread status information for guests. If disabled posts are always read for guests.',
'YES_BIRTHDAYS' => 'Enable birthday listing',
'YES_JUMPBOX' => 'Enable display of Jumpbox',
'YES_MODERATORS' => 'Enable display of Moderators',
diff --git a/phpBB/search.php b/phpBB/search.php
index 185dcb0f50..53f75ab0cf 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -525,7 +525,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
}
}
- if (!$user->data['is_registered'] || !$config['load_db_lastread'])
+ if ($config['load_anon_lastread'] || ($user->data['is_registered'] && !$config['load_db_lastread']))
{
$tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . '_track']) : $_COOKIE[$config['cookie_name'] . '_track']) : '';
$tracking_topics = ($tracking_topics) ? unserialize($tracking_topics) : array();
@@ -563,7 +563,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
{
$topic_tracking_info[$forum_id] = get_topic_tracking($forum_id, $forum['topic_list'], $forum['rowset'], array($forum_id => $forum['mark_time']), ($forum_id) ? false : $forum['topic_list']);
}
- else
+ else if ($config['load_anon_lastread'] || $user->data['is_registered'])
{
$topic_tracking_info[$forum_id] = get_complete_topic_tracking($forum_id, $forum['topic_list'], ($forum_id) ? false : $forum['topic_list']);
diff --git a/phpBB/styles/subSilver/template/ucp_main_bookmarks.html b/phpBB/styles/subSilver/template/ucp_main_bookmarks.html
index b13a2a3eeb..5be1a5af2e 100644
--- a/phpBB/styles/subSilver/template/ucp_main_bookmarks.html
+++ b/phpBB/styles/subSilver/template/ucp_main_bookmarks.html
@@ -5,7 +5,7 @@
<th colspan="5">{L_UCP}</th>
</tr>
<tr>
- <td class="row1" colspan="5" align="center"><span class="genmed">{L_UCP_WELCOME}</span></td>
+ <td class="row1" colspan="5" align="center"><span class="genmed">{L_BOOKMARKS_EXPLAIN}</span></td>
</tr>
<tr>
<th colspan="5">{L_BOOKMARKS}</th>
diff --git a/phpBB/styles/subSilver/template/ucp_main_subscribed.html b/phpBB/styles/subSilver/template/ucp_main_subscribed.html
index 8153ac8eda..b0f3d455c0 100644
--- a/phpBB/styles/subSilver/template/ucp_main_subscribed.html
+++ b/phpBB/styles/subSilver/template/ucp_main_subscribed.html
@@ -5,7 +5,7 @@
<th colspan="4">{L_UCP}</th>
</tr>
<tr>
- <td class="row1" colspan="4" align="center"><span class="genmed">{L_UCP_WELCOME}</span></td>
+ <td class="row1" colspan="4" align="center"><span class="genmed">{L_WATCHED_EXPLAIN}</span></td>
</tr>
<tr>
<th colspan="4">{L_WATCHED_FORUMS}</th>
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index 794352a17d..1e7a078c7f 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -38,17 +38,14 @@ if (!$forum_id)
}
$sql_from = FORUMS_TABLE . ' f';
+$lastread_select = '';
// Grab appropriate forum data
if ($config['load_db_lastread'] && $user->data['is_registered'])
{
$sql_from .= ' LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . '
AND ft.forum_id = f.forum_id)';
- $lastread_select = ', ft.mark_time';
-}
-else
-{
- $lastread_select = '';
+ $lastread_select .= ', ft.mark_time';
}
if ($user->data['is_registered'])
@@ -428,6 +425,7 @@ $topic_tracking_info = $tracking_topics = array();
if (sizeof($topic_list))
{
$mark_forum_read = true;
+ $mark_time_forum = 0;
// Active topics?
if ($s_display_active && sizeof($active_forum_ary))
@@ -447,7 +445,7 @@ if (sizeof($topic_list))
$topic_tracking_info += get_topic_tracking($f_id, $topic_row['topics'], $rowset, array($f_id => $topic_row['forum_mark_time']), false);
}
}
- else
+ else if ($config['load_anon_lastread'] || $user->data['is_registered'])
{
foreach ($topic_forum_list as $f_id => $topic_row)
{
@@ -464,7 +462,7 @@ if (sizeof($topic_list))
$topic_tracking_info = get_topic_tracking($forum_id, $topic_list, $rowset, array($forum_id => $forum_data['mark_time']), $global_announce_list);
$mark_time_forum = (!empty($forum_data['mark_time'])) ? $forum_data['mark_time'] : $user->data['user_lastmark'];
}
- else
+ else if ($config['load_anon_lastread'] || $user->data['is_registered'])
{
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_list, $global_announce_list);
@@ -572,65 +570,7 @@ if (sizeof($topic_list))
// after reading a topic
if ($forum_data['forum_type'] == FORUM_POST && sizeof($topic_list) && $mark_forum_read)
{
- // Make sure there are not additional topics unread
- if ($config['load_db_lastread'] && $user->data['is_registered'])
- {
- if ($mark_time_forum >= $forum_data['forum_last_post_time'])
- {
- $row = true;
- }
- else
- {
- $sql = 'SELECT t.forum_id FROM ' . TOPICS_TABLE . ' t
- LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id'] . ')
- WHERE t.forum_id = ' . $forum_id . '
- AND t.topic_last_post_time > ' . $mark_time_forum . '
- AND t.topic_moved_id = 0
- AND tt.topic_id IS NULL
- GROUP BY t.forum_id';
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
- }
- }
- else
- {
- // Get information from cookie
- $row = false;
-
- if (!isset($tracking_topics['tf'][$forum_id]))
- {
- // We do not need to mark read, this has happened before. Therefore setting this to true
- $row = true;
- }
- else
- {
- $sql = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
- WHERE forum_id = ' . $forum_id . '
- AND topic_last_post_time > ' . $mark_time_forum . '
- AND topic_moved_id = 0';
- $result = $db->sql_query($sql);
-
- $check_forum = $tracking_topics['tf'][$forum_id];
- $unread = false;
- while ($row = $db->sql_fetchrow($result))
- {
- if (!in_array(base_convert($row['topic_id'], 10, 36), array_keys($check_forum)))
- {
- $unread = true;
- break;
- }
- }
- $db->sql_freeresult($result);
-
- $row = $unread;
- }
- }
-
- if (!$row)
- {
- markread('topics', $forum_id);
- }
+ update_forum_tracking_info($forum_id, $forum_data['forum_last_post_time'], false, $mark_time_forum);
}
page_footer();
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 43aca88ade..ac090bb19a 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -325,6 +325,8 @@ if ($post_id)
// Get topic tracking info
if (!isset($topic_tracking_info))
{
+ $topic_tracking_info = array();
+
// Get topic tracking info
if ($config['load_db_lastread'] && $user->data['is_registered'])
{
@@ -332,7 +334,7 @@ if (!isset($topic_tracking_info))
$topic_tracking_info = get_topic_tracking($forum_id, $topic_id, $tmp_topic_data, array($forum_id => $topic_data['forum_mark_time']));
unset($tmp_topic_data);
}
- else
+ else if ($config['load_anon_lastread'] || $user->data['is_registered'])
{
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id);
}
@@ -715,20 +717,25 @@ if (!empty($topic_data['poll_start']))
for ($i = 0, $size = sizeof($poll_info); $i < $size; $i++)
{
+ $poll_info[$i]['poll_option_text'] = censor_text($poll_info[$i]['poll_option_text']);
+
if ($poll_bbcode !== false)
{
$poll_bbcode->bbcode_second_pass($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield']);
}
+
$poll_info[$i]['poll_option_text'] = smiley_text($poll_info[$i]['poll_option_text']);
- $poll_info[$i]['poll_option_text'] = str_replace("\n", '<br />', censor_text($poll_info[$i]['poll_option_text']));
+ $poll_info[$i]['poll_option_text'] = str_replace("\n", '<br />', $poll_info[$i]['poll_option_text']);
}
+ $topic_data['poll_title'] = censor_text($topic_data['poll_title']);
+
if ($poll_bbcode !== false)
{
$poll_bbcode->bbcode_second_pass($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield']);
}
$topic_data['poll_title'] = smiley_text($topic_data['poll_title']);
- $topic_data['poll_title'] = str_replace("\n", '<br />', censor_text($topic_data['poll_title']));
+ $topic_data['poll_title'] = str_replace("\n", '<br />', $topic_data['poll_title']);
unset($poll_bbcode);
@@ -1081,8 +1088,8 @@ while ($row = $db->sql_fetchrow($result))
{
$diff = ($diff < 0) ? 1 : 0;
}
-
- $age = (int) (date('Y', $time) - $bday_year - $diff);
+
+ $age = (int) (date('Y', time()) - $bday_year - $diff);
$user_cache[$poster_id]['age'] = (int) ($today['year'] - $bday_year - $diff);
}
}
@@ -1193,7 +1200,7 @@ if (sizeof($attach_list))
}
// Instantiate BBCode if need be
-if ($bbcode_bitfield)
+if ($bbcode_bitfield !== '')
{
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
$bbcode = new bbcode($bbcode_bitfield);
@@ -1233,18 +1240,20 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
// End signature parsing, only if needed
if ($user_cache[$poster_id]['sig'] && empty($user_cache[$poster_id]['sig_parsed']))
{
+ $user_cache[$poster_id]['sig'] = censor_text($user_cache[$poster_id]['sig']);
+
if ($user_cache[$poster_id]['sig_bbcode_bitfield'])
{
$bbcode->bbcode_second_pass($user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], $user_cache[$poster_id]['sig_bbcode_bitfield']);
}
$user_cache[$poster_id]['sig'] = smiley_text($user_cache[$poster_id]['sig']);
- $user_cache[$poster_id]['sig'] = str_replace("\n", '<br />', censor_text($user_cache[$poster_id]['sig']));
+ $user_cache[$poster_id]['sig'] = str_replace("\n", '<br />', $user_cache[$poster_id]['sig']);
$user_cache[$poster_id]['sig_parsed'] = true;
}
// Parse the message and subject
- $message = $row['post_text'];
+ $message = censor_text($row['post_text']);
// Second parse bbcode here
if ($row['bbcode_bitfield'])
@@ -1274,7 +1283,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
// Replace naughty words such as farty pants
$row['post_subject'] = censor_text($row['post_subject']);
- $message = str_replace("\n", '<br />', censor_text($message));
+ $message = str_replace("\n", '<br />', $message);
// Editing information
if (($row['post_edit_count'] && $config['display_last_edited']) || $row['post_edit_reason'])
@@ -1478,6 +1487,9 @@ if (isset($user->data['session_page']) && strpos($user->data['session_page'], '&
if (isset($topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time'] > $topic_tracking_info[$topic_id])
{
markread('topic', $forum_id, $topic_id, $max_post_time);
+
+ // Update forum info
+ update_forum_tracking_info($forum_id, $topic_data['forum_last_post_time'], (isset($topic_data['forum_mark_time'])) ? $topic_data['forum_mark_time'] : false, false);
}
// Change encoding if appropriate