+
+ /** handle the data from the small form
+ * @return true if all is ok, false and sets $philter->error() else
+ */
+ function handle_small_form() {
+ global $philter;
+
+ if(isset($_POST['emails']['add'])) { // add an email to the pool
+ if(Email::Check($_POST['emails']['new'])) {
+ $new_mail = strtolower($_POST['emails']['new']);
+
+ // 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 "._i18n('pool_err_already'));
+ return false;
+ }
+
+ // then we compute one free id, and we add it to the list
+ $mid = $this->new_mail_id();
+ $this->emails[$mid] = new Email($new_mail, '');
+ $this->emails[$mid]->commit($this->uid, $mid);
+ uasort($this->emails, "email_cmp");
+ } else {
+ $philter->set_error($_POST['emails']['new'].' '._i18n('pool_err_not_valid'));
+ return false;
+ }
+ }
+ }