Commit 3ffde628 authored by Dries's avatar Dries
Browse files

- Patch #8179 by JonBob: the legacy handlers and file upload previews were...

- Patch #8179 by JonBob: the legacy handlers and file upload previews were mistakenly cached when they cannot be. Attached patch fixes this as well as a reference to an undefined constant in legacy_menu().
parent 2f0221e9
......@@ -25,6 +25,17 @@ function legacy_menu($may_cache) {
$items = array();
if ($may_cache) {
// Map "taxonomy/page/or/52,97" to "taxonomy/term/52+97".
$items[] = array('path' => 'taxonomy/page', 'title' => t('taxonomy'),
'callback' => 'legacy_taxonomy_page',
'access' => TRUE, 'type' => MENU_CALLBACK);
// Map "taxonomy/feed/or/52,97" to "taxonomy/term/52+97/0/feed".
$items[] = array('path' => 'taxonomy/feed', 'title' => t('taxonomy'),
'callback' => 'legacy_taxonomy_feed',
'access' => TRUE, 'type' => MENU_CALLBACK);
}
else {
// Map "node/view/52" to "node/52".
$items[] = array('path' => 'node/view', 'title' => t('view'),
'callback' => 'drupal_goto',
......@@ -42,16 +53,6 @@ function legacy_menu($may_cache) {
'callback' => 'drupal_goto',
'callback arguments' => array('user/'. arg(2), NULL, NULL),
'access' => TRUE, 'type' => MENU_CALLBACK);
// Map "taxonomy/page/or/52,97" to "taxonomy/term/52+97".
$items[] = array('path' => 'taxonomy/page', 'title' => t('taxonomy'),
'callback' => 'legacy_taxonomy_page',
'access' => TRUE, 'type' => MENU_CALLBACK);
// Map "taxonomy/feed/or/52,97" to "taxonomy/term/52+97/0/feed".
$items[] = array('path' => 'taxonomy/feed', 'title' => t('taxonomy'),
'callback' => 'legacy_taxonomy_feed',
'access' => TRUE, 'type' => MENU_CALLBACK);
}
return $items;
......
......@@ -25,6 +25,17 @@ function legacy_menu($may_cache) {
$items = array();
if ($may_cache) {
// Map "taxonomy/page/or/52,97" to "taxonomy/term/52+97".
$items[] = array('path' => 'taxonomy/page', 'title' => t('taxonomy'),
'callback' => 'legacy_taxonomy_page',
'access' => TRUE, 'type' => MENU_CALLBACK);
// Map "taxonomy/feed/or/52,97" to "taxonomy/term/52+97/0/feed".
$items[] = array('path' => 'taxonomy/feed', 'title' => t('taxonomy'),
'callback' => 'legacy_taxonomy_feed',
'access' => TRUE, 'type' => MENU_CALLBACK);
}
else {
// Map "node/view/52" to "node/52".
$items[] = array('path' => 'node/view', 'title' => t('view'),
'callback' => 'drupal_goto',
......@@ -42,16 +53,6 @@ function legacy_menu($may_cache) {
'callback' => 'drupal_goto',
'callback arguments' => array('user/'. arg(2), NULL, NULL),
'access' => TRUE, 'type' => MENU_CALLBACK);
// Map "taxonomy/page/or/52,97" to "taxonomy/term/52+97".
$items[] = array('path' => 'taxonomy/page', 'title' => t('taxonomy'),
'callback' => 'legacy_taxonomy_page',
'access' => TRUE, 'type' => MENU_CALLBACK);
// Map "taxonomy/feed/or/52,97" to "taxonomy/term/52+97/0/feed".
$items[] = array('path' => 'taxonomy/feed', 'title' => t('taxonomy'),
'callback' => 'legacy_taxonomy_feed',
'access' => TRUE, 'type' => MENU_CALLBACK);
}
return $items;
......
......@@ -25,6 +25,14 @@ function upload_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'admin/upload', 'title' => t('uploads'),
'callback' => 'upload_admin',
'access' => user_access('access administration pages'),
'type' => MENU_NORMAL_ITEM
);
}
else {
// Add handlers for previewing new uploads.
if ($_SESSION['file_uploads']) {
foreach ($_SESSION['file_uploads'] as $key => $file) {
......@@ -32,18 +40,12 @@ function upload_menu($may_cache) {
$items[] = array(
'path' => $filename, 'title' => t('file download'),
'callback' => 'upload_download',
'access' => true,
'type' => MENU_DYNAMIC_ITEM & MENU_HIDDEN
'access' => TRUE,
'type' => MENU_CALLBACK
);
$_SESSION['file_uploads'][$key]->_filename = $filename;
}
}
$items[] = array(
'path' => 'admin/upload', 'title' => t('uploads'),
'callback' => 'upload_admin',
'access' => user_access('access administration pages'),
'type' => MENU_NORMAL_ITEM
);
}
return $items;
......
......@@ -25,6 +25,14 @@ function upload_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'admin/upload', 'title' => t('uploads'),
'callback' => 'upload_admin',
'access' => user_access('access administration pages'),
'type' => MENU_NORMAL_ITEM
);
}
else {
// Add handlers for previewing new uploads.
if ($_SESSION['file_uploads']) {
foreach ($_SESSION['file_uploads'] as $key => $file) {
......@@ -32,18 +40,12 @@ function upload_menu($may_cache) {
$items[] = array(
'path' => $filename, 'title' => t('file download'),
'callback' => 'upload_download',
'access' => true,
'type' => MENU_DYNAMIC_ITEM & MENU_HIDDEN
'access' => TRUE,
'type' => MENU_CALLBACK
);
$_SESSION['file_uploads'][$key]->_filename = $filename;
}
}
$items[] = array(
'path' => 'admin/upload', 'title' => t('uploads'),
'callback' => 'upload_admin',
'access' => user_access('access administration pages'),
'type' => MENU_NORMAL_ITEM
);
}
return $items;
......
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