Opps, not all elements for sprintf() has been set.
[mailer.git] / inc / libs / order_functions.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 04/05/2005 *
4  * ===================                          Last change: 04/05/2005 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : order_functions.php                               *
8  * -------------------------------------------------------------------- *
9  * Short description : Functions for the guest's newsletter             *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Funktionen fuer den Newsletter an die Gaeste     *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
20  * For more information visit: http://mxchange.org                      *
21  *                                                                      *
22  * This program is free software; you can redistribute it and/or modify *
23  * it under the terms of the GNU General Public License as published by *
24  * the Free Software Foundation; either version 2 of the License, or    *
25  * (at your option) any later version.                                  *
26  *                                                                      *
27  * This program is distributed in the hope that it will be useful,      *
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
30  * GNU General Public License for more details.                         *
31  *                                                                      *
32  * You should have received a copy of the GNU General Public License    *
33  * along with this program; if not, write to the Free Software          *
34  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         die();
41 } // END - if
42
43 // Generates a selection list for mail order
44 function addOrderSelectionOptions ($default) {
45         // Currenty the list is hardcoded...
46         // @TODO Move this array into a filter
47         $LIST = array('userid', 'zip', 'country', 'email', 'birth_year', 'last_online', 'ref_clicks', 'total_logins', 'mail_orders');
48         $OUT = '';
49         foreach ($LIST as $item) {
50                 // Defaul selection
51                 $selected = '';
52                 if ($item == $default) {
53                         $selected = ' selected="selected"';
54                 } // END - if
55
56                 // 'ref_clicks' needs to be rewritten to 'referral_clicks'
57                 if ($item == 'ref_clicks') {
58                         $item = 'referral_clicks';
59                 } // END - if
60
61                 // Add option line
62                 $OUT .= '<option value="' . $item . '"' . $selected . '>{--ADMIN_CONFIG_ORDER_SELECT_COLUMN_' . strtoupper($item) . '--}</option>';
63         } // END - foreach
64
65         // Return the output
66         return $OUT;
67 }
68
69 //-----------------------------------------------------------------------------
70 //                Wrapper functions for configuration entries
71 //-----------------------------------------------------------------------------
72
73 // Getter for 'order_multi_page' config entry
74 function getOrderMultiPage () {
75         // Is there cache?
76         if (!isset($GLOBALS[__FUNCTION__])) {
77                 // Determine it
78                 $GLOBALS[__FUNCTION__] = getConfig('order_multi_page');
79         } // END - if
80
81         // Return cache
82         return $GLOBALS[__FUNCTION__];
83 }
84
85 // Determines whether 'order_multi_page' is set to 'Y'
86 function isOrderMultiPageEnabled () {
87         // Is there cache?
88         if (!isset($GLOBALS[__FUNCTION__])) {
89                 // Determine it
90                 $GLOBALS[__FUNCTION__] = (getOrderMultiPage() == 'Y');
91         } // END - if
92
93         // Return cache
94         return $GLOBALS[__FUNCTION__];
95 }
96
97 // Getter for 'autosend_member_mails' config entry
98 function getAutosendMemberMails () {
99         // Is there cache?
100         if (!isset($GLOBALS[__FUNCTION__])) {
101                 // Determine it
102                 $GLOBALS[__FUNCTION__] = getConfig('autosend_member_mails');
103         } // END - if
104
105         // Return cache
106         return $GLOBALS[__FUNCTION__];
107 }
108
109 // Determines whether 'autosend_member_mails' is set to 'Y'
110 function isAutosendMemberMailsEnabled () {
111         // Is there cache?
112         if (!isset($GLOBALS[__FUNCTION__])) {
113                 // Determine it
114                 $GLOBALS[__FUNCTION__] = (getAutosendMemberMails() == 'Y');
115         } // END - if
116
117         // Return cache
118         return $GLOBALS[__FUNCTION__];
119 }
120
121 // Getter for 'order_max_full' config entry
122 function getOrderMaxFull () {
123         // Is there cache?
124         if (!isset($GLOBALS[__FUNCTION__])) {
125                 // Determine it
126                 $GLOBALS[__FUNCTION__] = getConfig('order_max_full');
127         } // END - if
128
129         // Return cache
130         return $GLOBALS[__FUNCTION__];
131 }
132
133 // Getter for 'order_mode' config entry
134 function getOrderMode () {
135         // Is there cache?
136         if (!isset($GLOBALS[__FUNCTION__])) {
137                 // Determine it
138                 $GLOBALS[__FUNCTION__] = getConfig('order_mode');
139         } // END - if
140
141         // Return cache
142         return $GLOBALS[__FUNCTION__];
143 }
144
145 // Getter for 'order_select' config entry
146 function getOrderSelect () {
147         // Is there cache?
148         if (!isset($GLOBALS[__FUNCTION__])) {
149                 // Determine it
150                 $GLOBALS[__FUNCTION__] = getConfig('order_select');
151         } // END - if
152
153         // Return cache
154         return $GLOBALS[__FUNCTION__];
155 }
156
157 // Getter for 'max_unconfirmed' config entry
158 function getMaxUnconfirmed () {
159         // Is there cache?
160         if (!isset($GLOBALS[__FUNCTION__])) {
161                 // Determine it
162                 $GLOBALS[__FUNCTION__] = getConfig('max_unconfirmed');
163         } // END - if
164
165         // Return cache
166         return $GLOBALS[__FUNCTION__];
167 }
168
169 // Getter for 'max_text_length' config entry
170 function getMaxTextLength () {
171         // Is there cache?
172         if (!isset($GLOBALS[__FUNCTION__])) {
173                 // Determine it
174                 $GLOBALS[__FUNCTION__] = getConfig('max_text_length');
175         } // END - if
176
177         // Return cache
178         return $GLOBALS[__FUNCTION__];
179 }
180
181 // Getter for 'order_min' config entry
182 function getOrderMin () {
183         // Is there cache?
184         if (!isset($GLOBALS[__FUNCTION__])) {
185                 // Determine it
186                 $GLOBALS[__FUNCTION__] = getConfig('order_min');
187         } // END - if
188
189         // Return cache
190         return $GLOBALS[__FUNCTION__];
191 }
192
193 // Getter for 'allow_url_in_text' config entry
194 function getAllowUrlInText () {
195         // Is there cache?
196         if (!isset($GLOBALS[__FUNCTION__])) {
197                 // Determine it
198                 $GLOBALS[__FUNCTION__] = getConfig('allow_url_in_text');
199         } // END - if
200
201         // Return cache
202         return $GLOBALS[__FUNCTION__];
203 }
204
205 // Determines whether 'allow_url_in_text' is set to 'Y'
206 function isAllowUrlInTextEnabled () {
207         // Is there cache?
208         if (!isset($GLOBALS[__FUNCTION__])) {
209                 // Determine it
210                 $GLOBALS[__FUNCTION__] = (getAllowUrlInText() == 'Y');
211         } // END - if
212
213         // Return cache
214         return $GLOBALS[__FUNCTION__];
215 }
216
217 // Getter for 'allow_url_in_subject' config entry
218 function getAllowUrlInSubject () {
219         // Is there cache?
220         if (!isset($GLOBALS[__FUNCTION__])) {
221                 // Determine it
222                 $GLOBALS[__FUNCTION__] = getConfig('allow_url_in_subject');
223         } // END - if
224
225         // Return cache
226         return $GLOBALS[__FUNCTION__];
227 }
228
229 // Determines whether 'allow_url_in_subject' is set to 'Y'
230 function isAllowUrlInSubjectEnabled () {
231         // Is there cache?
232         if (!isset($GLOBALS[__FUNCTION__])) {
233                 // Determine it
234                 $GLOBALS[__FUNCTION__] = (getAllowUrlInSubject() == 'Y');
235         } // END - if
236
237         // Return cache
238         return $GLOBALS[__FUNCTION__];
239 }
240
241 // [EOF]
242 ?>