Added update_year.sh (still not fully flexible) and updated all years with it.
[mailer.git] / inc / modules / guest / what-sponsor_infos.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                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  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
14  * Copyright (c) 2009 - 2015 by Mailer Developer Team                   *
15  * For more information visit: http://mxchange.org                      *
16  *                                                                      *
17  * This program is free software; you can redistribute it and/or modify *
18  * it under the terms of the GNU General Public License as published by *
19  * the Free Software Foundation; either version 2 of the License, or    *
20  * (at your option) any later version.                                  *
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         exit();
36 } // END - if
37
38 // Add description as navigation point
39 addYouAreHereLink('guest', __FILE__);
40
41 if ((!isExtensionActive('sponsor'))) {
42         displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=sponsor%}');
43         return;
44 } // END - if
45
46 // Init both results (see footer of this file)
47 $result_act = FALSE;
48 $result_pay = FALSE;
49
50 // ... and output variables
51 $OUT_ACT = '';
52 $OUT_PAY = '';
53
54 // Load all sponsor actions
55 $result_act = sqlQuery("SELECT
56         `m`.`title` AS `conv_title`,
57         `c`.`conv_rate`,
58         `c`.`conv_name`
59 FROM
60         `{?_MYSQL_PREFIX?}_sponsor_menu` AS `m`
61 LEFT JOIN
62         `{?_MYSQL_PREFIX?}_sponsor_action_convert` AS `c`
63 ON
64         `m`.`what`=`c`.`ext_name`
65 LEFT JOIN
66         `{?_MYSQL_PREFIX?}_sponsor_registry` AS `r`
67 ON
68         `m`.`what`=`r`.`ext_name`
69 WHERE
70         `m`.`action`='actions' AND
71         `r`.`is_active`='Y'
72 ORDER BY
73         `m`.`sort` ASC", __FILE__, __LINE__);
74
75 if (!ifSqlHasZeroNums($result_act)) {
76         // Load all actions
77         while ($content = sqlFetchArray($result_act)) {
78                 // Load row template and switch color
79                 $OUT_ACT .= loadTemplate('guest_sponsor_act_row', TRUE, $content);
80         } // END - while
81
82         // Check for pay types
83         $result_pay = sqlQuery('SELECT `pay_name`, `pay_rate`, `pay_min_count`, `pay_currency` FROM `{?_MYSQL_PREFIX?}_sponsor_paytypes` ORDER BY `pay_name` ASC', __FILE__, __LINE__);
84         if (!ifSqlHasZeroNums($result_pay)) {
85                 // Load all pay types
86                 while ($content = sqlFetchArray($result_pay)) {
87                         // Load row template and switch color
88                         $OUT_PAY .= loadTemplate('guest_sponsor_pay_row', TRUE, $content);
89                 } // END - while
90         } else {
91                 // No pay types setuped so far!
92                 $OUT_PAY = loadTemplate('guest_sponsor_infos_none_row', TRUE, displayMessage('{--SPONSOR_NO_ACTIONS_ACTIVATED--}', TRUE));
93         }
94 } else {
95         // No actions activated so far!
96         $OUT_ACT = loadTemplate('guest_sponsor_infos_none_row', TRUE, displayMessage('{--SPONSOR_NO_ACTIONS_ACTIVATED--}', TRUE));
97         $OUT_PAY = loadTemplate('guest_sponsor_infos_none_row', TRUE, displayMessage('{--SPONSOR_NO_ACTIONS_ACTIVATED--}', TRUE));
98 }
99
100 // Free memory
101 sqlFreeResult($result_act);
102 sqlFreeResult($result_pay);
103
104 // Transfer rows to an array
105 $content = array(
106         'actions'  => $OUT_ACT,
107         'paytypes' => $OUT_PAY
108 );
109
110 // Load main template
111 loadTemplate('guest_sponsor_infos', FALSE, $content);
112
113 // [EOF]
114 ?>