"> "/> "/> "/> "/> "/> "/> "/>
$lng[section_blog]\n"); $offset = (int) $_GET['o']; $q = mysqli_query($con, "SELECT id, permalink, title_$lang AS title, text_$lang AS text, DATE_FORMAT(dtime, '%Y-%m-%dT%T') AS isodate, dtime, comments FROM post WHERE visible = 1 ORDER BY dtime DESC LIMIT 5 OFFSET $offset;"); while($r = mysqli_fetch_array($q)){ echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "

\n"; $q_image = mysqli_query($con, "SELECT image FROM post_image WHERE post = $r[id] ORDER BY idx LIMIT 1;"); if (mysqli_num_rows($q_image) > 0){ $r_image = mysqli_fetch_array($q_image); echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; } echo "

" . cutText($r['text'], 800, $lng['blog_read_more'], "$proto$http_host/blog/$r[permalink]/") . "

\n"; # Tags (if any), date, and comment counter echo "
\n"; $q_tag = mysqli_query($con, "SELECT tag FROM post_tag WHERE post= $r[id];"); if (mysqli_num_rows($q_tag) > 0){ $tag_string = "Tags: "; $tag_raw = ""; while ($r_tag = mysqli_fetch_array($q_tag)){ $tag_string = $tag_string . "$r_tag[tag], "; $tag_raw = $tag_raw . "$r_tag[tag],"; } $tag_string = substr($tag_string, 0, strlen($tag_string) - 2); $tag_string = $tag_string . ""; $tag_raw = substr($tag_raw, 0, strlen($tag_raw) - 1); echo "\n"; echo "\n"; } else echo "\n"; #Comment counter if ($r['comments'] == 1){ $q_comment = mysqli_query($con, "SELECT count(id) AS count FROM post_comment WHERE post = $r[id] AND visible = 1;"); $r_comment = mysqli_fetch_array($q_comment); echo "\n"; if ($r_comment['count'] == 1) echo "\n"; echo "\n"; echo "

\n"; } #Pager $q_count = mysqli_query($con, "SELECT COUNT(id) AS count FROM post WHERE visible = 1;"); $r_count = mysqli_fetch_array($q_count); $cur_page = (int) ($offset / 5) + 1; $max_page = (int) ($r_count['count'] / 5); if ($r_count['count'] % 5 != 0) $max_page ++; echo "
\n"; if ($cur_page > 4){ echo "\n"; for ($i = $cur_page - 2; $i < $cur_page; $i ++) echo "\n"; } else for ($i = 1; $i < $cur_page; $i ++) echo "\n"; echo "\n"; if ($cur_page + 4 < $max_page){ for ($i = $cur_page + 1; $i < $cur_page + 3; $i ++) echo ""; echo ""; } else for ($i = $cur_page + 1; $i <= $max_page; $i ++) echo ""; echo "
1
...
" . $i . "
" . $i . "
$cur_page
" . $i . "
...
$max_page
" . $i . "
\n"; ?>