| | |
| | | |
| | | */ |
| | | |
| | | $a_save_cols = array('name', 'email', 'organization', 'reply-to', 'bcc', 'standard', 'signature'); |
| | | |
| | | $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'); |
| | | |
| | | // check input |
| | | if (empty($_POST['_name']) || empty($_POST['_email'])) |
| | |
| | | |
| | | $a_write_sql[] = sprintf("%s=%s", |
| | | $DB->quoteIdentifier($col), |
| | | $DB->quote(rcube_charset_convert(strip_tags($_POST[$fname]), $OUTPUT->get_charset()))); |
| | | $DB->quote(get_input_value($fname, RCUBE_INPUT_POST, in_array($col, $a_html_cols)))); |
| | | } |
| | | |
| | | // set "off" values for checkboxes that were not checked, and therefore |
| | | // not included in the POST body. |
| | | foreach ($a_boolean_cols as $col) |
| | | { |
| | | $fname = '_' . $col; |
| | | if (!isset($_POST[$fname])) |
| | | { |
| | | $a_write_sql[] = sprintf("%s=0", $DB->quoteIdentifier($col)); |
| | | } |
| | | } |
| | | |
| | | if (sizeof($a_write_sql)) |
| | |
| | | WHERE identity_id=? |
| | | AND user_id=? |
| | | AND del<>1", |
| | | $_POST['_iid'], |
| | | get_input_value('_iid', RCUBE_INPUT_POST), |
| | | $_SESSION['user_id']); |
| | | |
| | | $updated = $DB->affected_rows(); |
| | |
| | | show_message('successfullysaved', 'confirmation'); |
| | | |
| | | // mark all other identities as 'not-default' |
| | | $DB->query("UPDATE ".get_table_name('identities')." |
| | | SET ".$DB->quoteIdentifier('standard')."='0' |
| | | WHERE user_id=? |
| | | AND identity_id<>? |
| | | AND del<>1", |
| | | $_SESSION['user_id'], |
| | | $_POST['_iid']); |
| | | if (!empty($_POST['_standard'])) |
| | | $DB->query("UPDATE ".get_table_name('identities')." |
| | | SET ".$DB->quoteIdentifier('standard')."='0' |
| | | WHERE user_id=? |
| | | AND identity_id<>? |
| | | AND del<>1", |
| | | $_SESSION['user_id'], |
| | | get_input_value('_iid', RCUBE_INPUT_POST)); |
| | | |
| | | if ($_POST['_framed']) |
| | | { |
| | |
| | | // ... |
| | | } |
| | | } |
| | | else |
| | | else if ($DB->is_error()) |
| | | { |
| | | // show error message |
| | | show_message('errorsaving', 'error'); |
| | |
| | | continue; |
| | | |
| | | $a_insert_cols[] = $DB->quoteIdentifier($col); |
| | | $a_insert_values[] = $DB->quote(rcube_charset_convert(strip_tags($_POST[$fname]), $OUTPUT->get_charset())); |
| | | $a_insert_values[] = $DB->quote(get_input_value($fname, RCUBE_INPUT_POST, in_array($col, $a_html_cols))); |
| | | } |
| | | |
| | | if (sizeof($a_insert_cols)) |