| | |
| | | |
| | | */ |
| | | |
| | | $a_save_cols = array('name', 'email', 'organization', 'reply-to', 'bcc', 'default'); |
| | | $a_save_cols = array('name', 'email', 'organization', 'reply-to', 'bcc', 'standard', 'signature'); |
| | | $a_html_cols = array('signature'); |
| | | |
| | | |
| | | // check input |
| | |
| | | if (!isset($_POST[$fname])) |
| | | continue; |
| | | |
| | | $a_write_sql[] = sprintf("%s=%s", $DB->quoteIdentifier($col), $DB->quote(strip_tags($_POST[$fname]))); |
| | | $a_write_sql[] = sprintf("%s=%s", |
| | | $DB->quoteIdentifier($col), |
| | | $DB->quote(get_input_value($fname, RCUBE_INPUT_POST, in_array($col, $a_html_cols)))); |
| | | } |
| | | |
| | | if (sizeof($a_write_sql)) |
| | |
| | | SET ".join(', ', $a_write_sql)." |
| | | WHERE identity_id=? |
| | | AND user_id=? |
| | | AND del<>'1'", |
| | | AND del<>1", |
| | | $_POST['_iid'], |
| | | $_SESSION['user_id']); |
| | | |
| | | $updated = $DB->affected_rows(); |
| | | } |
| | | |
| | | if ($updated) |
| | | if ($updated && !empty($_POST['_standard'])) |
| | | { |
| | | show_message('successfullysaved', 'confirmation'); |
| | | |
| | | // mark all other identities as 'not-default' |
| | | $DB->query("UPDATE ".get_table_name('identities')." |
| | | SET ".$DB->quoteIdentifier('default')."='0' |
| | | SET ".$DB->quoteIdentifier('standard')."='0' |
| | | WHERE user_id=? |
| | | AND identity_id<>? |
| | | AND del<>'1'", |
| | | AND del<>1", |
| | | $_SESSION['user_id'], |
| | | $_POST['_iid']); |
| | | |
| | |
| | | // ... |
| | | } |
| | | } |
| | | 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(strip_tags($_POST[$fname])); |
| | | $a_insert_values[] = $DB->quote(get_input_value($fname, RCUBE_INPUT_POST, in_array($col, $a_html_cols))); |
| | | } |
| | | |
| | | if (sizeof($a_insert_cols)) |
| | |
| | | (user_id, ".join(', ', $a_insert_cols).") |
| | | VALUES (?, ".join(', ', $a_insert_values).")", |
| | | $_SESSION['user_id']); |
| | | |
| | | $insert_id = $DB->insert_id(); |
| | | |
| | | $insert_id = $DB->insert_id(get_sequence_name('identities')); |
| | | } |
| | | |
| | | if ($insert_id) |