[Openfirst-cvscommit] SF.net SVN: openfirst: [205] trunk/src/news
Brought to you by:
xtimg
From: <ast...@us...> - 2006-06-28 18:00:53
|
Revision: 205 Author: astronouth7303 Date: 2006-06-28 11:00:46 -0700 (Wed, 28 Jun 2006) ViewCVS: http://svn.sourceforge.net/openfirst/?rev=205&view=rev Log Message: ----------- - Found readnews.php! - Modified viewnews() so that $admin is no longer given, but $id is (optionally) Modified Paths: -------------- trunk/src/news/viewnews.php Added Paths: ----------- trunk/src/news/readnews.php Added: trunk/src/news/readnews.php =================================================================== --- trunk/src/news/readnews.php (rev 0) +++ trunk/src/news/readnews.php 2006-06-28 18:00:46 UTC (rev 205) @@ -0,0 +1,24 @@ +<?php +/* + * openFIRST.news - readnews.php + * + * Copyright (C) 2003, + * openFIRST Project + * Original Author: Tim Ginn <tim...@sy...> + * + * Based on the original code from openFIRST. Edited and refined by David Di Biase + * Copyright (C) 2003, Archangel Robotics #1049 * + */ + +include_once("../includes/globals.php"); +$Title = "Read News"; +include_once($ogHeader); + +if(isset($_GET['id'])){ + shownews(1,$_GET['id']); +} else { + shownews(); +} +?> +[ <a href="index.php?show=all">Show All News</a> ] +<?php include_once($ogFooter); ?> Property changes on: trunk/src/news/readnews.php ___________________________________________________________________ Name: of:module + openfirst.news Name: svn:mime-type + text/x-php Name: svn:eol-style + native Modified: trunk/src/news/viewnews.php =================================================================== --- trunk/src/news/viewnews.php 2006-06-23 23:34:24 UTC (rev 204) +++ trunk/src/news/viewnews.php 2006-06-28 18:00:46 UTC (rev 205) @@ -25,11 +25,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ - function shownews($limit = 5,$admin=false) { +function shownews($limit = 5, $id=false) { // Get a list of the users able to // be contacted via the feedback form. - global $ogBasePath, $ogDB; - $query = $ogDB->select('news', '*', '', array('order'=>'post_date', 'dir'=>'DESC', 'limit' => $limit)); + global $ogBasePath, $ogDB, $ogUser; + if ($id === false) { + $query = $ogDB->select('news', '*', '', array('order'=>'post_date', 'dir'=>'DESC', 'limit' => $limit)); + } else { + $query = $ogDB->select('news', '*', array('ID' => $id), array('limit' => 1)); + } if ($ogDB->numberOfRows($query) != 0){ @@ -47,7 +51,7 @@ echo($news->news); } echo("<br /><br /><center>[ <a href='{$ogBasePath}/news/comments.php?ID={$news->ID}'>View Comments</a> ]</center></td></tr>"); - if ($admin) { + if ($ogUser->isAdmin()) { #TODO: Add ACL system echo('<tr><td class="sub"><div style="" align="right">Admin options: <a href="'.$ogBasePath.'/news/admin/editnews.php?id='.$news->ID.'"><img alt="Edit story" border=0 src="'.$ogBasePath.'/news/images/newdoc.gif" align=absmiddle>Edit story</a>'); echo('<a href="'.$ogBasePath.'/news/admin/killnews.php?id='.$news->ID.'"><img alt="Delete story" border=0 src="'.$ogBasePath.'/news/images/killdoc.gif" align=absmiddle>Delete story</a></div></td></tr>'); } @@ -61,5 +65,5 @@ echo("<div align=center>[ <b><a href=\"$ogBasePath/news/admin\">Post News</a></b> ]</div>"); } return(0); - } +} ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |