<?php
/****************************************************************************
* Copyright (C) 2000 Bryan Brunton
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
****************************************************************************/
page_open(array("sess" => "ME_Session_Uncached", "auth" => "ME_Auth", "user" => "ME_User"));
$sess->register("player_id");
$sess->register("player_dead");
include("./lib/player.php");
include("./lib/ship.php");
include("./merchantempiresdefines.php");
include("./lib/player_redirect.php");
?>
<html><head><title>Merchant Empires: News</title>
<link rel=stylesheet href="./merchantempires.css" type=text/css>
</head><body text=white background="./images/createbg.gif"><?php
include("./templates/header.html");
?>
<table width=100%><tr>
<td width=100 vAlign=top><?php
$player = new ME_Player;
$player->get_player($player_id);
$player_dead = $player->f("dead");
$game_id = $player->f("game_id");
$ship = new ME_Ship;
$ship->get_ship($player_id);
$ship->add_parameter("time", date ("Y H:i:s"));
$ship->add_parameter("current_screen", "news");
echo $ship->get_transform("./xslt/mainmenu.xslt", $ship->get_xml());
?>
</td>
<td vAlign=top align=left width=0> </td>
<td vAlign=top width=490>
<table border=0 cellPadding=0 cellSpacing=0>
<tr>
<td bgColor=#993300>
<table border=0 cellPadding=5 cellSpacing=1 width=500>
<tr>
<td width=200 bgColor=#000000 align=left valign=middle><?php
if (!isset($arg)) {
$today = " <img alt='Today' border=0 src='./images/submenu/today-on.png'>";
$yesterday = "<a href=" . $sess->url(URL . "news.php?arg=1") . "><img alt='Yesterday' border=0 src='./images/submenu/yesterday-off.png'></a>";
$weekly = "<a href=" . $sess->url(URL . "news.php?arg=2") . "><img alt='Weekly' border=0 src='./images/submenu/weekly-off.png'></a>";
}
if ($arg == 1) {
$today = "<a href=" . $sess->url(URL . "news.php") . "><img alt='Today' border=0 src='./images/submenu/today-off.png'></a>";
$yesterday = "<img alt='Yesterday' border=0 src='./images/submenu/yesterday-on.png'></a>";
$weekly = "<a href=" . $sess->url(URL . "news.php?arg=2") . "><img alt='Weekly' border=0 src='./images/submenu/weekly-off.png'></a>";
} elseif ($arg == 2) {
$today = "<a href=" . $sess->url(URL . "news.php") . "><img alt='Today' border=0 src='./images/submenu/today-off.png'></a>";
$yesterday = "<a href=" . $sess->url(URL . "news.php?arg=1") . "><img alt='Yesterday' border=0 src='./images/submenu/yesterday-off.png'></a>";
$weekly = "<img border=0 src='./images/submenu/weekly-on.png'></a>";
}
?>
<table border=0>
<tr>
<td colspan=2 align=left>
<font color=#3333FF face=arial,helvetica,swiss size=5>NEWS</font>
</td>
</tr>
<tr>
<td><?php
echo $today;
?>
</td>
<td><?php
echo $yesterday;
?>
</td>
<td><?php
echo $weekly;
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br><?php
$db = new ME_DB;
$date = mktime(0,0,0,date("m"),date("d"),date("Y"));
$query = sprintf("SELECT * from news where date >= $date and game_id = '$game_id' order by date desc");
if ( $arg == 1 ) {
$date = mktime(0,0,0,date("m"),date("d") - 1,date("Y"));
$date_2 = mktime(0,0,0,date("m"),date("d"),date("Y"));
$query = sprintf("SELECT * from news where date >= $date and date <= $date_2 and game_id = '$game_id' order by date desc");
}
if ( $arg == 2 ) {
$date = mktime(0,0,0,date("m"),date("d") - 7,date("Y"));
$query = sprintf("SELECT * from news where date >= $date and game_id = '$game_id' order by date desc");
}
$db->query($query);
?>
<table border=0 cellPadding=0 cellSpacing=0 width=500>
<tr>
<td bgColor=#003399>
<table border=0 cellpadding=5 cellspacing=1 width=100%>
<tr>
<td width=15% class=clsHedTxt id=blu1><center>Date</center></td>
<td width=85% class=clsHedTxt id=blu1><center>News</center></td>
</tr><?php
while ( $db->next_record() ) {
echo "<tr><td class=clsNrmTxt>";
echo date ("m/d/y H:i:s", $db->f("date"));
echo "</td><td class=clsNrmTxt>";
echo $db->f("item");
echo "</td></tr>";
}
?>
</table>
<td>
</tr>
</table>
</td>
<td valign=top align=right width=100%><?php
include("./messages_display.php");
echo $player->get_transform("./xslt/player.xslt", $player->get_xml());
echo $ship->get_transform("./xslt/ship.xslt", $ship->get_xml());
?>
</td></tr></table>
</body></html><?php
page_close();
?>