Changeset 1487

Show
Ignore:
Timestamp:
07/27/04 15:04:37 (4 years ago)
Author:
rboren
Message:

More wp-mail timezone and delimiter fixes from Kitten.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-mail.php

    r1484 r1487  
    77 
    88$time_difference = get_settings('gmt_offset') * 3600; 
     9 
     10$phone_delim = get_settings('use_phoneemail'); 
     11if (empty($phone_delim)) $phone_delim = '::'; 
    912 
    1013$pop3 = new POP3(); 
     
    6063                  $subject = wp_iso_descrambler($subject); 
    6164                } 
    62                 // Captures any text in the subject before :: as the subject 
    63                 $subject = explode('::', $subject); 
     65                // Captures any text in the subject before $phone_delim as the subject 
     66                $subject = explode($phone_delim, $subject); 
    6467                $subject = $subject[0]; 
    65  
    6668            } 
    6769            if (preg_match('/Date: /i', $line)) { // of the form '20 Mar 2002 20:32:37' 
     
    8183                $ddate_d = $date_arr[0]; 
    8284                $ddate_Y = $date_arr[2]; 
    83  
    8485                for ($j=0; $j<12; $j++) { 
    8586                    if ($ddate_m == $dmonths[$j]) { 
     
    8990 
    9091                $time_zn = intval($date_arr[4]) * 36; 
    91                 if ( $time_zn < 0 ) { 
    92                     if (abs($time_difference) > abs($time_zn)) { 
    93                         $time_zn = abs($time_difference) - abs($time_zn); 
    94                     } else { 
    95                         $time_zn = abs($time_zn) - abs($time_difference); 
    96                     } 
    97                 } else { 
    98                     $time_zn = abs($time_zn) + abs($time_difference); 
    99                 } 
    100  
    101                 $ddate_U = mktime($ddate_H, $ddate_i, $ddate_s, $ddate_m, $ddate_d, $ddate_Y); 
     92                $ddate_U = gmmktime($ddate_H, $ddate_i, $ddate_s, $ddate_m, $ddate_d, $ddate_Y); 
    10293                $ddate_U = $ddate_U - $time_zn; 
    10394                $post_date = gmdate('Y-m-d H:i:s', $ddate_U + $time_difference); 
     
    116107    } 
    117108    $content = trim($content); 
    118     // Captures any text in the body after :: as the body 
    119     $content = explode('::', $content); 
    120     $content = $content[1]; 
     109    // Captures any text in the body after $phone_delim as the body 
     110    $content = explode($phone_delim, $content); 
     111    $content[1] ? $content = $content[1] : $content = $content[0]; 
    121112 
    122113    echo "<p><b>Content-type:</b> $content_type, <b>boundary:</b> $boundary</p>\n"; 
     
    138129    $content = preg_replace("|\n([^\n])|", " $1", $content); 
    139130    $content = addslashes(trim($content)); 
    140  
    141131 
    142132    $sql = "INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_name, post_modified, post_modified_gmt) VALUES (1, '$post_date', '$post_date_gmt', '$content', '$post_title', '$post_name', '$post_date', '$post_date_gmt')";