summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2005-12-03 16:54:12 +0000
committerthomascube <thomas@roundcube.net>2005-12-03 16:54:12 +0000
commit1cded85790206afe084e1baff371c543711b2b18 (patch)
treeb050fb89707e048df5f30f500faad792962a1e81 /program/steps
parent5bc8cb662fc3bcda9aa641b7a5e88c0b81dd63d6 (diff)
Re-design of caching (new database table added\!); some bugfixes; Postgres support
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/addressbook/delete.inc6
-rw-r--r--program/steps/addressbook/edit.inc2
-rw-r--r--program/steps/addressbook/func.inc6
-rw-r--r--program/steps/addressbook/list.inc4
-rw-r--r--program/steps/addressbook/save.inc12
-rw-r--r--program/steps/addressbook/show.inc2
-rw-r--r--program/steps/mail/addcontact.inc8
-rw-r--r--program/steps/mail/compose.inc182
-rw-r--r--program/steps/mail/func.inc121
-rw-r--r--program/steps/mail/sendmail.inc15
-rw-r--r--program/steps/settings/delete_identity.inc2
-rw-r--r--program/steps/settings/edit_identity.inc5
-rw-r--r--program/steps/settings/func.inc4
-rw-r--r--program/steps/settings/manage_folders.inc15
-rw-r--r--program/steps/settings/save_identity.inc12
15 files changed, 239 insertions, 157 deletions
diff --git a/program/steps/addressbook/delete.inc b/program/steps/addressbook/delete.inc
index a3fcefbf7..b95988d12 100644
--- a/program/steps/addressbook/delete.inc
+++ b/program/steps/addressbook/delete.inc
@@ -24,7 +24,7 @@ $REMOTE_REQUEST = TRUE;
if ($_GET['_cid'])
{
$DB->query("UPDATE ".get_table_name('contacts')."
- SET del='1'
+ SET del=1
WHERE user_id=?
AND contact_id IN (".$_GET['_cid'].")",
$_SESSION['user_id']);
@@ -40,7 +40,7 @@ if ($_GET['_cid'])
// count contacts for this user
$sql_result = $DB->query("SELECT COUNT(contact_id) AS rows
FROM ".get_table_name('contacts')."
- WHERE del<>'1'
+ WHERE del<>1
AND user_id=?",
$_SESSION['user_id']);
@@ -60,7 +60,7 @@ if ($_GET['_cid'])
// get contacts from DB
$sql_result = $DB->limitquery("SELECT * FROM ".get_table_name('contacts')."
- WHERE del<>'1'
+ WHERE del<>1
AND user_id=?
ORDER BY name",
$start_row,
diff --git a/program/steps/addressbook/edit.inc b/program/steps/addressbook/edit.inc
index feb794f4d..a129d0094 100644
--- a/program/steps/addressbook/edit.inc
+++ b/program/steps/addressbook/edit.inc
@@ -26,7 +26,7 @@ if (($_GET['_cid'] || $_POST['_cid']) && $_action=='edit')
$DB->query("SELECT * FROM ".get_table_name('contacts')."
WHERE contact_id=?
AND user_id=?
- AND del<>'1'",
+ AND del<>1",
$cid,
$_SESSION['user_id']);
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index 4cc79bad6..8065219b0 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -43,7 +43,7 @@ function rcmail_contacts_list($attrib)
// count contacts for this user
$sql_result = $DB->query("SELECT COUNT(contact_id) AS rows
FROM ".get_table_name('contacts')."
- WHERE del<>'1'
+ WHERE del<>1
AND user_id=?",
$_SESSION['user_id']);
@@ -56,7 +56,7 @@ function rcmail_contacts_list($attrib)
// get contacts from DB
$sql_result = $DB->limitquery("SELECT * FROM ".get_table_name('contacts')."
- WHERE del<>'1'
+ WHERE del<>1
AND user_id= ?
ORDER BY name",
$start_row,
@@ -173,7 +173,7 @@ function rcmail_get_rowcount_text($max=NULL)
if ($max===NULL)
{
$sql_result = $DB->query("SELECT 1 FROM ".get_table_name('contacts')."
- WHERE del<>'1'
+ WHERE del<>1
AND user_id=?",
$_SESSION['user_id']);
diff --git a/program/steps/addressbook/list.inc b/program/steps/addressbook/list.inc
index ecb634b6f..0aa4873b3 100644
--- a/program/steps/addressbook/list.inc
+++ b/program/steps/addressbook/list.inc
@@ -24,7 +24,7 @@ $REMOTE_REQUEST = TRUE;
// count contacts for this user
$sql_result = $DB->query("SELECT COUNT(contact_id) AS rows
FROM ".get_table_name('contacts')."
- WHERE del<>'1'
+ WHERE del<>1
AND user_id=?",
$_SESSION['user_id']);
@@ -40,7 +40,7 @@ $start_row = ($CONTACTS_LIST['page']-1) * $CONFIG['pagesize'];
// get contacts from DB
$sql_result = $DB->limitquery("SELECT * FROM ".get_table_name('contacts')."
- WHERE del<>'1'
+ WHERE del<>1
AND user_id=?
ORDER BY name",
$start_row,
diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc
index 2f54e435b..f5ba139b9 100644
--- a/program/steps/addressbook/save.inc
+++ b/program/steps/addressbook/save.inc
@@ -52,7 +52,7 @@ if ($_POST['_cid'])
SET changed=now(), ".join(', ', $a_write_sql)."
WHERE contact_id=?
AND user_id=?
- AND del<>'1'",
+ AND del<>1",
$_POST['_cid'],
$_SESSION['user_id']);
@@ -73,7 +73,7 @@ if ($_POST['_cid'])
$sql_result = $DB->query("SELECT * FROM ".get_table_name('contacts')."
WHERE contact_id=?
AND user_id=?
- AND del<>'1'",
+ AND del<>1",
$_POST['_cid'],
$_SESSION['user_id']);
@@ -109,7 +109,7 @@ else
$sql_result = $DB->query("SELECT 1 FROM ".get_table_name('contacts')."
WHERE user_id=?
AND email=?
- AND del<>'1'",
+ AND del<>1",
$_SESSION['user_id'],
$_POST['_email']);
@@ -134,11 +134,11 @@ else
if (sizeof($a_insert_cols))
{
$DB->query("INSERT INTO ".get_table_name('contacts')."
- (user_id, changed, ".join(', ', $a_insert_cols).")
- VALUES (?, now(), ".join(', ', $a_insert_values).")",
+ (user_id, changed, del, ".join(', ', $a_insert_cols).")
+ VALUES (?, now(), 0, ".join(', ', $a_insert_values).")",
$_SESSION['user_id']);
- $insert_id = $DB->insert_id();
+ $insert_id = $DB->insert_id(get_sequence_name('contacts'));
}
if ($insert_id)
diff --git a/program/steps/addressbook/show.inc b/program/steps/addressbook/show.inc
index 83db486cc..960ea1c45 100644
--- a/program/steps/addressbook/show.inc
+++ b/program/steps/addressbook/show.inc
@@ -26,7 +26,7 @@ if ($_GET['_cid'] || $_POST['_cid'])
$DB->query("SELECT * FROM ".get_table_name('contacts')."
WHERE contact_id=?
AND user_id=?
- AND del<>'1'",
+ AND del<>1",
$cid,
$_SESSION['user_id']);
diff --git a/program/steps/mail/addcontact.inc b/program/steps/mail/addcontact.inc
index ad1544e71..b1129ec9d 100644
--- a/program/steps/mail/addcontact.inc
+++ b/program/steps/mail/addcontact.inc
@@ -32,7 +32,7 @@ if ($_GET['_address'])
$sql_result = $DB->query("SELECT 1 FROM ".get_table_name('contacts')."
WHERE user_id=?
AND email=?
- AND del<>'1'",
+ AND del<>1",
$_SESSION['user_id'],$contact['mailto']);
// contact entry with this mail address exists
@@ -42,13 +42,13 @@ if ($_GET['_address'])
else if ($contact['mailto'])
{
$DB->query("INSERT INTO ".get_table_name('contacts')."
- (user_id, changed, name, email)
- VALUES (?, now(), ?, ?)",
+ (user_id, changed, del, name, email)
+ VALUES (?, now(), 0, ?, ?)",
$_SESSION['user_id'],
$contact['name'],
$contact['mailto']);
- $added = $DB->insert_id();
+ $added = $DB->insert_id(get_sequence_name('contacts'));
}
}
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 9509b492b..45f111263 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -88,50 +88,20 @@ function rcmail_compose_headers($attrib)
switch ($part)
{
case 'from':
- // pass the following attributes to the form class
- $field_attrib = array('name' => '_from');
- foreach ($attrib as $attr => $value)
- if (in_array($attr, array('id', 'class', 'style', 'size', 'tabindex')))
- $field_attrib[$attr] = $value;
-
- // get this user's identities
- $sql_result = $DB->query("SELECT identity_id, name, email
- FROM ".get_table_name('identities')." WHERE user_id=?
- AND del<>'1'
- ORDER BY ".$DB->quoteIdentifier('default')." DESC, name ASC",
- $_SESSION['user_id']);
-
- if ($DB->num_rows($sql_result))
- {
- $select_from = new select($field_attrib);
- while ($sql_arr = $DB->fetch_assoc($sql_result))
- $select_from->add(format_email_recipient($sql_arr['email'], $sql_arr['name']), $sql_arr['identity_id']);
-
- $out = $select_from->show($_POST['_from']);
- }
- else
- {
- $input_from = new textfield($field_attrib);
- $out = $input_from->show($_POST['_from']);
- }
-
- if ($form_start)
- $out = $form_start.$out;
-
- return $out;
-
+ return rcmail_compose_header_from($attrib);
case 'to':
$fname = '_to';
$header = 'to';
-
+
// we have contact id's as get parameters
- if (!empty($_GET['_to']) && preg_match('/[0-9]+,?/', $_GET['_to']))
+ if (!empty($_GET['_to']) && preg_match('/^([0-9]+,?)+$/', $_GET['_to']))
{
$a_recipients = array();
$sql_result = $DB->query("SELECT name, email
- FROM ".get_table_name('contacts')." WHERE user_id=?
- AND del<>'1'
+ FROM ".get_table_name('contacts')."
+ WHERE user_id=?
+ AND del<>1
AND contact_id IN (".$_GET['_to'].")",
$_SESSION['user_id']);
@@ -229,71 +199,91 @@ function rcmail_compose_headers($attrib)
}
-/*function rcube_compose_headers($attrib)
- {
- global $CONFIG, $OUTPUT;
-
- list($form_start, $form_end) = get_form_tags($attrib);
-
- // allow the following attributes to be added to the headers table
- $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'cellpadding', 'cellspacing', 'border'));
-
- $labels = array();
- $labels['from'] = rcube_label('from');
- $labels['to'] = rcube_label('to');
- $labels['cc'] = rcube_label('cc');
- $labels['bcc'] = rcube_label('bcc');
- $labels['replyto'] = rcube_label('replyto');
-
- $input_from = new textfield(array('name' => '_from', 'size' => 30));
- $input_to = new textfield(array('name' => '_to', 'size' => 30));
- $input_cc = new textfield(array('name' => '_cc', 'size' => 30));
- $input_bcc = new textfield(array('name' => '_bcc', 'size' => 30));
- $input_replyto = new textfield(array('name' => '_replyto', 'size' => 30));
-
- $fields = array();
- $fields['from'] = $input_from->show($_POST['_from']);
- $fields['to'] = $input_to->show($_POST['_to']);
- $fields['cc'] = $input_cc->show($_POST['_cc']);
- $fields['bcc'] = $input_bcc->show($_POST['_bcc']);
- $fields['replyto'] = $input_replyto->show($_POST['_replyto']);
-
-
- $out = <<<EOF
-$form_start
-<table$attrib_str><tr>
-
-<td class="title">$labels[from]</td>
-<td>$fields[from]</td>
-
-</tr><tr>
-
-<td class="title">$labels[to]</td>
-<td>$fields[to]</td>
-</tr><tr>
+function rcmail_compose_header_from($attrib)
+ {
+ global $IMAP, $REPLY_MESSAGE, $DB, $OUTPUT, $JS_OBJECT_NAME;
+
+ // pass the following attributes to the form class
+ $field_attrib = array('name' => '_from');
+ foreach ($attrib as $attr => $value)
+ if (in_array($attr, array('id', 'class', 'style', 'size', 'tabindex')))
+ $field_attrib[$attr] = $value;
+
+ // extract all recipients of the reply-message
+ $a_recipients = array();
+ if ($REPLY_MESSAGE && is_object($REPLY_MESSAGE['headers']))
+ {
+ $a_to = $IMAP->decode_address_list($REPLY_MESSAGE['headers']->to);
+ foreach ($a_to as $addr)
+ {
+ if (!empty($addr['mailto']))
+ $a_recipients[] = $addr['mailto'];
+ }
-<td class="title">$labels[cc]</td>
-<td>$fields[cc]</td>
+ if (!empty($REPLY_MESSAGE['headers']->cc))
+ {
+ $a_cc = $IMAP->decode_address_list($REPLY_MESSAGE['headers']->cc);
+ foreach ($a_cc as $addr)
+ {
+ if (!empty($addr['mailto']))
+ $a_recipients[] = $addr['mailto'];
+ }
+ }
+ }
-</tr><tr>
+ // get this user's identities
+ $sql_result = $DB->query("SELECT identity_id, name, email, signature
+ FROM ".get_table_name('identities')."
+ WHERE user_id=?
+ AND del<>1
+ ORDER BY ".$DB->quoteIdentifier('standard')." DESC, name ASC",
+ $_SESSION['user_id']);
+
+ if ($DB->num_rows($sql_result))
+ {
+ $from_id = 0;
+ $a_signatures = array();
+
+ $field_attrib['onchange'] = "$JS_OBJECT_NAME.change_identity(this)";
+ $select_from = new select($field_attrib);
+
+ while ($sql_arr = $DB->fetch_assoc($sql_result))
+ {
+ $select_from->add(format_email_recipient($sql_arr['email'], $sql_arr['name']), $sql_arr['identity_id']);
-<td class="title">$labels[bcc]</td>
-<td>$fields[bcc]</td>
+ // add signature to array
+ if (!empty($sql_arr['signature']))
+ $a_signatures[$sql_arr['identity_id']] = $sql_arr['signature'];
+
+ // set identity if it's one of the reply-message recipients
+ if (in_array($sql_arr['email'], $a_recipients))
+ $from_id = $sql_arr['identity_id'];
+ }
-</tr><tr>
+ // overwrite identity selection with post parameter
+ if (isset($_POST['_from']))
+ $from_id = $_POST['_from'];
-<td class="title">$labels[replyto]</td>
-<td>$fields[replyto]</td>
+ $out = $select_from->show($from_id);
+
-</tr></table>
-$form_end
-EOF;
+ // add signatures to client
+ $OUTPUT->add_script(sprintf("%s.set_env('signatures', %s);", $JS_OBJECT_NAME, array2js($a_signatures)));
+ }
+ else
+ {
+ $input_from = new textfield($field_attrib);
+ $out = $input_from->show($_POST['_from']);
+ }
+
+ if ($form_start)
+ $out = $form_start.$out;
- return $out;
+ return $out;
}
-*/
+
function rcmail_compose_body($attrib)
{
@@ -360,6 +350,14 @@ function rcmail_create_reply_body($body)
$pefix = sprintf("\n\n\nOn %s, %s wrote:\n",
$REPLY_MESSAGE['headers']->date,
$IMAP->decode_header($REPLY_MESSAGE['headers']->from));
+
+
+ // try to remove the signature
+ if ($sp = strrpos($body, '--'))
+ {
+ if ($body{$sp+3}==' ' || $body{$sp+3}=="\n" || $body{$sp+3}=="\r")
+ $body = substr($body, 0, $sp-1);
+ }
return $pefix.$body;
}
@@ -596,7 +594,7 @@ function rcmail_charset_pulldown($selected='ISO-8859-1')
$sql_result = $DB->query("SELECT name, email
FROM ".get_table_name('contacts')." WHERE user_id=?
- AND del<>'1'",$_SESSION['user_id']);
+ AND del<>1",$_SESSION['user_id']);
if ($DB->num_rows($sql_result))
{
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index ca72f7437..c81dd2fd2 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -305,26 +305,41 @@ function rcmail_message_list($attrib)
// make sort links
$sort = '';
- if (in_array($col, $a_sort_cols) && (!empty($attrib['sortdescbutton']) || !empty($attrib['sortascbutton'])))
+ if ($IMAP->get_capability('sort') && in_array($col, $a_sort_cols))
{
- $sort = '&nbsp;&nbsp;';
-
- // asc link
- if (!empty($attrib['sortascbutton']))
+ // have buttons configured
+ if (!empty($attrib['sortdescbutton']) || !empty($attrib['sortascbutton']))
{
- $sort .= rcube_button(array('command' => 'sort',
- 'prop' => $col.'_ASC',
- 'image' => $attrib['sortascbutton'],
- 'title' => 'sortasc'));
- }
+ $sort = '&nbsp;&nbsp;';
+
+ // asc link
+ if (!empty($attrib['sortascbutton']))
+ {
+ $sort .= rcube_button(array('command' => 'sort',
+ 'prop' => $col.'_ASC',
+ 'image' => $attrib['sortascbutton'],
+ 'align' => 'absmiddle',
+ 'title' => 'sortasc'));
+ }
- // desc link
- if (!empty($attrib['sortdescbutton']))
+ // desc link
+ if (!empty($attrib['sortdescbutton']))
+ {
+ $sort .= rcube_button(array('command' => 'sort',
+ 'prop' => $col.'_DESC',
+ 'image' => $attrib['sortdescbutton'],
+ 'align' => 'absmiddle',
+ 'title' => 'sortdesc'));
+ }
+ }
+ // just add a link tag to the header
+ else
{
- $sort .= rcube_button(array('command' => 'sort',
- 'prop' => $col.'_DESC',
- 'image' => $attrib['sortdescbutton'],
- 'title' => 'sortdesc'));
+ $col_name = sprintf('<a href="./#sort" onclick="return %s.command(\'sort\',\'%s\',this)" title="%s">%s</a>',
+ $JS_OBJECT_NAME,
+ $col,
+ rcube_label('sortby'),
+ $col_name);
}
}
@@ -1128,20 +1143,76 @@ function rcmail_first_text_part($message_parts)
// get source code of a specific message and cache it
function rcmail_message_source($uid)
{
- global $IMAP, $DB;
+ global $IMAP, $DB, $CONFIG;
+
+ // get message ID if uid is given
+ $cache_key = $IMAP->mailbox.'.msg';
+ $cached = $IMAP->get_cached_message($cache_key, $uid, FALSE);
+
+ // message is cached in database
+ if ($cached && !empty($cached->body))
+ return $cached->body;
+
+ if (!$cached)
+ $headers = $IMAP->get_headers($uid);
+ else
+ $headers = &$cached;
+
- // get message ID if uid is given
- $headers = $IMAP->get_headers($uid);
$message_id = $headers->messageID;
- // get cached message source
- $msg_source = rcube_read_cache($message_id);
+ $temp_dir = $CONFIG['temp_dir'].(!eregi('\/$', $CONFIG['temp_dir']) ? '/' : '');
+ $cache_dir = $temp_dir.$_SESSION['client_id'];
+ $cache_path = $cache_dir.'/'.$message_id;
+
+ // message is cached in temp dir
+ if (is_dir($cache_dir) && is_file($cache_path))
+ {
+ if ($fp = fopen($cache_path, 'r'))
+ {
+ $msg_source = fread($fp, filesize($cache_path));
+ fclose($fp);
+ return $msg_source;
+ }
+ }
+
+
+ // get message from server
+ $msg_source = $IMAP->get_raw_body($uid);
+
+ // let's cache the message body within the database
+ if ($CONFIG['enable_caching'] && $cached && ($CONFIG['db_max_length'] -300) > $headers->size)
+ {
+ $DB->query("UPDATE ".get_table_name('messages')."
+ SET body=?
+ WHERE user_id=?
+ AND cache_key=?
+ AND uid=?",
+ $msg_source,
+ $_SESSION['user_id'],
+ $cache_key,
+ $uid);
+
+ return $msg_source;
+ }
+
+
+ // create dir for caching
+ if (!is_dir($cache_dir))
+ $dir = mkdir($cache_dir);
+ else
+ $dir = true;
- // get message from server and cache it
- if (!$msg_source)
+ // attempt to write a file with the message body
+ if ($dir && ($fp = fopen($cache_path, 'w')))
+ {
+ fwrite($fp, $msg_source);
+ fclose($fp);
+ }
+ else
{
- $msg_source = $IMAP->get_raw_body($uid);
- rcube_write_cache($message_id, $msg_source, TRUE);
+ raise_error(array('code' => 403, 'type' => 'php', 'line' => __LINE__, 'file' => __FILE__,
+ 'message' => "Failed to write to temp dir"), TRUE, FALSE);
}
return $msg_source;
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 11fb559dd..8ec30b0a7 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -46,7 +46,7 @@ function rcmail_get_identity($id)
FROM ".get_table_name('identities')."
WHERE identity_id=?
AND user_id=?
- AND del<>'1'",
+ AND del<>1",
$id,$_SESSION['user_id']);
if ($DB->num_rows($sql_result))
@@ -78,8 +78,8 @@ if (empty($CHARSET))
$CHARSET = 'ISO-8859-1';
-$mailto_regexp = array('/,\s*[\r\n]+/', '/[\r\n]+/', '/,\s*$/m');
-$mailto_replace = array(' ', ', ', '');
+$mailto_regexp = array('/[,;]\s*[\r\n]+/', '/[\r\n]+/', '/[,;]\s*$/m');
+$mailto_replace = array(', ', ', ', '');
// repalce new lines and strip ending ', '
$mailto = preg_replace($mailto_regexp, $mailto_replace, stripslashes($_POST['_to']));
@@ -175,13 +175,16 @@ if (is_array($_FILES['_attachments']['tmp_name']))
foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath)
$MAIL_MIME->addAttachment($filepath, $files['type'][$i], $files['name'][$i], TRUE);
+
+$message_charset = isset($_POST['_charset']) ? $_POST['_charset'] : $CHARSET;
+
// encoding settings for mail composing
$message_param = array('text_encoding' => '7bit',
'html_encoding' => 'quoted-printable',
'head_encoding' => 'quoted-printable',
- 'head_charset' => $CHARSET,
- 'html_charset' => $CHARSET,
- 'text_charset' => $CHARSET);
+ 'head_charset' => $message_charset,
+ 'html_charset' => $message_charset,
+ 'text_charset' => $message_charset);
// compose message body and get headers
$msg_body = $MAIL_MIME->get($message_param);
diff --git a/program/steps/settings/delete_identity.inc b/program/steps/settings/delete_identity.inc
index 3bca860b3..b8f9f526c 100644
--- a/program/steps/settings/delete_identity.inc
+++ b/program/steps/settings/delete_identity.inc
@@ -24,7 +24,7 @@ $REMOTE_REQUEST = $_GET['_remote'] ? TRUE : FALSE;
if ($_GET['_iid'])
{
$DB->query("UPDATE ".get_table_name('identities')."
- SET del='1'
+ SET del=1
WHERE user_id=?
AND identity_id IN (".$_GET['_iid'].")",
$_SESSION['user_id']);
diff --git a/program/steps/settings/edit_identity.inc b/program/steps/settings/edit_identity.inc
index 6649c209a..07cd8fa02 100644
--- a/program/steps/settings/edit_identity.inc
+++ b/program/steps/settings/edit_identity.inc
@@ -25,7 +25,7 @@ if (($_GET['_iid'] || $_POST['_iid']) && $_action=='edit-identity')
$DB->query("SELECT * FROM ".get_table_name('identities')."
WHERE identity_id=?
AND user_id=?
- AND del<>'1'",
+ AND del<>1",
$id,
$_SESSION['user_id']);
@@ -63,7 +63,8 @@ function rcube_identity_form($attrib)
'organization' => array('type' => 'text'),
'reply-to' => array('type' => 'text', 'label' => 'replyto'),
'bcc' => array('type' => 'text'),
- 'default' => array('type' => 'checkbox', 'label' => 'setdefault'));
+ 'signature' => array('type' => 'textarea'),
+ 'standard' => array('type' => 'checkbox', 'label' => 'setdefault'));
// a specific part is requested
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index 01b692395..b33f8d434 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -146,9 +146,9 @@ function rcmail_identities_list($attrib)
// get contacts from DB
$sql_result = $DB->query("SELECT * FROM ".get_table_name('identities')."
- WHERE del<>'1'
+ WHERE del<>1
AND user_id=?
- ORDER BY ".$DB->quoteIdentifier('default')." DESC, name ASC",
+ ORDER BY standard DESC, name ASC",
$_SESSION['user_id']);
diff --git a/program/steps/settings/manage_folders.inc b/program/steps/settings/manage_folders.inc
index 04b2a461e..33d83dfff 100644
--- a/program/steps/settings/manage_folders.inc
+++ b/program/steps/settings/manage_folders.inc
@@ -69,10 +69,15 @@ else if ($_action=='create-folder')
else if ($_action=='delete-folder')
{
if (strlen($_GET['_mboxes']))
- $IMAP->delete_mailbox(explode(',', $_GET['_mboxes']));
+ $deleted = $IMAP->delete_mailbox(explode(',', $_GET['_mboxes']));
- if ($_GET['_remote'])
- rcube_remote_response('// deleted');
+ if ($_GET['_remote'] && $deleted)
+ rcube_remote_response(sprintf("this.remove_folder_row('%s')", rep_specialchars_output($_GET['_mboxes'], 'js')));
+ else if ($_GET['_remote'])
+ {
+ $commands = show_message('errorsaving', 'error');
+ rcube_remote_response($commands);
+ }
}
@@ -174,5 +179,9 @@ function rcube_create_folder_form($attrib)
}
+// add some labels to client
+rcube_add_label('deletefolderconfirm');
+
+
parse_template('managefolders');
?> \ No newline at end of file
diff --git a/program/steps/settings/save_identity.inc b/program/steps/settings/save_identity.inc
index 2e42987bf..dc61b7875 100644
--- a/program/steps/settings/save_identity.inc
+++ b/program/steps/settings/save_identity.inc
@@ -19,7 +19,7 @@
*/
-$a_save_cols = array('name', 'email', 'organization', 'reply-to', 'bcc', 'default');
+$a_save_cols = array('name', 'email', 'organization', 'reply-to', 'bcc', 'standard', 'signature');
// check input
@@ -51,7 +51,7 @@ if ($_POST['_iid'])
SET ".join(', ', $a_write_sql)."
WHERE identity_id=?
AND user_id=?
- AND del<>'1'",
+ AND del<>1",
$_POST['_iid'],
$_SESSION['user_id']);
@@ -64,10 +64,10 @@ if ($_POST['_iid'])
// 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']);
@@ -106,8 +106,8 @@ else
(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)