diff --git a/upload/includes/functions.php b/upload/includes/functions.php
index 2af705079..42156ee26 100644
--- a/upload/includes/functions.php
+++ b/upload/includes/functions.php
@@ -2736,20 +2736,20 @@ function get_avatar ($avatar, $type, $allow_avatar = true, $height = '', $width
$height = ($height != '') ? 'height="'. $height .'"' : '';
$width = ($width != '') ? 'width="'. $width .'"' : '';
- $user_avatar = '';
+ $user_avatar = '
';
if ($allow_avatar)
{
switch($type)
{
case USER_AVATAR_UPLOAD:
- $user_avatar = ( $bb_cfg['allow_avatar_upload'] ) ? '
' : '';
+ $user_avatar = ( $bb_cfg['allow_avatar_upload'] ) ? '
' : '';
break;
case USER_AVATAR_REMOTE:
- $user_avatar = ( $bb_cfg['allow_avatar_remote'] ) ? '
' : '';
+ $user_avatar = ( $bb_cfg['allow_avatar_remote'] ) ? '
' : '';
break;
case USER_AVATAR_GALLERY:
- $user_avatar = ( $bb_cfg['allow_avatar_local'] ) ? '
' : '';
+ $user_avatar = ( $bb_cfg['allow_avatar_local'] ) ? '
' : '';
break;
}
}
diff --git a/upload/includes/ucp/usercp_topic_watch.php b/upload/includes/ucp/usercp_topic_watch.php
new file mode 100644
index 000000000..088cef286
--- /dev/null
+++ b/upload/includes/ucp/usercp_topic_watch.php
@@ -0,0 +1,103 @@
+sql_query($sql)) )
+ {
+ message_die(GENERAL_ERROR, "Could not delete topic watch information", '', __LINE__, __FILE__, $sql);
+ }
+}
+
+$template->assign_vars(array(
+ 'PAGE_TITLE' => $lang['WATCHED_TOPICS'],
+ 'S_FORM_ACTION' => BB_ROOT .'profile.php?mode=watch',
+));
+
+$sql = "SELECT COUNT(topic_id) as watch_count FROM ". BB_TOPICS_WATCH ." WHERE user_id = $user_id";
+if ( !($result = DB() ->sql_query($sql)) )
+{
+ message_die(GENERAL_ERROR, 'Could not obtain watch topic information', '', __LINE__, __FILE__, $sql);
+}
+$row = DB() ->sql_fetchrow($result);
+$watch_count = ( $row['watch_count'] ) ? $row['watch_count'] : 0;
+DB() ->sql_freeresult($result);
+
+if ($watch_count > 0)
+{
+ $sql = "SELECT w.*, t.*, f.*, u.*, u2.username as last_username, u2.user_id as last_user_id,
+ u2.user_level as last_user_level, u2.user_rank as last_user_rank
+ FROM ". BB_TOPICS_WATCH ." w, ". BB_TOPICS ." t, ". BB_USERS ." u, ". BB_FORUMS ." f, ". BB_POSTS ." p, " . BB_USERS . " u2
+ WHERE w.topic_id = t.topic_id
+ AND t.forum_id = f.forum_id
+ AND p.post_id = t.topic_last_post_id
+ AND p.poster_id = u2.user_id
+ AND t.topic_poster = u.user_id
+ AND w.user_id = $user_id
+ GROUP BY t.topic_last_post_time DESC
+ LIMIT $start, $per_page";
+ if ( !($result = DB() ->sql_query($sql)) )
+ {
+ message_die(GENERAL_ERROR, 'Could not obtain watch topic information', '', __LINE__, __FILE__, $sql);
+ }
+ $watch = DB() ->sql_fetchrowset($result);
+
+ if ($watch)
+ {
+ for ( $i = 0; $i < count($watch); $i++ )
+ {
+ $is_unread = is_unread($watch[$i]['topic_last_post_time'], $watch[$i]['topic_id'], $watch[$i]['forum_id']);
+
+ $template->assign_block_vars('watch', array(
+ 'ROW_CLASS' => ( !($i % 2) ) ? 'row1' : 'row2',
+ 'POST_ID' => $watch[$i]['topic_first_post_id'],
+ 'TOPIC_ID' => $watch[$i]['topic_id'],
+ 'TOPIC_TITLE' => wbr(str_short($watch[$i]['topic_title'], 70)),
+ 'FULL_TOPIC_TITLE' => wbr($watch[$i]['topic_title']),
+ 'U_TOPIC' => TOPIC_URL . $watch[$i]['topic_id'],
+ 'FORUM_TITLE' => wbr($watch[$i]['forum_name']),
+ 'U_FORUM' => FORUM_URL . $watch[$i]['forum_id'],
+ 'REPLIES' => $watch[$i]['topic_replies'],
+ 'AUTHOR' => profile_url(array('username' => $watch[$i]['username'], 'user_rank' => $watch[$i]['user_rank'])) .'',
+ 'LAST_POST' => bb_date($watch[$i]['topic_last_post_time']) .'
'. profile_url(array('username' => $watch[$i]['last_username'], 'user_rank' => $watch[$i]['last_user_rank'])),
+ 'LAST_POST_ID' => $watch[$i]['topic_last_post_id'],
+ 'IS_UNREAD' => $is_unread,
+ 'TOPIC_ICON' => get_topic_icon($watch[$i], $is_unread),
+ 'PAGINATION' => ($watch[$i]['topic_status'] == TOPIC_MOVED) ? '' : build_topic_pagination(TOPIC_URL . $watch[$i]['topic_id'], $watch[$i]['topic_replies'], $bb_cfg['posts_per_page']),
+ ));
+ }
+
+ $template->assign_vars(array(
+ 'MATCHES' => (count($watch) == 1) ? sprintf($lang['FOUND_SEARCH_MATCH'], count($watch)) : sprintf($lang['FOUND_SEARCH_MATCHES'], count($watch)),
+ 'PAGINATION' => generate_pagination(BB_ROOT .'profile.php?mode=watch', $watch_count, $per_page, $start),
+ 'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], ( floor( $start / $per_page ) + 1 ), ceil( $watch_count / $per_page )),
+ 'U_PER_PAGE' => BB_ROOT .'profile.php?mode=watch',
+ 'PER_PAGE' => $per_page,
+ ));
+ }
+ DB() ->sql_freeresult($result);
+}
+else
+{
+ meta_refresh(BB_ROOT, '3');
+ bb_die($lang['NO_WATCHED_TOPICS']);
+}
+
+print_page('usercp_topic_watch.tpl');
+?>
\ No newline at end of file
diff --git a/upload/includes/ucp/usercp_viewprofile.php b/upload/includes/ucp/usercp_viewprofile.php
index 79a3a86c2..fa05eca3e 100644
--- a/upload/includes/ucp/usercp_viewprofile.php
+++ b/upload/includes/ucp/usercp_viewprofile.php
@@ -130,7 +130,8 @@ $template->assign_vars(array(
'U_SEARCH_USER' => "search.php?search_author=1&uid={$profiledata['user_id']}",
'U_SEARCH_TOPICS' => "search.php?uid={$profiledata['user_id']}&myt=1",
'U_SEARCH_RELEASES' => "tracker.php?rid={$profiledata['user_id']}#results",
-
+ 'U_WATCHED_TOPICS' => "profile.php?mode=watch",
+
'S_PROFILE_ACTION' => 'profile.php',
'SIGNATURE' => $signature,
diff --git a/upload/language/lang_russian/lang_main.php b/upload/language/lang_russian/lang_main.php
index 0545a92f6..fcfaaa24a 100644
--- a/upload/language/lang_russian/lang_main.php
+++ b/upload/language/lang_russian/lang_main.php
@@ -1772,6 +1772,10 @@ $lang['DEL_LIST_MY_MESSAGE'] = 'Удалить выбранные темы из
$lang['DEL_LIST_MY_MESSAGE_INFO'] = 'После удаления и до обновления всего списка в нём могут быть показаны уже удаленные темы';
$lang['DEL_LIST_INFO'] = 'Для удаления тем из списка нажмите на иконку слева от названия любого раздела';
+//Отслеживаемые темы
+$lang['WATCHED_TOPICS'] = 'Отслеживаемые темы';
+$lang['NO_WATCHED_TOPICS'] = 'Вы не отслеживаете ни на одну из тем';
+
// set_die_append_msg
$lang['INDEX_RETURN'] = 'Вернуться на главную';
$lang['FORUM_RETURN'] = 'Вернуться в форум';
diff --git a/upload/profile.php b/upload/profile.php
index 882c6b95d..46f392a68 100644
--- a/upload/profile.php
+++ b/upload/profile.php
@@ -47,7 +47,13 @@ switch ($mode)
require(INC_DIR . 'ucp/usercp_bonus.php');
break;
-
+
+ case 'watch':
+ if (IS_GUEST) login_redirect();
+
+ require(INC_DIR . 'ucp/usercp_topic_watch.php');
+ break;
+
default:
bb_die('Invalid mode');
}
diff --git a/upload/templates/default/usercp_topic_watch.tpl b/upload/templates/default/usercp_topic_watch.tpl
new file mode 100644
index 000000000..a596ebec1
--- /dev/null
+++ b/upload/templates/default/usercp_topic_watch.tpl
@@ -0,0 +1,137 @@
+
+
+
+
+
+ {PAGE_TITLE}+ + |
+ {PAGINATION} | +
+ | {L_FORUM} | +{L_TOPIC} | +{L_AUTHOR} | +{L_REPLIES} | +{L_LASTPOST} | +
---|---|---|---|---|---|
+ |
+
+ {watch.FORUM_TITLE} | +
+ {watch.TOPIC_TITLE}
+ [{ICON_GOTOPOST}{L_GOTO_SHORT} {watch.PAGINATION} ] + |
+ {watch.AUTHOR} | +{watch.REPLIES} | ++ {watch.LAST_POST}{ICON_NEWEST_REPLY} + {ICON_LATEST_REPLY} + | +
+ {L_DEL_LIST_INFO}{MATCHES} + | +