[2] | 1 | <?php |
---|
| 2 | /**************************************************************************\ |
---|
| 3 | * eGroupWare - Webpage news admin * |
---|
| 4 | * http://www.egroupware.org * |
---|
| 5 | * -------------------------------------------- * |
---|
| 6 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 7 | * under the terms of the GNU General Public License as published by the * |
---|
| 8 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 9 | * option) any later version. * |
---|
| 10 | * -------------------------------------------- * |
---|
| 11 | * This program was sponsered by Golden Glair productions * |
---|
| 12 | * http://www.goldenglair.com * |
---|
| 13 | \**************************************************************************/ |
---|
| 14 | |
---|
| 15 | include('setup.inc.php'); |
---|
| 16 | |
---|
| 17 | $tpl->set_file(array('news' => 'news.tpl', |
---|
| 18 | 'row' => 'news_row.tpl') |
---|
| 19 | ); |
---|
| 20 | |
---|
| 21 | $db->query("SELECT COUNT(*) FROM phpgw_news WHERE news_status='Active'"); |
---|
| 22 | $db->next_record(); |
---|
| 23 | $total = $db->f(0); |
---|
| 24 | |
---|
| 25 | if (! $oldnews) |
---|
| 26 | { |
---|
| 27 | $db->query("SELECT *,account_lid AS submittedby FROM phpgw_news,phpgw_accounts WHERE news_status='Active' " |
---|
| 28 | . "AND news_submittedby=phpgw_accounts.account_id ORDER BY news_date DESC LIMIT 5"); |
---|
| 29 | } |
---|
| 30 | else |
---|
| 31 | { |
---|
| 32 | $db->query("SELECT *,account_lid AS submittedby FROM phpgw_news,phpgw_accounts WHERE news_status='Active' AND " |
---|
| 33 | . "news_submittedby=phpgw_accounts.account_id ORDER BY news_date DESC LIMIT 5,$total"); |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | while ($db->next_record()) |
---|
| 37 | { |
---|
| 38 | $tpl->set_var('subject',$db->f('news_subject')); |
---|
| 39 | $tpl->set_var('submitedby','Submitted by ' . $db->f('submittedby') . ' on ' . date("m/d/Y - h:m:s a",$db->f('news_date'))); |
---|
| 40 | $tpl->set_var('content',nl2br($db->f('news_content'))); |
---|
| 41 | |
---|
| 42 | $tpl->parse('rows','row',True); |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | $tpl->pparse('out','news'); |
---|
| 46 | |
---|
| 47 | if ($total > 5 && ! $oldnews) |
---|
| 48 | { |
---|
| 49 | echo '<center><a href="index.php?oldnews=True">View news archives</a></center>'; |
---|
| 50 | } |
---|
| 51 | ?> |
---|
| 52 | <p> </p> |
---|
| 53 | |
---|
| 54 | <div align="center"><font size="-1">This page uses the news admin from <a href="http://www.egroupware.org">eGroupWare</a></font></div> |
---|