From 14c1c505e0b5915ff85f0698afc209f530fd83fb Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sun, 1 Nov 2009 23:02:13 +0000 Subject: #607008 by dww, Gerhard Killesreiter, JacobSingh, and chx: Changed Fix bugs in https support and use https for authorize.php if available. --- modules/menu/menu.admin.inc | 2 +- modules/shortcut/shortcut.module | 2 +- modules/system/system.module | 24 ++++++++++++++++++++++-- modules/update/update.authorize.inc | 9 ++------- 4 files changed, 26 insertions(+), 11 deletions(-) (limited to 'modules') diff --git a/modules/menu/menu.admin.inc b/modules/menu/menu.admin.inc index 92f78a818..16fcadf7c 100644 --- a/modules/menu/menu.admin.inc +++ b/modules/menu/menu.admin.inc @@ -355,7 +355,7 @@ function menu_edit_item_validate($form, &$form_state) { drupal_set_message(t('The menu system stores system paths only, but will use the URL alias for display. %link_path has been stored as %normal_path', array('%link_path' => $item['link_path'], '%normal_path' => $normal_path))); $item['link_path'] = $normal_path; } - if (!menu_path_is_external($item['link_path'])) { + if (!url_is_external($item['link_path'])) { $parsed_link = parse_url($item['link_path']); if (isset($parsed_link['query'])) { $item['options']['query'] = $parsed_link['query']; diff --git a/modules/shortcut/shortcut.module b/modules/shortcut/shortcut.module index d3c9e2473..4607d4884 100644 --- a/modules/shortcut/shortcut.module +++ b/modules/shortcut/shortcut.module @@ -482,7 +482,7 @@ function shortcut_valid_link($path) { $path = $normal_path; } // Only accept links that correspond to valid paths on the site itself. - return !menu_path_is_external($path) && menu_get_item($path); + return !url_is_external($path) && menu_get_item($path); } /** diff --git a/modules/system/system.module b/modules/system/system.module index c7be27e97..76ea92269 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -1504,10 +1504,19 @@ function system_authorized_init($callback, $file, $arguments = array(), $page_ti /** * Return the URL for the authorize.php script. + * + * @param array $options + * Optional array of options to pass to url(). + * @return + * The full URL to authorize.php, using https if available. */ -function system_authorized_get_url() { +function system_authorized_get_url(array $options = array()) { global $base_url; - return $base_url . '/authorize.php'; + // Force https if available, regardless of what the caller specifies. + $options['https'] = TRUE; + // We prefix with $base_url so we get a full path even if clean URLs are + // disabled. + return url($base_url . '/authorize.php', $options); } /** @@ -1520,6 +1529,17 @@ function system_authorized_run($callback, $file, $arguments = array(), $page_tit drupal_goto(system_authorized_get_url()); } +/** + * Use authorize.php to run batch_process(). + * + * @see batch_process() + */ +function system_authorized_batch_process() { + $finish_url = system_authorized_get_url(); + $process_url = system_authorized_get_url(array('query' => array('batch' => '1'))); + batch_process($finish_url, $process_url); +} + /** * @} End of "defgroup authorize". */ diff --git a/modules/update/update.authorize.inc b/modules/update/update.authorize.inc index 6b7c797a4..0a5514d9d 100644 --- a/modules/update/update.authorize.inc +++ b/modules/update/update.authorize.inc @@ -24,8 +24,6 @@ * - 'local_url': The locally installed location of new code to update with. */ function update_authorize_run_update($filetransfer, $projects) { - global $base_url; - $operations = array(); foreach ($projects as $project => $project_info) { $operations[] = array( @@ -49,7 +47,7 @@ function update_authorize_run_update($filetransfer, $projects) { batch_set($batch); // Invoke the batch via authorize.php. - batch_process($base_url . '/authorize.php', $base_url . '/authorize.php?batch=1'); + system_authorized_batch_process(); } /** @@ -67,8 +65,6 @@ function update_authorize_run_update($filetransfer, $projects) { * already been downloaded and extracted into. */ function update_authorize_run_install($filetransfer, $project, $updater_name, $local_url) { - global $base_url; - $operations[] = array( 'update_authorize_batch_copy_project', array( @@ -91,8 +87,7 @@ function update_authorize_run_install($filetransfer, $project, $updater_name, $l batch_set($batch); // Invoke the batch via authorize.php. - batch_process($base_url . '/authorize.php', $base_url . '/authorize.php?batch=1'); - + system_authorized_batch_process(); } /** -- cgit v1.2.3