diff --git a/phpBB/adm/admin_forums.php b/phpBB/adm/admin_forums.php
index 12391d3371..5264c22bf5 100644
--- a/phpBB/adm/admin_forums.php
+++ b/phpBB/adm/admin_forums.php
@@ -6,6 +6,7 @@
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
+* @todo add show_active flag (& 16)
*/
/**
@@ -1445,6 +1446,7 @@ function delete_forum_content($forum_id)
REPORTS_TABLE => 're.post_id',
TOPICS_WATCH_TABLE => 'tw.topic_id',
TOPICS_TRACK_TABLE => 'tt.topic_id',
+ TOPICS_POSTED_TABLE => 'tp.topic_id',
POLL_OPTIONS_TABLE => 'po.topic_id',
POLL_VOTES_TABLE => 'pv.post_id'
);
@@ -1515,6 +1517,7 @@ function delete_forum_content($forum_id)
'topic_id' => array(
TOPICS_WATCH_TABLE,
TOPICS_TRACK_TABLE,
+ TOPICS_POSTED_TABLE,
POLL_OPTIONS_TABLE,
POLL_VOTES_TABLE
)
diff --git a/phpBB/cron.php b/phpBB/cron.php
index 9fbbb812e6..6c4fdf6b7a 100644
--- a/phpBB/cron.php
+++ b/phpBB/cron.php
@@ -20,8 +20,12 @@ $cron_type = request_var('cron_type', '');
$use_shutdown_function = (@function_exists('register_shutdown_function')) ? true : false;
-// Run cron-like action
-// Real cron-based layer will be introduced in 3.2
+/**
+* Run cron-like action
+* Real cron-based layer will be introduced in 3.2
+*
+* @todo: check gc-intervals here too (important!)
+*/
switch ($cron_type)
{
case 'queue':
@@ -35,7 +39,7 @@ switch ($cron_type)
{
$queue->process();
}
- break;
+ break;
case 'tidy_cache':
if ($use_shutdown_function)
@@ -46,7 +50,7 @@ switch ($cron_type)
{
$cache->tidy();
}
- break;
+ break;
case 'tidy_database':
include_once($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
@@ -59,17 +63,66 @@ switch ($cron_type)
{
tidy_database();
}
- break;
+ break;
- case 'tidy_login_keys':
+ case 'tidy_sessions':
if ($use_shutdown_function)
{
- register_shutdown_function(array(&$user, 'tidy_login_keys'));
+ register_shutdown_function(array(&$user, 'session_gc'));
}
else
{
- $user->tidy_login_keys();
+ $user->session_gc();
}
+ break;
+
+ case 'prune_forum':
+
+ $forum_id = request_var('f', 0);
+
+ $sql = 'SELECT forum_id, prune_next, enable_prune, prune_days, prune_viewed, forum_flags, prune_freq
+ FROM ' . FORUMS_TABLE . "
+ WHERE forum_id = $forum_id";
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ if (!$row)
+ {
+ break;
+ }
+
+ // Do the forum Prune thang
+ if ($row['prune_next'] < time() && $row['enable_prune'])
+ {
+ include_once($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
+
+ if ($row['prune_days'])
+ {
+ if ($use_shutdown_function)
+ {
+ register_shutdown_function('auto_prune', $row['forum_id'], 'posted', $row['forum_flags'], $row['prune_days'], $row['prune_freq']);
+ }
+ else
+ {
+ auto_prune($row['forum_id'], 'posted', $row['forum_flags'], $row['prune_days'], $row['prune_freq']);
+ }
+ }
+
+ if ($row['prune_viewed'])
+ {
+ if ($use_shutdown_function)
+ {
+ register_shutdown_function('auto_prune', $row['forum_id'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq']);
+ }
+ else
+ {
+ auto_prune($row['forum_id'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq']);
+ }
+ }
+ }
+
+ break;
}
// Output transparent gif
diff --git a/phpBB/includes/acm/acm_main.php b/phpBB/includes/acm/acm_main.php
index bdb8189bd7..27c59ea7c4 100644
--- a/phpBB/includes/acm/acm_main.php
+++ b/phpBB/includes/acm/acm_main.php
@@ -65,7 +65,7 @@ class cache extends acm
*/
function obtain_word_list(&$censors)
{
- global $db, $user;
+ global $config, $user, $db;
if (!$user->optionget('viewcensors') && $config['allow_nocensors'])
{
@@ -101,14 +101,14 @@ class cache extends acm
*/
function obtain_icons(&$icons)
{
- global $db;
-
if ($this->exists('icons'))
{
$icons = $this->get('icons');
}
else
{
+ global $db;
+
// Topic icons
$sql = 'SELECT *
FROM ' . ICONS_TABLE . '
@@ -136,14 +136,14 @@ class cache extends acm
*/
function obtain_ranks(&$ranks)
{
- global $db;
-
if ($this->exists('ranks'))
{
$ranks = $this->get('ranks');
}
else
{
+ global $db;
+
$sql = 'SELECT *
FROM ' . RANKS_TABLE . '
ORDER BY rank_min DESC';
@@ -181,14 +181,14 @@ class cache extends acm
*/
function obtain_attach_extensions(&$extensions, $forum_id = false)
{
- global $db;
-
- if ($this->exists('extensions'))
+ if ($this->exists('_extensions'))
{
- $extensions = $this->get('extensions');
+ $extensions = $this->get('_extensions');
}
else
{
+ global $db;
+
// The rule is to only allow those extensions defined. ;)
$sql = 'SELECT e.extension, g.*
FROM ' . EXTENSIONS_TABLE . ' e, ' . EXTENSION_GROUPS_TABLE . ' g
@@ -220,7 +220,7 @@ class cache extends acm
}
$db->sql_freeresult($result);
- $this->put('extensions', $extensions);
+ $this->put('_extensions', $extensions);
}
if ($forum_id !== false)
@@ -265,14 +265,14 @@ class cache extends acm
*/
function obtain_bots(&$bots)
{
- global $db;
-
if ($this->exists('bots'))
{
$bots = $this->get('bots');
}
else
{
+ global $db;
+
switch (SQL_LAYER)
{
case 'mssql':
diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php
index 2b333c50cb..89c224bafe 100644
--- a/phpBB/includes/constants.php
+++ b/phpBB/includes/constants.php
@@ -169,8 +169,9 @@ define('STYLES_TPLDATA_TABLE', $table_prefix.'styles_template_data');
define('STYLES_CSS_TABLE', $table_prefix.'styles_theme');
define('STYLES_IMAGE_TABLE', $table_prefix.'styles_imageset');
define('TOPICS_TABLE', $table_prefix.'topics');
-define('TOPICS_TRACK_TABLE', $table_prefix.'topics_marking');
+define('TOPICS_POSTED_TABLE', $table_prefix.'topics_posted');
define('TOPICS_WATCH_TABLE', $table_prefix.'topics_watch');
+define('TOPICS_TRACK_TABLE', $table_prefix.'topics_marking');
define('USER_GROUP_TABLE', $table_prefix.'user_group');
define('USERS_TABLE', $table_prefix.'users');
define('USERS_PASSWD_TABLE', $table_prefix.'users_passwd');
diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php
index 7f57f33ff2..dda1094498 100644
--- a/phpBB/includes/db/firebird.php
+++ b/phpBB/includes/db/firebird.php
@@ -160,7 +160,7 @@ class dbal_firebird extends dbal
}
else
{
- return ($this->query_result) ? true : false;
+ return false; //($this->query_result) ? true : false;
}
}
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 4daab71c90..477a7f7ac3 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -473,196 +473,419 @@ function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $mat
}
/**
-* Marks a topic or form as read
+* Marks a topic/forum as read
+* Marks a topic as posted to
*/
-function markread($mode, $forum_id = 0, $topic_id = 0, $marktime = false)
+function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0)
{
- global $config, $db, $user;
-
- if (!$user->data['is_registered'])
+ global $db, $user, $config;
+
+ if ($mode == 'all')
{
- return;
- }
-
- if (!is_array($forum_id))
- {
- $forum_id = array($forum_id);
- }
-
- // Default tracking type
- $type = TRACK_NORMAL;
- $current_time = ($marktime) ? $marktime : time();
- $topic_id = (int) $topic_id;
-
- switch ($mode)
- {
- case 'mark':
- if ($config['load_db_lastread'])
+ if ($forum_id === false || !sizeof($forum_id))
+ {
+ if ($config['load_db_lastread'] && $user->data['is_registered'])
{
- $sql = 'SELECT forum_id
- FROM ' . FORUMS_TRACK_TABLE . '
- WHERE user_id = ' . $user->data['user_id'] . '
- AND forum_id IN (' . implode(', ', array_map('intval', $forum_id)) . ')';
- $result = $db->sql_query($sql);
-
- $sql_update = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $sql_update[] = $row['forum_id'];
- }
- $db->sql_freeresult($result);
-
- if (sizeof($sql_update))
- {
- $sql = 'UPDATE ' . FORUMS_TRACK_TABLE . "
- SET mark_time = $current_time
- WHERE user_id = " . $user->data['user_id'] . '
- AND forum_id IN (' . implode(', ', $sql_update) . ')';
- $db->sql_query($sql);
-
- $sql = 'DELETE FROM ' . TOPICS_TRACK_TABLE . '
- WHERE user_id = ' . $user->data['user_id'] . '
- AND forum_id IN (' . implode(', ', $sql_update) . ')
- AND mark_type = ' . TRACK_NORMAL;
- $db->sql_query($sql);
- }
-
- if ($sql_insert = array_diff($forum_id, $sql_update))
- {
- foreach ($sql_insert as $forum_id)
- {
- $sql = '';
- switch (SQL_LAYER)
- {
- case 'mysql':
- $sql .= (($sql != '') ? ', ' : '') . '(' . $user->data['user_id'] . ", $forum_id, $current_time)";
- $sql = 'VALUES ' . $sql;
- break;
-
- case 'mysql4':
- case 'mysqli':
- case 'mssql':
- case 'mssql_odbc':
- case 'sqlite':
- $sql .= (($sql != '') ? ' UNION ALL ' : '') . ' SELECT ' . $user->data['user_id'] . ", $forum_id, $current_time";
- break;
-
- default:
- $sql = 'INSERT INTO ' . FORUMS_TRACK_TABLE . ' (user_id, forum_id, mark_time)
- VALUES (' . $user->data['user_id'] . ", $forum_id, $current_time)";
- $db->sql_query($sql);
- $sql = '';
- }
-
- if ($sql)
- {
- $sql = 'INSERT INTO ' . FORUMS_TRACK_TABLE . " (user_id, forum_id, mark_time) $sql";
- $db->sql_query($sql);
- }
-
- $sql = 'DELETE FROM ' . TOPICS_TRACK_TABLE . '
- WHERE user_id = ' . $user->data['user_id'] . '
- AND forum_id = ' . $forum_id . '
- AND mark_type = ' . TRACK_NORMAL;
- $db->sql_query($sql);
- }
- }
- unset($sql_update);
- unset($sql_insert);
+ // Mark all forums read (index page)
+ $db->sql_query('DELETE FROM ' . TOPICS_TRACK_TABLE . " WHERE user_id = {$user->data['user_id']}");
+ $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
{
$tracking = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? unserialize(stripslashes($_COOKIE[$config['cookie_name'] . '_track'])) : array();
- foreach ($forum_id as $f_id)
- {
- unset($tracking[$f_id]);
- $tracking[$f_id][0] = base_convert($current_time - $config['board_startdate'], 10, 36);
- }
-
+ unset($tracking['tf']);
+ unset($tracking['t']);
+ unset($tracking['f']);
+ $tracking['l'] = base_convert(time() - $config['board_startdate'], 10, 36);
+
$user->set_cookie('track', serialize($tracking), time() + 31536000);
unset($tracking);
}
- break;
-
- case 'post':
- // Mark a topic as read and mark it as a topic where the user has made a post.
- $type = TRACK_POSTED;
-
- case 'topic':
- if (!isset($type))
- {
- $type = TRACK_NORMAL;
- }
+ }
- $forum_id = (int) $forum_id[0];
+ return;
+ }
+ else if ($mode == 'topics')
+ {
+ // Mark all topics in forums read
+ if (!is_array($forum_id))
+ {
+ $forum_id = array($forum_id);
+ }
- /// Mark a topic as read
- if ($config['load_db_lastread'] || ($config['load_db_track'] && $type == TRACK_POSTED))
+ // Add 0 to forums array to mark global announcements correctly
+ $forum_id[] = 0;
+
+ if ($config['load_db_lastread'] && $user->data['is_registered'])
+ {
+ $db->sql_query('DELETE FROM ' . TOPICS_TRACK_TABLE . "
+ WHERE user_id = {$user->data['user_id']}
+ AND forum_id IN (" . implode(', ', $forum_id) . ")");
+
+ $sql = 'SELECT forum_id
+ FROM ' . FORUMS_TRACK_TABLE . "
+ WHERE user_id = {$user->data['user_id']}
+ AND forum_id IN (" . implode(', ', $forum_id) . ')';
+ $result = $db->sql_query($sql);
+
+ $sql_update = array();
+ while ($row = $db->sql_fetchrow($result))
{
- $track_type = ($type == TRACK_POSTED) ? ', mark_type = ' . $type : '';
- $sql = 'UPDATE ' . TOPICS_TRACK_TABLE . "
- SET forum_id = $forum_id, mark_time = $current_time $track_type
- WHERE topic_id = $topic_id
- AND user_id = {$user->data['user_id']}
- AND mark_time < $current_time";
- if (!$db->sql_query($sql) || !$db->sql_affectedrows())
+ $sql_update[] = $row['forum_id'];
+ }
+ $db->sql_freeresult($result);
+
+ if (sizeof($sql_update))
+ {
+ $sql = 'UPDATE ' . FORUMS_TRACK_TABLE . '
+ SET mark_time = ' . time() . "
+ WHERE user_id = {$user->data['user_id']}
+ AND forum_id IN (" . implode(', ', $sql_update) . ')';
+ $db->sql_query($sql);
+ }
+
+ if ($sql_insert = array_diff($forum_id, $sql_update))
+ {
+ $sql_ary = array();
+ foreach ($sql_insert as $f_id)
{
- $db->sql_return_on_error(true);
-
- $sql_ary = array(
- 'user_id' => $user->data['user_id'],
- 'topic_id' => $topic_id,
- 'forum_id' => $forum_id,
- 'mark_type' => $type,
- 'mark_time' => $current_time
+ $sql_ary[] = array(
+ 'user_id' => $user->data['user_id'],
+ 'forum_id' => $f_id,
+ 'mark_time' => time()
);
-
- $db->sql_query('INSERT INTO ' . TOPICS_TRACK_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
-
- $db->sql_return_on_error(false);
}
+
+ if (sizeof($sql_ary))
+ {
+ $db->sql_query('INSERT INTO ' . FORUMS_TRACK_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_ary));
+ }
+ }
+ }
+ else
+ {
+ $tracking = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? unserialize(stripslashes($_COOKIE[$config['cookie_name'] . '_track'])) : array();
+
+ foreach ($forum_id as $f_id)
+ {
+ $topic_ids36 = (isset($tracking['tf'][$f_id])) ? $tracking['tf'][$f_id] : array();
+
+ unset($tracking['tf'][$f_id]);
+ foreach ($topic_ids36 as $topic_id36)
+ {
+ unset($tracking['t'][$topic_id36]);
+ }
+ unset($tracking['f'][$f_id]);
+ $tracking['f'][$f_id] = base_convert(time() - $config['board_startdate'], 10, 36);
+ }
+
+ $user->set_cookie('track', serialize($tracking), time() + 31536000);
+ unset($tracking);
+ }
+
+ return;
+ }
+ else if ($mode == 'topic')
+ {
+ if ($topic_id === false || $forum_id === false)
+ {
+ return;
+ }
+
+ if ($config['load_db_lastread'] && $user->data['is_registered'])
+ {
+ $sql = 'UPDATE ' . TOPICS_TRACK_TABLE . '
+ SET mark_time = ' . (($post_time) ? $post_time : time()) . "
+ WHERE user_id = {$user->data['user_id']}
+ AND topic_id = $topic_id";
+ $db->sql_query($sql);
+
+ // insert row
+ if (!$db->sql_affectedrows())
+ {
+ $db->sql_return_on_error(true);
+
+ $sql_ary = array(
+ 'user_id' => $user->data['user_id'],
+ 'topic_id' => $topic_id,
+ 'forum_id' => (int) $forum_id,
+ 'mark_time' => ($post_time) ? $post_time : time(),
+ );
+
+ $db->sql_query('INSERT INTO ' . TOPICS_TRACK_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
+
+ $db->sql_return_on_error(false);
+ }
+ }
+ else
+ {
+ $tracking = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? unserialize(stripslashes($_COOKIE[$config['cookie_name'] . '_track'])) : array();
+
+ $topic_id36 = base_convert($topic_id, 10, 36);
+
+ if (!isset($tracking['t'][$topic_id36]))
+ {
+ $tracking['tf'][$forum_id][$topic_id36] = true;
}
- if (!$config['load_db_lastread'])
- {
- $tracking = array();
- if (isset($_COOKIE[$config['cookie_name'] . '_track']))
- {
- $tracking = unserialize(stripslashes($_COOKIE[$config['cookie_name'] . '_track']));
+ $post_time = ($post_time) ? $post_time : time();
+ $tracking['t'][$topic_id36] = base_convert($post_time - $config['board_startdate'], 10, 36);
- // If the cookie grows larger than 2000 characters we will remove
- // the smallest value
- if (strlen($_COOKIE[$config['cookie_name'] . '_track']) > 2000)
+ // If the cookie grows larger than 5000 characters we will remove the smallest value
+ if (isset($_COOKIE[$config['cookie_name'] . '_track']) && strlen($_COOKIE[$config['cookie_name'] . '_track']) > 5000)
+ {
+// echo 'Cookie grown too large' . print_r($tracking, true);
+
+ $min_value = min($tracking['t']);
+ $m_tkey = array_search($min_value, $t_ary);
+ unset($tracking['t'][$m_tkey]);
+
+ foreach ($tracking['tf'] as $f_id => $topic_id_ary)
+ {
+ if (in_array($m_tkey, array_keys($topic_id_ary)))
{
- foreach ($tracking as $f => $t_ary)
- {
- if (!isset($m_value) || min($t_ary) < $m_value)
- {
- $m_value = min($t_ary);
- $m_tkey = array_search($m_value, $t_ary);
- $m_fkey = $f;
- }
- }
- unset($tracking[$m_fkey][$m_tkey]);
+ unset($tracking['tf'][$f_id][$m_tkey]);
+ break;
}
}
-
- if (isset($tracking[$forum_id]) && base_convert($tracking[$forum_id][0], 36, 10) < $current_time)
- {
- $tracking[$forum_id][base_convert($topic_id, 10, 36)] = base_convert($current_time - $config['board_startdate'], 10, 36);
-
- $user->set_cookie('track', serialize($tracking), time() + 31536000);
- }
- else if (!isset($tracking[$forum_id]))
- {
- $tracking[$forum_id][0] = base_convert($current_time - $config['board_startdate'], 10, 36);
- $user->set_cookie('track', serialize($tracking), time() + 31536000);
- }
- unset($tracking);
}
- break;
+
+ $user->set_cookie('track', serialize($tracking), time() + 31536000);
+ }
+
+ return;
}
+ else if ($mode == 'post')
+ {
+ if ($topic_id === false)
+ {
+ return;
+ }
+
+ $db->sql_return_on_error(true);
+
+ $sql_ary = array(
+ 'user_id' => $user->data['user_id'],
+ 'topic_id' => $topic_id,
+ 'topic_posted' => 1
+ );
+
+ $db->sql_query('INSERT INTO ' . TOPICS_POSTED_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
+
+ $db->sql_return_on_error(false);
+
+ return;
+ }
+}
+
+/**
+* Get topic tracking info by using already fetched info
+*/
+function get_topic_tracking($forum_id, $topic_ids, &$rowset, $forum_mark_time, $global_announce_list = false)
+{
+ global $config, $user;
+
+ $last_read = array();
+
+ if (!is_array($topic_ids))
+ {
+ $topic_ids = array($topic_ids);
+ }
+
+ foreach ($topic_ids as $topic_id)
+ {
+ if (!empty($rowset[$topic_id]['mark_time']))
+ {
+ $last_read[$topic_id] = $rowset[$topic_id]['mark_time'];
+ }
+ }
+
+ $topic_ids = array_diff($topic_ids, array_keys($last_read));
+
+ if (sizeof($topic_ids))
+ {
+ $mark_time = array();
+
+ // Get global announcement info
+ if ($global_announce_list && sizeof($global_announce_list))
+ {
+ if (!isset($forum_mark_time[0]))
+ {
+ global $db;
+
+ $sql = 'SELECT mark_time
+ FROM ' . FORUMS_TRACK_TABLE . "
+ WHERE user_id = {$user->data['user_id']}
+ AND forum_id = 0";
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ if ($row)
+ {
+ $mark_time[0] = $row['mark_time'];
+ }
+ }
+ else
+ {
+ if ($forum_mark_time[0] !== false)
+ {
+ $mark_time[0] = $forum_mark_time[0];
+ }
+ }
+ }
+
+ if (!empty($forum_mark_time[$forum_id]) && $forum_mark_time[$forum_id] !== false)
+ {
+ $mark_time[$forum_id] = $forum_mark_time[$forum_id];
+ }
+
+ $user_lastmark = (isset($mark_time[$forum_id])) ? $mark_time[$forum_id] : $user->data['user_lastmark'];
+
+ foreach ($topic_ids as $topic_id)
+ {
+ if ($global_announce_list && isset($global_announce_list[$topic_id]))
+ {
+ $last_read[$topic_id] = (isset($mark_time[0])) ? $mark_time[0] : $user_lastmark;
+ }
+ else
+ {
+ $last_read[$topic_id] = $user_lastmark;
+ }
+ }
+ }
+
+ return $last_read;
+}
+
+/**
+* Get topic tracking info from db (for cookie based tracking only this function is used)
+*/
+function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_list = false)
+{
+ global $config, $user;
+
+ $last_read = array();
+
+ if (!is_array($topic_ids))
+ {
+ $topic_ids = array($topic_ids);
+ }
+
+ if ($config['load_db_lastread'] && $user->data['is_registered'])
+ {
+ global $db;
+
+ $sql = 'SELECT topic_id, mark_time
+ FROM ' . TOPICS_TRACK_TABLE . "
+ WHERE user_id = {$user->data['user_id']}
+ AND topic_id IN (" . implode(', ', $topic_ids) . ")";
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $last_read[$row['topic_id']] = $row['mark_time'];
+ }
+ $db->sql_freeresult($result);
+
+ $topic_ids = array_diff($topic_ids, array_keys($last_read));
+
+ if (sizeof($topic_ids))
+ {
+ $sql = 'SELECT forum_id, mark_time
+ FROM ' . FORUMS_TRACK_TABLE . "
+ WHERE user_id = {$user->data['user_id']}
+ AND forum_id " .
+ (($global_announce_list && sizeof($global_announce_list)) ? "IN (0, $forum_id)" : "= $forum_id");
+ $result = $db->sql_query($sql);
+
+ $mark_time = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $mark_time[$row['forum_id']] = $row['mark_time'];
+ }
+ $db->sql_freeresult($result);
+
+ $user_lastmark = (isset($mark_time[$forum_id])) ? $mark_time[$forum_id] : $user->data['user_lastmark'];
+
+ foreach ($topic_ids as $topic_id)
+ {
+ if ($global_announce_list && isset($global_announce_list[$topic_id]))
+ {
+ $last_read[$topic_id] = (isset($mark_time[0])) ? $mark_time[0] : $user_lastmark;
+ }
+ else
+ {
+ $last_read[$topic_id] = $user_lastmark;
+ }
+ }
+ }
+ }
+ else
+ {
+ global $tracking_topics;
+
+ if (!isset($tracking_topics) || !sizeof($tracking_topics))
+ {
+ $tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? unserialize(stripslashes($_COOKIE[$config['cookie_name'] . '_track'])) : array();
+ }
+
+ if (!$user->data['is_registered'])
+ {
+ $user_lastmark = (isset($tracking_topics['l'])) ? base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate'] : 0;
+ }
+ else
+ {
+ $user_lastmark = $user->data['user_lastmark'];
+ }
+
+ foreach ($topic_ids as $topic_id)
+ {
+ $topic_id36 = base_convert($topic_id, 10, 36);
+
+ if (isset($tracking_topics['t'][$topic_id36]))
+ {
+ $last_read[$topic_id] = base_convert($tracking_topics['t'][$topic_id36], 36, 10) + $config['board_startdate'];
+ }
+ }
+
+ $topic_ids = array_diff($topic_ids, array_keys($last_read));
+
+ if (sizeof($topic_ids))
+ {
+ $mark_time = array();
+ if ($global_announce_list && sizeof($global_announce_list))
+ {
+ if (isset($tracking_topics['f'][0]))
+ {
+ $mark_time[0] = base_convert($tracking_topics['f'][0], 36, 10) + $config['board_startdate'];
+ }
+ }
+
+ if (isset($tracking_topics['f'][$forum_id]))
+ {
+ $mark_time[$forum_id] = base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate'];
+ }
+
+ $user_lastmark = (isset($mark_time[$forum_id])) ? $mark_time[$forum_id] : $user_lastmark;
+
+ foreach ($topic_ids as $topic_id)
+ {
+ if ($global_announce_list && isset($global_announce_list[$topic_id]))
+ {
+ $last_read[$topic_id] = (isset($mark_time[0])) ? $mark_time[0] : $user_lastmark;
+ }
+ else
+ {
+ $last_read[$topic_id] = $user_lastmark;
+ }
+ }
+ }
+ }
+
+ return $last_read;
}
/**
@@ -877,7 +1100,14 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
// generate activation key
$confirm_key = gen_rand_string(10);
- page_header((!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title]);
+ if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin'])
+ {
+ adm_page_header((!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title]);
+ }
+ else
+ {
+ page_header((!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title]);
+ }
$template->set_filenames(array(
'body' => $html_body)
@@ -908,7 +1138,14 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
WHERE user_id = " . $user->data['user_id'];
$db->sql_query($sql);
- page_footer();
+ if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin'])
+ {
+ adm_page_footer();
+ }
+ else
+ {
+ page_footer();
+ }
}
/**
@@ -1292,11 +1529,12 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
{
if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin'])
{
- adm_page_header('', '', false);
+ // adm_page_header('', '', false);
+ adm_page_header('');
}
else
{
- page_header();
+ page_header('');
}
}
@@ -1304,26 +1542,19 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
$msg_title = (!isset($msg_title)) ? $user->lang['INFORMATION'] : ((!empty($user->lang[$msg_title])) ? $user->lang[$msg_title] : $msg_title);
$display_header = (!isset($display_header)) ? false : (bool) $display_header;
- if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin'])
- {
- adm_page_message($msg_title, $msg_text, $display_header);
- adm_page_footer();
- }
- else
- {
- $template->set_filenames(array(
- 'body' => 'message_body.html')
- );
+ $template->set_filenames(array(
+ 'body' => 'message_body.html')
+ );
- $template->assign_vars(array(
- 'MESSAGE_TITLE' => $msg_title,
- 'MESSAGE_TEXT' => $msg_text)
- );
+ $template->assign_vars(array(
+ 'MESSAGE_TITLE' => $msg_title,
+ 'MESSAGE_TEXT' => $msg_text)
+ );
+
+ // We do not want the cron script to be called on error messages
+ define('IN_CRON', true);
+ page_footer();
- // We do not want the cron script to be called on error messages
- define('IN_CRON', true);
- page_footer();
- }
exit;
break;
}
@@ -1700,6 +1931,14 @@ function page_footer()
// Tidy some table rows every week
$cron_type = 'tidy_database';
}
+/**
+* @todo add session garbage collection
+
+ else if (time() - $config['session_gc'] > $config['session_last_gc'])
+ {
+ $cron_type = 'tidy_sessions';
+ }
+*/
if ($cron_type)
{
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 7fb8148726..6b2f9bb83e 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -11,7 +11,7 @@
/**
* Recalculate Binary Tree
*/
-function recalc_btree($sql_id, $sql_table)
+function recalc_btree($sql_id, $sql_table, $module_class = '')
{
global $db;
@@ -25,8 +25,29 @@ function recalc_btree($sql_id, $sql_table)
return;
}
+ $sql_where = ($module_class) ? " WHERE module_class = '" . $db->sql_escape($module_class) . "'" : ' WHERE 1 ';
+
+ // Reset to minimum possible left and right id
+ $sql = "SELECT MIN(left_id) as min_left_id, MIN(right_id) as min_right_id
+ FROM $sql_table
+ $sql_where";
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ $substract = (int) (min($row['min_left_id'], $row['min_right_id']) - 1);
+
+ if ($substract > 0)
+ {
+ $sql = "UPDATE $sql_table
+ SET left_id = left_id - $substract, right_id = right_id - $substract
+ $sql_where";
+ $db->sql_query($sql);
+ }
+
$sql = "SELECT $sql_id, parent_id, left_id, right_id
FROM $sql_table
+ $sql_where
ORDER BY left_id ASC, parent_id ASC, $sql_id ASC";
$f_result = $db->sql_query($sql);
@@ -36,7 +57,8 @@ function recalc_btree($sql_id, $sql_table)
{
$sql = "SELECT left_id, right_id
FROM $sql_table
- WHERE $sql_id = {$item_data['parent_id']}";
+ $sql_where
+ AND $sql_id = {$item_data['parent_id']}";
$result = $db->sql_query($sql);
if (!$row = $db->sql_fetchrow($result))
@@ -48,12 +70,14 @@ function recalc_btree($sql_id, $sql_table)
$sql = "UPDATE $sql_table
SET left_id = left_id + 2, right_id = right_id + 2
- WHERE left_id > {$row['right_id']}";
+ $sql_where
+ AND left_id > {$row['right_id']}";
$db->sql_query($sql);
$sql = "UPDATE $sql_table
SET right_id = right_id + 2
- WHERE {$row['left_id']} BETWEEN left_id AND right_id";
+ $sql_where
+ AND {$row['left_id']} BETWEEN left_id AND right_id";
$db->sql_query($sql);
$item_data['left_id'] = $row['right_id'];
@@ -62,7 +86,8 @@ function recalc_btree($sql_id, $sql_table)
else
{
$sql = "SELECT MAX(right_id) AS right_id
- FROM $sql_table";
+ FROM $sql_table
+ $sql_where";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
@@ -450,7 +475,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = TRUE)
$db->sql_transaction('begin');
- $table_ary = array(TOPICS_TRACK_TABLE, POLL_VOTES_TABLE, POLL_OPTIONS_TABLE, TOPICS_WATCH_TABLE, TOPICS_TABLE);
+ $table_ary = array(TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, POLL_VOTES_TABLE, POLL_OPTIONS_TABLE, TOPICS_WATCH_TABLE, TOPICS_TABLE);
foreach ($table_ary as $table)
{
$sql = "DELETE FROM $table
@@ -2335,13 +2360,13 @@ function update_post_information($type, $ids)
}
/**
-* Tidy topic tracking tables
+* Tidy database
* Removes all tracking rows older than 6 months, including mark_posted informations
*/
function tidy_database()
{
global $db;
-
+/*
$remove_date = time() - (3 * 62 * 24 * 3600);
$sql = 'DELETE FROM ' . FORUMS_TRACK_TABLE . '
@@ -2351,7 +2376,7 @@ function tidy_database()
$sql = 'DELETE FROM ' . TOPICS_TRACK_TABLE . '
WHERE mark_time < ' . $remove_date;
$db->sql_query($sql);
-
+*/
set_config('database_last_gc', time(), true);
}
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 9622af8b26..c887c28aef 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -11,18 +11,30 @@
/**
* Display Forums
*/
-function display_forums($root_data = '', $display_moderators = TRUE)
+function display_forums($root_data = '', $display_moderators = true, $return_moderators = false)
{
- global $config, $db, $template, $auth, $user, $phpEx, $SID, $forum_moderators, $phpbb_root_path;
+ global $db, $auth, $user, $template;
+ global $phpbb_root_path, $phpEx, $SID, $config;
- // Get posted/get info
+ $forum_rows = $subforums = $forum_ids = $forum_ids_moderator = $forum_moderators = $active_forum_ary = array();
+ $parent_id = $visible_forums = 0;
+ $sql_from = $lastread_select = '';
+
+ // Mark forums read?
$mark_read = request_var('mark', '');
- $forum_id_ary = $active_forum_ary = $forum_rows = $subforums = $forum_moderators = $mark_forums = array();
- $visible_forums = 0;
+ if ($mark_read == 'all')
+ {
+ $mark_read = '';
+ }
if (!$root_data)
{
+ if ($mark_read == 'forums')
+ {
+ $mark_read = 'all';
+ }
+
$root_data = array('forum_id' => 0);
$sql_where = '';
}
@@ -34,17 +46,9 @@ function display_forums($root_data = '', $display_moderators = TRUE)
// Display list of active topics for this category?
$show_active = (isset($root_data['forum_flags']) && $root_data['forum_flags'] & 16) ? true : false;
- if ($config['load_db_lastread'] && $user->data['is_registered'])
+ if ($config['load_db_track'] && $user->data['is_registered'])
{
- switch (SQL_LAYER)
- {
- case 'oracle':
- break;
-
- default:
- $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))';
- break;
- }
+ $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
@@ -53,6 +57,11 @@ function display_forums($root_data = '', $display_moderators = TRUE)
$lastread_select = $sql_lastread = '';
$tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? unserialize(stripslashes($_COOKIE[$config['cookie_name'] . '_track'])) : array();
+
+ if (!$user->data['is_registered'])
+ {
+ $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate'] : 0;
+ }
}
$sql = "SELECT f.* $lastread_select
@@ -61,20 +70,29 @@ function display_forums($root_data = '', $display_moderators = TRUE)
ORDER BY f.left_id";
$result = $db->sql_query($sql);
+ $forum_tracking_info = array();
$branch_root_id = $root_data['forum_id'];
- $forum_ids = array($root_data['forum_id']);
while ($row = $db->sql_fetchrow($result))
{
- if ($mark_read == 'forums' && $user->data['is_registered'])
- {
- if ($auth->acl_get('f_list', $row['forum_id']))
- {
- $forum_id_ary[] = $row['forum_id'];
- }
+ $forum_id = $row['forum_id'];
+ // Mark forums read?
+ if ($mark_read == 'forums' || $mark_read == 'all')
+ {
+ if ($auth->acl_get('f_list', $forum_id))
+ {
+ $forum_ids[] = $forum_id;
+ continue;
+ }
+ }
+
+ // Category with no members
+ if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id']))
+ {
continue;
}
+ // Skip branch
if (isset($right_id))
{
if ($row['left_id'] < $right_id)
@@ -84,14 +102,6 @@ function display_forums($root_data = '', $display_moderators = TRUE)
unset($right_id);
}
- if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id']))
- {
- // Non-postable forum with no subforums: don't display
- continue;
- }
-
- $forum_id = $row['forum_id'];
-
if (!$auth->acl_get('f_list', $forum_id))
{
// if the user does not have permissions to list this forum, skip everything until next branch
@@ -99,8 +109,17 @@ function display_forums($root_data = '', $display_moderators = TRUE)
continue;
}
-
-
+ $forum_ids[] = $forum_id;
+
+ if ($config['load_db_lastread'] && $user->data['is_registered'])
+ {
+ $forum_tracking_info[$forum_id] = (!empty($row['mark_time'])) ? $row['mark_time'] : $user->data['user_lastmark'];
+ }
+ else
+ {
+ $forum_tracking_info[$forum_id] = (isset($tracking_topics['f'][$forum_id])) ? base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate'] : $user->data['user_lastmark'];
+ }
+
// Display active topics from this forum?
if ($show_active && $row['forum_type'] == FORUM_POST && $auth->acl_get('f_read', $forum_id) && ($row['forum_flags'] & 16))
{
@@ -110,24 +129,26 @@ function display_forums($root_data = '', $display_moderators = TRUE)
$active_forum_ary['forum_posts'] += $row['forum_posts'];
}
+ //
if ($row['parent_id'] == $root_data['forum_id'] || $row['parent_id'] == $branch_root_id)
{
- // Direct child
+ // Direct child of current branch
$parent_id = $forum_id;
$forum_rows[$forum_id] = $row;
- $forum_ids[] = $forum_id;
if (!$row['parent_id'] && $row['forum_type'] == FORUM_CAT && $row['parent_id'] == $root_data['forum_id'])
{
$branch_root_id = $forum_id;
}
$forum_rows[$parent_id]['forum_id_last_post'] = $row['forum_id'];
+ $forum_rows[$parent_id]['orig_forum_last_post_time'] = $row['forum_last_post_time'];
}
- elseif ($row['forum_type'] != FORUM_CAT)
+ else if ($row['forum_type'] != FORUM_CAT)
{
- $subforums[$parent_id]['display'] = ($row['display_on_index']) ? true : false;;
- $subforums[$parent_id]['name'][$forum_id] = $row['forum_name'];
-
+ $subforums[$parent_id][$forum_id]['display'] = ($row['display_on_index']) ? true : false;
+ $subforums[$parent_id][$forum_id]['name'] = $row['forum_name'];
+ $subforums[$parent_id][$forum_id]['orig_forum_last_post_time'] = $row['forum_last_post_time'];
+
$forum_rows[$parent_id]['forum_topics'] += ($auth->acl_get('m_approve', $forum_id)) ? $row['forum_topics_real'] : $row['forum_topics'];
// Do not list redirects in LINK Forums as Posts.
@@ -136,7 +157,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
$forum_rows[$parent_id]['forum_posts'] += $row['forum_posts'];
}
- if (isset($forum_rows[$parent_id]) && $row['forum_last_post_time'] > $forum_rows[$parent_id]['forum_last_post_time'])
+ if ($row['forum_last_post_time'] > $forum_rows[$parent_id]['forum_last_post_time'])
{
$forum_rows[$parent_id]['forum_last_post_id'] = $row['forum_last_post_id'];
$forum_rows[$parent_id]['forum_last_post_time'] = $row['forum_last_post_time'];
@@ -150,113 +171,104 @@ function display_forums($root_data = '', $display_moderators = TRUE)
}
}
- if (!isset($row['mark_time']))
- {
- $row['mark_time'] = 0;
- }
+ $forum_ids_moderator[$parent_id] = $forum_rows[$parent_id]['forum_id_last_post'];
- $mark_time_forum = ($config['load_db_lastread']) ? $row['mark_time'] : ((isset($tracking_topics[$forum_id][0])) ? base_convert($tracking_topics[$forum_id][0], 36, 10) + $config['board_startdate'] : 0);
-
- if ($mark_time_forum < $row['forum_last_post_time'] && $user->data['is_registered'])
- {
- $forum_unread[$parent_id] = true;
- }
}
$db->sql_freeresult($result);
// Handle marking posts
- if ($mark_read == 'forums')
+ if ($mark_read == 'forums' || $mark_read == 'all')
{
- markread('mark', $forum_id_ary);
-
$redirect = (!empty($_SERVER['REQUEST_URI'])) ? preg_replace('#^(.*?)&(amp;)?mark=.*$#', '\1', htmlspecialchars($_SERVER['REQUEST_URI'])) : "index.$phpEx$SID";
- meta_refresh(3, $redirect);
- $message = (strpos($redirect, 'viewforum') !== false) ? 'RETURN_FORUM' : 'RETURN_INDEX';
- $message = $user->lang['FORUMS_MARKED'] . '
' . sprintf($user->lang[$message], '', ' ');
+ if ($mark_read == 'all')
+ {
+ markread('all');
+
+ $message = sprintf($user->lang['RETURN_INDEX'], '', '');
+ }
+ else
+ {
+ markread('topics', $forum_ids);
+
+ $message = sprintf($user->lang['RETURN_FORUM'], '', '');
+ }
+
+ meta_refresh(3, $redirect);
+
+ $message = $user->lang['FORUMS_MARKED'] . '
' . $message;
trigger_error($message);
}
// Grab moderators ... if necessary
if ($display_moderators)
{
- get_moderators($forum_moderators, $forum_ids);
+ if ($return_moderators)
+ {
+ $forum_ids_moderator[] = $root_data['forum_id'];
+ }
+ get_moderators($forum_moderators, $forum_ids_moderator);
}
- // Loop through the forums
- $root_id = $root_data['forum_id'];
-
foreach ($forum_rows as $row)
{
- if ($row['parent_id'] == $root_id && !$row['parent_id'])
- {
- if ($row['forum_type'] == FORUM_CAT)
- {
- $hold = $row;
- continue;
- }
- else
- {
- unset($hold);
- }
- }
- else if (!empty($hold))
+ // Empty category
+ if (!$row['parent_id'] && $row['forum_type'] == FORUM_CAT)
{
$template->assign_block_vars('forumrow', array(
- 'S_IS_CAT' => TRUE,
- 'FORUM_ID' => $hold['forum_id'],
- 'FORUM_NAME' => $hold['forum_name'],
- 'FORUM_DESC' => $hold['forum_desc'],
- 'U_VIEWFORUM' => "viewforum.$phpEx$SID&f=" . $hold['forum_id'])
+ 'S_IS_CAT' => true,
+ 'FORUM_ID' => $row['forum_id'],
+ 'FORUM_NAME' => $row['forum_name'],
+ 'FORUM_DESC' => $row['forum_desc'],
+ 'U_VIEWFORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&f=" . $row['forum_id'])
);
- unset($hold);
+
+ continue;
}
$visible_forums++;
$forum_id = $row['forum_id'];
- $subforums_list = $l_subforums = '';
+ $forum_unread = (isset($forum_tracking_info[$forum_id]) && $row['orig_forum_last_post_time'] > $forum_tracking_info[$forum_id]) ? true : false;
+
+ $folder_image = $folder_alt = $subforums_list = $l_subforums = '';
// Generate list of subforums if we need to
if (isset($subforums[$forum_id]))
{
- if ($subforums[$forum_id]['display'])
+ foreach ($subforums[$forum_id] as $subforum_id => $subforum_row)
{
- $alist = array();
- foreach ($subforums[$forum_id]['name'] as $sub_forum_id => $subforum_name)
+ // Update unread information if needed
+ if (!$forum_unread)
{
- if (!empty($subforum_name))
- {
- $alist[$sub_forum_id] = $subforum_name;
- }
+ $forum_unread = (isset($forum_tracking_info[$subforum_id]) && $subforum_row['orig_forum_last_post_time'] > $forum_tracking_info[$subforum_id]) ? true : false;
}
- if (sizeof($alist))
+ if ($subforum_row['display'] && $subforum_row['name'])
{
- $links = array();
- foreach ($alist as $subforum_id => $subforum_name)
- {
- $links[] = '' . $subforum_name . '';
- }
- $subforums_list = implode(', ', $links);
-
- $l_subforums = (sizeof($subforums[$forum_id]) == 1) ? $user->lang['SUBFORUM'] . ': ' : $user->lang['SUBFORUMS'] . ': ';
+ $subforums_list .= ($subforums_list == '') ? '' : ', ';
+ $subforums_list .= '{$subforum_row['name']}";
+ }
+ else
+ {
+ unset($subforums[$forum_id][$subforum_id]);
}
}
-
- $folder_image = (!empty($forum_unread[$forum_id])) ? 'sub_forum_new' : 'sub_forum';
+
+ $l_subforums = (sizeof($subforums[$forum_id]) == 1) ? $user->lang['SUBFORUM'] . ': ' : $user->lang['SUBFORUMS'] . ': ';
+ $folder_image = ($forum_unread) ? 'sub_forum_new' : 'sub_forum';
}
else
{
switch ($row['forum_type'])
{
case FORUM_POST:
- $folder_image = (!empty($forum_unread[$forum_id])) ? 'forum_new' : 'forum';
- break;
+ $folder_image = ($forum_unread) ? 'forum_new' : 'forum';
+ break;
case FORUM_LINK:
$folder_image = 'forum_link';
- break;
+ break;
}
}
@@ -268,7 +280,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
}
else
{
- $folder_alt = (!empty($forum_unread[$forum_id])) ? 'NEW_POSTS' : 'NO_NEW_POSTS';
+ $folder_alt = ($forum_unread) ? 'NEW_POSTS' : 'NO_NEW_POSTS';
}
// Create last post link information, if appropriate
@@ -277,9 +289,9 @@ function display_forums($root_data = '', $display_moderators = TRUE)
$last_post_time = $user->format_date($row['forum_last_post_time']);
$last_poster = ($row['forum_last_poster_name'] != '') ? $row['forum_last_poster_name'] : $user->lang['GUEST'];
- $last_poster_url = ($row['forum_last_poster_id'] == ANONYMOUS) ? '' : "memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['forum_last_poster_id'];
+ $last_poster_url = ($row['forum_last_poster_id'] == ANONYMOUS) ? '' : "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u={$row['forum_last_poster_id']}";
- $last_post_url = "viewtopic.$phpEx$SID&f=" . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id'] . '#' . $row['forum_last_post_id'];
+ $last_post_url = "{$phpbb_root_path}viewtopic.$phpEx$SID&f=" . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id'] . '#' . $row['forum_last_post_id'];
}
else
{
@@ -299,40 +311,44 @@ function display_forums($root_data = '', $display_moderators = TRUE)
$template->assign_block_vars('forumrow', array(
'S_IS_CAT' => false,
- 'S_IS_LINK' => ($row['forum_type'] != FORUM_LINK) ? false : true,
+ 'S_IS_LINK' => ($row['forum_type'] == FORUM_LINK) ? true : false,
- 'LAST_POST_IMG' => $user->img('icon_post_latest', 'VIEW_LATEST_POST'),
-
- 'FORUM_ID' => $row['forum_id'],
- 'FORUM_FOLDER_IMG' => ($row['forum_image']) ? '' : $user->img($folder_image, $folder_alt),
+ 'FORUM_ID' => $row['forum_id'],
+ 'FORUM_NAME' => $row['forum_name'],
+ 'FORUM_DESC' => $row['forum_desc'],
+ 'TOPICS' => $row['forum_topics'],
+ $l_post_click_count => $post_click_count,
+ 'FORUM_FOLDER_IMG' => ($row['forum_image']) ? '
' : $user->img($folder_image, $folder_alt),
'FORUM_FOLDER_IMG_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : $user->img($folder_image, $folder_alt, false, '', 'src'),
- 'FORUM_NAME' => $row['forum_name'],
- 'FORUM_DESC' => $row['forum_desc'],
- $l_post_click_count => $post_click_count,
- 'TOPICS' => $row['forum_topics'],
- 'LAST_POST_TIME' => $last_post_time,
- 'LAST_POSTER' => $last_poster,
- 'MODERATORS' => $moderators_list,
- 'SUBFORUMS' => $subforums_list,
+ 'SUBFORUMS' => $subforums_list,
+ 'LAST_POST_TIME' => $last_post_time,
+ 'LAST_POSTER' => $last_poster,
+ 'MODERATORS' => $moderators_list,
'L_SUBFORUM_STR' => $l_subforums,
- 'L_MODERATOR_STR' => $l_moderator,
'L_FORUM_FOLDER_ALT'=> $folder_alt,
+ 'L_MODERATOR_STR' => $l_moderator,
+ 'U_VIEWFORUM' => ($row['forum_type'] != FORUM_LINK || $row['forum_flags'] & 1) ? "{$phpbb_root_path}viewforum.$phpEx$SID&f={$row['forum_id']}" : $row['forum_link'],
'U_LAST_POSTER' => $last_poster_url,
'U_LAST_POST' => $last_post_url,
- 'U_VIEWFORUM' => ($row['forum_type'] != FORUM_LINK || $row['forum_flags'] & 1) ? "viewforum.$phpEx$SID&f=" . $row['forum_id'] : $row['forum_link'])
+ )
);
}
$template->assign_vars(array(
- 'U_MARK_FORUMS' => "viewforum.$phpEx$SID&f=" . $root_data['forum_id'] . '&mark=forums',
-
- 'S_HAS_SUBFORUM' => ($visible_forums) ? true : false,
-
- 'L_SUBFORUM' => ($visible_forums == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS'])
+ 'U_MARK_FORUMS' => "{$phpbb_root_path}viewforum.$phpEx$SID&f=" . $root_data['forum_id'] . '&mark=forums',
+ 'S_HAS_SUBFORUM' => ($visible_forums) ? true : false,
+ 'L_SUBFORUM' => ($visible_forums == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS'],
+ 'LAST_POST_IMG' => $user->img('icon_post_latest', 'VIEW_LATEST_POST'),
+ )
);
+ if ($return_moderators)
+ {
+ return array($active_forum_ary, $forum_moderators);
+ }
+
return $active_forum_ary;
}
@@ -509,33 +525,33 @@ function topic_generate_pagination($replies, $url)
*/
function get_moderators(&$forum_moderators, $forum_id = false)
{
- global $config, $template, $db, $phpEx, $SID;
+ global $config, $template, $db, $phpbb_root_path, $phpEx, $SID;
// Have we disabled the display of moderators? If so, then return
// from whence we came ...
- if (empty($config['load_moderators']))
+ if (!$config['load_moderators'])
{
return;
}
- if (!empty($forum_id) && is_array($forum_id))
+ if ($forum_id !== false && is_array($forum_id))
{
$forum_sql = 'AND forum_id IN (' . implode(', ', $forum_id) . ')';
}
else
{
- $forum_sql = ($forum_id) ? 'AND forum_id = ' . $forum_id : '';
+ $forum_sql = ($forum_id !== false) ? 'AND forum_id = ' . $forum_id : '';
}
$sql = 'SELECT *
FROM ' . MODERATOR_TABLE . "
WHERE display_on_index = 1
$forum_sql";
- $result = $db->sql_query($sql);
+ $result = $db->sql_query($sql, 3600);
while ($row = $db->sql_fetchrow($result))
{
- $forum_moderators[$row['forum_id']][] = (!empty($row['user_id'])) ? '' . $row['username'] . '' : '' . $row['groupname'] . '';
+ $forum_moderators[$row['forum_id']][] = (!empty($row['user_id'])) ? '' . $row['username'] . '' : '' . $row['groupname'] . '';
}
$db->sql_freeresult($result);
@@ -568,12 +584,11 @@ function gen_forum_auth_level($mode, $forum_id)
/**
* Generate topic status
*/
-function topic_status(&$topic_row, $replies, $mark_time_topic, $mark_time_forum, &$folder_img, &$folder_alt, &$topic_type)
+function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$folder_alt, &$topic_type)
{
global $user, $config;
$folder = $folder_new = '';
- $unread_topic = false;
if ($topic_row['topic_status'] == ITEM_MOVED)
{
@@ -619,34 +634,11 @@ function topic_status(&$topic_row, $replies, $mark_time_topic, $mark_time_forum,
$folder_new = 'folder_locked_new';
}
- if ($user->data['is_registered'])
- {
- $unread_topic = $new_votes = true;
-
- if ($mark_time_topic >= $topic_row['topic_last_post_time'] || $mark_time_forum >= $topic_row['topic_last_post_time']) //|| ($topic_row['topic_last_post_time'] == $topic_row['poll_last_vote'] && $replies))
- {
- $unread_topic = false;
- }
-/*
- if ($topic_row['poll_start'] && ($mark_time_topic >= $topic_row['poll_last_vote'] || $mark_time_forum >= $topic_row['poll_last_vote']))
- {
- $new_votes = false;
- }
-*/
- }
- else
- {
- $unread_topic = false;
- //$unread_topic = $new_votes = false;
- }
-
-// $folder_new .= ($new_votes) ? '_vote' : '';
-
$folder_img = ($unread_topic) ? $folder_new : $folder;
$folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($topic_row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
// Posted image?
- if (!empty($topic_row['mark_type']))
+ if (!empty($topic_row['topic_posted']) && $topic_row['topic_posted'])
{
$folder_img .= '_posted';
}
@@ -656,8 +648,6 @@ function topic_status(&$topic_row, $replies, $mark_time_topic, $mark_time_forum,
{
$topic_type .= $user->lang['VIEW_TOPIC_POLL'];
}
-
- return $unread_topic;
}
/**
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index f40feb9415..e88a506121 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -105,7 +105,11 @@ class p_master
foreach ($this->module_cache['modules'] as $row)
{
- // Authorisation is required ... not authed, skip
+ /**
+ * Authorisation is required ... not authed, skip
+ * @todo implement $this->is_module_id
+ * @todo put in seperate method for authentication
+ */
if ($row['module_auth'])
{
$is_auth = false;
@@ -141,7 +145,7 @@ class p_master
$right = $row['right_id'];
- $module_data = array(
+ $this->module_ary[$i] = array(
'depth' => $depth,
'id' => (int) $row['module_id'],
@@ -151,15 +155,13 @@ class p_master
'name' => (string) $row['module_name'],
'mode' => (string) $row['module_mode'],
- 'lang' => (function_exists($row['module_name'])) ? $row['module_name']($row['module_mode'], $row['module_langname']) : ((!empty($user->lang[$row['module_langname']])) ? $user->lang[$row['module_langname']] : ucfirst(str_replace('_', ' ', strtolower($row['module_langname'])))),
+ 'lang' => (function_exists($row['module_name'])) ? $row['module_name']($row['module_mode'], $row['module_langname']) : ((!empty($user->lang[$row['module_langname']])) ? $user->lang[$row['module_langname']] : $row['module_langname']),
'langname' => $row['module_langname'],
'left' => $row['left_id'],
'right' => $row['right_id'],
);
- $this->module_ary[$i] = $module_data;
-
$i++;
}
@@ -274,9 +276,7 @@ class p_master
function assign_tpl_vars($module_url)
{
- global $template, $db;
-
- $parents = $this->module_cache['parents'];
+ global $template;
$current_padding = $current_depth = 0;
$linear_offset = 'l_block1';
@@ -305,13 +305,13 @@ class p_master
}
// Only output a categories items if it's currently selected
- if (!$depth || ($depth && (in_array($itep_ary['parent'], array_values($parents)) || $itep_ary['parent'] == $this->p_parent)))
+ if (!$depth || ($depth && (in_array($itep_ary['parent'], array_values($this->module_cache['parents'])) || $itep_ary['parent'] == $this->p_parent)))
{
$use_tabular_offset = (!$depth) ? 't_block1' : $tabular_offset;
$tpl_ary = array(
'L_TITLE' => $itep_ary['lang'],
- 'S_SELECTED' => (in_array($itep_ary['id'], array_keys($parents)) || $itep_ary['id'] == $this->p_id) ? true : false,
+ 'S_SELECTED' => (in_array($itep_ary['id'], array_keys($this->module_cache['parents'])) || $itep_ary['id'] == $this->p_id) ? true : false,
'U_TITLE' => $module_url . '&i=' . (($itep_ary['cat']) ? $itep_ary['id'] : $itep_ary['name'] . '&mode=' . $itep_ary['mode'])
);
@@ -320,7 +320,7 @@ class p_master
$tpl_ary = array(
'L_TITLE' => $itep_ary['lang'],
- 'S_SELECTED' => (in_array($itep_ary['id'], array_keys($parents)) || $itep_ary['id'] == $this->p_id) ? true : false,
+ 'S_SELECTED' => (in_array($itep_ary['id'], array_keys($this->module_cache['parents'])) || $itep_ary['id'] == $this->p_id) ? true : false,
'U_TITLE' => $module_url . '&i=' . (($itep_ary['cat']) ? $itep_ary['id'] : $itep_ary['name'] . '&mode=' . $itep_ary['mode'])
);
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index d868235319..f4e27b4138 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -66,7 +66,7 @@ function user_get_id_name(&$user_id_ary, &$username_ary)
*/
function user_update_name($old_name, $new_name)
{
- global $config, $db;
+ global $config, $db, $cache;
$update_ary = array(
FORUMS_TABLE => array('forum_last_poster_name'),
@@ -176,7 +176,7 @@ function user_delete($mode, $user_id)
break;
}
- $table_ary = array(USERS_TABLE, USER_GROUP_TABLE, TOPICS_WATCH_TABLE, FORUMS_WATCH_TABLE, ACL_USERS_TABLE, TOPICS_TRACK_TABLE, FORUMS_TRACK_TABLE);
+ $table_ary = array(USERS_TABLE, USER_GROUP_TABLE, TOPICS_WATCH_TABLE, FORUMS_WATCH_TABLE, ACL_USERS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, FORUMS_TRACK_TABLE);
foreach ($table_ary as $table)
{
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 62d100156d..e2141dde59 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -43,8 +43,6 @@ class session
$this->time_now = time();
$this->browser = (!empty($_SERVER['HTTP_USER_AGENT'])) ? $_SERVER['HTTP_USER_AGENT'] : '';
-// $this->page = (!empty($_SERVER['REQUEST_URI'])) ? preg_replace('#/?' . preg_quote($config['script_path'], '#') . '/?([a-z]+?\.' . $phpEx . '\?)sid=[a-z0-9]*(.*?)$#i', '\1\2', $_SERVER['REQUEST_URI']) . ((isset($_POST['f'])) ? 'f=' . intval($_POST['f']) : '') : '';
-
$this->page = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] . ((isset($_POST['f'])) ? 'f=' . intval($_POST['f']) : '') : '';
$sid = substr($this->page, strpos($this->page, 'sid='), 36);
$this->page = str_replace(array('/' . $config['script_path'] . '/', (strlen($sid) == 36 && strpos($sid, '&') === false) ? $sid : 'sid='), '', $this->page);
@@ -175,8 +173,7 @@ class session
foreach ($active_bots as $row)
{
-// if ($row['bot_agent'] && preg_match('#' . preg_quote($row['bot_agent'], '#') . '#i', $this->browser))
- if ($row['bot_agent'] && strpos($this->browser, $row['bot_agent']) !== false)
+ if ($row['bot_agent'] && strpos(strtolower($this->browser), strtolower($row['bot_agent'])) !== false)
{
$bot = $row['user_id'];
}
@@ -270,7 +267,7 @@ class session
$this->data = array_merge($sdata, $this->data);
unset($sdata);
$this->session_id = $this->data['session_id'];
- }
+ }
$db->sql_freeresult($result);
$this->data['session_last_visit'] = (isset($this->data['session_time']) && $this->data['session_time']) ? $this->data['session_time'] : (($this->data['user_lastvisit']) ? $this->data['user_lastvisit'] : time());
@@ -440,11 +437,18 @@ class session
* data before those sessions are destroyed. In addition this method
* removes autologin key information that is older than an admin defined
* limit.
+ *
+ * @todo add to cron
*/
function session_gc()
{
global $db, $config;
+ if (!$this->time_now)
+ {
+ $this->time_now = time();
+ }
+
switch (SQL_LAYER)
{
case 'mysql4':
@@ -531,6 +535,13 @@ class session
break;
}
+ if (!empty($config['max_autologin_time']))
+ {
+ $sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . '
+ WHERE last_login < ' . (time() - (86400 * (int) $config['max_autologin_time']));
+ $db->sql_query($sql);
+ }
+
return;
}
@@ -611,7 +622,7 @@ class session
if ($this->data['user_id'] != ANONYMOUS)
{
$this->session_kill();
- }
+ }
// Determine which message to output
$till_date = (!empty($ban_row['ban_end'])) ? $this->format_date($ban_row['ban_end']) : '';
$message = (!empty($ban_row['ban_end'])) ? 'BOARD_BAN_TIME' : 'BOARD_BAN_PERM';
@@ -666,25 +677,6 @@ class session
return false;
}
-
- /**
- * Remove stale login keys
- *
- * @private
- */
- function tidy_login_keys()
- {
- global $config, $db;
-
- if (!empty($config['max_autologin_time']))
- {
- $sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . '
- WHERE last_login < ' . (time() - (86400 * (int) $config['max_autologin_time']));
- $db->sql_query($sql);
- }
-
- return false;
- }
}
diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php
index d7e16caabb..72c43a6f7b 100644
--- a/phpBB/includes/ucp/ucp_main.php
+++ b/phpBB/includes/ucp/ucp_main.php
@@ -32,6 +32,7 @@ class ucp_main
$user->add_lang('memberlist');
+/*
if ($config['load_db_lastread'] || $config['load_db_track'])
{
if ($config['load_db_lastread'])
@@ -75,6 +76,23 @@ class ucp_main
{
$forum_check = (isset($tracking_topics[0][0])) ? base_convert($tracking_topics[0][0], 36, 10) + $config['board_startdate'] : 0;
}
+*/
+ $sql_from = TOPICS_TABLE . ' t ';
+ $sql_select = '';
+
+ if ($config['load_db_track'])
+ {
+ $sql_from .= ' LEFT JOIN ' . TOPICS_POSTED_TABLE . ' tp ON (tp.topic_id = t.topic_id
+ AND tp.user_id = ' . $user->data['user_id'] . ')';
+ $sql_select .= ', tp.topic_posted';
+ }
+
+ if ($config['load_db_lastread'])
+ {
+ $sql_from .= ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id
+ AND tt.user_id = ' . $user->data['user_id'] . ')';
+ $sql_select .= ', tt.mark_time';
+ }
$topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT'];
$folder = 'folder_announce';
@@ -108,11 +126,25 @@ class ucp_main
ORDER BY t.topic_last_post_time DESC';
$result = $db->sql_query($sql);
+ $topic_list = $rowset = array();
while ($row = $db->sql_fetchrow($result))
{
+ $topic_list[] = $row['topic_id'];
+ $rowset[$row['topic_id']] = $row;
+ }
+ $db->sql_freeresult($result);
+
+ $topic_tracking_info = get_topic_tracking(0, $topic_list, $rowset, array(0 => false), $topic_list);
+
+ foreach ($topic_list as $topic_id)
+ {
+ $row = &$rowset[$topic_id];
+
$forum_id = $row['forum_id'];
$topic_id = $row['topic_id'];
+ $unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
+
if ($row['topic_status'] == ITEM_LOCKED)
{
$topic_type = $user->lang['VIEW_TOPIC_LOCKED'];
@@ -120,38 +152,20 @@ class ucp_main
$folder_new = 'folder_locked_new';
}
- $unread_topic = true;
-
- if ($config['load_db_lastread'])
- {
- $topic_check = $row['mark_time'];
- }
- else
- {
- $topic_id36 = base_convert($topic_id, 10, 36);
- $topic_check = (isset($tracking_topics[0][$topic_id36])) ? base_convert($tracking_topics[0][$topic_id36], 36, 10) + $config['board_startdate'] : 0;
- }
-
- if ($topic_check >= $row['topic_last_post_time'] || $forum_check >= $row['topic_last_post_time'])
- {
- $unread_topic = false;
- }
-
- $newest_post_img = ($unread_topic) ? "" . $user->img('icon_post_newest', 'VIEW_NEWEST_POST') . ' ' : '';
+ $newest_post_img = ($unread_topic) ? "" . $user->img('icon_post_newest', 'VIEW_NEWEST_POST') . ' ' : '';
$folder_img = ($unread_topic) ? $folder_new : $folder;
$folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
// Posted image?
- if (!empty($row['mark_type']))
+ if (!empty($row['topic_posted']) && $row['topic_posted'])
{
$folder_img .= '_posted';
}
- $view_topic_url = "viewtopic.$phpEx$SID&f=$g_forum_id&t=$topic_id";
+ $view_topic_url = "{$phpbb_root_path}viewtopic.$phpEx$SID&f=$g_forum_id&t=$topic_id";
+ $last_post_img = "' . $user->img('icon_post_latest', 'VIEW_LATEST_POST') . '';
- $last_post_img = "' . $user->img('icon_post_latest', 'VIEW_LATEST_POST') . '';
-
- $last_post_author = ($row['topic_last_poster_id'] == ANONYMOUS) ? (($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] . ' ' : $user->lang['GUEST'] . ' ') : "' . $row['topic_last_poster_name'] . '';
+ $last_post_author = ($row['topic_last_poster_id'] == ANONYMOUS) ? (($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] . ' ' : $user->lang['GUEST'] . ' ') : "' . $row['topic_last_poster_name'] . '';
$template->assign_block_vars('topicrow', array(
'FORUM_ID' => $forum_id,
@@ -166,12 +180,11 @@ class ucp_main
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_attach', '') : '',
- 'S_USER_POSTED' => (!empty($row['mark_type'])) ? true : false,
+ 'S_USER_POSTED' => (!empty($row['topic_posted']) && $row['topic_posted']) ? true : false,
'U_VIEW_TOPIC' => $view_topic_url)
);
}
- $db->sql_freeresult($result);
$post_count_ary = $auth->acl_getf('f_postcount');
@@ -328,15 +341,7 @@ class ucp_main
if ($config['load_db_lastread'])
{
- switch (SQL_LAYER)
- {
- case 'oracle':
- break;
-
- default:
- $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))';
- break;
- }
+ $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
@@ -358,14 +363,17 @@ class ucp_main
{
$forum_id = $row['forum_id'];
- $unread_forum = false;
- $forum_check = (!$config['load_db_lastread']) ? $tracking_topics[$forum_id][0] : $row['mark_time'];
-
- if ($forum_check < $row['forum_last_post_time'])
+ if ($config['load_db_lastread'])
{
- $unread_forum = true;
+ $forum_check = (!empty($row['mark_time'])) ? $row['mark_time'] : $user->data['user_lastmark'];
}
-
+ else
+ {
+ $forum_check = (isset($tracking_topics['f'][$forum_id])) ? base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate'] : $user->data['user_lastmark'];
+ }
+
+ $unread_forum = ($row['forum_last_post_time'] > $forum_check) ? true : false;
+
// Which folder should we display?
if ($row['forum_status'] == ITEM_LOCKED)
{
@@ -429,12 +437,35 @@ class ucp_main
);
}
+ /*
$sql_from = ($config['load_db_lastread'] || $config['load_db_track']) ? '(' . TOPICS_TABLE . ' t LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id'] . '))' : TOPICS_TABLE . ' t';
$sql_f_tracking = ($config['load_db_lastread']) ? 'LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.forum_id = t.forum_id AND ft.user_id = ' . $user->data['user_id'] . ')' : '';
$sql_t_select = ($config['load_db_lastread'] || $config['load_db_track']) ? ', tt.mark_type, tt.mark_time' : '';
$sql_f_select = ($config['load_db_lastread']) ? ', ft.mark_time AS forum_mark_time' : '';
-
+ */
+
+ $sql_f_tracking = ($config['load_db_lastread']) ? 'LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.forum_id = t.forum_id AND ft.user_id = ' . $user->data['user_id'] . ')' : '';
+ $sql_f_select = ($config['load_db_lastread']) ? ', ft.mark_time AS forum_mark_time' : '';
+
+ $sql_from = TOPICS_TABLE . ' t';
+ $sql_t_select = '';
+
+ if ($config['load_db_track'])
+ {
+ $sql_from .= ' LEFT JOIN ' . TOPICS_POSTED_TABLE . ' tp ON (tp.topic_id = t.topic_id
+ AND tp.user_id = ' . $user->data['user_id'] . ')';
+ $sql_t_select .= ', tp.topic_posted';
+ }
+
+ if ($config['load_db_lastread'])
+ {
+ $sql_from .= ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id
+ AND tt.user_id = ' . $user->data['user_id'] . ')';
+ $sql_t_select .= ', tt.mark_time';
+ }
+
+
$sql = "SELECT t.* $sql_f_select $sql_t_select
FROM $sql_from $sql_f_tracking, " . TOPICS_WATCH_TABLE . ' tw
WHERE tw.user_id = ' . $user->data['user_id'] . '
@@ -442,24 +473,32 @@ class ucp_main
ORDER BY t.topic_last_post_time DESC';
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
+ $topic_list = $global_announce_list = $rowset = array();
while ($row = $db->sql_fetchrow($result))
{
- $topic_id = $row['topic_id'];
- $forum_id = $row['forum_id'];
-
- if ($config['load_db_lastread'])
- {
- $mark_time_topic = ($user->data['is_registered']) ? $row['mark_time'] : 0;
- $mark_time_forum = $row['forum_mark_time'];
- }
- else
- {
- $topic_id36 = base_convert($topic_id, 10, 36);
- $forum_id36 = ($row['topic_type'] == POST_GLOBAL) ? 0 : $forum_id;
- $mark_time_topic = (isset($tracking_topics[$forum_id36][$topic_id36])) ? base_convert($tracking_topics[$forum_id36][$topic_id36], 36, 10) + $config['board_startdate'] : 0;
+ $topic_list[] = $row['topic_id'];
+ $rowset[$row['topic_id']] = $row;
- $mark_time_forum = (isset($tracking_topics[$forum_id][0])) ? base_convert($tracking_topics[$forum_id][0], 36, 10) + $config['board_startdate'] : 0;
+ if ($row['topic_type'] == POST_GLOBAL)
+ {
+ $global_announce_list[] = $row['topic_id'];
}
+ }
+ $db->sql_freeresult($result);
+
+ /**
+ * @todo get_topic_tracking able to fetch from multiple forums
+ */
+ $topic_tracking_info = get_topic_tracking(0, $topic_list, $rowset, array(0 => false), $global_announce_list);
+
+ foreach ($topic_list as $topic_id)
+ {
+ $row = &$rowset[$topic_id];
+
+ $forum_id = $row['forum_id'];
+ $topic_id = $row['topic_id'];
+
+ $unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
// Replies
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
@@ -471,7 +510,7 @@ class ucp_main
// Get folder img, topic status/type related informations
$folder_img = $folder_alt = $topic_type = '';
- $unread_topic = topic_status($row, $replies, $mark_time_topic, $mark_time_forum, $folder_img, $folder_alt, $topic_type);
+ topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
$newest_post_img = ($unread_topic) ? "" . $user->img('icon_post_newest', 'VIEW_NEWEST_POST') . ' ' : '';
@@ -502,7 +541,7 @@ class ucp_main
'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
'S_TOPIC_TYPE' => $row['topic_type'],
- 'S_USER_POSTED' => (!empty($row['mark_type'])) ? true : false,
+ 'S_USER_POSTED' => (!empty($row['topic_posted'])) ? true : false,
'S_UNREAD_TOPIC' => $unread_topic,
'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'],
diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php
index 3ed7e7668f..a010f1575c 100644
--- a/phpBB/includes/ucp/ucp_register.php
+++ b/phpBB/includes/ucp/ucp_register.php
@@ -245,6 +245,7 @@ class ucp_register
'user_actkey' => $user_actkey,
'user_ip' => $user->ip,
'user_regdate' => time(),
+ 'user_lastmark' => time(),
);
$sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql
index 8873ade3d6..74e5dbef8f 100644
--- a/phpBB/install/schemas/firebird_schema.sql
+++ b/phpBB/install/schemas/firebird_schema.sql
@@ -708,10 +708,16 @@ CREATE TABLE phpbb_topics_marking (
user_id INTEGER DEFAULT 0 NOT NULL,
topic_id INTEGER DEFAULT 0 NOT NULL,
forum_id INTEGER DEFAULT 0 NOT NULL,
- mark_type INTEGER DEFAULT 0 NOT NULL,
mark_time INTEGER DEFAULT 0 NOT NULL
);;
+# phpbb_topics_posted
+CREATE TABLE phpbb_topics_posted (
+ user_id INTEGER DEFAULT 0 NOT NULL,
+ topic_id INTEGER DEFAULT 0 NOT NULL,
+ topic_posted INTEGER DEFAULT 0 NOT NULL
+);;
+
# phpbb_topics_watch
CREATE TABLE phpbb_topics_watch (
topic_id INTEGER DEFAULT 0 NOT NULL,
@@ -742,6 +748,7 @@ CREATE TABLE phpbb_users (
user_email_hash DOUBLE PRECISION DEFAULT 0 NOT NULL,
user_birthday VARCHAR(10) NOT NULL,
user_lastvisit INTEGER DEFAULT 0 NOT NULL,
+ user_lastmark INTEGER DEFAULT 0 NOT NULL,
user_lastpost_time INTEGER DEFAULT 0 NOT NULL,
user_lastpage VARCHAR(100) NOT NULL,
user_last_confirm_key VARCHAR(10) NOT NULL,
@@ -1376,6 +1383,17 @@ ADD PRIMARY KEY (
topic_id
);;
+CREATE INDEX forum_idtp
+ON phpbb_topics_marking(
+ forum_id
+);;
+
+ALTER TABLE phpbb_topics_posted
+ADD PRIMARY KEY (
+ user_id,
+ topic_id
+);;
+
CREATE INDEX notify_status71
ON phpbb_topics_watch(
notify_status
diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index ac13607e3b..74a8b3be0c 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -713,11 +713,17 @@ CREATE TABLE [phpbb_topics_marking] (
[user_id] [int] NOT NULL ,
[topic_id] [int] NOT NULL ,
[forum_id] [int] NOT NULL ,
- [mark_type] [int] NOT NULL ,
[mark_time] [int] NOT NULL
) ON [PRIMARY]
GO
+CREATE TABLE [phpbb_topics_posted] (
+ [user_id] [int] NOT NULL ,
+ [topic_id] [int] NOT NULL ,
+ [topic_posted] [int] NOT NULL
+) ON [PRIMARY]
+GO
+
CREATE TABLE [phpbb_topics_watch] (
[topic_id] [int] NOT NULL ,
[user_id] [int] NOT NULL ,
@@ -747,6 +753,7 @@ CREATE TABLE [phpbb_users] (
[user_email_hash] [float] NOT NULL ,
[user_birthday] [varchar] (10) NOT NULL ,
[user_lastvisit] [int] NOT NULL ,
+ [user_lastmark] [int] NOT NULL ,
[user_lastpost_time] [int] NOT NULL ,
[user_lastpage] [varchar] (100) NOT NULL ,
[user_last_confirm_key] [varchar] (10) NOT NULL ,
@@ -1140,6 +1147,14 @@ ALTER TABLE [phpbb_topics_marking] WITH NOCHECK ADD
) ON [PRIMARY]
GO
+ALTER TABLE [phpbb_topics_posted] WITH NOCHECK ADD
+ CONSTRAINT [PK_phpbb_topics_posted] PRIMARY KEY CLUSTERED
+ (
+ [user_id],
+ [topic_id]
+ ) ON [PRIMARY]
+GO
+
ALTER TABLE [phpbb_users] WITH NOCHECK ADD
CONSTRAINT [PK_phpbb_users] PRIMARY KEY CLUSTERED
(
@@ -1552,10 +1567,15 @@ ALTER TABLE [phpbb_topics_marking] WITH NOCHECK ADD
CONSTRAINT [DF_tmarki_user_id] DEFAULT (0) FOR [user_id],
CONSTRAINT [DF_tmarki_topic_id] DEFAULT (0) FOR [topic_id],
CONSTRAINT [DF_tmarki_forum_id] DEFAULT (0) FOR [forum_id],
- CONSTRAINT [DF_tmarki_mark_type] DEFAULT (0) FOR [mark_type],
CONSTRAINT [DF_tmarki_mark_time] DEFAULT (0) FOR [mark_time]
GO
+ALTER TABLE [phpbb_topics_posted] WITH NOCHECK ADD
+ CONSTRAINT [DF_tposte_user_id] DEFAULT (0) FOR [user_id],
+ CONSTRAINT [DF_tposte_topic_id] DEFAULT (0) FOR [topic_id],
+ CONSTRAINT [DF_tposte_topic_posted] DEFAULT (0) FOR [topic_posted]
+GO
+
ALTER TABLE [phpbb_topics_watch] WITH NOCHECK ADD
CONSTRAINT [DF_twatch_topic_id] DEFAULT (0) FOR [topic_id],
CONSTRAINT [DF_twatch_user_id] DEFAULT (0) FOR [user_id],
@@ -1575,6 +1595,7 @@ ALTER TABLE [phpbb_users] WITH NOCHECK ADD
CONSTRAINT [DF_users__user_passchg] DEFAULT (0) FOR [user_passchg],
CONSTRAINT [DF_users__user_email_hash] DEFAULT (0) FOR [user_email_hash],
CONSTRAINT [DF_users__user_lastvisit] DEFAULT (0) FOR [user_lastvisit],
+ CONSTRAINT [DF_users__user_lastmark] DEFAULT (0) FOR [user_lastmark],
CONSTRAINT [DF_users__user_lastpost_time] DEFAULT (0) FOR [user_lastpost_time],
CONSTRAINT [DF_users__user_warnings] DEFAULT (0) FOR [user_warnings],
CONSTRAINT [DF_users__user_posts] DEFAULT (0) FOR [user_posts],
@@ -1833,6 +1854,9 @@ GO
CREATE INDEX [topic_last_post_time] ON [phpbb_topics]([topic_last_post_time]) ON [PRIMARY]
GO
+CREATE INDEX [forum_id] ON [phpbb_topics_marking]([forum_id]) ON [PRIMARY]
+GO
+
CREATE INDEX [topic_id] ON [phpbb_topics_watch]([topic_id]) ON [PRIMARY]
GO
diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql
index cec502c424..f7e5fea293 100644
--- a/phpBB/install/schemas/mysql_schema.sql
+++ b/phpBB/install/schemas/mysql_schema.sql
@@ -821,8 +821,16 @@ CREATE TABLE phpbb_topics_marking (
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
- mark_type tinyint(4) DEFAULT '0' NOT NULL,
mark_time int(11) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (user_id, topic_id),
+ KEY forum_id (forum_id)
+);
+
+# Table: 'phpbb_topic_posted'
+CREATE TABLE phpbb_topics_posted (
+ user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ topic_posted tinyint(4) DEFAULT '0' NOT NULL,
PRIMARY KEY (user_id, topic_id)
);
@@ -862,6 +870,7 @@ CREATE TABLE phpbb_users (
user_email_hash bigint(20) DEFAULT '0' NOT NULL,
user_birthday varchar(10) DEFAULT '' NOT NULL,
user_lastvisit int(11) DEFAULT '0' NOT NULL,
+ user_lastmark int(11) DEFAULT '0' NOT NULL,
user_lastpost_time int(11) DEFAULT '0' NOT NULL,
user_lastpage varchar(100) DEFAULT '' NOT NULL,
user_last_confirm_key varchar(10) DEFAULT '' NOT NULL,
diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql
index 8add2daeb1..5b9f14baea 100644
--- a/phpBB/install/schemas/oracle_schema.sql
+++ b/phpBB/install/schemas/oracle_schema.sql
@@ -1578,12 +1578,25 @@ CREATE TABLE phpbb_topics_marking (
user_id number(8) DEFAULT '0' NOT NULL,
topic_id number(8) DEFAULT '0' NOT NULL,
forum_id number(8) DEFAULT '0' NOT NULL,
- mark_type number(4) DEFAULT '0' NOT NULL,
mark_time number(11) DEFAULT '0' NOT NULL,
CONSTRAINT pk_phpbb_topics_marking PRIMARY KEY (user_id, topic_id)
)
/
+CREATE INDEX forum_id06 on phpbb_topics_marking (forum_id)
+/
+
+/*
+ Table: phpbb_topics_posted
+*/
+CREATE TABLE phpbb_topics_posted (
+ user_id number(8) DEFAULT '0' NOT NULL,
+ topic_id number(8) DEFAULT '0' NOT NULL,
+ topic_posted number(4) DEFAULT '0' NOT NULL,
+ CONSTRAINT pk_phpbb_topics_posted PRIMARY KEY (user_id, topic_id)
+)
+/
+
/*
Table: phpbb_topics_watch
*/
@@ -1636,6 +1649,7 @@ CREATE TABLE phpbb_users (
user_email_hash number(20) DEFAULT '0' NOT NULL,
user_birthday varchar2(10) DEFAULT '',
user_lastvisit number(11) DEFAULT '0' NOT NULL,
+ user_lastmark number(11) DEFAULT '0' NOT NULL,
user_lastpost_time number(11) DEFAULT '0' NOT NULL,
user_lastpage varchar2(100) DEFAULT '',
user_last_confirm_key varchar2(10) DEFAULT '',
diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 9f7e4c4493..805001e2fc 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -1094,12 +1094,11 @@ CREATE INDEX topic_last_post_time_phpbb_topics_index ON phpbb_topics (topic_last
SELECT SETVAL('phpbb_topics_topic_id_seq',(select case when max(topic_id)>0 then max(topic_id)+1 else 1 end from phpbb_topics));
-/* Table: phpbb_topic_marking */
+/* Table: phpbb_topics_marking */
CREATE TABLE phpbb_topics_marking (
user_id INT4 DEFAULT '0' NOT NULL,
topic_id INT4 DEFAULT '0' NOT NULL,
forum_id INT4 DEFAULT '0' NOT NULL,
- mark_type INT2 DEFAULT '0' NOT NULL,
mark_time INT4 DEFAULT '0' NOT NULL,
PRIMARY KEY (user_id,topic_id),
CHECK (user_id>=0),
@@ -1107,6 +1106,18 @@ CREATE TABLE phpbb_topics_marking (
CHECK (forum_id>=0)
);
+CREATE INDEX forum_id_phpbb_topics_marking_index ON phpbb_topics_marking (forum_id);
+
+/* Table: phpbb_topics_posted */
+CREATE TABLE phpbb_topics_posted (
+ user_id INT4 DEFAULT '0' NOT NULL,
+ topic_id INT4 DEFAULT '0' NOT NULL,
+ topic_posted INT2 DEFAULT '0' NOT NULL,
+ PRIMARY KEY (user_id,topic_id),
+ CHECK (user_id>=0),
+ CHECK (topic_id>=0)
+);
+
/* Table: phpbb_topics_watch */
CREATE TABLE phpbb_topics_watch (
topic_id INT4 DEFAULT '0' NOT NULL,
@@ -1147,6 +1158,7 @@ CREATE TABLE phpbb_users (
user_email_hash INT8 DEFAULT '0' NOT NULL,
user_birthday varchar(10) DEFAULT '' NOT NULL,
user_lastvisit INT4 DEFAULT '0' NOT NULL,
+ user_lastmark INT4 DEFAULT '0' NOT NULL,
user_lastpost_time INT4 DEFAULT '0' NOT NULL,
user_lastpage varchar(100) DEFAULT '' NOT NULL,
user_last_confirm_key varchar(10) DEFAULT '' NOT NULL,
diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql
index 906e934646..320d86d8f3 100644
--- a/phpBB/install/schemas/sqlite_schema.sql
+++ b/phpBB/install/schemas/sqlite_schema.sql
@@ -823,11 +823,20 @@ CREATE TABLE phpbb_topics_marking (
user_id mediumint(8) NOT NULL DEFAULT '0',
topic_id mediumint(8) NOT NULL DEFAULT '0',
forum_id mediumint(8) NOT NULL DEFAULT '0',
- mark_type tinyint(4) NOT NULL DEFAULT '0',
mark_time int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (user_id, topic_id)
);
+CREATE INDEX forum_id_phpbb_topics_posted on phpbb_topics_posted (forum_id);
+
+# Table: phpbb_topics_posted
+CREATE TABLE phpbb_topics_posted (
+ user_id mediumint(8) NOT NULL DEFAULT '0',
+ topic_id mediumint(8) NOT NULL DEFAULT '0',
+ topic_posted tinyint(4) NOT NULL DEFAULT '0',
+ PRIMARY KEY (user_id, topic_id)
+);
+
# Table: phpbb_topics_watch
CREATE TABLE phpbb_topics_watch (
topic_id mediumint(8) NOT NULL DEFAULT '0',
@@ -866,6 +875,7 @@ CREATE TABLE phpbb_users (
user_email_hash bigint(20) NOT NULL DEFAULT '0',
user_birthday varchar(10) NOT NULL DEFAULT '',
user_lastvisit int(11) NOT NULL DEFAULT '0',
+ user_lastmark int(11) NOT NULL DEFAULT '0',
user_lastpost_time int(11) NOT NULL DEFAULT '0',
user_lastpage varchar(100) NOT NULL DEFAULT '',
user_last_confirm_key varchar(10) NOT NULL DEFAULT '',
diff --git a/phpBB/posting.php b/phpBB/posting.php
index c79757809a..d986f958a5 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -1843,9 +1843,14 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$db->sql_query($sql);
}
- // Mark this topic as read and posted to.
- $mark_mode = ($mode == 'post' || $mode == 'reply' || $mode == 'quote') ? 'post' : 'topic';
- markread($mark_mode, $data['forum_id'], $data['topic_id'], $data['post_time']);
+ if ($mode == 'post' || $mode == 'reply' || $mode == 'quote')
+ {
+ // Mark this topic as posted to
+ markread('post', $data['forum_id'], $data['topic_id'], $data['post_time']);
+ }
+
+ // Mark this topic as read
+ markread('topic', $data['forum_id'], $data['topic_id'], $data['post_time']);
// Send Notifications
if ($mode != 'edit' && $mode != 'delete' && (!$auth->acl_get('f_moderate', $data['forum_id']) || $auth->acl_get('m_approve')))
diff --git a/phpBB/search.php b/phpBB/search.php
index a092105b94..75ca8b57d3 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -36,7 +36,7 @@ $search_fields = request_var('search_fields', 'all');
$search_child = request_var('search_child', true);
$return_chars = request_var('return_chars', 200);
-$search_forum = request_var('search_forum', 0);
+$search_forum = request_var('search_forum', array(0));
$sort_days = request_var('st', 0);
$sort_key = request_var('sk', 't');
@@ -251,7 +251,7 @@ if ($keywords || $author || $search_id || $search_session_id)
/**
* @todo add to config
*/
- $config['search_type'] = 'mysql';
+ $config['search_type'] = 'phpbb';
// Select which method we'll use to obtain the post_id information
$smid = '';
@@ -468,7 +468,7 @@ if ($keywords || $author || $search_id || $search_session_id)
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
$folder_img = $folder_alt = $topic_type = '';
- topic_status($row, $replies, time(), time(), $folder_img, $folder_alt, $topic_type);
+ topic_status($row, $replies, false, $folder_img, $folder_alt, $topic_type);
$tpl_ary = array(
'TOPIC_AUTHOR' => topic_topic_author($row),
diff --git a/phpBB/styles/subSilver/template/index_body.html b/phpBB/styles/subSilver/template/index_body.html
index 51b0ddff2d..25daf5a92c 100644
--- a/phpBB/styles/subSilver/template/index_body.html
+++ b/phpBB/styles/subSilver/template/index_body.html
@@ -56,7 +56,7 @@
{forumrow.LAST_POSTER}
- {forumrow.LAST_POST_IMG}
+ {LAST_POST_IMG}
{L_NO_POSTS}
diff --git a/phpBB/styles/subSilver/template/viewforum_body.html b/phpBB/styles/subSilver/template/viewforum_body.html index 0f9f4b1829..e1d98a1abd 100644 --- a/phpBB/styles/subSilver/template/viewforum_body.html +++ b/phpBB/styles/subSilver/template/viewforum_body.html @@ -48,7 +48,7 @@ {REPORTED_IMG} -{topicrow.NEWEST_POST_IMG} {topicrow.ATTACH_ICON_IMG} {topicrow.TOPIC_TITLE}
+{NEWEST_POST_IMG} {topicrow.ATTACH_ICON_IMG} {topicrow.TOPIC_TITLE}
[ {GOTO_PAGE_IMG}{L_GOTO_PAGE}: {topicrow.PAGINATION} ]
@@ -59,7 +59,7 @@{topicrow.LAST_POST_TIME}
{topicrow.LAST_POST_AUTHOR}{topicrow.LAST_POST_AUTHOR} - {topicrow.LAST_POST_IMG} + {LAST_POST_IMG}
{topicrow.NEWEST_POST_IMG} {topicrow.ATTACH_ICON_IMG} {topicrow.TOPIC_TITLE}
+{NEWEST_POST_IMG} {topicrow.ATTACH_ICON_IMG} {topicrow.TOPIC_TITLE}
[ {GOTO_PAGE_IMG}{L_GOTO_PAGE}: {topicrow.PAGINATION} ]
@@ -178,7 +178,7 @@{topicrow.LAST_POST_TIME}
{topicrow.LAST_POST_AUTHOR}{topicrow.LAST_POST_AUTHOR} - {topicrow.LAST_POST_IMG} + {LAST_POST_IMG}