d38757f1f0a207aa3bf84f07a486a8ddaaa9c221
[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  *                                                                      *
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, or    *
21  * (at your option) any later version.                                  *
22  *                                                                      *
23  * This program is distributed in the hope that it will be useful,      *
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
26  * GNU General Public License for more details.                         *
27  *                                                                      *
28  * You should have received a copy of the GNU General Public License    *
29  * along with this program; if not, write to the Free Software          *
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if (!defined('__SECURITY')) {
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
37         require($INC);
38 } elseif (!IS_MEMBER()) {
39         // Redirect
40         LOAD_URL(URL."/modules.php?module=index");
41 } elseif ((!EXT_IS_ACTIVE("surfbar")) && (!IS_ADMIN())) {
42         ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "surfbar");
43         return;
44 }
45
46 // Add description as navigation point
47 ADD_DESCR("member", __FILE__);
48
49 // Still allowed to book more URLs?
50 if (!SURFBAR_IF_USER_BOOK_MORE_URLS()) {
51         // No more URLs allowed to book!
52         LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_SURFBAR_NO_MORE_ALLOWED);
53 } elseif ((isset($_POST['ok'])) && (isset($_POST['limited']))) {
54         // Is limitation "no" and "limit" is > 0?
55         if (($_POST['limited'] == "N") && ((isset($_POST['limit'])) && ($_POST['limit'] > 0)) || (!isset($_POST['limit']))) {
56                 // Set it to unlimited
57                 $_POST['limit'] = 0;
58         } // END - if
59
60         // Register the new URL
61         $insertId = SURFBAR_MEMBER_ADD_URL($_POST['url'], $_POST['limit']);
62
63         // By default something went wrong
64         $msg = MEMBER_SURFBAR_URL_NOT_ADDED;
65
66         // Was this fine?
67         if ($insertId > 0) {
68                 // URL added and waiting for unlock
69                 $msg = MEMBER_SURFBAR_URL_ADDED;
70         } // END - if
71
72         // Load message template
73         LOAD_TEMPLATE("admin_settings_saved", false, $msg);
74 } else {
75         // Prepare some content
76         $content = array(
77                 'reward'     => TRANSLATE_COMMA(SURFBAR_DETERMINE_REWARD(true)),
78                 'costs'      => TRANSLATE_COMMA(SURFBAR_DETERMINE_COSTS(true)),
79                 'max_order'  => getConfig('surfbar_max_order'),
80                 'curr_order' => SURFBAR_GET_TOTAL_USER_URLS()
81         );
82
83         // Load surfbar order form
84         LOAD_TEMPLATE(sprintf("member_surfbar_book_%s", strtolower(getConfig('surfbar_pay_model'))), false, $content);
85 }
86
87 //
88 ?>