diff options
Diffstat (limited to 'admin/news/functions.php')
-rw-r--r-- | admin/news/functions.php | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/admin/news/functions.php b/admin/news/functions.php index f98c4e2..1f9e34a 100644 --- a/admin/news/functions.php +++ b/admin/news/functions.php @@ -16,6 +16,29 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +date_default_timezone_set("America/New_York"); +function ListNews(){ + + global $db; + + $result = $db->Query("SELECT n.news_id, n.title, n.message, n.date, n.category_id, u.username AS author, c.name AS catname, c.image AS catimage ". + "FROM `bayonet_news` AS n ". + "INNER JOIN `bayonet_news_categories` AS c ON c.category_id = n.category_id ". + "LEFT OUTER JOIN `mybb_users` AS u ON u.uid = n.author_id ORDER BY `date` DESC"); + while($row = $db->Fetch($result)){ + + $newsBody = $row['message']; + echo "<a href=\"?op=news&edit={$row['news_id']}\">"; + echo "<span class=\"bold\">{$row['title']}</span> | <span class=\"blue\">{$row['catname']}</span> <img src=\"images/page.png\" /></a><br />"; + if(($len = strlen($newsBody))>150) + echo substr($newsBody, 0, 150)."..."; + else + echo $newsBody; + echo '<br />'; + echo "Posted By: {$row['author']} on ".date('D M j, Y g:i a T', strtotime($row['date'])); + echo '<br /><br />'; + } +} function EditNews($news_id){ @@ -31,7 +54,7 @@ function EditNews($news_id){ $row = $db->Fetch($result); ?> - <h3>Edit Event</h3> + <h3>Edit News</h3> <form action="<?php $_SERVER['PHP_SELF']?>" method="post"> <table> <tr><th>Author</th><td><?php SelectAuthor($row['author_id']); ?></td></tr> |