[20890] Fix search (not happy with non-ascii)
Sigurd Nes <[email protected]>
| Newsgroups | gmane.comp.web.phpgroupware.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision: 20890
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=20890
Author: sigurdne
Date: 2009-11-23 20:02:40 +0000 (Mon, 23 Nov 2009)
Log Message:
-----------
Fix search (not happy with non-ascii)
Modified Paths:
--------------
modules/email/trunk/inc/class.mail_msg_wrappers.inc.php
modules/email/trunk/inc/class.uisearch.inc.php
Modified: modules/email/trunk/inc/class.mail_msg_wrappers.inc.php
===================================================================
--- modules/email/trunk/inc/class.mail_msg_wrappers.inc.php 2009-11-23 18:53:35 UTC (rev 20889)
+++ modules/email/trunk/inc/class.mail_msg_wrappers.inc.php 2009-11-23 20:02:40 UTC (rev 20890)
@@ -1200,7 +1200,7 @@
@discussion Debug with flag "debug_wrapper_dcom_calls"
@access public
*/
- function phpgw_search($fldball='', $criteria='', $flags='', $display_error = true)
+ function phpgw_search($fldball='', $criteria='', $flags=0, $display_error = true)
{
if ($this->debug_wrapper_dcom_calls > 0) { $this->dbug->out('mail_msg(_wrappers): phpgw_search ('.__LINE__.'): ENTERING, $fldball ['.serialize($fldball).']; $criteria ['.$criteria.']; $flags['.serialize($flags).'] <br />'); }
$acctnum = (int)$fldball['acctnum'];
@@ -1224,7 +1224,7 @@
$fake_fldball['folder'] = $folder;
$this->ensure_stream_and_folder($fake_fldball, 'phpgw_search LINE '.__LINE__, $display_error);
$mailsvr_stream = $this->get_arg_value('mailsvr_stream', $acctnum);
-
+
// now we have the stream and the desired folder open
if ($this->debug_wrapper_dcom_calls > 0) { $this->dbug->out('mail_msg(_wrappers): phpgw_search ('.__LINE__.'): calling $GLOBALS[phpgw_dcom_'.$acctnum.']->dcom->i_search($mailsvr_stream['.$mailsvr_stream.'], $criteria['.$criteria.'],$flags['.serialize($flags).']) <br />'); }
$retval = $GLOBALS['phpgw_dcom_'.$acctnum]->dcom->i_search($mailsvr_stream,$criteria,$flags);
@@ -6019,4 +6019,3 @@
} // end class mail_msg_wrappers
-?>
Modified: modules/email/trunk/inc/class.uisearch.inc.php
===================================================================
--- modules/email/trunk/inc/class.uisearch.inc.php 2009-11-23 18:53:35 UTC (rev 20889)
+++ modules/email/trunk/inc/class.uisearch.inc.php 2009-11-23 20:02:40 UTC (rev 20890)
@@ -298,24 +298,24 @@
$jst->pparse('output', 'search_js');
# have to loop for selected folders
- for ($j=0;$j<count($GLOBALS['HTTP_POST_VARS']['folder_list']);$j++)
+ for ($j=0;$j<count($_POST['folder_list']);$j++)
{
$search_vars = array ();
$imap_search_str = '';
# Get folder to search in
- $search_vars['fldball']['folder'] = $GLOBALS['HTTP_POST_VARS']['folder_list'][$j];
+ $search_vars['fldball']['folder'] = $_POST['folder_list'][$j];
// REMEMBER what account we are searching
$search_vars['fldball']['acctnum'] = $GLOBALS['phpgw']->msg->get_acctnum();
# Get and process the textbox values
- $search_vars['str']['SUBJECT'] = trim($GLOBALS['HTTP_POST_VARS']['search_subject']);
- $search_vars['str']['BODY'] = trim($GLOBALS['HTTP_POST_VARS']['search_body']);
- $search_vars['str']['FROM'] = trim($GLOBALS['HTTP_POST_VARS']['search_from']);
- $search_vars['str']['TO'] = trim($GLOBALS['HTTP_POST_VARS']['search_to']);
- $search_vars['str']['CC'] = trim($GLOBALS['HTTP_POST_VARS']['search_cc']);
- $search_vars['str']['BCC'] = trim($GLOBALS['HTTP_POST_VARS']['search_bcc']);
- $search_vars['str']['KEYWORD'] = trim($GLOBALS['HTTP_POST_VARS']['search_keyword']);
+ $search_vars['str']['SUBJECT'] = trim($_POST['search_subject']);
+ $search_vars['str']['BODY'] = trim($_POST['search_body']);
+ $search_vars['str']['FROM'] = trim($_POST['search_from']);
+ $search_vars['str']['TO'] = trim($_POST['search_to']);
+ $search_vars['str']['CC'] = trim($_POST['search_cc']);
+ $search_vars['str']['BCC'] = trim($_POST['search_bcc']);
+ $search_vars['str']['KEYWORD'] = trim($_POST['search_keyword']);
while (list($name, $value) = each($search_vars['str']))
{
if ($value != '')
@@ -324,44 +324,44 @@
$imap_search_str .= "$name \"$value\" ";
}
}
-
+
# Process the flags
while (list($name, $value) = each($this->flags_array))
{
- if ($GLOBALS['HTTP_POST_VARS'][$name] == "on")
+ if ($_POST[$name] == "on")
{
- $imap_search_str .= strtoupper($value).' ';
+ $temp = explode('_', $name);
+ $imap_search_str .= strtoupper($temp[1]).' ';
}
}
reset($this->flags_array);
# Process dates
- if ($GLOBALS['HTTP_POST_VARS']['date_on'] == "on")
+ if ($_POST['date_on'] == "on")
{
- $imap_search_str .= "ON \"".$GLOBALS['HTTP_POST_VARS']['date_on_month'].'/';
- $imap_search_str .= $GLOBALS['HTTP_POST_VARS']['date_on_day'].'/';
- $imap_search_str .= $GLOBALS['HTTP_POST_VARS']['date_on_year'];
+ $imap_search_str .= "ON \"".$_POST['date_on_month'].'/';
+ $imap_search_str .= $_POST['date_on_day'].'/';
+ $imap_search_str .= $_POST['date_on_year'];
$imap_search_str .= '" ';
}
- if ($GLOBALS['HTTP_POST_VARS']['date_before'] == "on")
+ if ($_POST['date_before'] == "on")
{
- $imap_search_str .= "BEFORE \"".$GLOBALS['HTTP_POST_VARS']['date_before_month'].'/';
- $imap_search_str .= $GLOBALS['HTTP_POST_VARS']['date_before_day'].'/';
- $imap_search_str .= $GLOBALS['HTTP_POST_VARS']['date_before_year'];
+ $imap_search_str .= "BEFORE \"".$_POST['date_before_month'].'/';
+ $imap_search_str .= $_POST['date_before_day'].'/';
+ $imap_search_str .= $_POST['date_before_year'];
$imap_search_str .= '" ';
}
- if ($GLOBALS['HTTP_POST_VARS']['date_after'] == "on")
+ if ($_POST['date_after'] == "on")
{
- $imap_search_str .= "SINCE \"".$GLOBALS['HTTP_POST_VARS']['date_after_month'].'/';
- $imap_search_str .= $GLOBALS['HTTP_POST_VARS']['date_after_day'].'/';
- $imap_search_str .= $GLOBALS['HTTP_POST_VARS']['date_after_year'];
+ $imap_search_str .= "SINCE \"".$_POST['date_after_month'].'/';
+ $imap_search_str .= $_POST['date_after_day'].'/';
+ $imap_search_str .= $_POST['date_after_year'];
$imap_search_str .= '" ';
}
- $imap_search_str = rtrim($imap_search_str);
-
- $search_results = $GLOBALS['phpgw']->msg->phpgw_search($search_vars['fldball'], $imap_search_str, '');
-
+ $imap_search_str = rtrim($imap_search_str);
+ $search_results = $GLOBALS['phpgw']->msg->phpgw_search($search_vars['fldball'], $imap_search_str, 0);
+
if (is_array($search_results))
{
$num_msg = count($search_results);