Index: customdestination.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/customdestination/customdestination.module,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 customdestination.module
--- customdestination.module	7 Jan 2009 20:55:48 -0000	1.1.2.5
+++ customdestination.module	3 Jun 2009 17:27:30 -0000
@@ -4,7 +4,7 @@
 /**
  * Implementation of hook_help().
  */
-function customdestination_help($path, $arg) {
+function customdestination_help($path) {
   $output = '';
   switch ($path) {
     case "admin/help#customdestination":
@@ -25,39 +25,47 @@
 /**
  * Implementation of hook_menu
  */
-function customdestination_menu() {
-  $items['admin/settings/customdestination'] = array(
-    'title' => 'Custom destination',
-    'description' => 'List of custom destinations set',
-    'page callback' => 'customdestination_overview',
-    'access arguments' => array('administer custom destination'),
-  );
-  $items['admin/settings/customdestination/list'] = array(
-    'title' => 'List',
-    'type' => MENU_DEFAULT_LOCAL_TASK,
-    'weight' => -10,
-  );
-  $items['admin/settings/customdestination/add'] = array(
-    'title' => 'Add custom destination',
-    'description' => 'Add a new custom destination',
-    'page callback' => 'customdestination_edit',
-    'access arguments' => array('access administration pages'),
-    'type' => MENU_LOCAL_TASK,
-  );
-  $items['admin/settings/customdestination/edit'] = array(
-    'title' => 'Edit',
-    'page callback' => 'customdestination_edit',
-    'access arguments' => array('access administration pages'),
-    'type' => MENU_CALLBACK,
-  );
-  $items['admin/settings/customdestination/delete'] = array(
-    'title' => 'Delete custom destination',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('customdestination_delete_confirm'),
-    'access arguments' => array('access administration pages'),
-    'type' => MENU_CALLBACK,
-  );
-
+function customdestination_menu($may_cache) {
+  if ($may_cache) {
+    $items[] = array(
+      'path' => 'admin/settings/customdestination',
+      'title' => t('Custom destination'),
+      'description' => 'List of custom destinations set',
+      'callback' => 'customdestination_overview',
+      'access' => user_access('administer custom destination'),
+    );
+    $items[] = array(
+      'path' => 'admin/settings/customdestination/list',
+      'title' => t('List'),
+      'callback' => 'customdestination_overview',
+      'access' => user_access('administer custom destination'),
+      'type' => MENU_DEFAULT_LOCAL_TASK,
+      'weight' => -10,
+    );
+    $items[] = array(
+      'path' => 'admin/settings/customdestination/add',
+      'title' => t('Add custom destination'),
+      'description' => 'Add a new custom destination',
+      'callback' => 'customdestination_edit',
+      'access' => user_access('administer custom destination'),
+      'type' => MENU_LOCAL_TASK,
+    );
+    $items[] = array(
+      'path' => 'admin/settings/customdestination/edit',
+      'title' => t('Edit'),
+      'callback' => 'customdestination_edit',
+      'access' => user_access('administer custom destination'),
+      'type' => MENU_CALLBACK,
+    );
+    $items[] = array(
+      'path' => 'admin/settings/customdestination/delete',
+      'title' => t('Delete custom destination'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('customdestination_delete_confirm'),
+      'access' => user_access('administer custom destination'),
+      'type' => MENU_CALLBACK,
+    );
+  }
   return $items;
 }
 
@@ -68,7 +76,7 @@
   if (!empty($fid)) {
     $customdestination = customdestination_load($fid);
     drupal_set_title(check_plain($customdestination['fid']));
-    $output = drupal_get_form('customdestination_form', $customdestination);
+    $output = drupal_get_form('customdestination_form', NULL, $customdestination);
   }
   else {
     $output = drupal_get_form('customdestination_form');
@@ -84,11 +92,11 @@
  * @see customdestination_form_validate()
  * @see customdestination_form_submit()
  */
-function customdestination_form(&$form_state, $edit = array('fid' => '', 'dst' => '')) {
+function customdestination_form($param1 = NULL, $form_values = array('fid' => '', 'dst' => '')) {
   $form['fid'] = array(
     '#type' => 'textfield',
     '#title' => t('Form ID'),
-    '#default_value' => $edit['fid'],
+    '#default_value' => $form_values['fid'],
     '#size' => 30,
     '#description' => t("The ID of the form you want to change without quotes."),
     '#required' => TRUE,
@@ -96,12 +104,12 @@
   $form['dst'] = array(
     '#type' => 'textfield',
     '#title' => t('Destination'),
-    '#default_value' => $edit['dst'],
+    '#default_value' => $form_values['dst'],
     '#size' => 30,
     '#description' => t("The destination path to redirect to upon form submission. No leading and trailing slash."),
     '#required' => TRUE,
   );
-  if ($edit['fid']) {
+  if ($form_values['fid']) {
     // use hidden value here if can't usere INSERT OR UPDATE
     $form['submit'] = array('#type' => 'submit', '#value' => t('Update custom destination'));
   }
@@ -115,35 +123,25 @@
 /**
  * Save a new custom destination to the database.
  */
-function customdestination_form_submit($form, &$form_state) {
-  customdestination_save($form_state['values']['fid'], $form_state['values']['dst']);
+function customdestination_form_submit($form_id, $form_values) {
+  customdestination_save($form_values['fid'], $form_values['dst']);
 
   drupal_set_message(t('The custom destination has been saved.'));
-  $form_state['redirect'] = 'admin/settings/customdestination';
-  return;
+  //$form_values['redirect'] = 'admin/settings/customdestination';
+  return 'admin/settings/customdestination';
 }
 
 /**
  * Verify that a new URL alias is valid
  */
-function customdestination_form_validate($form, &$form_state) {
-  $fid = $form_state['values']['fid'];
-  $dst = $form_state['values']['dst'];
+function customdestination_form_validate($form_id, $form_values, $form) {
+  $fid = $form_values['fid'];
+  $dst = $form_values['dst'];
 
   // check if form exists -- see comments in _customdestination_form_exists() body
   if (!_customdestination_form_exists($fid)) {
     form_set_error('fid', t("The form id '@form_id' doesn't exist in the system.", array('@form_id' => $fid)));
   }
-
-  // check if destination exists (check for aliases first)
-  $source = drupal_lookup_path('source', $dst);
-  if (!empty($source)) {
-    $dst = $source;
-  }
-  $item = menu_get_item($dst);
-  if (!$item || !$item['access']) {
-    form_set_error('dst', t("The path '@link_path' is either invalid or you do not have access to it.", array('@link_path' => $dst)));
-  }
 }
 
 /**
@@ -183,7 +181,7 @@
 /**
  * Menu callback; confirms deleting a custom destination
  */
-function customdestination_delete_confirm($form_state, $fid) {
+function customdestination_delete_confirm($fid) {
   $path = customdestination_load($fid);
   if (user_access('access administration pages')) {
     $form['fid'] = array('#type' => 'value', '#value' => $fid);
@@ -197,11 +195,10 @@
 /**
  * Execute URL alias deletion
  */
-function customdestination_delete_confirm_submit($form, &$form_state) {
-  if ($form_state['values']['confirm']) {
-    customdestination_delete($form_state['values']['fid']);
-    $form_state['redirect'] = 'admin/settings/customdestination';
-    return;
+function customdestination_delete_confirm_submit($form_id, $form_values) {
+  if ($form_values['confirm']) {
+    customdestination_delete($form_values['fid']);
+    return 'admin/settings/customdestination';
   }
 }
 
@@ -272,7 +269,7 @@
 /**
  * The core of the module, form_alter #redirect value with custom destination
  */
-function customdestination_form_alter(&$form, $form_state, $form_id) {
+function customdestination_form_alter($form_id, &$form) {
   $customdestination = customdestination_load($form_id);
   if (!empty($customdestination)) {
     $form['#redirect'] = $customdestination['dst'];
Index: customdestination.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/customdestination/customdestination.info,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 customdestination.info
--- customdestination.info	24 May 2008 14:40:04 -0000	1.1.2.1
+++ customdestination.info	3 Jun 2009 17:27:30 -0000
@@ -1,4 +1,3 @@
-; $Id: customdestination.info,v 1.1.2.1 2008/05/24 14:40:04 flevour Exp $
+; $Id$
 name = "Custom destination"
 description = "Programmatically set the destination a form redirects to upon submission."
-core = 6.x
Index: customdestination.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/customdestination/customdestination.install,v
retrieving revision 1.1
diff -u -r1.1 customdestination.install
--- customdestination.install	23 May 2008 18:12:01 -0000	1.1
+++ customdestination.install	3 Jun 2009 17:27:30 -0000
@@ -1,32 +1,18 @@
 <?php
-function customdestination_schema() {
-  $schema['customdestination'] = array(
-    'description' => t('The base table for customdestinations.'),
-    'fields' => array(
-      'fid' => array(
-        'description' => t('The form ID of this customdestination.'),
-        'type' => 'varchar',
-        'length' => 255,
-        'not null' => TRUE,
-        'default' => ''),
-      'dst' => array(
-        'description' => t('The custom destination for this form ID.'),
-        'type' => 'varchar',
-        'length' => 255,
-        'not null' => TRUE,
-        'default' => ''),
-      ),
-    'primary key' => array('fid'),
-  );
-  return $schema;
-}
+// $Id$
 
+/**
+ * Implementation of hook_install().
+ */
 function customdestination_install() {
-  // Create my tables.
-  drupal_install_schema('customdestination');
-}
-
-function customdestination_uninstall() {
-  // Drop my tables.
-  drupal_uninstall_schema('customdestination');
+  switch ($GLOBALS['db_type']) {
+    case 'mysql':
+    case 'mysqli':
+      db_query("CREATE TABLE {customdestination} (
+        fid varchar(255) NOT NULL default '',
+        dst varchar(255) NOT NULL default '',
+        PRIMARY KEY  (fid)
+      ) /*!40100 DEFAULT CHARACTER SET utf8 */");
+      break;
+  }
 }
