Mailer project continued:
[mailer.git] / inc / modules / admin / what-list_user_subid.php
index b2bede3bafba00ca0fe836b4a5f5c4635098c5d1..75dba7e9b911740ad9277b5af5dfe2546c9d5e7c 100644 (file)
@@ -47,7 +47,7 @@ addYouAreHereLink('admin', __FILE__);
 $show = true;
 
 // Check for 'id' element
-if ((countRequestPost() > 0) && (!ifPostContainsSelections('id'))) {
+if ((countRequestPost() > 0) && (!ifPostContainsSelections('id')) && (!ifPostContainsSelections('subid'))) {
        // Not found so output message
        displayMessage('{--ADMIN_USER_SUBID_NO_SELECTIONS--}');
 
@@ -56,7 +56,16 @@ if ((countRequestPost() > 0) && (!ifPostContainsSelections('id'))) {
 } // END - if
 
 // Edit or delete button hit?
-if (isFormSent('delete')) {
+if (isFormSent('edit')) {
+       // Show entries for editing
+       showEntriesByXmlCallback('admin_edit_show_user_subid');
+
+       // Do not show the list of URLs after this template
+       $show = false;
+} elseif (isFormSent('do_edit')) {
+       // Change data of entries
+       showEntriesByXmlCallback('admin_edit_do_user_subid');
+} elseif (isFormSent('delete')) {
        // Show entries for deletion
        showEntriesByXmlCallback('admin_delete_show_user_subid');
 
@@ -65,6 +74,27 @@ if (isFormSent('delete')) {
 } elseif (isFormSent('do_delete')) {
        // Remove entries from database
        showEntriesByXmlCallback('admin_delete_do_user_subid');
+} elseif (isFormSent('do_delete_stats')) {
+       // Remove entries from database
+       showEntriesByXmlCallback('admin_delete_do_user_subid_stats');
+} elseif ((isGetRequestElementSet('do')) && (isGetRequestElementSet('id'))) {
+       // Construct module name
+       $incFile = sprintf("inc/modules/admin/subid-%s.php", SQL_ESCAPE(getRequestElement('do')));
+
+       // Is the include readable and is the sub id assigned to current admin?
+       if (!isUserSubIdAssignedToMember(getRequestElement('id'), getRequestElement('userid'))) {
+               // Sub id is not assigned to current admin or doesn't exist
+               reportBug(__FILE__, __LINE__, 'Sub id ' . getRequestElement('id') . ' is not assigned with userid ' .getRequestElement('userid'));
+       } elseif (isIncludeReadable($incFile)) {
+               // Then include it
+               loadIncludeOnce($incFile);
+
+               // Do not show the list of URLs after this template
+               $show = false;
+       } else {
+               // Display error message
+               reportBug(__FILE__, __LINE__, 'Invalid include file ' . basename($incFile) . ' detected.');
+       }
 }
 
 // Show entries?