]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-subids.php
Updated copyright year.
[mailer.git] / inc / modules / member / what-subids.php
index 3ca4364019432a921d15c80c6a3bdb6e1147cce3..93cd3125707af9bc5b99acfdbd84ad327e409084 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2016 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -55,11 +55,11 @@ if ((!isExtensionActive('user')) && (!isAdmin())) {
 } // END - if
 
 // By default show the list...
-$show = true;
+$show = TRUE;
 
 // Check for 'url_id' element
 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isFormSent()=' . intval(isFormSent('add_subid')) . ',ifPostContainsSelections()=' . intval(ifPostContainsSelections()) . ',countRequestPost()=' . countRequestPost());
-if ((!isFormSent('add_subid')) && ((!ifPostContainsSelections()) || (countRequestPost() == 0))) {
+if ((countRequestPost('id') > 0) && (!isFormSent('add_subid')) && ((!ifPostContainsSelections('id')) || (countRequestPost('id') == 0))) {
        // Not found so output message
        displayMessage('{--MEMBER_SUBID_NO_SELECTIONS--}');
 
@@ -70,35 +70,53 @@ if ((!isFormSent('add_subid')) && ((!ifPostContainsSelections()) || (countReques
 // Edit or delete button hit?
 if (isFormSent('add_subid')) {
        // Add new sub id
-       showEntriesByXmlCallback('member_add_do_subid');
+       doGenericXmlTemplateCallback('member_add_do_user_subid');
 } elseif (isFormSent('edit')) {
        // Show entries for editing
-       showEntriesByXmlCallback('member_edit_show_subid');
+       doGenericXmlTemplateCallback('member_edit_show_user_subid');
 
        // Do not show the list of URLs after this template
-       $show = false;
+       $show = FALSE;
 } elseif (isFormSent('do_edit')) {
        // Change data of entries
-       showEntriesByXmlCallback('member_edit_do_subid');
+       doGenericXmlTemplateCallback('member_edit_do_user_subid');
 } elseif (isFormSent('delete')) {
        // Show entries for deletion
-       showEntriesByXmlCallback('member_delete_show_subid');
+       doGenericXmlTemplateCallback('member_delete_show_user_subid');
 
        // Do not show the list of URLs after this template
-       $show = false;
+       $show = FALSE;
 } elseif (isFormSent('do_delete')) {
        // Remove entries from database
-       showEntriesByXmlCallback('member_delete_do_subid');
+       doGenericXmlTemplateCallback('member_delete_do_user_subid');
+} elseif ((isGetRequestElementSet('do')) && (isGetRequestElementSet('id'))) {
+       // Construct module name
+       $incFile = sprintf('inc/modules/member/subid-%s.php', sqlEscapeString(getRequestElement('do')));
+
+       // Is the include readable and is the sub id assigned to current member?
+       if (!isUserSubIdAssignedToMember(getRequestElement('id'))) {
+               // Sub id is not assigned to current member or doesn't exist
+               displayMessage('{--MEMBER_USER_SUBID_NOT_ASSIGNED_404--}');
+       } elseif (isIncludeReadable($incFile)) {
+               // Then include it
+               loadIncludeOnce($incFile);
+
+               // Do not show the list of URLs after this template
+               $show = FALSE;
+       } else {
+               // Display error message
+               displayMessage('{--MEMBER_INVALID_DO_USER_SUBID--}');
+       }
 }
 
 // Show entries?
-if ($show === false) {
+if ($show === FALSE) {
        // No, a form has already been show
-       return false;
+       return FALSE;
 } // END - if
 
 // List all campaigns
-showEntriesByXmlCallback('member_list_subid');
+doGenericXmlTemplateCallback('member_list_subid');
 
 // Display form for adding a sub id
 loadTemplate('member_add_subid');