-function sqimap_get_headerfield($imap_stream, $field) {
- global $uid_support;
- $sid = sqimap_session_id(false);
-
- $results = array();
- $read_list = array();
-
- $query = "FETCH 1:* (UID BODY.PEEK[HEADER.FIELDS ($field)])";
- $readin_list = sqimap_run_command_list ($imap_stream, $query, true, $response, $message, $uid_support);
- $i = 0;
-
- foreach ($readin_list as $r) {
- $r = implode('',$r);
- /* first we unfold the header */
- $r = str_replace(array("\r\n\t","\r\n\s"),array('',''),$r);
- /*
- * now we can make a new header array with each element representing
- * a headerline
- */
- $r = explode("\r\n" , $r);
- if (!$uid_support) {
- if (!preg_match("/^\\*\s+([0-9]+)\s+FETCH/iAU",$r[0], $regs)) {
- set_up_language($squirrelmail_language);
- echo '<br><b><font color=$color[2]>' .
- _("ERROR : Could not complete request.") .
- '</b><br>' .
- _("Unknown response from IMAP server: ") . ' 1.' .
- $r[0] . "</font><br>\n";
- } else {
- $id = $regs[1];
- }
- } else {
- if (!preg_match("/^\\*\s+([0-9]+)\s+FETCH.*UID\s+([0-9]+)\s+/iAU",$r[0], $regs)) {
- set_up_language($squirrelmail_language);
- echo '<br><b><font color=$color[2]>' .
- _("ERROR : Could not complete request.") .
- '</b><br>' .
- _("Unknown response from IMAP server: ") . ' 1.' .
- $r[0] . "</font><br>\n";
- } else {
- $id = $regs[2];
- }
- }
- $field = $r[1];
- $field = substr($field,strlen($field)+2);
- $result[] = array($id,$field);
- }
- return $result;
-}
-
-
-
-
-
-/*