-
Notifications
You must be signed in to change notification settings - Fork 0
/
news.php
88 lines (68 loc) · 1.71 KB
/
news.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
require_once('includes/globals.inc');
emitTop('Peanut Butter -> News', $_SERVER['PHP_SELF']);
mysqlSetup();
$sqlquery = "SELECT `title`,`user`,`added`,`modified`,`text`,`id` FROM `pb_blog` "
. " WHERE `projid` = '-1' ORDER BY `modified` DESC LIMIT 10";
$result = mysql_query($sqlquery) or die('Invalid query: ' . mysql_error());
$count = mysql_num_rows($result);
if(isset($_GET['start']))
escapes('start',$_GET['start']);
else
escapes('start',0);
print("<h3>News:</h3>\n");
if($count > NUM_ENTRIES)
$showCount = NUM_ENTRIES;
else
$showCount = $count;
print("<h3>Posts ".($start + 1)."-".($start + $showCount)."</h3>\n");
print("<p>");
$self = $_SERVER['PHP_SELF'];
if($userType == ADMIN || $userType == SITEADMIN)
{
print('<a href="postNew.php?projid=-1">New Post</a> ');
print('<a href="postManagement.php?projid=-1">Manage Posts</a><br /><br />');
}
/***
** Set up links for "newest" "previous" and "next", based upon where we are
** in the results
**/
if(!$start)
{
print("Newest <<Prev ".NUM_ENTRIES." ");
}
else
{
$newval = $start - NUM_ENTRIES;
if($newval < 0) $newval = 0;
print("<a href=\"$self\">Newest</a> "
. "<a href=\"$self&start=$newval\"><< Prev ".NUM_ENTRIES
. "</a> ");
}
if($count > NUM_ENTRIES)
{
$newval = $start + NUM_ENTRIES;
print("<a href=\"$self&start=$newval\">Next ".NUM_ENTRIES.">></a>");
$count = NUM_ENTRIES;
}
else
{
print("Next ".NUM_ENTRIES.">>");
}
print("</p><br />");
if(!$count)
{
print("<h3>No news.</h3>");
}
else
{
for($i = $start; $i < $start + $count; $i++)
{
$row = mysql_fetch_assoc($result);
$row = cleanValues($row);
emitPost($row);
}
}
mysql_close();
emitBottom();
?>