From c941f666cf5184b508589fc151772f42f1a2d4c5 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 13 Oct 2004 19:30:02 +0000 Subject: [PATCH] - ucp register/remind/activate fixes mostly regarding account activation - general ucp fixing (profile and ucp_main) - created three new functions (return correct topic author string, generate topic related pagination and get topic type/status...). These general bits are used on several pages (subscribed topics, bookmarks, viewforum). - config basic schema fix - commented out inline fix for unread topic tracking in viewforum, instead tried another method (hopefully working as well) git-svn-id: file:///svn/phpbb/trunk@5001 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_display.php | 137 +++++++++++ phpBB/includes/ucp/ucp_activate.php | 31 ++- phpBB/includes/ucp/ucp_main.php | 228 +++++++----------- phpBB/includes/ucp/ucp_prefs.php | 14 +- phpBB/includes/ucp/ucp_profile.php | 39 +-- phpBB/includes/ucp/ucp_register.php | 18 +- phpBB/includes/ucp/ucp_remind.php | 12 +- phpBB/includes/ucp/ucp_zebra.php | 3 +- phpBB/install/schemas/schema_data.sql | 2 +- phpBB/language/en/common.php | 3 + phpBB/language/en/posting.php | 2 - .../template/ucp_main_bookmarks.html | 15 +- .../subSilver/template/ucp_main_drafts.html | 7 +- .../template/ucp_main_subscribed.html | 29 ++- .../template/ucp_profile_reg_details.html | 2 +- .../styles/subSilver/template/ucp_remind.html | 6 +- phpBB/viewforum.php | 179 +++----------- 17 files changed, 392 insertions(+), 335 deletions(-) diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 3e6a511c62..a37b9c77be 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -340,6 +340,143 @@ function display_forums($root_data = '', $display_moderators = TRUE) return $active_forum_ary; } +function topic_topic_author(&$topic_row) +{ + global $phpEx, $SID, $phpbb_root_path, $user; + + $topic_author = ($topic_row['topic_poster'] != ANONYMOUS) ? "' : ''; + $topic_author .= ($topic_row['topic_poster'] != ANONYMOUS) ? $topic_row['topic_first_poster_name'] : (($topic_row['topic_first_poster_name'] != '') ? $topic_row['topic_first_poster_name'] : $user->lang['GUEST']); + $topic_author .= ($topic_row['topic_poster'] != ANONYMOUS) ? '' : ''; + + return $topic_author; +} + +function topic_generate_pagination($replies, $url) +{ + global $config, $user; + + if (($replies + 1) > $config['posts_per_page']) + { + $total_pages = ceil(($replies + 1) / $config['posts_per_page']); + $pagination = ''; + + $times = 1; + for ($j = 0; $j < $replies + 1; $j += $config['posts_per_page']) + { + $pagination .= "$times"; + if ($times == 1 && $total_pages > 4) + { + $pagination .= ' ... '; + $times = $total_pages - 3; + $j += ($total_pages - 4) * $config['posts_per_page']; + } + else if ($times < $total_pages) + { + $pagination .= $user->theme['primary']['pagination_sep']; + } + $times++; + } + } + else + { + $pagination = ''; + } + + return $pagination; +} + +function topic_status(&$topic_row, $replies, $mark_time_topic, $mark_time_forum, &$folder_img, &$folder_alt, &$topic_type) +{ + global $user, $config; + + $folder = $folder_new = ''; + $unread_topic = false; + + if ($topic_row['topic_status'] == ITEM_MOVED) + { + $topic_type = $user->lang['VIEW_TOPIC_MOVED']; + $folder_img = 'folder_moved'; + $folder_alt = 'VIEW_TOPIC_MOVED'; + } + else + { + switch ($topic_row['topic_type']) + { + case POST_GLOBAL: + case POST_ANNOUNCE: + $topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT']; + $folder = 'folder_announce'; + $folder_new = 'folder_announce_new'; + break; + + case POST_STICKY: + $topic_type = $user->lang['VIEW_TOPIC_STICKY']; + $folder = 'folder_sticky'; + $folder_new = 'folder_sticky_new'; + break; + + default: + if ($replies >= $config['hot_threshold']) + { + $folder = 'folder_hot'; + $folder_new = 'folder_hot_new'; + } + else + { + $folder = 'folder'; + $folder_new = 'folder_new'; + } + break; + } + + if ($topic_row['topic_status'] == ITEM_LOCKED) + { + $topic_type = $user->lang['VIEW_TOPIC_LOCKED']; + $folder = 'folder_locked'; + $folder_new = 'folder_locked_new'; + } + + if ($user->data['user_id'] != ANONYMOUS) + { + $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'])) + { + $folder_img .= '_posted'; + } + } + + if ($topic_row['poll_start']) + { + $topic_type .= $user->lang['VIEW_TOPIC_POLL']; + } + + return $unread_topic; +} + // Display Attachments function display_attachments($forum_id, $blockname, &$attachment_data, &$update_count, $force_physical = false, $return = false) { diff --git a/phpBB/includes/ucp/ucp_activate.php b/phpBB/includes/ucp/ucp_activate.php index d50b87bf52..0892ebbb08 100644 --- a/phpBB/includes/ucp/ucp_activate.php +++ b/phpBB/includes/ucp/ucp_activate.php @@ -42,23 +42,34 @@ class ucp_activate extends module trigger_error($user->lang['WRONG_ACTIVATION']); } - $sql_update_pass = ($row['user_newpasswd']) ? ", user_password = '" . $db->sql_escape($row['user_newpasswd']) . "', user_newpasswd = ''" : ''; + $update_password = ($row['user_newpasswd']) ? true : false; - $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_type = ' . USER_NORMAL . ", user_actkey = '$sql_update_pass' - WHERE user_id = {$row['user_id']}"; + $sql_ary = array( + 'user_type' => USER_NORMAL, + 'user_actkey' => '' + ); + + if ($update_password) + { + $sql_ary += array( + 'user_password' => $row['user_newpasswd'], + 'user_newpasswd' => '' + ); + } + + $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $row['user_id']; $result = $db->sql_query($sql); - if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $sql_update_pass) + if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password) { include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx); $messenger = new messenger(); $messenger->template('admin_welcome_activated', $row['user_lang']); - $messenger->subject($subject); - $messenger->replyto($user->data['board_contact']); + $messenger->replyto($config['board_contact']); $messenger->to($row['user_email'], $row['username']); $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); @@ -69,7 +80,7 @@ class ucp_activate extends module $messenger->assign_vars(array( 'SITENAME' => $config['sitename'], 'USERNAME' => $row['username'], - 'PASSWORD' => $password_confirm, + 'EMAIL_SIG' => str_replace('
', "\n", "-- \n" . $config['board_email_sig'])) ); @@ -80,10 +91,10 @@ class ucp_activate extends module } else { - $message = (!$sql_update_pass) ? 'ACCOUNT_ACTIVE' : 'PASSWORD_ACTIVATED'; + $message = (!$update_password) ? 'ACCOUNT_ACTIVE' : 'PASSWORD_ACTIVATED'; } - if (!$sql_update_pass) + if (!$update_password) { set_config('newest_user_id', $row['user_id']); set_config('newest_username', $row['username']); diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 7a95c9dfff..3e08d4686d 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -277,7 +277,12 @@ class ucp_main extends module case 'subscribed': - if ($_POST['unwatch']) + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + $user->add_lang('viewforum'); + + $unwatch = (isset($_POST['unwatch'])) ? true : false; + + if ($unwatch) { $forums = (isset($_POST['f'])) ? implode(', ', array_map('intval', array_keys($_POST['f']))) : false; $topics = (isset($_POST['t'])) ? implode(', ', array_map('intval', array_keys($_POST['t']))) : false; @@ -305,9 +310,9 @@ class ucp_main extends module $l_unwatch .= '_TOPICS'; } - $message = $user->lang['UNWATCHED' . $l_unwatch] . '

