| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
// Get the current profile ID |
|---|
| 6 |
|
|---|
| 7 |
global $page_owner; |
|---|
| 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 |
$where1 = run("users:access_level_sql_where",$_SESSION['userid']); |
|---|
| 18 |
|
|---|
| 19 |
// $_SESSION['friends_posts_cache']->created = time(); |
|---|
| 20 |
// $_SESSION['friends_posts_cache']->data = db_query("select * from weblog_posts where ($where1) and ($where2) order by posted desc limit $weblog_offset,25"); |
|---|
| 21 |
// } |
|---|
| 22 |
// $posts = $_SESSION['friends_posts_cache']->data; |
|---|
| 23 |
$posts = db_query("select * from weblog_posts where ($where1) order by posted desc limit $weblog_offset,25"); |
|---|
| 24 |
$numberofposts = db_query("select count(*) as numberofposts from weblog_posts where ($where1)"); |
|---|
| 25 |
$numberofposts = $numberofposts[0]->numberofposts; |
|---|
| 26 |
|
|---|
| 27 |
if (sizeof($posts > 0)) { |
|---|
| 28 |
|
|---|
| 29 |
$lasttime = ""; |
|---|
| 30 |
$url = url; |
|---|
| 31 |
|
|---|
| 32 |
foreach($posts as $post) { |
|---|
| 33 |
|
|---|
| 34 |
$time = gmdate("F d, Y",$post->posted); |
|---|
| 35 |
if ($time != $lasttime) { |
|---|
| 36 |
$run_result .= "<h2 class=\"weblog_dateheader\">$time</h2>\n"; |
|---|
| 37 |
$lasttime = $time; |
|---|
| 38 |
} |
|---|
| 39 |
|
|---|
| 40 |
$run_result .= run("weblogs:posts:view",$post); |
|---|
| 41 |
|
|---|
| 42 |
} |
|---|
| 43 |
|
|---|
| 44 |
$weblog_name = htmlentities(stripslashes($_REQUEST['weblog_name'])); |
|---|
| 45 |
|
|---|
| 46 |
if ($numberofposts - ($weblog_offset + 25) > 0) { |
|---|
| 47 |
$display_weblog_offset = $weblog_offset + 25; |
|---|
| 48 |
$back = gettext("Back"); |
|---|
| 49 |
$run_result .= <<< END |
|---|
| 50 |
|
|---|
| 51 |
<a href="{$url}_weblog/everyone.php?weblog_offset={$display_weblog_offset}"><< $back</a> |
|---|
| 52 |
<!-- <form action="" method="post" style="display:inline"> |
|---|
| 53 |
<input type="submit" value="<< Previous 25" /> |
|---|
| 54 |
<input type="hidden" name="weblog_offset" value="{$display_weblog_offset}" /> |
|---|
| 55 |
</form> --> |
|---|
| 56 |
|
|---|
| 57 |
END; |
|---|
| 58 |
} |
|---|
| 59 |
if ($weblog_offset > 0) { |
|---|
| 60 |
$display_weblog_offset = $weblog_offset - 25; |
|---|
| 61 |
if ($display_weblog_offset < 0) { |
|---|
| 62 |
$display_weblog_offset = 0; |
|---|
| 63 |
} |
|---|
| 64 |
$next = gettext("Next"); |
|---|
| 65 |
$run_result .= <<< END |
|---|
| 66 |
|
|---|
| 67 |
<a href="{$url}_weblog/everyone.php?weblog_offset={$display_weblog_offset}">$next >></a> |
|---|
| 68 |
<!-- <form action="" method="post" style="display:inline"> |
|---|
| 69 |
<input type="submit" value="Next 25 >>" /> |
|---|
| 70 |
<input type="hidden" name="weblog_offset" value="{$display_weblog_offset}" /> |
|---|
| 71 |
</form> --> |
|---|
| 72 |
|
|---|
| 73 |
END; |
|---|
| 74 |
} |
|---|
| 75 |
|
|---|
| 76 |
} |
|---|
| 77 |
|
|---|
| 78 |
?> |
|---|