| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
// Get the current profile ID |
|---|
| 6 |
|
|---|
| 7 |
global $profile_id; |
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
if (!isset($_REQUEST['weblog_offset'])) { |
|---|
| 11 |
$weblog_offset = 0; |
|---|
| 12 |
} else { |
|---|
| 13 |
$weblog_offset = $_REQUEST['weblog_offset']; |
|---|
| 14 |
} |
|---|
| 15 |
$weblog_offset = (int) $weblog_offset; |
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
$where = run("users:access_level_sql_where",$_SESSION['userid']); |
|---|
| 21 |
$posts = db_query("select * from weblog_posts where ($where) and owner = $profile_id order by posted desc limit $weblog_offset,25"); |
|---|
| 22 |
$numberofposts = db_query("select count(ident) as numberofposts from weblog_posts where ($where) and owner = $profile_id"); |
|---|
| 23 |
$numberofposts = $numberofposts[0]->numberofposts; |
|---|
| 24 |
|
|---|
| 25 |
if (sizeof($posts > 0) || sizeof($friendsposts > 0)) { |
|---|
| 26 |
|
|---|
| 27 |
$lasttime = ""; |
|---|
| 28 |
|
|---|
| 29 |
foreach($posts as $post) { |
|---|
| 30 |
|
|---|
| 31 |
$time = gmdate("F d, Y",$post->posted); |
|---|
| 32 |
if ($time != $lasttime) { |
|---|
| 33 |
$run_result .= "<h2 class=\"weblogdateheader\">$time</h2>\n"; |
|---|
| 34 |
$lasttime = $time; |
|---|
| 35 |
} |
|---|
| 36 |
|
|---|
| 37 |
$run_result .= run("weblogs:posts:view",$post); |
|---|
| 38 |
|
|---|
| 39 |
} |
|---|
| 40 |
|
|---|
| 41 |
$weblog_name = htmlentities(stripslashes($_REQUEST['weblog_name'])); |
|---|
| 42 |
|
|---|
| 43 |
if ($numberofposts - ($weblog_offset + 25) > 0) { |
|---|
| 44 |
$display_weblog_offset = $weblog_offset + 25; |
|---|
| 45 |
$run_result .= <<< END |
|---|
| 46 |
|
|---|
| 47 |
<a href="/{$weblog_name}/weblog/skip={$display_weblog_offset}"><< Previous 25</a> |
|---|
| 48 |
|
|---|
| 49 |
END; |
|---|
| 50 |
} |
|---|
| 51 |
if ($weblog_offset > 0) { |
|---|
| 52 |
$display_weblog_offset = $weblog_offset - 25; |
|---|
| 53 |
if ($display_weblog_offset < 0) { |
|---|
| 54 |
$display_weblog_offset = 0; |
|---|
| 55 |
} |
|---|
| 56 |
$run_result .= <<< END |
|---|
| 57 |
|
|---|
| 58 |
<a href="/{$weblog_name}/weblog/skip={$display_weblog_offset}">Next 25 >></a> |
|---|
| 59 |
|
|---|
| 60 |
END; |
|---|
| 61 |
} |
|---|
| 62 |
|
|---|
| 63 |
} |
|---|
| 64 |
|
|---|
| 65 |
?> |
|---|