2 /************************************************************************
3 * MXChange v0.2.1 Start: 09/28/2003 *
4 * =============== Last change: 10/29/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-email_details.php *
8 * -------------------------------------------------------------------- *
9 * Short description : See all email details of ordered mails *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Alle Details einer gebuchten Mail ansehen *
12 * -------------------------------------------------------------------- *
14 * -------------------------------------------------------------------- *
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
16 * For more information visit: http://www.mxchange.org *
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. *
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. *
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, *
32 * -------------------------------------------------------------------- *
33 * Moded What-email_details.php / also Editet ! *
34 * Auf langsammen Servern (wie mein z.B Dauert das Laden) *
35 * enorm hoch zu lang. Jetzt werden nur auftraege aufgelistet die *
36 * NEU sind ( DB NEW) oder ADMIN freischalten muss (DB ADMIN ) *
37 * oder noch als TEMP gespecihert sind *
38 * der rest der schon als SEND sich melden darf wird per *
39 * what-email_archiv .php aufgerufen *
40 * beste gruesse Robert Niedziela / www.personal-webserver.de *
41 * oder auch www.mc-p.org *
42 ************************************************************************/
44 // Some security stuff...
45 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
47 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
51 // Add description as navigation point
52 ADD_DESCR("admin", basename(__FILE__));
54 // Normal mails ordered by your members
55 // 0 1 2 3 4 5 6 7 8 9 10
56 $SQL = "SELECT id, sender, subject, text, receivers, payment_id, data_type, timestamp, url, target_send, cat_id
57 FROM "._MYSQL_PREFIX."_pool
58 WHERE data_type IN('ADMIN', 'TEMP', 'NEW', 'ACTIVE')
59 ORDER BY timestamp DESC";
63 if (!empty($_GET['mid']))
65 // Only a specific mail shall be displayed
66 // 0 1 2 3 4 5 6 7 8 9 10
67 $SQL = "SELECT id, sender, subject, text, receivers, payment_id, data_type, timestamp, url, target_send, cat_id
68 FROM "._MYSQL_PREFIX."_pool
69 WHERE id='".bigintval($_GET['mid'])."'
71 $WHO = MAIL_ID.": ".$_GET['mid'];
73 elseif (!empty($_GET['u_id']))
75 // All mails by a specific member shall be displayed
76 // 0 1 2 3 4 5 6 7 8 9 10
77 $SQL = "SELECT id, sender, subject, text, receivers, payment_id, data_type, timestamp, url, target_send, cat_id
78 FROM "._MYSQL_PREFIX."_pool
79 WHERE sender='".bigintval($_GET['u_id'])."'
80 ORDER by timestamp DESC";
81 $WHO = USER_ID.": ".$_GET['u_id'];
84 if ((EXT_IS_ACTIVE("bonus")) && ($WHO == _ALL))
86 // Bonus mails sent by you
87 // 0 1 2 3 4 5 6 7 8 9 10 11 12
88 $SQL2 = "SELECT id, subject, text, receivers, points, time, data_type, timestamp, url, cat_id, target_send, mails_sent, clicks
89 FROM "._MYSQL_PREFIX."_bonus
90 ORDER BY timestamp DESC";
92 // Check for maximum pages
93 $result_bonus = SQL_QUERY($SQL2, __FILE__, __LINE__);
96 // Check for maximum pages
97 $result_normal = SQL_QUERY($SQL, __FILE__, __LINE__);
99 // Set offset an current page to default values
100 if (empty($_GET['page'])) $_GET['page'] = "1";
101 if (empty($_GET['offset'])) $_GET['offset'] = $CONFIG['mails_page'];
103 // Add limitation to SQL string
104 if (empty($_GET['mid']))
106 // Create limitation line
107 $ADD = " LIMIT ".(bigintval($_GET['offset']) * bigintval($_GET['page']) - bigintval($_GET['offset'])).", ".bigintval($_GET['offset']);
113 if (!empty($SQL2)) $SQL2 .= $ADD;
116 // Run SQL query for normal mails
117 $result_list = SQL_QUERY($SQL, __FILE__, __LINE__);
118 if ((!empty($SQL2)) && ($WHO == _ALL)) $result_bonus = SQL_QUERY($SQL2, __FILE__, __LINE__);
121 $PAGES = round(SQL_NUMROWS($result_normal) / $CONFIG['mails_page'] + 0.3);
122 SQL_FREERESULT($result_normal);
125 if (SQL_NUMROWS($result_list) > 0)
127 // Mail orders are in pool so we can display them
128 OUTPUT_HTML ("<DIV align=\"center\">
129 <TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"admin_table dashed\" width=\"99%\">
131 <TD colspan=\"3\" align=\"center\" height=\"25\" class=\"admin_title\">
132 <STRONG class=\"admin_done\">".ADMIN_POOL_CONTENT." (".$WHO.")</STRONG>
136 // Add navigation (with change box and colspan=3)
137 if ($PAGES > 1) ADD_EMAIL_NAV($PAGES, $CONFIG['mails_page'], false, "3");
139 while ($pool = SQL_FETCHROW($result_list))
141 // Unconfirmed mails and sent mails
142 $result_uncon = SQL_QUERY_ESC("SELECT max_rec, clicks FROM "._MYSQL_PREFIX."_user_stats WHERE pool_id=%d LIMIT 1",
143 array(bigintval($pool[0])), __FILE__, __LINE__);
144 list($sent, $clicks) = SQL_FETCHROW($result_uncon);
145 SQL_FREERESULT($result_uncon);
148 $unconfirmed = $sent - $clicks;
149 if ($unconfirmed > 0)
151 // Add link to list_unconfirmed what-file
152 $unconfirmed = "<STRONG><A href=\"".URL."/modules.php?module=admin&what=list_unconfirmed&mid=".$pool[0]."\">".$unconfirmed."</A></STRONG>";
154 elseif ($unconfirmed < 0)
156 // Sometimes rarely displayed minus values will be "fixed" to zero
162 <TD class=\"bottom top2 right\" width=\"23%\" align=\"center\">
163 ".EMAIL_SENDER.":<BR>
164 <STRONG class=\"admin_misc\">".ADMIN_USER_PROFILE_LINK($pool[1])."</STRONG>
166 <TD class=\"bottom top2 right\" width=\"23%\" align=\"center\">
167 ".EMAIL_SUBJECT.":<BR>
168 <STRONG class=\"admin_misc\">".COMPILE_CODE($pool[2])."</STRONG>
170 <TD class=\"bottom top2\" width=\"54%\" align=\"center\">
172 <STRONG class=\"admin_misc\">".COMPILE_CODE($pool[3])."</STRONG>
175 <TR><TD height=\"5\" colspan=\"3\"></TD></TR>
177 <TD colspan=\"2\" align=\"center\" class=\"top bottom right\">
178 ".EMAIL_PAYMENT.":<BR>
179 <STRONG class=\"admin_misc\">".GET_PAYMENT($pool[5])."
181 <TD align=\"center\" class=\"top bottom\">
182 ".EMAIL_CATEGORY.":<BR>
183 <STRONG class=\"admin_misc\">".GET_CATEGORY($pool[10])."
186 <TR><TD height=\"5\" colspan=\"3\"></TD></TR>
188 <TD align=\"center\" class=\"top bottom right\">
189 ".EMAIL_RECEIVERS.":<BR>
190 <STRONG class=\"admin_misc\">".$sent."</STRONG> (".EMAIL_RUIDS.": <STRONG class=\"admin_misc\">".str_replace(";", ", ", $pool[4])."</STRONG>)
192 <TD align=\"center\" class=\"top bottom right\">
194 <STRONG class=\"admin_misc\">".$unconfirmed."</STRONG>
196 <TD align=\"center\" class=\"top bottom\">
197 ".EMAIL_POOL_TYPE.":<BR>
198 <STRONG class=\"admin_misc\">".GET_POOL_TYPE($pool[6])."</STRONG>
201 <TR><TD height=\"5\" colspan=\"3\"></TD></TR>
203 <TD align=\"center\" class=\"top right\">
205 <STRONG class=\"admin_misc\">".$pool[9]."</STRONG>
207 <TD align=\"center\" class=\"top right\">
209 <STRONG class=\"admin_misc\"><A href=\"".FRAMETESTER($pool[8])."\" target=\"_blank\">".EMAIL_URL_TEST."</A></STRONG>
211 <TD align=\"center\" class=\"top\">
212 ".EMAIL_TIMESTAMP.":<BR>
213 <STRONG class=\"admin_misc\">".MAKE_DATETIME($pool[7], "0")."</STRONG>
217 <TD align=\"center\" class=\"top2 admin_del_link\" colspan=\"3\">
218 <A href=\"".URL."/modules.php?module=admin&what=del_email&mid=".$pool[0]."\">".ADMIN_DELETE_NORMAL_MAIL."</A>
224 SQL_FREERESULT($result_list);
226 // Add navigation (without change box but with colspan=3)
227 if ($PAGES > 1) ADD_EMAIL_NAV($PAGES, $CONFIG['mails_page'], false, "3");
230 OUTPUT_HTML ("</TABLE>
233 if ((EXT_IS_ACTIVE("bonus")) && ($WHO == _ALL))
235 // Check only if bonus extension is active
236 if (SQL_NUMROWS($result_bonus) > 0) OUTPUT_HTML ("<BR><BR>");
240 if ((EXT_IS_ACTIVE("bonus")) && ($WHO == _ALL))
242 // Load bonus mails only when extension is active
243 if (SQL_NUMROWS($result_bonus) > 0)
245 // Mail orders are in pool so we can display them
246 OUTPUT_HTML ("<DIV align=\"center\">
247 <TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"admin_table dashed\" width=\"99%\">
249 <TD colspan=\"3\" align=\"center\" height=\"25\" class=\"admin_title\">
250 <STRONG class=\"admin_done\">".ADMIN_BONUS_CONTENT."</STRONG>
254 $PAGES = round(SQL_NUMROWS($result_bonus) / $CONFIG['mails_page'] + 0.5);
256 // Add navigation (with change box and colspan=3)
257 if ($PAGES > 1) ADD_EMAIL_NAV($PAGES, $CONFIG['mails_page'], true, "3");
260 while ($bonus = SQL_FETCHROW($result_bonus))
263 $unconfirmed = $bonus[11] - $bonus[12];
264 if ($unconfirmed > 0)
266 // Add link to list_unconfirmed what-file
267 $unconfirmed = "<STRONG><A href=\"".URL."/modules.php?module=admin&what=list_unconfirmed&bid=".$bonus[0]."\">".$unconfirmed."</A></STRONG>";
271 <TD class=\"bottom top2 right\" colspan=\"2\" width=\"46%\" align=\"center\">
272 ".EMAIL_SUBJECT.":<BR>
273 <STRONG class=\"admin_misc\">".$bonus[1]."</STRONG>
275 <TD class=\"bottom top2\" width=\"54%\" align=\"center\">
277 <STRONG class=\"admin_misc\">".$bonus[2]."</STRONG>
280 <TR><TD height=\"5\" colspan=\"3\"></TD></TR>
282 <TD align=\"center\" class=\"top bottom right\" width=\"23%\">
283 ".EMAIL_POINTS.":<BR>
284 <STRONG class=\"admin_misc\">".$bonus[4]." ".POINTS."
286 <TD align=\"center\" class=\"top bottom right\" width=\"23%\">
287 ".EMAIL_SECONDS.":<BR>
288 <STRONG class=\"admin_misc\">".$bonus[5]." ".SECS."
290 <TD align=\"center\" class=\"top bottom\">
291 ".EMAIL_CATEGORY.":<BR>
292 <STRONG class=\"admin_misc\">".GET_CATEGORY($bonus[9])."
295 <TR><TD height=\"5\" colspan=\"3\"></TD></TR>
297 <TD align=\"center\" class=\"top bottom right\">
298 ".EMAIL_RECEIVERS.":<BR>
299 <STRONG class=\"admin_misc\">".$bonus[11]."</STRONG> (".EMAIL_RUIDS.": <STRONG class=\"admin_misc\">".str_replace(";", ", ", $bonus[3])."</STRONG>)
301 <TD align=\"center\" class=\"top bottom right\">
303 <STRONG class=\"admin_misc\">".$unconfirmed."</STRONG>
305 <TD align=\"center\" class=\"top bottom\">
306 ".EMAIL_POOL_TYPE.":<BR>
307 <STRONG class=\"admin_misc\">".GET_POOL_TYPE($bonus[6])."</STRONG>
310 <TR><TD height=\"5\" colspan=\"3\"></TD></TR>
312 <TD align=\"center\" class=\"top right\">
314 <STRONG class=\"admin_misc\">".$bonus[10]."</STRONG>
316 <TD align=\"center\" class=\"top right\">
318 <STRONG class=\"admin_misc\"><A href=\"".FRAMETESTER($bonus[8])."\" target=\"_blank\">".EMAIL_URL_TEST."</A></STRONG>
320 <TD align=\"center\" class=\"top\">
321 ".EMAIL_TIMESTAMP.":<BR>
322 <STRONG class=\"admin_misc\">".MAKE_DATETIME($bonus[7], "0")."</STRONG>
326 <TD align=\"center\" class=\"top2 admin_del_link\" colspan=\"3\">
327 <A href=\"".URL."/modules.php?module=admin&what=del_email&bid=".$bonus[0]."\">".ADMIN_DELETE_BONUS_MAIL."</A>
332 // Add navigation (without change box but with colspan=3)
333 if ($PAGES > 1) ADD_EMAIL_NAV($PAGES, $CONFIG['mails_page'], false, "3");
336 OUTPUT_HTML ("</TABLE>
344 // No mail orders fond
345 OUTPUT_HTML ("<SPAN class=\"admin_failed\">".ADMIN_NO_MAILS_IN_POOL."</SPAN>");