Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

first commit

  • Loading branch information...
commit 6928cbcd1dbc112c2eb67b04b70c1e86e02ecffb 0 parents
unknown authored
Showing with 19,579 additions and 0 deletions.
  1. +141 −0 AC_OETags.js
  2. +142 −0 Admin/admin.php
  3. +70 −0 Admin/ajax.js
  4. +226 −0 GameEngine/Account.php
  5. +106 −0 GameEngine/Admin/Mods/addTroops.php
  6. +25 −0 GameEngine/Admin/Mods/cp.php
  7. +24 −0 GameEngine/Admin/Mods/editUser.php
  8. +26 −0 GameEngine/Admin/Mods/gold.php
  9. +25 −0 GameEngine/Admin/Mods/gold_1.php
  10. +43 −0 GameEngine/Admin/Mods/natarend.php
  11. +4 −0 GameEngine/Admin/_notes/dwsync.xml
  12. +108 −0 GameEngine/Admin/admin.php
  13. +70 −0 GameEngine/Admin/ajax.js
  14. +309 −0 GameEngine/Admin/database.php
  15. +168 −0 GameEngine/Admin/function.php
  16. +6 −0 GameEngine/Admin/welcome.tpl
  17. +370 −0 GameEngine/Alliance.php
  18. +2,617 −0 GameEngine/Automation.php
  19. +183 −0 GameEngine/BBCode.php
  20. +850 −0 GameEngine/Battle.php
  21. +741 −0 GameEngine/Building.php
  22. +382 −0 GameEngine/Chat.php
  23. +55 −0 GameEngine/Data/buidata.php
  24. +54 −0 GameEngine/Data/buidata.php_backup_postpercup
  25. +54 −0 GameEngine/Data/buidata.php_backup_postrespalfix
  26. +52 −0 GameEngine/Data/buidata.php_nk
  27. +49 −0 GameEngine/Data/cel.php
  28. +267 −0 GameEngine/Data/cp.php
  29. +74 −0 GameEngine/Data/hero_full.php
  30. +16 −0 GameEngine/Data/hunitdata.php
  31. +97 −0 GameEngine/Data/resdata.php
  32. +91 −0 GameEngine/Data/unitdata.php
  33. +24 −0 GameEngine/Database.php
  34. +2,497 −0 GameEngine/Database/db_MYSQL.php
  35. +81 −0 GameEngine/Form.php
  36. +16 −0 GameEngine/Game/WorldWonderName.php
  37. +161 −0 GameEngine/Generator.php
  38. +356 −0 GameEngine/Lang/en.php
  39. +300 −0 GameEngine/Lang/es.php
  40. +119 −0 GameEngine/Logging.php
  41. +75 −0 GameEngine/Mailer.php
  42. +264 −0 GameEngine/Market.php
  43. +391 −0 GameEngine/Message.php
  44. +54 −0 GameEngine/Multisort.php
  45. +1 −0  GameEngine/Notes/53038fc5cf739e9208444d036d8233c0.txt
  46. 0  GameEngine/Notes/DO NOT REMOVE THIS FOLDER.txt
  47. 0  GameEngine/Prevention/empty.txt
  48. 0  GameEngine/Prevention/lock.lock
  49. +142 −0 GameEngine/Profile.php
  50. +24 −0 GameEngine/Protection.php
  51. +569 −0 GameEngine/Ranking.php
  52. +195 −0 GameEngine/Session.php
  53. +626 −0 GameEngine/Technology.php
  54. +425 −0 GameEngine/Units.php
  55. +293 −0 GameEngine/Village.php
  56. BIN  GameEngine/favicon.ico
  57. +37 −0 GameEngine/functions.php
  58. +11 −0 README
  59. +1 −0  Templates/.htaccess
  60. +24 −0 Templates/Admin/404.tpl
  61. +311 −0 Templates/Admin/addTroops.tpl
  62. +44 −0 Templates/Admin/add_village.tpl
  63. +56 −0 Templates/Admin/admin_log.tpl
  64. +140 −0 Templates/Admin/alliance.tpl
  65. +8 −0 Templates/Admin/backup/admin_menu.tpl
  66. +39 −0 Templates/Admin/backup/bug_report.tpl
  67. +138 −0 Templates/Admin/backup/config.tpl
  68. +47 −0 Templates/Admin/backup/edit_ally.tpl
  69. +75 −0 Templates/Admin/backup/edit_user.tpl
  70. +3 −0  Templates/Admin/backup/intro.tpl
  71. +61 −0 Templates/Admin/backup/online_players.tpl
  72. +70 −0 Templates/Admin/backup/results - kopie.tpl
  73. +104 −0 Templates/Admin/backup/results.tpl
  74. +46 −0 Templates/Admin/backup/search.tpl
  75. +141 −0 Templates/Admin/backup/show_user.tpl
  76. +136 −0 Templates/Admin/backup/show_village.tpl
  77. +35 −0 Templates/Admin/backup/user_log_login.tpl
  78. +217 −0 Templates/Admin/ban.tpl
  79. +38 −0 Templates/Admin/ban_msg.tpl
  80. +506 −0 Templates/Admin/config.tpl
  81. +114 −0 Templates/Admin/deletion.tpl
  82. +125 −0 Templates/Admin/editUser.tpl
  83. +26 −0 Templates/Admin/gold.tpl
  84. +29 −0 Templates/Admin/home.tpl
  85. +53 −0 Templates/Admin/login.tpl
  86. +76 −0 Templates/Admin/login_log.tpl
  87. +44 −0 Templates/Admin/map.tpl
  88. +67 −0 Templates/Admin/message.tpl
  89. +42 −0 Templates/Admin/msg.tpl
  90. +51 −0 Templates/Admin/natarend.tpl
  91. +67 −0 Templates/Admin/online.tpl
  92. +377 −0 Templates/Admin/player.tpl
  93. +82 −0 Templates/Admin/punish.tpl
  94. +12 −0 Templates/Admin/report.tpl
  95. +51 −0 Templates/Admin/results_alliances.tpl
  96. +49 −0 Templates/Admin/results_email.tpl
  97. +63 −0 Templates/Admin/results_ip.tpl
  98. +56 −0 Templates/Admin/results_player.tpl
  99. +58 −0 Templates/Admin/results_villages.tpl
  100. +90 −0 Templates/Admin/search.tpl
  101. +51 −0 Templates/Admin/search2.tpl
  102. +157 −0 Templates/Admin/server_info.tpl
  103. +960 −0 Templates/Admin/village.tpl
  104. +57 −0 Templates/Admin/villages.tpl
  105. +135 −0 Templates/Ajax/mapscroll.tpl
  106. +154 −0 Templates/Ajax/mapscroll2.tpl
  107. +187 −0 Templates/Ajax/plusmap.tpl
