| 1 |
<?php |
| 2 |
/** |
| 3 |
* File functions: |
| 4 |
* Adding news in game |
| 5 |
* |
| 6 |
* @name : addnews.php |
| 7 |
* @copyright : (C) 2004-2005 Vallheru Team based on Gamers-Fusion ver 2.5 |
| 8 |
* @author : thindil <thindil@users.sourceforge.net> |
| 9 |
* @version : 1.0 rc1 |
| 10 |
* @since : 06.12.2005 |
| 11 |
* |
| 12 |
*/ |
| 13 |
|
| 14 |
// |
| 15 |
// |
| 16 |
// This program is free software; you can redistribute it and/or modify |
| 17 |
// it under the terms of the GNU General Public License as published by |
| 18 |
// the Free Software Foundation; either version 2 of the License, or |
| 19 |
// (at your option) any later version. |
| 20 |
// |
| 21 |
// This program is distributed in the hope that it will be useful, |
| 22 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 23 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 24 |
// GNU General Public License for more details. |
| 25 |
// |
| 26 |
// You should have received a copy of the GNU General Public License |
| 27 |
// along with this program; if not, write to the Free Software |
| 28 |
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 29 |
// |
| 30 |
// |
| 31 |
|
| 32 |
$title = "Dodaj PlotkÄ™"; |
| 33 |
require_once("includes/head.php"); |
| 34 |
|
| 35 |
/** |
| 36 |
* Get the localization for game |
| 37 |
*/ |
| 38 |
require_once("languages/".$player -> lang."/addnews.php"); |
| 39 |
|
| 40 |
if ($player -> rank != "Admin" && $player -> rank != 'Staff' && $player -> rank != 'Kronikarz') |
| 41 |
{ |
| 42 |
error (NOT_HAVE); |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* Check avaible languages |
| 47 |
*/ |
| 48 |
$path = 'languages/'; |
| 49 |
$dir = opendir($path); |
| 50 |
$arrLanguage = array(); |
| 51 |
$i = 0; |
| 52 |
while ($file = readdir($dir)) |
| 53 |
{ |
| 54 |
if (!ereg(".htm*$", $file)) |
| 55 |
{ |
| 56 |
if (!ereg("\.$", $file)) |
| 57 |
{ |
| 58 |
$arrLanguage[$i] = $file; |
| 59 |
$i = $i + 1; |
| 60 |
} |
| 61 |
} |
| 62 |
} |
| 63 |
closedir($dir); |
| 64 |
|
| 65 |
/** |
| 66 |
* Assign variables and display page |
| 67 |
*/ |
| 68 |
$smarty -> assign(array("Ntitle" => N_TITLE, |
| 69 |
"Ntext" => N_TEXT, |
| 70 |
"Nadd" => N_ADD, |
| 71 |
"Nlangsel" => N_LANG_S, |
| 72 |
"Nlang" => $arrLanguage)); |
| 73 |
$smarty -> display('addnews.tpl'); |
| 74 |
|
| 75 |
if (isset ($_GET['action']) && $_GET['action'] == 'add') |
| 76 |
{ |
| 77 |
if (empty ($_POST['addtitle']) || empty ($_POST['addnews'])) |
| 78 |
{ |
| 79 |
error (EMPTY_FIELDS); |
| 80 |
} |
| 81 |
$_POST['addnews'] = nl2br($_POST['addnews']); |
| 82 |
$db -> Execute("INSERT INTO news (starter, title, news, lang, added) VALUES('".$player -> user." (".$player -> id.")','".$_POST['addtitle']."','".$_POST['addnews']."', '".$_POST['addlang']."', 'N')") or error(E_DB); |
| 83 |
error (N_SUCCES); |
| 84 |
} |
| 85 |
|
| 86 |
require_once("includes/foot.php"); |
| 87 |
?> |