Index: signup.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/signup/signup.install,v
retrieving revision 1.16
diff -u -r1.16 signup.install
--- signup.install	22 Dec 2007 09:07:18 -0000	1.16
+++ signup.install	31 Jul 2008 14:56:24 -0000
@@ -4,101 +4,121 @@
 /**
  * Implementation of hook_install()
  *
- * This will automatically install the database tables for the Signup
- * module for both the MySQL and PostgreSQL databases.
- *
- * If you are using another database, you will have to install the
- * tables by hand, using the queries below as a reference.
- *
- * Note that the curly braces around table names are a drupal-specific
- * feature to allow for automatic database table prefixing, and will
- * need to be removed.
- */
-function signup_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysqli':
-    case 'mysql':
-      $q1 = db_query("CREATE TABLE IF NOT EXISTS {signup} (
-                nid int(10) unsigned NOT NULL default '0',
-                forwarding_email varchar(64) NOT NULL default '',
-                send_confirmation int(2) NOT NULL default '0',
-                confirmation_email longtext NOT NULL,
-                send_reminder int(2) NOT NULL default '0',
-                reminder_days_before int(4) unsigned NOT NULL default '0',
-                reminder_email longtext NOT NULL,
-                close_in_advance_time int(10) unsigned NOT NULL default '0',
-                close_signup_limit int(10) unsigned NOT NULL default '0',
-                status int(2) NOT NULL default '1',
-                PRIMARY KEY  (nid)
-            ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-
-      $q2 = db_query("CREATE TABLE IF NOT EXISTS {signup_log} (
-                uid int(10) unsigned NOT NULL default '0',
-                nid int(10) unsigned NOT NULL default '0',
-                anon_mail varchar(255) NOT NULL default '',
-                signup_time int(10) unsigned NOT NULL default '0',
-                form_data longtext NOT NULL,
-                KEY uid (uid),
-                KEY nid (nid)
-            ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-
-      $q3 = signup_insert_default_signup_info();
-
-      if ($q1 && $q2 && $q3) {
-        $created = TRUE;
-      }
-      break;
 
-    case 'pgsql':
-      $q1 = db_query("CREATE TABLE {signup} (
-                nid SERIAL,
-                forwarding_email text NOT NULL default '',
-                send_confirmation integer NOT NULL default '0',
-                confirmation_email text NOT NULL default '',
-                send_reminder integer NOT NULL default '0',
-                reminder_days_before integer NOT NULL default '0',
-                reminder_email text NOT NULL default '',
-                close_in_advance_time integer NOT NULL default '0',
-                close_signup_limit integer NOT NULL default '0',
-                status integer NOT NULL default '1',
-                PRIMARY KEY (nid)
-            );");
+function signup_schema() {
+  $schema['signup'] = array(
+     'description' => t('Signup module per-node settings.'),
+     'fields' => array(
+      'nid' => array(
+        'description' => t('Identifier for nodes.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0),
+      'forwarding_email' => array(
+        'description' => t('Email to send signup notifications to.'),
+        'type' => 'varchar',
+        'length' => 64,
+        'not null' => TRUE,
+        'default' => ''),
+      'send_confirmation' => array(
+        'description' => t('Should a confirmation be sent?'),
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0),
+      'confirmation_email' => array(
+        'description' => t('Email to send when user signs up.'),
+        'type' => 'text',
+        'size' => 'medium',
+        'not null' => TRUE,
+        'default' => ''),
+      'send_reminder' => array(
+        'description' => t('Send a reminder?.'),
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0),
+      'reminder_days_before' => array(
+        'description' => t('How many days before the event?'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0),
+      'reminder_email' => array(
+        'description' => t('Email to send for reminder.'),
+        'type' => 'varchar',
+        'length' => 64,
+        'not null' => TRUE,
+        'default' => ''),
+      'close_in_advance_time' => array(
+        'description' => t('How many hours before the event should it be closed?'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0),
+      'close_signup_limit' => array(
+        'description' => t('Max number of signups before signup is closed.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0),
+      'status' => array(
+        'description' => t('Signup status: 1=enabled, 0=disabled.'),
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 1),
+      ),
 
-      $q2 = db_query("CREATE TABLE {signup_log} (
-                uid integer NOT NULL default '0',
-                nid integer NOT NULL default '0',
-                anon_mail text NOT NULL default '',
-                signup_time integer NOT NULL default '0',
-                form_data text NOT NULL default ''
-            );");
+    'primary key' => array('nid'),
 
-      $q3 = db_query("CREATE INDEX {signup_log}_uid_idx ON {signup_log}(uid);");
-
-      $q4 = db_query("CREATE INDEX {signup_log}_nid_idx ON {signup_log}(nid);");
-
-      $q5 = signup_insert_default_signup_info();
-
-      if ($q1 && $q2 && $q3 && $q4 && $q5) {
-        $created = TRUE;
-      }
-      break;
-  }
+  );
+  $schema['signup_log'] = array(
+    'description' => t('Signup module table for recording signups.'),
+    'fields' => array(
+      'nid' => array(
+        'description' => t('Identifier for nodes.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0),
+      'uid' => array(
+        'description' => t('Identifier for user.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0),
+      'anon_mail' => array(
+        'description' => t('Email, is user is anonymous.'),
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default' => ''),
+      'signup_time' => array(
+        'description' => t('Signup time.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0),
+      'form_data' => array(
+        'description' => t('Other values saved and displayed.'),
+        'type' => 'text',
+        'size' => 'medium',
+        'not null' => TRUE),
+    ),
+    'indexes' => array(
+      'nodeid'        => array('nid'),
+      'userid'        => array('uid'),
+    ),
+  );
+  return $schema;
+}
 
-  if ($created) {
-    drupal_set_message(t('Signup module installed successfully.'));
-  }
-  else {
-    drupal_set_message(t('Table installation for the Signup module was unsuccessful. The tables may need to be installed by hand. See the signup.install file for a list of the installation queries.'), 'error');
-  }
+function signup_install() {
+  drupal_install_schema('signup');
+  signup_insert_default_signup_info();
 }
 
 function signup_uninstall() {
-  if (db_table_exists('signup')) {
-    db_query("DROP TABLE {signup}");
-  }
-  if (db_table_exists('signup_log')) {
-    db_query("DROP TABLE {signup_log}");
-  }
+  drupal_uninstall_schema('signup');
   $variables = db_query("SELECT name FROM {variable} WHERE name LIKE 'signup%%'");
   while ($variable = db_fetch_object($variables)) {
     variable_del($variable->name);
@@ -118,178 +138,3 @@
     1, 'Enter your default confirmation email message here',
     1, 0, 'Enter your default reminder email message here', 0, 0, 1)");
 }
-
-/**
- * UTF8 table update
- */
-function signup_update_1() {
-  return _system_update_utf8(array('signup', 'signup_log'));
-}
-
-function signup_update_2() {
-  $ret = array();
-  $ret[] = update_sql("ALTER TABLE {signup} DROP permissions");
-  return $ret;
-}
-
-function signup_update_3() {
-  $ret = array();
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      $ret[] = update_sql("ALTER TABLE {signup_log} ADD anon_mail VARCHAR( 255 ) NOT NULL default '' AFTER nid;");
-      $ret[] = update_sql("ALTER TABLE {signup_log} DROP INDEX uid_nid;");
-      $ret[] = update_sql("ALTER TABLE {signup_log} ADD INDEX (uid);");
-      $ret[] = update_sql("ALTER TABLE {signup_log} ADD INDEX (nid);");
-    break;
-
-    case 'pgsql':
-      db_add_column($ret, 'signup_log', 'anon_mail', 'text', array('not null' => TRUE, 'default' => "''"));
-      $ret[] = update_sql("DROP INDEX {signup_log}_uid_nid_idx;");
-      $ret[] = update_sql("CREATE INDEX {signup_log}_uid_idx ON {signup_log}(uid);");
-      $ret[] = update_sql("CREATE INDEX {signup_log}_nid_idx ON {signup_log}(nid);");
-    break;
-
-  }
-  return $ret;
-}
-
-/**
- * Rename the signup permissions.
- * See http://drupal.org/node/69283 for details.
- * Also, remove the 'signup_user_view' setting in favor of a permission.
- * See http://drupal.org/node/69367 for details.
- */
-function signup_update_4() {
-  $ret = array();
-
-  // Setup arrays holding regexps to match and the corresponding
-  // strings to replace them with, for use with preg_replace().
-  $old_perms = array(
-    '/allow signups/',
-    '/admin signups/',
-    '/admin own signups/',
-  );
-  $new_perms = array(
-    'sign up for content',
-    'administer all signups',
-    'administer signups for own content',
-  );
-
-  // Now, loop over all the roles, and do the necessary transformations.
-  $query = db_query("SELECT rid, perm FROM {permission} ORDER BY rid");
-  while ($role = db_fetch_object($query)) {
-    $fixed_perm = preg_replace($old_perms, $new_perms, $role->perm);
-    if ($role->rid == 2 && variable_get('signup_user_view', 0)) {
-      // The setting is currently enabled, so add the new permission to
-      // the "authenticated user" role as a reasonable default.
-      if (!strpos($fixed_perm, 'view all signups')) {
-        $fixed_perm .= ', view all signups';
-        drupal_set_message(t('The old %signup_user_view setting was enabled on your site, so the %view_all_signups permission has been added to the %authenticated_user role. Please consider customizing what roles have this permission on the !access_control page.', array('%signup_user_view' => t('Users can view signups'), '%view_all_signups' => 'view all signups', '%authenticated_user' => 'Authenticated user', '!access_control' => l(t('Access control'), '/admin/user/access'))));
-      }
-    }
-    $ret[] = update_sql("UPDATE {permission} SET perm = '$fixed_perm' WHERE rid = $role->rid");
-  }
-
-  // Remove the stale setting from the {variable} table in the DB.
-  variable_del('signup_user_view');
-  drupal_set_message(t('The %signup_user_view setting has been removed.', array('%signup_user_view' => t('Users can view signups'))));
-
-  return $ret;
-}
-
-/**
- * Convert the misnamed "completed" column to "status" (and swap all
- * the values: 0 == closed, 1 == open).
- */
-function signup_update_5200() {
-  $ret = array();
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      $ret[] = update_sql("ALTER TABLE {signup} ADD status int NOT NULL default '1'");
-      break;
-    case 'pgsql':
-      db_add_column($ret, 'signup', 'status', 'integer', array('not null' => TRUE, 'default' => "'1'"));
-      break;
-  }
-  $ret[] = update_sql("UPDATE {signup} SET status = (1 - completed)");
-  $ret[] = update_sql("ALTER TABLE {signup} DROP completed");
-  return $ret;
-}
-
-/**
- * Add the close_signup_limit field to the {signup} table to allow
- * signup limits for sites that upgraded from 4.6.x.  The original
- * signup.install for 4.7.x accidentally included this column in the
- * DB, but it's never been used in the code until now.  However, sites
- * that upgraded from 4.6.x need this column for the module to work,
- * so just to be safe, we also add that here.
- */
-function signup_update_5201() {
-  $ret = array();
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      if (!_signup_db_column_exists('signup', 'close_signup_limit')) {
-        $ret[] = update_sql("ALTER TABLE {signup} ADD close_signup_limit int(10) unsigned NOT NULL default '0'");
-      }
-      break;
-
-    case 'pgsql':
-      if (!_signup_db_column_exists('signup', 'close_signup_limit')) {
-        db_add_column($ret, 'signup', 'close_signup_limit', 'integer', array('not null' => TRUE, 'default' => "'0'"));
-      }
-      break;
-  }
-  return $ret;
-}
-
-/**
- * Add "cancel own signups" permission to all roles that have "sign up
- * for content" permission.
- */
-function signup_update_5202() {
-  $ret = array();
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      $ret[] = update_sql("UPDATE {permission} SET perm = CONCAT(perm, ', cancel own signups') WHERE CONCAT(perm, ', ') LIKE '%%sign up for content, %%'");
-      break;
-
-    case 'pgsql':
-      $ret[] = update_sql("UPDATE {permission} SET perm = perm || ', cancel own signups' WHERE perm || ', ' LIKE '%%sign up for content, %%'");
-      break;
-  }
-  drupal_set_message(t("Added the 'cancel own signups' permission to all roles that have the 'sign up for content' permission.") .'<br />'. t('If you do not want your users to cancel their own signups, go to the <a href="@access_url">Access control</a> page and unset this permission.', array('@access_url' => url('/admin/user/access'))));
-  return $ret;
-}
-
-/**
- * Migrate signup settings per content type so that signups can be disabled
- * completely for a content type.
- */
-function signup_update_5203() {
-  $old_prefix = 'signup_form_';
-  $result = db_query("SELECT name FROM {variable} WHERE name LIKE '$old_prefix%%'");
-  while ($row = db_fetch_object($result)) {
-    $old_name = $row->name;
-    $new_name = 'signup_node_default_state_'. substr($old_name, strlen($old_prefix));
-    $new_value = variable_get($old_name, 0) == 1 ? 'enabled_on' : 'disabled';
-    variable_del($old_name);
-    variable_set($new_name, $new_value);
-  }
-  drupal_set_message(t('Migrated signup settings per content type.'));
-  return array();
-}
-
-
-function _signup_db_column_exists($table, $column) {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      return db_num_rows(db_query("SHOW COLUMNS FROM {%s} LIKE '%s'", $table, $column));
-    case 'pgsql':
-      return db_result(db_query("SELECT COUNT(pg_attribute.attname) FROM pg_class, pg_attribute WHERE pg_attribute.attrelid = pg_class.oid AND pg_class.relname = '{%s}' AND attname='%s'", $table, $column));
-  }
-}
Index: signup.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/signup/signup.module,v
retrieving revision 1.129
diff -u -r1.129 signup.module
--- signup.module	26 Jan 2008 03:02:39 -0000	1.129
+++ signup.module	31 Jul 2008 14:47:44 -0000
@@ -1,6 +1,10 @@
 <?php
 // $Id: signup.module,v 1.129 2008/01/26 03:02:39 dww Exp $
 
+if (!module_exists('views')) {
+  require_once(drupal_get_path('module', 'signup') .'/signup_no_views.inc');
+}
+
 /**
  * @defgroup signup_core Core drupal hooks
  */
@@ -60,7 +64,6 @@
   // the signup log to pull all users who are signed up for this event.
   $from = variable_get('site_mail', 'noadmin@noadmin.com');
   while ($event = db_fetch_object($result)) {
-    $subject = t('Event reminder: !event', array('!event' => $event->title));
     $signups = db_query("SELECT u.name, u.mail, s_l.anon_mail, s_l.form_data FROM {signup_log} s_l INNER JOIN {users} u ON u.uid = s_l.uid WHERE s_l.nid = %d", $event->nid);
 
     // Loop through the users, composing their customized message
@@ -80,9 +83,11 @@
         '%useremail' => $mail_address,
         '%info' => $signup_info,
         );
-      $message = strtr($event->reminder_email, $trans);
-      drupal_mail('signup_reminder_mail', $mail_address, $subject, $message, $from);
-      watchdog('signup', t('Reminder for %event sent to %useremail.', array('%event' => $event->title, '%useremail' => $mail_address)), WATCHDOG_NOTICE, l(t('view'), 'node/'. $event->nid));
+      $params['message'] = strtr($event->reminder_email, $trans);
+      $params['subject'] = t('Event reminder: !event', array('!event' => $event->title));
+
+      drupal_mail('signup', 'signup_reminder_mail', $mail_address, NULL, $params, $from);
+      watchdog('signup', 'Reminder for %event sent to %useremail.', array('%event' => $event->title, '%useremail' => $mail_address), WATCHDOG_NOTICE, l(t('view'), 'node/'. $event->nid));
     }
 
     // Reminders for this event are all sent, so mark it in the
@@ -128,7 +133,7 @@
       $function = $module .'_signup_close';
       $function($node);
     }
-    watchdog('signup', t('Signups closed for %event by cron.', array('%event' => $node->title)), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid));
+    watchdog('signup', 'Signups closed for %event by cron.', array('%event' => $node->title), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid));
   }
 }
 
@@ -188,8 +193,8 @@
  * Implementation of hook_help().
  * @ingroup signup_core
  */
-function signup_help($section) {
-  switch ($section) {
+function signup_help($path, $arg) {
+  switch ($path) {
     case 'admin/help#signup':
       return '<p>'.
         t('Signup allows users to sign up (in other words, register) for content of any type. The most common use is for events, where users indicate they are planning to attend. This module includes options for sending a notification email to a selected email address upon a new user signup (good for notifying event coordinators, etc.) and a confirmation email to users who sign up. Each of these options are controlled per node. When used on event nodes (with event.module installed and regular cron runs), it can also send out reminder emails to all signups a configurable number of days before the start of the event (also controlled per node) and to automatically close event signups 1 hour before their start (general setting). Settings exist for resticting signups to selected roles and content types.')
@@ -207,8 +212,8 @@
   }
 
   // If we're still here, consider the URL for help on various menu tabs.
-  if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'signup-broadcast') {
-    $node = node_load(arg(1));
+  if (arg(2) == 'signup-broadcast') {
+    $node = menu_get_object();
     return '<p>'. t('This page allows you to send an email message to every user who signed up for this @node_type.', array('@node_type' => $node->type)) .'</p>';
   }
 }
@@ -217,92 +222,77 @@
  * Implmentation of hook_menu()
  * @ingroup signup_core
  */
-function signup_menu($may_cache) {
+function signup_menu() {
   global $user;
   $items = array();
-  $access = user_access('administer all signups');
-
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/settings/signup',
-      'description' => t('Configure settings for signups.'),
-      'access' => $access,
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('signup_settings_page'),
-      'title' => user_access('access administration pages') ? t('Signup') : t('Signup settings'),
+  
+    $items['admin/settings/signup'] = array(
+      'description' => 'Configure settings for signups.',
+      'access arguments' => array('administer all signups'),
+      'page callback' => 'drupal_get_form',
+      'page arguments' => array('signup_settings_page'),
+      'title' => user_access('access administration pages') ? 'Signup' : 'Signup settings',
     );
 
-    $items[] = array(
-      'path' => 'admin/content/signup',
-      'description' => t('View all signup-enabled posts, and open or close signups on them.'),
-      'access' => $access,
-      'callback' => 'signup_admin_page',
-      'title' => t('Signup administration'),
+    $items['admin/content/signup'] = array(
+      'description' => 'View all signup-enabled posts, and open or close signups on them.',
+      'access arguments' => array('administer all signups'),
+      'page callback' => 'signup_admin_page',
+      'title' => 'Signup administration',
     );
-  }
-  else {  // !$may_cache: dynamic menu items
-    _signup_initialize_event_backend();
 
-    // Conditionally load either the views support, or the code that
-    // only should happen if views is not enabled.
-    $signup_path = './'. drupal_get_path('module', 'signup');
-    if (module_exists('views')) {
-      require_once($signup_path .'/signup_views.inc');
-    }
-    else {
-      require_once($signup_path .'/signup_no_views.inc');
-      signup_no_views_menu($items, $may_cache);
+    //D6 _signup_initialize_event_backend() removed from here and invoked where needed
+
+    if (!module_exists('views')) {
+      signup_no_views_menu($items);
     }
 
     // If it's a signup-enabled node, then put in a signup tab for admins.
-    if (arg(0) == 'node' && is_numeric(arg(1))) {
-      $node = node_load(array('nid' => arg(1)));
-      if (!empty($node->signup)) {
-        $access_own = user_access('administer signups for own content') && ($user->uid == $node->uid);
-        $email_own = user_access('email users signed up for own content') && ($user->uid == $node->uid);
-        $email_all = user_access('email all signed up users');
-        if (variable_get('signup_form_location', 'node') == 'tab'
-            && _signup_needs_output($node)) {
-          $items[] = array(
-            'path' => 'node/'. arg(1) .'/signup',
-            'title' => t('Sign up'),
-            'callback' => 'signup_node_tab',
-            'callback arguments' => array($node),
+        if (variable_get('signup_form_location', 'node') == 'tab') {
+          $items['node/%node/signup'] = array(
+            'title' => 'Sign up',
+            'page callback' => 'signup_node_tab',
+            'page arguments' => array(1),
+            'access callback' => '_signup_needs_output',
+            'access arguments' => array(1),
             'type' => MENU_LOCAL_TASK,
             'weight' => 19,
           );
         }
-        $items[] = array(
-          'path' => 'node/'. arg(1) .'/signups',
-          'title' => t('Signups'),
-          'callback' => 'signup_node_admin_page',
-          'callback arguments' => array($node),
-          'access' => $access || $access_own,
+
+        $items['node/%node/signups'] = array(
+          'title' => 'Signups',
+          'page callback' => 'signup_node_admin_page',
+          'page arguments' => array(1),
+          'access callback' => '_signup_check_perm',
+          'access arguments' => array('administer all signups', 'administer signups for own content', $user->uid == $node->uid),
           'type' => MENU_LOCAL_TASK,
           'weight' => 20,
         );
-        $items[] = array(
-          'path' => 'node/'. arg(1) .'/signup-broadcast',
-          'title' => t('Signup broadcast'),
-          'callback' => 'drupal_get_form',
-          'callback arguments' => array('signup_broadcast_form', $node),
-          'access' => $email_all || $email_own,
+        $items['node/%node/signup-broadcast'] = array(
+          'title' => 'Signup broadcast',
+          'page callback' => 'drupal_get_form',
+          'page arguments' => array('signup_broadcast_form', 1),
+          'access callback' => '_signup_check_perm',
+          'access arguments' => array('email all signed up users', 'email users signed up for own content', $user->uid == $node->uid),
           'type' => MENU_LOCAL_TASK,
           'weight' => 21,
         );
-      }
-    }
-  }
+
   return $items;
 }
 
+function _signup_check_perm($forall, $foruser, $isowner) {
+  $perm_all = user_access($forall);
+  $perm_user = user_access($foruser) && isowner;
+  return $perm_all || $perm_user;
+}
+
 function _signup_initialize_event_backend() {
   define('SIGNUP_PATH', drupal_get_path('module', 'signup'));
+  //D6 The event API available for 6.x is 5.2
   if (defined('EVENT_API') && EVENT_API == '5.2') {
-    include_once(SIGNUP_PATH .'/signup_event_5.x-2.inc');
-  }
-  else if (module_exists('event')) {
-    include_once(SIGNUP_PATH .'/signup_event_5.x-1.inc');
+    include_once(SIGNUP_PATH .'/signup_event_5.2.inc');
   }
   else if (module_exists('date')) {
     // include_once(SIGNUP_PATH .'/signup_date.inc');
@@ -334,7 +324,8 @@
  * Implementation of hook_form_alter().
  * @ingroup signup_core
  */
-function signup_form_alter($form_id, &$form) {
+  
+function signup_form_alter(&$form, &$form_state, $form_id) {
   switch ($form_id) {
     case 'node_type_form':
       signup_alter_node_type_form($form_id, $form);
@@ -377,16 +368,14 @@
   else {
     $node = NULL;
   }
-  
   $signup_type_default = variable_get('signup_node_default_state_'. $form['type']['#value'], 'disabled');
-
   // If the current user has the global 'administer all signups' permission
   // and signups are not explicitly disallowed, or if this node-type is
   // signup-enabled and the user has permission to administer signups for
   // their own content, add a fieldset for signup-related settings.
   if ( (($signup_type_default != 'disabled' || (!empty($node) && !empty($node->signup))) && user_access('administer all signups'))
        || (!empty($node) && $signup_type_default == 'enabled_on' && $node->uid == $user->uid && user_access('administer signups for own content')) ) {
-    $form['signup'] = array(
+      $form['signup'] = array(
       '#type' => 'fieldset',
       '#title' => t('Signup settings'),
       '#collapsible' => TRUE,
@@ -453,26 +442,26 @@
  * Submits the cancel signup form
  *
  * @ingroup signup_core
- * @param $form_id The ID of the form being submitted.
- * @param $form_values The constructed form values array of the submitted form.
+ * @param $form The form being submitted.
+ * @param $form_state The constructed form
  */
-function signup_form_cancel_submit($form_id, $form_values) {
-  signup_cancel_signup($form_values['uid'], $form_values['nid'], $form_values['signup_anon_mail']);
+function signup_form_cancel_submit($form, &$form_state) {
+  signup_cancel_signup($form_state['values']['uid'], $form_state['values']['nid'], $form_state['values']['signup_anon_mail']);
 }
 
 /**
  * Executes the user signup form
  *
  * @ingroup signup_core
- * @param $form_id The ID of the form being submitted.
- * @param $form_values The constructed form values array of the submitted form.
+ * @param $form The form being submitted.
+ * @param $form_state The constructed form
  */
-function signup_form_submit($form_id, $form_values) {
-  if (isset($form_values['signup_username'])) {
-    $account = user_load(array('name' => $form_values['signup_username']));
-    $form_values['uid'] = $account->uid;
+function signup_form_submit($form, &$form_state) {
+  if (isset($form_state['values']['signup_username'])) {
+    $account = user_load(array('name' => $form_state['values']['signup_username']));
+    $form_state['values']['uid'] = $account->uid;
   }
-  signup_sign_up_user($form_values);
+  signup_sign_up_user($form_state['values']);
 }
 
 /**
@@ -520,22 +509,22 @@
  * @ingroup signup_nodeapi
  */
 function signup_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
-  global $form_values;
+//D6 as per http://drupal.org/node/241364, it is not possible to use global $form_values anymore, so the only option is to use $_POST
   $signup_type_default = variable_get('signup_node_default_state_'. $node->type, 'disabled');
-  
+
   switch ($op) {
     case 'insert':
-      if (isset($form_values['signup_enabled'])) {
-        if ($form_values['signup_enabled'] == 1) {
+      if (isset($_POST['signup_enabled'])) {
+        if ($_POST['signup_enabled'] == 1) {
           $values = array(
             $node->nid,
-            $form_values['signup_forwarding_email'],
-            $form_values['signup_send_confirmation'],
-            $form_values['signup_confirmation_email'],
-            $form_values['signup_send_reminder'],
-            $form_values['signup_reminder_days_before'],
-            $form_values['signup_reminder_email'],
-            $form_values['signup_close_signup_limit'],
+            $_POST['signup_forwarding_email'],
+            $_POST['signup_send_confirmation'],
+            $_POST['signup_confirmation_email'],
+            $_POST['signup_send_reminder'],
+            $_POST['signup_reminder_days_before'],
+            $_POST['signup_reminder_email'],
+            $_POST['signup_close_signup_limit'],
           );
         }
       }
@@ -563,11 +552,11 @@
       break;
 
     case 'update':
-      if (isset($form_values['signup_enabled'])) {
+      if (isset($_POST['signup_enabled'])) {
         $has_signup_record = db_result(db_query('SELECT COUNT(*) FROM {signup} WHERE nid = %d', $node->nid));
-        switch ($form_values['signup_enabled']) {
+        switch ($_POST['signup_enabled']) {
           case 1: // Enabled
-            $limit_changed = false;
+            $limit_changed = FALSE;
             if ($has_signup_record) {
               // See if the limit is going to change, since if it did,
               // we might have to change the status, too.
@@ -595,6 +584,9 @@
                 $node->signup_close_signup_limit
               );
             }
+            
+            //D6 _signup_initialize_event_backend() was previously part of signup_menu(), but because of 6.x menu caching, it has to be invoked separately
+            _signup_initialize_event_backend();
             if (_signup_event_completed($node) && $node->signup_status) {
               // If this is an event, and it's already past the close
               // in advance time, and signups are still open, close
@@ -606,6 +598,7 @@
             else if ($limit_changed) {
               _signup_check_limit($node, 'limit');
             }
+            
             break;
 
           case 2: // Disabled, and delete {signup_log}, too
@@ -632,11 +625,11 @@
       // Check for a signup for this node.
       // If it's a new node, load the defaults.
       $result = db_query("SELECT * FROM {signup} WHERE nid = %d", ($node->nid ? $node->nid : 0));
+      $signup = db_fetch_object($result);
 
       // Load signup data for both new nodes w/ enabled node types,
       // and any existing nodes that are already signup enabled.
-      if ((!$node->nid && $signup_type_default == 'enabled_on') || ($node->nid && db_num_rows($result))) {
-        $signup = db_fetch_object($result);
+      if ((!$node->nid && $signup_type_default == 'enabled_on') || ($node->nid && $signup)) {
         $node->signup = 1;
         $node->signup_forwarding_email = $signup->forwarding_email;
         $node->signup_send_confirmation = $signup->send_confirmation;
@@ -709,8 +702,8 @@
       // signup info and give them the option to cancel.
       if ($user->uid) {
         $result = db_query("SELECT signup_time, form_data FROM {signup_log} WHERE uid = %d AND nid = %d", $user->uid, $node->nid);
-        if (db_num_rows($result)) {
-          $signup_info = db_fetch_object($result);
+        $signup_info = db_fetch_object($result);
+        if ($signup_info) {
           $output .= _signup_print_current_signup($node, $signup_info);
         }
       }
@@ -723,8 +716,8 @@
       // then build the anon portion of the sigup form.  If not, then
       // display the login link.
       $login_array = array(
-        '!login' => l(t('login'), 'user/login', array(), drupal_get_destination()),
-        '!register' => l(t('register'), 'user/register', array(), drupal_get_destination()),
+        '!login' => l(t('login'), 'user/login', array('query' => drupal_get_destination())),
+        '!register' => l(t('register'), 'user/register', array('query' => drupal_get_destination())),
         );
       if (user_access('sign up for content')) {
         $needs_signup_form = TRUE;
@@ -738,7 +731,7 @@
     else {
       // See if the user is already signed up for this node.
       $result = db_query("SELECT signup_time, form_data FROM {signup_log} WHERE uid = %d AND nid = %d", $user->uid, $node->nid);
-      $needs_signup_form = db_num_rows($result) == 0;
+      $needs_signup_form = db_fetch_object($result) ? FALSE : TRUE;
     }
 
     if ($needs_signup_form) {
@@ -761,12 +754,12 @@
   // Pull all users signed up for this event, and start table creation.
   if (user_access('view all signups')) {
     $registered_signups = db_query("SELECT u.uid, u.name, s.signup_time, s.form_data FROM {signup_log} s INNER JOIN {users} u ON u.uid = s.uid WHERE s.nid = %d AND u.uid <> 0", $node->nid);
-    $anon_signups = db_num_rows(db_query("SELECT anon_mail FROM {signup_log} WHERE nid = %d AND uid = 0", $node->nid));
-    $header = array(array('data' => t('!users signed up', array('!users' => format_plural((db_num_rows($registered_signups) + $anon_signups), '1 individual', '@count individuals')))));
+    $anon_signups = db_result(db_query("SELECT COUNT(*) FROM {signup_log} WHERE nid = %d AND uid = 0", $node->nid));
     $rows = array();
     while ($signed_up_user = db_fetch_object($registered_signups)) {
       $rows[] = array(theme('username', $signed_up_user));
     }
+    $header = array(array('data' => t('!users signed up', array('!users' => format_plural((count($rows) + $anon_signups), '1 individual', '@count individuals')))));
     if ($anon_signups) {
       $rows[] = array(t('!count anonymous', array('!count' => $anon_signups)));
     }
@@ -838,9 +831,9 @@
  * @param $fieldset
  *   Boolean that indicates if the signup form should be in a fieldset.
  */
-function signup_form($node, $signup_type = 'auth', $fieldset = TRUE) {
+function signup_form(&$form_state, $node, $signup_type = 'auth', $fieldset = TRUE) {
   global $user;
-  include_once(SIGNUP_PATH .'/signup.theme');
+  include_once(drupal_get_path('module', 'signup') .'/signup.theme');
 
   $form = array();
   $form['nid'] = array('#type' => 'value', '#value' => $node->nid);
@@ -903,12 +896,13 @@
     }
   }
   $signup_form += $signup_themed_form;
-  
+
   $form['collapse']['signup_user_form'] = $signup_form;
   $form['collapse']['submit'] = array(
     '#type' => 'submit',
     '#value' => t('Sign up'),
   );
+
   return $form;
 }
 
@@ -916,7 +910,7 @@
  * Builder function for the cancel signup form
  * @ingroup signup_callback
  */
-function signup_form_cancel($node) {
+function signup_form_cancel(&$form_state, $node) {
   global $user;
   $form['nid'] = array('#type' => 'value', '#value' => $node->nid);
   $form['uid'] = array('#type' => 'value', '#value' => $user->uid);
@@ -955,12 +949,33 @@
   return $form;
 }
 
+function signup_theme() {
+  return array(
+    'signup_filter_status_form' => array(
+      'arguments' => array('form' => NULL),
+    ),
+    'signup_admin_form' => array(
+      'arguments' => array('form' => NULL),
+    ),
+    'signup_admin_node_form' => array(
+      'arguments' => array('form' => NULL),
+    ),
+    'signup_user_schedule' => array(
+      'arguments' => array('node' => NULL),
+    ),
+    'signup_user_form' => array(
+      'arguments' => array(),
+    ),
+
+  );
+}
+
 function theme_signup_filter_status_form($form) {
   return '<div class="container-inline">'. drupal_render($form) .'</div>';
 }
 
-function signup_filter_status_form_submit($form_id, $form_values) {
-  $_SESSION['signup_status_filter'] = $form_values['filter'];
+function signup_filter_status_form_submit($form, &$form_state) {
+  $_SESSION['signup_status_filter'] = $form_state['values']['filter'];
 }
 
 function signup_admin_form() {
@@ -1019,7 +1034,7 @@
     );
     $form['nids'][$signup_event->nid] = $row;
   }
-  $form['#tree'] = true;
+  $form['#tree'] = TRUE;
   $form['submit'] = array(
     '#type' => 'submit',
     '#value' => t('Update'),
@@ -1126,10 +1141,10 @@
   return $output;
 }
 
-function signup_admin_form_submit($form_id, $form_values) {
-  foreach ($form_values['nids'] as $nid => $values) {
+function signup_admin_form_submit($form, &$form_state) {
+  foreach ($form_state['values']['nids'] as $nid => $values) {
     $values['nid'] = $nid;
-    signup_admin_node_form_submit($form_id, $values);
+    signup_admin_node_form_submit($form, $values);
   }
 }
 
@@ -1164,7 +1179,7 @@
       $function = $module .'_signup_close';
       $function($node);
     }
-    watchdog('signup', t('Signups closed for %title.', array('%title' => $node->title)), WATCHDOG_NOTICE, l(t('view'), 'node/'. $nid));
+    watchdog('signup', 'Signups closed for %title.', array('%title' => $node->title), WATCHDOG_NOTICE, l(t('view'), 'node/'. $nid));
   }
 }
 
@@ -1180,7 +1195,7 @@
       $function = $module .'_signup_open';
       $function($node);
     }
-    watchdog('signup', t('Signups reopened for %title.', array('%title' => $node->title)), WATCHDOG_NOTICE, l(t('view'), 'node/'. $nid));
+    watchdog('signup', 'Signups reopened for %title.', array('%title' => $node->title), WATCHDOG_NOTICE, l(t('view'), 'node/'. $nid));
   }
 }
 
@@ -1200,15 +1215,15 @@
     '#type' => 'fieldset',
     '#title' => t('Default signup information'),
     '#description' => t('New signup-enabled nodes will start with these settings.'),
-    '#collapsible' => true,
+    '#collapsible' => TRUE,
   );
   $form['node_defaults']['_signup_admin_form'] = _signup_admin_form($node);
 
   $form['adv_settings'] = array(
     '#type' => 'fieldset',
     '#title' => t('Advanced settings'),
-    '#collapsible' => true,
-    '#collapsed' => true,
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
   );
   $form['adv_settings']['signup_form_location'] = array(
     '#title' => t('Location of the signup form and related information'),
@@ -1231,27 +1246,27 @@
 
   // Use our own submit handler, so we can do some processing before
   // we hand control to system_settings_form_submit.
-  $form['#submit']['signup_settings_page_submit'] = array();
+  $form['#submit'][] = 'signup_settings_page_submit';
   return system_settings_form($form);
 }
 
 /**
  * Submits the signup settings form
  *
- * @param $form_id The ID of the form being submitted.
- * @param $form_values The constructed form values array of the submitted form.
+ * @param $form_id The form being submitted.
+ * @param $form_state The constructed form
  */
-function signup_settings_page_submit($form_id, $form_values) {
-  $op = isset($form_values['op']) ? $form_values['op'] : '';
-  if ($op == t('Save configuration') && db_num_rows(db_query('SELECT nid FROM {signup} WHERE nid = 0'))) {
+function signup_settings_page_submit($form, &$form_state) {
+  $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
+  if ($op == t('Save configuration') && db_result(db_query('SELECT COUNT(*) FROM {signup} WHERE nid = 0'))) {
     db_query("UPDATE {signup} SET forwarding_email = '%s', send_confirmation = %d, confirmation_email = '%s', send_reminder = %d, reminder_days_before = %d, reminder_email = '%s', close_signup_limit = %d WHERE nid = 0",
-      $form_values['signup_forwarding_email'],
-      $form_values['signup_send_confirmation'],
-      $form_values['signup_confirmation_email'],
-      $form_values['signup_send_reminder'],
-      $form_values['signup_reminder_days_before'],
-      $form_values['signup_reminder_email'],
-      $form_values['signup_close_signup_limit']
+      $form_state['values']['signup_forwarding_email'],
+      $form_state['values']['signup_send_confirmation'],
+      $form_state['values']['signup_confirmation_email'],
+      $form_state['values']['signup_send_reminder'],
+      $form_state['values']['signup_reminder_days_before'],
+      $form_state['values']['signup_reminder_email'],
+      $form_state['values']['signup_close_signup_limit']
     );
   }
   else {
@@ -1261,7 +1276,7 @@
   }
 
   // Now, remove all the settings we just processed from our copy of
-  // $form_values, so system_settings_form_submit() doesn't see them.
+  // $form_state, so system_settings_form_submit() doesn't see them.
   $settings = array(
     'signup_forwarding_email',
     'signup_send_confirmation',
@@ -1272,14 +1287,14 @@
     'signup_close_signup_limit',
   );
   foreach ($settings as $setting) {
-    unset($form_values[$setting]);
+    unset($form_state['values'][$setting]);
   }
   // Remove the hidden element from _signup_admin_form(), too.
-  unset($form_values['signup']);
+  unset($form_state['values']['signup']);
 
   // Finally, let system_settings_form_submit() do its magic with the
   // rest of the settings.
-  system_settings_form_submit($form_id, $form_values);
+  system_settings_form_submit($form, $form_state);
 }
 
 /**
@@ -1331,7 +1346,7 @@
     // Ensure the uid is 0 for anonymous signups, even if it's not duplicate.
     $signup_form['uid'] = 0;
     // Now, see if this email is already signed-up.
-    if (db_num_rows(db_query("SELECT anon_mail FROM {signup_log} WHERE anon_mail = '%s' AND nid = %d", $signup_form['signup_anon_mail'], $node->nid))) {
+    if (db_result(db_query("SELECT COUNT(*) FROM {signup_log} WHERE anon_mail = '%s' AND nid = %d", $signup_form['signup_anon_mail'], $node->nid))) {
       drupal_set_message(t('Anonymous user %email is already signed up for %title', array('%email' => $signup_form['signup_anon_mail'], '%title' => $node->title), 'error'));
       return FALSE;
     }
@@ -1341,8 +1356,8 @@
     // user_load() just so theme('username') can have the data it
     // needs for the error message we might print out.
     $query = db_query("SELECT sl.uid, u.name FROM {signup_log} sl INNER JOIN {users} u ON sl.uid = u.uid WHERE sl.uid = %d AND sl.nid = %d", $signup_form['uid'], $signup_form['nid']);
-    if (db_num_rows($query)) {
-      $user = db_fetch_object($query);
+    $user = db_fetch_object($query);
+    if ($user) {      
       drupal_set_message(t('User !user is already signed up for %title', array('!user' => theme('username', $user), '%title' => $node->title)), 'error');
       return FALSE;
     }
@@ -1369,6 +1384,8 @@
 
     // Format the start time, and compose the user's signup data for
     // later use in the emails.
+    //D6 _signup_initialize_event_backend() was previously part of signup_menu(), but because of 6.x menu caching, it has to be invoked separately
+    _signup_initialize_event_backend();
     $starttime = signup_format_date($node);
     $signup_data_array = array();
     if (isset($signup_form['signup_form_data'])) {
@@ -1393,21 +1410,22 @@
     // If a confirmation is to be sent, compose the mail message,
     // translate the string substitutions, and send it.
     if ($node->signup_send_confirmation && $user_mail) {
-      $subject = t('Signup confirmation for event: !event', array('!event' => $node->title));
-      $message = strtr($node->signup_confirmation_email, $trans);
-      drupal_mail('signup_confirmation_mail', $user_mail, $subject, $message, $from);
+      $params['subject'] = t('Signup confirmation for event: !event', array('!event' => $node->title));
+      $params['body'] = strtr($node->signup_confirmation_email, $trans);
+      drupal_mail('signup', 'signup_confirmation_mail', $user_mail, NULL, $params, $from);
     }
 
     // If a forwarding email is to be sent, compose the mail message,
     // translate the string substitutions, and send it.
     if ($node->signup_forwarding_email) {
-      $header = array('From' => t('New Event Signup') ."<$from>");
-      $subject = t('Signup confirmation for event: !title', array('!title' => $node->title));
-      $message = t('The following information was submitted as a signup for !title', array('!title' => $node->title)) .
+      $params['headers'] = array('From' => t('New Event Signup') ."<$from>");
+      $params['subject'] = t('Signup confirmation for event: !title', array('!title' => $node->title));
+      $params['body'] = t('The following information was submitted as a signup for !title', array('!title' => $node->title)) .
       "\n\r". t('Date/Time: !time', array('!time' => $starttime)) .":\n\r\n\r".
       "\n\r". t('Username:') . $user->name .
       "\n\r". t('Email:') . $user_mail ."\n\r\n\r". $signup_data;
-      drupal_mail('signup_forwarding_mail', $node->signup_forwarding_email, $subject, $message, $from, $header);
+      
+      drupal_mail('signup', 'signup_forwarding_mail', $node->signup_forwarding_email, NULL, $params, $from);
     }
 
     drupal_set_message(t('Signup to !title confirmed.', array('!title' => l($node->title, "node/$node->nid"))) . $confirmation_email . $reminder_email);
@@ -1422,6 +1440,16 @@
   }
 }
 
+function signup_mail($key, &$message, $params) {
+  $message['subject'] .= $params['subject'];
+  $message['body'] = $params['body'];
+  if (isset($params['headers'])){
+    foreach($params as $key => $value){
+      $message['headers'][$key] = $value;
+    }
+  }
+}
+
 /**
  * Prints the signup details for a single node when the signups tab is clicked
  * @ingroup signup_callback
@@ -1501,7 +1529,7 @@
   return theme('table', $header, array($row));
 }
 
-function signup_admin_node_form($node) {
+function signup_admin_node_form(&$form_state, $node) {
   if ($node->signup_close_signup_limit &&
       $node->signup_total >= $node->signup_close_signup_limit) {
     $form['status'] = array(
@@ -1534,20 +1562,20 @@
   return $form;
 }
 
-function signup_admin_node_form_submit($form_id, $form_values) {
-  $nid = $form_values['nid'];
+function signup_admin_node_form_submit($form, &$form_state) {
+  $nid = $form_state['values']['nid'];
   $node = node_load($nid);
   $limit_status = 0;
-  if (isset($form_values['limit']) && ($form_values['limit'] != $node->signup_close_signup_limit)) {
-    db_query("UPDATE {signup} SET close_signup_limit = %d WHERE nid = %d", $form_values['limit'], $nid);
-    $node->signup_close_signup_limit = $form_values['limit'];
+  if (isset($form_state['values']['limit']) && ($form_state['values']['limit'] != $node->signup_close_signup_limit)) {
+    db_query("UPDATE {signup} SET close_signup_limit = %d WHERE nid = %d", $form_state['values']['limit'], $nid);
+    $node->signup_close_signup_limit = $form_state['values']['limit'];
     $limit_status = _signup_check_limit($node, 'limit');
   }
 
   // Only consider the form's status value if the signup limit didn't
   // touch the status already.
-  if (!$limit_status && isset($form_values['status']) && ($form_values['status'] != $node->signup_status)) {
-    if ($form_values['status']) {
+  if (!$limit_status && isset($form_state['values']['status']) && ($form_state['values']['status'] != $node->signup_status)) {
+    if ($form_state['values']['status']) {
       signup_open_signup($nid);
       drupal_set_message(t('Signups opened for !title.', array('!title' => l($node->title, "node/$node->nid"))));
     }
@@ -1628,10 +1656,7 @@
 /**
  * Implementation of hook_forms().
  */
-function signup_forms() {
-  $args = func_get_args();
-  $args = $args[0];
-  $form_id = array_shift($args);
+function signup_forms($form_id, $args) {
   if (strpos($form_id, 'signup_user_cancel_form') !== FALSE) {
     if ($form_id == 'signup_user_cancel_form_'. $args[0]) {
       array_shift($args);  // Get rid of the extra uid arg.
@@ -1644,8 +1669,8 @@
   }
 }
 
-function signup_user_cancel_form($nid, $uid, $anon_mail) {
-  $form['#base'] = 'signup_form_cancel';
+function signup_user_cancel_form(&$form_state, $nid, $uid, $anon_mail) {
+  $form['#submit'][] = 'signup_form_cancel_submit';
   $form['nid'] = array('#type' => 'value', '#value' => $nid);
   $form['uid'] = array('#type' => 'value', '#value' => $uid);
   $form['signup_anon_mail'] = array('#type' => 'value', '#value' => $anon_mail);
@@ -1666,10 +1691,10 @@
   if (!valid_email_address($anon_mail)) {
     $message = 'Invalid email address entered for signup.';
   }
-  else if (db_num_rows(db_query("SELECT mail FROM {users} WHERE mail = '%s'", $anon_mail))) {
+  else if (db_result(db_query("SELECT COUNT(*) FROM {users} WHERE mail = '%s'", $anon_mail))) {
     $message = 'The email address entered belongs to a registered user.';
   }
-  else if (db_num_rows(db_query("SELECT anon_mail FROM {signup_log} WHERE anon_mail = '%s' AND nid = %d", $anon_mail, $nid))) {
+  else if (db_result(db_query("SELECT COUNT(*) FROM {signup_log} WHERE anon_mail = '%s' AND nid = %d", $anon_mail, $nid))) {
     $message = 'The email address entered has already been used to sign up for this event.';
   }
 
@@ -1831,7 +1856,7 @@
  * @param $node
  *   The node that the broadcast form is being attached to.
  */
-function signup_broadcast_form($node) {
+function signup_broadcast_form(&$form_state, $node) {
   // Seems lame we need this here, but apparently, we do. :(
   drupal_set_title(check_plain($node->title));
 
@@ -1853,12 +1878,12 @@
   $form['subject'] = array(
     '#type' => 'textfield',
     '#title' => t('Subject'),
-    '#required' => true,
+    '#required' => TRUE,
   );
   $form['message'] = array(
     '#type' => 'textarea',
     '#title' => t('Message body'),
-    '#required' => true,
+    '#required' => TRUE,
     '#description' => t('Body of the email message you wish to send to all users who have signed up for this @node_type.', array('@node_type' => $node->type)) .' '. $token_text,
     '#rows' => 10,
   );
@@ -1876,7 +1901,7 @@
     $form['from'] = array(
       '#type' => 'textfield',
       '#title' => t('From'),
-      '#required' => true,
+      '#required' => TRUE,
       '#default_value' => $user->mail,
       '#weight' => '-10',
     );
@@ -1909,14 +1934,14 @@
  * Send an email message to all those signed up to an event.
  *
  * @param $form_id
- * @param $form_values
+ * @param $form_state
  */
-function signup_broadcast_form_submit($form_id, $form_values) {
-  $addresses = signup_get_email_addresses($form_values['nid']);
+function signup_broadcast_form_submit($form, &$form_state) {
+  $addresses = signup_get_email_addresses($form_state['values']['nid']);
   if (is_array($addresses)) {
-    $from = $form_values['from'];
-    $subject = $form_values['subject'];
-    $event = node_load($form_values['nid']);
+    $from = $form_state['values']['from'];
+    $params['subject'] = $form_state['values']['subject'];
+    $event = node_load($form_state['values']['nid']);
     foreach ($addresses as $signup) {
       $mail_address = $signup->anon_mail ? $signup->anon_mail : $signup->mail;
       $trans = array(
@@ -1925,47 +1950,12 @@
         '%useremail' => $mail_address,
 //        '%info' => $signup_info,
       );
-
+      _signup_initialize_event_backend();
       $trans['%time'] = signup_format_date($event);
-
-      $message = strtr($form_values['message'], $trans);
-      drupal_mail('signup_broadcast_mail', $mail_address, $subject, $message, $from);
-      watchdog('signup', t('Broadcast email for %event sent to %email.', array('%event' => $event->title, '%email' => $mail_address)), WATCHDOG_NOTICE, l(t('view'), 'node/'. $event->nid));
+      $params['body'] = strtr($form_state['values']['message'], $trans);
+      drupal_mail('signup', 'signup_broadcast_mail', $mail_address, NULL, $params, $from);
+      watchdog('signup', 'Broadcast email for %event sent to %email.', array('%event' => $event->title, '%email' => $mail_address), WATCHDOG_NOTICE, l(t('view'), 'node/'. $event->nid));
     }
   }
   drupal_set_message(t('Message sent to all users who have signed up'));
 }
-
-/**
- * @defgroup signup_views Views-integration hooks
- */
-
-/**
- * Implementation of hook_views_tables.
- * @ingroup signup_views
- * @see _signup_views_tables()
- */
-function signup_views_tables() {
-  require_once(drupal_get_path('module', 'signup') .'/signup_views.inc');
-  return _signup_views_tables();
-}
-
-/**
- * Implementation of hook_views_arguments.
- * @ingroup signup_views
- * @see _signup_views_arguments()
- */
-function signup_views_arguments() {
-  require_once(drupal_get_path('module', 'signup') .'/signup_views.inc');
-  return _signup_views_arguments();
-}
-
-/**
- * Implementation of hook_views_default_views.
- * @ingroup signup_views
- * @see _signup_views_default_views()
- */
-function signup_views_default_views() {
-  require_once(drupal_get_path('module', 'signup') .'/signup_views.inc');
-  return _signup_views_default_views();
-}
Index: signup_no_views.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/signup/signup_no_views.inc,v
retrieving revision 1.4
diff -u -r1.4 signup_no_views.inc
--- signup_no_views.inc	26 Jan 2008 03:02:39 -0000	1.4
+++ signup_no_views.inc	31 Jul 2008 14:54:40 -0000
@@ -65,19 +65,16 @@
 /**
  * Menu items we only need to define if views is not enabled.
  */
-function signup_no_views_menu(&$items, $may_cache) {
+function signup_no_views_menu(&$items) {
   global $user;
-  $access = user_access('administer all signups');
-  if (!$may_cache) {
     // User signup schedule callback
-    $items[] = array(
-      'path' => 'user/'. arg(1) .'/signups',
-      'access' => ($access || ($user->uid == arg(1))),
+    $items['user/'. arg(1) .'/signups'] = array(
+      'access callback' => ($user->uid == arg(1)) ? TRUE : 'user_access',
+      'access arguments' => array('administer all signups'),
       'type' => MENU_CALLBACK,
-      'callback' => 'signup_user_schedule',
-      'callback arguments' => array($uid => arg(1)),
+      'page callback' => 'signup_user_schedule',
+      'page arguments' => array('uid' => arg(1)),
     );
-  }
 }
 
 /**
@@ -91,7 +88,7 @@
     drupal_not_found();
     return;
   }
-  include_once(SIGNUP_PATH .'/signup.theme');
+  include_once(drupal_get_path('module', 'signup') .'/signup.theme');
   drupal_set_title(t('Signups for @user', array('@user' => $user->name)));
   $titles = signup_list_user_signups($user->uid);
   foreach ($titles as $nid => $title) {

