function toggle_flag($_flag) {
$flags = explode(",", $this->flags);
$key = array_search($_flag,$flags);
function toggle_flag($_flag) {
$flags = explode(",", $this->flags);
$key = array_search($_flag,$flags);
// we check that the email is not already there
foreach($this->emails as $id=>$key)
if($key->email == $new_mail) {
// we check that the email is not already there
foreach($this->emails as $id=>$key)
if($key->email == $new_mail) {
$this->emails[$mid]->commit($this->uid, $mid);
uasort($this->emails, "email_cmp");
} else {
$this->emails[$mid]->commit($this->uid, $mid);
uasort($this->emails, "email_cmp");
} else {
if(isset($_POST['emails'][$id]['active']) xor $this->emails[$id]->is_active()) {
$this->emails[$id]->toggle_flag('active');
$this->emails[$id]->commit($this->uid, $id);
}
if(isset($_POST['emails'][$id]['active']) xor $this->emails[$id]->is_active()) {
$this->emails[$id]->toggle_flag('active');
$this->emails[$id]->commit($this->uid, $id);
}