AND itc_coll_ID = ' . $DB->quote($blog)); $Messages->add(T_('Post type has been disabled for this collection.'), 'success'); } } // Redirect so that a reload doesn't write to the DB twice: header_redirect($admin_url . '?ctrl=itemtypes&blog=' . $blog . '&tab=' . $tab . '&tab3=' . $tab3 . '', 303); // Will EXIT // We have EXITed already at this point!! break; case 'default': // Set default item type for the selected collection: // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('itemtype'); // Check permission: $current_User->check_perm('blog_properties', 'edit', true, $blog); if ($edited_Itemtype && !ItemType::is_reserved($edited_Itemtype->ID)) { // Do only when item type exists in DB: // Update default item type to new selected: $Blog->set_setting('default_post_type', $edited_Itemtype->ID); $Blog->dbupdate(); // Enable new default item type for the selected collection automatically: $DB->query('REPLACE INTO T_items__type_coll ( itc_ityp_ID, itc_coll_ID ) VALUES ( ' . $DB->quote($edited_Itemtype->ID) . ', ' . $DB->quote($blog) . ' )'); $Messages->add(T_('The item type has been set as the default for this collection.'), 'success'); } // Redirect so that a reload doesn't write to the DB twice: header_redirect($admin_url . '?ctrl=itemtypes&blog=' . $blog . '&tab=' . $tab . '&tab3=' . $tab3 . '', 303); // Will EXIT // We have EXITed already at this point!! break;
function ityp_row_perm_level($level, $id) { if (ItemType::is_reserved($id)) { // It is reserved item type, Don't display perm level return ''; } $perm_levels = array('standard' => T_('Standard'), 'restricted' => T_('Restricted'), 'admin' => T_('Admin')); return isset($perm_levels[$level]) ? $perm_levels[$level] : $level; }
/** * Assert that the supplied post type can be used by the current user in * the post's extra categories' context. * * @param integer Item type ID * @param array The extra cats of the post. */ function check_perm_posttype($item_typ_ID, $post_extracats) { global $Blog, $current_User; $ItemTypeCache =& get_ItemTypeCache(); $ItemType =& $ItemTypeCache->get_by_ID($item_typ_ID); if (ItemType::is_reserved($ItemType->ID)) { // Don't allow to use a reserved post type: debug_die('This post type is reserved and cannot be used. Please choose another one.'); } if (!$Blog->is_item_type_enabled($ItemType->ID)) { // Don't allow to use a not enabled post type: debug_die('This post type is not enabled. Please choose another one.'); } // Check permission: $current_User->check_perm('cats_item_type_' . $ItemType->perm_level, 'edit', true, $post_extracats); }