diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php
index d18eb287..8c1b53ec 100644
--- a/GameEngine/Automation.php
+++ b/GameEngine/Automation.php
@@ -210,7 +210,7 @@ class Automation {
$this->updateStore();
$this->CheckBan();
$this->regenerateOasisTroops();
-
+ $this->medals();
$this->artefactOfTheFool();
}
@@ -4419,6 +4419,515 @@ $wallimg = "
$post['x'], 'y'=>$post['y']);
- $id = $generator->getBaseID($coor['x'],$coor['y']);
- if (!$database->getVillageState($id)){
- $form->addError("error","Coordinates do not exist");
- }
- if ($session->tribe == 1){$Gtribe = "";}elseif ($session->tribe == 2){$Gtribe = "1";}elseif ($session->tribe == 3){$Gtribe = "2";}elseif ($session->tribe == 4){$Gtribe = "3";}elseif ($session->tribe == 5){$Gtribe = "4";}
- for($i=1; $i<11; $i++)
- {
- if(isset($post['t'.$i]))
- {
+ if(isset($post['x']) && isset($post['y']) && $post['x'] != "" && $post['y'] != "") {
+ $coor = array('x'=>$post['x'], 'y'=>$post['y']);
+ $id = $generator->getBaseID($coor['x'],$coor['y']);
+ if (!$database->getVillageState($id)){
+ $form->addError("error","Coordinates do not exist");
+ }
+ if ($session->tribe == 1){$Gtribe = "";}elseif ($session->tribe == 2){$Gtribe = "1";}elseif ($session->tribe == 3){$Gtribe = "2";}elseif ($session->tribe == 4){$Gtribe = "3";}elseif ($session->tribe == 5){$Gtribe = "4";}
+ for($i=1; $i<10; $i++)
+ {
+ if(isset($post['t'.$i]))
+ {
- if ($post['t'.$i] > $village->unitarray['u'.$Gtribe.$i])
- {
- $form->addError("error","You can't send more units than you have");
- break;
- }
+ if ($post['t'.$i] > $village->unitarray['u'.$Gtribe.$i])
+ {
+ $form->addError("error","You can't send more units than you have");
+ break;
+ }
- if($post['t'.$i]<0)
- {
- $form->addError("error","You can't send negative units.");
- break;
- }
+ if($post['t'.$i]<0)
+ {
+ $form->addError("error","You can't send negative units.");
+ break;
+ }
- }
- }
- if ($post['t11'] > $village->unitarray['hero'])
- {
- $form->addError("error","You can't send more units than you have");
- break;
- }
+ if(preg_match('/[^0-9]/',$post['t'.$i]))
+ {
+ $form->addError("error","Special characters can't entered");
+ break;
+ }
+ }
+ }
+ if ($post['t11'] > $village->unitarray['hero'])
+ {
+ $form->addError("error","You can't send more units than you have");
+ break;
+ }
- if($post['t11']<0)
- {
- $form->addError("error","You can't send negative units.");
- break;
- }
- }
+ if($post['t11']<0)
+ {
+ $form->addError("error","You can't send negative units.");
+ break;
+ }
+
+ if(preg_match('/[^0-9]/',$post['t11']))
+ {
+ $form->addError("error","Special characters can't entered");
+ break;
+ }
+ }
if ($database->isVillageOases($id) == 0) {
if($database->hasBeginnerProtection($id)==1) {
$form->addError("error","Player is under beginners protection. You can't attack him");
diff --git a/install/data/constant_format.tpl b/install/data/constant_format.tpl
index 7cde1ec4..0e1a12c9 100644
--- a/install/data/constant_format.tpl
+++ b/install/data/constant_format.tpl
@@ -123,6 +123,8 @@ define("AUTH_EMAIL",%ACTIVATE%);
define("PLUS_TIME",%PLUS_TIME%);
//+25% production lenght
define("PLUS_PRODUCTION",%PLUS_PRODUCTION%);
+// ***** Medal Interval check
+define("MEDALINTERVAL",%MEDALINTERVAL%);
// ***** Great Workshop
define("GREAT_WKS",%GREAT_WKS%);
// ***** Tourn threshold
diff --git a/install/data/sql.sql b/install/data/sql.sql
index cc0375a1..7e042a53 100644
--- a/install/data/sql.sql
+++ b/install/data/sql.sql
@@ -425,6 +425,22 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%chat` (
--
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `%prefix%config`
+--
+
+CREATE TABLE IF NOT EXISTS `%PREFIX%config` (
+ `lastgavemedal` int(11) unsigned NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+INSERT INTO `%PREFIX%config` VALUES (0);
+
+--
+-- Dumping data for table `%prefix%config`
+--
+
+
-- --------------------------------------------------------
--
diff --git a/install/process.php b/install/process.php
index 96794c61..ba2fbc65 100644
--- a/install/process.php
+++ b/install/process.php
@@ -91,6 +91,7 @@ class Process {
$text = preg_replace("'%GP_LOCATE%'", $_POST['gp_locate'], $text);
$text = preg_replace("'%PLUS_TIME%'", $_POST['plus_time'], $text);
$text = preg_replace("'%PLUS_PRODUCTION%'", $_POST['plus_production'], $text);
+ $text = preg_replace("'%MEDALINTERVAL%'", $_POST['medalinterval'], $text);
$text = preg_replace("'%GREAT_WKS%'", $_POST['great_wks'], $text);
$text = preg_replace("'%TS_THRESHOLD%'", $_POST['ts_threshold'], $text);
$text = preg_replace("'%WW%'", $_POST['ww'], $text);
diff --git a/install/templates/config.tpl b/install/templates/config.tpl
index 3c1ed2a2..0cb3d98e 100644
--- a/install/templates/config.tpl
+++ b/install/templates/config.tpl
@@ -47,13 +47,16 @@ echo "