Fixed that clans didn't get unlocked

main
hecht 13 years ago
parent f5ca108f7d
commit 58070ad57c

@ -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.'<br>';
$lock = mysql_fetch_assoc(mysql_query($sql));
echo $lock['lock'] . ' => ' . ($lock['lock'] == 0?'TRUE':'FALSE').'<br>';
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

Loading…
Cancel
Save