166e3b0c5f2e720c0ce36de26838d9d3cd887477
[mailer.git] / inc / modules / member / what-subids.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 10/06/2012 *
4  * ===================                          Last change: 10/06/2012 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-subids.php                                  *
8  * -------------------------------------------------------------------- *
9  * Short description : Lists and manages member's own sub ids           *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Auflisten und verwalten der Mitglied-SubIds      *
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         exit();
41 } elseif (!isMember()) {
42         redirectToIndexMemberOnlyModule();
43 }
44
45 // Add description as navigation point
46 addYouAreHereLink('member', __FILE__);
47
48 // Continue only if the proper extension is active (admins can always continue)
49 if ((!isExtensionActive('user')) && (!isAdmin())) {
50         // Required extension ext-user not active
51         displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=user%}');
52
53         // Abort here
54         return;
55 } // END - if
56
57 // By default show the list...
58 $show = TRUE;
59
60 // Check for 'url_id' element
61 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isFormSent()=' . intval(isFormSent('add_subid')) . ',ifPostContainsSelections()=' . intval(ifPostContainsSelections()) . ',countRequestPost()=' . countRequestPost());
62 if ((countRequestPost('id') > 0) && (!isFormSent('add_subid')) && ((!ifPostContainsSelections('id')) || (countRequestPost('id') == 0))) {
63         // Not found so output message
64         displayMessage('{--MEMBER_SUBID_NO_SELECTIONS--}');
65
66         // Abort here
67         return;
68 } // END - if
69
70 // Edit or delete button hit?
71 if (isFormSent('add_subid')) {
72         // Add new sub id
73         doGenericXmlTemplateCallback('member_add_do_user_subid');
74 } elseif (isFormSent('edit')) {
75         // Show entries for editing
76         doGenericXmlTemplateCallback('member_edit_show_user_subid');
77
78         // Do not show the list of URLs after this template
79         $show = FALSE;
80 } elseif (isFormSent('do_edit')) {
81         // Change data of entries
82         doGenericXmlTemplateCallback('member_edit_do_user_subid');
83 } elseif (isFormSent('delete')) {
84         // Show entries for deletion
85         doGenericXmlTemplateCallback('member_delete_show_user_subid');
86
87         // Do not show the list of URLs after this template
88         $show = FALSE;
89 } elseif (isFormSent('do_delete')) {
90         // Remove entries from database
91         doGenericXmlTemplateCallback('member_delete_do_user_subid');
92 } elseif ((isGetRequestElementSet('do')) && (isGetRequestElementSet('id'))) {
93         // Construct module name
94         $incFile = sprintf("inc/modules/member/subid-%s.php", sqlEscapeString(getRequestElement('do')));
95
96         // Is the include readable and is the sub id assigned to current member?
97         if (!isUserSubIdAssignedToMember(getRequestElement('id'))) {
98                 // Sub id is not assigned to current member or doesn't exist
99                 displayMessage('{--MEMBER_USER_SUBID_NOT_ASSIGNED_404--}');
100         } elseif (isIncludeReadable($incFile)) {
101                 // Then include it
102                 loadIncludeOnce($incFile);
103
104                 // Do not show the list of URLs after this template
105                 $show = FALSE;
106         } else {
107                 // Display error message
108                 displayMessage('{--MEMBER_INVALID_DO_USER_SUBID--}');
109         }
110 }
111
112 // Show entries?
113 if ($show === FALSE) {
114         // No, a form has already been show
115         return FALSE;
116 } // END - if
117
118 // List all campaigns
119 doGenericXmlTemplateCallback('member_list_subid');
120
121 // Display form for adding a sub id
122 loadTemplate('member_add_subid');
123
124 // [EOF]
125 ?>