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]);
}
$res .= "</table>\n"
- . "<center>\n"
+ . "<br /><center>\n"
. " <input id=\"emailsDel\" type=\"hidden\" name=\"emails[del]\" value=\"-1\" />\n"
. " <input type=\"submit\" name=\"emails[apply]\" value=\""
. _i18n('apply_changes')."\" />\n"
- . "</center>\n"
+ . "</center><br />\n"
. "</form>\n";
$val = _i18n('your_email');
$res .= "<form action=\"{$_SERVER['REQUEST_URI']}\" method=\"post\">\n"
+ . _i18n('pool_help2')
. "<input type=\"text\" name=\"emails[new]\" size=\"50\" value='$val' "
. " onfocus=\"text_onfocus(this,'$val')\" onblur=\"text_onblur(this,'$val')\" />\n"
. "<input type=\"submit\" name=\"emails[add]\" value=\"".
// 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;
}
$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
."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}' "
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;
}
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;
}
}