Example #1
0
 case 'blocked_new':
     // Init Email Address to show on the form
     $edited_EmailAddress = new EmailAddress();
     break;
 case 'blocked_save':
     // Update Email Address...
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('email_blocked');
     $action = 'blocked_edit';
     if (!isset($edited_EmailAddress)) {
         // Create a new address
         $edited_EmailAddress = new EmailAddress();
         $action = 'blocked_new';
     }
     // load data from request
     if ($edited_EmailAddress->load_from_Request()) {
         // We could load data from form without errors:
         // Save Email Address in DB:
         $edited_EmailAddress->dbsave();
         $Messages->add(T_('The email address was updated.'), 'success');
         // Redirect so that a reload doesn't write to the DB twice:
         header_redirect('?ctrl=email&tab=blocked', 303);
         // Will EXIT
         // We have EXITed already at this point!!
     }
     break;
 case 'blocked_delete':
     // Delete Email Address...
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('email_blocked');
     // Make sure we got an emadr_ID: