Missing templates/language strings added for migrated URLs
[mailer.git] / show_bonus.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 11/13/2004 *
4  * ===============                              Last change: 11/14/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : show_bonus.php                                   *
8  * -------------------------------------------------------------------- *
9  * Short description : Show ranking list for turbo-bonus                *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Rankliste fuer Turbo-Bonus anzeigen              *
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 // Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
35 require_once("inc/libs/security_functions.php");
36
37 // Init "action" and "what"
38 global $what, $action, $startTime;
39 $GLOBALS['startTime'] = microtime(true);
40 $GLOBALS['what'] = ""; $GLOBALS['action'] = "";
41
42 // Set this because we have no module in URI
43 $GLOBALS['module'] = "show_bonus"; $CSS = 0;
44
45 // Load the required file(s)
46 require("inc/config.php");
47
48 // Is the "bonus" extension active?
49 if (!EXT_IS_ACTIVE("bonus")) {
50         // Redirect to index
51         LOAD_URL("modules.php?module=index&amp;msg=".CODE_EXTENSION_PROBLEM."&amp;ext=bonus");
52 } // END - if
53
54 // List only rankings when script is installed
55 if (isBooleanConstantAndTrue('mxchange_installed')) {
56         // Include header
57         include(PATH."inc/header.php");
58
59         if (($_GET['uid'] > 0) && ($_GET['d'] > 0) && (!empty($_GET['t']))) {
60                 // Set row name
61                 $t = "";
62                 switch ($_GET['t'])
63                 {
64                 case "bonusid":
65                         $t = "bonus_id";
66                         break;
67
68                 case "mailid":
69                         $t = "mail_id";
70                         break;
71                 }
72
73                 // Valid type?
74                 if (!empty($t)) {
75                         // Check for data
76                         $result = SQL_QUERY_ESC("SELECT DISTINCT d.gender, d.surname, d.family, b.level, b.points
77 FROM "._MYSQL_PREFIX."_user_data AS d
78 RIGHT JOIN "._MYSQL_PREFIX."_bonus_turbo AS b
79 ON d.userid=b.userid
80 WHERE d.status='CONFIRMED' AND d.userid=%s AND b.".$t."='%s' LIMIT 1",
81  array(bigintval($_GET['uid']), bigintval($_GET['d'])), __FILE__, __LINE__);
82                         if (SQL_NUMROWS($result) == 1) {
83                                 // Load data
84                                 list($gender, $sname, $fname, $level, $points) = SQL_FETCHROW($result);
85
86                                 // Prepare constants for the pre-template
87                                 define('__GENDER'    , TRANSLATE_GENDER($gender));
88                                 define('__SNAME'    , $sname);
89                                 define('__FNAME'    , $fname);
90                                 define('__RANK'     , $level);
91                                 define('__POINTS'   , $points);
92                                 define('__MAILID'   , $_GET['d']);
93                                 define('__RANK_ROWS', BONUS_MAKE_RANK_ROWS(bigintval($_GET['d']), $t, bigintval($_GET['uid'])));
94
95                                 // Constant created within previous function which contains informations for current user's ranking position:
96                                 //   __YOUR_RANKING_LINE
97
98                                 // Load pre-template
99                                 define('__BONUS_MSG', LOAD_TEMPLATE("show_bonus_msg", true));
100                         } else {
101                                 // No data found
102                                 define('__BONUS_MSG', "<FONT class=\"guest_failed\">".BONUS_SHOW_NO_DATA."</FONT>");
103                         }
104
105                         // Free memory
106                         SQL_FREERESULT($result);
107                 } else {
108                         // Wrong type entered
109                         define('__BONUS_MSG', "<FONT class=\"guest_failed\">".BONUS_SHOW_WRONG_TYPE."</FONT>");
110                 }
111         } else {
112                 // Wrong call!
113                 define('__BONUS_MSG', "<FONT class=\"guest_failed\">".BONUS_SHOW_WRONG_CALL."</FONT>");
114         }
115
116         // Load send_bonus header template (for your banners, e.g.?)
117         define('__BONUS_HEADER', LOAD_TEMPLATE("show_bonus_header", true));
118
119         // Load show_bonus footer template (for your banners, e.g.?)
120         define('__BONUS_FOOTER', LOAD_TEMPLATE("show_bonus_footer", true));
121
122         // Total ranks who can win
123         define('__BONUS_TOTAL_RANKS', $_CONFIG['bonus_ranks']);
124
125         // Load final template
126         LOAD_TEMPLATE("show_bonus");
127
128         // Include footer
129         include(PATH."inc/footer.php");
130 } else {
131         // You have to configure first!
132         LOAD_URL("install.php");
133 }
134
135 // Really all done here... ;-)
136 ?>