From 58070ad57cf4316e4055b174815ba2fe88e3444c Mon Sep 17 00:00:00 2001 From: hecht Date: Wed, 23 Nov 2011 18:48:56 +0000 Subject: [PATCH] Fixed that clans didn't get unlocked --- ag/include/clan_fights.inc.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ag/include/clan_fights.inc.php b/ag/include/clan_fights.inc.php index ff5ab12..a32c36f 100644 --- a/ag/include/clan_fights.inc.php +++ b/ag/include/clan_fights.inc.php @@ -372,7 +372,7 @@ function isClanLocked($clanid) { $sql = 'SELECT *, locked_until > now() as `lock`, (Select count(id) from user where clan = c2.id) as members FROM clan_locked right join clan c2 on c2.id = clan_locked.clanid where c2.id = ' . $clanid; // echo $sql.'
'; $lock = mysql_fetch_assoc(mysql_query($sql)); - + echo $lock['lock'] . ' => ' . ($lock['lock'] == 0?'TRUE':'FALSE').'
'; if($lock['lock'] == 0) { // don't matter if it is 0 or NULL // we do not have data in the clan locked table so we are not locked :D @@ -380,7 +380,12 @@ function isClanLocked($clanid) { // we do have data but it seems we are not locked anymore ;) // are we still having enough members?? - if($lock['members'] >= MIN_MEMBERS && $lock['lock'] === NULL) { + if($lock['members'] >= MIN_MEMBERS) { + if($lock['lock'] === 0) { // If data is available in 'clan_locked' remove it + $sql = 'DELETE FROM clan_locked WHERE clanid = ' .$clanid .' AND locked_until < now()'; + mysql_query($sql); + } + // key so every thing seems to be fine :) return false; // the only case we may return false! } else if($lock['lock'] === NULL){ // we need to insert a row