get_attachment_data($blog_id, $reply_ids); blog_plugins::plugin_do('view_blog_start'); // Output some data $template->assign_vars(array('META' => '<link rel="canonical" href="' . blog_url($user_id, $blog_id, false, $start > 0 ? array('start' => $start) : array()) . '" />', 'BLOG_CSS' => isset($user_settings[$user_id]['blog_css']) ? $user_settings[$user_id]['blog_css'] : '', 'U_PRINT_TOPIC' => !$user->data['is_bot'] ? $blog_urls['self_print'] : '', 'U_VIEW' => $blog_urls['self'], 'S_CATEGORY_MODE' => $category_id ? true : false, 'S_SINGLE' => true, 'U_QUICK_REPLY' => blog_url($user_id, $blog_id, false, array('page' => 'reply', 'mode' => 'add')), 'S_QUICK_REPLY' => $user->data['is_registered'] && $config['user_blog_quick_reply'] ? true : false)); // Quick Reply add_form_key('postform'); // Parse the blog data and output it to the template $template->assign_block_vars('blogrow', array_merge($blog_data->handle_blog_data($blog_id), $blog_data->handle_user_data($user_id))); blog_plugins::plugin_do('view_blog_after_blogrow'); // to update the read count, we are only doing this if the user is not the owner, and the user doesn't view the shortened version, and we are not viewing the deleted blogs page if ($user->data['user_id'] != $user_id) { $sql = 'UPDATE ' . BLOGS_TABLE . ' SET blog_read_count = blog_read_count + 1 WHERE blog_id = ' . intval($blog_id); $db->sql_query($sql); } if ($total_replies > 0 || $sort_days != 0) { // for sorting and pagination gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); $pagination = generate_blog_pagination($blog_urls['start_zero'], $total_replies, $limit, $start, false); $template->assign_vars(array('PAGINATION' => $pagination, 'PAGE_NUMBER' => on_page($total_replies, $limit, $start), 'TOTAL_POSTS' => $total_replies == 1 ? $user->lang['ONE_REPLY'] : sprintf($user->lang['CNT_REPLIES'], $total_replies), 'S_REPLIES' => true, 'S_SORT_REPLY' => true, 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days)); unset($pagination); // For the replies if ($reply_ids !== false) { // use a foreach to easily output the data foreach ($reply_ids as $id) { // send the data to the template $template->assign_block_vars('replyrow', array_merge($blog_data->handle_reply_data($id), $blog_data->handle_user_data(blog_data::$reply[$id]['user_id']))); } } } blog_plugins::plugin_do('view_blog_end'); $template->set_filenames(array('body' => 'blog/view_blog.html'));
} $blog_data->get_user_data(false, true); update_edit_delete(); foreach ($ids as $id) { if (isset($id['reply_id'])) { if (!$author || $uid == blog_data::$reply[$id['reply_id']]['user_id']) { $template->assign_block_vars('searchrow', $blog_data->handle_reply_data($id['reply_id']) + $blog_data->handle_user_data(blog_data::$reply[$id['reply_id']]['user_id'])); } else { // they are selecting from a specific author and this is from a different author $matches--; } } else { if (isset(blog_data::$blog[$id['blog_id']]) && (!$author || $uid == blog_data::$blog[$id['blog_id']]['user_id'])) { $template->assign_block_vars('searchrow', $blog_data->handle_blog_data($id['blog_id']) + $blog_data->handle_user_data(blog_data::$blog[$id['blog_id']]['user_id'])); } else { // they don't have permission to view this blog, or they are selecting from a specific author and this is from a different author $matches--; } } } } else { $matches = 0; } $pagination = generate_blog_pagination(blog_url(false, false, false, array('page' => 'search', 'author' => $author, 'keywords' => $keywords, 'terms' => $terms, 'sf' => $sf, 'start' => '*start*', 'limit' => $limit), array(), true), $matches, $limit, $start, false); $template->assign_vars(array('PAGINATION' => $pagination, 'PAGE_NUMBER' => on_page($matches, $limit, $start), 'TOTAL_POSTS' => $matches == 1 ? $user->lang['ONE_REPLY'] : sprintf($user->lang['CNT_REPLIES'], $matches), 'SEARCH_MATCHES' => $matches == 1 ? sprintf($user->lang['FOUND_SEARCH_MATCH'], $matches) : sprintf($user->lang['FOUND_SEARCH_MATCHES'], $matches), 'U_SEARCH_WORDS' => $search_url, 'SEARCH_WORDS' => $author . ' • ' . $keywords)); $template->set_filenames(array('body' => 'blog/search_results.html')); } else { $template->assign_vars(array('U_BLOG_SEARCH' => blog_url(false, false, false, array('page' => 'search'), array(), true))); $template->set_filenames(array('body' => 'blog/search_body.html')); } blog_plugins::plugin_do('search_end');