X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=philter%2Fphilter%2Finclude%2Femails.inc.php;h=0ee1afa1cce095066af95e113f422f898edb66c9;hb=f0a83324f4cda95839ae5f033289c478db499c71;hp=1cc1eafe5b206ff6e869dc35044dbc34c806ef18;hpb=eca2e192f5a58a8eeef0fd16f8e5f021fdae662f;p=old-projects.git diff --git a/philter/philter/include/emails.inc.php b/philter/philter/include/emails.inc.php index 1cc1eaf..0ee1afa 100644 --- a/philter/philter/include/emails.inc.php +++ b/philter/philter/include/emails.inc.php @@ -54,7 +54,7 @@ class Email { function toggle_flag($_flag) { $flags = explode(",", $this->flags); $key = array_search($_flag,$flags); - if($key===false) + if($key===NULL || $key===false) $flags[]=$_flag; else unset($flags[$key]); @@ -173,7 +173,7 @@ class EmailPool { // we check that the email is not already there foreach($this->emails as $id=>$key) if($key->email == $new_mail) { - $philter->set_error("$new_mail is already in the Email Pool"); + $philter->set_error("$new_mail "._i18n('pool_err_already')); return false; } @@ -183,7 +183,7 @@ class EmailPool { $this->emails[$mid]->commit($this->uid, $mid); uasort($this->emails, "email_cmp"); } else { - $philter->set_error($_POST['emails']['new']." is not a valid email"); + $philter->set_error($_POST['emails']['new'].' '._i18n('pool_err_not_valid')); return false; } } elseif(isset($_POST['emails']['del']) && $_POST['emails']['del'] != -1) { // delete one email @@ -203,7 +203,7 @@ class EmailPool { ."WHERE uid='{$this->uid}' AND pid='" .FwdPlugin::rtti()."' AND data='$del_id'")); if($count) { - $philter->set_error("This email is still in use and can't be deleted !"); + $philter->set_error(_i18n('pool_err_active')); return false; } else { mysql_query("DELETE FROM emails WHERE uid='{$this->uid}' " @@ -211,12 +211,11 @@ class EmailPool { unset($this->emails[$del_id]); } } else { - $philter->set_error("you must have at least one active email !"); + $philter->set_error(_i18n('pool_err_need_one')); return false; } } elseif(isset($_POST['emails']['apply'])) { // apply actives changes $one_active = false; - foreach($this->emails as $id=>$mail) if(isset($_POST['emails'][$id]['active'])) { $one_active = true; @@ -224,15 +223,16 @@ class EmailPool { } if(!$one_active) { - $philter->set_error("you must have at least one active email !"); + $philter->set_error(_i18n('pool_err_need_one')); return false; } - foreach($this->emails as $id=>$key) + foreach($this->emails as $id=>$key) { 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); } + } return true; } }