aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions_admin.php6
-rw-r--r--phpBB/includes/mcp/mcp_front.php4
-rw-r--r--phpBB/includes/mcp/mcp_main.php66
-rw-r--r--phpBB/includes/mcp/mcp_post.php33
-rw-r--r--phpBB/includes/mcp/mcp_topic.php292
-rw-r--r--phpBB/includes/ucp/ucp_main.php62
6 files changed, 410 insertions, 53 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index b7d0adf305..067f463325 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -250,7 +250,7 @@ function move_topics($topic_ids, $forum_id, $auto_sync = true)
}
}
-function move_posts($post_ids, $topic_id, $auto_sync = TRUE)
+function move_posts($post_ids, $topic_id, $auto_sync = true)
{
global $db;
@@ -304,8 +304,8 @@ function move_posts($post_ids, $topic_id, $auto_sync = TRUE)
$forum_ids[] = $row['forum_id'];
sync('reported', 'topic_id', $topic_ids);
- sync('topic', 'topic_id', $topic_ids, TRUE);
- sync('forum', 'forum_id', $forum_ids, TRUE);
+ sync('topic', 'topic_id', $topic_ids, true);
+ sync('forum', 'forum_id', $forum_ids, true);
}
}
diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php
index cf9eb5a05e..c593e6ae90 100644
--- a/phpBB/includes/mcp/mcp_front.php
+++ b/phpBB/includes/mcp/mcp_front.php
@@ -186,4 +186,6 @@ function mcp_front_view($id, $mode, $action, $url)
$template->assign_var('S_MCP_ACTION', $url);
make_jumpbox($url . '&mode=forum_view', 0, false, 'm_');
-} \ No newline at end of file
+}
+
+?> \ No newline at end of file
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index f5ec4d703b..7bf8c9ca63 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -104,7 +104,7 @@ class mcp_main extends module
if (!$post_ids)
{
- trigger_error('NO_TOPIC_SELECTED');
+ trigger_error('NO_POST_SELECTED');
}
mcp_delete_post($post_ids);
@@ -211,13 +211,23 @@ function get_array($var, $default_value)
// LITTLE HELPER
// Build simple hidden fields from array
-function build_hidden_fields($name, $vars)
+function build_hidden_fields($field_ary)
{
$s_hidden_fields = '';
- foreach ($vars as $key => $value)
+ foreach ($field_ary as $name => $vars)
{
- $s_hidden_fields .= '<input type="hidden" name="' . $name . '[' . $key . ']" value="' . ((is_string($value)) ? htmlspecialchars($value) : (int) $value) . '" />';
+ if (is_array($vars))
+ {
+ foreach ($vars as $key => $value)
+ {
+ $s_hidden_fields .= '<input type="hidden" name="' . $name . '[' . $key . ']" value="' . $value . '" />';
+ }
+ }
+ else
+ {
+ $s_hidden_fields .= '<input type="hidden" name="' . $name . '" value="' . $vars . '" />';
+ }
}
return $s_hidden_fields;
@@ -552,9 +562,11 @@ function lock_unlock($mode, $ids)
$redirect = request_var('redirect', $user->data['session_page']);
- $s_hidden_fields = build_hidden_fields($sql_id . '_list', $ids);
- $s_hidden_fields .= '<input type="hidden" name="mode" value="' . $mode . '" />';
- $s_hidden_fields .= '<input type="hidden" name="redirect" value="' . $redirect . '" />';
+ $s_hidden_fields = build_hidden_fields(array(
+ $sql_id . '_list' => $ids,
+ 'mode' => $mode,
+ 'redirect' => $redirect)
+ );
$success_msg = '';
if (confirm_box(true))
@@ -632,10 +644,12 @@ function change_topic_type($mode, $topic_ids)
$redirect = request_var('redirect', $user->data['session_page']);
- $s_hidden_fields = build_hidden_fields('topic_id_list', $topic_ids);
- $s_hidden_fields .= '<input type="hidden" name="f" value="' . $forum_id . '" />';
- $s_hidden_fields .= '<input type="hidden" name="mode" value="' . $mode . '" />';
- $s_hidden_fields .= '<input type="hidden" name="redirect" value="' . $redirect . '" />';
+ $s_hidden_fields = build_hidden_fields(array(
+ 'topic_id_list' => $topic_ids,
+ 'f' => $forum_id,
+ 'mode' => $mode,
+ 'redirect' => $redirect)
+ );
$success_msg = '';
if (confirm_box(true))
@@ -713,10 +727,12 @@ function mcp_move_topic($topic_ids)
$redirect = request_var('redirect', $user->data['session_page']);
$additional_msg = $success_msg = '';
- $s_hidden_fields = build_hidden_fields('topic_id_list', $topic_ids);
- $s_hidden_fields .= '<input type="hidden" name="f" value="' . $forum_id . '" />';
- $s_hidden_fields .= '<input type="hidden" name="mode" value="move" />';
- $s_hidden_fields .= '<input type="hidden" name="redirect" value="' . $redirect . '" />';
+ $s_hidden_fields = build_hidden_fields(array(
+ 'topic_id_list' => $topic_ids,
+ 'f' => $forum_id,
+ 'mode' => 'move',
+ 'redirect' => $redirect)
+ );
if ($to_forum_id)
{
@@ -855,10 +871,12 @@ function mcp_delete_topic($topic_ids)
$redirect = request_var('redirect', $user->data['session_page']);
- $s_hidden_fields = build_hidden_fields('topic_id_list', $topic_ids);
- $s_hidden_fields .= '<input type="hidden" name="f" value="' . $forum_id . '" />';
- $s_hidden_fields .= '<input type="hidden" name="mode" value="delete_topic" />';
- $s_hidden_fields .= '<input type="hidden" name="redirect" value="' . $redirect . '" />';
+ $s_hidden_fields = build_hidden_fields(array(
+ 'topic_id_list' => $topic_ids,
+ 'f' => $forum_id,
+ 'mode' => 'delete_topic',
+ 'redirect' => $redirect)
+ );
$success_msg = '';
if (confirm_box(true))
@@ -911,10 +929,12 @@ function mcp_delete_post($post_ids)
$redirect = request_var('redirect', $user->data['session_page']);
- $s_hidden_fields = build_hidden_fields('post_id_list', $post_ids);
- $s_hidden_fields .= '<input type="hidden" name="f" value="' . $forum_id . '" />';
- $s_hidden_fields .= '<input type="hidden" name="mode" value="delete_post" />';
- $s_hidden_fields .= '<input type="hidden" name="redirect" value="' . $redirect . '" />';
+ $s_hidden_fields = build_hidden_fields(array(
+ 'post_id_list' => $post_ids,
+ 'f' => $forum_id,
+ 'mode' => 'delete_post',
+ 'redirect' => $redirect)
+ );
$success_msg = '';
if (confirm_box(true))
diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php
index c1ecd3325b..00570964a8 100644
--- a/phpBB/includes/mcp/mcp_post.php
+++ b/phpBB/includes/mcp/mcp_post.php
@@ -84,6 +84,35 @@ function mcp_post_details($id, $mode, $action, $url)
);
break;
+ case 'chgposter':
+
+ $new_user = request_var('u', 0);
+
+ if ($new_user && $auth->acl_get('m_', $post_info['forum_id']) && $new_user != $post_info['user_id'])
+ {
+ $sql = 'UPDATE ' . POSTS_TABLE . "
+ SET poster_id = $new_user
+ WHERE post_id = $post_id";
+ $db->sql_query($sql);
+
+ if ($post_info['topic_last_post_id'] == $post_info['post_id'] || $post_info['forum_last_post_id'] == $post_info['post_id'])
+ {
+ sync('topic', 'topic_id', $post_info['topic_id'], false, false);
+ sync('forum', 'forum_id', $post_info['forum_id'], false, false);
+ }
+
+ // Renew post info
+ $post_info = get_post_data(array($post_id));
+
+ if (!sizeof($post_info))
+ {
+ trigger_error($user->lang['POST_NOT_EXIST']);
+ }
+
+ $post_info = $post_info[$post_id];
+ }
+ break;
+
default:
}
@@ -215,4 +244,6 @@ function mcp_post_details($id, $mode, $action, $url)
}
}
-} \ No newline at end of file
+}
+
+?> \ No newline at end of file
diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php
index 20eb8d0d53..eb19a402e3 100644
--- a/phpBB/includes/mcp/mcp_topic.php
+++ b/phpBB/includes/mcp/mcp_topic.php
@@ -23,7 +23,6 @@ function mcp_topic_view($id, $mode, $action, $url)
$user->add_lang('viewtopic');
$topic_id = request_var('t', 0);
-
$topic_info = get_topic_data(array($topic_id));
if (!sizeof($topic_info))
@@ -42,8 +41,25 @@ function mcp_topic_view($id, $mode, $action, $url)
$post_id_list = get_array('post_id_list', 0);
+ // Split Topic?
+ if ($action == 'split_all' || $action == 'split_beyond')
+ {
+ split_topic($action, $topic_id, $to_forum_id, $subject);
+ }
+
+ // Merge Posts?
+ if ($action == 'merge_posts')
+ {
+ merge_posts($topic_id, $to_topic_id);
+ }
+
$topics_per_page = ($topic_info['forum_topics_per_page']) ? $topic_info['forum_topics_per_page'] : $config['topics_per_page'];
+ if ($action == 'split' && !$subject)
+ {
+ $subject = $topic_info['topic_title'];
+ }
+
// Jumpbox, sort selects and that kind of things
make_jumpbox($url . '&amp;mode=forum_view', $topic_info['forum_id'], false, 'm_');
mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $topic_info['forum_id'], $topic_id);
@@ -176,8 +192,8 @@ function mcp_topic_view($id, $mode, $action, $url)
'S_MCP_ACTION' => "$url&amp;mode=$mode&amp;start=$start",
'S_FORUM_SELECT' => '<select name="to_forum_id">' . (($to_forum_id) ? make_forum_select($to_forum_id) : make_forum_select($topic_info['forum_id'])) . '</select>',
- 'S_CAN_SPLIT' => ($auth->acl_get('m_split', $topic_info['forum_id'])) ? true : false,
- 'S_CAN_MERGE' => ($auth->acl_get('m_merge', $topic_info['forum_id'])) ? true : false,
+ 'S_CAN_SPLIT' => ($auth->acl_get('m_split', $topic_info['forum_id']) && $action != 'merge') ? true : false,
+ 'S_CAN_MERGE' => ($auth->acl_get('m_merge', $topic_info['forum_id']) && $action != 'split') ? true : false,
'S_CAN_DELETE' => ($auth->acl_get('m_delete', $topic_info['forum_id'])) ? true : false,
'S_CAN_APPROVE' => ($has_unapproved_posts && $auth->acl_get('m_approve', $topic_info['forum_id'])) ? true : false,
'S_CAN_LOCK' => ($auth->acl_get('m_lock', $topic_info['forum_id'])) ? true : false,
@@ -189,7 +205,273 @@ function mcp_topic_view($id, $mode, $action, $url)
'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], "<a href=\"viewforum.$phpEx$SID&amp;f={$topic_info['forum_id']}&amp;start=$start\">", '</a>'),
'PAGE_NUMBER' => on_page($total, $posts_per_page, $start),
- 'PAGINATION' => (!$posts_per_page) ? '' : generate_pagination("mcp.$phpEx$SID&amp;t=" . $topic_info['topic_id'] . "&amp;mode=$mode&amp;posts_per_page=$posts_per_page&amp;st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir", $total, $posts_per_page, $start),
+ 'PAGINATION' => (!$posts_per_page) ? '' : generate_pagination("mcp.$phpEx$SID&amp;t=" . $topic_info['topic_id'] . "&amp;mode=$mode&amp;action=$action&amp;to_topic_id=$to_topic_id&amp;posts_per_page=$posts_per_page&amp;st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir", $total, $posts_per_page, $start),
'TOTAL' => $total)
);
-} \ No newline at end of file
+}
+
+function split_topic($mode, $topic_id, $to_forum_id, $subject)
+{
+ global $db, $template, $user, $phpEx, $SID, $phpbb_root_path, $auth;
+
+ $post_id_list = get_array('post_id_list', 0);
+ $start = request_var('start', 0);
+
+ if (!$post_id_list)
+ {
+ trigger_error('NO_POST_SELECTED');
+ }
+
+ if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_split')))
+ {
+ return;
+ }
+
+ $post_id = $post_id_list[0];
+ $post_info = get_post_data(array($post_id));
+
+ if (!sizeof($post_info))
+ {
+ $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']);
+ return;
+ }
+
+ $post_info = $post_info[$post_id];
+ $subject = trim($subject);
+
+ // Make some tests
+ if (!$subject)
+ {
+ $template->assign_var('MESSAGE', $user->lang['EMPTY_SUBJECT']);
+ return;
+ }
+
+ if ($to_forum_id <= 0)
+ {
+ $template->assign_var('MESSAGE', $user->lang['NO_DESTINATION_FORUM']);
+ return;
+ }
+
+ $forum_info = get_forum_data(array($to_forum_id), 'm_split');
+
+ if (!sizeof($forum_info))
+ {
+ $template->assign_var('MESSAGE', $user->lang['NOT_MODERATOR']);
+ return;
+ }
+
+ $forum_info = $forum_info[$to_forum_id];
+
+ if ($forum_info['forum_type'] != FORUM_POST)
+ {
+ $template->assign_var('MESSAGE', $user->lang['FORUM_NOT_POSTABLE']);
+ return;
+ }
+
+ $redirect = request_var('redirect', $user->data['session_page']);
+
+ $s_hidden_fields = build_hidden_fields(array(
+ 'post_id_list' => $post_id_list,
+ 'f' => $forum_id,
+ 'mode' => 'topic_view',
+ 'start' => $start,
+ 'action' => $mode,
+ 't' => $topic_id,
+ 'redirect' => $redirect,
+ 'subject' => $subject,
+ 'to_forum_id' => $to_forum_id,
+ 'icon' => request_var('icon', 0))
+ );
+ $success_msg = $return_link = '';
+
+ if (confirm_box(true))
+ {
+ if ($mode == 'split_beyond')
+ {
+ mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
+ $limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';
+
+ if ($sort_order_sql{0} == 'u')
+ {
+ $sql = 'SELECT p.post_id, p.forum_id, p.post_approved
+ FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
+ WHERE p.topic_id = $topic_id
+ AND p.poster_id = u.user_id
+ $limit_time_sql
+ ORDER BY $sort_order_sql";
+ }
+ else
+ {
+ $sql = 'SELECT p.post_id, p.forum_id, p.post_approved
+ FROM ' . POSTS_TABLE . " p
+ WHERE p.topic_id = $topic_id
+ $limit_time_sql
+ ORDER BY $sort_order_sql";
+ }
+ $result = $db->sql_query_limit($sql, 0, $start);
+
+ $store = false;
+ $post_id_list = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ // If splitted from selected post (split_beyond), we split the unapproved items too.
+ if (!$row['post_approved'] && !$auth->acl_get('m_approve', $row['forum_id']))
+ {
+// continue;
+ }
+
+ // Start to store post_ids as soon as we see the first post that was selected
+ if ($row['post_id'] == $post_id)
+ {
+ $store = true;
+ }
+
+ if ($store)
+ {
+ $post_id_list[] = $row['post_id'];
+ }
+ }
+ }
+
+ if (!sizeof($post_id_list))
+ {
+ trigger_error($user->lang['NO_POST_SELECTED']);
+ }
+
+ $icon_id = request_var('icon', 0);
+
+ $sql_ary = array(
+ 'forum_id' => $to_forum_id,
+ 'topic_title' => $subject,
+ 'icon_id' => $icon_id,
+ 'topic_approved'=> 1
+ );
+
+ $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
+ $db->sql_query($sql);
+
+ $to_topic_id = $db->sql_nextid();
+ move_posts($post_id_list, $to_topic_id);
+
+ $success_msg = 'TOPIC_SPLIT_SUCCESS';
+
+ // Link back to both topics
+ $return_link = sprintf($user->lang['RETURN_TOPIC'], '<a href="viewtopic.' . $phpEx . $SID . '&amp;f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id'] . '">', '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="viewtopic.' . $phpEx . $SID . '&amp;f=' . $to_forum_id . '&amp;t=' . $to_topic_id . '">', '</a>');
+ }
+ else
+ {
+ confirm_box(false, ($mode == 'split_all') ? 'SPLIT_TOPIC_ALL' : 'SPLIT_TOPIC_BEYOND', $s_hidden_fields);
+ }
+
+ $redirect = request_var('redirect', "index.$phpEx$SID");
+
+ if (strpos($redirect, '?') === false)
+ {
+ $redirect = substr_replace($redirect, ".$phpEx$SID&", strpos($redirect, '&'), 1);
+ }
+
+ if (!$success_msg)
+ {
+ return;
+ }
+ else
+ {
+ meta_refresh(3, "viewtopic.$phpEx$SID&amp;f=$to_forum_id&amp;t=$to_topic_id");
+ trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link);
+ }
+}
+
+// Merge selected posts into selected topic
+function merge_posts($topic_id, $to_topic_id)
+{
+ global $db, $template, $user, $phpEx, $SID, $phpbb_root_path, $auth;
+
+ if (!$to_topic_id)
+ {
+ $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']);
+ return;
+ }
+
+ $topic_data = get_topic_data(array($to_topic_id), 'm_merge');
+
+ if (!sizeof($topic_data))
+ {
+ $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']);
+ return;
+ }
+
+ $topic_data = $topic_data[$to_topic_id];
+
+ $post_id_list = get_array('post_id_list', 0);
+ $start = request_var('start', 0);
+
+ if (!$post_id_list)
+ {
+ $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']);
+ $this->main('merge');
+ }
+
+ if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_merge')))
+ {
+ return;
+ }
+
+ $redirect = request_var('redirect', $user->data['session_page']);
+
+ $s_hidden_fields = build_hidden_fields(array(
+ 'post_id_list' => $post_id_list,
+ 'to_topic_id' => $to_topic_id,
+ 'mode' => 'topic_view',
+ 'action' => 'merge_posts',
+ 'start' => $start,
+ 'redirect' => $redirect,
+ 'f' => $forum_id,
+ 't' => $topic_id)
+ );
+ $success_msg = $return_link = '';
+
+ if (confirm_box(true))
+ {
+ $to_forum_id = $topic_data['forum_id'];
+
+ move_posts($post_id_list, $to_topic_id);
+ add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $topic_data['topic_title']);
+
+ // Message and return links
+ $success_msg = 'POSTS_MERGED_SUCCESS';
+
+ // Does the original topic still exist? If yes, link back to it
+ $topic_data = get_topic_data(array($topic_id));
+
+ if (sizeof($topic_data))
+ {
+ $return_link .= sprintf($user->lang['RETURN_TOPIC'], '<a href="viewtopic.' . $phpEx . $SID . '&amp;f=' . $forum_id . '&amp;t=' . $topic_id . '">', '</a>');
+ }
+
+ // Link to the new topic
+ $return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="viewtopic.' . $phpEx . $SID . '&amp;f=' . $to_forum_id . '&amp;t=' . $to_topic_id . '">', '</a>');
+ }
+ else
+ {
+ confirm_box(false, 'MERGE_POSTS', $s_hidden_fields);
+ }
+
+ $redirect = request_var('redirect', "index.$phpEx$SID");
+
+ if (strpos($redirect, '?') === false)
+ {
+ $redirect = substr_replace($redirect, ".$phpEx$SID&", strpos($redirect, '&'), 1);
+ }
+
+ if (!$success_msg)
+ {
+ return;
+ }
+ else
+ {
+ meta_refresh(3, "viewtopic.$phpEx$SID&amp;f=$to_forum_id&amp;t=$to_topic_id");
+ trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link);
+ }
+}
+
+?> \ No newline at end of file
diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php
index 33e72eab86..004053b10e 100644
--- a/phpBB/includes/ucp/ucp_main.php
+++ b/phpBB/includes/ucp/ucp_main.php
@@ -56,11 +56,42 @@ class ucp_main extends module
}
$tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? unserialize(stripslashes($_COOKIE[$config['cookie_name'] . '_track'])) : array();
+
+ // Has to be in while loop if we not only check forum id 0
+ if ($config['load_db_lastread'])
+ {
+ $forum_check = $track_data['mark_time'];
+ }
+ else
+ {
+ $forum_check = (isset($tracking_topics[0][0])) ? base_convert($tracking_topics[0][0], 36, 10) + $config['board_startdate'] : 0;
+ }
$topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT'];
$folder = 'folder_announce';
$folder_new = $folder . '_new';
+ // Determine first forum the user is able to read into - for global announcement link
+ $forum_ary = $auth->acl_getf('f_read');
+ $g_forum_id = 0;
+
+ foreach ($forum_ary as $forum_id => $allowed)
+ {
+ if (!$allowed['f_read'])
+ {
+ unset($forum_ary[$forum_id]);
+ }
+ }
+ $forum_ary = array_unique(array_keys($forum_ary));
+
+ $sql = 'SELECT forum_id
+ FROM ' . FORUMS_TABLE . '
+ WHERE forum_type = ' . FORUM_POST . '
+ AND forum_id IN (' . implode(', ', $forum_ary) . ')';
+ $result = $db->sql_query_limit($sql, 1);
+ $g_forum_id = (int) $db->sql_fetchfield('forum_id', 0, $result);
+ $db->sql_freeresult($result);
+
$sql = "SELECT t.* $sql_select
FROM $sql_from
WHERE t.forum_id = 0
@@ -82,32 +113,22 @@ class ucp_main extends module
$unread_topic = true;
- $topic_check = (!$config['load_db_lastread']) ? base_convert($tracking_topics[0][base_convert($topic_id, 10, 36)], 36, 10) + $config['board_startdate'] : $row['mark_time'];
-
- if (!$config['load_db_lastread'])
+ if ($config['load_db_lastread'])
{
- $forum_check = '';
- foreach ($tracking_topics as $forum_id => $tracking_time)
- {
- if ($tracking_time[0] > $forum_check)
- {
- $forum_check = $tracking_time[0];
- }
- }
- $forum_check = base_convert($forum_check, 36, 10) + $config['board_startdate'];
+ $topic_check = $row['mark_time'];
}
else
{
- $forum_check = $track_data['mark_time'];
+ $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'])
+ if ($topic_check >= $row['topic_last_post_time'] || $forum_check >= $row['topic_last_post_time'])
{
$unread_topic = false;
}
- $newest_post_img = ($unread_topic) ? "<a href=\"viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;view=unread\">" . $user->img('icon_post_newest', 'VIEW_NEWEST_POST') . '</a> ' : '';
+ $newest_post_img = ($unread_topic) ? "<a href=\"viewtopic.$phpEx$SID&amp;f=$g_forum_id&amp;t=$topic_id&amp;view=unread#unread\">" . $user->img('icon_post_newest', 'VIEW_NEWEST_POST') . '</a> ' : '';
$folder_img = ($unread_topic) ? $folder_new : $folder;
$folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
@@ -117,9 +138,9 @@ class ucp_main extends module
$folder_img .= '_posted';
}
- $view_topic_url = "viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id";
+ $view_topic_url = "viewtopic.$phpEx$SID&amp;f=$g_forum_id&amp;t=$topic_id";
- $last_post_img = "<a href=\"viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;p=" . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'] . '">' . $user->img('icon_post_latest', 'VIEW_LATEST_POST') . '</a>';
+ $last_post_img = "<a href=\"viewtopic.$phpEx$SID&amp;f=$g_forum_id&amp;t=$topic_id&amp;p=" . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'] . '">' . $user->img('icon_post_latest', 'VIEW_LATEST_POST') . '</a>';
$last_post_author = ($row['topic_last_poster_id'] == ANONYMOUS) ? (($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] . ' ' : $user->lang['GUEST'] . ' ') : "<a href=\"memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['topic_last_poster_id'] . '">' . $row['topic_last_poster_name'] . '</a>';
@@ -148,7 +169,7 @@ class ucp_main extends module
$forum_ary = array();
foreach ($post_count_ary as $forum_id => $allowed)
{
- if ($allowed)
+ if ($allowed['f_read'] && $allowed['f_postcount'])
{
$forum_ary[] = $forum_id;
}
@@ -684,11 +705,12 @@ class ucp_main extends module
$edit = (isset($_REQUEST['edit'])) ? true : false;
$submit = (isset($_POST['submit'])) ? true : false;
$draft_id = ($edit) ? intval($_REQUEST['edit']) : 0;
+ $delete = (isset($_POST['delete'])) ? true : false;
$s_hidden_fields = ($edit) ? '<input type="hidden" name="edit" value="' . $draft_id . '" />' : '';
$draft_subject = $draft_message = '';
- if ($_POST['delete'])
+ if ($delete)
{
$drafts = (isset($_POST['d'])) ? implode(', ', array_map('intval', array_keys($_POST['d']))) : '';