' . sprintf($user->lang['RETURN_UCP'], "", ''); + $message = $user->lang['UNWATCHED' . $l_unwatch] . '

' . sprintf($user->lang['RETURN_UCP'], "", ''); - meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=watched"); + meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=subscribed"); trigger_error($message); } } @@ -396,137 +401,102 @@ class ucp_main extends module // Subscribed Topics + $start = request_var('start', 0); + + $sql = 'SELECT COUNT(topic_id) as topics_count + FROM ' . TOPICS_WATCH_TABLE . ' + WHERE user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + $topics_count = (int) $db->sql_fetchfield('topics_count', 0, $result); + $db->sql_freeresult($result); + + if ($topics_count) + { + $template->assign_vars(array( + 'PAGINATION' => generate_pagination("ucp.$phpEx$SID&i=$id&mode=$mode", $topics_count, $config['topics_per_page'], $start), + 'PAGE_NUMBER' => on_page($topics_count, $config['topics_per_page'], $start), + 'TOTAL_TOPICS' => ($topics_count == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $topics_count)) + ); + } + $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_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_select = ($config['load_db_lastread']) ? ', ft.mark_time AS forum_mark_time' : ''; + $sql = "SELECT t.* $sql_f_select $sql_t_select - FROM $sql_from, " . TOPICS_WATCH_TABLE . ' tw + FROM $sql_from $sql_f_tracking " . TOPICS_WATCH_TABLE . ' tw WHERE tw.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tw.topic_id ORDER BY t.topic_last_post_time DESC'; - $result = $db->sql_query_limit($sql, $config['topics_per_page']); + $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); while ($row = $db->sql_fetchrow($result)) { - $forum_id = $row['forum_id']; $topic_id = $row['topic_id']; - - // Goto message generation - $replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies']; + $forum_id = $row['forum_id']; - $topic_type = ''; - switch ($row['topic_type']) + if ($config['load_db_lastread']) { - case POST_ANNOUNCE: - $topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT']; - $folder = 'folder_announce'; - $folder_new = 'folder_announce_new'; - break; - - case POST_STICKY: - $topic_type = $user->lang['VIEW_TOPIC_STICKY']; - $folder = 'folder_sticky'; - $folder_new = 'folder_sticky_new'; - break; - - default: - if ($replies >= intval($config['hot_threshold'])) - { - $folder = 'folder_hot'; - $folder_new = 'folder_hot_new'; - } - else - { - $folder = 'folder'; - $folder_new = 'folder_new'; - } - break; - } - - if ($row['topic_status'] == ITEM_LOCKED) - { - $topic_type = $user->lang['VIEW_TOPIC_LOCKED']; - $folder = 'folder_locked'; - $folder_new = 'folder_locked_new'; - } - - $unread_topic = ($user->data['user_id'] != ANONYMOUS) ? true : false; - if ($user->data['user_id'] != ANONYMOUS) - { - $topic_check = (!$config['load_db_lastread']) ? ((isset($tracking_topics[$forum_id][base_convert($topic_id, 10, 36)])) ? base_convert($tracking_topics[$forum_id36][$topic_id36], 36, 10) + $config['board_startdate'] : 0) : $row['mark_time']; - $forum_check = (!$config['load_db_lastread']) ? ((isset($tracking_topics[$forum_id][0])) ? base_convert($tracking_topics[$forum_id][0], 36, 10) + $config['board_startdate'] : 0) : $row['forum_mark_time']; - - 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') . ' ' : ''; - $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'])) - { - $folder_img .= '_posted'; - } - - if (($replies + 1) > $config['posts_per_page']) - { - $total_pages = ceil(($replies + 1) / $config['posts_per_page']); - $goto_page = ' [ ' . $user->img('icon_post', 'GOTO_PAGE') . $user->lang['GOTO_PAGE'] . ': '; - - $times = 1; - for($j = 0; $j < $replies + 1; $j += $config['posts_per_page']) - { - $goto_page .= "$times"; - if ($times == 1 && $total_pages > 4) - { - $goto_page .= ' ... '; - $times = $total_pages - 3; - $j += ($total_pages - 4) * $config['posts_per_page']; - } - else if ($times < $total_pages) - { - $goto_page .= ', '; - } - $times++; - } - $goto_page .= ' ] '; + $mark_time_topic = ($user->data['user_id'] != ANONYMOUS) ? $row['mark_time'] : 0; + $mark_time_forum = $row['forum_mark_time']; } else { - $goto_page = ''; + $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; + + $mark_time_forum = (isset($tracking_topics[$forum_id][0])) ? base_convert($tracking_topics[$forum_id][0], 36, 10) + $config['board_startdate'] : 0; } + // Replies + $replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies']; + + if ($row['topic_status'] == ITEM_MOVED) + { + $topic_id = $row['topic_moved_id']; + } + + // 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); + + $newest_post_img = ($unread_topic) ? "" . $user->img('icon_post_newest', 'VIEW_NEWEST_POST') . ' ' : ''; + $view_topic_url = "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id"; - - $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'] . ''; - + + // Send vars to template $template->assign_block_vars('topicrow', array( 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, + 'TOPIC_AUTHOR' => topic_topic_author($row), + 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), - 'LAST_POST_AUTHOR' => $last_post_author, - 'GOTO_PAGE' => $goto_page, + 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), + 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] : $user->lang['GUEST'], + 'PAGINATION' => topic_generate_pagination($replies, "viewtopic.$phpEx$SID&f=" . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . "&t=$topic_id"), + 'REPLIES' => $replies, + 'VIEWS' => $row['topic_views'], 'TOPIC_TITLE' => censor_text($row['topic_title']), 'TOPIC_TYPE' => $topic_type, - 'LAST_POST_IMG' => $last_post_img, + 'LAST_POST_IMG' => $user->img('icon_post_latest', 'VIEW_LATEST_POST'), 'NEWEST_POST_IMG' => $newest_post_img, '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', '') : '', + 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? '' : '', + 'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_attach', sprintf($user->lang['TOTAL_ATTACHMENTS'], $row['topic_attachment'])) : '', - 'S_USER_POSTED' => (!empty($row['mark_type'])) ? true : false, + 'S_TOPIC_TYPE' => $row['topic_type'], + 'S_USER_POSTED' => (!empty($row['mark_type'])) ? true : false, + 'S_UNREAD_TOPIC' => $unread_topic, + 'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'], + 'U_LAST_POST_AUTHOR'=> ($row['topic_last_poster_id'] != ANONYMOUS && $row['topic_last_poster_id']) ? "memberlist.$phpEx$SID&mode=viewprofile&u={$row['topic_last_poster_id']}" : '', 'U_VIEW_TOPIC' => $view_topic_url) ); + } $db->sql_freeresult($result); @@ -542,6 +512,9 @@ class ucp_main extends module break; } + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + $user->add_lang('viewforum'); + $move_up = request_var('move_up', 0); $move_down = request_var('move_down', 0); @@ -634,40 +607,12 @@ class ucp_main extends module $replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies']; - $topic_type = ''; - switch ($row['topic_type']) - { - case POST_ANNOUNCE: - $topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT']; - $folder = 'folder_announce'; - break; + // Get folder img, topic status/type related informations + $folder_img = $folder_alt = $topic_type = ''; + $unread_topic = topic_status($row, $replies, time(), time(), $folder_img, $folder_alt, $topic_type); - case POST_STICKY: - $topic_type = $user->lang['VIEW_TOPIC_STICKY']; - $folder = 'folder_sticky'; - break; - - default: - if ($replies >= intval($config['hot_threshold'])) - { - $folder = 'folder_hot'; - } - else - { - $folder = 'folder'; - } - break; - } - - if ($row['topic_status'] == ITEM_LOCKED) - { - $topic_type = $user->lang['VIEW_TOPIC_LOCKED']; - $folder = 'folder_locked'; - } - - $folder_alt = ($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'TOPIC'; $view_topic_url = "viewtopic.$phpEx$SID&f=$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') . ''; $template->assign_block_vars('topicrow', array( 'FORUM_ID' => $forum_id, @@ -676,13 +621,24 @@ class ucp_main extends module 'TOPIC_TITLE' => censor_text($row['topic_title']), 'TOPIC_TYPE' => $topic_type, 'FORUM_NAME' => $row['forum_name'], + + 'TOPIC_AUTHOR' => topic_topic_author($row), + 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), + 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), + 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] : $user->lang['GUEST'], + 'PAGINATION' => topic_generate_pagination($replies, "viewtopic.$phpEx$SID&f=" . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . "&t=$topic_id"), + 'POSTED_AT' => $user->format_date($row['topic_time']), - 'TOPIC_FOLDER_IMG' => $user->img($folder, $folder_alt), + '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', '') : '', + 'LAST_POST_IMG' => $user->img('icon_post_latest', 'VIEW_LATEST_POST'), + 'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'], + 'U_LAST_POST_AUTHOR'=> ($row['topic_last_poster_id'] != ANONYMOUS && $row['topic_last_poster_id']) ? "memberlist.$phpEx$SID&mode=viewprofile&u={$row['topic_last_poster_id']}" : '', 'U_VIEW_TOPIC' => $view_topic_url, - 'U_VIEW_FORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&f={$row['forum_id']}", + 'U_VIEW_FORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&f=$forum_id}", 'U_MOVE_UP' => ($row['order_id'] != 1) ? "{$phpbb_root_path}ucp.$phpEx$SID&i=main&mode=bookmarks&move_up={$row['order_id']}" : '', 'U_MOVE_DOWN' => ($row['order_id'] != $max_order_id) ? "{$phpbb_root_path}ucp.$phpEx$SID&i=main&mode=bookmarks&move_down={$row['order_id']}" : '') ); diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index a463df778a..27002cbeaf 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -21,7 +21,7 @@ class ucp_prefs extends module $error = $data = array(); $s_hidden_fields = ''; - switch($mode) + switch ($mode) { case 'personal': @@ -40,10 +40,9 @@ class ucp_prefs extends module 'notifypm' => true, 'popuppm' => false, 'allowpm' => true, + 'report_pm_notify' => false ); - $var_ary['report_pm_notify'] = false; - foreach ($var_ary as $var => $default) { $data[$var] = request_var($var, $default); @@ -89,6 +88,9 @@ class ucp_prefs extends module $message = $user->lang['PREFERENCES_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], "", ''); trigger_error($message); } + + // Replace "error" strings with their real, localised form + $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); } $viewemail = (isset($viewemail)) ? $viewemail : $user->data['user_allow_viewemail']; @@ -214,6 +216,9 @@ class ucp_prefs extends module $message = $user->lang['PREFERENCES_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], "", ''); trigger_error($message); } + + // Replace "error" strings with their real, localised form + $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); } $sk = (isset($sk)) ? $sk : ((!empty($user->data['user_sortby_type'])) ? $user->data['user_sortby_type'] : 't'); @@ -310,6 +315,9 @@ class ucp_prefs extends module $message = $user->lang['PREFERENCES_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], "", ''); trigger_error($message); } + + // Replace "error" strings with their real, localised form + $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); } $bbcode = (isset($bbcode)) ? $bbcode : $user->optionget('bbcode'); diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index f4e963daae..db07ca48d7 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -23,6 +23,7 @@ class ucp_profile extends module $submit = (!empty($_POST['submit'])) ? true : false; $delete = (!empty($_POST['delete'])) ? true : false; $error = $data = array(); + $s_hidden_fields = ''; switch ($mode) { @@ -47,13 +48,13 @@ class ucp_profile extends module $var_ary = array( 'username' => array( array('string', false, $config['min_name_chars'], $config['max_name_chars']), - array('username', $username)), + array('username', $data['username'])), 'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), 'new_password' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), 'cur_password' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), 'email' => array( array('string', false, 6, 60), - array('email', $email)), + array('email', $data['email'])), 'email_confirm' => array('string', true, 6, 60), ); @@ -99,10 +100,10 @@ class ucp_profile extends module $messenger = new messenger(); - $messenger->template($email_template, $lang); - $messenger->subject($subject); + $template_file = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? 'user_activate_inactive' : 'user_activate'; + $messenger->template($template_file, $user->data['user_lang']); - $messenger->replyto($user->data['board_contact']); + $messenger->replyto($config['board_contact']); $messenger->to($email, $username); $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); @@ -112,12 +113,10 @@ class ucp_profile extends module $messenger->assign_vars(array( 'SITENAME' => $config['sitename'], - 'WELCOME_MSG' => sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename']), 'USERNAME' => $username, - 'PASSWORD' => $password_confirm, 'EMAIL_SIG' => str_replace('
', "\n", "-- \n" . $config['board_email_sig']), - 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&k=$user_actkey") + 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey") ); $messenger->send(NOTIFY_EMAIL); @@ -127,23 +126,23 @@ class ucp_profile extends module // Grab an array of user_id's with a_user permissions $admin_ary = $auth->acl_get_list(false, 'a_user', false); - $sql = 'SELECT user_id, username, user_email, user_jabber, user_notify_type + $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type FROM ' . USERS_TABLE . ' WHERE user_id IN (' . implode(', ', $admin_ary[0]['a_user']) .')'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { - $messenger->use_template('admin_activate', $row['user_lang']); + $messenger->template('admin_activate', $row['user_lang']); $messenger->replyto($config['board_contact']); $messenger->to($row['user_email'], $row['username']); $messenger->im($row['user_jabber'], $row['username']); $messenger->assign_vars(array( - 'USERNAME' => $row['username'], + 'USERNAME' => $username, 'EMAIL_SIG' => str_replace('
', "\n", "-- \n" . $config['board_email_sig']), - 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&k=$user_actkey") + 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey") ); $messenger->send($row['user_notify_type']); @@ -174,6 +173,9 @@ class ucp_profile extends module $message = $user->lang['PROFILE_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], "", ''); trigger_error($message); } + + // Replace "error" strings with their real, localised form + $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); } $user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\w]+' => 'USERNAME_ALPHA_ONLY', '[\w_\+\. \-\[\]]+' => 'USERNAME_ALPHA_SPACERS'); @@ -304,6 +306,9 @@ class ucp_profile extends module $message = $user->lang['PROFILE_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], "", ''); trigger_error($message); } + + // Replace "error" strings with their real, localised form + $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); } if (!isset($bday_day)) @@ -364,8 +369,6 @@ class ucp_profile extends module include($phpbb_root_path . 'includes/functions_posting.'.$phpEx); - $s_hidden_fields = ''; - $var_ary = array( 'enable_html' => (bool) $config['allow_html'], 'enable_bbcode' => (bool) $config['allow_bbcode'], @@ -394,7 +397,7 @@ class ucp_profile extends module if (strlen($signature) > $config['max_sig_chars']) { - $error[] = $user->lang['SIGNATURE_TOO_LONG']; + $error[] = 'SIGNATURE_TOO_LONG'; } if (!sizeof($error)) @@ -426,6 +429,9 @@ class ucp_profile extends module trigger_error($message); } } + + // Replace "error" strings with their real, localised form + $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); } $signature_preview = ''; @@ -468,7 +474,6 @@ class ucp_profile extends module $category = request_var('category', ''); $delete = (isset($_POST['delete'])) ? true : false; $avatarselect = request_var('avatarselect', ''); - $s_hidden_fields = ''; // Can we upload? $can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && is_writeable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; @@ -553,7 +558,7 @@ class ucp_profile extends module unset($data); // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$lang['\\1'])) ? \$lang['\\1'] : '\\1'", $error); + $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); } // Generate users avatar diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index cd188cd383..be29709ca7 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -154,6 +154,19 @@ class ucp_register extends module } } + if (!sizeof($error)) + { + if ($new_password != $password_confirm) + { + $error[] = 'NEW_PASSWORD_ERROR'; + } + + if ($email != $email_confirm) + { + $error[] = 'NEW_EMAIL_ERROR'; + } + } + if (!sizeof($error)) { $server_url = generate_board_url(); @@ -262,7 +275,6 @@ class ucp_register extends module $messenger = new messenger(); $messenger->template($email_template, $lang); - $messenger->subject($subject); $messenger->replyto($config['board_contact']); $messenger->to($email, $username); @@ -300,7 +312,7 @@ class ucp_register extends module // can activate a user $admin_ary = $auth->acl_get_list(false, 'a_user', false); - $sql = 'SELECT user_id, username, user_email, user_jabber, user_notify_type + $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type FROM ' . USERS_TABLE . ' WHERE user_id IN (' . implode(', ', $admin_ary[0]['a_user']) .')'; $result = $db->sql_query($sql); @@ -313,7 +325,7 @@ class ucp_register extends module $messenger->im($row['user_jabber'], $row['username']); $messenger->assign_vars(array( - 'USERNAME' => $row['username'], + 'USERNAME' => $username, 'EMAIL_SIG' => str_replace('
', "\n", "-- \n" . $config['board_email_sig']), 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey") diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index f119633c82..ae6ce3c27c 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -28,20 +28,17 @@ class ucp_remind extends module FROM ' . USERS_TABLE . " WHERE user_email = '" . $db->sql_escape($email) . "' AND username = '" . $db->sql_escape($username) . "'"; - if (!($result = $db->sql_query($sql))) - { - trigger_error($user->lang['NO_USER']); - } + $result = $db->sql_query($sql); if (!($row = $db->sql_fetchrow($result))) { - trigger_error($lang['NO_EMAIL']); + trigger_error('NO_EMAIL_USER'); } $db->sql_freeresult($result); if ($row['user_type'] == USER_INACTIVE) { - trigger_error($lang['ACCOUNT_INACTIVE']); + trigger_error('ACCOUNT_NOT_ACTIVATED'); } $server_url = generate_board_url(); @@ -49,7 +46,7 @@ class ucp_remind extends module $user_id = $row['user_id']; $key_len = 54 - strlen($server_url); - $key_len = ($str_len > 6) ? $key_len : 6; + $key_len = ($key_len > 6) ? $key_len : 6; $user_actkey = substr(gen_rand_string(10), 0, $key_len); $user_password = gen_rand_string(8); @@ -63,7 +60,6 @@ class ucp_remind extends module $messenger = new messenger(); $messenger->template('user_activate_passwd', $row['user_lang']); - $messenger->subject($subject); $messenger->replyto($user->data['user_email']); $messenger->to($row['user_email'], $row['username']); diff --git a/phpBB/includes/ucp/ucp_zebra.php b/phpBB/includes/ucp/ucp_zebra.php index d71527b579..b93c01a370 100644 --- a/phpBB/includes/ucp/ucp_zebra.php +++ b/phpBB/includes/ucp/ucp_zebra.php @@ -18,6 +18,7 @@ class ucp_zebra extends module global $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx; $submit = (!empty($_POST['submit']) || !empty($_GET['add'])) ? true : false; + $s_hidden_fields = ''; if ($submit) { @@ -174,7 +175,7 @@ class ucp_zebra extends module $db->sql_freeresult($result); $template->assign_vars(array( - 'L_TITLE' => $user->lang['UCP_' . strtoupper($mode)], + 'L_TITLE' => $user->lang['UCP_ZEBRA_' . strtoupper($mode)], 'U_SEARCH_USER' => "memberlist.$phpEx$SID&mode=searchuser&form=ucp&field=add", diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 8b22f250e0..3d260fcb4c 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -21,7 +21,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_uploa INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_nocensors','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_emailreuse','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bookmarks','1'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_name_chars','.*?'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_name_chars','.*'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable','0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable_msg',''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_dst','0'); diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 1477a207ab..3c3dddf337 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -262,6 +262,8 @@ $lang += array( 'PM' => 'PM', 'POSTING_MESSAGE' => 'Posting message in %s', 'POST' => 'Post', + 'POST_ANNOUNCEMENT' => 'Announce', + 'POST_STICKY' => 'Sticky', 'POSTED' => 'Posted', 'POSTS' => 'Posts', 'POST_BY_FOE' => 'This post was made by %1$s who is currently on your ignore list. To display this post click %2$sHERE%3$s.', @@ -367,6 +369,7 @@ $lang += array( 'TOPICS' => 'Topics', 'TOPIC_ICON' => 'Topic icon', 'TOPIC_LOCKED' => 'This topic is locked you cannot edit posts or make replies', + 'TOPIC_MOVED' => 'Moved Topic', 'TOPIC_TITLE' => 'Topic Title', 'TOPIC_UNAPPROVED' => 'This topic has not been approved', 'TOTAL_ATTACHMENTS' => '%d Attachments', diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index e6c86acdee..23d142d9b7 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -139,7 +139,6 @@ $lang += array( 'POLL_VOTE_CHANGE' => 'Allow Vote Change', 'POLL_VOTE_CHANGE_EXPLAIN' => 'If enabled users are able to change their vote.', 'POSTED_ATTACHMENTS' => 'Posted attachments', - 'POST_ANNOUNCEMENT' => 'Announce', 'POST_DELETED' => 'Your message has been deleted successfully', 'POST_EDITED' => 'Your message has been edited successfully', 'POST_EDITED_MOD' => 'Your message has been edited but requires approval', @@ -149,7 +148,6 @@ $lang += array( 'POST_REPLY' => 'Post a reply', 'POST_REVIEW' => 'Post Review', 'POST_REVIEW_EXPLAIN' => 'At least one new post has been made to this topic. You may wish to review your post inlight of this.', - 'POST_STICKY' => 'Sticky', 'POST_STORED' => 'Your message has been posted successfully', 'POST_STORED_MOD' => 'Your message has been saved but requires approval', 'POST_TOPIC' => 'Post a new topic', diff --git a/phpBB/styles/subSilver/template/ucp_main_bookmarks.html b/phpBB/styles/subSilver/template/ucp_main_bookmarks.html index bbf40c678b..95532fb992 100644 --- a/phpBB/styles/subSilver/template/ucp_main_bookmarks.html +++ b/phpBB/styles/subSilver/template/ucp_main_bookmarks.html @@ -26,8 +26,19 @@ {L_DELETED_TOPIC} -

{topicrow.ATTACH_ICON_IMG}{topicrow.TOPIC_TYPE}{topicrow.TOPIC_TITLE}


{L_FORUM}: {topicrow.FORUM_NAME} - {L_POSTED}:
{topicrow.POSTED_AT} + +

{topicrow.ATTACH_ICON_IMG} {topicrow.TOPIC_TITLE}


+ {L_FORUM}: {topicrow.FORUM_NAME} + +

[ {GOTO_PAGE_IMG}{L_GOTO_PAGE}: {topicrow.PAGINATION} ]

+ + + +

{topicrow.LAST_POST_TIME}

+

{topicrow.LAST_POST_AUTHOR}{topicrow.LAST_POST_AUTHOR} + {topicrow.LAST_POST_IMG} +

+ {L_MOVE_UP} | {L_MOVE_DOWN} diff --git a/phpBB/styles/subSilver/template/ucp_main_drafts.html b/phpBB/styles/subSilver/template/ucp_main_drafts.html index 3d844bf2fb..433e5c252f 100644 --- a/phpBB/styles/subSilver/template/ucp_main_drafts.html +++ b/phpBB/styles/subSilver/template/ucp_main_drafts.html @@ -31,14 +31,15 @@ - {draftrow.DATE} - {draftrow.DRAFT_SUBJECT} + {draftrow.DATE} + +

{draftrow.DRAFT_SUBJECT}


{L_TOPIC}: {draftrow.TITLE}
{L_FORUM}: {draftrow.TITLE}
{L_PRIVATE_MESSAGE}
{L_NO_TOPIC_FORUM} - {L_LOAD_DRAFT}
{L_VIEW_EDIT} + {L_LOAD_DRAFT}
{L_VIEW_EDIT} diff --git a/phpBB/styles/subSilver/template/ucp_main_subscribed.html b/phpBB/styles/subSilver/template/ucp_main_subscribed.html index 2d282a1355..f2d43563a4 100644 --- a/phpBB/styles/subSilver/template/ucp_main_subscribed.html +++ b/phpBB/styles/subSilver/template/ucp_main_subscribed.html @@ -22,7 +22,7 @@ {forumrow.FORUM_FOLDER_IMG} - {forumrow.FORUM_NAME}
+

{forumrow.FORUM_NAME}

{forumrow.LAST_POST_TIME}
{forumrow.LAST_POST_AUTHOR}{forumrow.LAST_POST_AUTHOR} {forumrow.LAST_POST_IMG}{L_NO_POSTS} @@ -36,6 +36,20 @@ {L_WATCHED_TOPICS} + + + + + + + + + +
 [ {TOTAL_TOPICS} ] {L_GOTO_PAGE} {L_PREVIOUS}  {PAGINATION}  {L_NEXT}
+ + + + @@ -45,8 +59,17 @@ {topicrow.TOPIC_FOLDER_IMG} - {topicrow.NEWEST_POST_IMG}{topicrow.ATTACH_ICON_IMG}{topicrow.TOPIC_TYPE}{topicrow.TOPIC_TITLE}
{topicrow.GOTO_PAGE}
- {topicrow.LAST_POST_TIME}
{topicrow.LAST_POST_AUTHOR} {topicrow.LAST_POST_IMG} + +

{topicrow.NEWEST_POST_IMG} {topicrow.ATTACH_ICON_IMG} {topicrow.TOPIC_TITLE}


+ +

[ {GOTO_PAGE_IMG}{L_GOTO_PAGE}: {topicrow.PAGINATION} ]

+ + +

{topicrow.LAST_POST_TIME}

+

{topicrow.LAST_POST_AUTHOR}{topicrow.LAST_POST_AUTHOR} + {topicrow.LAST_POST_IMG} +

+ diff --git a/phpBB/styles/subSilver/template/ucp_profile_reg_details.html b/phpBB/styles/subSilver/template/ucp_profile_reg_details.html index 34cf8179ad..5f8fc037ad 100644 --- a/phpBB/styles/subSilver/template/ucp_profile_reg_details.html +++ b/phpBB/styles/subSilver/template/ucp_profile_reg_details.html @@ -27,7 +27,7 @@ {L_CONFIRM_EMAIL}:
{L_CONFIRM_EMAIL_EXPLAIN} - + diff --git a/phpBB/styles/subSilver/template/ucp_remind.html b/phpBB/styles/subSilver/template/ucp_remind.html index 2b66fec589..ae467d1d66 100644 --- a/phpBB/styles/subSilver/template/ucp_remind.html +++ b/phpBB/styles/subSilver/template/ucp_remind.html @@ -1,10 +1,6 @@ -
- - - -
+ diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index ddc41db941..3ee2f38464 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -15,6 +15,7 @@ define('IN_PHPBB', true); $phpbb_root_path = './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.'.$phpEx); +include($phpbb_root_path . 'includes/functions_display.' . $phpEx); // Start session $user->start(); @@ -25,9 +26,9 @@ $forum_id = request_var('f', 0); $mark_read = request_var('mark', ''); $start = request_var('start', 0); -$sort_days = (isset($_REQUEST['st'])) ? max(intval($_REQUEST['st']), 0) : ((!empty($user->data['user_show_days'])) ? $user->data['user_show_days'] : 0); -$sort_key = (!empty($_REQUEST['sk'])) ? htmlspecialchars($_REQUEST['sk']) : ((!empty($user->data['user_sortby_type'])) ? $user->data['user_sortby_type'] : 't'); -$sort_dir = (!empty($_REQUEST['sd'])) ? htmlspecialchars($_REQUEST['sd']) : ((!empty($user->data['user_sortby_dir'])) ? $user->data['user_sortby_dir'] : 'd'); +$sort_days = request_var('st', ((!empty($user->data['user_show_days'])) ? $user->data['user_show_days'] : 0)); +$sort_key = request_var('sk', ((!empty($user->data['user_sortby_type'])) ? $user->data['user_sortby_type'] : 't')); +$sort_dir = request_var('sd', ((!empty($user->data['user_sortby_dir'])) ? $user->data['user_sortby_dir'] : 'd')); // Check if the user has actually sent a forum ID with his/her request // If not give them a nice error page. @@ -150,7 +151,6 @@ $active_forum_ary = $moderators = array(); if ($forum_data['left_id'] != $forum_data['right_id'] - 1) { - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); $active_forum_ary = display_forums($forum_data); } else @@ -372,7 +372,7 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16) ORDER BY t.topic_type DESC, $sql_sort_order"; $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); - while($row = $db->sql_fetchrow($result)) + while ($row = $db->sql_fetchrow($result)) { $rowset[$row['topic_id']] = $row; $topic_list[] = $row['topic_id']; @@ -398,7 +398,7 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16) $s_type_switch = 0; foreach ($topic_list as $topic_id) { - $row =& $rowset[$topic_id]; + $row = &$rowset[$topic_id]; if ($config['load_db_lastread']) { @@ -407,150 +407,43 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16) else { $topic_id36 = base_convert($topic_id, 10, 36); - $forum_id36 = ($row['topic_type'] == POST_GLOBAL) ? 0 : $row['forum_id']; + $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; } - // Replies - $replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies']; - - // Topic type/folder - $topic_type = ''; - if ($row['topic_status'] == ITEM_MOVED) - { - $topic_type = $user->lang['VIEW_TOPIC_MOVED']; - $topic_id = $row['topic_moved_id']; - - $folder_img = 'folder_moved'; - $folder_alt = 'Topic_Moved'; - $newest_post_img = ''; - } - else - { - switch ($row['topic_type']) - { - case POST_GLOBAL: - case POST_ANNOUNCE: - $topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT']; - $folder = 'folder_announce'; - $folder_new = 'folder_announce_new'; - break; - - case POST_STICKY: - $topic_type = $user->lang['VIEW_TOPIC_STICKY']; - $folder = 'folder_sticky'; - $folder_new = 'folder_sticky_new'; - break; - - default: - if ($replies >= $config['hot_threshold']) - { - $folder = 'folder_hot'; - $folder_new = 'folder_hot_new'; - } - else - { - $folder = 'folder'; - $folder_new = 'folder_new'; - } - break; - } - - if ($row['topic_status'] == ITEM_LOCKED) - { - $topic_type = $user->lang['VIEW_TOPIC_LOCKED']; - $folder = 'folder_locked'; - $folder_new = 'folder_locked_new'; - } - - if ($user->data['user_id'] != ANONYMOUS) - { - $unread_topic = $new_votes = true; - - if ($mark_time_topic >= $row['topic_last_post_time'] || $mark_time_forum >= $row['topic_last_post_time'] || ($row['topic_last_post_time'] == $row['poll_last_vote'] && $replies)) - { - $unread_topic = false; - } -/* - if ($row['poll_start'] && ($mark_time_topic >= $row['poll_last_vote'] || $mark_time_forum >= $row['poll_last_vote'])) - { - $new_votes = false; - }*/ - } - else - { - $unread_topic = $new_votes = false; - } - -// $folder_new .= ($new_votes) ? '_vote' : ''; - - $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'])) - { - $folder_img .= '_posted'; - } - } - - if (!$row['poll_start']) - { - $topic_type .= $user->lang['VIEW_TOPIC_POLL']; - } - - // Goto message generation - if (($replies + 1) > $config['posts_per_page']) - { - $total_pages = ceil(($replies + 1) / $config['posts_per_page']); - $pagination = ''; - - $times = 1; - for($j = 0; $j < $replies + 1; $j += $config['posts_per_page']) - { - $pagination .= "$times"; - if ($times == 1 && $total_pages > 4) - { - $pagination .= ' ... '; - $times = $total_pages - 3; - $j += ($total_pages - 4) * $config['posts_per_page']; - } - else if ($times < $total_pages) - { - $pagination .= $user->theme['primary']['pagination_sep']; - } - $times++; - } - } - else - { - $pagination = ''; - } - - // Generate all the URIs ... - $view_topic_url = "viewtopic.$phpEx$SID&f=" . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . "&t=$topic_id"; - - $topic_author = ($row['topic_poster'] != ANONYMOUS) ? "' : ''; - $topic_author .= ($row['topic_poster'] != ANONYMOUS) ? $row['topic_first_poster_name'] : (($row['topic_first_poster_name'] != '') ? $row['topic_first_poster_name'] : $user->lang['GUEST']); - $topic_author .= ($row['topic_poster'] != ANONYMOUS) ? '' : ''; - // This will allow the style designer to output a different header // or even seperate the list of announcements from sticky and normal // topics $s_type_switch_test = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0; + // Replies + $replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies']; + + if ($row['topic_status'] == ITEM_MOVED) + { + $topic_id = $row['topic_moved_id']; + } + + // 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); + + $newest_post_img = ($unread_topic) ? "" . $user->img('icon_post_newest', 'VIEW_NEWEST_POST') . ' ' : ''; + + // Generate all the URIs ... + $view_topic_url = "viewtopic.$phpEx$SID&f=" . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . "&t=$topic_id"; + // Send vars to template $template->assign_block_vars('topicrow', array( 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, - 'TOPIC_AUTHOR' => $topic_author, - 'FIRST_POST_TIME' => $user->format_date($row['topic_time'], $config['board_timezone']), + 'TOPIC_AUTHOR' => topic_topic_author($row), + 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), 'LAST_POST_AUTHOR' => ($row['topic_last_poster_name'] != '') ? $row['topic_last_poster_name'] : $user->lang['GUEST'], - 'PAGINATION' => $pagination, - 'REPLIES' => ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'], + 'PAGINATION' => topic_generate_pagination($replies, "viewtopic.$phpEx$SID&f=" . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . "&t=$topic_id"), + 'REPLIES' => $replies, 'VIEWS' => $row['topic_views'], 'TOPIC_TITLE' => censor_text($row['topic_title']), 'TOPIC_TYPE' => $topic_type, @@ -561,23 +454,29 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16) 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? '' : '', 'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_attach', sprintf($user->lang['TOTAL_ATTACHMENTS'], $row['topic_attachment'])) : '', - 'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test, 'S_TOPIC_TYPE' => $row['topic_type'], 'S_USER_POSTED' => (!empty($row['mark_type'])) ? true : false, 'S_UNREAD_TOPIC' => $unread_topic, - 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_gets('m_', $forum_id)) ? TRUE : FALSE, - 'S_TOPIC_UNAPPROVED' => (!$row['topic_approved'] && $auth->acl_gets('m_approve', $forum_id)) ? TRUE : FALSE, + 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_gets('m_', $forum_id)) ? true : false, + 'S_TOPIC_UNAPPROVED' => (!$row['topic_approved'] && $auth->acl_gets('m_approve', $forum_id)) ? true : false, 'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'], 'U_LAST_POST_AUTHOR'=> ($row['topic_last_poster_id'] != ANONYMOUS && $row['topic_last_poster_id']) ? "memberlist.$phpEx$SID&mode=viewprofile&u={$row['topic_last_poster_id']}" : '', 'U_VIEW_TOPIC' => $view_topic_url, 'U_MCP_REPORT' => "mcp.$phpEx?sid={$user->session_id}&mode=reports&t=$topic_id", - 'U_MCP_QUEUE' => "mcp.$phpEx?sid={$user->session_id}&i=queue&mode=approve_details&t=$topic_id") + 'U_MCP_QUEUE' => "mcp.$phpEx?sid={$user->session_id}&i=queue&mode=approve_details&t=$topic_id", + + 'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test) ); $s_type_switch = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0; + if ($mark_time_topic < $row['topic_last_post_time'] && $mark_time_forum < $row['topic_last_post_time']) + { + $mark_forum_read = false; + } +/* if ($config['load_db_lastread']) { if ((isset($row['mark_time']) && $row['topic_last_post_time'] > $row['mark_time']) || (empty($row['mark_time']) && $row['topic_last_post_time'] > $forum_data['mark_time'])) @@ -607,7 +506,7 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16) } } } - +*/ unset($rowset[$topic_id]); } }