2 /************************************************************************
3 * MXChange v0.2.1 Start: 09/28/2003 *
4 * =============== Last change: 04/03/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-email_archiv .php *
8 * -------------------------------------------------------------------- *
9 * Short description : See send emails details of ordered mails *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Alle Mails ansehen die versand wurden *
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 * Mod-Copyright (c) 2004 by Robert Niedziela *
34 * www.megacomputing.de *
35 ************************************************************************/
37 // Some security stuff...
38 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
40 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
43 // Add description as navigation point
44 ADD_DESCR("admin", basename(__FILE__));
46 // 0 1 2 3 4 5 6 7 8 9 10
47 $SQL = "SELECT id, sender, subject, text, receivers, payment_id, data_type, timestamp, url, target_send, cat_id
48 FROM "._MYSQL_PREFIX."_pool
49 WHERE data_type='SEND' OR data_type='DELETED'
50 ORDER BY timestamp DESC";
52 // Check for maximum pages
53 $result_normal = SQL_QUERY($SQL, __FILE__, __LINE__);
55 // Set offset an current page to default values
56 if (empty($_GET['page'])) $_GET['page'] = "1";
57 if (empty($_GET['offset'])) $_GET['offset'] = $CONFIG['mails_page'];
59 // Add limitation to SQL string
60 $SQL .= " LIMIT ".($_GET['offset'] * $_GET['page'] - $_GET['offset']).", ".$_GET['offset'];
62 // Run SQL query for normal mails
63 $result = SQL_QUERY($SQL, __FILE__, __LINE__);
66 $PAGES = round(SQL_NUMROWS($result_normal) / $CONFIG['mails_page'] + 0.5);
67 SQL_FREERESULT($result_normal);
69 if (SQL_NUMROWS($result) > 0)
71 // Mail orders are in pool so we can display them
73 // Add navigation table rows
76 define('__TOP_EMAIL_NAV' , ADD_EMAIL_NAV($PAGES, $CONFIG['mails_page'], true , "3", true));
77 define('__BOTTOM_EMAIL_NAV', ADD_EMAIL_NAV($PAGES, $CONFIG['mails_page'], false, "3", true));
81 define('__TOP_EMAIL_NAV' , "");
82 define('__BOTTOM_EMAIL_NAV', "");
86 while ($pool = SQL_FETCHROW($result))
88 // Check sent mails and clicks
89 $result_mails = SQL_QUERY_ESC("SELECT max_rec, clicks FROM "._MYSQL_PREFIX."_user_stats WHERE pool_id=%d LIMIT 1",
90 array(bigintval($pool[0])), __FILE__, __LINE__);
91 list($sent, $clicks) = SQL_FETCHROW($result_mails);
92 SQL_FREERESULT($result_mails);
95 $unconfirmed = $sent - $clicks;
98 // Add link to list_unconfirmed what-file
99 $unconfirmed = "<STRONG><A href=\"".URL."/modules.php?module=admin&what=list_unconfirmed&mid=".$pool[0]."\">".$unconfirmed."</A></STRONG>";
102 // Prepare data for the row template
105 'u_link' => ADMIN_USER_PROFILE_LINK($pool[1]),
106 'subj' => COMPILE_CODE($pool[2]),
107 'text' => COMPILE_CODE($pool[3]),
108 'pay' => GET_PAYMENT($pool[5]),
109 'cat' => GET_CATEGORY($pool[10]),
111 'ruids' => str_replace(";", ", ", $pool[4]),
112 'unconfirmed' => $unconfirmed,
113 'type' => GET_POOL_TYPE($pool[6]),
115 'url' => FRAMETESTER($pool[8]),
116 'stamp' => MAKE_DATETIME($pool[7], "0"),
120 // Load row template and switch colors
121 $OUT .= LOAD_TEMPLATE("admin_email_archiv_row", true, $content);
126 SQL_FREERESULT($result);
127 define('__EMAIL_ROWS', $OUT);
129 // Load main template
130 LOAD_TEMPLATE("admin_email_archiv");
134 // No mail orders fond
135 OUTPUT_HTML("<SPAN class=\"admin_failed\">".ADMIN_NO_MAILS_IN_POOL."</SPAN>");