$total = $total['c']; // setup some vars for the query $limit = $page_start . ', ' . $perpage; // 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 b.access = ' . access_public . ' AND b.author_id IN(' . $in . ') AND b.author_id = u.user_id ORDER BY b.date DESC LIMIT ' . $limit . ';'); // timezone settings if ($user->isLogedIn) { $blog->setDateOffset($config->get('server_timezone'), $user->get('timezone')); } // parse the blogs $blog->setDate($u->get('date_format')); $i = 0; foreach ($all as $item) { $ets->blog[$i] = $blog->format($item, $user, $l['edit']); // check for avatar if (isset($avatars[$item['author_id']])) { $id = $item['author_id']; if ($avatars[$id]['isCustom'] == 1) { $av_file = script_path . 'avatars/'; } else { $av_file = script_path . 'avatars/default/'; } $av_file .= $avatars[$id]['file']; $ets->blog[$i]->avatar_url = $av_file; $ets->blog[$i]->avatar = '<img src="' . $av_file . '" />'; }
* ======================================= */ $ets_outter->main_title = $config->get('site_name') . ': ' . $l['title-news']; $ets_outter->page_title = $l['title-news']; $page = 0; if (isset($_PATH['page'])) { $page = $_PATH['page']; } $q = '# GET NEWS POSTS SELECT t1.blog_id, t1.author_id, t1.date, t1.subject, t1.body, t1.access, t1.custom AS custom_text, t1.comments, t1.html, t1.smiles, t1.bb, t2.username AS author, t2.custom AS custom_title FROM ' . db_blogs . ' AS t1, ' . db_users . ' AS t2 WHERE t1.author_id = t2.user_id AND t1.access = ' . access_news . ' ORDER BY t1.date DESC LIMIT ' . $page . ' , ' . $config->get('news_per_page') . ' ;'; $newsitems = $db->getAllArray($q); $b->setDate($config->get('news_date_format')); foreach ($newsitems as $news) { $b->setData($news); $ets->news[] = $b->format(false, $user, $l['edit']); } $USESKIN = skin_news; break; case 'comment': /** * ======================================= * N E W S C O M M E N T S * ======================================= */ $USESKIN = skin_news; $ets_outter->main_title = $config->get('site_name') . ': ' . $l['title-news']; $ets_outter->page_title = $l['title-news'];
// get list of blog owners' friends // This should probally be a method of nlb_users, but I only have to do this once... $f = $db->query('SELECT friend_id FROM ' . db_friends . ' WHERE owner_id=' . $thisblog['author_id'] . ';'); while ($row = mysql_fetch_assoc($f)) { if ($row['friend_id'] == $user->id) { $isAFriend = true; break; } } if (!$isAFriend) { // Can't see this blog :( jsRedirect(script_path . 'index.php'); } } $blog->setData($thisblog); $blog->setDate($thisblog['date_format']); if ($user->isLogedIn) { $blog->setDateOffset($config->get('server_timezone'), $user->get('timezone')); } $USERID = $blog->data['author_id']; // check for avatars $avatar = $db->getArray('SELECT file, isCustom FROM ' . db_avatars . ' WHERE owner_id=' . $USERID . ' AND type=1;'); if (!empty($avatar)) { if ($avatar['isCustom'] == 1) { $file = 'avatars/'; } else { $file = 'avatars/default/'; } $file .= $avatar['file']; $ets->avatar_url = script_path . $file; $ets->avatar = '<img src="' . script_path . $file . '" />';