b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (CVS HEAD) [ class tree: main ] [ index: main ] [ all elements ]

Procedural File: getmail.php

Source Location: /blogs/cron/getmail.php

Page Details

pop3-2-b2 mail to blog

modified for 2.4.1 by Stephan Knauss. Contact me by PM in http://forums.b2evolution.net/ (user stephankn) or send a mail to stephankn at users.sourceforge.net

Uses MIME E-mail message parser classes written by Manuel Lemos: http://www.phpclasses.org/browse/package/3169.html

This script can be called with a parameter "test" to specify what should be done and what level of debug output to generate:

  • level 0: default. Process everything, no debug output, no html (called by cronjob)
  • level 1: Test only connection to server, do not process messages
  • level 2: additionally process messages, but do not post
  • level 3: do everything with extended verbosity
Only messages for "level 0" should get marked for translation (using T_()).

b2evolution - http://b2evolution.net/ Released under GNU GPL License - http://b2evolution.net/about/license.html

Author:  tblue246: Tilman Blumenbach
Author:  Stephan Knauss
Version:  $Id: getmail.php,v 1.44 2010/02/08 17:50:51 efy-yury Exp $
Copyright:  (c)2003-2010 by Francois PLANQUE - http://fplanque.net/ This file built upon code from original b2 - http://cafelog.com/
Todo:  check different encodings. only tested with iso-8859-1
Todo:  tested and working with thunderbird (text, html, signed), yahoo mail (text, html), outlook webmail, K800i
Todo:  try more exotic email clients like mobile phones
Todo:  Allow the user to choose whether to upload attachments to the blog media folder or to his user root.
Filesource:  Source Code for this file
Includes
require_once (_main.inc.php) [line 41]
[ Top ]

require_once (dirname(__FILE__).'/../conf/_config.php') [line 40]

load b2evolution configuration

[ Top ]


Constants
ERROR  [line 84]

ERROR = 'red'

define colour constants for messages


[ Top ]

INFO  [line 81]

INFO = 'black'

define colour constants for messages


[ Top ]

SUCCESS  [line 82]

SUCCESS = 'green'

define colour constants for messages


[ Top ]

WARNING  [line 83]

WARNING = 'orange'

define colour constants for messages


[ Top ]


Globals
string   $content [line 76]

message content of current email that is going to be posted

Default value:  ''

[ Top ]

string   $post_date [line 69]

post date of current message

Default value:  ''

[ Top ]

string   $subject [line 62]

Subject of the current email message

Default value:  ''

[ Top ]


Functions
echo_message  [line 124]

void echo_message( string $strmessage, [string $color = ''], [integer $level = 0]  )

Print out a debugging message with optional HTML color added.

This function only outputs any additional HTML (colors,
) if $test is greater than 0.

Parameters:
string   $strmessage:  The message to print
string   $color:  optional colour so use
integer   $level:  optional level to limit output to that level

API Tags:
Global:  integer $test: The test level


[ Top ]
get_post_title  [line 394]

string get_post_title( string $content, string $alternate_title  )

look inside message to get title for posting.

The message could contain a xml-tag

  1. <title>sample title</title>
to specify a title for the posting. If not tag is found there could be a global $post_default_title containing a global default title. If none of these is found then the specified alternate title line is used.

Parameters:
string   $content:  message to search for title tag
string   $alternate_title:  use this string if no title tag is found

API Tags:
Return:  title of posting
See:  $post_default_title


[ Top ]
processAttachments  [line 309]

bool processAttachments( array $mailAttachments, string $mediadir, string $media_url, [bool $add_img_tags = true]  )

process attachments by saving into media directory and optionally creating image tag in post

Parameters:
array   $mailAttachments:  array containing path to attachment files
string   $mediadir:  path to media directory of blog as seen by file system
string   $media_url:  url to media directory as seen by user
bool   $add_img_tags:  should img tags be added (instead of adding a normal link)

API Tags:
Return:  true for sucessfull execution
Global:  bool 1: do we really post?
Global:  object global 2: b2evo settings
Global:  string $content$do_real_posting$Settings: message content that is optionally manipulated by adding image tags


[ Top ]
processHeader  [line 231]

bool processHeader( &$header, array $header  )

Process Header information like subject and date of a mail.

Parameters:
array   $header:  header as set by mime_parser_class::Analyze()
   &$header: 

API Tags:
Return:  true if valid subject prefix is detected
Global:  integer 3: The test level (read)
Global:  string $subject: The subject of the current message (write)
Global:  string $post_date$Settings: The post date of the current message (write)
Global:  object b2evo $test: settings (read)


[ Top ]
sys_get_temp_dir  [line 161]

string sys_get_temp_dir( )

Provide sys_get_temp_dir for older versions of PHP (< 5.2.1).

code posted on php.net by minghong at gmail dot com Based on http://www.phpit.net/article/creating-zip-tar-archives-dynamically-php/2/


API Tags:
Return:  path to system temporary directory


[ Top ]
tempdir  [line 207]

string tempdir( string $dir, [string $prefix = 'tmp'], [integer $mode = 0700]  )

Create a new directory with unique name.

This creates a new directory below the given path with the given prefix and a random number.

Parameters:
string   $dir:  base path to new directory
string   $prefix:  prefix random number with this
integer   $mode:  permissions to use

API Tags:
Return:  path to created directory


[ Top ]


Documentation generated on Sat, 06 Mar 2010 03:52:28 +0100 by phpDocumentor 1.4.2. This site is hosted and maintained by Daniel HAHLER (Contact).