Exemplo n.º 1
0
     $Session->assert_received_crumb('itemtype');
     // Check permission:
     $current_User->check_perm('options', 'edit', true);
     // Make sure we got an ityp_ID:
     param('ityp_ID', 'integer', true);
     // load data from request
     if ($edited_Itemtype->load_from_Request()) {
         // We could load data from form without errors:
         if (ItemType::is_reserved($edited_Itemtype->ID)) {
             // is reserved post type
             param_error('ityp_ID', sprintf(T_('Post types with IDs = ( %d ) are reserved. You can not edit this post type.'), implode(', ', $posttypes_reserved_IDs)));
         } else {
             // ID is good
             // Update in DB:
             $DB->begin();
             $edited_Itemtype->dbupdate();
             $Messages->add(T_('Post type updated.'), 'success');
             $DB->commit();
             header_redirect($admin_url . '?ctrl=itemtypes&blog=' . $blog . '&tab=' . $tab . '&tab3=' . $tab3 . '', 303);
             // Will EXIT
             // We have EXITed already at this point!!
         }
     }
     break;
 case 'delete':
     // Delete post type:
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('itemtype');
     // Check permission:
     $current_User->check_perm('options', 'edit', true);
     // Make sure we got an ityp_ID: