2 /************************************************************************
3 * MXChange v0.2.1 Start: 09/28/2003 *
4 * =============== Last change: 04/09/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-edit_emails.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Edit ordered mails e.g. redirecting the URL *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Werbebuchungen aendern (z.B. umleiten der URL) *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * For more information visit: http://www.mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
28 * This program is distributed in the hope that it will be useful, *
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
31 * GNU General Public License for more details. *
33 * You should have received a copy of the GNU General Public License *
34 * along with this program; if not, write to the Free Software *
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
37 ************************************************************************/
39 // Some security stuff...
40 if ((!defined('__SECURITY')) || (!isAdmin())) {
44 // Add description as navigation point
45 addMenuDescription('admin', __FILE__);
47 if ((isFormSent()) && (!isPostRequestElementSet('id'))) {
48 unsetPostRequestElement('ok');
51 $result = SQL_QUERY("SELECT id, sender, subject, payment_id, cat_id FROM `{?_MYSQL_PREFIX?}_pool` ORDER BY timestamp", __FILE__, __LINE__);
52 if (SQL_NUMROWS($result) > 0) {
54 // Make mail editable...
55 $result = SQL_QUERY_ESC("SELECT subject, text, url FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s LIMIT 1",
56 array(bigintval(postRequestElement('id'))), __FILE__, __LINE__);
57 list($subj, $text, $url) = SQL_FETCHROW($result);
58 SQL_FREERESULT($result);
60 // Prepare constant for template
61 $content['id'] = bigintval(postRequestElement('id'));
62 $content['url'] = $url;
63 $content['subject'] = $subj;
64 $content['text'] = $text;
67 loadTemplate('admin_edit_email', false, $content);
68 } elseif (isPostRequestElementSet('save')) {
71 `{?_MYSQL_PREFIX?}_pool`
80 postRequestElement('subject'),
81 postRequestElement('text'),
82 postRequestElement('url'),
83 bigintval(postRequestElement('id')),
84 ), __FILE__, __LINE__);
86 if (SQL_AFFECTEDROWS() == 1) {
87 $content = getMessage('SETTINGS_SAVED');
89 $content = "<span class=\"admin_failed\">{--SETTINGS_NOT_SAVED--}</span>";
93 loadTemplate('admin_settings_saved', false, $content);
95 // There are mail orders available
97 while ($content = SQL_FETCHARRAY($result)) {
98 // Prepare data for the row template
101 'id' => $content['id'],
102 'subject' => $content['subject'],
103 'userid' => generateUserProfileLink($content['sender']),
104 'pay' => getPaymentTitlePrice($content['payment_id']),
105 'cat' => getCategory($content['cat_id']),
108 // Load row template and switch colors
109 $OUT .= loadTemplate('admin_edit_email_row', true, $content);
114 SQL_FREERESULT($result);
116 // Load email template
117 loadTemplate('admin_edit_email_select', false, $OUT);
120 // No mail orders left in pool
121 loadTemplate('admin_settings_saved', false, "<span class=\"admin_failed\">{--ADMIN_NO_MAILS_IN_POOL--}</span>");