[ Index ]

PHP Cross Reference of Eventum

title

Body

[close]

/manage/ -> check_email_settings.php (source)

   1  <?php
   2  /* vim: set expandtab tabstop=4 shiftwidth=4 encoding=utf-8: */
   3  // +----------------------------------------------------------------------+
   4  // | Eventum - Issue Tracking System                                      |
   5  // +----------------------------------------------------------------------+
   6  // | Copyright (c) 2003, 2004, 2005, 2006, 2007 MySQL AB                              |
   7  // |                                                                      |
   8  // | This program is free software; you can redistribute it and/or modify |
   9  // | it under the terms of the GNU General Public License as published by |
  10  // | the Free Software Foundation; either version 2 of the License, or    |
  11  // | (at your option) any later version.                                  |
  12  // |                                                                      |
  13  // | This program is distributed in the hope that it will be useful,      |
  14  // | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
  15  // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        |
  16  // | GNU General Public License for more details.                         |
  17  // |                                                                      |
  18  // | You should have received a copy of the GNU General Public License    |
  19  // | along with this program; if not, write to:                           |
  20  // |                                                                      |
  21  // | Free Software Foundation, Inc.                                       |
  22  // | 59 Temple Place - Suite 330                                          |
  23  // | Boston, MA 02111-1307, USA.                                          |
  24  // +----------------------------------------------------------------------+
  25  // | Authors: João Prado Maia <jpm@mysql.com>                             |
  26  // +----------------------------------------------------------------------+
  27  //
  28  // @(#) $Id: check_email_settings.php 3206 2007-01-24 20:24:35Z glen $
  29  //
  30  require_once(dirname(__FILE__) . "/../init.php");
  31  require_once (APP_INC_PATH . "class.template.php");
  32  require_once (APP_INC_PATH . "class.auth.php");
  33  require_once (APP_INC_PATH . "class.support.php");
  34  require_once (APP_INC_PATH . "db_access.php");
  35  error_reporting(0);
  36  @set_time_limit(0);
  37  
  38  $tpl = new Template_API();
  39  $tpl->setTemplate("get_emails.tpl.html");
  40  
  41  Auth::checkAuthentication(APP_COOKIE, NULL, true);
  42  
  43  $tpl->displayTemplate();
  44  flush();
  45  
  46  echo "<span class='default'>";
  47  
  48  // we need the IMAP extension for this to work
  49  if (!function_exists('imap_open')) {
  50      echo "<b>Error: Eventum requires the IMAP extension in order to connect to IMAP/POP3 servers.<br /><br />";
  51      echo "Please refer to the PHP manual for more details about how to enable the IMAP extension.</b>";
  52  } else {
  53      // check if the hostname is just an IP based one
  54      if ((!preg_match("/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/", $_POST["hostname"])) &&
  55              (gethostbyname($_POST["hostname"]) == $_POST["hostname"])) {
  56          echo "<b>The provided hostname could not be resolved. Please check your information and try again.</b>";
  57      } else {
  58          $account = array(
  59              "ema_hostname" => $_POST["hostname"],
  60              "ema_port"     => $_POST["port"],
  61              "ema_type"     => $_POST["type"],
  62              "ema_folder"   => $_POST["folder"],
  63              "ema_username" => $_POST["username"],
  64              "ema_password" => $_POST["password"]
  65          );
  66          $mbox = Support::connectEmailServer($account);
  67          if (!$mbox) {
  68              echo "<b>Could not connect to the server with the provided information.</b>";
  69          } else {
  70              echo "<b>Thank you, the connection to the email server was created successfully.</b>";
  71          }
  72      }
  73  }
  74  ?>
  75  
  76  <br /><br />
  77  <a class="link" href="javascript:window.close();">Close Window</a>
  78  
  79  </span>
  80  
  81  </body>
  82  </html>


Generated: Wed Dec 19 21:21:33 2007 Cross-referenced by PHPXref 0.7