- /******************************************************************************
- ** Gets the number of messages in the current mailbox.
- ******************************************************************************/
- function sqimap_get_num_messages ($imap_stream, $mailbox) {
- fputs ($imap_stream, sqimap_session_id() . " EXAMINE \"$mailbox\"\r\n");
- $read_ary = sqimap_read_data ($imap_stream, sqimap_session_id(), true, $result, $message);
- for ($i = 0; $i < count($read_ary); $i++) {
- if (ereg("[^ ]+ +([^ ]+) +EXISTS", $read_ary[$i], $regs)) {
- return $regs[1];
- }
- }
- return "BUG! Couldn't get number of messages in $mailbox!";
- }
-
-
- /******************************************************************************
- ** Returns a displayable email address
- ******************************************************************************/
- function sqimap_find_email ($string) {
- /** Luke Ehresman <lehresma@css.tayloru.edu>
- ** <lehresma@css.tayloru.edu>
- ** lehresma@css.tayloru.edu
- **
- ** What about
- ** lehresma@css.tayloru.edu (Luke Ehresman)
- **/
-
- if (ereg("<([^>]+)>", $string, $regs)) {
- $string = $regs[1];
- }
- return trim($string);
- }
-
-
- /******************************************************************************
- ** Takes the From: field, and creates a displayable name.
- ** Luke Ehresman <lkehresman@yahoo.com>
- ** becomes: Luke Ehresman
- ** <lkehresman@yahoo.com>
- ** becomes: lkehresman@yahoo.com
- ******************************************************************************/
- function sqimap_find_displayable_name ($string) {
- $string = ' '.trim($string);
- $orig_string = $string;
- if (strpos($string, '<') && strpos($string, '>')) {
- if (strpos($string, '<') == 1) {
+/*
+ * Gets the number of messages in the current mailbox.
+ */
+function sqimap_get_num_messages ($imap_stream, $mailbox) {
+
+ fputs ($imap_stream, sqimap_session_id() . " EXAMINE \"$mailbox\"\r\n");
+ $read_ary = sqimap_read_data ($imap_stream, sqimap_session_id(), true, $result, $message);
+ for ($i = 0; $i < count($read_ary); $i++) {
+ if (ereg("[^ ]+ +([^ ]+) +EXISTS", $read_ary[$i], $regs)) {
+ return $regs[1];
+ }
+ }
+ return sprintf( "BUG! Couldn't get number of messages in %s!", $mailbox );
+
+}
+
+
+/*
+* Returns a displayable email address
+*/
+function sqimap_find_email ($string) {
+ /** Luke Ehresman <lehresma@css.tayloru.edu>
+ ** <lehresma@css.tayloru.edu>
+ ** lehresma@css.tayloru.edu
+ **
+ ** What about
+ ** lehresma@css.tayloru.edu (Luke Ehresman)
+ **/
+
+ if (ereg("<([^>]+)>", $string, $regs)) {
+ $string = $regs[1];
+ }
+ return trim($string);
+}
+
+
+/*
+* Takes the From: field, and creates a displayable name.
+* Luke Ehresman <lkehresman@yahoo.com>
+* becomes: Luke Ehresman
+* <lkehresman@yahoo.com>
+* becomes: lkehresman@yahoo.com
+*/
+function sqimap_find_displayable_name ($string) {
+ $string = ' '.trim($string);
+ $orig_string = $string;
+ if (strpos($string, '<') && strpos($string, '>')) {
+ if (strpos($string, '<') == 1) {