+++ /dev/null
-<?php
-/************************************************************************
- * MXChange v0.2.1 Start: 02/12/2004 *
- * ================ Last change: 02/27/2004 *
- * *
- * -------------------------------------------------------------------- *
- * File : what-del_email.php *
- * -------------------------------------------------------------------- *
- * Short description : Delete a bonus or normal mail *
- * -------------------------------------------------------------------- *
- * Kurzbeschreibung : Bonus- / Normal-Mail loeschen *
- * -------------------------------------------------------------------- *
- * *
- * Module by Robert Niedziela, Megacomputing *
- * web : http://mc-p.mcserver.de *
- * *
- * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder *
- * For more information visit: http://www.mxchange.org *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
- * MA 02110-1301 USA *
- ************************************************************************/
-
-// Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
-{
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
- require($INC);
-}
-
-// Add description as navigation point
-ADD_DESCR("admin", basename(__FILE__));
-OPEN_TABLE("100%", "admin_content admin_content_align", "");
-if (!empty($_GET['mid']))
-{
- // Load email data
- $result = SQL_QUERY_ESC("SELECT id, sender, subject, url, timestamp FROM "._MYSQL_PREFIX."_pool WHERE id=%d LIMIT 1",
- array(bigintval($_GET['mid'])), __FILE__, __LINE__);
- list ($id, $sender, $subject, $url, $timestamp,) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
-
- // Delete mail only once
- if ($sender > 0)
- {
- // Prepare data for the template
- define('__ID' , $id);
- define('__SENDER' , ADMIN_USER_PROFILE_LINK($sender));
- define('__SUBJECT', $subject);
- define('__URL' , DEREFERER($url));
- define('__ORDERED', MAKE_DATETIME($timestamp, "0"));
-
- // Load template
- LOAD_TEMPLATE("admin_del_email_normal");
-
- // Transfer data to data array
- $DATA = array($url, $subject);
-
- // Load email template and send the email away
- $msg_user = LOAD_EMAIL_TEMPLATE("order-deleted", "", $sender);
- SEND_EMAIL($sender, MEMBER_ORDER_DELETED, $msg_user);
-
- // Delete mail from queue
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_pool WHERE id=%d LIMIT 1",
- array(bigintval($_GET['mid'])), __FILE__, __LINE__);
-
- // Fetch right stats_id from pool
- $result = SQL_QUERY_ESC("SELECT s.id FROM "._MYSQL_PREFIX."_user_stats AS s
-LEFT JOIN "._MYSQL_PREFIX."_pool AS p
-ON s.pool_id=%d LIMIT 1",
- array(bigintval($_GET['mid'])), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
- // Fetch stats id
- list($stats_id) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
-
- // Remove links from DB
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%d",
- array(bigintval($stats_id)), __FILE__, __LINE__);
-
- // Output link for manually removing stats entry
- LOAD_TEMPLATE ("admin_settings_saved", false, "<A href=\"".URL."/modules.php?module=admin&what=del_email&pid=".$_GET['mid']."\">".ADMIN_REMOVE_STATS_ENTRY."</A>");
- }
- }
- else
- {
- // Mail already deleted!
- LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_NORMAL_MAIL_ALREADY_DELETED);
- }
-}
- elseif (!empty($_GET['pid']))
-{
- // Remove stats entries
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_stats WHERE pool_id=%d LIMIT 1",
- array(bigintval($_GET['pid'])), __FILE__, __LINE__);
- LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_USER_STATS_REMOVED);
-}
- elseif ((!empty($_GET['bid'])) && (EXT_IS_ACTIVE("bonus")))
-{
- // Load data from bonus mail
- $result = SQL_QUERY_ESC("SELECT id, subject, url, timestamp FROM "._MYSQL_PREFIX."_bonus WHERE id=%d",
- array(bigintval($_GET['bid'])), __FILE__, __LINE__);
- list ($id, $subject, $url, $timestamp) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
-
- // Delete mail only once
- if ($id > 0)
- {
- // Delete bonus mail entirely from database
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_bonus WHERE id=%d LIMIT 1",
- array(bigintval($_GET['bid'])), __FILE__, __LINE__);
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE bonus_id=%d",
- array(bigintval($_GET['bid'])), __FILE__, __LINE__);
-
- // Prepare data for the template
- define('__ID' , $id);
- define('__SUBJECT', $subject);
- define('__URL' , DEREFERER($url));
- define('__ORDERED', MAKE_DATETIME($timestamp, "0"));
-
- // Load template
- LOAD_TEMPLATE("admin_del_email_bonus");
- }
- else
- {
- // Mail already deleted!
- LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_BONUS_MAIL_ALREADY_DELETED);
- }
-}
- else
-{
- // No mail orders fond
- LOAD_TEMPLATE ("admin_settings_saved", false, ADMIN_WRONG_CALL);
-}
-CLOSE_TABLE();
-//
-?>