Commit 8ebc345b authored by Dries's avatar Dries

- Patch #191914 by chx: you cannot add user/register to a menu. Also removed some whitespace.

parent 6bb15d29
...@@ -128,7 +128,7 @@ INSTALLATION ...@@ -128,7 +128,7 @@ INSTALLATION
some temporary files. On some installations, it may be necessary to modify some temporary files. On some installations, it may be necessary to modify
the file system path, especially in large or multi-site configurations. See the the file system path, especially in large or multi-site configurations. See the
files/README.txt file for more information about setting the file system path. files/README.txt file for more information about setting the file system path.
6. CRON TASKS 6. CRON TASKS
Many Drupal modules (such as the search functionality) have periodic tasks Many Drupal modules (such as the search functionality) have periodic tasks
......
...@@ -27,6 +27,7 @@ function menu_overview_page() { ...@@ -27,6 +27,7 @@ function menu_overview_page() {
* relevant operations. * relevant operations.
*/ */
function menu_overview_form(&$form_state, $menu) { function menu_overview_form(&$form_state, $menu) {
global $menu_admin;
$sql =" $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.* 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 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) { ...@@ -37,7 +38,10 @@ function menu_overview_form(&$form_state, $menu) {
$tree = menu_tree_data($result); $tree = menu_tree_data($result);
$node_links = array(); $node_links = array();
menu_tree_collect_node_links($tree, $node_links); 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_tree_check_access($tree, $node_links);
$menu_admin = FALSE;
$form = _menu_overview_tree_form($tree); $form = _menu_overview_tree_form($tree);
if (element_children($form)) { if (element_children($form)) {
......
...@@ -450,8 +450,11 @@ function menu_get_menus($all = TRUE) { ...@@ -450,8 +450,11 @@ function menu_get_menus($all = TRUE) {
* FALSE otherwise. * FALSE otherwise.
*/ */
function menu_valid_path($form_item) { function menu_valid_path($form_item) {
global $menu_admin;
$item = array(); $item = array();
$path = $form_item['link_path']; $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)) { if ($path == '<front>' || menu_path_is_external($path)) {
$item = array('access' => TRUE); $item = array('access' => TRUE);
} }
...@@ -468,5 +471,6 @@ function menu_valid_path($form_item) { ...@@ -468,5 +471,6 @@ function menu_valid_path($form_item) {
else { else {
$item = menu_get_item($path); $item = menu_get_item($path);
} }
$menu_admin = FALSE;
return $item && $item['access']; return $item && $item['access'];
} }
...@@ -49,7 +49,7 @@ function taxonomy_link($type, $node = NULL) { ...@@ -49,7 +49,7 @@ function taxonomy_link($type, $node = NULL) {
if (!empty($node->taxonomy)) { if (!empty($node->taxonomy)) {
foreach ($node->taxonomy as $term) { foreach ($node->taxonomy as $term) {
// During preview the free tagging terms are in an array unlike the // 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. // is an object or not.
if (is_object($term)) { if (is_object($term)) {
$links['taxonomy_term_'. $term->tid] = array( $links['taxonomy_term_'. $term->tid] = array(
...@@ -66,7 +66,7 @@ function taxonomy_link($type, $node = NULL) { ...@@ -66,7 +66,7 @@ function taxonomy_link($type, $node = NULL) {
foreach($typed_terms as $typed_term) { foreach($typed_terms as $typed_term) {
$links['taxonomy_preview_term_'. $typed_term] = array( $links['taxonomy_preview_term_'. $typed_term] = array(
'title' => $typed_term, 'title' => $typed_term,
); );
} }
} }
} }
...@@ -449,7 +449,7 @@ function taxonomy_form_alter(&$form, $form_state, $form_id) { ...@@ -449,7 +449,7 @@ function taxonomy_form_alter(&$form, $form_state, $form_id) {
while ($vocabulary = db_fetch_object($c)) { while ($vocabulary = db_fetch_object($c)) {
if ($vocabulary->tags) { if ($vocabulary->tags) {
if (isset($form_state['node_preview'])) { 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. // so we just insert the tags directly as provided in the form.
$typed_string = $node->taxonomy['tags'][$vocabulary->vid]; $typed_string = $node->taxonomy['tags'][$vocabulary->vid];
} }
...@@ -475,7 +475,7 @@ function taxonomy_form_alter(&$form, $form_state, $form_id) { ...@@ -475,7 +475,7 @@ function taxonomy_form_alter(&$form, $form_state, $form_id) {
else { else {
// Extract terms belonging to the vocabulary in question. // Extract terms belonging to the vocabulary in question.
$default_terms = array(); $default_terms = array();
foreach ($terms as $term) { foreach ($terms as $term) {
// Free tagging has no default terms and also no vid after preview. // Free tagging has no default terms and also no vid after preview.
if (isset($term->vid) && $term->vid == $vocabulary->vid) { if (isset($term->vid) && $term->vid == $vocabulary->vid) {
$default_terms[$term->tid] = $term; $default_terms[$term->tid] = $term;
...@@ -487,7 +487,7 @@ function taxonomy_form_alter(&$form, $form_state, $form_id) { ...@@ -487,7 +487,7 @@ function taxonomy_form_alter(&$form, $form_state, $form_id) {
} }
} }
if (!empty($form['taxonomy']) && is_array($form['taxonomy'])) { 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. // Add fieldset only if form has more than 1 element.
$form['taxonomy'] += array( $form['taxonomy'] += array(
'#type' => 'fieldset', '#type' => 'fieldset',
...@@ -498,7 +498,7 @@ function taxonomy_form_alter(&$form, $form_state, $form_id) { ...@@ -498,7 +498,7 @@ function taxonomy_form_alter(&$form, $form_state, $form_id) {
} }
$form['taxonomy']['#weight'] = -3; $form['taxonomy']['#weight'] = -3;
$form['taxonomy']['#tree'] = TRUE; $form['taxonomy']['#tree'] = TRUE;
} }
} }
} }
...@@ -507,8 +507,8 @@ function taxonomy_form_alter(&$form, $form_state, $form_id) { ...@@ -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 * 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, * 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 * 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 * yet exist in the database. We therefore save those tags as a string so
* we can fill the form again after the preview. * we can fill the form again after the preview.
*/ */
function taxonomy_preview_terms($node) { function taxonomy_preview_terms($node) {
...@@ -519,8 +519,8 @@ function taxonomy_preview_terms($node) { ...@@ -519,8 +519,8 @@ function taxonomy_preview_terms($node) {
if (is_array($term)) { if (is_array($term)) {
foreach ($term as $tid) { foreach ($term as $tid) {
if ($key == 'tags') { if ($key == 'tags') {
// Free tagging; the values will be saved for later as strings // Free tagging; the values will be saved for later as strings
// instead of objects to fill the form again. // instead of objects to fill the form again.
$taxonomy['tags'] = $term; $taxonomy['tags'] = $term;
} }
else { else {
......
...@@ -817,7 +817,8 @@ function theme_user_list($users, $title = NULL) { ...@@ -817,7 +817,8 @@ function theme_user_list($users, $title = NULL) {
} }
function user_is_anonymous() { 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() { function user_is_logged_in() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment