summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-11-28 09:03:27 +0000
committeralecpl <alec@alec.pl>2011-11-28 09:03:27 +0000
commit77449d011b2367a9f3d7bb179534aa09865aa26e (patch)
tree20a299715c627cecdc2f7247056dde120748c6a7 /program/steps
parent2a3e02769d2014038675a5d8ddf18d1dba87bf2f (diff)
- Applied fixes from trunk up to r5498
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/addressbook/func.inc2
-rw-r--r--program/steps/mail/search.inc20
2 files changed, 14 insertions, 8 deletions
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index 2f1fbb70f..cb5cc63dc 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -705,7 +705,7 @@ function rcmail_contact_photo($attrib)
$RCMAIL->output->set_env('photo_placeholder', $photo_img);
unset($attrib['placeholder']);
- if (strpos($record['photo'], 'http:') === 0)
+ if (preg_match('!^https?://!i', $record['photo']))
$photo_img = $record['photo'];
else if ($record['photo'])
$photo_img = $RCMAIL->url(array('_action' => 'photo', '_cid' => $record['ID'], '_source' => $SOURCE_ID));
diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc
index 2e7fd130c..593eac427 100644
--- a/program/steps/mail/search.inc
+++ b/program/steps/mail/search.inc
@@ -31,6 +31,7 @@ $str = get_input_value('_q', RCUBE_INPUT_GET, true);
$mbox = get_input_value('_mbox', RCUBE_INPUT_GET, true);
$filter = get_input_value('_filter', RCUBE_INPUT_GET);
$headers = get_input_value('_headers', RCUBE_INPUT_GET);
+$subject = array();
$search_request = md5($mbox.$filter.$str);
@@ -70,14 +71,19 @@ else if (preg_match("/^body:.*/i", $str))
list(,$srch) = explode(":", $str);
$subject['text'] = "TEXT";
}
-else if(trim($str))
+else if (strlen(trim($str)))
{
if ($headers) {
- foreach(explode(',', $headers) as $header)
- switch ($header) {
- case 'text': $subject['text'] = 'TEXT'; break;
- default: $subject[$header] = 'HEADER '.strtoupper($header);
+ foreach (explode(',', $headers) as $header) {
+ if ($header == 'text') {
+ // #1488208: get rid of other headers when searching by "TEXT"
+ $subject = array('text' => 'TEXT');
+ break;
}
+ else {
+ $subject[$header] = 'HEADER '.strtoupper($header);
+ }
+ }
// save search modifiers for the current folder to user prefs
$search_mods = $RCMAIL->config->get('search_mods', $SEARCH_MODS_DEFAULT);
@@ -89,9 +95,9 @@ else if(trim($str))
}
}
-$search = $srch ? trim($srch) : trim($str);
+$search = isset($srch) ? trim($srch) : trim($str);
-if ($subject) {
+if (!empty($subject)) {
$search_str .= str_repeat(' OR', count($subject)-1);
foreach ($subject as $sub)
$search_str .= sprintf(" %s {%d}\r\n%s", $sub, strlen($search), $search);