// 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 . '" />'; } $i++; } // setup tags for next/prev pages.
$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']; if (!isset($_PATH['id'])) { jsRedirect('index.php'); }
} $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 . '" />'; } $ets->username = $thisblog['author']; $ets->blog = $blog->format(false, $user, $l['edit']); $ets->list_comments = $blog->getComments($blog_id, $config->get('comment_date_format'), $l['guest'], $user, $l['edit']); if ($blog->data['comments'] != -1) { $ets->view_comments = true; } else { $ets->view_comments = false; } // form to add comment if ($user->isAllowed('comment') || !$user->isLogedIn) { $name = $user->isLogedIn ? $user->get('username') : $l['guest']; $submit_text = sprintf($l['comment_submit'], $name); $ets->add_comment = ' <script type="text/javascript"> function insertWindow( gotopage ) { window.open( gotopage, \'newwindow\',\'toolbar=0,location=0,directories=0,menuBar=0,resizable=1,scrollbars=yes,width=400,height=500,left=20,top=20\'); }