Sorry, we could not display the entire diff because too many files (2,445) changed.
141 AC_OETags.js
@@ -0,0 +1,141 @@
+// Flash Player Version Detection - Rev 1.6
+// Detect Client Browser type
+// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
+var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
+var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
+var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
+
+function ControlVersion()
+{
+ var version;
+ var axo;
+ var e;
+
+ // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
+
+ try {
+ // version will be set for 7.X or greater players
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
+ version = axo.GetVariable("$version");
+ } catch (e) {
+ }
+
+ if (!version)
+ {
+ try {
+ // version will be set for 6.X players only
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
+
+ // installed player is some revision of 6.0
+ // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
+ // so we have to be careful.
+
+ // default to the first public version
+ version = "WIN 6,0,21,0";
+
+ // throws if AllowScripAccess does not exist (introduced in 6.0r47)
+ axo.AllowScriptAccess = "always";
+
+ // safe to call for 6.0r47 or greater
+ version = axo.GetVariable("$version");
+
+ } catch (e) {
+ }
+ }
+
+ if (!version)
+ {
+ try {
+ // version will be set for 4.X or 5.X player
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
+ version = axo.GetVariable("$version");
+ } catch (e) {
+ }
+ }
+
+ if (!version)
+ {
+ try {
+ // version will be set for 3.X player
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
+ version = "WIN 3,0,18,0";
+ } catch (e) {
+ }
+ }
+
+ if (!version)
+ {
+ try {
+ // version will be set for 2.X player
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
+ version = "WIN 2,0,0,11";
+ } catch (e) {
+ version = -1;
+ }
+ }
+
+ return version;
+}
+
+// JavaScript helper required to detect Flash Player PlugIn version information
+function GetSwfVer(id){
+ // NS/Opera version >= 3 check for Flash plugin in plugin array
+ var flashVer = -1;
+
+ if (navigator.plugins != null && navigator.plugins.length > 0) {
+ if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
+ var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
+ var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
+ var descArray = flashDescription.split(" ");
+ var tempArrayMajor = descArray[2].split(".");
+ var versionMajor = tempArrayMajor[0];
+ var versionMinor = tempArrayMajor[1];
+ var versionRevision = descArray[3];
+ if (versionRevision == "") {
+ versionRevision = descArray[4];
+ }
+ if (versionRevision[0] == "d") {
+ versionRevision = versionRevision.substring(1);
+ } else if (versionRevision[0] == "r") {
+ versionRevision = versionRevision.substring(1);
+ if (versionRevision.indexOf("d") > 0) {
+ versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
+ }
+ }
+ var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
+ }
+ }
+ // MSN/WebTV 2.6 supports Flash 4
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
+ // WebTV 2.5 supports Flash 3
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
+ // older WebTV supports Flash 2
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
+ else if ( isIE && isWin && !isOpera ) {
+ flashVer = ControlVersion();
+ }
+
+ if(flashVer != -1) {
+ writeFlashTags(id);
+ }
+
+ return flashVer;
+}
+
+
+function writeFlashTags(id)
+{
+ var swfFilename = "stats.swf";
+ var swfUrlWithGetParameters = swfFilename + "?id=" + id;
+
+ document.writeln("<div style=\"position:absolute; z-index:-1; top:0px; left:0px;\"><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab\" width=\"1\" height=\"1\">");
+ document.writeln("<param name=\"movie\" value=\""+swfUrlWithGetParameters+"\" />");
+ document.writeln("<param name=\"quality\" value=\"low\" />");
+ document.writeln("<param name=\"allowScriptAccess\" value=\"always\" />");
+ document.writeln("<param name=\"allowNetworking\" value=\"true\" />");
+ document.writeln("<embed width=\"1\" height=\"1\" src=\""+swfUrlWithGetParameters+"\" ");
+ document.writeln("quality=\"low\" allowNetworking=\"true\" name=\""+swfFilename+"\" play=\"true\" loop=\"false\" ");
+ document.writeln("allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" ");
+ document.writeln("pluginspage=\"http://www.macromedia.com/go/getflashplayer\"> ");
+ document.writeln("</embed> </object></div>");
+}
142 Admin/admin.php
@@ -0,0 +1,142 @@
+<?php
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename admin.php ##
+## Developed by: Dzoki ##
+## License: TravianX Project ##
+## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
+## ##
+#################################################################################
+session_start();
+include("../GameEngine/Database.php");
+include("../GameEngine/Admin/database.php");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<link REL="shortcut icon" HREF="favicon.ico"/>
+<title><?php if($_SESSION['access'] == ADMIN){ echo 'Admin Control Panel - TravianX'; } else if($_SESSION['access'] == MULTIHUNTER){ echo 'Multihunter Control Panel - TravianX'; } ?></title>
+<link rel=stylesheet type="text/css" href="../img/admin/admin.css">
+<link rel=stylesheet type="text/css" href="../img/admin/acp.css">
+<link rel=stylesheet type="text/css" href="../img/img.css">
+<script src="/mt-full.js?423cb" type="text/javascript"></script>
+<script src="ajax.js" type="text/javascript"></script>
+
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+<meta http-equiv="imagetoolbar" content="no">
+</head>
+<body>
+
+<script language="javascript">
+function aktiv() {this.srcElement.className='fl1'; }
+function inaktiv() {event.srcElement.className='fl2'; }
+
+function del(e,id){
+if(e == 'did'){ var conf = confirm('Dou you really want delete village id '+id+'?'); }
+if(e == 'unban'){ var conf = confirm('Dou you really want unban player '+id+'?'); }
+if(e == 'stopDel'){ var conf = confirm('Dou you really want stop deleting user '+id+'?'); }
+if(conf){return true;}else{return false;}
+}
+
+</script>
+
+<div id="ltop1">
+<div style="position:relative; width:231px; height:100px; float:left;">
+<img src="http://forum.ragezone.com/f583/img/x.gif" width="1" height="1">
+</div>
+<img class="fl2" src="http://forum.ragezone.com/f583/img/admin/x1.gif" width="70" height="100" border="0" onmouseover="this.className='fl1'" onmouseout="this.className='fl2'"><img class="fl2" src="http://forum.ragezone.com/f583/img/admin/x2.gif" width="70" height="100" border="0" onmouseover="this.className='fl1'" onmouseout="this.className='fl2'"><img class="fl2" src="http://forum.ragezone.com/f583/img/admin/x3.gif" width="70" height="100" border="0" onmouseover="this.className='fl1'" onmouseout="this.className='fl2'"><img class="fl2" src="http://forum.ragezone.com/f583/img/admin/x4.gif" width="70" height="100" border="0" onmouseover="this.className='fl1'" onmouseout="this.className='fl2'"><img class="fl2" src="http://forum.ragezone.com/f583/img/admin/x5.gif" width="70" height="100" border="0" onmouseover="this.className='fl1'" onmouseout="this.className='fl2'"></div>
+
+<div id="lmidall">
+<div id="lmidlc">
+<div id="lleft">
+<a href="<?php echo HOMEPAGE; ?>"><img src="http://forum.ragezone.com/f583/img/en/a/travian0.gif" class="logo_plus" width="116" height="60" border="0"></a>
+
+<table id="navi_table" cellspacing="0" cellpadding="0">
+<tr>
+<td class="menu">
+<?php
+ if($funct->CheckLogin()){?>
+<?php if($_SESSION['access'] == ADMIN){ ?>
+<a href="admin.php">ACP Home</a>
+<a href="<?php echo HOMEPAGE; ?>">Homepage</a>
+<a href="#"></a><a href="#"></a>
+
+<a href="?p=server_info">Server Info</a>
+<a href="?p=online">Online users</a>
+<a href="?p=search">Search</a>
+<a href="?p=message">Msg/Rep</a>
+<a href="?p=ban">Ban</a>
+<a href="?p=gold">Give Gold</a>
+<a href="?p=natarstart">Add Natar Villages</a>
+<a href="?p=natarend">Add World Wonder Villages</a>
+<a href="?p=admin_log"><font color="Red"><b>Admin Log</font></b></a>
+<a href="?p=config">Config</a>
+<a href="#"></a><a href="#"></a><a href="#"></a>
+<a href="?action=logout">Logout</a>
+<?php } else if($_SESSION['access'] == MULTIHUNTER){ ?>
+<a href="admin.php">MCP Home</a>
+<a href="<?php echo HOMEPAGE; ?>">Homepage</a>
+<a href="#"></a><a href="#"></a>
+
+<a href="?p=server_info">Server Info</a>
+
+<a href="?p=online">Online users</a>
+
+<a href="?p=search">Search</a>
+
+<a href="?p=message">Msg/Rep</a>
+
+<a href="?p=ban">Ban</a>
+<a href="#"></a><a href="#"></a><a href="#"></a>
+
+<a href="?action=logout">Logout</a>
+<?php } }?>
+</td>
+</tr>
+</table></div>
+<div id="lmid1">
+<div id="lmid3">
+
+<?php
+
+ if($funct->CheckLogin()){
+ if($_POST or $_GET){
+ if($_GET['p'] and $_GET['p']!="search"){
+ $filename = '../Templates/Admin/'.$_GET['p'].'.tpl';
+ if(file_exists($filename)){
+ include($filename);
+ }else{
+ include('../Templates/Admin/404.tpl');
+ }
+ }else{
+ include('../Templates/Admin/search.tpl');
+ }
+ if($_POST['p'] and $_POST['s']){
+ $filename = '../Templates/Admin/results_'.$_POST['p'].'.tpl';
+ if(file_exists($filename)){
+ include($filename);
+ }else{
+ include('../Templates/Admin/404.tpl');
+ }
+ }
+ }else{
+ include('../Templates/Admin/home.tpl');
+ }
+ }else{
+ include('../Templates/Admin/login.tpl');
+ }
+?>
+
+</div>
+</div>
+
+</div>
+<div id="lright1"></div>
+
+<div id="ce"></div>
+
+
+
+</body>
+</html>
70 Admin/ajax.js
@@ -0,0 +1,70 @@
+var http_request = false;
+
+function macheRequest(url, id)
+{
+
+ http_request = false;
+
+ if (window.XMLHttpRequest)
+ { // Mozilla, Safari,...
+ http_request = new XMLHttpRequest();
+ if (http_request.overrideMimeType)
+ {
+ http_request.overrideMimeType('text/xml');
+ // zu dieser Zeile siehe weiter unten
+ }
+ }
+ else if (window.ActiveXObject)
+ { // IE
+ try
+ {
+ http_request = new ActiveXObject("Msxml2.XMLHTTP");
+ }
+ catch (e)
+ {
+ try
+ {
+ http_request = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ catch (e)
+ {
+ }
+ }
+ }
+
+ if (!http_request)
+ {
+ alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen');
+ return false;
+ }
+ http_request.onreadystatechange = function()
+ {
+ alertInhalt2(id);
+ };
+ http_request.open('GET', url, true);
+ http_request.send(null);
+
+}
+
+function alertInhalt2(id)
+{
+
+ if (http_request.readyState == 4)
+ {
+ if (http_request.status == 200)
+ {
+ // alert(http_request.responseText);
+ myElement = document.getElementById(id);
+ if (myElement != null)
+ {
+ myElement.innerHTML = http_request.responseText;
+ }
+
+ }
+ else
+ {
+ alert('Bei dem Request ist ein Problem aufgetreten.');
+ }
+ }
+
+}
226 GameEngine/Account.php
@@ -0,0 +1,226 @@
+<?php
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename Account.php ##
+## Developed by: Dzoki ##
+## License: TravianX Project ##
+## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
+## ##
+#################################################################################
+
+include("Session.php");
+
+class Account {
+
+ function Account() {
+ global $session;
+ if(isset($_POST['ft'])) {
+ switch($_POST['ft']) {
+ case "a1":
+ $this->Signup();
+ break;
+ case "a2":
+ $this->Activate();
+ break;
+ case "a3":
+ $this->Unreg();
+ break;
+ case "a4":
+ $this->Login();
+ break;
+ }
+ } if(isset($_GET['code'])) {
+ $_POST['id'] = $_GET['code']; $this->Activate();
+ }
+ else {
+ if($session->logged_in && in_array("logout.php",explode("/",$_SERVER['PHP_SELF']))) {
+ $this->Logout();
+ }
+ }
+ }
+
+ private function Signup() {
+ global $database,$form,$mailer,$generator,$session;
+ if(!isset($_POST['name']) || $_POST['name'] == "") {
+ $form->addError("name",USRNM_EMPTY);
+ }
+ else {
+ if(strlen($_POST['name']) < USRNM_MIN_LENGTH) {
+ $form->addError("name",USRNM_SHORT);
+ }
+ else if(!USRNM_SPECIAL && preg_match('/[^0-9A-Za-z]/',$_POST['name'])) {
+ $form->addError("name",USRNM_CHAR);
+ }
+ else if($database->checkExist($_POST['name'],0)) {
+ $form->addError("name",USRNM_TAKEN);
+ }
+ else if($database->checkExist_activate($_POST['name'],0)) {
+ $form->addError("name",USRNM_TAKEN);
+ }
+
+ }
+ if(!isset($_POST['pw']) || $_POST['pw'] == "") {
+ $form->addError("pw",PW_EMPTY);
+ }
+ else {
+ if(strlen($_POST['pw']) < PW_MIN_LENGTH) {
+ $form->addError("pw",PW_SHORT);
+ }
+ else if($_POST['pw'] == $_POST['name']) {
+ $form->addError("pw",PW_INSECURE);
+ }
+ }
+ if(!isset($_POST['email'])) {
+ $form->addError("email",EMAIL_EMPTY);
+ }
+ else {
+ if(!$this->validEmail($_POST['email'])) {
+ $form->addError("email",EMAIL_INVALID);
+ }
+ else if($database->checkExist($_POST['email'],1)) {
+ $form->addError("email",EMAIL_TAKEN);
+ }
+ else if($database->checkExist_activate($_POST['email'],1)) {
+ $form->addError("email",EMAIL_TAKEN);
+ }
+ }
+ if(!isset($_POST['vid'])) {
+ $form->addError("tribe",TRIBE_EMPTY);
+ }
+ if(!isset($_POST['agb'])) {
+ $form->addError("agree",AGREE_ERROR);
+ }
+ if($form->returnErrors() > 0) {
+ $_SESSION['errorarray'] = $form->getErrors();
+ $_SESSION['valuearray'] = $_POST;
+
+ header("Location: anmelden.php");
+ }
+ else {
+ if(AUTH_EMAIL){
+ $act = $generator->generateRandStr(10);
+ $act2 = $generator->generateRandStr(5);
+ $uid = $database->activate($_POST['name'],md5($_POST['pw']),$_POST['email'],$_POST['vid'],$_POST['kid'],$act,$act2);
+ if($uid) {
+
+ $mailer->sendActivate($_POST['email'],$_POST['name'],$_POST['pw'],$act);
+ header("Location: activate.php?id=$uid&q=$act2");
+ }
+ }
+ else {
+ $uid = $database->register($_POST['name'],md5($_POST['pw']),$_POST['email'],$_POST['vid'],$_POST['kid'],$act);
+ if($uid) {
+ setcookie("COOKUSR",$_POST['name'],time()+COOKIE_EXPIRE,COOKIE_PATH);
+ setcookie("COOKEMAIL",$_POST['email'],time()+COOKIE_EXPIRE,COOKIE_PATH);
+
+ $database->updateUserField($uid,"act","",1);
+ $this->generateBase($_POST['kid'],$uid,$_POST['name']);
+ header("Location: login.php");
+ }
+ }
+ }
+ }
+
+ private function Activate() {
+ global $database;
+ $q = "SELECT * FROM ".TB_PREFIX."activate where act = '".$_POST['id']."'";
+ $result = mysql_query($q, $database->connection);
+ $dbarray = mysql_fetch_array($result);
+ if($dbarray['act'] == $_POST['id']) {
+ $uid = $database->register($dbarray['username'],$dbarray['password'],$dbarray['email'],$dbarray['tribe'],$dbarray['location'],"");
+ if($uid) {
+ $database->unreg($dbarray['username']);
+ $this->generateBase($dbarray['kid'],$uid,$dbarray['username']);
+ header("Location: activate.php?e=2");
+ }
+ }
+ else {
+ header("Location: activate.php?e=3");
+ }
+ }
+
+ private function Unreg() {
+ global $database;
+ $q = "SELECT * FROM ".TB_PREFIX."activate where id = '".$_POST['id']."'";
+ $result = mysql_query($q, $database->connection);
+ $dbarray = mysql_fetch_array($result);
+ if(md5($_POST['pw']) == $dbarray['password']) {
+ $database->unreg($dbarray['username']);
+ header("Location: anmelden.php");
+ }
+ else {
+ header("Location: activate.php?e=3");
+ }
+ }
+
+ private function Login() {
+ global $database,$session,$form;
+ if(!isset($_POST['user']) || $_POST['user'] == "") {
+ $form->addError("user",LOGIN_USR_EMPTY);
+ }
+ else if(!$database->checkExist($_POST['user'],0)) {
+ $form->addError("user",USR_NT_FOUND);
+ }
+ if(!isset($_POST['pw']) || $_POST['pw'] == "") {
+ $form->addError("pw",LOGIN_PASS_EMPTY);
+ }
+ else if(!$database->login($_POST['user'],$_POST['pw']) && !$database->sitterLogin($_POST['user'],$_POST['pw'])) {
+ $form->addError("pw",LOGIN_PW_ERROR);
+ }
+ if($database->getUserField($_POST['user'],"act",1) != "") {
+ $form->addError("activate",$_POST['user']);
+ }
+ if($form->returnErrors() > 0) {
+ $_SESSION['errorarray'] = $form->getErrors();
+ $_SESSION['valuearray'] = $_POST;
+
+ header("Location: login.php");
+ }
+ else {
+ setcookie("COOKUSR",$_POST['user'],time()+COOKIE_EXPIRE,COOKIE_PATH);
+ $database->UpdateOnline("login" ,$_POST['user'],time());
+ $session->login($_POST['user']);
+ }
+ }
+
+ private function Logout() {
+ global $session,$database;
+ unset($_SESSION['wid']);
+ $database->activeModify($session->username,1);
+ $database->UpdateOnline("logout") or die(mysql_error());
+ $session->Logout();
+ }
+
+ private function validEmail($email) {
+ $regexp="/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i";
+ if ( !preg_match($regexp, $email) ) {
+ return false;
+ }
+ return true;
+ }
+
+ function generateBase($kid,$uid,$username) {
+ global $database,$message;
+ $database->updateUserField($uid,"location","",1);
+ if($kid == 0) {
+ $kid = rand(1,4);
+ }
+ else{
+ $kid = $_POST['kid'];
+ }
+
+ $wid = $database->generateBase($kid);
+ $database->setFieldTaken($wid);
+ $database->addVillage($wid,$uid,$username,1);
+ $database->addResourceFields($wid,$database->getVillageType($wid));
+ $database->addUnits($wid);
+ $database->addTech($wid);
+ $database->addABTech($wid);
+ $database->updateUserField($uid,"access",USER,1);
+ $message->sendWelcome($uid,$username);
+ }
+
+};
+$account = new Account;
+?>
106 GameEngine/Admin/Mods/addTroops.php
@@ -0,0 +1,106 @@
+<?php
+
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename addTroops.php ##
+## Developed by: Dzoki & Advocatie ##
+## License: TravianX Project ##
+## Thanks to: Dzoki & itay2277 (edit troops) ##
+## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
+## ##
+#################################################################################
+
+include_once("../../Account.php");
+
+mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS);
+mysql_select_db(SQL_DB);
+
+if ($session->access < ADMIN) die("Access Denied: You are not Admin!");
+
+$id = $_POST['id'];
+$village = $database->getVillage($id);
+$user = $database->getUserArray($village['owner'],1);
+$coor = $database->getCoor($village['wref']);
+$varray = $database->getProfileVillages($village['owner']);
+$type = $database->getVillageType($village['wref']);
+$fdata = $database->getResourceLevel($village['wref']);
+$units = $database->getUnit($village['wref']);
+
+$u1 = $_POST['u1'];
+$u2 = $_POST['u2'];
+$u3 = $_POST['u3'];
+$u4 = $_POST['u4'];
+$u5 = $_POST['u5'];
+$u6 = $_POST['u6'];
+$u7 = $_POST['u7'];
+$u8 = $_POST['u8'];
+$u9 = $_POST['u9'];
+$u10 = $_POST['u10'];
+////////////////////
+$u11 = $_POST['u11'];
+$u12 = $_POST['u12'];
+$u13 = $_POST['u13'];
+$u14 = $_POST['u14'];
+$u15 = $_POST['u15'];
+$u16 = $_POST['u16'];
+$u17 = $_POST['u17'];
+$u18 = $_POST['u18'];
+$u19 = $_POST['u19'];
+$u20 = $_POST['u20'];
+////////////////////
+$u21 = $_POST['u21'];
+$u22 = $_POST['u22'];
+$u23 = $_POST['u23'];
+$u24 = $_POST['u24'];
+$u25 = $_POST['u25'];
+$u26 = $_POST['u26'];
+$u27 = $_POST['u27'];
+$u28 = $_POST['u28'];
+$u29 = $_POST['u29'];
+$u30 = $_POST['u30'];
+////////////////////
+$u31 = $_POST['u31'];
+$u32 = $_POST['u32'];
+$u33 = $_POST['u33'];
+$u34 = $_POST['u34'];
+$u35 = $_POST['u35'];
+$u36 = $_POST['u36'];
+$u37 = $_POST['u37'];
+$u38 = $_POST['u38'];
+$u39 = $_POST['u39'];
+$u40 = $_POST['u40'];
+////////////////////
+$u41 = $_POST['u41'];
+$u42 = $_POST['u42'];
+$u43 = $_POST['u43'];
+$u44 = $_POST['u44'];
+$u45 = $_POST['u45'];
+$u46 = $_POST['u46'];
+$u47 = $_POST['u47'];
+$u48 = $_POST['u48'];
+$u49 = $_POST['u49'];
+$u50 = $_POST['u50'];
+
+if($user['tribe'] == 1){
+$q = "UPDATE ".TB_PREFIX."units SET u1 = $u1, u2 = $u2, u3 = $u3, u4 = $u4, u5 = $u5, u6 = $u6, u7 = $u7, u8 = $u8, u9 = $u9, u10 = $u10 WHERE vref = $id";
+mysql_query($q);
+} else if($user['tribe'] == 2){
+$q = "UPDATE ".TB_PREFIX."units SET u11 = '$u11', u12 = '$u12', u13 = '$u13', u14 = '$u14', u15 = '$u15', u16 = '$u16', u17 = '$u17', u18 = '$u18', u19 = '$u19', u20 = '$u20' WHERE vref = $id";
+mysql_query($q);
+} else if($user['tribe'] == 3){
+$q = "UPDATE ".TB_PREFIX."units SET u21 = '$u21', u22 = '$u22', u23 = '$u23', u24 = '$u24', u25 = '$u25', u26 = '$u26', u27 = '$u27', u28 = '$u28', u29 = '$u29', u30 = '$u30' WHERE vref = $id";
+mysql_query($q);
+} else if($user['tribe'] == 4){
+$q = "UPDATE ".TB_PREFIX."units SET u31 = '$u31', u32 = '$u32', u33 = '$u33', u34 = '$u34', u35 = '$u35', u36 = '$u36', u37 = '$u37', u38 = '$u38', u39 = '$u39', u40 = '$u40' WHERE vref = $id";
+mysql_query($q);
+} else if($user['tribe'] == 5){
+$q = "UPDATE ".TB_PREFIX."units SET u41 = '$u41', u42 = '$u42', u43 = '$u43', u44 = '$u44', u45 = '$u45', u46 = '$u46', u47 = '$u47', u48 = '$u48', u49 = '$u49', u50 = '$u50' WHERE vref = $id";
+mysql_query($q);
+}
+
+mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Changed troop anmount in village <a href=\'admin.php?p=village&did=$id\'>$id</a> ',".time().")");
+
+header("Location: ../../../Admin/admin.php?p=addTroops&did=".$id."&d");
+
+?>
25 GameEngine/Admin/Mods/cp.php
@@ -0,0 +1,25 @@
+<?php
+
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename gold.php ##
+## Developed by: Dzoki ##
+## License: TravianX Project ##
+## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
+## ##
+#################################################################################
+include_once("../../Account.php");
+mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS);
+mysql_select_db(SQL_DB);
+if ($session->access < ADMIN) die("Access Denied: You are not Admin!");
+
+$id = $_POST['id'];
+$admid = $_POST['admid'];
+mysql_query("UPDATE ".TB_PREFIX."users SET cp = cp + ".$_POST['cp']." WHERE id = ".$id."");
+
+$name = $database->getUserField($id,"username",0);
+mysql_query("Insert into ".TB_PREFIX."admin_log values (0,$admid,'Added ".$_POST['cp']." Cultural Points to user <a href=\'admin.php?p=player&uid=$id\'>$name</a> ',".time().")");
+
+header("Location: ../../../Admin/admin.php?p=player&uid=".$id."&cp=ok");
+?>
24 GameEngine/Admin/Mods/editUser.php
@@ -0,0 +1,24 @@
+<?php
+
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename editUser.php ##
+## Developed by: Dzoki ##
+## License: TravianX Project ##
+## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
+## ##
+#################################################################################
+include_once("../../Account.php");
+mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS);
+mysql_select_db(SQL_DB);
+if ($_SESSION['access'] < ADMIN) die("Access Denied: You are not Admin!");
+
+$id = $_POST['id'];
+$user = $database->getUserArray($id,1);
+mysql_query("UPDATE ".TB_PREFIX."users SET email = '".$_POST['email']."', tribe = ".$_POST['tribe'].", location = '".$_POST['location']."', desc1 = '".$_POST['desc1']."', `desc2` = '".$_POST['desc2']."' WHERE id = ".$_POST['id']."");
+mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Changed <a href=\'admin.php?p=village&did=$id\'>".$user['username']."</a>\'s profile',".time().")");
+
+
+header("Location: ../../../Admin/admin.php?p=player&uid=".$id."");
+?>
26 GameEngine/Admin/Mods/gold.php
@@ -0,0 +1,26 @@
+<?php
+
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename gold.php ##
+## Developed by: Dzoki ##
+## License: TravianX Project ##
+## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
+## ##
+#################################################################################
+include_once("../../Account.php");
+mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS);
+mysql_select_db(SQL_DB);
+if ($session->access < ADMIN) die("Access Denied: You are not Admin!");
+
+$id = $_POST['id'];
+$gold = $_POST['gold'];
+
+ $q = "UPDATE ".TB_PREFIX."users SET gold = gold + ".$_POST['gold']." WHERE id != '0'";
+ mysql_query($q);
+ mysql_query("Insert into ".TB_PREFIX."admin_log values (0,$id,'Added <b>$gold</b> gold to all users',".time().")");
+
+
+header("Location: ../../../Admin/admin.php?p=gold&g");
+?>
25 GameEngine/Admin/Mods/gold_1.php
@@ -0,0 +1,25 @@
+<?php
+
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename gold_1.php ##
+## Developed by: Dzoki ##
+## License: TravianX Project ##
+## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
+## ##
+#################################################################################
+include_once("../../Account.php");
+mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS);
+mysql_select_db(SQL_DB);
+if ($session->access < ADMIN) die("Access Denied: You are not Admin!");
+
+$id = $_POST['id'];
+$admid = $_POST['admid'];
+mysql_query("UPDATE ".TB_PREFIX."users SET gold = gold + ".$_POST['gold']." WHERE id = ".$id."");
+
+$name = $database->getUserField($id,"username",0);
+mysql_query("Insert into ".TB_PREFIX."admin_log values (0,$admid,'Added <b>".$_POST['gold']."</b> gold to user <a href=\'admin.php?p=player&uid=$id\'>$name</a> ',".time().")");
+
+header("Location: ../../../Admin/admin.php?p=player&uid=".$id."&g=ok");
+?>
43 GameEngine/Admin/Mods/natarend.php
@@ -0,0 +1,43 @@
+<?php
+
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename gold.php ##
+## Developed by: Dzoki ##
+## License: TravianX Project ##
+## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
+## ##
+#################################################################################
+include_once("../../Session.php");
+mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS);
+mysql_select_db(SQL_DB);
+if ($session->access < ADMIN) die("Access Denied: You are not Admin!");
+
+$id = $_POST['id'];
+$amt = $_POST['vill_amount'];
+
+for($i=1;$i<=$amt;$i++) {
+
+ $kid = rand(1,4);
+
+ $wid = $database->generateBase($kid);
+ $database->setFieldTaken($wid);
+ $time = time();
+ $q = "insert into `s1_vdata`(`wref`,`owner`,`name`,`capital`,`pop`,`cp`,`celebration`,`type`,`wood`,`clay`,`iron`,`maxstore`,`crop`,`maxcrop`,`lastupdate`,`loyalty`,`exp1`,`exp2`,`exp3`,`created`) values ('$wid','3','World Wonder',0,233,232,0,0,80000.00,80000.00,80000.00,80000,80000.00,80000,1314974534,100,0,0,0,1314968914)";
+ mysql_query($q) or die(mysql_error());
+ $q = "insert into ".TB_PREFIX."fdata (`vref`,`f1`,`f1t`,`f2`,`f2t`,`f3`,`f3t`,`f4`,`f4t`,`f5`,`f5t`,`f6`,`f6t`,`f7`,`f7t`,`f8`,`f8t`,`f9`,`f9t`,`f10`,`f10t`,`f11`,`f11t`,`f12`,`f12t`,`f13`,`f13t`,`f14`,`f14t`,`f15`,`f15t`,`f16`,`f16t`,`f17`,`f17t`,`f18`,`f18t`,`f19`,`f19t`,`f20`,`f20t`,`f21`,`f21t`,`f22`,`f22t`,`f23`,`f23t`,`f24`,`f24t`,`f25`,`f25t`,`f26`,`f26t`,`f27`,`f27t`,`f28`,`f28t`,`f29`,`f29t`,`f30`,`f30t`,`f31`,`f31t`,`f32`,`f32t`,`f33`,`f33t`,`f34`,`f34t`,`f35`,`f35t`,`f36`,`f36t`,`f37`,`f37t`,`f38`,`f38t`,`f39`,`f39t`,`f40`,`f40t`,`f99`,`f99t`,`wwname`) values ($wid,0,1,0,4,0,1,0,3,0,2,0,2,0,3,0,4,0,4,0,3,0,3,0,4,0,4,0,1,0,4,0,2,0,1,0,2,20,17,20,11,20,15,20,10,10,22,10,25,0,0,0,0,10,19,0,0,0,0,0,0,10,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,16,0,0,1,40,'World Wonder')";
+ mysql_query($q);
+ $database->addUnits($wid);
+ $database->addTech($wid);
+ $database->addABTech($wid);
+ $q = "UPDATE ".TB_PREFIX."units SET u41 = u41 + '150000', u42 = u42 + '150000', u43 = u43 + '150000', u44 = u44 + '150000', u45 = u45 + '150000', u46 = u46 + '150000', u47 = u47 + '150000', u48 = u48 + '150000' , u49 = u49 + '150000', u50 = u50 + '150000' WHERE vref = '".$wid."'";
+ mysql_query($q);
+}
+
+
+ mysql_query("Insert into ".TB_PREFIX."admin_log values (0,$id,'Added <b>$amt</b> WW Villages',".time().")");
+
+
+header("Location: ../../../Admin/admin.php?p=natarend&g");
+?>
4 GameEngine/Admin/_notes/dwsync.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<dwsync>
+<file name="userCount.php" server="D:/wamp/www/New/" local="129157402737451172" remote="129157402730000000" />
+</dwsync>
108 GameEngine/Admin/admin.php
@@ -0,0 +1,108 @@
+<?php
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename admin.php ##
+## Developed by: Dzoki ##
+## License: TravianX Project ##
+## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
+## ##
+#################################################################################
+session_start();
+include("../GameEngine/Database.php");
+include("../GameEngine/Admin/database.php");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <link REL="shortcut icon" HREF="favicon.ico"/>
+ <title>Admin Control Panel - TravianX</title>
+ <link rel=stylesheet type="text/css" href="../img/admin/admin.css">
+ <link rel=stylesheet type="text/css" href="../img/admin/acp.css">
+ <link rel=stylesheet type="text/css" href="../img/../img.css">
+ <script src="mt-full.js?423cb" type="text/javascript"></script>
+ <script src="ajax.js" type="text/javascript"></script>
+
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <meta http-equiv="imagetoolbar" content="no">
+</head>
+<body>
+
+<script language="javascript">
+function aktiv() {this.srcElement.className='fl1'; }
+function inaktiv() {event.srcElement.className='fl2'; }
+
+function del(e,id){
+if(e == 'did'){ var conf = confirm('Dou you really want delete village id '+id+'?'); }
+if(e == 'unban'){ var conf = confirm('Dou you really want unban player '+id+'?'); }
+if(e == 'stopDel'){ var conf = confirm('Dou you really want stop deleting user '+id+'?'); }
+if(conf){return true;}else{return false;}
+}
+
+</script>
+
+<div id="ltop1">
+<div style="position:relative; width:231px; height:100px; float:left;">
+ <img src="../img/x.gif" width="1" height="1">
+</div>
+<img class="fl2" src="../img/admin/x1.gif" width="70" height="100" border="0" onmouseover="this.className='fl1'" onmouseout="this.className='fl2'"><img class="fl2" src="../img/admin/x2.gif" width="70" height="100" border="0" onmouseover="this.className='fl1'" onmouseout="this.className='fl2'"><img class="fl2" src="../img/admin/x3.gif" width="70" height="100" border="0" onmouseover="this.className='fl1'" onmouseout="this.className='fl2'"><img class="fl2" src="../img/admin/x4.gif" width="70" height="100" border="0" onmouseover="this.className='fl1'" onmouseout="this.className='fl2'"><img class="fl2" src="../img/admin/x5.gif" width="70" height="100" border="0" onmouseover="this.className='fl1'" onmouseout="this.className='fl2'"></div>
+
+<div id="lmidall">
+<div id="lmidlc">
+<div id="lleft">
+<a href="index.php"><img src="../img/en/a/travian0.gif" class="logo_plus" width="116" height="60" border="0"></a>
+
+<table id="navi_table" cellspacing="0" cellpadding="0">
+<tr>
+<td class="menu">
+<?php
+ if($funct->CheckLogin()){?>
+ <a href="admin.php">ACP Home</a>
+
+ <a href="<?php echo HOMEPAGE; ?>">Homepage</a>
+
+ <a href="#"></a><a href="#"></a>
+
+ <a href="?p=server_info">Server Info</a>
+ <a href="?p=online">Online users</a>
+ <a href="?p=search">Search</a>
+ <a href="?p=message">Msg/Rep</a>
+ <a href="?p=ban">Ban</a>
+ <a href="?p=config">Config</a>
+ <a href="?p=config_editor">Config Editor</a>
+
+ <a href="#"></a><a href="#"></a><a href="#"></a>
+ <a href="?action=logout">Logout</a>
+<?php }?>
+</td>
+</tr>
+</table></div>
+<div id="lmid1">
+<div id="lmid3">
+
+<?php
+
+ if($funct->CheckLogin()){
+ if($_POST or $_GET){
+ if($_GET['p'] and $_GET['p']!="search"){
+ $filename = '../Templates/Admin/'.$_GET['p'].'.tpl';
+ if(file_exists($filename)){
+ include($filename);
+ }else{
+ include('../Templates/Admin/404.tpl');
+ }
+ }else{
+ include('../Templates/Admin/search.tpl');
+ }
+ if($_POST['p'] and $_POST['s']){
+ $filename = '../Templates/Admin/results_'.$_POST['p'].'.tpl';
+ if(file_exists($filename)){
+ include($filename);
+ }else{
+ include('../Templates/Admin/404.tpl');
+ }
+ }
+ }else{
+ include('../Templates/Admin/home.tpl');
+ }
+ }else{
70 GameEngine/Admin/ajax.js
@@ -0,0 +1,70 @@
+var http_request = false;
+
+function macheRequest(url, id)
+{
+
+ http_request = false;
+
+ if (window.XMLHttpRequest)
+ { // Mozilla, Safari,...
+ http_request = new XMLHttpRequest();
+ if (http_request.overrideMimeType)
+ {
+ http_request.overrideMimeType('text/xml');
+ // zu dieser Zeile siehe weiter unten
+ }
+ }
+ else if (window.ActiveXObject)
+ { // IE
+ try
+ {
+ http_request = new ActiveXObject("Msxml2.XMLHTTP");
+ }
+ catch (e)
+ {
+ try
+ {
+ http_request = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ catch (e)
+ {
+ }
+ }
+ }
+
+ if (!http_request)
+ {
+ alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen');
+ return false;
+ }
+ http_request.onreadystatechange = function()
+ {
+ alertInhalt2(id);
+ };
+ http_request.open('GET', url, true);
+ http_request.send(null);
+
+}
+
+function alertInhalt2(id)
+{
+
+ if (http_request.readyState == 4)
+ {
+ if (http_request.status == 200)
+ {
+ // alert(http_request.responseText);
+ myElement = document.getElementById(id);
+ if (myElement != null)
+ {
+ myElement.innerHTML = http_request.responseText;
+ }
+
+ }
+ else
+ {
+ alert('Bei dem Request ist ein Problem aufgetreten.');
+ }
+ }
+
+}
309 GameEngine/Admin/database.php
@@ -0,0 +1,309 @@
+<?php
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename database.php ##
+## Developed by: Dzoki ##
+## License: TravianX Project ##
+## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
+## ##
+#################################################################################
+
+include("../GameEngine/config.php");
+include("../GameEngine/Data/buidata.php");
+
+class adm_DB {
+ var $connection;
+
+ function adm_DB(){
+ global $database;
+ $this->connection = mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS) or die(mysql_error());
+ mysql_select_db(SQL_DB, $this->connection) or die(mysql_error());
+ }
+
+ function Login($username,$password) {
+ $q = "SELECT password FROM ".TB_PREFIX."users where username = '$username' and access >= ".MULTIHUNTER;
+ $result = mysql_query($q, $this->connection);
+ $dbarray = mysql_fetch_array($result);
+ if($dbarray['password'] == md5($password)) {
+ mysql_query("Insert into ".TB_PREFIX."admin_log values (0,'X','$username logged in (IP: <b>".$_SERVER['REMOTE_ADDR']."</b>)',".time().")");
+ return true;
+ }
+ else {
+ mysql_query("Insert into ".TB_PREFIX."admin_log values (0,'X','<font color=\'red\'><b>IP: ".$_SERVER['REMOTE_ADDR']." tried to log in with username <u> $username</u> but access was denied!</font></b>',".time().")");
+ return false;
+ }
+ }
+
+ function recountPopUser($uid){
+ global $database;
+ $villages = $database->getProfileVillages($uid);
+ for ($i = 0; $i <= count($villages)-1; $i++) {
+ $vid = $villages[$i]['wref'];
+ $this->recountPop($vid);
+ }
+ }
+
+ function recountPop($vid){
+ global $database;
+ $fdata = $database->getResourceLevel($vid);
+ $popTot = 0;
+ for ($i = 1; $i <= 40; $i++) {
+ $lvl = $fdata["f".$i];
+ $building = $fdata["f".$i."t"];
+ if($building){
+ $popTot += $this->buildingPOP($building,$lvl);
+ }
+ }
+ $q = "UPDATE ".TB_PREFIX."vdata set pop = $popTot where wref = $vid";
+ mysql_query($q, $this->connection);
+ }
+
+ function buildingPOP($f,$lvl){
+ $name = "bid".$f;
+ global $$name;
+ $popT = 0;
+ $dataarray = $$name;
+ for ($i = 0; $i <= $lvl; $i++) {
+ $popT += $dataarray[$i]['pop'];
+ }
+ return $popT;
+ }
+
+ function getWref($x,$y) {
+ $q = "SELECT id FROM ".TB_PREFIX."wdata where x = $x and y = $y";
+ $result = mysql_query($q, $this->connection);
+ $r = mysql_fetch_array($result);
+ return $r['id'];
+ }
+
+ function AddVillage($post){
+ global $database;
+ $wid = $this->getWref($post['x'],$post['y']);
+ $uid = $post['uid'];
+ $status = $database->getVillageState($wid);
+ $status = 0;
+ if($status == 0){
+ mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Added new village <b><a href=\'admin.php?p=village&did=$wid\'>$wid</a></b> to user <b><a href=\'admin.php?p=player&uid=$uid\'>$uid</a></b>',".time().")");
+ $database->setFieldTaken($wid);
+ $database->addVillage($wid,$uid,'new village','0');
+ $database->addResourceFields($wid,$database->getVillageType($wid));
+ $database->addUnits($wid);
+ $database->addTech($wid);
+ $database->addABTech($wid);
+ }
+ }
+
+ function Punish($post){
+ global $database;
+ $villages = $database->getProfileVillages($post['uid']);
+ $admid = $post['admid'];
+ $user = $database->getUserArray($post['uid'],1);
+ for ($i = 0; $i <= count($villages)-1; $i++) {
+ $vid = $villages[$i]['wref'];
+ if($post['punish']){
+ $popOld = $villages[$i]['pop'];
+ $proc = 100-$post['punish'];
+ $pop = floor(($popOld/100)*($proc));
+ if($pop <= 1 ){$pop = 2;}
+ $this->PunishBuilding($vid,$proc,$pop);
+
+ }
+ if($post['del_troop']){
+ if($user['tribe'] == 1) {
+ $unit = 1;
+ }else if($user['tribe'] == 2) {
+ $unit = 11;
+ }else if($user['tribe'] == 3) {
+ $unit = 21;
+ }
+ $this->DelUnits($villages[$i]['wref'],$unit);
+ }
+ if($post['clean_ware']){
+ $time = time();
+ $q = "UPDATE ".TB_PREFIX."vdata SET `wood` = '0', `clay` = '0', `iron` = '0', `crop` = '0', `lastupdate` = '$time' WHERE wref = $vid;";
+ mysql_query($q, $this->connection);
+ }
+ }
+ mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Punished user: <a href=\'admin.php?p=player&uid=".$post['uid']."\'>".$post['uid']."</a> with <b>-".$post['punish']."%</b> population',".time().")");
+ }
+
+ function PunishBuilding($vid,$proc,$pop){
+ global $database;
+ $q = "UPDATE ".TB_PREFIX."vdata set pop = $pop where wref = $vid;";
+ mysql_query($q, $this->connection);
+ $fdata = $database->getResourceLevel($vid);
+ for ($i = 1; $i <= 40; $i++) {
+ if($fdata['f'.$i]>1){
+ $zm = ($fdata['f'.$i]/100)*$proc;
+ if($zm < 1){$zm = 1;}else{$zm = floor($zm);}
+ $q = "UPDATE ".TB_PREFIX."fdata SET `f$i` = '$zm' WHERE `vref` = $vid;";
+ mysql_query($q, $this->connection);
+ }
+ }
+ }
+
+ function DelUnits($vid,$unit){
+ for ($i = $unit; $i <= 9+$unit; $i++) {
+ $this->DelUnits2($vid,$unit);
+ }
+ }
+
+ function DelUnits2($vid,$unit){
+ $q = "UPDATE ".TB_PREFIX."units SET `u$unit` = '0' WHERE `vref` = $vid;";
+ mysql_query($q, $this->connection);
+ }
+
+ function DelPlayer($uid,$pass){
+ global $database;
+ $ID = $_SESSION['id'];//$database->getUserField($_SESSION['username'],'id',1);
+ if($this->CheckPass($pass,$ID)){
+ $villages = $database->getProfileVillages($uid);
+ for ($i = 0; $i <= count($villages)-1; $i++) {
+ $this->DelVillage($villages[$i]['wref']);
+ }
+ $name = $database->getUserField($uid,"username",0);
+ mysql_query("Insert into ".TB_PREFIX."admin_log values (0,$ID,'Deleted user <a>$name</a>',".time().")");
+ $q = "DELETE FROM ".TB_PREFIX."users WHERE `id` = $uid;";
+ mysql_query($q, $this->connection);
+ }
+ }
+
+ function getUserActive() {
+ $time = time() - (60*5);
+ $q = "SELECT * FROM ".TB_PREFIX."users where timestamp > $time and username != 'support'";
+ $result = mysql_query($q, $this->connection);
+ return $this->mysql_fetch_all($result);
+ }
+
+ function CheckPass($password,$uid){
+ $q = "SELECT password FROM ".TB_PREFIX."users where id = '$uid' and access = ".ADMIN;
+ $result = mysql_query($q, $this->connection);
+ $dbarray = mysql_fetch_array($result);
+ if($dbarray['password'] == md5($password)) {
+ return true;
+ }else{
+ return false;
+ }
+ }
+
+ function DelVillage($wref){
+ $q = "SELECT * FROM ".TB_PREFIX."vdata WHERE `wref` = $wref and capital = 1;";
+ $result = mysql_query($q, $this->connection);
+ if(mysql_num_rows($result) > 0){
+ mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Deleted village <b>$wref</b>',".time().")");
+ $q = "DELETE FROM ".TB_PREFIX."vdata WHERE `wref` = $wref and capital = 1;";
+ mysql_query($q, $this->connection);
+ $q = "DELETE FROM ".TB_PREFIX."units WHERE `vref` = $wref;";
+ mysql_query($q, $this->connection);
+ $q = "DELETE FROM ".TB_PREFIX."bdata WHERE `wid` = $wref;";
+ mysql_query($q, $this->connection);
+ $q = "DELETE FROM ".TB_PREFIX."abdata WHERE `wid` = $wref;";
+ mysql_query($q, $this->connection);
+ $q = "DELETE FROM ".TB_PREFIX."fdata WHERE `vref` = $wref;";
+ mysql_query($q, $this->connection);
+ $q = "DELETE FROM ".TB_PREFIX."training WHERE `vref` = $wref;";
+ mysql_query($q, $this->connection);
+ $q = "DELETE FROM ".TB_PREFIX."movement WHERE `from` = $wref;";
+ mysql_query($q, $this->connection);
+ $q = "UPDATE ".TB_PREFIX."wdata SET `occupied` = '0' WHERE `id` = $wref;";
+ mysql_query($q, $this->connection);
+ }
+ }
+
+ function DelBan($uid,$id){
+ global $database;
+ $name = $database->getUserField($uid,"username",0);
+ mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Unbanned user <a href=\'admin.php?p=player&uid=$uid\'>$name</a>',".time().")");
+ $q = "UPDATE ".TB_PREFIX."users SET `access` = '".USER."' WHERE `id` = $uid;";
+ mysql_query($q, $this->connection);
+ $q = "UPDATE ".TB_PREFIX."banlist SET `active` = '0' WHERE `id` = $id;";
+ mysql_query($q, $this->connection);
+ }
+
+ function AddBan($uid,$end,$reason){
+ global $database;
+ $name = $database->getUserField($uid,"username",0);
+ mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Banned user <a href=\'admin.php?p=player&uid=$uid\'>$name</a>',".time().")");
+ $q = "UPDATE ".TB_PREFIX."users SET `access` = '0' WHERE `id` = $uid;";
+ mysql_query($q, $this->connection);
+ $time = time();
+ $admin = $_SESSION['id']; //$database->getUserField($_SESSION['username'],'id',1);
+ $name = $database->getUserField($uid,'username',0);
+ $q = "INSERT INTO ".TB_PREFIX."banlist (`uid`, `name`, `reason`, `time`, `end`, `admin`, `active`) VALUES ($uid, '$name' , '$reason', '$time', '$end', '$admin', '1');";
+ mysql_query($q, $this->connection);
+ }
+
+ function search_player($player){
+ $q = "SELECT id,username FROM ".TB_PREFIX."users WHERE `username` LIKE '%$player%' and username != 'support'";
+ $result = mysql_query($q, $this->connection);
+ return $this->mysql_fetch_all($result);
+ }
+
+ function search_email($email){
+ $q = "SELECT id,email FROM ".TB_PREFIX."users WHERE `email` LIKE '%$email%' and username != 'support'";
+ $result = mysql_query($q, $this->connection);
+ return $this->mysql_fetch_all($result);
+ }
+
+ function search_village($village){
+ $q = "SELECT * FROM ".TB_PREFIX."vdata WHERE `name` LIKE '%$village%' or `wref` LIKE '%$village%'";
+ $result = mysql_query($q, $this->connection);
+ return $this->mysql_fetch_all($result);
+ }
+
+ function search_alliance($alliance){
+ $q = "SELECT * FROM ".TB_PREFIX."alidata WHERE `name` LIKE '%$alliance%' or `tag` LIKE '%$alliance%' or `id` LIKE '%$alliance%'";
+ $result = mysql_query($q, $this->connection);
+ return $this->mysql_fetch_all($result);
+ }
+
+ function search_ip($ip){
+ $q = "SELECT * FROM ".TB_PREFIX."login_log WHERE `ip` LIKE '%$ip%'";
+ $result = mysql_query($q, $this->connection);
+ return $this->mysql_fetch_all($result);
+ }
+
+ function search_banned(){
+ $q = "SELECT * FROM ".TB_PREFIX."banlist where active = '1'";
+ $result = mysql_query($q, $this->connection);
+ return $this->mysql_fetch_all($result);
+ }
+
+ function Del_banned(){
+ //$q = "SELECT * FROM ".TB_PREFIX."banlist";
+ $result = mysql_query($q, $this->connection);
+ return $this->mysql_fetch_all($result);
+ }
+
+ /***************************
+ Function to process MYSQLi->fetch_all (Only exist in MYSQL)
+ References: Result
+ ***************************/
+ function mysql_fetch_all($result) {
+ $all = array();
+ if($result) {
+ while ($row = mysql_fetch_assoc($result)){ $all[] = $row; }
+ return $all;
+ }
+ }
+
+ function query_return($q) {
+ $result = mysql_query($q, $this->connection);
+ return $this->mysql_fetch_all($result);
+ }
+
+ /***************************
+ Function to do free query
+ References: Query
+ ***************************/
+ function query($query) {
+ return mysql_query($query, $this->connection);
+ }
+
+
+};
+
+$admin = new adm_DB;
+include("function.php");
+?>
168 GameEngine/Admin/function.php
@@ -0,0 +1,168 @@
+<?php
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Filename function.php ##
+## Developed by: Dzoki ##
+## License: TravianX Project ##
+## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
+## ##
+#################################################################################
+
+class funct {
+
+ function CheckLogin(){
+ if($_SESSION['access'] >= MULTIHUNTER && isset($_SESSION['id'])){
+ return true;
+ }else{
+ return false;
+ }
+ }
+
+ function Act($get){
+ global $admin,$database;
+
+ switch($get['action']){
+ case recountPop:
+ $admin->recountPop($get['did']);
+ break;
+ case recountPopUsr:
+ $admin->recountPopUser($get['uid']);
+ break;
+ case StopDel:
+ //stop deleting
+ break;
+ case delVil:
+ $admin->DelVillage($get['did']);
+ break;
+ case delBan:
+ $admin->DelBan($get['uid'],$get['id']);
+ //remove ban
+ break;
+ case addBan:
+ if($get['time']){$end = time()+$get['time']; }else{$end = '';}
+
+ if(preg_match("/^[0-9]+$/",$get['uid'])){
+ //if(eregi("^[0-9]*+$",$get['uid'])){
+ $get['uid'] = $get['uid'];
+ }else{
+ $get['uid'] = $database->getUserField($get['uid'],'id',1);
+ }
+
+ $admin->AddBan($get['uid'],$end,$get['reason']);
+ //add ban
+ break;
+ case delOas:
+ //oaza
+ break;
+ case logout:
+ $this->LogOut();
+ break;
+ }
+ if($get['action'] == 'logout'){
+ header("Location: admin.php");
+ }else{
+ header("Location: ".$_SERVER['HTTP_REFERER']);
+ }
+ }
+
+ function Act2($post){
+ global $admin,$database;
+ switch($post['action']){
+ case DelPlayer:
+ $admin->DelPlayer($post['uid'],$post['pass']);
+ header("Location: ?p=search&msg=ursdel");
+ break;
+ case punish:
+ $admin->Punish($post);
+ header("Location: ".$_SERVER['HTTP_REFERER']);
+ break;
+ case addVillage:
+ $admin->AddVillage($post);
+ header("Location: ".$_SERVER['HTTP_REFERER']);
+ break;
+ }
+ }
+
+ function LogIN($username,$password){
+ global $admin,$database;
+ if($admin->Login($username,$password)){
+ //$_SESSION['username'] = $username;
+ $_SESSION['access'] = $database->getUserField($username,'access',1);
+ $_SESSION['id'] = $database->getUserField($username,'id',1);
+ header("Location: ".$_SERVER['HTTP_REFERER']);
+ //header("Location: admin.php");
+ }else{
+ echo "Error";
+ }
+ }
+
+ function LogOut(){
+ $_SESSION['access'] = '';
+ $_SESSION['id'] = '';
+ }
+
+ public function procResType($ref) {
+ global $session;
+ switch($ref) {
+ case 1: $build = "Woodcutter"; break;
+ case 2: $build = "Clay Pit"; break;
+ case 3: $build = "Iron Mine"; break;
+ case 4: $build = "Cropland"; break;
+ case 5: $build = "Sawmill"; break;
+ case 6: $build = "Brickyard"; break;
+ case 7: $build = "Iron Foundry"; break;
+ case 8: $build = "Grain Mill"; break;
+ case 9: $build = "Bakery"; break;
+ case 10: $build = "Warehouse"; break;
+ case 11: $build = "Granary"; break;
+ case 12: $build = "Blacksmith"; break;
+ case 13: $build = "Armoury"; break;
+ case 14: $build = "Tournament Square"; break;
+ case 15: $build = "Main Building"; break;
+ case 16: $build = "Rally Point"; break;
+ case 17: $build = "Marketplace"; break;
+ case 18: $build = "Embassy"; break;
+ case 19: $build = "Barracks"; break;
+ case 20: $build = "Stable"; break;
+ case 21: $build = "Workshop"; break;
+ case 22: $build = "Academy"; break;
+ case 23: $build = "Cranny"; break;
+ case 24: $build = "Town Hall"; break;
+ case 25: $build = "Residence"; break;
+ case 26: $build = "Palace"; break;
+ case 27: $build = "Treasury"; break;
+ case 28: $build = "Trade Office"; break;
+ case 29: $build = "Great Barracks"; break;
+ case 30: $build = "Great Stable"; break;
+ case 31: $build = "City Wall"; break;
+ case 32: $build = "Earth Wall"; break;
+ case 33: $build = "Palisade"; break;
+ case 34: $build = "Stonemason's Lodge"; break;
+ case 35: $build = "Brewery"; break;
+ case 36: $build = "Trapper"; break;
+ case 37: $build = "Hero's Mansion"; break;
+ case 38: $build = "Great Warehouse"; break;
+ case 39: $build = "Great Granary"; break;
+ case 40: $build = "Wonder of the World"; break;
+ case 41: $build = "Horse Drinking Trough"; break;
+ default: $build = "Error"; break;
+ }
+ return $build;
+ }
+
+};
+
+$funct = new funct;
+if($funct->CheckLogin()){
+ if($_GET['action']){
+ $funct->Act($_GET);
+ }
+ if($_POST['action']){
+ $funct->Act2($_POST);
+ }
+}
+if($_POST['action']=='login'){
+ $funct->LogIN($_POST['name'],$_POST['pw']);
+}
+?>
6 GameEngine/Admin/welcome.tpl
@@ -0,0 +1,6 @@
+Hello %USER%,
+
+Thank you for registering on our server.
+Since the %START% at %TIME% Romans, Gauls and Teutons attack each other on this game world. Right now, %PLAYERS% players in %ALLI% Alliances are fighting for supremacy.
+
+TravianX Team
370 GameEngine/Alliance.php
@@ -0,0 +1,370 @@
+<?php
+
+/*
+|--------------------------------------------------------------------------
+| PLEASE DO NOT REMOVE THIS COPYRIGHT NOTICE!
+|--------------------------------------------------------------------------
+|
+| Project owner: Dzoki < dzoki.travian@gmail.com >
+|
+| This script is property of TravianX Project. You are allowed to change
+| its source and release it under own name, not under name `TravianX`.
+| You have no rights to remove copyright notices.
+|
+| TravianX All rights reserved
+|
+*/
+
+ class Alliance {
+
+ public $gotInvite = false;
+ public $inviteArray = array();
+ public $allianceArray = array();
+ public $userPermArray = array();
+
+ public function procAlliance($get) {
+ global $session, $database;
+
+ if($session->alliance != 0) {
+ $this->allianceArray = $database->getAlliance($session->alliance);
+ // Permissions Array
+ // [id] => id [uid] => uid [alliance] => alliance [opt1] => X [opt2] => X [opt3] => X [opt4] => X [opt5] => X [opt6] => X [opt7] => X [opt8] => X
+ $this->userPermArray = $database->getAlliPermissions($session->uid, $session->alliance);
+ } else {
+ $this->inviteArray = $database->getInvitation($session->uid);
+ $this->gotInvite = count($this->inviteArray) == 0 ? false : true;
+ }
+ if(isset($get['a'])) {
+ switch($get['a']) {
+ case 2:
+ $this->rejectInvite($get);
+ break;
+ case 3:
+ $this->acceptInvite($get);
+ break;
+ default:
+ break;
+ }
+ }
+ if(isset($get['o'])) {
+ switch($get['o']) {
+ case 4:
+ $this->delInvite($get);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ public function procAlliForm($post) {
+ if(isset($post['ft'])) {
+ switch($post['ft']) {
+ case "ali1":
+ $this->createAlliance($post);
+ break;
+ }
+
+ }
+ if(isset($_POST['dipl']) and isset($_POST['a_name'])) {
+ $this->changediplomacy($post);
+ }
+
+ if(isset($post['s'])) {
+ if(isset($post['o'])) {
+ switch($post['o']) {
+ case 1:
+ if(isset($_POST['a'])) {
+ $this->changeUserPermissions($post);
+ }
+ break;
+ case 2:
+ if(isset($_POST['a_user'])) {
+ $this->kickAlliUser($post);
+ }
+ break;
+ case 4:
+ if(isset($_POST['a']) && $_POST['a'] == 4) {
+ $this->sendInvite($post);
+ }
+ break;
+ case 3:
+ $this->updateAlliProfile($post);
+ break;
+ case 11:
+ $this->quitally($post);
+ break;
+ case 100:
+ $this->changeAliName($post);
+ break;
+ }
+ }
+ }
+ }
+
+ /*****************************************
+ Function to process of sending invitations
+ *****************************************/
+ public function sendInvite($post) {
+ global $form, $database, $session;
+ // ¿El campo posee informacion?
+ if(!isset($post['a_name']) || $post['a_name'] == "") {
+ $form->addError("name1", NAME_EMPTY);
+ }
+ // ¿Existe el usuario?
+ if(!$database->checkExist($post['a_name'], 0)) {
+ $form->addError("name2", NAME_NO_EXIST);
+ }
+ // ¿La invitacion es a si mismo?
+ if($post['a_name'] == ($session->username)) {
+ $form->addError("name3", SAME_NAME);
+ }
+ // ¿Esta ya invitado a la alianza?
+ $UserData = $database->getUserArray($post['a_name'], 0);
+ if($database->getInvitation($UserData['id'])) {
+ $form->addError("name4", OLRADY_INVITED);
+ }
+ // ¿Esta ya en la alianza?
+ $UserData = $database->getUserArray($post['a_name'], 0);
+ if($UserData['alliance'] == $session->alliance) {
+ $form->addError("name5", OLRADY_IN_ALLY);
+ }
+ // ¿La invitación la envia un autorizado?
+ if($this->userPermArray['opt4'] == 0) {
+ $form->addError("perm", NO_PERMISSION);
+ }
+ if($form->returnErrors() != 0) {
+ $_SESSION['errorarray'] = $form->getErrors();
+ $_SESSION['valuearray'] = $post;
+ print_r($form->getErrors());
+ } else {
+ // Obtenemos la informacion necesaria
+ $aid = $session->alliance;
+ // Insertamos invitacion
+ $database->sendInvitation($UserData['id'], $aid, $session->uid);
+ // Log the notice
+ $database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $session->uid . '">' . $session->username . '</a> has invited <a href="spieler.php?uid=' . $UserData['id'] . '">' . $UserData['username'] . '</a> into the alliance.');
+ }
+ }
+
+ /*****************************************
+ Function to reject an invitation
+ *****************************************/
+ private function rejectInvite($get) {
+ global $database, $session;
+ foreach($this->inviteArray as $invite) {
+ if($invite['id'] == $get['d']) {
+ $database->removeInvitation($get['d']);
+ $database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $session->uid . '">' . $session->username . '</a> has deleted an invitation.');
+ }
+ }
+ //header("Location: build.php?id=".$get['id']);
+ }
+
+ /*****************************************
+ Function to del an invitation
+ *****************************************/
+ private function delInvite($get) {
+ global $database, $session;
+ $inviteArray = $database->getAliInvitations($session->alliance);
+ foreach($inviteArray as $invite) {
+ if($invite['id'] == $get['d']) {
+ $database->removeInvitation($get['d']);
+ $database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $session->uid . '">' . $session->username . '</a> has deleted an invitation.');
+ }
+ }
+ //header("Location: build.php?id=".$get['id']);
+ }
+
+ /*****************************************
+ Function to accept an invitation
+ *****************************************/
+ private function acceptInvite($get) {
+ global $database, $session;
+ foreach($this->inviteArray as $invite) {
+ if($invite['id'] == $get['d']) {
+ $database->removeInvitation($database->RemoveXSS($get['d']));
+ $database->updateUserField($database->RemoveXSS($invite['uid']), "alliance", $database->RemoveXSS($invite['alliance']), 1);
+ $database->createAlliPermissions($database->RemoveXSS($invite['uid']), $database->RemoveXSS($invite['alliance']), '', '0', '0', '0', '0', '0', '0', '0', '0');
+ // Log the notice
+ $database->insertAlliNotice($invite['alliance'], '<a href="spieler.php?uid=' . $session->uid . '">' . $session->username . '</a> has joined the alliance.');
+ }
+ }
+ header("Location: build.php?id=" . $get['id']);
+ }
+
+ /*****************************************
+ Function to create an alliance
+ *****************************************/
+ private function createAlliance($post) {
+ global $form, $database, $session, $bid18, $village;
+ if(!isset($post['ally1']) || $post['ally1'] == "") {
+ $form->addError("ally1", ATAG_EMPTY);
+ }
+ if(!isset($post['ally2']) || $post['ally2'] == "") {
+ $form->addError("ally2", ANAME_EMPTY);
+ }
+ if($database->aExist($post['ally1'], "tag")) {
+ $form->addError("ally1", ATAG_EXIST);
+ }
+ if($database->aExist($post['ally2'], "name")) {
+ $form->addError("ally2", ANAME_EXIST);
+ }
+ if($form->returnErrors() != 0) {
+ $_SESSION['errorarray'] = $form->getErrors();
+ $_SESSION['valuearray'] = $post;
+
+ header("Location: build.php?id=" . $post['id']);
+ } else {
+ $max = $bid18[$village->resarray['f' . $post['id']]]['attri'];
+ $aid = $database->createAlliance($database->RemoveXSS($post['ally1']), $database->RemoveXSS($post['ally2']), $session->uid, $max);
+ $database->updateUserField($database->RemoveXSS($session->uid), "alliance", $database->RemoveXSS($aid), 1);
+ // Asign Permissions
+ $database->createAlliPermissions($database->RemoveXSS($session->uid), $database->RemoveXSS($aid), 'Alliance founder', '1', '1', '1', '1', '1', '1', '1', '1');
+ // log the notice
+ $database->insertAlliNotice($session->alliance, 'The alliance has been founded by <a href="spieler.php?uid=' . $session->uid . '">' . $session->username . '</a>');
+ header("Location: build.php?id=" . $post['id']);
+ }
+ }
+
+ /*****************************************
+ Function to change the alliance name
+ *****************************************/
+ private function changeAliName($get) {
+ global $form, $database, $session;
+
+ if(!isset($get['ally1']) || $get['ally1'] == "") {
+ $form->addError("ally1", ATAG_EMPTY);
+ }
+ if(!isset($get['ally2']) || $get['ally2'] == "") {
+ $form->addError("ally2", ANAME_EMPTY);
+ }
+ if($database->aExist($get['ally1'], "tag")) {
+ $form->addError("tag", ATAG_EXIST);
+ }
+ if($database->aExist($get['ally2'], "name")) {
+ $form->addError("name", ANAME_EXIST);
+ }
+ if($this->userPermArray['opt3'] == 0) {
+ $form->addError("perm", NO_PERMISSION);
+ }
+ if($form->returnErrors() != 0) {
+ $_SESSION['errorarray'] = $form->getErrors();
+ $_SESSION['valuearray'] = $post;
+ //header("Location: build.php?id=".$post['id']);
+ } else {
+ $database->setAlliName($database->RemoveXSS($session->alliance), $database->RemoveXSS($get['ally2']), $database->RemoveXSS($get['ally1']));
+ // log the notice
+ $database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $session->uid . '">' . $session->username . '</a> has changed the alliance name.');
+ }
+ }
+
+ /*****************************************
+ Function to create/change the alliance description
+ *****************************************/
+ private function updateAlliProfile($post) {
+ global $database, $session, $form;
+ if($this->userPermArray['opt3'] == 0) {
+ $form->addError("perm", NO_PERMISSION);
+ }
+ if($form->returnErrors() != 0) {
+ $_SESSION['errorarray'] = $form->getErrors();
+ $_SESSION['valuearray'] = $post;
+ //header("Location: build.php?id=".$post['id']);
+ } else {
+ $database->submitAlliProfile($database->RemoveXSS($session->alliance), $database->RemoveXSS($post['be2']), $database->RemoveXSS($post['be1']));
+ // log the notice
+ $database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $session->uid . '">' . $session->username . '</a> has changed the alliance description');
+ }
+ }
+
+ /*****************************************
+ Function to change the user permissions
+ *****************************************/
+ private function changeUserPermissions($post) {
+ global $database, $session, $form;
+ if($this->userPermArray['opt1'] == 0) {
+ $form->addError("perm", NO_PERMISSION);
+ }
+ if($form->returnErrors() != 0) {
+ $_SESSION['errorarray'] = $form->getErrors();
+ $_SESSION['valuearray'] = $post;
+ //header("Location: build.php?id=".$post['id']);
+ } else {
+ $database->updateAlliPermissions($post['a_user'], $session->alliance, $post['a_titel'], $post['e1'], $post['e2'], $post['e3'], $post['e4'], $post['e5'], $post['e6'], $post['e7']);
+ // log the notice
+ $database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $session->uid . '">' . $session->username . '</a> has changed permissions.');
+ }
+
+ }
+ /*****************************************
+ Function to kick a user from alliance
+ *****************************************/
+ private function kickAlliUser($post) {
+ global $database, $session, $form;
+
+ if($this->userPermArray['opt2'] == 0) {
+ $form->addError("perm", NO_PERMISSION);
+ }
+ if($form->returnErrors() != 0) {
+ $_SESSION['errorarray'] = $form->getErrors();
+ $_SESSION['valuearray'] = $post;
+ //header("Location: build.php?id=".$post['id']);
+ } else {
+ $database->updateUserField($post['a_user'], 'alliance', 0, 1);
+ $database->deleteAlliPermissions($post['a_user']);
+ $database->deleteAlliance($session->alliance);
+ // log the notice
+ $database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $session->uid . '">' . $session->username . '</a> kicked <a href="spieler.php?uid=' . $post['a_user'] . '">' . $UserData['username'] . '</a>.');
+ //header("Location: build.php?id=".$post['id']);
+ }
+ }
+ /*****************************************
+ Function to quit from alliance
+ *****************************************/
+ private function quitally($post) {
+ global $database, $session, $form;
+ if(!isset($post['pw']) || $post['pw'] == "") {
+ $form->addError("pw1", PW_EMPTY);
+ } elseif(md5($post['pw']) !== $session->userinfo['password']) {
+ $form->addError("pw2", PW_ERR);
+ } else {
+ $database->updateUserField($session->uid, 'alliance', 0, 1);
+ $database->deleteAlliPermissions($session->uid);
+ // log the notice
+ $database->deleteAlliance($session->alliance);
+ $database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $session->uid . '">' . $session->username . '</a> has quit the alliance');
+ header("Location: dorf1.php");
+ }
+ }
+
+ private function changediplomacy($post) {
+ global $database, $session, $form;
+
+ $aName = $database->RemoveXSS($_POST['a_name']);
+ $aType = (int)intval($_POST['dipl']);
+ if($database->aExist($aName, "tag")) {
+ if($database->getAllianceID($aName) != $session->alliance) {
+ if($aType >= 1 and $aType <= 3) {
+ if(!$database->diplomacyInviteCheck($database->getAllianceID($aName), $session->alliance)) {
+ $database->diplomacyInviteAdd($session->alliance, $database->getAllianceID($aName), $aType);
+ $form->addError("name", "Invite sended");
+ } else {
+ $form->addError("name", "You have already sended them a invite");
+ }
+
+ } else {
+ $form->addError("name", "wrong choice made");
+ }
+ } else {
+ $form->addError("name", "You can not invite your own alliance");
+ }
+ } else {
+ $form->addError("name", "Alliance does not exist");
+ }
+ }
+ }
+
+ $alliance = new Alliance;
+
+?>
2,617 GameEngine/Automation.php
2,617 additions, 0 deletions not shown
183 GameEngine/BBCode.php
@@ -0,0 +1,183 @@
+<?php
+
+$pattern= array();
+$pattern[0] = "/\[b\](.*?)\[\/b\]/is";
+$pattern[1] = "/\[i\](.*?)\[\/i\]/is";
+$pattern[2] = "/\[u\](.*?)\[\/u\]/is";
+$pattern[3] = "/\[tid1\]/";
+$pattern[4] = "/\[tid2\]/";
+$pattern[5] = "/\[tid3\]/";
+$pattern[6] = "/\[tid4\]/";
+$pattern[7] = "/\[tid5\]/";
+$pattern[8] = "/\[tid6\]/";
+$pattern[9] = "/\[tid7\]/";
+$pattern[10] = "/\[tid8\]/";
+$pattern[11] = "/\[tid9\]/";
+$pattern[12] = "/\[tid10\]/";
+$pattern[13] = "/\[tid11\]/";
+$pattern[14]