<?php _e('This is how your profile appears to a logged in member.'); ?> <?php if (bb_current_user_can('edit_user', $user->ID)) { printf(__('You may <a href="%1$s">edit this information</a>.'), esc_attr(get_profile_tab_link($user_id, 'edit'))); } ?> </p> <?php if (bb_current_user_can('edit_favorites_of', $user->ID)) { ?> <p><?php printf(__('You can also <a href="%1$s">manage your favorites</a> and subscribe to your favorites’ <a href="%2$s"><abbr title="Really Simple Syndication">RSS</abbr> feed</a>.'), esc_attr(get_favorites_link()), esc_attr(get_favorites_rss_link())); ?> </p> <?php } } ?> <?php bb_profile_data(); ?> </div> <h3 id="useractivity"><?php _e('User Activity');
function bb_repermalink() { global $page; $location = bb_get_location(); $uri = $_SERVER['REQUEST_URI']; if (isset($_GET['id'])) { $id = $_GET['id']; } else { $id = bb_get_path(); } $_original_id = $id; do_action('pre_permalink', $id); $id = apply_filters('bb_repermalink', $id); switch ($location) { case 'front-page': $path = null; $querystring = null; if ($page > 1) { if (bb_get_option('mod_rewrite')) { $path = 'page/' . $page; } else { $querystring = array('page' => $page); } } $permalink = bb_get_uri($path, $querystring, BB_URI_CONTEXT_HEADER); $issue_404 = true; break; case 'forum-page': if (empty($id)) { $permalink = bb_get_uri(null, null, BB_URI_CONTEXT_HEADER); break; } global $forum_id, $forum; $forum = bb_get_forum($id); $forum_id = $forum->forum_id; $permalink = get_forum_link($forum->forum_id, $page); break; case 'topic-edit-page': case 'topic-page': if (empty($id)) { $permalink = bb_get_uri(null, null, BB_URI_CONTEXT_HEADER); break; } global $topic_id, $topic; $topic = get_topic($id); $topic_id = $topic->topic_id; $permalink = get_topic_link($topic->topic_id, $page); break; case 'profile-page': // This handles the admin side of the profile as well. global $user_id, $user, $profile_hooks, $self; if (isset($_GET['id'])) { $id = $_GET['id']; } elseif (isset($_GET['username'])) { $id = $_GET['username']; } else { $id = bb_get_path(); } $_original_id = $id; if (!$id) { $user = bb_get_current_user(); // Attempt to go to the current users profile } else { if (bb_get_option('mod_rewrite') === 'slugs') { if (!($user = bb_get_user_by_nicename($id))) { $user = bb_get_user($id); } } else { if (!($user = bb_get_user($id))) { $user = bb_get_user_by_nicename($id); } } } if (!$user || 1 == $user->user_status && !bb_current_user_can('moderate')) { bb_die(__('User not found.'), '', 404); } $user_id = $user->ID; bb_global_profile_menu_structure(); $valid = false; if ($tab = isset($_GET['tab']) ? $_GET['tab'] : bb_get_path(2)) { foreach ($profile_hooks as $valid_tab => $valid_file) { if ($tab == $valid_tab) { $valid = true; $self = $valid_file; } } } if ($valid) { $permalink = get_profile_tab_link($user->ID, $tab, $page); } else { $permalink = get_user_profile_link($user->ID, $page); unset($self, $tab); } break; case 'favorites-page': $permalink = get_favorites_link(); break; case 'tag-page': // It's not an integer and tags.php pulls double duty. $id = isset($_GET['tag']) ? $_GET['tag'] : false; if (!$id || !bb_get_tag((string) $id)) { $permalink = bb_get_tag_page_link(); } else { global $tag, $tag_name; $tag_name = $id; $tag = bb_get_tag((string) $id); $permalink = bb_get_tag_link(0, $page); // 0 => grabs $tag from global. } break; case 'view-page': // Not an integer if (isset($_GET['view'])) { $id = $_GET['view']; } else { $id = bb_get_path(); } $_original_id = $id; global $view; $view = $id; $permalink = get_view_link($view, $page); break; default: return; break; } nxt_parse_str($_SERVER['QUERY_STRING'], $args); $args = urlencode_deep($args); if ($args) { $permalink = add_query_arg($args, $permalink); if (bb_get_option('mod_rewrite')) { $pretty_args = array('id', 'page', 'tag', 'tab', 'username'); // these are already specified in the path if ($location == 'view-page') { $pretty_args[] = 'view'; } foreach ($pretty_args as $pretty_arg) { $permalink = remove_query_arg($pretty_arg, $permalink); } } } $permalink = apply_filters('bb_repermalink_result', $permalink, $location); $domain = bb_get_option('domain'); $domain = preg_replace('/^https?/', '', $domain); $check = preg_replace('|^.*' . trim($domain, ' /') . '|', '', $permalink, 1); $uri = rtrim($uri, " \t\n\r\v?"); $uri = str_replace('/index.php', '/', $uri); global $bb_log; $bb_log->debug($uri, 'bb_repermalink() ' . __('REQUEST_URI')); $bb_log->debug($check, 'bb_repermalink() ' . __('should be')); $bb_log->debug($permalink, 'bb_repermalink() ' . __('full permalink')); $bb_log->debug(isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : null, 'bb_repermalink() ' . __('PATH_INFO')); if ($check != $uri && $check != str_replace(urlencode($_original_id), $_original_id, $uri)) { if ($issue_404 && rtrim($check, " \t\n\r\v/") !== rtrim($uri, " \t\n\r\v/")) { status_header(404); bb_load_template('404.php'); } else { nxt_redirect($permalink); } exit; } do_action('post_permalink', $permalink); }
function user_favorites_link($add = array(), $rem = array(), $user_id = 0) { global $topic, $bb_current_user; if (empty($add) || !is_array($add)) { $add = array('mid' => __('Add this topic to your favorites'), 'post' => __(' (%?%)')); } if (empty($rem) || !is_array($rem)) { $rem = array('pre' => __('This topic is one of your %favorites% ['), 'mid' => __('×'), 'post' => __(']')); } if ($user_id) { if (!bb_current_user_can('edit_favorites_of', (int) $user_id)) { return false; } if (!($user = bb_get_user(bb_get_user_id($user_id)))) { return false; } } else { if (!bb_current_user_can('edit_favorites')) { return false; } $user =& $bb_current_user->data; } $url = esc_url(get_favorites_link($user_id)); if ($is_fav = is_user_favorite($user->ID, $topic->topic_id)) { $rem = preg_replace('|%(.+)%|', "<a href='{$url}'>\$1</a>", $rem); $favs = array('fav' => '0', 'topic_id' => $topic->topic_id); $pre = is_array($rem) && isset($rem['pre']) ? $rem['pre'] : ''; $mid = is_array($rem) && isset($rem['mid']) ? $rem['mid'] : (is_string($rem) ? $rem : ''); $post = is_array($rem) && isset($rem['post']) ? $rem['post'] : ''; } elseif (false === $is_fav) { $add = preg_replace('|%(.+)%|', "<a href='{$url}'>\$1</a>", $add); $favs = array('fav' => '1', 'topic_id' => $topic->topic_id); $pre = is_array($add) && isset($add['pre']) ? $add['pre'] : ''; $mid = is_array($add) && isset($add['mid']) ? $add['mid'] : (is_string($add) ? $add : ''); $post = is_array($add) && isset($add['post']) ? $add['post'] : ''; } $url = esc_url(bb_nonce_url(add_query_arg($favs, get_favorites_link($user_id)), 'toggle-favorite_' . $topic->topic_id)); if (!is_null($is_fav)) { echo "<span id='favorite-{$topic->topic_id}'>{$pre}<a href='{$url}' class='dim:favorite-toggle:favorite-{$topic->topic_id}:is-favorite'>{$mid}</a>{$post}</span>"; } }
/** * Load localized script just in time for MCE. * * These localizations require information that may not be loaded even by init. */ function bb_just_in_time_script_localization() { wp_localize_script('topic', 'bbTopicJS', array('currentUserId' => bb_get_current_user_info('id'), 'topicId' => get_topic_id(), 'favoritesLink' => get_favorites_link(), 'isFav' => (int) is_user_favorite(bb_get_current_user_info('id')), 'confirmPostDelete' => __("Are you sure you want to delete this post?"), 'confirmPostUnDelete' => __("Are you sure you want to undelete this post?"), 'favLinkYes' => __('favorites'), 'favLinkNo' => __('?'), 'favYes' => __('This topic is one of your %favLinkYes% [%favDel%]'), 'favNo' => __('%favAdd% (%favLinkNo%)'), 'favDel' => __('×'), 'favAdd' => __('Add this topic to your favorites'))); }
?> <p> Это то, каким видит Ваш профиль пользователь, вошедший в систему. <?php if (bb_current_user_can('edit_user', $user->ID)) { printf('Вы можете <a href=\\"%1$s\\">редактировать эту информацию</a>.', attribute_escape(get_profile_tab_link($user_id, 'edit'))); } ?> </p> <?php if (bb_current_user_can('edit_favorites_of', $user->ID)) { ?> <p><?php printf('Вы также можете <a href="%1$s">управлять вашими закладками</a> и подписаться на ваши закладки по <a href="%2$s"><abbr title="Really Simple Syndication">RSS</abbr></a>.', attribute_escape(get_favorites_link()), attribute_escape(get_favorites_rss_link())); ?> </p> <?php } ?> <hr /> <?php } ?> <h2 id="useractivity">Активность</h2> <div id="user-replies" class="user-recent"><h4>Последние сообщения</h4> <?php
<p><?php _e('Profile updated'); ?> . <a href="<?php profile_tab_link($user_id, 'edit'); ?> "><?php _e('Edit again »'); ?> </a></p> </div> <?php } elseif ($user_id == bb_get_current_user_info('id')) { ?> <p><?php printf(__('This is how your profile appears to a fellow logged in member, you may <a href="%1$s">edit this information</a>. You can also <a href="%2$s">manage your favorites</a> and subscribe to your favorites’ <a href="%3$s"><abbr title="Really Simple Syndication">RSS</abbr> feed</a>'), attribute_escape(get_profile_tab_link($user_id, 'edit')), attribute_escape(get_favorites_link()), attribute_escape(get_favorites_rss_link())); ?> </p> <?php } ?> <div class="post"><h4><?php _e('Recent Replies'); ?> </h4> <?php if ($posts) { ?> <ol> <?php