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 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2011 by Mailer Developer Team *
20 * For more information visit: http://mxchange.org *
22 * This program is free software. You can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License. *
26 * This program is distributed in the hope that it will be useful, *
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
29 * GNU General Public License for more details. *
31 * You should have received a copy of the GNU General Public License *
32 * along with this program; if not, write to the Free Software *
33 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
35 ************************************************************************/
37 // Some security stuff...
38 if ((!defined('__SECURITY')) || (!isAdmin())) {
42 // Add description as navigation point
43 addYouAreHereLink('admin', __FILE__);
45 if (!isExtensionActive('bonus')) {
46 displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=bonus%}');
52 // Prepare mail for delivery
53 YOOMEDIA_PREPARE_MAIL_DELIVERY(postRequestArray());
55 } elseif (isPostRequestElementSet('sent')) {
57 YOOMEDIA_SEND_BONUS_MAIL(postRequestArray(), 'normal');
58 } elseif (isFormSent('do_delete')) {
59 // Add mail to exclude list
60 YOOMEDIA_EXCLUDE_MAIL(postRequestArray(), 'normal');
61 } elseif (isPostRequestElementSet('unlist')) {
62 // Remove mail from exclude list
63 YOOMEDIA_UNLIST_MAIL(postRequestArray(), 'normal');
66 // Enougth queries left?
67 if (getConfig('yoomedia_requests_remain') == '0') {
69 displayMessage('{--ADMIN_YOOMEDIA_REQUESTS_DEPLETED--}');
75 // Get parsed array back
76 $result = YOOMEDIA_GET_PARSED_RESULT_TEXTMAILS();
78 // Sanity-check on result array
79 if ((!is_array($result)) || (count($result) == 0) || (!isset($result[0]['id']))) {
81 displayMessage('{--ADMIN_YOOMEDIA_INVALID_RESULT--}');
83 } elseif (count($result[0]) < 7) {
84 // Error received so prepare error code
85 $code = YOOMEDIA_GET_ERRORCODE_FROM_RESULT($result);
88 loadTemplate('admin_yoomedia_error', false, sprintf("{--ADMIN_YOOMEDIA_ERROR_%s--}", strtoupper(translateYooMediaError($code))));
92 // Prepare all entries
94 foreach ($result as $entry) {
95 // Translate some data
96 $entry['pay'] = translateComma($entry['pay'], true, 5);
99 $reload = YOOMEDIA_CHECK_RELOAD($entry['id'], $entry['reload'], 'textmail');
101 // Is this mail already sent?
102 if ($reload !== false) {
106 // Not manually locked?
108 // Calculate countdown
109 $countdown = $reload + ($entry['reload'] * 60*60) - time();
111 // Countdown < 60 seconds and bigger zero?
112 if (($countdown < 60) && ($countdown > 0)) {
118 $entry['already'] = '{%message,ADMIN_YOOMEDIA_TEXTMAIL_SEND_AGAIN=' . $countdown . '%}';
120 // Never resentable unless manual removal
121 $entry['already'] = '{--ADMIN_YOOMEDIA_TEXTMAIL_MANUALLY_LOCKED--}';
124 // Load row template for displaying
125 $OUT .= loadTemplate('admin_list_yoomedia_tm_already', true, $entry);
127 // Load row template with buttons
128 $OUT .= loadTemplate('admin_list_yoomedia_tm_row', true, $entry);
132 // Load main template
133 loadTemplate('admin_list_yoomedia_tm', false, $OUT);