diff --git a/includes/admin.inc b/includes/admin.inc index d637181ba50..2c1de2e95ab 100644 --- a/includes/admin.inc +++ b/includes/admin.inc @@ -109,8 +109,8 @@ function views_ui_preview($view, $display_id, $args = array()) { $args = array_slice(func_get_args(), 2); } - // Save $_GET['q'] so it can be restored before returning from this function. - $q = $_GET['q']; + // Save the current path so it can be restored before returning from this function. + $old_q = current_path(); // Determine where the query and performance statistics should be output. $show_query = variable_get('views_ui_show_sql_query', FALSE); @@ -161,11 +161,12 @@ function views_ui_preview($view, $display_id, $args = array()) { // Make view links come back to preview. $view->override_path = 'admin/structure/views/nojs/preview/' . $view->name . '/' . $display_id; - // Also override $_GET['q'] so we get the pager. + // Also override the current path so we get the pager. $original_path = current_path(); - $_GET['q'] = $view->override_path; + $q = _current_path($view->override_path); if ($args) { - $_GET['q'] .= '/' . implode('/', $args); + $q .= '/' . implode('/', $args); + _current_path($q); } // Suppress contextual links of entities within the result set during a @@ -178,7 +179,7 @@ function views_ui_preview($view, $display_id, $args = array()) { // Reset variables. unset($view->override_path); - $_GET['q'] = $original_path; + _current_path($original_path); // Prepare the query information and statistics to show either above or // below the view preview. @@ -281,7 +282,7 @@ function views_ui_preview($view, $display_id, $args = array()) { $output .= '
' . theme('table', array('rows' => $rows['statistics'])) . '
'; } - $_GET['q'] = $q; + _current_path($old_q); return $output; } @@ -1440,7 +1441,7 @@ function views_ui_edit_form_submit_preview($form, &$form_state) { function views_ui_edit_form_submit_delay_destination($form, &$form_state) { if (isset($_GET['destination']) && $form_state['redirect'] !== FALSE) { if (!isset($form_state['redirect'])) { - $form_state['redirect'] = $_GET['q']; + $form_state['redirect'] = current_path(); } if (is_string($form_state['redirect'])) { $form_state['redirect'] = array($form_state['redirect']); diff --git a/includes/ajax.inc b/includes/ajax.inc index a71785d0706..e5904cfda36 100644 --- a/includes/ajax.inc +++ b/includes/ajax.inc @@ -41,9 +41,9 @@ function views_ajax() { // Load the view. $view = views_get_view($name); if ($view && $view->access($display_id)) { - // Fix 'q' for paging. + // Fix the current path for paging. if (!empty($path)) { - $_GET['q'] = $path; + _current_path($path); } // Add all $_POST data, because AJAX is always a post and many things, @@ -261,7 +261,7 @@ function views_ajax_form_wrapper($form_id, &$form_state) { } } - $url = empty($form_state['url']) ? url($_GET['q'], array('absolute' => TRUE)) : $form_state['url']; + $url = empty($form_state['url']) ? url(current_path(), array('absolute' => TRUE)) : $form_state['url']; $commands[] = views_ajax_command_set_form($display, $title, $url); diff --git a/plugins/export_ui/views_ui.class.php b/plugins/export_ui/views_ui.class.php index 22b65cb028f..4938248cbbe 100644 --- a/plugins/export_ui/views_ui.class.php +++ b/plugins/export_ui/views_ui.class.php @@ -298,7 +298,7 @@ class views_ui extends ctools_export_ui { 'attributes' => array('title' => $title), 'query' => $query, ); - $link = l($label, $_GET['q'], $link_options); + $link = l($label, current_path(), $link_options); if ($this->active == $field) { $class .= ' active'; } diff --git a/plugins/views_plugin_style_jump_menu.inc b/plugins/views_plugin_style_jump_menu.inc index f571f622575..94612aaad38 100644 --- a/plugins/views_plugin_style_jump_menu.inc +++ b/plugins/views_plugin_style_jump_menu.inc @@ -127,8 +127,8 @@ class views_plugin_style_jump_menu extends views_plugin_style { unset($this->view->row_index); $default_value = ''; - if ($this->options['default_value'] && !empty($paths[url($_GET['q'])])) { - $default_value = $paths[url($_GET['q'])]; + if ($this->options['default_value'] && !empty($paths[url(current_path())])) { + $default_value = $paths[url(current_path())]; } ctools_include('jump-menu'); diff --git a/plugins/views_plugin_style_summary_jump_menu.inc b/plugins/views_plugin_style_summary_jump_menu.inc index 5b02163d85b..be46db72847 100644 --- a/plugins/views_plugin_style_summary_jump_menu.inc +++ b/plugins/views_plugin_style_summary_jump_menu.inc @@ -110,7 +110,7 @@ class views_plugin_style_summary_jump_menu extends views_plugin_style { if (!empty($this->options['count'])) { $options[$key] .= ' (' . intval($row->{$argument->count_alias}) . ')'; } - if ($this->options['default_value'] && $_GET['q'] == $this->view->get_url($args)) { + if ($this->options['default_value'] && current_path() == $this->view->get_url($args)) { $default_value = $key; } } diff --git a/theme/theme.inc b/theme/theme.inc index 5cda7d9a096..333b9ff8e79 100644 --- a/theme/theme.inc +++ b/theme/theme.inc @@ -125,7 +125,7 @@ function template_preprocess_views_view(&$vars) { 'view_name' => $view->name, 'view_display_id' => $view->current_display, 'view_args' => check_plain(implode('/', $view->args)), - 'view_path' => check_plain($_GET['q']), + 'view_path' => check_plain(current_path()), // Pass through URL to ensure we get e.g. language prefixes. // 'view_base_path' => isset($view->display['page']) ? substr(url($view->display['page']->display_options['path']), strlen($base_path)) : '', 'view_base_path' => $view->get_path(), @@ -367,8 +367,8 @@ function template_preprocess_views_view_summary(&$vars) { } $active_urls = drupal_map_assoc(array( - url($_GET['q'], array('alias' => TRUE)), // force system path - url($_GET['q']), // could be an alias + url(current_path(), array('alias' => TRUE)), // force system path + url(current_path()), // could be an alias )); // Collect all arguments foreach row, to be able to alter them for example by the validator. @@ -416,8 +416,8 @@ function template_preprocess_views_view_summary_unformatted(&$vars) { $count = 0; $active_urls = drupal_map_assoc(array( - url($_GET['q'], array('alias' => TRUE)), // force system path - url($_GET['q']), // could be an alias + url(current_path(), array('alias' => TRUE)), // force system path + url(current_path()), // could be an alias )); // Collect all arguments foreach row, to be able to alter them for example by the validator. @@ -519,7 +519,7 @@ function template_preprocess_views_view_table(&$vars) { 'attributes' => array('title' => $title), 'query' => $query, ); - $vars['header'][$field] = l($label, $_GET['q'], $link_options); + $vars['header'][$field] = l($label, current_path(), $link_options); } $vars['header_classes'][$field] = ''; diff --git a/views.module b/views.module index cceebc70017..ca024cef1b9 100644 --- a/views.module +++ b/views.module @@ -1697,7 +1697,7 @@ function views_form($form, &$form_state, $view, $output) { $form_state['cache'] = TRUE; $form = array(); - $query = drupal_get_query_parameters($_GET, array('q')); + $query = drupal_get_query_parameters(); $form['#action'] = url($view->get_url(), array('query' => $query)); // Tell the preprocessor whether it should hide the header, footer, pager... $form['show_view_elements'] = array(