Example #1
0
     $current_User->check_perm('options', 'edit', true);
     $edited_ItemTag = new ItemTag();
     break;
 case 'edit':
     // Check permission:
     $current_User->check_perm('options', 'edit', true);
     break;
 case 'create':
     // Create new tag...
     $edited_ItemTag = new ItemTag();
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('tag');
     // Check that current user has permission to create tags:
     $current_User->check_perm('options', 'edit', true);
     // load data from request
     if ($edited_ItemTag->load_from_Request()) {
         // We could load data from form without errors:
         // Insert in DB:
         $edited_ItemTag->dbinsert();
         $Messages->add(T_('New tag has been created.'), 'success');
         // Redirect so that a reload doesn't write to the DB twice:
         header_redirect($admin_url . '?ctrl=itemtags', 303);
         // Will EXIT
         // We have EXITed already at this point!!
     }
     $action = 'new';
     break;
 case 'update':
     // Update tag...
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('tag');