2 /************************************************************************
3 * MXChange v0.2.1 Start: 11/13/2004 *
4 * =============== Last change: 11/14/2004 *
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 * -------------------------------------------------------------------- *
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 - 2008 by Roland Haeder *
21 * For more information visit: http://www.mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
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 // Load security stuff here
40 require('inc/libs/security_functions.php');
43 $GLOBALS['startTime'] = microtime(true);
45 // Set this because we have no module in URI
46 $GLOBALS['module'] = 'show_bonus';
47 $GLOBALS['output_mode'] = 0;
49 // Load the required file(s)
50 require('inc/config-global.php');
52 // Is the 'bonus' extension active?
53 redirectOnUninstalledExtension('bonus');
55 // List only rankings when script is installed
57 // You have to install first!
58 redirectToUrl('install.php');
62 loadIncludeOnce('inc/header.php');
64 if ((REQUEST_GET('uid') > 0) && (REQUEST_GET('d') > 0) && (REQUEST_ISSET_GET(('t')))) {
67 switch (REQUEST_GET('t')) {
68 case 'bonusid': // Bonus mail
72 case 'mailid': // Regular member mail
76 default: // Invalid type
77 DEBUG_LOG(__FILE__, __LINE__, sprintf("Invalid type %s detected.", REQUEST_GET('t')));
84 $result = SQL_QUERY_ESC("SELECT DISTINCT d.gender, d.surname, d.family, b.level, b.points
85 FROM `{!_MYSQL_PREFIX!}_user_data` AS d
86 RIGHT JOIN `{!_MYSQL_PREFIX!}_bonus_turbo` AS b
88 WHERE d.`status`='CONFIRMED' AND d.userid=%s AND b.%s=%s
90 array(bigintval(REQUEST_GET('uid')), $t, bigintval(REQUEST_GET('d'))), __FILE__, __LINE__);
93 if (SQL_NUMROWS($result) == 1) {
95 $content = SQL_FETCHARRAY($result);
97 // Prepare constants for the pre-template
98 $content['gender'] = translateGender($content['gender']);
99 $content['points'] = translateComma($content['points']);
100 $content['mailid'] = bigintval(REQUEST_GET('d'));
101 $content['rows'] = BONUS_MAKE_RANK_ROWS(bigintval(REQUEST_GET('d')), $t, bigintval(REQUEST_GET('uid')));
103 // Constant created within previous function which contains informations for current user's ranking position:
104 // @TODO Rewrite this constant
105 // __YOUR_RANKING_LINE
108 $content['msg'] = LOAD_TEMPLATE('show_bonus_msg', true, $content);
111 $content['msg'] = "<span class=\"guest_failed\">{--BONUS_SHOW_NO_DATA--}</span>";
115 SQL_FREERESULT($result);
117 // Wrong type entered
118 $content['msg'] = "<span class=\"guest_failed\">{--BONUS_SHOW_WRONG_TYPE--}</span>";
122 $content['msg'] = "<span class=\"guest_failed\">{--BONUS_SHOW_WRONG_CALL--}</span>";
125 // Load send_bonus header template (for your banners, e.g.?)
126 $content['header'] = LOAD_TEMPLATE('show_bonus_header', true);
128 // Load show_bonus footer template (for your banners, e.g.?)
129 $content['footer'] = LOAD_TEMPLATE('show_bonus_footer', true);
131 // Total ranks who can win
132 $content['total_ranks'] = getConfig('bonus_ranks');
134 // Load final template
135 LOAD_TEMPLATE('show_bonus', false, $content);
138 loadIncludeOnce('inc/footer.php');