2 /************************************************************************
3 * MXChange v0.2.1 Start: 09/08/2008 *
4 * ================ Last change: 09/08/2008 *
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 * -------------------------------------------------------------------- *
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 - 2009 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 // Some security stuff...
40 if (!defined('__SECURITY')) {
42 } elseif (!isMember()) {
44 redirectToIndexMemberOnlyModule();
47 // Add description as navigation point
48 addMenuDescription('member', __FILE__);
50 if ((!isExtensionActive('surfbar')) && (!isAdmin())) {
51 loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('surfbar'));
55 // Still allowed to book more URLs?
56 if (!SURFBAR_IF_USER_BOOK_MORE_URLS()) {
57 // No more URLs allowed to book!
58 loadTemplate('admin_settings_saved', false, getMessage('MEMBER_SURFBAR_NO_MORE_ALLOWED'));
59 } elseif ((isFormSent()) && (isPostRequestElementSet(('limited')))) {
60 // Is limitation "no" and "limit" is > 0?
61 if ((postRequestElement('limited') != 'Y') && ((isPostRequestElementSet(('limit'))) && (postRequestElement('limit') > 0)) || (!isPostRequestElementSet(('limit')))) {
62 // Set it to unlimited
63 setRequestPostElement('limit', 0);
66 // Register the new URL
67 $insertId = SURFBAR_MEMBER_ADD_URL(postRequestElement('url'), postRequestElement('limit'));
69 // By default something went wrong
70 $message = getMessage('MEMBER_SURFBAR_URL_NOT_ADDED');
74 // URL added and waiting for unlock
75 $message = getMessage('MEMBER_SURFBAR_URL_ADDED');
78 // Load message template
79 loadTemplate('admin_settings_saved', false, $message);
81 // Prepare some content
83 'reward' => translateComma(SURFBAR_DETERMINE_REWARD(true)),
84 'costs' => translateComma(SURFBAR_DETERMINE_COSTS(true)),
85 'max_order' => getConfig('surfbar_max_order'),
86 'curr_order' => SURFBAR_GET_TOTAL_USER_URLS()
89 // Load surfbar order form
90 loadTemplate(sprintf("member_surfbar_book_%s", strtolower(getConfig('surfbar_pay_model'))), false, $content);