| | |
| | | return false; |
| | | } |
| | | do { |
| | | $line = $this->readLine(1024); |
| | | $line = $this->readLine(4096); |
| | | $line = $this->multLine($line); |
| | | |
| | | if (!$line) |
| | |
| | | if ($field == 'date' || $field == 'internaldate') { |
| | | $field = 'timestamp'; |
| | | } |
| | | |
| | | if (empty($flag)) { |
| | | $flag = 'ASC'; |
| | | } else { |
| | | $flag = strtoupper($flag); |
| | | } |
| | | |
| | | $stripArr = ($field=='subject') ? array('Re: ','Fwd: ','Fw: ','"') : array('"'); |
| | | |
| | | $c = count($a); |
| | | if ($c > 0) { |
| | | |
| | | // Strategy: |
| | | // First, we'll create an "index" array. |
| | | // Then, we'll use sort() on that array, |
| | |
| | | } else { |
| | | $data = $val->$field; |
| | | if (is_string($data)) { |
| | | $data = strtoupper(str_replace($stripArr, '', $data)); |
| | | $data = str_replace('"', '', $data); |
| | | if ($field == 'subject') { |
| | | $data = preg_replace('/^(Re: \s*|Fwd:\s*|Fw:\s*)+/i', '', $data); |
| | | } |
| | | $data = strtoupper($data); |
| | | } |
| | | } |
| | | $index[$key]=$data; |
| | | } |
| | | |
| | | // sort index |
| | | $i = 0; |
| | | if ($flag == 'ASC') { |
| | | asort($index); |
| | | } else { |
| | |
| | | reset($index); |
| | | while (list($key, $val) = each($index)) { |
| | | $result[$key]=$a[$key]; |
| | | $i++; |
| | | } |
| | | } |
| | | |