f004def6c3b6fa626401292792f1382d2a9718fe
[mailer.git] / inc / modules / admin / what-admins_contct.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 06/19/2004 *
4  * ================                             Last change: 06/19/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-admins_contct.php                          *
8  * -------------------------------------------------------------------- *
9  * Short description : Contact an admin through mail or message         *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Admin per Mail oder Nachricht kontaktieren       *
12  * -------------------------------------------------------------------- *
13  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
18  * This program is free software; you can redistribute it and/or modify *
19  * it under the terms of the GNU General Public License as published by *
20  * the Free Software Foundation; either version 2 of the License, or    *
21  * (at your option) any later version.                                  *
22  *                                                                      *
23  * This program is distributed in the hope that it will be useful,      *
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
26  * GNU General Public License for more details.                         *
27  *                                                                      *
28  * You should have received a copy of the GNU General Public License    *
29  * along with this program; if not, write to the Free Software          *
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
37         require($INC);
38 }
39
40 // Add description as navigation point
41 ADD_DESCR("admin", basename(__FILE__));
42
43 if ((isset($_POST['ok'])) && (!empty($_GET['admin']))) {
44         // Send mail or message
45         if ((EXT_IS_ACTIVE("msg")) && ($_POST['type'] == "msg")) {
46                 // Add message
47                 $msg = LOAD_EMAIL_TEMPLATE("admins_msg_contct_admin", $_POST['text'], "0");
48                 SEND_ADMIN_MESSAGE($_GET['admin'], ADMINS_MSG_FROM_ADMIN, $msg);
49         } else {
50                 // Load admin's email address
51                 $email = GET_ADMIN_EMAIL(GET_ADMIN_LOGIN(bigintval($_GET['admin'])));
52
53                 // Load email template and send the mail to the admin
54                 $msg = LOAD_EMAIL_TEMPLATE("admins_mail_contct_admin", $_POST['text'], "0");
55                 SEND_EMAIL($email, ADMINS_MSG_FROM_ADMIN, $msg);
56         }
57
58         // Mail / message dropped
59         LOAD_TEMPLATE("admin_settings_saved", false, ADMINS_ADMIN_CONTACTED);
60 } elseif (!empty($_GET['admin'])) {
61         // Load contact form template
62         define('__ADMIN', $_GET['admin']);
63         if (EXT_IS_ACTIVE("msg")) {
64                 // Add option to select between mail and message
65                 define('ADMINS_MESSAGING_SELECTION', LOAD_TEMPLATE("admin_admins_contct_select", true));
66         } else {
67                 // Outout hidden input
68                 define('ADMINS_MESSAGING_SELECTION', LOAD_TEMPLATE("admin_admins_contct_default", true));
69         }
70         LOAD_TEMPLATE("admin_admins_contct_form");
71 } else {
72         // Please select an admin!
73         LOAD_TEMPLATE("admin_settings_saved", false, ADMINS_SELECT_ADMIN);
74 }
75
76 //
77 ?>