Fixed broken german umlauts
[mailer.git] / 0.2.1 / inc / modules / member / what-unconfirmed.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 10/19/2003 *
4  * ===============                              Last change: 07/13/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-unconfirmed.php                             *
8  * -------------------------------------------------------------------- *
9  * Short description : Unconfirmed mails                                *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Unbestaetigte Mails                              *
12  * -------------------------------------------------------------------- *
13  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
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.                                  *
22  *                                                                      *
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.                         *
27  *                                                                      *
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,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
36 {
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
38         require($INC);
39 }
40  elseif (!IS_LOGGED_IN())
41 {
42         LOAD_URL(URL."/modules.php?module=index");
43 }
44
45 // Add description as navigation point
46 ADD_DESCR("member", basename(__FILE__));
47
48 OPEN_TABLE("100%", "member_content member_content_align", "");
49 if (EXT_IS_ACTIVE("bonus"))
50 {
51         // Load bonus ID
52         $result = SQL_QUERY_ESC("SELECT stats_id, bonus_id, link_type FROM "._MYSQL_PREFIX."_user_links WHERE userid=%d ORDER BY bonus_id DESC",
53          array($GLOBALS['userid']), __FILE__, __LINE__);
54 }
55  else
56 {
57         // Don't load bonus ID
58         $result = SQL_QUERY_ESC("SELECT stats_id, stats_id, link_type FROM "._MYSQL_PREFIX."_user_links WHERE userid=%d ORDER BY stats_id DESC",
59          array($GLOBALS['userid']), __FILE__, __LINE__);
60 }
61
62 if (SQL_NUMROWS($result) > 0)
63 {
64         // Please confirm these mails!
65         $sum = "0"; $SW = 2; $OUT = "";
66         while (list($id, $id2, $type) = SQL_FETCHROW($result))
67         {
68                 // Load data from stats table...
69                 $cat = "";
70                 switch ($type)
71                 {
72                 case "NORMAL":
73                         $result_data = SQL_QUERY_ESC("SELECT subject, subject, timestamp_ordered, cat_id, payment_id, pool_id FROM "._MYSQL_PREFIX."_user_stats WHERE id=%d LIMIT 1",
74                          array(bigintval($id)), __FILE__, __LINE__);
75                         $TYPE = "mailid"; $DATA = $id; $PROBLEM = NORMAL_MAIL_PROBLEM;
76                         break;
77
78                 case "BONUS":
79                         $result_data = SQL_QUERY_ESC("SELECT subject, text, timestamp, cat_id, points, id FROM "._MYSQL_PREFIX."_bonus WHERE id=%d LIMIT 1",
80                          array(bigintval($id2)), __FILE__, __LINE__);
81                         $TYPE = "bonusid"; $DATA = $id2; $PROBLEM = BONUS_MAIL_PROBLEM;
82                         break;
83                 }
84
85                 if (SQL_NUMROWS($result_data) == 1)
86                 {
87                         // Mail was found!
88                         list($subject, $text, $timestamp, $cat, $pay, $pool) = SQL_FETCHROW($result_data);
89                         SQL_FREERESULT($result_data);
90                         if ($type == "NORMAL")
91                         {
92                                 $pay = GET_PAY_POINTS($pay, "payment");
93                                 $result_text = SQL_QUERY_ESC("SELECT text FROM "._MYSQL_PREFIX."_pool WHERE id=%d LIMIT 1",
94                                  array(bigintval($pool)), __FILE__, __LINE__);
95                                 list($text) = SQL_FETCHROW($result_text);
96                                 SQL_FREERESULT($result_text);
97                         }
98                         if (empty($subject)) $subject = DEFAULT_SUBJECT_LINE;
99                         if (empty($text))    $text    = "---";
100                         $subject = COMPILE_CODE($subject);
101
102                         // Prepare data for template
103                         $content = array(
104                                 'sw'     => $SW,
105                                 'uid'    => $GLOBALS['userid'],
106                                 'data'   => $DATA,
107                                 'type'   => $TYPE,
108                                 'subj'   => $subject,
109                                 'text'   => COMPILE_CODE($text),
110                                 'stamp'  => MAKE_DATETIME($timestamp, "0"),
111                                 'cat'    => GET_CATEGORY($cat),
112                                 'points' => TRANSLATE_COMMA($pay),
113                         );
114
115                         // Load row template and count points
116                         $OUT .= LOAD_TEMPLATE("member_unconfirmed_row", true, $content);
117                         $sum += $pay;
118                 }
119                  else
120                 {
121                         // Prepare data for template
122                         $content = array(
123                                 'sw'    => $SW,
124                                 'data'  => $DATA,
125                                 'probl' => $PROBLEM,
126                         );
127
128                         // Problem with mail detected
129                         $OUT .= LOAD_TEMPLATE("member_unconfirmed_404", true, $content);
130                 }
131                 $SW = 3 - $SW;
132         }
133
134         // Free memory
135         SQL_FREERESULT($result);
136
137         // Remember total points
138         define('__TOTAL_POINTS', TRANSLATE_COMMA($sum));
139
140         // Remember all generated rows in constant for the template
141         define('__UNCONFIRMED_ROWS', $OUT);
142
143         // Load main template
144         LOAD_TEMPLATE("member_unconfirmed_table");
145 }
146  else
147 {
148         // No mails left to confirm... :)
149         LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_NO_MAILS_TO_CONFIRM);
150 }
151 CLOSE_TABLE();
152 //
153 ?>