summaryrefslogtreecommitdiff
path: root/program/steps/settings/save_identity.inc
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps/settings/save_identity.inc')
-rw-r--r--program/steps/settings/save_identity.inc17
1 files changed, 13 insertions, 4 deletions
diff --git a/program/steps/settings/save_identity.inc b/program/steps/settings/save_identity.inc
index e19a3317b..b34575dce 100644
--- a/program/steps/settings/save_identity.inc
+++ b/program/steps/settings/save_identity.inc
@@ -19,13 +19,15 @@
*/
+define('IDENTITIES_LEVEL', intval($RCMAIL->config->get('identities_level', 0)));
+
$a_save_cols = array('name', 'email', 'organization', 'reply-to', 'bcc', 'standard', 'signature', 'html_signature');
$a_html_cols = array('signature');
$a_boolean_cols = array('standard', 'html_signature');
$updated = $default_id = false;
// check input
-if (empty($_POST['_name']) || empty($_POST['_email']))
+if (empty($_POST['_name']) || (empty($_POST['_email']) && IDENTITIES_LEVEL != 1 && IDENTITIES_LEVEL != 3))
{
$OUTPUT->show_message('formincomplete', 'warning');
rcmail_overwrite_action('edit-identity');
@@ -50,6 +52,10 @@ foreach ($a_boolean_cols as $col)
$save_data[$col] = 0;
}
+// unset email address if user has no rights to change it
+if (IDENTITIES_LEVEL == 1 || IDENTITIES_LEVEL == 3)
+ unset($save_data['email']);
+
// update an existing contact
if ($_POST['_iid'])
@@ -77,9 +83,12 @@ if ($_POST['_iid'])
}
// insert a new identity record
-else if ($RCMAIL->config->get('multiple_identities', true))
+else if (IDENTITIES_LEVEL < 2)
{
- if ($insert_id = $USER->insert_identity($save_data))
+ if (IDENTITIES_LEVEL == 1)
+ $save_data['email'] = rcmail_get_email();
+
+ if ($save_data['email'] && ($insert_id = $USER->insert_identity($save_data)))
{
$OUTPUT->show_message('successfullysaved', 'confirmation');
@@ -107,4 +116,4 @@ if ($default_id)
// go to next step
rcmail_overwrite_action('identities');
-?> \ No newline at end of file
+?>