[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/admin/ -> email_queue.php (source)

   1  <?php
   2  # MantisBT - A PHP based bugtracking system
   3  
   4  # Mantis is free software: you can redistribute it and/or modify
   5  # it under the terms of the GNU General Public License as published by
   6  # the Free Software Foundation, either version 2 of the License, or
   7  # (at your option) any later version.
   8  #
   9  # Mantis is distributed in the hope that it will be useful,
  10  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  # GNU General Public License for more details.
  13  #
  14  # You should have received a copy of the GNU General Public License
  15  # along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * @package MantisBT
  19   * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
  20   * @copyright Copyright (C) 2002 - 2011  MantisBT Team   - mantisbt-dev@lists.sourceforge.net
  21   * @link http://www.mantisbt.org
  22   */
  23  /**
  24   * Mantis Core API's
  25   */
  26  require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' );
  27  
  28  access_ensure_global_level( config_get_global( 'admin_site_threshold' ) );
  29  
  30  $f_to = gpc_get( 'send', null );
  31  
  32  if ( $f_to !== null ) {
  33      if ( $f_to == 'all' ) {
  34          echo "Sending emails...<br />";
  35          email_send_all();
  36          echo "Done";
  37      } else if ( $f_to == 'sendordelall' ) {
  38          echo "Sending or deleting emails...<br />";
  39          email_send_all(true);
  40          echo "Done";
  41  
  42      } else {
  43          $t_email_data = email_queue_get( (int) $f_to );
  44  
  45          // check if email was found.  This can fail if another request picks up the email first and sends it.
  46          echo 'Sending email...<br />';
  47          if( $t_email_data !== false ) {
  48              if( !email_send( $t_email_data ) ) {
  49                  echo 'Email Not Sent - Deleting from queue<br />';
  50                  email_queue_delete( $t_email_data->email_id );
  51              } else {
  52                  echo 'Email Sent<br />';
  53              }
  54          } else {
  55              echo 'Email not found in queue<br />';
  56          }
  57      }
  58  }
  59  
  60  $t_ids = email_queue_get_ids();
  61  
  62  if( count( $t_ids ) > 0 ) {
  63  
  64      echo '<table><tr><th>' . lang_get('id') . '</th><th>' . lang_get('email') . '</th><th>' . lang_get('timestamp') . '</th><th>Send Or Delete</th></tr>';
  65      foreach( $t_ids as $t_id ) {
  66          $row = email_queue_get( $t_id );
  67  
  68          echo '<tr><td>' . $row->email_id . '</td><td>' . $row->email . '</td><td>' . $row->submitted . '</td><td>' , html_button( 'email_queue.php', 'Send Or Delete', array( 'send' => $row->email_id ) ) , '</td></tr>';
  69      }
  70      echo '</table>';
  71  } else {
  72  }
  73  
  74  html_button( 'email_queue.php', 'Send All', array( 'send' => 'all') );
  75  html_button( 'email_queue.php', 'Send Or Delete All', array( 'send' => 'sendordelall') );


Generated: Thu Jul 28 15:48:31 2011 Cross-referenced by PHPXref 0.7