4 * SourceForge News Facility
6 * SourceForge: Breaking Down the Barriers to Open Source Development
7 * Copyright 1999-2001 (c) VA Linux Systems
8 * http://sourceforge.net
15 require_once('pre.php');
16 require_once('news_admin_utils.php');
17 //common forum tools which are used during the creation/editing of news items
18 require_once('www/forum/forum_utils.php');
20 if ($group_id && $group_id != $sys_news_group && user_ismember($group_id,'A')) {
23 Per-project admin pages.
25 Shows their own news items so they can edit/update.
27 If their news is on the homepage, and they edit, it is removed from
34 Update the db so the item shows on the home page
36 if ($status != 0 && $status != 4) {
37 //may have tampered with HTML to get their item on the home page
41 //foundry stuff - remove this news from the foundry so it has to be re-approved by the admin
42 db_query("DELETE FROM foundry_news WHERE news_id='$id'");
51 $sql="UPDATE news_bytes SET is_approved='$status', summary='".htmlspecialchars($summary)."', ".
52 "details='".htmlspecialchars($details)."' WHERE id='$id' AND group_id='$group_id'";
53 $result=db_query($sql);
55 if (!$result || db_affected_rows($result) < 1) {
56 $feedback .= ' ERROR doing group update ';
58 $feedback .= ' Project NewsByte Updated. ';
68 news_header(array('title'=>'NewsBytes','pagename'=>'news_admin'));
75 $sql="SELECT * FROM news_bytes WHERE id='$id' AND group_id='$group_id'";
76 $result=db_query($sql);
77 if (db_numrows($result) < 1) {
78 exit_error('Error','Error - none found');
82 <H3>Approve a NewsByte For Project: '.group_getname($group_id).'</H3>
84 <FORM ACTION="'.$PHP_SELF.'" METHOD="POST">
85 <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="'.db_result($result,0,'group_id').'">
86 <INPUT TYPE="HIDDEN" NAME="id" VALUE="'.db_result($result,0,'id').'">
88 <B>Submitted by:</B> '.user_getname(db_result($result,0,'submitted_by')).'<BR>
89 <INPUT TYPE="HIDDEN" NAME="approve" VALUE="y">
90 <INPUT TYPE="HIDDEN" NAME="post_changes" VALUE="y">
93 <INPUT TYPE="RADIO" NAME="status" VALUE="0" CHECKED> Displayed<BR>
94 <INPUT TYPE="RADIO" NAME="status" VALUE="4"> Delete<BR>
97 <INPUT TYPE="TEXT" NAME="summary" VALUE="'.db_result($result,0,'summary').'" SIZE="30" MAXLENGTH="60"><BR>
99 <TEXTAREA NAME="details" ROWS="5" COLS="50" WRAP="SOFT">'.db_result($result,0,'details').'</TEXTAREA><P>
100 <B>If this item is on the '.$GLOBALS['sys_name'].' home page and you edit it, it will be removed from the home page.</B><BR>
101 <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="SUBMIT">
106 Show list of waiting news items
109 $sql="SELECT * FROM news_bytes WHERE is_approved <> 4 AND group_id='$group_id'";
110 $result=db_query($sql);
111 $rows=db_numrows($result);
114 <H4>No Queued Items Found For Project: '.group_getname($group_id).'</H1>';
117 <H4>These News Items Were Submitted For Project: '.group_getname($group_id).'</H4>
119 for ($i=0; $i<$rows; $i++) {
121 <A HREF="/news/admin/?approve=1&id='.db_result($result,$i,'id').'&group_id='.
122 db_result($result,$i,'group_id').'">'.
123 db_result($result,$i,'summary').'</A><BR>';
128 news_footer(array());
130 } else if (user_ismember($sys_news_group,'A')) {
133 News uber-user admin pages
135 Show all waiting news items except those already rejected.
137 Admin members of $sys_news_group (news project) can edit/change/approve news items
144 Update the db so the item shows on the home page
146 $sql="UPDATE news_bytes SET is_approved='1', date='".time()."', ".
147 "summary='".htmlspecialchars($summary)."', details='".htmlspecialchars($details)."' WHERE id='$id'";
148 $result=db_query($sql);
149 if (!$result || db_affected_rows($result) < 1) {
150 $feedback .= ' ERROR doing update ';
152 $feedback .= ' NewsByte Updated. ';
154 } else if ($status==2) {
156 Move msg to deleted status
158 $sql="UPDATE news_bytes SET is_approved='2' WHERE id='$id'";
159 $result=db_query($sql);
160 if (!$result || db_affected_rows($result) < 1) {
161 $feedback .= ' ERROR doing update ';
162 $feedback .= db_error();
164 $feedback .= ' NewsByte Deleted. ';
173 } else if ($mass_reject) {
175 Move msg to rejected status
177 $sql="UPDATE news_bytes "
178 ."SET is_approved='2' "
179 ."WHERE id IN ('".implode($news_id,"','")."')";
180 $result=db_query($sql);
181 if (!$result || db_affected_rows($result) < 1) {
182 $feedback .= ' ERROR doing update ';
183 $feedback .= db_error();
185 $feedback .= ' NewsBytes Rejected. ';
190 news_header(array('title'=>'NewsBytes','pagename'=>'news_admin'));
197 $sql="SELECT groups.unix_group_name,news_bytes.* ".
198 "FROM news_bytes,groups WHERE id='$id' ".
199 "AND news_bytes.group_id=groups.group_id ";
200 $result=db_query($sql);
201 if (db_numrows($result) < 1) {
202 exit_error('Error','Error - not found');
206 <H3>Approve a NewsByte</H3>
208 <FORM ACTION="'.$PHP_SELF.'" METHOD="POST">
209 <INPUT TYPE="HIDDEN" NAME="for_group" VALUE="'.db_result($result,0,'group_id').'">
210 <INPUT TYPE="HIDDEN" NAME="id" VALUE="'.db_result($result,0,'id').'">
211 <B>Submitted for group:</B> <a href="/projects/'.strtolower(db_result($result,0,'unix_group_name')).'/">'.group_getname(db_result($result,0,'group_id')).'</a><BR>
212 <B>Submitted by:</B> '.user_getname(db_result($result,0,'submitted_by')).'<BR>
213 <INPUT TYPE="HIDDEN" NAME="approve" VALUE="y">
214 <INPUT TYPE="HIDDEN" NAME="post_changes" VALUE="y">
215 <INPUT TYPE="RADIO" NAME="status" VALUE="1"> Approve For Front Page<BR>
216 <INPUT TYPE="RADIO" NAME="status" VALUE="0"> Do Nothing<BR>
217 <INPUT TYPE="RADIO" NAME="status" VALUE="2" CHECKED> Delete<BR>
219 <INPUT TYPE="TEXT" NAME="summary" VALUE="'.db_result($result,0,'summary').'" SIZE="30" MAXLENGTH="60"><BR>
221 <TEXTAREA NAME="details" ROWS="5" COLS="50" WRAP="SOFT">'.db_result($result,0,'details').'</TEXTAREA><BR>
222 <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="SUBMIT">
228 Show list of waiting news items
231 $old_date = time()-60*60*24*30;
233 SELECT groups.group_id,id,date,summary,
234 group_name,unix_group_name
235 FROM news_bytes,groups
237 AND news_bytes.group_id=groups.group_id
238 AND date > '$old_date'
239 AND groups.is_public=1
240 AND groups.status='A'
244 $old_date = time()-(60*60*24*7);
246 SELECT groups.group_id,id,date,summary,
247 group_name,unix_group_name
248 FROM news_bytes,groups
250 AND news_bytes.group_id=groups.group_id
251 AND date > '$old_date'
256 SELECT groups.group_id,id,date,summary,
257 group_name,unix_group_name
258 FROM news_bytes,groups
260 AND news_bytes.group_id=groups.group_id
261 AND date > '$old_date'
265 show_news_approve_form(
272 news_footer(array());
276 exit_error('Permission Denied.','Permission Denied. You have to be an admin on the project you are editing or a member of the '.$GLOBALS['sys_name'].' News team.');