diff -r -u --new-file original\announce.php patched\announce.php
--- original\announce.php Thu Jan 01 02:00:00 1970
+++ patched\announce.php Sat Apr 17 15:06:24 2010
@@ -0,0 +1,82 @@
+<?php
+
+/**
+ * announce.php
+ *
+ * @v2
+ * @copyright 2010 by Gorlum for http://ogame.triolan.com.ua
+ * based on admin/activeplanet.php (c) 2008 for XNova
+ */
+
+define('INSIDE', true);
+define('INSTALL' , false);
+
+$ugamela_root_path = './';
+include($ugamela_root_path . 'extension.inc');
+include($ugamela_root_path . 'common.' . $phpEx);
+
+includeLang('admin');
+
+$parse = $lang;
+$parse['dpath'] = $dpath;
+
+if ($user['authlevel'] >= 3) {
+ if (!empty($_POST['text'])){
+
+ $idAnnounce = intval(mysql_real_escape_string($_POST['id']));
+ $dtDateTime = empty($_POST['dtDateTime']) ? ("FROM_UNIXTIME(".time().")") : "'" . mysql_real_escape_string($_POST['dtDateTime']) . "'";
+ $strText = mysql_real_escape_string($_POST['text']);
+
+ if ($_POST['mode']=='edit'){
+ doquery( "UPDATE {{table}} SET `tsTimeStamp`={$dtDateTime}, `strAnnounce`='{$strText}' WHERE `idAnnounce`={$idAnnounce}", 'announce');
+ }else{
+ doquery( "INSERT INTO {{table}} SET `tsTimeStamp`={$dtDateTime}, `strAnnounce`='{$strText}'", 'announce');
+ }
+ };
+
+ if ($_GET['cmd']=='del'){
+ $idAnnounce = intval(mysql_real_escape_string($_GET['id']));
+ doquery( "DELETE FROM {{table}} WHERE `idAnnounce`={$idAnnounce}", 'announce');
+ };
+
+ if ($_GET['cmd']=='edit'){
+ $parse['id'] = intval(mysql_real_escape_string($_GET['id']));
+ $announce = doquery("SELECT * FROM {{table}} where `idAnnounce`={$parse['id']}", 'announce', true);
+ $parse['tsTimeStamp'] = $announce['tsTimeStamp'];
+ $parse['strAnnounce'] = $announce['strAnnounce'];
+ };
+
+ if ($_GET['cmd']=='dup'){
+ $announce = doquery("SELECT * FROM {{table}} where `idAnnounce`=".intval(mysql_real_escape_string($_GET['id'])), 'announce', true);
+ $parse['tsTimeStamp'] = $announce['tsTimeStamp'];
+ $parse['strAnnounce'] = $announce['strAnnounce'];
+ };
+ $parse['mode']=$_GET['cmd'];
+}else{
+ $parse['DisplayAdmin'] = "display: none";
+}
+
+$PageTPL = gettemplate('announce');
+$allAnnounces = doquery("SELECT * FROM {{table}} ORDER BY `tsTimeStamp` DESC", 'announce');
+$Count = 0;
+
+while ($announce = mysql_fetch_array($allAnnounces)) {
+ $parse['announces'] .= "<tr>";
+ $parse['announces'] .= "<td class=b>". str_replace(" ", " ", $announce['tsTimeStamp']) ."</td>";
+ $parse['announces'] .= "<td class=b align=justify>". $announce['strAnnounce'] ."</td>";
+ if ($user['authlevel'] >= 1) {
+ $parse['announces'] .= "<td class=b><center><a href=\"announce.php?cmd=edit&id=".$announce['idAnnounce']."\">Ed</a></th>";
+ $parse['announces'] .= "<td class=b><center><a href=\"announce.php?cmd=dup&id=".$announce['idAnnounce']."\">Dup</a></th>";
+ $parse['announces'] .= "<td class=b><center><a href=\"announce.php?cmd=del&id=".$announce['idAnnounce']."\"><img src=\"../images/r1.png\"></a></th>";
+ }
+ $parse['announces'] .= "</tr>";
+ $Count++;
+}
+
+$parse['announces_total'] = $Count;
+$parse['colspan'] = ($user['authlevel'] >= 1) ? 5 : 2;
+
+$page = parsetemplate( $PageTPL , $parse );
+
+display( $page, $lang['adm_an_title']);
+?>
\ No newline at end of file
diff -r -u --new-file original\language\en\admin.mo patched\language\en\admin.mo
--- original\language\en\admin.mo Sat Apr 17 15:15:11 2010
+++ patched\language\en\admin.mo Sat Apr 17 15:14:43 2010
@@ -61,6 +61,12 @@
$lang['adm_pl_they'] = "Всего";
$lang['adm_pl_apla'] = "планет активно";
+$lang['adm_an_title'] = "Announces";
+$lang['adm_an_date'] = "Date";
+$lang['adm_an_announce'] = "Announce";
+$lang['adm_an_total'] = "Announces total: ";
+$lang['adm_an_add'] = "Add announce";
+
$lang['adm_am_plid'] = "ID планеты";
$lang['adm_am_done'] = "Добавление прошло успешно";
$lang['adm_am_ttle'] = "Добавить ресурсы";
diff -r -u --new-file original\language\en\leftmenu.mo patched\language\en\leftmenu.mo
--- original\language\en\leftmenu.mo Sat Apr 17 15:15:12 2010
+++ patched\language\en\leftmenu.mo Sat Apr 17 15:15:26 2010
@@ -71,6 +71,7 @@
// Administrator menu links
$lang['adm_over'] = 'Общая информация';
+$lang['adm_announce'] = 'News';
$lang['adm_conf'] = 'Конфигурация';
$lang['adm_reset'] = 'Сброс вселенной';
diff -r -u --new-file original\language\ru\admin.mo patched\language\ru\admin.mo
--- original\language\ru\admin.mo Sat Apr 17 15:15:14 2010
+++ patched\language\ru\admin.mo Sat Apr 17 01:44:01 2010
@@ -60,6 +60,12 @@
$lang['adm_pl_they'] = "Всего";
$lang['adm_pl_apla'] = "планет(а/ы)";
+$lang['adm_an_title'] = "Новости";
+$lang['adm_an_date'] = "Дата";
+$lang['adm_an_announce'] = "Содержание";
+$lang['adm_an_total'] = "Всего новостей: ";
+$lang['adm_an_add'] = "Добавить новость";
+
$lang['adm_am_plid'] = "ID планеты";
$lang['adm_am_done'] = "Добавление прошло успешно";
$lang['adm_am_ttle'] = "Добавить ресурсы";
diff -r -u --new-file original\language\ru\leftmenu.mo patched\language\ru\leftmenu.mo
--- original\language\ru\leftmenu.mo Sat Apr 17 15:15:15 2010
+++ patched\language\ru\leftmenu.mo Fri Apr 16 23:53:21 2010
@@ -63,9 +63,10 @@
$lang['infog'] = 'Информация';
//
-$lang['adm_over'] = 'Обзор';
-$lang['adm_conf'] = 'Настройки';
-$lang['adm_reset'] = 'Обнуление';
+$lang['adm_over'] = 'Обзор';
+$lang['adm_announce'] = 'Новости';
+$lang['adm_conf'] = 'Настройки';
+$lang['adm_reset'] = 'Обнуление';
$lang['adm_plrlst'] = 'Список игроков';
$lang['adm_panel'] = 'Панель администратора';
diff -r -u --new-file original\overview.php patched\overview.php
--- original\overview.php Sat Apr 17 15:15:20 2010
+++ patched\overview.php Sat Apr 17 14:29:19 2010
@@ -356,7 +356,11 @@
// External Chat Frame ...
// Banner ADS Google (meme si je suis contre cela)
if ($game_config['OverviewNewsFrame'] == '1') {
- $parse['NewsFrame'] = "<tr><th>". $lang['ov_news_title'] ."</th><th colspan=\"3\">". stripslashes($game_config['OverviewNewsText']) ."</th></tr>";
+ $parse['NewsFrame'] = "<tr><td colspan=2 class=\"c\">". $lang['ov_news_title'] . "</td></tr>";
+ $lastAnnounces = doquery("SELECT * FROM {{table}} ORDER BY `tsTimeStamp` DESC LIMIT 3", 'announce');
+
+ while ($lastAnnounce = mysql_fetch_array($lastAnnounces))
+ $parse['NewsFrame'] .= "<tr><th><font color=Cyan>" . $lastAnnounce['tsTimeStamp'] . "</font>" ."</th><th colspan=\"3\" valign=top><div align=justify>" . stripslashes($lastAnnounce['strAnnounce']) ."</div></th></tr>";
}
if ($game_config['OverviewExternChat'] == '1') {
$parse['ExternalTchatFrame'] = "<tr><th colspan=\"4\">". stripslashes( $game_config['OverviewExternChatCmd'] ) ."</th></tr>";
diff -r -u --new-file original\sql\game_announce.sql patched\sql\game_announce.sql
--- original\sql\game_announce.sql Thu Jan 01 02:00:00 1970
+++ patched\sql\game_announce.sql Sat Apr 17 15:02:56 2010
@@ -0,0 +1,15 @@
+SET FOREIGN_KEY_CHECKS=0;
+-- ----------------------------
+-- Table structure for game_announce
+-- ----------------------------
+CREATE TABLE `game_announce` (
+ `idAnnounce` bigint(11) unsigned NOT NULL AUTO_INCREMENT,
+ `tsTimeStamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Date & Time of announce',
+ `strAnnounce` text NOT NULL,
+ PRIMARY KEY (`idAnnounce`),
+ KEY `indTimeStamp` (`tsTimeStamp`)
+) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+-- Records
+-- ----------------------------
diff -r -u --new-file original\templates\OpenGame\announce.tpl patched\templates\OpenGame\announce.tpl
--- original\templates\OpenGame\announce.tpl Thu Jan 01 02:00:00 1970
+++ patched\templates\OpenGame\announce.tpl Sat Apr 17 14:50:45 2010
@@ -0,0 +1,30 @@
+<h2>{adm_an_title}</h2>
+<table width="519" style="{DisplayAdmin}">
+<form action="announce.php" method="post" name="fForm">
+ <tr>
+ <td>{adm_an_date}</td>
+ <td><input name="dtDateTime" size="25" maxlength="19" value="{tsTimeStamp}"></td>
+ <input type="hidden" name="id" value="{id}"></td>
+ <input type="hidden" name="mode" value="{mode}"></td>
+ </tr>
+
+ <tr>
+ <td valign="top">{adm_an_announce}</td>
+ <td><textarea name="text" cols=40 rows=5 width="80%">{strAnnounce}</textarea></td>
+ </tr>
+ <tr><td colspan="2" align="center"><input type=submit value="{adm_an_add}"></td></tr>
+</form>
+</table>
+
+<table width="519">
+ <tr><td class="c" colspan="{colspan}">{adm_an_title}</td></tr>
+ <tr>
+ <th>{adm_an_date}</th>
+ <th width="100%">{adm_an_announce}</th>
+ <th style="{DisplayAdmin}">Ed</th>
+ <th style="{DisplayAdmin}">Dup</th>
+ <th style="{DisplayAdmin}"><img src="/images/r1.png"></th>
+ </tr>
+ {announces}
+ <tr><th class="b" colspan="{colspan}">{adm_an_total} {announces_total}</th></tr>
+</table>
diff -r -u --new-file original\templates\OpenGame\left_menu.tpl patched\templates\OpenGame\left_menu.tpl
--- original\templates\OpenGame\left_menu.tpl Sat Apr 17 15:15:18 2010
+++ patched\templates\OpenGame\left_menu.tpl Sat Apr 17 01:48:41 2010
@@ -108,6 +108,7 @@
<tr><td class="lm_para">{m_h_rules}</td></tr>
<tr><td><a href="http://ogame.triolan.com.ua/phpBB3/viewtopic.php?f=3&t=974&start=0">Правила игры</a></td></tr>
<tr><td><a href="faq.php">{m_faq}</a></td></tr>
+ <tr><td><a href="announce.php">{adm_announce}</a></td></tr>
<tr><td class="lm_para">{m_h_control}</td></tr>
<tr><td><a href="overview.php"><span class="lm_overview">{Overview}</span></a></td></tr>