maillog:drupal_mail_wrapper -> maillog_mail_send * mimemail -> maillog_mailengine -> maillog_mail_send [-> ANY_engine] */ /** * Implementation of hook_permision(). */ function maillog_permission() { return array('view maillog' => array( 'title' => t('View Maillog'), 'description' => t('Allow users to view a list of recently logged mails.'), ), 'delete maillog' => array( 'title' => t('Delete Entries from the log'), 'description' => t('Allow users to delete logged mails.'), ), 'administer maillog' => array( 'title' => t('Administer Maillog'), 'description' => t('Allow users to change maillog seetings.'), ) ); } function maillog_maillog_delete($maillog) { $idmaillog = $maillog['idmaillog']; $result = db_query("DELETE FROM {maillog} WHERE idmaillog = :id", array(':id' => $idmaillog)); if ($result == FALSE) { drupal_set_message(t('A Problem occured when deleting Mail with idmaillog !idmaillog !', array('!idmaillog' => $idmaillog))); } else { drupal_set_message(t('Mail with idmaillog !idmaillog has been deleted!', array('!idmaillog' => $idmaillog))); } drupal_goto('admin/reports/maillog'); } /** * Implementation of hook_menu(). */ function maillog_menu() { $items = array(); $items['admin/config/development/maillog'] = array( 'title' => t('Maillog Settings'), 'description' => t('Configure the settings of Maillog module.'), 'page callback' => 'drupal_get_form', 'page arguments' => array('maillog_admin_settings'), 'access arguments' => array('administer maillog'), 'type' => MENU_NORMAL_ITEM, ); $items['maillog/delete/%maillog_maillog'] = array( 'title' => t("Delete Maillog from 'maillog' Table"), 'description' => t("Delete the Maillog with the idmaillog given by the parameter from 'maillog' Table"), 'page callback' => 'maillog_maillog_delete', 'page arguments' => array(2), 'access arguments' => array('delete maillog'), 'type' => MENU_CALLBACK, ); $items['maillog/details/%maillog_maillog'] = array( 'title callback' => 'maillog_maillog_title', 'title arguments' => array(2), 'description' => t("Delete the Maillog with the idmaillog given by the parameter from 'maillog' Table"), 'page callback' => 'maillog_maillog_page', 'page arguments' => array(2), 'access arguments' => array('view maillog'), 'type' => MENU_CALLBACK, ); return $items; } /** * */ function maillog_maillog_title($maillog) { return $maillog['subject']; } /** * */ function maillog_maillog_load($idmaillog) { $result = db_query("SELECT idmaillog, header_from, header_to, header_reply_to, header_all, subject, body FROM {maillog} WHERE idmaillog=:id", array( ':id' => $idmaillog, )); if ($result == FALSE) { $maillog = NULL; } else { $maillog = $result->fetchAssoc(); // unserialize values $maillog['header_all'] = unserialize($maillog['header_all']); } return $maillog; } /** * */ function maillog_maillog_page($maillog) { return theme('maillog', array('maillog' => $maillog)); } /** * Implementation of the module settings form. */ function maillog_admin_settings() { $form = array(); $form['maillog_send'] = array( '#type' => 'checkbox', '#title' => t("Allow the e-mails to be sent."), '#default_value' => variable_get('maillog_send', TRUE), ); $form['maillog_log'] = array( '#type' => 'checkbox', '#title' => t("Create table entries in maillog table for each e-mail."), '#default_value' => variable_get('maillog_log', TRUE), ); $form['maillog_devel'] = array( '#type' => 'checkbox', '#title' => t("Display the e-mails on page using devel module (if enabled)."), '#default_value' => variable_get('maillog_devel', TRUE), ); if (module_exists('mimemail')) { $engines = mimemail_get_engines(); // maillog will be unset, because ist would cause an recursion unset($engines['maillog']); $form['maillog_engine'] = array( '#type' => 'select', '#title' => t("Select the mailengine which should be used."), '#default_value' => variable_get('maillog_engine', 'mimemail'), '#options' => $engines, ); } return system_settings_form($form); } /** * Implementation of hook_views_api(). */ function maillog_views_api() { return array( 'api' => 3, 'path' => drupal_get_path('module', 'maillog') . '/includes/', ); } /** * Implementation of hook_theme(). */ function maillog_theme() { return array( 'maillog_header_from' => array( 'variables' => array('header_from' => NULL), ), 'maillog_header_to' => array( 'variables' => array('header_to' => NULL), ), 'maillog_header_reply_to' => array( 'variables' => array('header_reply_to' => NULL), ), 'maillog_header_all' => array( 'variables' => array('header_all' => NULL), ), 'maillog_body' => array( 'variables' => array('body' => NULL), ), 'maillog' => array( 'variables' => array('maillog' => NULL), ), ); } /** * Render the 'From' field in the node type 'Logged Mail' */ function theme_maillog_header_from($variables) { $output = ''; $output .= '
'; $output .= '
' . t('From') . ':
'; $output .= '
' . check_plain($variables['header_from']) . '
'; $output .= '
'; return $output; } /** * */ function theme_maillog($variables) { $output = theme( 'maillog_header_from', array('header_from' => $variables['maillog']['header_from']) ); $output .= theme( 'maillog_header_to', array('header_to' => $variables['maillog']['header_to']) ); $output .= theme( 'maillog_header_reply_to', array('header_reply_to' => $variables['maillog']['header_reply_to']) ); $output .= theme( 'maillog_header_all', array('header_all' => $variables['maillog']['header_all']) ); $output .= theme( 'maillog_body', array('body' => $variables['maillog']['body']) ); return $output; } /** * Render the 'To' field in the node type 'Logged Mail' */ function theme_maillog_header_to($variables) { $output = ''; $output .= '
'; $output .= '
' . t('To') . ':
'; $output .= '
' . check_plain($variables['header_to']) . '
'; $output .= '
'; return $output; } /** * Render the 'Reply-To' field in the node type 'Logged Mail' */ function theme_maillog_header_reply_to($variables) { $output = ''; $output .= '
'; $output .= '
' . t('Reply To') . ':
'; $output .= '
' . check_plain($variables['header_reply_to']) . '
'; $output .= '
'; return $output; } /** * Render the 'Header' field in the node type 'Logged Mail' */ function theme_maillog_header_all($variables) { $output = ''; $output .= '
'; $output .= '
' . t('Header') . ':
'; $output .= '
'; foreach ($variables['header_all'] as $header_all_name => $header_all_value) { $output .= '
'; $output .= check_plain($header_all_name) . ': ' . check_plain($header_all_value); $output .= '
'; } $output .= '
'; $output .= '
'; return $output; } /** * Render the 'Body' field in the node type 'Logged Mail' */ function theme_maillog_body($variables) { $output = ''; $output .= '
'; $output .= '
' . t('Body') . ':
'; $output .= '
'; $output .= '
';
  $output .= check_plain($variables['body']);
  $output .= '
'; $output .= '
'; $output .= '
'; return $output; }