mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 07:50:11 +01:00
fixed a bug in user add/edit if empty line among the email addresses
This commit is contained in:
parent
654a5700fa
commit
78259c85ef
@ -103,12 +103,14 @@ class ControllerUserAdd extends Controller {
|
||||
$emails = explode("\n", $this->request->post['email']);
|
||||
foreach ($emails as $email) {
|
||||
$email = rtrim($email);
|
||||
if($email == '') { continue; }
|
||||
|
||||
$ret = checkemail($email, $this->domains);
|
||||
if($ret == 0) {
|
||||
$this->error['email'] = $this->data['text_invalid_email'] . ": $email";
|
||||
$this->error['email'] = $this->data['text_invalid_email'] . ": *$email*";
|
||||
}
|
||||
else if($ret == -1) {
|
||||
$this->error['email'] = $this->data['text_email_in_unknown_domain'] . ": $email";
|
||||
$this->error['email'] = $this->data['text_email_in_unknown_domain'] . ": *$email*";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,12 +117,15 @@ class ControllerUserEdit extends Controller {
|
||||
$emails = explode("\n", $this->request->post['email']);
|
||||
foreach ($emails as $email) {
|
||||
$email = rtrim($email);
|
||||
|
||||
if($email == '') { continue; }
|
||||
|
||||
$ret = checkemail($email, $this->domains);
|
||||
if($ret == 0) {
|
||||
$this->error['email'] = $this->data['text_invalid_email'] . ": $email";
|
||||
$this->error['email'] = $this->data['text_invalid_email'] . ": *$email*";
|
||||
}
|
||||
else if($ret == -1) {
|
||||
$this->error['email'] = $this->data['text_email_in_unknown_domain'] . ": $email";
|
||||
$this->error['email'] = $this->data['text_email_in_unknown_domain'] . ": *$email*";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -314,6 +314,8 @@ class ModelUserUser extends Model {
|
||||
foreach ($emails as $email) {
|
||||
$email = rtrim($email);
|
||||
|
||||
if(validemail($email) == 0) { continue; }
|
||||
|
||||
$query = $this->db->query("SELECT COUNT(*) AS count FROM " . TABLE_EMAIL . " WHERE email=?", array($email));
|
||||
|
||||
/* remove from memcached */
|
||||
@ -346,6 +348,8 @@ class ModelUserUser extends Model {
|
||||
foreach ($emails as $email) {
|
||||
$email = rtrim($email);
|
||||
|
||||
if(validemail($email) == 0) { continue; }
|
||||
|
||||
$ret = $this->add_email((int)$user['uid'], $email);
|
||||
if($ret == 0) { return -2; }
|
||||
}
|
||||
@ -391,6 +395,8 @@ class ModelUserUser extends Model {
|
||||
foreach ($emails as $email) {
|
||||
$email = rtrim($email);
|
||||
|
||||
if(validemail($email) == 0) { continue; }
|
||||
|
||||
$query = $this->db->query("SELECT COUNT(*) AS count FROM " . TABLE_EMAIL . " WHERE uid!=? AND email=?", array((int)$user['uid'], $email));
|
||||
|
||||
if($query->row['count'] > 0) {
|
||||
@ -417,6 +423,9 @@ class ModelUserUser extends Model {
|
||||
|
||||
foreach ($emails as $email) {
|
||||
$email = rtrim($email);
|
||||
|
||||
if(validemail($email) == 0) { continue; }
|
||||
|
||||
$query = $this->db->query("INSERT INTO " . TABLE_EMAIL . " (uid, email) VALUES(?,?)", array((int)$user['uid'], $email));
|
||||
|
||||
/* remove from memcached */
|
||||
|
Loading…
Reference in New Issue
Block a user