Ejemplo n.º 1
0
        $perpage = $u->get('perpage');
        $page_start = $page * $perpage;
        // get count of all the blogs
        $total = $u->get('blog_count');
        // setup some vars for the query
        $limit = $page_start . ', ' . $perpage;
        // check to see what blogs we can view
        $access_in = access_public;
        // default is public blogs only.
        if ($user->isLogedIn) {
            // if we are the author, we can see all
            if ($user->id == $u->id) {
                $access_in = access_public . ', ' . access_private . ', ' . access_friendsonly;
            }
            // are we a friend?
            if ($u->areFriends($user->id)) {
                $access_in = access_public . ', ' . access_friendsonly;
            }
        }
        // get the blogs
        $all = $db->getAllArray('# Get page of blogs
	SELECT b.blog_id, b.author_id, b.date, b.subject, b.body, b.access, 
		b.mood, b.custom AS custom_text, b.comments, b.html, b.smiles, 
		b.bb, u.username AS author, u.custom AS custom_title, u.date_format
	FROM ' . db_blogs . ' AS b, ' . db_users . ' AS u
	WHERE u.user_id = ' . $USERID . ' AND b.author_id = u.user_id AND b.access IN(' . $access_in . ')
	ORDER BY b.date DESC
	LIMIT ' . $limit . ';');
        // timezone settings
        if ($user->isLogedIn) {
            $blog->setDateOffset($config->get('server_timezone'), $user->get('timezone'));