summaryrefslogtreecommitdiff
path: root/program/steps/settings/save_identity.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-10-24 07:57:21 +0000
committeralecpl <alec@alec.pl>2008-10-24 07:57:21 +0000
commitec01712a998b35d48be3daaf272779fdbc63cd74 (patch)
tree397846eede8b3d52e55dcc33563b0bc47b0a2913 /program/steps/settings/save_identity.inc
parentd1a8d0f4c21136c9adc7efa02e3a37772bea222f (diff)
- Added option 'identities_level', removed 'multiple_identities'
- Allow deleting identities when multiple_identities=false (#1485435)
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
+?>