2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 10/10/2008 *
4 * =================== Last change: 10/10/2008 *
6 * -------------------------------------------------------------------- *
7 * File : what-list_yoomedia_tm.php *
8 * -------------------------------------------------------------------- *
9 * Short description : List Yoo!Media text mails *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Auflisten von Yoo!Media Textmails *
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 * Copyright (c) 2009, 2010 by Mailer Developer Team *
22 * For more information visit: http://www.mxchange.org *
24 * This program is free software. You can redistribute it and/or modify *
25 * it under the terms of the GNU General Public License as published by *
26 * the Free Software Foundation; either version 2 of the License. *
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 (!isExtensionActive('yoomedia')) {
48 loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('yoomedia'));
50 } elseif (!isExtensionActive('bonus')) {
51 loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('bonus'));
57 // Prepare mail for delivery
58 YOOMEDIA_PREPARE_MAIL_DELIVERY(postRequestArray());
60 } elseif (isPostRequestParameterSet('sent')) {
62 YOOMEDIA_SEND_BONUS_MAIL(postRequestArray(), 'normal');
63 } elseif (isPostRequestParameterSet('remove')) {
64 // Add mail to exclude list
65 YOOMEDIA_EXCLUDE_MAIL(postRequestArray(), 'normal');
66 } elseif (isPostRequestParameterSet('unlist')) {
67 // Remove mail from exclude list
68 YOOMEDIA_UNLIST_MAIL(postRequestArray(), 'normal');
71 // Enougth queries left?
72 if (getConfig('yoomedia_requests_remain') == '0') {
74 loadTemplate('admin_settings_saved', false, getMessage('ADMIN_YOOMEDIA_REQUESTS_DEPLETED'));
80 // Get parsed array back
81 $result = YOOMEDIA_GET_PARSED_RESULT_TEXTMAILS();
83 // Sanity-check on result array
84 if ((!is_array($result)) || (count($result) == '0') || (!isset($result[0]['id']))) {
86 loadTemplate('admin_settings_saved', false, getMessage('ADMIN_YOOMEDIA_INVALID_RESULT'));
88 } elseif (count($result[0]) < 7) {
89 // Error received so prepare error code
90 $code = YOOMEDIA_GET_ERRORCODE_FROM_RESULT($result);
93 loadTemplate('admin_yoomedia_error', false, sprintf("{--ADMIN_YOOMEDIA_ERROR_%s--}", strtoupper(translateYooMediaError($code))));
97 // Prepare all entries
99 foreach ($result as $entry) {
100 // Translate some data
101 $entry['pay'] = translateComma($entry['pay'], true, 5);
102 $entry['remain'] = translateComma($entry['remain']);
106 $reload = YOOMEDIA_CHECK_RELOAD($entry['id'], $entry['reload'], 'textmail');
108 // Is this mail already sent?
109 if ($reload !== false) {
113 // Not manually locked?
115 // Calculate countdown
116 $countdown = $reload + ($entry['reload'] * 60*60) - time();
118 // Countdown < 60 seconds and bigger zero?
119 if (($countdown < 60) && ($countdown > 0)) {
125 $entry['already'] = getMaskedMessage('ADMIN_YOOMEDIA_TEXTMAIL_SEND_AGAIN', createFancyTime($countdown));
127 // Never resentable unless manual removal
128 $entry['already'] = getMessage('ADMIN_YOOMEDIA_TEXTMAIL_MANUALLY_LOCKED');
131 // Load row template for displaying
132 $OUT .= loadTemplate('admin_list_yoomedia_tm_already', true, $entry);
134 // Load row template with buttons
135 $OUT .= loadTemplate('admin_list_yoomedia_tm_row', true, $entry);
142 // Load main template
143 loadTemplate('admin_list_yoomedia_tm', false, $OUT);