New naming convention applied to many functions, see #118 for details
[mailer.git] / inc / modules / member / what-surfbar_book.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 09/08/2008 *
4  * ================                             Last change: 09/08/2008 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-surfbar_book.php                            *
8  * -------------------------------------------------------------------- *
9  * Short description : Members can book new URLs here                   *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Mitglieder koennen URLs buchen                   *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
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                  *
22  *                                                                      *
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.                                  *
27  *                                                                      *
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.                         *
32  *                                                                      *
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,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
41         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
42         require($INC);
43 } elseif (!IS_MEMBER()) {
44         // Redirect
45         redirectToUrl('modules.php?module=index');
46 } elseif ((!EXT_IS_ACTIVE('surfbar')) && (!IS_ADMIN())) {
47         addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'surfbar'));
48         return;
49 }
50
51 // Add description as navigation point
52 ADD_DESCR('member', __FILE__);
53
54 // Still allowed to book more URLs?
55 if (!SURFBAR_IF_USER_BOOK_MORE_URLS()) {
56         // No more URLs allowed to book!
57         LOAD_TEMPLATE('admin_settings_saved', false, getMessage('MEMBER_SURFBAR_NO_MORE_ALLOWED'));
58 } elseif ((IS_FORM_SENT()) && (REQUEST_ISSET_POST(('limited')))) {
59         // Is limitation "no" and "limit" is > 0?
60         if ((REQUEST_POST('limited') == 'N') && ((REQUEST_ISSET_POST(('limit'))) && (REQUEST_POST('limit') > 0)) || (!REQUEST_ISSET_POST(('limit')))) {
61                 // Set it to unlimited
62                 REQUEST_SET_POST('limit', 0);
63         } // END - if
64
65         // Register the new URL
66         $insertId = SURFBAR_MEMBER_ADD_URL(REQUEST_POST('url'), REQUEST_POST('limit'));
67
68         // By default something went wrong
69         $msg = getMessage('MEMBER_SURFBAR_URL_NOT_ADDED');
70
71         // Was this fine?
72         if ($insertId > 0) {
73                 // URL added and waiting for unlock
74                 $msg = getMessage('MEMBER_SURFBAR_URL_ADDED');
75         } // END - if
76
77         // Load message template
78         LOAD_TEMPLATE('admin_settings_saved', false, $msg);
79 } else {
80         // Prepare some content
81         $content = array(
82                 'reward'     => translateComma(SURFBAR_DETERMINE_REWARD(true)),
83                 'costs'      => translateComma(SURFBAR_DETERMINE_COSTS(true)),
84                 'max_order'  => getConfig('surfbar_max_order'),
85                 'curr_order' => SURFBAR_GET_TOTAL_USER_URLS()
86         );
87
88         // Load surfbar order form
89         LOAD_TEMPLATE(sprintf("member_surfbar_book_%s", strtolower(getConfig('surfbar_pay_model'))), false, $content);
90 }
91
92 //
93 ?>