Example #1
0
         // parse and output the blogs
         $template->assign_block_vars('column', array('SECTION_WIDTH' => '100', 'U_FEED' => $config['user_blog_enable_feeds'] ? blog_url(false, false, false, array('mode' => $mode, 'feed' => 'explain')) : '', 'U_VIEW' => blog_url(false, false, false, array('mode' => $mode)), 'TITLE' => $user->lang[strtoupper($mode)], 'L_NO_MSG' => strpos($mode, 'comments') === false ? $user->lang['NO_BLOGS'] : $user->lang['NO_REPLIES']));
         if ($ids !== false) {
             if (strpos($mode, 'comments') === false) {
                 foreach ($ids as $id) {
                     $template->assign_block_vars('column.row', array_merge($blog_data->handle_user_data(blog_data::$blog[$id]['user_id']), $blog_data->handle_blog_data($id, $config['user_blog_user_text_limit'])));
                 }
             } else {
                 foreach ($ids as $id) {
                     $template->assign_block_vars('column.row', array_merge($blog_data->handle_user_data(blog_data::$reply[$id]['user_id']), $blog_data->handle_reply_data($id, $config['user_blog_user_text_limit'])));
                 }
             }
         }
         $template->set_filenames(array('body' => 'blog/view_blog_main.html'));
     } else {
         feed_output($ids, $feed);
     }
     break;
     // This is the default page
 // This is the default page
 default:
     // Get the random blog(s) and the recent blogs
     $random_blog_ids = $blog_data->get_blog_data('random', 0, array('limit' => 1, 'category_id' => $category_id));
     $recent_blog_ids = $blog_data->get_blog_data('recent', 0, array('limit' => $limit, 'category_id' => $category_id));
     $recent_reply_ids = $blog_data->get_reply_data('recent', 0, array('limit' => $limit, 'category_id' => $category_id));
     $blog_data->get_user_data(false, true);
     update_edit_delete();
     // Output the random blog(s)
     if ($random_blog_ids !== false) {
         $template->assign_vars(array('S_RANDOM_BLOG' => true));
         // I've decided to use a foreach to display the random blogs so it is easier to change the limit if the board owner would like...
Example #2
0
        }
    }
    // Output some data
    $template->assign_vars(array('META' => '<link rel="canonical" href="' . blog_url($user_id, false, false, $start > 0 ? array('start' => $start) : array()) . '" />', 'PAGINATION' => $pagination, 'PAGE_NUMBER' => on_page($total_blogs, $limit, $start), 'TOTAL_POSTS' => $total_blogs == 1 ? $user->lang['ONE_BLOG'] : sprintf($user->lang['CNT_BLOGS'], $total_blogs), 'U_BLOG_FEED' => $config['user_blog_enable_feeds'] ? blog_url($user_id, false, false, array('feed' => 'explain')) : '', 'U_PRINT_TOPIC' => !$user->data['is_bot'] ? $blog_urls['self_print'] : '', 'U_VIEW' => $blog_urls['self'], 'S_SORT' => true, 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, 'S_VIEW_REPLY_COUNT' => true, 'L_NO_DELETED_BLOGS' => $sort_days == 0 ? $user->lang['NO_DELETED_BLOGS'] : sprintf($user->lang['NO_DELETED_BLOGS_SORT_DAYS'], $limit_days[$sort_days]), 'L_NO_BLOGS_USER' => $sort_days == 0 ? $user->lang['NO_BLOGS_USER'] : sprintf($user->lang['NO_BLOGS_USER_SORT_DAYS'], $limit_days[$sort_days]), 'BLOG_CSS' => isset($user_settings[$user_id]['blog_css']) ? $user_settings[$user_id]['blog_css'] : ''));
    unset($pagination);
    // parse and output the blogs
    if ($blog_ids !== false) {
        // Get the Attachment Data
        get_attachment_data($blog_ids, false);
        // read blogs, for updating the read count
        $read_blogs = array();
        foreach ($blog_ids as $id) {
            $blogrow = array_merge($blog_data->handle_user_data(blog_data::$blog[$id]['user_id']), $blog_data->handle_blog_data($id, $config['user_blog_user_text_limit']));
            $template->assign_block_vars('blogrow', $blogrow);
            if (!$blogrow['S_SHORTENED']) {
                // for updating the read count later
                array_push($read_blogs, $id);
            }
        }
        // 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 && $mode != 'deleted' && sizeof($read_blogs)) {
            $sql = 'UPDATE ' . BLOGS_TABLE . ' SET blog_read_count = blog_read_count + 1 WHERE ' . $db->sql_in_set('blog_id', $read_blogs);
            $db->sql_query($sql);
        }
        unset($read_blogs);
    }
    blog_plugins::plugin_do('view_user_end');
    $template->set_filenames(array('body' => 'blog/view_blog.html'));
} else {
    feed_output($blog_ids, $feed);
}