summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/mail/func.inc53
-rw-r--r--program/steps/mail/list.inc24
-rw-r--r--program/steps/mail/sendmail.inc11
-rw-r--r--program/steps/settings/func.inc9
-rw-r--r--program/steps/settings/save_prefs.inc1
5 files changed, 82 insertions, 16 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 418c52b0a..a6f8b3f94 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -528,6 +528,36 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE)
}
+// return code for search function
+function rcmail_search_form($attrib)
+ {
+ global $OUTPUT, $JS_OBJECT_NAME;
+
+ // add some labels to client
+ rcube_add_label('searching');
+
+ $attrib['name'] = '_q';
+
+ if (empty($attrib['id']))
+ $attrib['id'] = 'rcmqsearchbox';
+
+ $input_q = new textfield($attrib);
+ $out = $input_q->show();
+
+ $OUTPUT->add_script(sprintf("%s.gui_object('qsearchbox', '%s');",
+ $JS_OBJECT_NAME,
+ $attrib['id']));
+
+ // add form tag around text field
+ if (empty($attrib['form']))
+ $out = sprintf('<form name="rcmqsearchform" action="./" '.
+ 'onsubmit="%s.command(\'search\');return false" style="display:inline;">%s</form>',
+ $JS_OBJECT_NAME,
+ $out);
+
+ return $out;
+ }
+
function rcmail_messagecount_display($attrib)
{
@@ -536,7 +566,9 @@ function rcmail_messagecount_display($attrib)
if (!$attrib['id'])
$attrib['id'] = 'rcmcountdisplay';
- $OUTPUT->add_script(sprintf("%s.gui_object('countdisplay', '%s');", $JS_OBJECT_NAME, $attrib['id']));
+ $OUTPUT->add_script(sprintf("%s.gui_object('countdisplay', '%s');",
+ $JS_OBJECT_NAME,
+ $attrib['id']));
// allow the following attributes to be added to the <span> tag
$attrib_str = create_attrib_string($attrib, array('style', 'class', 'id'));
@@ -560,16 +592,20 @@ function rcmail_quota_display($attrib)
// allow the following attributes to be added to the <span> tag
$attrib_str = create_attrib_string($attrib, array('style', 'class', 'id'));
-
+
+ if (!$IMAP->get_capability('QUOTA'))
+ $quota_text = rcube_label('unknown');
+ else if (!($quota_text = $IMAP->get_quota()))
+ $quota_text = rcube_label('unlimited');
$out = '<span' . $attrib_str . '>';
- $out .= $IMAP->get_quota();
+ $out .= $quota_text;
$out .= '</span>';
return $out;
}
-function rcmail_get_messagecount_text()
+function rcmail_get_messagecount_text($count=NULL, $page=NULL)
{
global $IMAP, $MESSAGE;
@@ -577,11 +613,14 @@ function rcmail_get_messagecount_text()
{
return rcube_label(array('name' => 'messagenrof',
'vars' => array('nr' => $MESSAGE['index']+1,
- 'count' => $IMAP->messagecount())));
+ 'count' => $count!==NULL ? $count : $IMAP->messagecount())));
}
- $start_msg = ($IMAP->list_page-1) * $IMAP->page_size + 1;
- $max = $IMAP->messagecount();
+ if ($page===NULL)
+ $page = $IMAP->list_page;
+
+ $start_msg = ($page-1) * $IMAP->page_size + 1;
+ $max = $count!==NULL ? $count : $IMAP->messagecount();
if ($max==0)
$out = rcube_label('mailboxempty');
diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc
index 391c05b73..40cd652df 100644
--- a/program/steps/mail/list.inc
+++ b/program/steps/mail/list.inc
@@ -22,8 +22,6 @@
$REMOTE_REQUEST = TRUE;
$OUTPUT_TYPE = 'js';
-$unseen = $IMAP->messagecount($mbox, 'UNSEEN', !empty($_GET['_refresh']) ? TRUE : FALSE);
-$count = $IMAP->messagecount();
$sort = isset($_GET['_sort']) ? $_GET['_sort'] : false;
// is there a sort type for this request?
@@ -37,13 +35,28 @@ if ($sort)
$_SESSION['sort_order'] = $sort_order;
}
else
- {
+ {
// use session settings if set, defaults if not
$sort_col = isset($_SESSION['sort_col']) ? $_SESSION['sort_col'] : $CONFIG['message_sort_col'];
$sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order'];
}
+// we have a saved search request
+if (!empty($_GET['_search']) && isset($_SESSION['search'][$_GET['_search']]))
+ {
+ $a_msgs = split(',', $_SESSION['search'][$_GET['_search']]);
+ $a_headers = $IMAP->list_header_set($mbox, $a_msgs, NULL, $sort_col, $sort_order);
+ $count = count($a_msgs);
+ }
+else
+ {
+ if ($count = $IMAP->messagecount())
+ $a_headers = $IMAP->list_headers($mbox, NULL, $sort_col, $sort_order);
+ }
+
+$unseen = $IMAP->messagecount($mbox, 'UNSEEN', !empty($_GET['_refresh']) ? TRUE : FALSE);
+
// update message count display
$pages = ceil($count/$IMAP->page_size);
$commands = sprintf("this.set_env('messagecount', %d);\n", $count);
@@ -56,11 +69,8 @@ $commands .= sprintf("this.set_unread_count('%s', %d);\n", addslashes($mbox), $u
// add message rows
-if ($count)
- {
- $a_headers = $IMAP->list_headers($mbox, null, $sort_col, $sort_order);
+if (isset($a_headers) && count($a_headers))
$commands .= rcmail_js_message_list($a_headers);
- }
// send response
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 70baba039..33f023de1 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -159,9 +159,16 @@ if (!empty($CONFIG['generic_message_footer']))
}
}
-
+// try to autodetect operating system and use the correct line endings
// use the configured delimiter for headers
-$header_delm = $CONFIG['mail_header_delimiter'] ? $CONFIG['mail_header_delimiter'] : "\r\n";
+if (!empty($CONFIG['mail_header_delimiter']))
+ $header_delm = $CONFIG['mail_header_delimiter'];
+else if (strtolower(substr(PHP_OS, 0, 3)=='win'))
+ $header_delm = "\r\n";
+else if (strtolower(substr(PHP_OS, 0, 3)=='mac'))
+ $header_delm = "\r\n";
+else
+ $header_delm = "\n";
// create PEAR::Mail_mime instance
$MAIL_MIME = new Mail_mime($header_delm);
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index ccc7871cc..a22ac9ae6 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -78,6 +78,7 @@ function rcmail_user_prefs_form($attrib)
$select_timezone->add('(GMT -5:00) Eastern Time (US/Canada), Bogota, Lima', '-5');
$select_timezone->add('(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz', '-4');
$select_timezone->add('(GMT -3:00) Brazil, Buenos Aires, Georgetown', '-3');
+ $select_timezone->add('(GMT -3:30) Nfld Time (Canada), Nfld, S. Labador', '-3.5');
$select_timezone->add('(GMT -2:00) Mid-Atlantic', '-2');
$select_timezone->add('(GMT -1:00) Azores, Cape Verde Islands', '-1');
$select_timezone->add('(GMT) Western Europe, London, Lisbon, Casablanca', '0');
@@ -108,6 +109,14 @@ function rcmail_user_prefs_form($attrib)
$select_timezone->show($CONFIG['timezone']));
+ $field_id = 'rcmfd_dst';
+ $input_dst = new checkbox(array('name' => '_dst_active', 'id' => $field_id, 'value' => 1));
+ $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n",
+ $field_id,
+ rep_specialchars_output(rcube_label('dstactive')),
+ $input_dst->show($CONFIG['dst_active']));
+
+
// show page size selection
$field_id = 'rcmfd_pgsize';
$input_pagesize = new textfield(array('name' => '_pagesize', 'id' => $field_id, 'size' => 5));
diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc
index d78acbdb4..81ffbe80a 100644
--- a/program/steps/settings/save_prefs.inc
+++ b/program/steps/settings/save_prefs.inc
@@ -25,6 +25,7 @@ if (!is_array($a_user_prefs))
$a_user_prefs['timezone'] = isset($_POST['_timezone']) ? floatval($_POST['_timezone']) : $CONFIG['timezone'];
+$a_user_prefs['dst_active'] = isset($_POST['_dst_active']) ? TRUE : FALSE;
$a_user_prefs['pagesize'] = is_numeric($_POST['_pagesize']) ? (int)$_POST['_pagesize'] : $CONFIG['pagesize'];
$a_user_prefs['prefer_html'] = isset($_POST['_prefer_html']) ? TRUE : FALSE;