diff options
author | Dries Buytaert <dries@buytaert.net> | 2007-11-17 14:25:23 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2007-11-17 14:25:23 +0000 |
commit | 8ebc345b9ddf0bb7bc3d0f2b412a4c4596e0d7aa (patch) | |
tree | 0ae76974dd0fb47ffaf9c9ac16dddba193a9c758 /modules | |
parent | 6bb15d29daac4b39d2b184928d5c4fa50e7456ab (diff) | |
download | brdo-8ebc345b9ddf0bb7bc3d0f2b412a4c4596e0d7aa.tar.gz brdo-8ebc345b9ddf0bb7bc3d0f2b412a4c4596e0d7aa.tar.bz2 |
- Patch #191914 by chx: you cannot add user/register to a menu. Also removed some whitespace.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/menu/menu.admin.inc | 4 | ||||
-rw-r--r-- | modules/menu/menu.module | 4 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.module | 20 | ||||
-rw-r--r-- | modules/user/user.module | 3 |
4 files changed, 20 insertions, 11 deletions
diff --git a/modules/menu/menu.admin.inc b/modules/menu/menu.admin.inc index c13c88e87..3ac0fcb23 100644 --- a/modules/menu/menu.admin.inc +++ b/modules/menu/menu.admin.inc @@ -27,6 +27,7 @@ function menu_overview_page() { * relevant operations. */ function menu_overview_form(&$form_state, $menu) { + global $menu_admin; $sql =" SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.type, ml.* FROM {menu_links} ml LEFT JOIN {menu_router} m ON m.path = ml.router_path @@ -37,7 +38,10 @@ function menu_overview_form(&$form_state, $menu) { $tree = menu_tree_data($result); $node_links = array(); menu_tree_collect_node_links($tree, $node_links); + // We indicate that a menu admintrator is running the menu access check. + $menu_admin = TRUE; menu_tree_check_access($tree, $node_links); + $menu_admin = FALSE; $form = _menu_overview_tree_form($tree); if (element_children($form)) { diff --git a/modules/menu/menu.module b/modules/menu/menu.module index 7204cd7ba..d5291cf02 100644 --- a/modules/menu/menu.module +++ b/modules/menu/menu.module @@ -450,8 +450,11 @@ function menu_get_menus($all = TRUE) { * FALSE otherwise. */ function menu_valid_path($form_item) { + global $menu_admin; $item = array(); $path = $form_item['link_path']; + // We indicate that a menu administrator is running the menu access check. + $menu_admin = TRUE; if ($path == '<front>' || menu_path_is_external($path)) { $item = array('access' => TRUE); } @@ -468,5 +471,6 @@ function menu_valid_path($form_item) { else { $item = menu_get_item($path); } + $menu_admin = FALSE; return $item && $item['access']; } diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 08f4f321c..7475ae665 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -49,7 +49,7 @@ function taxonomy_link($type, $node = NULL) { if (!empty($node->taxonomy)) { foreach ($node->taxonomy as $term) { // During preview the free tagging terms are in an array unlike the - // other terms which are objects. So we have to check if a $term + // other terms which are objects. So we have to check if a $term // is an object or not. if (is_object($term)) { $links['taxonomy_term_'. $term->tid] = array( @@ -66,7 +66,7 @@ function taxonomy_link($type, $node = NULL) { foreach($typed_terms as $typed_term) { $links['taxonomy_preview_term_'. $typed_term] = array( 'title' => $typed_term, - ); + ); } } } @@ -449,7 +449,7 @@ function taxonomy_form_alter(&$form, $form_state, $form_id) { while ($vocabulary = db_fetch_object($c)) { if ($vocabulary->tags) { if (isset($form_state['node_preview'])) { - // Typed string can be changed by the user before preview, + // Typed string can be changed by the user before preview, // so we just insert the tags directly as provided in the form. $typed_string = $node->taxonomy['tags'][$vocabulary->vid]; } @@ -475,7 +475,7 @@ function taxonomy_form_alter(&$form, $form_state, $form_id) { else { // Extract terms belonging to the vocabulary in question. $default_terms = array(); - foreach ($terms as $term) { + foreach ($terms as $term) { // Free tagging has no default terms and also no vid after preview. if (isset($term->vid) && $term->vid == $vocabulary->vid) { $default_terms[$term->tid] = $term; @@ -487,7 +487,7 @@ function taxonomy_form_alter(&$form, $form_state, $form_id) { } } if (!empty($form['taxonomy']) && is_array($form['taxonomy'])) { - if (count($form['taxonomy']) > 1) { + if (count($form['taxonomy']) > 1) { // Add fieldset only if form has more than 1 element. $form['taxonomy'] += array( '#type' => 'fieldset', @@ -498,7 +498,7 @@ function taxonomy_form_alter(&$form, $form_state, $form_id) { } $form['taxonomy']['#weight'] = -3; $form['taxonomy']['#tree'] = TRUE; - } + } } } @@ -507,8 +507,8 @@ function taxonomy_form_alter(&$form, $form_state, $form_id) { * * After preview the tags are an array instead of proper objects. This function * converts them back to objects with the exception of 'free tagging' terms, - * because new tags can be added by the user before preview and those do not - * yet exist in the database. We therefore save those tags as a string so + * because new tags can be added by the user before preview and those do not + * yet exist in the database. We therefore save those tags as a string so * we can fill the form again after the preview. */ function taxonomy_preview_terms($node) { @@ -519,8 +519,8 @@ function taxonomy_preview_terms($node) { if (is_array($term)) { foreach ($term as $tid) { if ($key == 'tags') { - // Free tagging; the values will be saved for later as strings - // instead of objects to fill the form again. + // Free tagging; the values will be saved for later as strings + // instead of objects to fill the form again. $taxonomy['tags'] = $term; } else { diff --git a/modules/user/user.module b/modules/user/user.module index 5c1b22ed6..88ffcabee 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -817,7 +817,8 @@ function theme_user_list($users, $title = NULL) { } function user_is_anonymous() { - return !$GLOBALS['user']->uid; + // Menu administrators can see items for anonymous when administering. + return !$GLOBALS['user']->uid || !empty($GLOBALS['menu_admin']); } function user_is_logged_in() { |