diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 2ae5f073..693ce035 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -473,32 +473,6 @@ class Automation { $q = "UPDATE " . TB_PREFIX . "odata set maxstore = $maxstore, maxcrop = $maxcrop where wref = ".$getoasis['wref'].""; $database->query($q); } - $q = "SELECT * FROM ".TB_PREFIX."odata WHERE wood > maxstore OR clay > maxstore OR iron > maxstore OR crop > maxcrop"; - $array = $database->query_return($q); - foreach($array as $getoasis) { - if($getoasis['wood'] > $getoasis['maxstore']){ - $wood = $getoasis['maxstore']; - }else{ - $wood = $getoasis['wood']; - } - if($getoasis['clay'] > $getoasis['maxstore']){ - $clay = $getoasis['maxstore']; - }else{ - $clay = $getoasis['clay']; - } - if($getoasis['iron'] > $getoasis['maxstore']){ - $iron = $getoasis['maxstore']; - }else{ - $iron = $getoasis['iron']; - } - if($getoasis['crop'] > $getoasis['maxstore']){ - $crop = $getoasis['maxstore']; - }else{ - $crop = $getoasis['crop']; - } - $q = "UPDATE " . TB_PREFIX . "odata set wood = $wood, clay = $clay, iron = $iron, crop = $crop where wref = ".$getoasis['wref'].""; - $database->query($q); - } $q = "SELECT * FROM ".TB_PREFIX."odata WHERE wood < 0 OR clay < 0 OR iron < 0 OR crop < 0"; $array = $database->query_return($q); foreach($array as $getoasis) { @@ -698,6 +672,9 @@ class Automation { if($indi['type'] == 40 and ($indi['level'] % 5 == 0 or $indi['level'] > 95) and $indi['level'] != 100){ $this->startNatarAttack($indi['level'], $indi['wid'], $indi['timestamp']); } + if($indi['type'] == 40 && $indi['level'] == 100){ //now can't be more than one winners if ww to level 100 is build by 2 users or more on same time + mysql_query("TRUNCATE ".TB_PREFIX."bdata"); + } if($database->getUserField($database->getVillageField($indi['wid'],"owner"),"tribe",0) != 1){ $q4 = "UPDATE ".TB_PREFIX."bdata set loopcon = 0 where loopcon = 1 and master = 0 and wid = ".$indi['wid']; $database->query($q4); @@ -914,6 +891,7 @@ class Automation { $q = "SELECT * FROM ".TB_PREFIX."route where timestamp < $time"; $dataarray = $database->query_return($q); foreach($dataarray as $data) { + $database->modifyResource($data['from'],$data['wood'],$data['clay'],$data['iron'],$data['crop'],0); $targettribe = $database->getUserField($database->getVillageField($data['from'],"owner"),"tribe",0); $this->sendResource2($data['wood'],$data['clay'],$data['iron'],$data['crop'],$data['from'],$data['wid'],$targettribe,$data['deliveries']); $database->editTradeRoute($data['id'],"timestamp",86400,1); @@ -1626,7 +1604,7 @@ class Automation { $cranny = 0; for($i=19;$i<39;$i++){ if($buildarray['f'.$i.'t']==23){ - $cranny += $bid23[$buildarray['f'.$i.'']]['attri']; + $cranny += $bid23[$buildarray['f'.$i.'']]['attri']*CRANNY_CAPACITY; } } @@ -3929,11 +3907,24 @@ $crannyimg = "query_return($q); foreach($array as $getoasis) { - $oasiswood = (8*SPEED/3600)*(time()-$getoasis['lastupdated']); - $oasisclay = (8*SPEED/3600)*(time()-$getoasis['lastupdated']); - $oasisiron = (8*SPEED/3600)*(time()-$getoasis['lastupdated']); - $oasiscrop = (8*SPEED/3600)*(time()-$getoasis['lastupdated']); - $database->modifyOasisResource($getoasis['wref'],$oasiswood,$oasisclay,$oasisiron,$oasiscrop,1); + $oasiswood = $getoasis['wood'] + (8*SPEED/3600)*(time()-$getoasis['lastupdated']); + $oasisclay = $getoasis['clay'] + (8*SPEED/3600)*(time()-$getoasis['lastupdated']); + $oasisiron = $getoasis['iron'] + (8*SPEED/3600)*(time()-$getoasis['lastupdated']); + $oasiscrop = $getoasis['crop'] + (8*SPEED/3600)*(time()-$getoasis['lastupdated']); + if($oasiswood > $getoasis['maxstore']){ + $oasiswood = $getoasis['maxstore']; + } + if($oasisclay > $getoasis['maxstore']){ + $oasisclay = $getoasis['maxstore']; + } + if($oasisiron > $getoasis['maxstore']){ + $oasisiron = $getoasis['maxstore']; + } + if($oasiscrop > $getoasis['maxcrop']){ + $oasiscrop = $getoasis['maxcrop']; + } + $q = "UPDATE " . TB_PREFIX . "odata set wood = $oasiswood, clay = $oasisclay, iron = $oasisiron, crop = $oasiscrop where wref = ".$getoasis['wref'].""; + $database->query($q); $database->updateOasis($getoasis['wref']); } } diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 19596f57..a4f2bb2b 100644 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -695,6 +695,8 @@ class Building { $buildiron = $buildarray[$level]['iron']; $buildcrop = $buildarray[$level]['crop']; if($buildwood < $villwood && $buildclay < $villclay && $buildiron < $villiron && $buildcrop < $villcrop){ + $newgold = $session->gold-1; + $database->updateUserField($session->uid, "gold", $newgold, 1); $enought_res = 1; $q = "UPDATE ".TB_PREFIX."fdata set f".$jobs['field']." = ".$jobs['level'].", f".$jobs['field']."t = ".$jobs['type']." where vref = ".$jobs['wid']; } diff --git a/GameEngine/Database/db_MYSQL.php b/GameEngine/Database/db_MYSQL.php index 0a7c4c07..66a8dee6 100644 --- a/GameEngine/Database/db_MYSQL.php +++ b/GameEngine/Database/db_MYSQL.php @@ -20,7 +20,7 @@ class MYSQL_DB { function register($username, $password, $email, $tribe, $act) { $time = time(); - $timep = (time() + PROTECTION); + $timep = (strtotime(START_TIME) + PROTECTION); $q = "INSERT INTO " . TB_PREFIX . "users (username,password,access,email,timestamp,tribe,act,protect,lastupdate,regtime) VALUES ('$username', '$password', " . USER . ", '$email', $time, $tribe, '$act', $timep, $time, $time)"; if(mysql_query($q, $this->connection)) { return mysql_insert_id($this->connection); @@ -2151,7 +2151,7 @@ class MYSQL_DB { } function getARanking() { - $q = "SELECT id,name,tag,oldrank FROM " . TB_PREFIX . "alidata where id != '' ORDER BY id DESC"; + $q = "SELECT id,name,tag,oldrank,Aap,Adp FROM " . TB_PREFIX . "alidata where id != '' ORDER BY id DESC"; $result = mysql_query($q, $this->connection); return $this->mysql_fetch_all($result); } diff --git a/GameEngine/Message.php b/GameEngine/Message.php index e213102d..881cc1ef 100644 --- a/GameEngine/Message.php +++ b/GameEngine/Message.php @@ -118,6 +118,22 @@ class Message { if($message['id'] == $id) { $message = preg_replace('/\[message\]/', '', $message); $message = preg_replace('/\[\/message\]/', '', $message); + for($i=1;$i<=$message['alliance'];$i++){ + $message = preg_replace('/\[alliance'.$i.'\]/', '[alliance0]', $message); + $message = preg_replace('/\[\/alliance'.$i.'\]/', '[/alliance0]', $message); + } + for($i=0;$i<=$message['player'];$i++){ + $message = preg_replace('/\[player'.$i.'\]/', '[player0]', $message); + $message = preg_replace('/\[\/player'.$i.'\]/', '[/player0]', $message); + } + for($i=0;$i<=$message['coor'];$i++){ + $message = preg_replace('/\[coor'.$i.'\]/', '[coor0]', $message); + $message = preg_replace('/\[\/coor'.$i.'\]/', '[/coor0]', $message); + } + for($i=0;$i<=$message['report'];$i++){ + $message = preg_replace('/\[report'.$i.'\]/', '[report0]', $message); + $message = preg_replace('/\[\/report'.$i.'\]/', '[/report0]', $message); + } $this->reply = $_SESSION['reply'] = $message; header("Location: nachrichten.php?t=1&id=" . $message['owner']); } @@ -392,18 +408,6 @@ class Message { $alliance = $player = $coor = $report = 0; for($i=0;$i<=$alliance;$i++){ if(preg_match('/\[alliance'.$i.'\]/',$text) && preg_match('/\[\/alliance'.$i.'\]/',$text)){ - $alliance1 = preg_replace('/\[alliance'.$i.'\]/', '', $input); - $alliance1 = preg_replace('/\[\/alliance'.$i.'\]/', '', $alliance1); - if(preg_match('/\[alliance'.$i.'\]/',$alliance1) && preg_match('/\[\/alliance'.$i.'\]/',$alliance1)){ - $j = $i+1; - $text = preg_replace('/\[alliance'.$i.'\]/', '/\[alliance'.$j.'\]/', $text); - $text = preg_replace('/\[\/alliance'.$i.'\]/', '/\[\/alliance'.$j.'\]/', $text); - $alliance += 1; - } - } - } - for($i=0;$i<=$alliance;$i++){ - if(preg_match('/\[alliance'.$i.'\]/',$text) && preg_match('/\[\/alliance'.$i.'\]/',$text)){ $alliance1 = preg_replace('/\[message\](.*?)\[\/alliance'.$i.'\]/is', '', $text); if(preg_match('/\[alliance'.$i.'\]/',$alliance1) && preg_match('/\[\/alliance'.$i.'\]/',$alliance1)){ $j = $i+1; diff --git a/GameEngine/Ranking.php b/GameEngine/Ranking.php index 21d42b05..87ce2983 100644 --- a/GameEngine/Ranking.php +++ b/GameEngine/Ranking.php @@ -484,10 +484,7 @@ $holder = array(); foreach($array as $value) { $memberlist = $database->getAllMember($value['id']); - $totalap = 0; - foreach($memberlist as $member) { - $totalap += $member['ap']; - } + $totalap = $value['Aap']; $value['players'] = count($memberlist); $value['totalap'] = $totalap; if($value['avg'] > 0) { @@ -512,14 +509,11 @@ $holder = array(); foreach($array as $value) { $memberlist = $database->getAllMember($value['id']); - $totaldp = 0; - foreach($memberlist as $member) { - $totaldp += $member['dp']; - } + $totaldp = $value['Adp']; $value['players'] = count($memberlist); $value['totaldp'] = $totaldp; if($value['avg'] > 0) { - $value['avg'] = round($totalap / count($memberlist)); + $value['avg'] = round($totaldp / count($memberlist)); } else { $value['avg'] = 0; } diff --git a/GameEngine/Technology.php b/GameEngine/Technology.php index a005a1bd..8f0958f6 100644 --- a/GameEngine/Technology.php +++ b/GameEngine/Technology.php @@ -179,7 +179,11 @@ class Technology { }else{ $cropcalc = 0; } + if($unit != "u99"){ $popcalc = floor($village->getProd("crop")/$unitarray['pop']); + }else{ + $popcalc = $village->getProd("crop"); + } return min($woodcalc,$claycalc,$ironcalc,$cropcalc); } diff --git a/Templates/Alliance/Forum/forum_10.tpl b/Templates/Alliance/Forum/forum_10.tpl index bb6c2659..317a7da0 100644 --- a/Templates/Alliance/Forum/forum_10.tpl +++ b/Templates/Alliance/Forum/forum_10.tpl @@ -6,10 +6,12 @@ $post_id = $_GET['pod']; $topics = $database->ShowTopic($topic_id); $posts = $database->ShowPostEdit($post_id); foreach($topics as $top) { - $title = $top['title']; + $title = stripslashes($top['title']); } foreach($posts as $pos) { - $poss = $pos['post']; + $poss = stripslashes($pos['post']); + $poss = preg_replace('/\[message\]/', '', $poss); + $poss = preg_replace('/\[\/message\]/', '', $poss); } ?>
diff --git a/Templates/Alliance/Forum/forum_2.tpl b/Templates/Alliance/Forum/forum_2.tpl index cffc62c3..baaf2656 100644 --- a/Templates/Alliance/Forum/forum_2.tpl +++ b/Templates/Alliance/Forum/forum_2.tpl @@ -54,7 +54,7 @@ if($database->CheckEditRes($aid)=="1"){ }else{ echo 'Thread without new posts'; } -echo ''.$arr['forum_name'].'
'.$arr['forum_des'].' +echo ''.stripslashes($arr['forum_name']).'
'.stripslashes($arr['forum_des']).' '.$countop.' '.$lpost.'
'.$owner['username'].' Show last post '; @@ -105,7 +105,7 @@ if($database->CheckEditRes($aid)=="1"){ }else{ echo 'Thread without new posts'; } -echo ''.$arr['forum_name'].'
'.$arr['forum_des'].' +echo ''.stripslashes($arr['forum_name']).'
'.stripslashes($arr['forum_des']).' '.$countop.' '.$lpost.'

'.$owner['username'].' Show last post '; @@ -156,7 +156,7 @@ if($database->CheckEditRes($aid)=="1"){ }else{ echo 'Thread without new posts'; } -echo ''.$arr['forum_name'].'
'.$arr['forum_des'].' +echo ''.stripslashes($arr['forum_name']).'
'.stripslashes($arr['forum_des']).' '.$countop.' '.$lpost.'

'.$owner['username'].' Show last post '; @@ -207,7 +207,7 @@ if($database->CheckEditRes($aid)=="1"){ }else{ echo 'Thread without new posts'; } -echo ''.$arr['forum_name'].'
'.$arr['forum_des'].' +echo ''.stripslashes($arr['forum_name']).'
'.stripslashes($arr['forum_des']).' '.$countop.' '.$lpost.'

'.$owner['username'].' Show last post '; diff --git a/Templates/Alliance/Forum/forum_3.tpl b/Templates/Alliance/Forum/forum_3.tpl index fa1232ce..cb28dad8 100644 --- a/Templates/Alliance/Forum/forum_3.tpl +++ b/Templates/Alliance/Forum/forum_3.tpl @@ -4,7 +4,7 @@ if($session->access!=BANNED){ $topic_id = $_GET['idt']; $show_topic = $database->ShowTopic($topic_id); foreach($show_topic as $topi) { - $title = $topi['title']; + $title = stripslashes($topi['title']); } ?> @@ -29,9 +29,9 @@ foreach($show_topic as $topi) { $show_cat = $database->ForumCat($session->alliance); foreach($show_cat as $cats) { if($cats['id'] == $_GET['idf']){ - echo ''; + echo ''; }else{ - echo ''; + echo ''; } } ?> diff --git a/Templates/Alliance/Forum/forum_4.tpl b/Templates/Alliance/Forum/forum_4.tpl index 20e3cb3d..e8d3af1f 100644 --- a/Templates/Alliance/Forum/forum_4.tpl +++ b/Templates/Alliance/Forum/forum_4.tpl @@ -2,7 +2,7 @@ //////////////// made by TTMTT //////////////// if($session->access!=BANNED){ $cat_id = $_GET['fid']; -$CatName = $database->ForumCatName($cat_id); +$CatName = stripslashes($database->ForumCatName($cat_id)); $ChckTopic = $database->CheckCatTopic($cat_id); $Topics = $database->ForumCatTopic($cat_id); $TopicsStick = $database->ForumCatTopicStick($cat_id); @@ -46,7 +46,7 @@ if($ChckTopic){ echo 'Important Thread without new posts'; } echo ' - '.$arrs['title'].'
+ '.stripslashes($arrs['title']).'
'.$CountPosts.' '.$post_dates.'
'.$owner_topics['username'].' Show last post '; @@ -80,7 +80,7 @@ if($ChckTopic){ echo 'Thread without new posts'; } echo ' - '.$arr['title'].'
+ '.stripslashes($arr['title']).'
'.$CountPost.' '.$post_date.'
'.$owner_topic['username'].' Show last post '; diff --git a/Templates/Alliance/Forum/forum_6.tpl b/Templates/Alliance/Forum/forum_6.tpl index 19e6ae74..6662e841 100644 --- a/Templates/Alliance/Forum/forum_6.tpl +++ b/Templates/Alliance/Forum/forum_6.tpl @@ -8,7 +8,7 @@ $posts = $database->ShowPost($tid); foreach($topics as $arr) { $cat_id = $arr['cat']; $owner = $database->getUserArray($arr['owner'],1); - $CatName = $database->ForumCatName($cat_id); + $CatName = stripslashes($database->ForumCatName($cat_id)); $allianceinfo = $database->getAlliance($owner['alliance']); } $date = date('m/d/y H:i a',$arr['date']); @@ -20,7 +20,7 @@ foreach($varray as $vil) { $countAu = $database->CountTopic($arr['owner']); $displayarray = $database->getUserArray($arr['owner'],1); if($displayarray['tribe'] == 1) { - $trip = "Roman"; + $trip = "Romans"; }else if($displayarray['tribe'] == 2) { $trip = "Teutons"; }else if($displayarray['tribe'] == 3) { @@ -29,11 +29,11 @@ if($displayarray['tribe'] == 1) { $input = $arr['post']; $bbcoded = $input; include("GameEngine/BBCode.php"); -$bbcode_topic = nl2br($bbcoded); +$bbcode_topic = stripslashes(nl2br($bbcoded)); ?>

Alliance ->

- + @@ -76,7 +76,7 @@ foreach($posts as $po) { $allianceinfo = $database->getAlliance($owner['alliance']); $input = $po['post']; include("GameEngine/BBCode.php"); - $bbcode_post = nl2br($bbcoded); + $bbcode_post = stripslashes(nl2br($bbcoded)); echo '
Author
'.$owner['username'].'
'.$allianceinfo['tag'].'
Posts: '.$countAu.'
diff --git a/Templates/Alliance/Forum/forum_7.tpl b/Templates/Alliance/Forum/forum_7.tpl index 8a0f7c6b..8328c765 100644 --- a/Templates/Alliance/Forum/forum_7.tpl +++ b/Templates/Alliance/Forum/forum_7.tpl @@ -4,7 +4,7 @@ if($session->access!=BANNED){ $tid = $_GET['tid']; $topics = $database->ShowTopic($tid); foreach($topics as $arr) { - $title = $arr['title']; + $title = stripslashes($arr['title']); } ?> diff --git a/Templates/Alliance/Forum/forum_8.tpl b/Templates/Alliance/Forum/forum_8.tpl index eab35769..5d21c911 100644 --- a/Templates/Alliance/Forum/forum_8.tpl +++ b/Templates/Alliance/Forum/forum_8.tpl @@ -3,8 +3,8 @@ if($session->access!=BANNED){ $forum_data = $database->ForumCatEdit($_GET['idf']); foreach($forum_data as $cats) { - $cat_name = $cats['forum_name']; - $cat_des = $cats['forum_des']; + $cat_name = stripslashes($cats['forum_name']); + $cat_des = stripslashes($cats['forum_des']); } ?>