? login_destination_286877.patch
Index: login_destination.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/login_destination/login_destination.module,v
retrieving revision 1.6.2.3
diff -u -p -r1.6.2.3 login_destination.module
--- login_destination.module	23 Jul 2008 11:37:12 -0000	1.6.2.3
+++ login_destination.module	29 Jul 2008 06:33:30 -0000
@@ -47,12 +47,6 @@ function login_destination_menu() {
     'type' => MENU_NORMAL_ITEM
   );
 
-/*  $items['login_redirect'] = array(
-    'page callback' => 'login_destination_redirect',
-    'access callback' => TRUE,
-    'type' => MENU_CALLBACK
-  );/**/
-
   return $items;
 }
 
@@ -85,8 +79,8 @@ function login_destination_admin_setting
     '#rows' => 4,
     '#description' =>
       t('<b>Static URL mode:</b> Enter a static path. Example paths are %ex1 or %ex2.', array('%ex1' => 'node/add', '%ex2' => 'workspace')). '<br/>'.
-      t("<b>PHP snippet mode:</b> Enter PHP code to evaluate path (<b>NO %php tags!</b>). It should return either a string value or an <b>array('path' => path/alias to redirect, 'query' => parameters, ... [other parameters are equal to the url() function specification]</b>).",
-        array('%php' => '<?php ?>'))
+      t("<b>PHP snippet mode:</b> Enter PHP code to evaluate path. It should return either a string value or an <kbd>array('path' => 'path/alias to redirect', 'options' => array('of parameters'))</kbd> see the <a href='!url-help'>url() documentation</a> for details. <b>Do not include %php tags!</b>",
+        array('%php' => '<?php ?>', '!url-help' => url('http://api.drupal.org/api/function/url/6')))
   );
 
   $form['condition'] = array(
@@ -136,35 +130,8 @@ function login_destination_user($op, &$e
     }
 
     if (is_array($url) && !empty($url['path'])) {
-      //$url = $url['path'] . "?=" . $url['query'];
-      $path = $url['path'];
-      unset($url['path']);
-      $url = str_replace(base_path(), '', url($path, $url));
+      $url = url($url['path'], isset($url['options']) ? $url['options'] : NULL);
     }
-  }
-  //drupal_goto($url['path'], $url['query']);
-  if (login_destination_apply_redirect()) {
-    $_REQUEST['destination'] = $url;
-  }
-}    
-
-/**
- * Callback for login_redirect URL.
- */
-/*function login_destination_redirect() {
-  $destination = variable_get('ld_url_destination', 'user');
-
-  if (variable_get('ld_url_type', LOGIN_DEST_STATIC) == LOGIN_DEST_SNIPPET) {
-    ob_start();
-    $url = eval($destination);
-    ob_end_clean();
-  } else {
-    $url = $destination;
-  }
-
-  if (is_array($url)) {
-    drupal_goto($url['path'], $url['query']);
-  } else {
     drupal_goto($url);
   }
 }
