Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.55
diff -u -F^f -r1.55 bootstrap.inc
--- includes/bootstrap.inc 3 Jul 2005 10:09:08 -0000 1.55
+++ includes/bootstrap.inc 22 Jul 2005 18:29:44 -0000
@@ -523,16 +523,18 @@ function drupal_lookup_path($action, $pa
* Given an internal Drupal path, return the alias set by the administrator.
*/
function drupal_get_path_alias($path) {
- if ($alias = drupal_lookup_path('source', $path)) {
- return $alias;
- }
- elseif (function_exists('conf_url_rewrite')) {
- return conf_url_rewrite($path, 'outgoing');
+ $alias = drupal_lookup_path('source', $path);
+ if (!$alias && function_exists('conf_url_rewrite')) {
+ $alias = conf_url_rewrite($path, 'outgoing');
}
else {
// No alias found. Return the normal path.
- return $path;
+ $alias = $path;
+ }
+ if (function_exists('i18n_url_rewrite')) {
+ $alias = i18n_url_rewrite($alias);
}
+ return $alias;
}
/**
@@ -790,6 +792,146 @@ function drupal_is_denied($type, $mask)
}
/**
+ * Send the user to a different Drupal page.
+ *
+ * This issues an on-site HTTP redirect. The function makes sure the redirected
+ * URL is formatted correctly.
+ *
+ * Usually the redirected URL is constructed from this function's input
+ * parameters. However you may override that behavior by setting a
+ * destination in either the $_REQUEST-array (i.e. by using
+ * the query string of an URI) or the $_REQUEST['edit']-array (i.e. by
+ * using a hidden form field). This is used to direct the user back to
+ * the proper page after completing a form. For example, after editing
+ * a post on the 'admin/node'-page or after having logged on using the
+ * 'user login'-block in a sidebar. The function drupal_get_destination()
+ * can be used to help set the destination URL.
+ *
+ * It is advised to use drupal_goto() instead of PHP's header(), because
+ * drupal_goto() will append the user's session ID to the URI when PHP is
+ * compiled with "--enable-trans-sid".
+ *
+ * This function ends the request; use it rather than a print theme('page')
+ * statement in your menu callback.
+ *
+ * @param $path
+ * A Drupal path.
+ * @param $query
+ * The query string component, if any.
+ * @param $fragment
+ * The destination fragment identifier (named anchor).
+ *
+ * @see drupal_get_destination()
+ */
+function drupal_goto($path = '', $query = NULL, $fragment = NULL) {
+ if ($_REQUEST['destination']) {
+ extract(parse_url($_REQUEST['destination']));
+ }
+ else if ($_REQUEST['edit']['destination']) {
+ extract(parse_url($_REQUEST['edit']['destination']));
+ }
+
+ $url = url($path, $query, $fragment, TRUE);
+
+ if (ini_get('session.use_trans_sid') && session_id() && !strstr($url, session_id())) {
+ $sid = session_name() . '=' . session_id();
+
+ if (strstr($url, '?') && !strstr($url, $sid)) {
+ $url = $url .'&'. $sid;
+ }
+ else {
+ $url = $url .'?'. $sid;
+ }
+ }
+
+ // Before the redirect, allow modules to react to the end of the page request.
+ module_invoke_all('exit', $url);
+
+ header('Location: '. $url);
+
+ // The "Location" header sends a REDIRECT status code to the http
+ // daemon. In some cases this can go wrong, so we make sure none
+ // of the code below the drupal_goto() call gets executed when we redirect.
+ exit();
+}
+
+/**
+ * Generate an internal Drupal URL.
+ *
+ * @param $path
+ * The Drupal path being linked to, such as "admin/node".
+ * @param $query
+ * A query string to append to the link.
+ * @param $fragment
+ * A fragment identifier (named anchor) to append to the link.
+ * @param $absolute
+ * Whether to force the output to be an absolute link (beginning with http:).
+ * Useful for links that will be displayed outside the site, such as in an RSS feed.
+ * @return
+ * an HTML string containing a link to the given path.
+ *
+ * When creating links in modules, consider whether l() could be a better
+ * alternative than url().
+ */
+function url($path = NULL, $query = NULL, $fragment = NULL, $absolute = FALSE) {
+ global $base_url;
+
+ static $script;
+
+ if (empty($script)) {
+ // On some web servers, such as IIS, we can't omit "index.php". So, we
+ // generate "index.php?q=foo" instead of "?q=foo" on anything that is not
+ // Apache.
+ $script = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === false) ? 'index.php' : '';
+ }
+
+ $path = drupal_get_path_alias($path);
+
+ if (isset($fragment)) {
+ $fragment = '#'. $fragment;
+ }
+
+ $base = ($absolute ? $base_url .'/' : '');
+
+ if (variable_get('clean_url', '0') == '0') {
+ if (isset($path)) {
+ if (isset($query)) {
+ return $base . $script .'?q='. $path .'&'. $query . $fragment;
+ }
+ else {
+ return $base . $script .'?q='. $path . $fragment;
+ }
+ }
+ else {
+ if (isset($query)) {
+ return $base . $script .'?'. $query . $fragment;
+ }
+ else {
+ return $base . $fragment;
+ }
+ }
+ }
+ else {
+ if (isset($path)) {
+ if (isset($query)) {
+ return $base . $path .'?'. $query . $fragment;
+ }
+ else {
+ return $base . $path . $fragment;
+ }
+ }
+ else {
+ if (isset($query)) {
+ return $base . $script .'?'. $query . $fragment;
+ }
+ else {
+ return $base . $fragment;
+ }
+ }
+ }
+}
+
+/**
* A string describing a phase of Drupal to load. Each phase adds to the
* previous one, so invoking a later phase automatically runs the earlier
* phases too. The most important usage is that if you want to access
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.458
diff -u -F^f -r1.458 common.inc
--- includes/common.inc 20 Jul 2005 10:48:20 -0000 1.458
+++ includes/common.inc 22 Jul 2005 18:29:45 -0000
@@ -158,70 +158,6 @@ function drupal_get_destination() {
}
/**
- * Send the user to a different Drupal page.
- *
- * This issues an on-site HTTP redirect. The function makes sure the redirected
- * URL is formatted correctly.
- *
- * Usually the redirected URL is constructed from this function's input
- * parameters. However you may override that behavior by setting a
- * destination in either the $_REQUEST-array (i.e. by using
- * the query string of an URI) or the $_REQUEST['edit']-array (i.e. by
- * using a hidden form field). This is used to direct the user back to
- * the proper page after completing a form. For example, after editing
- * a post on the 'admin/node'-page or after having logged on using the
- * 'user login'-block in a sidebar. The function drupal_get_destination()
- * can be used to help set the destination URL.
- *
- * It is advised to use drupal_goto() instead of PHP's header(), because
- * drupal_goto() will append the user's session ID to the URI when PHP is
- * compiled with "--enable-trans-sid".
- *
- * This function ends the request; use it rather than a print theme('page')
- * statement in your menu callback.
- *
- * @param $path
- * A Drupal path.
- * @param $query
- * The query string component, if any.
- * @param $fragment
- * The destination fragment identifier (named anchor).
- *
- * @see drupal_get_destination()
- */
-function drupal_goto($path = '', $query = NULL, $fragment = NULL) {
- if ($_REQUEST['destination']) {
- extract(parse_url($_REQUEST['destination']));
- }
- else if ($_REQUEST['edit']['destination']) {
- extract(parse_url($_REQUEST['edit']['destination']));
- }
-
- $url = url($path, $query, $fragment, TRUE);
-
- if (ini_get('session.use_trans_sid') && session_id() && !strstr($url, session_id())) {
- $sid = session_name() . '=' . session_id();
-
- if (strstr($url, '?') && !strstr($url, $sid)) {
- $url = $url .'&'. $sid;
- }
- else {
- $url = $url .'?'. $sid;
- }
- }
-
- // Before the redirect, allow modules to react to the end of the page request.
- module_invoke_all('exit', $url);
-
- header('Location: '. $url);
-
- // The "Location" header sends a REDIRECT status code to the http
- // daemon. In some cases this can go wrong, so we make sure none
- // of the code below the drupal_goto() call gets executed when we redirect.
- exit();
-}
-
-/**
* Generates a 404 error if the request can not be handled.
*/
function drupal_not_found() {
@@ -1559,82 +1495,6 @@ function form_clean_id($id = NULL) {
*/
/**
- * Generate an internal Drupal URL.
- *
- * @param $path
- * The Drupal path being linked to, such as "admin/node".
- * @param $query
- * A query string to append to the link.
- * @param $fragment
- * A fragment identifier (named anchor) to append to the link.
- * @param $absolute
- * Whether to force the output to be an absolute link (beginning with http:).
- * Useful for links that will be displayed outside the site, such as in an RSS feed.
- * @return
- * an HTML string containing a link to the given path.
- *
- * When creating links in modules, consider whether l() could be a better
- * alternative than url().
- */
-function url($path = NULL, $query = NULL, $fragment = NULL, $absolute = FALSE) {
- global $base_url;
-
- static $script;
-
- if (empty($script)) {
- // On some web servers, such as IIS, we can't omit "index.php". So, we
- // generate "index.php?q=foo" instead of "?q=foo" on anything that is not
- // Apache.
- $script = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === false) ? 'index.php' : '';
- }
-
- $path = drupal_get_path_alias($path);
-
- if (isset($fragment)) {
- $fragment = '#'. $fragment;
- }
-
- $base = ($absolute ? $base_url .'/' : '');
-
- if (variable_get('clean_url', '0') == '0') {
- if (isset($path)) {
- if (isset($query)) {
- return $base . $script .'?q='. $path .'&'. $query . $fragment;
- }
- else {
- return $base . $script .'?q='. $path . $fragment;
- }
- }
- else {
- if (isset($query)) {
- return $base . $script .'?'. $query . $fragment;
- }
- else {
- return $base . $fragment;
- }
- }
- }
- else {
- if (isset($path)) {
- if (isset($query)) {
- return $base . $path .'?'. $query . $fragment;
- }
- else {
- return $base . $path . $fragment;
- }
- }
- else {
- if (isset($query)) {
- return $base . $script .'?'. $query . $fragment;
- }
- else {
- return $base . $fragment;
- }
- }
- }
-}
-
-/**
* Format an attribute string to insert in a tag.
*
* @param $attributes