diff options
-rw-r--r-- | includes/common.inc | 32 | ||||
-rw-r--r-- | includes/pager.inc | 16 |
2 files changed, 7 insertions, 41 deletions
diff --git a/includes/common.inc b/includes/common.inc index febc9587b..b787945ea 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -719,34 +719,6 @@ function form_weight($title = NULL, $name = "weight", $value = 0, $delta = 10, $ return form_select($title, $name, $value, $weights, $description, $extra); } -/** - * Parse an URL; this function must be follow the changes of a clean url implementation - * - * @param string $url optional, url to parse; default to request_uri() - * @return array $result associative array: - * script => index/node/module/admin - * query => GET variables - * - */ -function drupal_parse_url($url = NULL) { - global $PHP_SELF; - static $cache; - - if ($url == NULL) { - $url = $PHP_SELF ."?". getenv("QUERY_STRING"); - } - - if (!$cache[$url]) { - $parts = parse_url($url); - preg_match("/(\w+?)\.php/", $parts["path"], $found); - $cache[$url]["script"] = $found[1]; - parse_str($parts["query"], $cache[$url]["query"]); - $cache[$url]["anchor"] = $parts["fragment"]; - } - - return $cache[$url]; -} - function url($url, $query = NULL) { if ($url) { @@ -766,10 +738,6 @@ function url($url, $query = NULL) { function l($text, $url, $attributes = array(), $query = NULL) { - if (!is_array($attributes)) { - print "$text - $url"; - } - $t = array(); foreach ($attributes as $key => $value) { $t[] = "$key=\"$value\""; diff --git a/includes/pager.inc b/includes/pager.inc index 0ec810171..28d96c743 100644 --- a/includes/pager.inc +++ b/includes/pager.inc @@ -282,21 +282,19 @@ function pager_query($query, $limit = 10, $element = 0) { } function pager_link($from_new, $attributes = array()) { - $url = drupal_parse_url(); - if (count($from_new) == 0 || (count($from_new) == 1 && $from_new[0] == 0)) { - unset($url["query"]["from"]); - } - else { - $url["query"]["from"] = implode(",", $from_new); + foreach($attributes as $key => $value) { + $query[] = "$key=$value"; } if (count($attributes)) { - $url["query"] = array_merge($url["query"], $attributes); + $url = url("", "from=". $from_new[0] ."&". implode("&", $query)); + } + else { + $url = url("", "from=". $from_new[0]); } - // TODO: should use 'url()': - // return drupal_url($url["query"], $url["script"]); + return $url; } function pager_load_array($value, $element, $old_array) { |