Файл: monst/core/pag/clan/invite.php
Строк: 83
<?
if ( isset($_GET['send']) ) {
$id = (int)$index[2];
if ( !$id ) {
g('/main');
}
$find = $_users -> findOne(
[
'id' => $id
]
);
if ( !$find ) {
g('/main');
}
if ( $find['clan_id'] ) {
g('/id'.$id.'?in_clan');
}
// root user
if ( !$clan ) {
g('/main');
}
if ( $clan['master_id'] != $user['id'] ) {
g('/main');
}
$_clan_invites -> remove(
[
'time' => [
'$lt' => time() - 60 * 60 * 24
]
]
);
$_clan_invites -> remove(
[
'user_id' => $id
]
);
$new_id = new_id('_clan_invites');
$_clan_invites -> insert(
[
'id' => $new_id,
'clan_id' => $clan['id'],
'user_id' => $id,
'time' => time()
]
);
$new_id = new_id('_not');
$text = '<img src="'.av($user['id']).'" alt="" width="15"/> ' . Name($user['id']) .' ' . $lang['clan.php']['invites']['invite_you'] . '<br/><br/>
<div style="text-align: center;">';
if ( clanicon($clan['id']) ) {
$text .= '<img src="'.clanicon($clan['id']).'" alt="" width="50"/><br/> ' . $clan['name'];
} else {
$text .= $clan['name'];
}
$text .= '<br/><br/>
<a href="/clan/invite?not_id='.$new_id.'">'.$lang['clan.php']['invites']['butt']['invite'].'</a>
</div>
';
$_not -> insert(
[
'id' => $new_id,
'user_id' => $id,
'time' => time(),
'text' => $text
]
);
g('/id'.$id.'?invite_sended');
}
// invite
$not_id = (int)$_GET['not_id'];
$find = $_clan_invites -> findOne(
[
'user_id' => $user['id']
]
);
if ( !$find ) {
g('/main');
}
$_users -> update(
[
'id' => $user['id']
],
[
'$set' => [
'clan_id' => $find['clan_id']
]
]
);
$_not -> remove(
[
'id' => $not_id,
'user_id' => $user['id']
]
);
g('/clan/' . $find['clan_id']);