2 /************************************************************************
\r
3 * MXChange v0.2.1 Start: 09/28/2003 *
\r
4 * =============== Last change: 04/09/2004 *
\r
6 * -------------------------------------------------------------------- *
\r
7 * File : what-edit_emails.php *
\r
8 * -------------------------------------------------------------------- *
\r
9 * Short description : Edit ordered mails e.g. redirecting the URL *
\r
10 * -------------------------------------------------------------------- *
\r
11 * Kurzbeschreibung : Werbebuchungen �ndern (z.B. umleiten der URL) *
\r
12 * -------------------------------------------------------------------- *
\r
14 * -------------------------------------------------------------------- *
\r
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
\r
16 * For more information visit: http://www.mxchange.org *
\r
18 * This program is free software; you can redistribute it and/or modify *
\r
19 * it under the terms of the GNU General Public License as published by *
\r
20 * the Free Software Foundation; either version 2 of the License, or *
\r
21 * (at your option) any later version. *
\r
23 * This program is distributed in the hope that it will be useful, *
\r
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
\r
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
\r
26 * GNU General Public License for more details. *
\r
28 * You should have received a copy of the GNU General Public License *
\r
29 * along with this program; if not, write to the Free Software *
\r
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
\r
31 * MA 02110-1301 USA *
\r
32 ************************************************************************/
\r
34 // Some security stuff...
\r
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
\r
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
\r
40 // Add description as navigation point
\r
41 ADD_DESCR("admin", basename(__FILE__));
\r
43 OPEN_TABLE("100%", "admin_content admin_content_align", "");
\r
46 if ((isset($_POST['ok'])) && (empty($_POST['id'])))
\r
48 unset($_POST['ok']);
\r
51 $result = SQL_QUERY("SELECT id, sender, subject, payment_id, cat_id FROM "._MYSQL_PREFIX."_pool ORDER BY timestamp", __FILE__, __LINE__);
\r
52 if (SQL_NUMROWS($result) > 0)
\r
54 if (isset($_POST['ok']))
\r
56 // Make mail editable...
\r
57 $result = SQL_QUERY_ESC("SELECT subject, text, url FROM "._MYSQL_PREFIX."_pool WHERE id=%d LIMIT 1",
\r
58 array(bigintval($_POST['id'])), __FILE__, __LINE__);
\r
59 list($subj, $text, $url) = SQL_FETCHROW($result);
\r
60 SQL_FREERESULT($result);
\r
61 define('__ID_VALUE' , $_POST['id']);
\r
62 define('__URL_VALUE' , stripslashes($url));
\r
63 define('__SUBJ_VALUE', stripslashes($subj));
\r
64 define('__TEXT_VALUE', stripslashes($text));
\r
67 LOAD_TEMPLATE("admin_edit_email");
\r
69 elseif (!empty($_POST['save']))
\r
74 $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_pool SET
\r
78 WHERE id=%d LIMIT 1",
\r
80 addslashes($_POST['subj']),
\r
81 addslashes($_POST['text']),
\r
82 addslashes($_POST['url']),
\r
83 bigintval($_POST['id']),
\r
84 ), __FILE__, __LINE__);
\r
85 if (SQL_AFFECTEDROWS($link, __FILE__, __LINE__) == 1)
\r
87 $content = "<SPAN class=\"admin_done\">".SETTINGS_SAVED."</SPAN>";
\r
91 $content = "<SPAN class=\"admin_failed\">".SETTINGS_NOT_SAVED."</SPAN>";
\r
96 $content = "<SPAN class=\"admin_failed\">".SETTINGS_NOT_SAVED."</SPAN>";
\r
100 LOAD_TEMPLATE("admin_settings_saved", false, $content);
\r
104 // There are mail orders available
\r
105 $SW = 2; $OUT = "";
\r
106 while (list($id, $sender, $subj, $pay, $cat) = SQL_FETCHROW($result))
\r
108 // Prepare data for the row template
\r
113 'uid' => ADMIN_USER_PROFILE_LINK($sender),
\r
114 'pay' => GET_PAYMENT($pay),
\r
115 'cat' => GET_CATEGORY($cat),
\r
118 // Load row template and switch colors
\r
119 $OUT .= LOAD_TEMPLATE("admin_edit_email_row", true, $content);
\r
124 SQL_FREERESULT($result);
\r
125 define('__EMAIL_SELECT_ROWS', $OUT);
\r
127 // Load email template
\r
128 LOAD_TEMPLATE("admin_edit_email_select");
\r
133 // No mail orders left in pool
\r
134 OUTPUT_HTML ("<SPAN class=\"admin_failed\">".ADMIN_NO_MAILS_IN_POOL."</SPAN>");
\r