-
Notifications
You must be signed in to change notification settings - Fork 0
/
projectInfo.php
161 lines (125 loc) · 3.28 KB
/
projectInfo.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?php
require_once('includes/globals.inc');
if(isset($_GET['projid']))
{
$projid = $_GET['projid'];
$projinfo = getProjInfoFromId($projid);
$name = $projinfo[0];
$owner = $projinfo[1];
escapes('projid', $projid);
escapes('name', $name);
escapes('owner', $owner);
$isNews = isNews($projid);
emitTop('Peanut Butter -> Projects -> Info: '.$name, $_SERVER['PHP_SELF']."?projid=$urlprojid");
if($name == '')
{
errAndDie('Project not found.');
}
}
else
{
emitTop('Peanut Butter -> Projects -> Info [ERROR]', $_SERVER['PHP_SELF']);
errAndDie('Project id not specified.');
}
mysqlSetup();
$sqlquery = "SELECT * FROM `pb_projects` WHERE `id` = '$mprojid'";
$result = mysql_query($sqlquery) or die('Invalid query: ' . mysql_error());
if($row = mysql_fetch_assoc($result))
{
$name = $row['name'];
?>
<h2><?php echo $name?>
<?php
if($userType == SITEADMIN || ($userType == ADMIN && $row['owner'] == $userName))
{
print(" <a href=\"projectEdit.php?projid=$urlprojid\">Edit</a>");
print(" <a href=\"projectDelete.php?projid=$urlprojid\">Delete</a>");
}
?>
</h2>
<table id="projectinfo">
<?php
$row = cleanValues($row);
foreach($row as $key => $value)
{
if($key == 'progress')
$value = "<img src=\"pngbar.php?rating=$value&type=progress\" />";
elseif($key == 'priority')
$value = "<img src=\"pngbar.php?rating=$value&type=priority\" />";
elseif($key == 'owner')
$owner = $value;
print("<tr>\n");
print("\t<th align=\"left\">$key</th>\n");
print("\t<td>$value</td>\n");
print("</tr>\n");
}
}
?>
</table>
<?php
if(isset($_GET['start']))
escapes('start',$_GET['start']);
else
escapes('start',0);
escapes('name',$name);
$sqlquery = "SELECT B.`title`,B.`user`,B.`added`,B.`modified`,B.`text`,`pb_projects`.`name` AS `project`,B.`id` "
. "FROM `pb_blog` AS B LEFT JOIN `pb_projects` ON `pb_projects`.`id` = `projid` "
. "WHERE `projid` = '$mprojid'"
. "ORDER BY `modified` DESC LIMIT $mstart,"
. ($start + NUM_ENTRIES + 1);
$result = mysql_query($sqlquery) or die('Invalid query: ' . mysql_error());
$count = mysql_num_rows($result);
if($count > NUM_ENTRIES)
$showCount = NUM_ENTRIES;
else
$showCount = $count;
print("<h3>Posts ".($start + 1)."-".($start + $showCount)."</h3>\n");
if($userType != VISITOR)
{
?><a href="postNew.php?projid=<?php echo $urlprojid;?>">New Post</a><?php
}
if($userType == SITEADMIN || ($userType == ADMIN && $owner == $userName))
{
?> <a href="postManagement.php?projid=<?php echo $urlprojid;?>">Manage Posts</a><?php
}
print("<p>");
$self = $_SERVER['PHP_SELF']."?id=$urlid";
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("<br />");
if(!$count)
{
print("<h3>No entries.</h3>");
}
else
{
for($i = $start; $i < $start + $count; $i++)
{
$row = mysql_fetch_assoc($result);
$row = cleanValues($row);
emitPost($row);
}
}
mysql_close();
?>
<?php emitBottom();?>