|
@@ -1233,7 +1233,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
':active' => $active
|
|
|
));
|
|
|
|
|
|
-
|
|
|
+
|
|
|
if (isset($_data['acl'])) {
|
|
|
$_data['acl'] = (array)$_data['acl'];
|
|
|
$_data['spam_alias'] = (in_array('spam_alias', $_data['acl'])) ? 1 : 0;
|
|
@@ -1265,14 +1265,14 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
$_data['quarantine_attachments'] = intval($MAILBOX_DEFAULT_ATTRIBUTES['acl_quarantine_attachments']);
|
|
|
$_data['quarantine_notification'] = intval($MAILBOX_DEFAULT_ATTRIBUTES['acl_quarantine_notification']);
|
|
|
$_data['quarantine_category'] = intval($MAILBOX_DEFAULT_ATTRIBUTES['acl_quarantine_category']);
|
|
|
- $_data['app_passwds'] = intval($MAILBOX_DEFAULT_ATTRIBUTES['acl_app_passwds']);
|
|
|
- $_data['pw_reset'] = intval($MAILBOX_DEFAULT_ATTRIBUTES['acl_pw_reset']);
|
|
|
+ $_data['app_passwds'] = intval($MAILBOX_DEFAULT_ATTRIBUTES['acl_app_passwds']);
|
|
|
+ $_data['pw_reset'] = intval($MAILBOX_DEFAULT_ATTRIBUTES['acl_pw_reset']);
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- $stmt = $pdo->prepare("INSERT INTO `user_acl`
|
|
|
+ $stmt = $pdo->prepare("INSERT INTO `user_acl`
|
|
|
(`username`, `spam_alias`, `tls_policy`, `spam_score`, `spam_policy`, `delimiter_action`, `syncjobs`, `eas_reset`, `sogo_profile_reset`,
|
|
|
- `pushover`, `quarantine`, `quarantine_attachments`, `quarantine_notification`, `quarantine_category`, `app_passwds`, `pw_reset`)
|
|
|
+ `pushover`, `quarantine`, `quarantine_attachments`, `quarantine_notification`, `quarantine_category`, `app_passwds`, `pw_reset`)
|
|
|
VALUES (:username, :spam_alias, :tls_policy, :spam_score, :spam_policy, :delimiter_action, :syncjobs, :eas_reset, :sogo_profile_reset,
|
|
|
:pushover, :quarantine, :quarantine_attachments, :quarantine_notification, :quarantine_category, :app_passwds, :pw_reset) ");
|
|
|
$stmt->execute(array(
|
|
@@ -1467,7 +1467,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
);
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// check attributes
|
|
|
$attr = array();
|
|
|
$attr['tags'] = (isset($_data['tags'])) ? $_data['tags'] : array();
|
|
@@ -1557,7 +1557,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
$attr['pop3_access'] = (in_array('pop3', $_data['protocol_access'])) ? 1 : 0;
|
|
|
$attr['smtp_access'] = (in_array('smtp', $_data['protocol_access'])) ? 1 : 0;
|
|
|
$attr['sieve_access'] = (in_array('sieve', $_data['protocol_access'])) ? 1 : 0;
|
|
|
- }
|
|
|
+ }
|
|
|
else {
|
|
|
$attr['imap_access'] = intval($MAILBOX_DEFAULT_ATTRIBUTES['imap_access']);
|
|
|
$attr['pop3_access'] = intval($MAILBOX_DEFAULT_ATTRIBUTES['pop3_access']);
|
|
@@ -2109,7 +2109,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
);
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// check if param is whitelisted
|
|
|
if (!in_array(strtolower($param), $GLOBALS["IMAPSYNC_OPTIONS"]["whitelist"])){
|
|
|
// bad option
|
|
@@ -2802,11 +2802,11 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
// check name
|
|
|
if ($is_now["template"] == "Default" && $is_now["template"] != $_data["template"]){
|
|
|
// keep template name of Default template
|
|
|
- $_data["template"] = $is_now["template"];
|
|
|
+ $_data["template"] = $is_now["template"];
|
|
|
}
|
|
|
else {
|
|
|
- $_data["template"] = (isset($_data["template"])) ? $_data["template"] : $is_now["template"];
|
|
|
- }
|
|
|
+ $_data["template"] = (isset($_data["template"])) ? $_data["template"] : $is_now["template"];
|
|
|
+ }
|
|
|
// check attributes
|
|
|
$attr = array();
|
|
|
$attr['tags'] = (isset($_data['tags'])) ? $_data['tags'] : array();
|
|
@@ -2833,10 +2833,10 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
":id" => $id ,
|
|
|
":template" => $_data["template"] ,
|
|
|
":attributes" => json_encode($attr)
|
|
|
- ));
|
|
|
+ ));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
$_SESSION['return'][] = array(
|
|
|
'type' => 'success',
|
|
|
'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
|
|
@@ -3192,7 +3192,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
':tag_name' => $tag,
|
|
|
));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$_SESSION['return'][] = array(
|
|
|
'type' => 'success',
|
|
|
'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
|
|
@@ -3203,6 +3203,146 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
}
|
|
|
return true;
|
|
|
break;
|
|
|
+ case 'mailbox_rename':
|
|
|
+ $domain = $_data['domain'];
|
|
|
+ $old_local_part = $_data['old_local_part'];
|
|
|
+ $old_username = $old_local_part . "@" . $domain;
|
|
|
+ $new_local_part = $_data['new_local_part'];
|
|
|
+ $new_username = $new_local_part . "@" . $domain;
|
|
|
+ $create_alias = intval($_data['create_alias']);
|
|
|
+
|
|
|
+ if (!filter_var($old_username, FILTER_VALIDATE_EMAIL)) {
|
|
|
+ $_SESSION['return'][] = array(
|
|
|
+ 'type' => 'danger',
|
|
|
+ 'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
|
|
|
+ 'msg' => array('username_invalid', $old_username)
|
|
|
+ );
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!filter_var($new_username, FILTER_VALIDATE_EMAIL)) {
|
|
|
+ $_SESSION['return'][] = array(
|
|
|
+ 'type' => 'danger',
|
|
|
+ 'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
|
|
|
+ 'msg' => array('username_invalid', $new_username)
|
|
|
+ );
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ $is_now = mailbox('get', 'mailbox_details', $old_username);
|
|
|
+ if (empty($is_now)) {
|
|
|
+ $_SESSION['return'][] = array(
|
|
|
+ 'type' => 'danger',
|
|
|
+ 'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
|
|
|
+ 'msg' => 'access_denied'
|
|
|
+ );
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!hasDomainAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $is_now['domain'])) {
|
|
|
+ $_SESSION['return'][] = array(
|
|
|
+ 'type' => 'danger',
|
|
|
+ 'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
|
|
|
+ 'msg' => 'access_denied'
|
|
|
+ );
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // rename username in sql
|
|
|
+ try {
|
|
|
+ $pdo->beginTransaction();
|
|
|
+ $pdo->exec('SET FOREIGN_KEY_CHECKS = 0');
|
|
|
+
|
|
|
+ $pdo->prepare('UPDATE mailbox SET username = :new_username, local_part = :new_local_part WHERE username = :old_username')
|
|
|
+ ->execute([
|
|
|
+ ':new_username' => $new_username,
|
|
|
+ ':new_local_part' => $new_local_part,
|
|
|
+ ':old_username' => $old_username
|
|
|
+ ]);
|
|
|
+
|
|
|
+ // Update the username in all related tables
|
|
|
+ $tables = [
|
|
|
+ 'tags_mailbox' => 'username',
|
|
|
+ 'sieve_filters' => 'username',
|
|
|
+ 'app_passwd' => 'mailbox',
|
|
|
+ 'user_acl' => 'username',
|
|
|
+ 'da_acl' => 'username',
|
|
|
+ 'quota2' => 'username',
|
|
|
+ 'quota2replica' => 'username',
|
|
|
+ 'pushover' => 'username'
|
|
|
+ ];
|
|
|
+
|
|
|
+ foreach ($tables as $table => $column) {
|
|
|
+ $pdo->prepare("UPDATE $table SET $column = :new_username WHERE $column = :old_username")
|
|
|
+ ->execute([
|
|
|
+ ':new_username' => $new_username,
|
|
|
+ ':old_username' => $old_username
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ $pdo->prepare("UPDATE _sogo_static_view SET c_uid = :new_username, c_name = :new_username2, mail = :new_username3 WHERE c_uid = :old_username")
|
|
|
+ ->execute([
|
|
|
+ ':new_username' => $new_username,
|
|
|
+ ':new_username2' => $new_username,
|
|
|
+ ':new_username3' => $new_username,
|
|
|
+ ':old_username' => $old_username
|
|
|
+ ]);
|
|
|
+
|
|
|
+ $pdo->prepare("UPDATE alias SET address = :new_username, goto = :new_username2 WHERE address = :old_username")
|
|
|
+ ->execute([
|
|
|
+ ':new_username' => $new_username,
|
|
|
+ ':new_username2' => $new_username,
|
|
|
+ ':old_username' => $old_username
|
|
|
+ ]);
|
|
|
+
|
|
|
+
|
|
|
+ // Re-enable foreign key checks
|
|
|
+ $pdo->exec('SET FOREIGN_KEY_CHECKS = 1');
|
|
|
+ $pdo->commit();
|
|
|
+ } catch (PDOException $e) {
|
|
|
+ // Rollback the transaction if something goes wrong
|
|
|
+ $pdo->rollBack();
|
|
|
+ $_SESSION['return'][] = array(
|
|
|
+ 'type' => 'danger',
|
|
|
+ 'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
|
|
|
+ 'msg' => $e->getMessage()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // move maildir
|
|
|
+ $exec_fields = array(
|
|
|
+ 'cmd' => 'maildir',
|
|
|
+ 'task' => 'move',
|
|
|
+ 'old_maildir' => $domain . '/' . $old_local_part,
|
|
|
+ 'new_maildir' => $domain . '/' . $new_local_part
|
|
|
+ );
|
|
|
+ docker('post', 'dovecot-mailcow', 'exec', $exec_fields);
|
|
|
+
|
|
|
+ // rename username in sogo
|
|
|
+ $exec_fields = array(
|
|
|
+ 'cmd' => 'sogo',
|
|
|
+ 'task' => 'rename_user',
|
|
|
+ 'old_username' => $old_username,
|
|
|
+ 'new_username' => $new_username
|
|
|
+ );
|
|
|
+ docker('post', 'sogo-mailcow', 'exec', $exec_fields);
|
|
|
+
|
|
|
+ // create alias
|
|
|
+ if ($create_alias == 1) {
|
|
|
+ mailbox("add", "alias", array(
|
|
|
+ "address" => $old_username,
|
|
|
+ "goto" => $new_username,
|
|
|
+ "active" => 1,
|
|
|
+ "sogo_visible" => 1,
|
|
|
+ "private_comment" => sprintf($lang['success']['mailbox_renamed'], $old_username, $new_username)
|
|
|
+ ));
|
|
|
+ }
|
|
|
+
|
|
|
+ $_SESSION['return'][] = array(
|
|
|
+ 'type' => 'success',
|
|
|
+ 'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
|
|
|
+ 'msg' => array('mailbox_renamed', $old_username, $new_username)
|
|
|
+ );
|
|
|
+ break;
|
|
|
case 'mailbox_templates':
|
|
|
if ($_SESSION['mailcow_cc_role'] != "admin") {
|
|
|
$_SESSION['return'][] = array(
|
|
@@ -3235,11 +3375,11 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
// check name
|
|
|
if ($is_now["template"] == "Default" && $is_now["template"] != $_data["template"]){
|
|
|
// keep template name of Default template
|
|
|
- $_data["template"] = $is_now["template"];
|
|
|
+ $_data["template"] = $is_now["template"];
|
|
|
}
|
|
|
else {
|
|
|
- $_data["template"] = (isset($_data["template"])) ? $_data["template"] : $is_now["template"];
|
|
|
- }
|
|
|
+ $_data["template"] = (isset($_data["template"])) ? $_data["template"] : $is_now["template"];
|
|
|
+ }
|
|
|
// check attributes
|
|
|
$attr = array();
|
|
|
$attr["quota"] = isset($_data['quota']) ? intval($_data['quota']) * 1048576 : 0;
|
|
@@ -3259,11 +3399,11 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
$attr['pop3_access'] = (in_array('pop3', $_data['protocol_access'])) ? 1 : 0;
|
|
|
$attr['smtp_access'] = (in_array('smtp', $_data['protocol_access'])) ? 1 : 0;
|
|
|
$attr['sieve_access'] = (in_array('sieve', $_data['protocol_access'])) ? 1 : 0;
|
|
|
- }
|
|
|
- else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
foreach ($is_now as $key => $value){
|
|
|
$attr[$key] = $is_now[$key];
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
if (isset($_data['acl'])) {
|
|
|
$_data['acl'] = (array)$_data['acl'];
|
|
@@ -3282,10 +3422,10 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
$attr['acl_quarantine_category'] = (in_array('quarantine_category', $_data['acl'])) ? 1 : 0;
|
|
|
$attr['acl_app_passwds'] = (in_array('app_passwds', $_data['acl'])) ? 1 : 0;
|
|
|
$attr['acl_pw_reset'] = (in_array('pw_reset', $_data['acl'])) ? 1 : 0;
|
|
|
- } else {
|
|
|
+ } else {
|
|
|
foreach ($is_now as $key => $value){
|
|
|
$attr[$key] = $is_now[$key];
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -3297,7 +3437,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
":id" => $id ,
|
|
|
":template" => $_data["template"] ,
|
|
|
":attributes" => json_encode($attr)
|
|
|
- ));
|
|
|
+ ));
|
|
|
}
|
|
|
|
|
|
|
|
@@ -3326,7 +3466,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
);
|
|
|
continue;
|
|
|
}
|
|
|
- $is_now = mailbox('get', 'mailbox_details', $mailbox);
|
|
|
+ $is_now = mailbox('get', 'mailbox_details', $mailbox);
|
|
|
if(!empty($is_now)){
|
|
|
if (!hasDomainAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $is_now['domain'])) {
|
|
|
$_SESSION['return'][] = array(
|
|
@@ -3353,15 +3493,15 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
$stmt->execute(array(
|
|
|
":username" => $mailbox,
|
|
|
":custom_attributes" => json_encode($attributes)
|
|
|
- ));
|
|
|
-
|
|
|
+ ));
|
|
|
+
|
|
|
$_SESSION['return'][] = array(
|
|
|
'type' => 'success',
|
|
|
'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
|
|
|
'msg' => array('mailbox_modified', $mailbox)
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return true;
|
|
|
break;
|
|
|
case 'resource':
|
|
@@ -3443,7 +3583,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
);
|
|
|
}
|
|
|
break;
|
|
|
- case 'domain_wide_footer':
|
|
|
+ case 'domain_wide_footer':
|
|
|
if (!is_array($_data['domains'])) {
|
|
|
$domains = array();
|
|
|
$domains[] = $_data['domains'];
|
|
@@ -3696,7 +3836,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
|
|
|
// prepend domain to array
|
|
|
$params = array();
|
|
|
- foreach ($tags as $key => $val){
|
|
|
+ foreach ($tags as $key => $val){
|
|
|
array_push($params, '%'.$_data.'%');
|
|
|
array_push($params, '%'.$val.'%');
|
|
|
}
|
|
@@ -3705,7 +3845,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
|
|
|
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
while($row = array_shift($rows)) {
|
|
|
- if (hasDomainAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], explode('@', $row['username'])[1]))
|
|
|
+ if (hasDomainAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], explode('@', $row['username'])[1]))
|
|
|
$mailboxes[] = $row['username'];
|
|
|
}
|
|
|
}
|
|
@@ -4260,7 +4400,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
while($row = array_shift($rows)) {
|
|
|
if ($_SESSION['mailcow_cc_role'] == "admin")
|
|
|
$domains[] = $row['domain'];
|
|
|
- elseif (hasDomainAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $row['domain']))
|
|
|
+ elseif (hasDomainAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $row['domain']))
|
|
|
$domains[] = $row['domain'];
|
|
|
}
|
|
|
} else {
|
|
@@ -4420,19 +4560,19 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
}
|
|
|
$_data = (isset($_data)) ? intval($_data) : null;
|
|
|
|
|
|
- if (isset($_data)){
|
|
|
- $stmt = $pdo->prepare("SELECT * FROM `templates`
|
|
|
+ if (isset($_data)){
|
|
|
+ $stmt = $pdo->prepare("SELECT * FROM `templates`
|
|
|
WHERE `id` = :id AND type = :type");
|
|
|
$stmt->execute(array(
|
|
|
":id" => $_data,
|
|
|
":type" => "domain"
|
|
|
));
|
|
|
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
-
|
|
|
+
|
|
|
if (empty($row)){
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$row["attributes"] = json_decode($row["attributes"], true);
|
|
|
return $row;
|
|
|
}
|
|
@@ -4440,11 +4580,11 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
$stmt = $pdo->prepare("SELECT * FROM `templates` WHERE `type` = 'domain'");
|
|
|
$stmt->execute();
|
|
|
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
-
|
|
|
+
|
|
|
if (empty($rows)){
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
foreach($rows as $key => $row){
|
|
|
$rows[$key]["attributes"] = json_decode($row["attributes"], true);
|
|
|
}
|
|
@@ -4610,19 +4750,19 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
}
|
|
|
$_data = (isset($_data)) ? intval($_data) : null;
|
|
|
|
|
|
- if (isset($_data)){
|
|
|
- $stmt = $pdo->prepare("SELECT * FROM `templates`
|
|
|
+ if (isset($_data)){
|
|
|
+ $stmt = $pdo->prepare("SELECT * FROM `templates`
|
|
|
WHERE `id` = :id AND type = :type");
|
|
|
$stmt->execute(array(
|
|
|
":id" => $_data,
|
|
|
":type" => "mailbox"
|
|
|
));
|
|
|
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
-
|
|
|
+
|
|
|
if (empty($row)){
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$row["attributes"] = json_decode($row["attributes"], true);
|
|
|
return $row;
|
|
|
}
|
|
@@ -5064,7 +5204,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
$ids = $_data['ids'];
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
foreach ($ids as $id) {
|
|
|
// delete template
|
|
|
$stmt = $pdo->prepare("DELETE FROM `templates`
|
|
@@ -5377,7 +5517,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
);
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
update_sogo_static_view($username);
|
|
|
$_SESSION['return'][] = array(
|
|
|
'type' => 'success',
|
|
@@ -5404,7 +5544,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
$ids = $_data['ids'];
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
foreach ($ids as $id) {
|
|
|
// delete template
|
|
|
$stmt = $pdo->prepare("DELETE FROM `templates`
|
|
@@ -5413,7 +5553,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
":id" => $id,
|
|
|
":type" => "mailbox",
|
|
|
":template" => "Default"
|
|
|
- ));
|
|
|
+ ));
|
|
|
}
|
|
|
|
|
|
$_SESSION['return'][] = array(
|
|
@@ -5487,7 +5627,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
);
|
|
|
}
|
|
|
break;
|
|
|
- case 'tags_domain':
|
|
|
+ case 'tags_domain':
|
|
|
if (!is_array($_data['domain'])) {
|
|
|
$domains = array();
|
|
|
$domains[] = $_data['domain'];
|
|
@@ -5500,7 +5640,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
|
|
|
|
|
|
$wasModified = false;
|
|
|
- foreach ($domains as $domain) {
|
|
|
+ foreach ($domains as $domain) {
|
|
|
if (!is_valid_domain_name($domain)) {
|
|
|
$_SESSION['return'][] = array(
|
|
|
'type' => 'danger',
|
|
@@ -5517,7 +5657,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
);
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
foreach($tags as $tag){
|
|
|
// delete tag
|
|
|
$wasModified = true;
|
|
@@ -5572,7 +5712,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|
|
// delete tags
|
|
|
foreach($tags as $tag){
|
|
|
$wasModified = true;
|
|
|
-
|
|
|
+
|
|
|
$stmt = $pdo->prepare("DELETE FROM `tags_mailbox` WHERE `username` = :username AND `tag_name` = :tag_name");
|
|
|
$stmt->execute(array(
|
|
|
':username' => $username,
|