]> git.mxchange.org Git - mailer.git/blob - inc/modules/guest/what-sponsor_infos.php
Fix for undefined index 'last'
[mailer.git] / inc / modules / guest / what-sponsor_infos.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 06/10/2005 *
4  * ===============                              Last change: 05/18/2008 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-sponsor_infos.php                           *
8  * -------------------------------------------------------------------- *
9  * Short description : Informations and prices for the sponsor          *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Informationen/Preise fuer den Sponsoren          *
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.       *
21  *                                                                      *
22  * This program is distributed in the hope that it will be useful,      *
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
25  * GNU General Public License for more details.                         *
26  *                                                                      *
27  * You should have received a copy of the GNU General Public License    *
28  * along with this program; if not, write to the Free Software          *
29  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
30  * MA  02110-1301  USA                                                  *
31  ************************************************************************/
32
33 // Some security stuff...
34 if (!defined('__SECURITY')) {
35         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
36         require($INC);
37 } elseif ((!EXT_IS_ACTIVE("sponsor"))) {
38         if (IS_ADMIN()) {
39                 ADD_FATAL(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "sponsor"));
40         } else {
41                 ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "sponsor");
42         }
43         return;
44 }
45
46 // Add description as navigation point
47 ADD_DESCR("guest", __FILE__);
48
49 // Remove result_act
50 unset($result_act);
51
52 // Load all sponsor actions
53 $result_act = SQL_QUERY("SELECT DISTINCT m.title, c.conv_rate, c.conv_name
54 FROM "._MYSQL_PREFIX."_sponsor_menu AS m
55 LEFT JOIN "._MYSQL_PREFIX."_sponsor_action_convert AS c ON m.what=c.ext_name
56 LEFT JOIN "._MYSQL_PREFIX."_sponsor_registry AS r ON m.what=r.ext_name
57 WHERE m.action='actions' AND r.is_active='Y'
58 ORDER BY m.sort ASC", __FILE__, __LINE__);
59 $num_act = SQL_NUMROWS($result_act);
60
61 if ($num_act > 0) {
62         // Load all actions
63         $OUT_ACT = ""; $SW = 2;
64         while (list($title, $conv, $name) = SQL_FETCHROW($result_act)) {
65                 // Prepare data for the row template
66                 $content = array(
67                         'sw'    => $SW,
68                         'title' => $title,
69                         'conv'  => round($conv),
70                         'name'  => $name,
71                 );
72
73                 // Load row template and switch color
74                 $OUT_ACT .= LOAD_TEMPLATE("guest_sponsor_act_row", true, $content);
75                 $SW = 3 - $SW;
76         } // END - while
77
78         // Check for pay types
79         $result_pay = SQL_QUERY("SELECT pay_name, pay_rate, pay_min_count, pay_currency FROM "._MYSQL_PREFIX."_sponsor_paytypes ORDER BY pay_name", __FILE__, __LINE__);
80         if (SQL_NUMROWS($result_pay) > 0) {
81                 // Load all pay types
82                 $OUT_PAY = ""; $SW = 2;
83                 while (list($name, $rate, $min, $curr) = SQL_FETCHROW($result_pay)) {
84                         // Prepare data for the row template
85                         $content = array(
86                                 'sw'    => $SW,
87                                 'name'  => $name,
88                                 'rate'  => TRANSLATE_COMMA($rate),
89                                 'min'   => $min,
90                                 'curr'  => $curr,
91                                 'price' => TRANSLATE_COMMA($min),
92                         );
93
94                         // Load row template and switch color
95                         $OUT_PAY .= LOAD_TEMPLATE("guest_sponsor_pay_row", true, $content);
96                         $SW = 3 - $SW;
97                 }
98         } else {
99                 // No pay types setuped so far!
100                 $OUT_PAY = "<TR><TD colspan=\"2\">
101   ".LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_NO_ACTIONS_ACTIVATED)."
102 </TD></TR>";
103         }
104 } else {
105         // No actions activated so far!
106         $OUT_ACT = "<TR><TD colspan=\"2\" class=\"bottom2\" style=\"padding-top: 10px; padding-bottom: 10px\">
107   ".LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_NO_ACTIONS_ACTIVATED)."
108 </TD></TR>";
109         $OUT_PAY = "<TR><TD colspan=\"2\" class=\"bottom2\" style=\"padding-top: 10px; padding-bottom: 10px\">
110   ".LOAD_TEMPLATE("admin_settings_saved", true, SPONSOR_NO_ACTIONS_ACTIVATED)."
111 </TD></TR>";
112 }
113
114 // Transfer rows to constans
115 define('__SPONSOR_ACTIONS' , $OUT_ACT);
116 define('__SPONSOR_PAYTYPES', $OUT_PAY);
117
118 // Free memory
119 if (isset($result_act)) SQL_FREERESULT($result_act);
120 if (isset($result_pay)) SQL_FREERESULT($result_pay);
121
122 // Load main template
123 LOAD_TEMPLATE("guest_sponsor_infos");
124
125 //
126 ?>