You are here

function mailmime_check_requirements in Mail MIME 7.2

Same name and namespace in other branches
  1. 8.2 mailmime.module \mailmime_check_requirements()
  2. 6.2 mailmime.module \mailmime_check_requirements()

Checks whether required files exist.

1 call to mailmime_check_requirements()
mailmime_init in ./mailmime.module
Implements hook_init().

File

./mailmime.module, line 73
Ensures that required files are available.

Code

function mailmime_check_requirements() {

  // Try including the files, then cleck for the classes.
  @(include_once 'Mail/mime.php');
  @(include_once 'Mail/mimeDecode.php');
  @(include_once 'Mail/mimePart.php');
  if (class_exists('Mail_Mime') && class_exists('Mail_mimeDecode') && class_exists('Mail_mimePart')) {
    if (!method_exists('Mail_mimePart', 'encodeHeader')) {
      drupal_set_message(t('Your version of <a href="@mimepart">!mimepart</a> is too old.  Please update to version 1.6.1 or later.', array(
        '@mimepart' => 'http://pear.php.net/package/Mail_Mime/docs/1.6.1/Mail_Mime/Mail_mimePart.html',
        '!mimepart' => 'Mail_mimePart',
      )), 'error');
      return FALSE;
    }
    return TRUE;
  }

  // One or more classes don't exist.  Try downloading them.
  if (module_exists('include')) {
    return mailmime_download_requirements();
  }
  return FALSE;
}