? sms_3.patch
Index: sms.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/smsframework/sms.info,v
retrieving revision 1.2
diff -u -p -r1.2 sms.info
--- sms.info	17 Aug 2007 00:18:45 -0000	1.2
+++ sms.info	6 Aug 2008 20:35:15 -0000
@@ -1,4 +1,5 @@
 ; $Id: sms.info,v 1.2 2007/08/17 00:18:45 diggersf Exp $
 name = "SMS Framework"
 description = "Provides a extensible API that facilitates communication between Drupal and various SMS gateways."
-package = SMS Framework
\ No newline at end of file
+package = SMS Framework
+core = 6.x
Index: sms.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/smsframework/sms.install,v
retrieving revision 1.7
diff -u -p -r1.7 sms.install
--- sms.install	30 Jul 2008 19:42:56 -0000	1.7
+++ sms.install	6 Aug 2008 20:35:15 -0000
@@ -1,39 +1,37 @@
 <?php
 // $Id: sms.install,v 1.7 2008/07/30 19:42:56 diggersf Exp $
+/**
+ * Implementation of hook_install().
+ */
 function sms_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      $success = TRUE;
-      db_query('
-         CREATE TABLE {sms_messages} (
-         mid int(10) NOT NULL,
-         sent int(11) NOT NULL,
-         status int(11) NOT NULL,
-         destination varchar(64) NOT NULL,
-         message text default NULL,
-         gateway varchar(64) NOT NULL,
-         PRIMARY KEY (mid)) /*!40100 DEFAULT CHARACTER SET utf8 */;
-        ');
-      
-      db_query('UPDATE {system} SET weight = -5 WHERE name = "sms_sendtophone"');
-      break;
-  }
+  $result = drupal_install_schema('sms');
+  db_query('UPDATE {system} SET weight = -5 WHERE name = "sms_sendtophone"');
+}
 
-  if ($success) {
-    drupal_set_message(t('SMS Framework installed succesfully.'));
-  } 
-  else {
-    drupal_set_message(t('SMS Framework installation failed. Database tables must be created manually.', 'error'));
-  }
+/**
+ * Implementation of hook_schema().
+ */
+function sms_schema() {
+  $schema['sms_messages'] = array(
+    'fields'        => array(
+      'mid'         => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE),
+      'sent'        => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE),
+      'status'      => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE),
+      'destination' => array('type' => 'varchar', 'not null' => TRUE, 'length' => 64),
+      'message'     => array('type' => 'text'),
+      'gateway'     => array('type' => 'varchar', 'not null' => TRUE, 'length' => 64),
+    ),
+    'primary key' => array('mid'),
+  );
+
+  return $schema;
 }
 
 /**
  * Implementation of hook_uninstall().
  */
 function sms_uninstall() {
-  db_query('DROP TABLE {sms_messages}');
-  drupal_set_message(t('SMS Framework uninstalled successfully.'));
+  drupal_uninstall_schema('sms');
 }
 
 /**
@@ -42,7 +40,7 @@ function sms_uninstall() {
 function sms_update_1() {
   $ret = array();
   // Remove table
-  $ret[] = update_sql("DROP TABLE {sms_mapping}");
+  db_drop_table($ret, 'sms_mapping');
   
   return $ret;
-}
\ No newline at end of file
+}
Index: sms.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/smsframework/sms.module,v
retrieving revision 1.6
diff -u -p -r1.6 sms.module
--- sms.module	30 Jul 2008 19:42:56 -0000	1.6
+++ sms.module	6 Aug 2008 20:35:16 -0000
@@ -9,42 +9,35 @@
 /**
  * Implementation of hook_menu().
  */
-function sms_menu($may_cache) {
+function sms_menu() {
   $items = array();
 
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/smsframework',
-      'title' => t('SMS Framework'),
-      'description' => t('Control how your site uses SMS.'),
-      'position' => 'right',
-      'callback' => 'system_admin_menu_block_page',
-      'access' => user_access('administer smsframework'),
-    );
-    
-    $items[] = array(
-      'path' => 'admin/smsframework/gateways',
-      'title' => t('Gateway configuration'),
-      'description' => t('Configure gateways and chose the default gateway.'),
-      'callback' => 'sms_admin_overview',
-      'access' => user_access('administer smsframework'),
-    );
-  }
-  else {
-    if (arg(0) == 'admin' && arg(1) == 'smsframework' && arg(2) == 'gateways' && arg(3)) {
-      $gateways = sms_gateways();
-      if (isset($gateways[arg(3)])) {
-        $items[] = array(
-          'path' => 'admin/smsframework/gateways/'. arg(3),
-          'title' => t("!gateway gateway", array('!gateway' => $gateways[arg(3)]['name'])),
-          'callback' => 'drupal_get_form',
-          'callback arguments' => array('sms_admin_gateway_form', $gateways[arg(3)], arg(3)),
-          'access' => user_access('administer smsframework'),
-          'type' => MENU_CALLBACK,
-        );
-      }
-    }
-  }
+  $items['admin/smsframework'] = array(
+    'title' => 'SMS Framework',
+    'description' => t('Control how your site uses SMS.'),
+    'position' => 'right',
+    'page callback' => 'system_admin_menu_block_page',
+    'access arguments' => array('administer smsframework'),
+    'file' => 'system.admin.inc',
+    'file path' => drupal_get_path('module', 'system')
+  );
+
+  $items['admin/smsframework/gateways'] = array(
+    'title' => 'Gateway configuration',
+    'description' => t('Configure gateways and chose the default gateway.'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('sms_admin_default_form', null),
+    'access arguments' => array('administer smsframework'),
+  );
+
+  $items['admin/smsframework/gateways/%'] = array(
+    'title callback' => 'sms_admin_gateway_title',
+    'title arguments' => array(3),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('sms_admin_gateway_form', 3),
+    'access arguments' => array('administer smsframework'),
+    'type' => MENU_CALLBACK,
+  );
   return $items;
 }
 
@@ -55,10 +48,23 @@ function sms_perm() {
   return array('administer smsframework');
 }
 
-function sms_admin_overview() {
-  $output = drupal_get_form('sms_admin_default_form');
-  
-  return $output;
+/**
+ * Implementation of hook_theme().
+ */
+function sms_theme() {
+  return array(
+    'sms_admin_default_form' => array(
+      'arguments' => array('form' => NULL),  
+    )
+  );
+}
+
+/**
+ * SMS gateway menutitle callback.
+ */
+function sms_admin_gateway_title($gateway_id) {
+  $gateway = sms_gateways('gateway', $gateway_id);
+  return sprintf('%s gateway', $gateway['name']);
 }
 
 function sms_admin_default_form() {
@@ -85,11 +91,11 @@ function sms_admin_default_form() {
   return $form;
 }
 
-function sms_admin_default_form_submit($form_id, $form_values) {
+function sms_admin_default_form_submit($form, &$form_state) {
   // Process form submission to set the default gateway
-  if ($form_values['default']) {
+  if ($form_state['values']['default']) {
     drupal_set_message(t('Default gateway updated.'));
-    variable_set('sms_default_gateway', $form_values['default']);
+    variable_set('sms_default_gateway', $form_state['values']['default']);
   }
 }
 
@@ -113,26 +119,28 @@ function theme_sms_admin_default_form($f
   return $output;
 }
 
-function sms_admin_gateway_form($gateway = NULL, $gateway_id = '') {
-  if (isset($gateway) && is_array($gateway)) {
-    $form = $gateway['options'];
-    $form['submit'] = array(
-      '#type' => 'submit', 
-      '#value' => t('Save'),
-    );
-    $form['#validate'] = array('sms_admin_gateway_form_validate' => array(), $gateway['validate'] => array());
-    $form['gateway'] = array('#type' => 'value', '#value' => $gateway);
-    $form['gateway_id'] = array('#type' => 'value', '#value' => $gateway_id);
-    
-    return $form;    
+function sms_admin_gateway_form($form_state, $gateway_id) {
+  $gateway = sms_gateways('gateway', $gateway_id);
+  if (!is_array($gateway)) {
+    drupal_not_found();
   }
+  $form = $gateway['options'];
+  $form['submit'] = array(
+    '#type' => 'submit', 
+    '#value' => t('Save'),
+  );
+  $form['#validate'] = array('sms_admin_gateway_form_validate', $gateway['validate']);
+  $form['gateway'] = array('#type' => 'value', '#value' => $gateway);
+  $form['gateway_id'] = array('#type' => 'value', '#value' => $gateway_id);
+    
+  return $form;    
 }
 
-function sms_admin_gateway_form_submit($form_id, $form_values) {
-  $gateway = $form_values['gateway'];
+function sms_admin_gateway_form_submit($form, &$form_state) {
+  $gateway = $form_state['values']['gateway'];
   if (is_array($gateway['options'])) {
     foreach ($gateway['options'] as $key => $option) {
-      variable_set($key, $form_values[$key]);
+      variable_set($key, $form_state['values'][$key]);
     }
   }
   drupal_set_message(t('The gateway settings have been saved.'));
@@ -278,7 +286,8 @@ function sms_send_form($form = NULL, $de
   
   if (is_array($form)) {
     $form['sms'] = $sms_form;
-    $form['#base'] = 'sms_send_form';
+    $form['#submit'][] = 'sms_send_form_submit';
+    $form['#validate'][] = 'sms_send_form_validate';
     $form['submit'] = array(
       '#type' => 'submit',
       '#value' => t('Send'),
@@ -295,13 +304,13 @@ function sms_send_form($form = NULL, $de
  * Performs a simple send on submit. 
  * 
  */
-function sms_send_form_submit($form_id, $form_values) {
-  $form_values['number'] = sms_formatter($form_values['number']);
-  sms_send($form_values['number'], $form_values['message'], $form_values['gateway']);
+function sms_send_form_submit($form, &$form_state) {
+  $form_state['values']['number'] = sms_formatter($form_state['values']['number']);
+  sms_send($form_state['values']['number'], $form_state['values']['message'], $form_state['values']['gateway']);
 }
 
-function sms_send_form_validate($form_id, &$form_values) {
-  if (!sms_formatter($form_values['number'])) {
+function sms_send_form_validate($form, &$form_state) {
+  if (!sms_formatter($form_state['values']['number'])) {
     form_set_error('number', t('You must enter a valid ten digit phone number.'));
   }
-}
\ No newline at end of file
+}
Index: modules/sms_clickatell/sms_clickatell.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/smsframework/modules/sms_clickatell/sms_clickatell.info,v
retrieving revision 1.2
diff -u -p -r1.2 sms_clickatell.info
--- modules/sms_clickatell/sms_clickatell.info	30 Jul 2008 19:42:56 -0000	1.2
+++ modules/sms_clickatell/sms_clickatell.info	6 Aug 2008 20:35:16 -0000
@@ -2,4 +2,6 @@
 name = "Clickatell"
 description = "Allows the SMS Framework to use Clickatell as a gateway."
 package = SMS Framework
-dependencies = sms
\ No newline at end of file
+dependencies[] = sms
+core = 6.x
+
Index: modules/sms_clickatell/sms_clickatell.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/smsframework/modules/sms_clickatell/sms_clickatell.module,v
retrieving revision 1.2
diff -u -p -r1.2 sms_clickatell.module
--- modules/sms_clickatell/sms_clickatell.module	30 Jul 2008 19:42:56 -0000	1.2
+++ modules/sms_clickatell/sms_clickatell.module	6 Aug 2008 20:35:16 -0000
@@ -48,8 +48,8 @@ function sms_clickatell_gateway_info() {
 /**
  * Validates the submission of the configuration form.
  */ 
-function sms_clickatell_validate($form_id, $form_values) {
-  $result = sms_clickatell_command('auth', array(), $form_values);
+function sms_clickatell_validate($form, &$form_state) {
+  $result = sms_clickatell_command('auth', array(), $form_state['values']);
   $codes = sms_clickatell_error_codes();
   if ($result['status'] == 'ERR') {
     form_set_error('', t('A Clickatell gateway error occured: '. $codes[floor($result['code'])]));
@@ -96,7 +96,7 @@ function sms_clickatell_command($command
     $config = $gateway['configuration'];
   }
   
-  if ($config['ssl']) {
+  if ($config['sms_clickatell_ssl']) {
     $scheme = 'https';
   }
   else {
@@ -149,7 +149,7 @@ function sms_clickatell_get_session_id()
       if ($result['status'] == 'OK') {
         variable_set('sms_clickatell_session_id', $result['data']);
         variable_set('sms_clickatell_session_id_timestamp', time());
-        watchdog('sms', t('Clickatell session ID refreshed: '. $result['data']));
+        watchdog('sms', 'Clickatell session ID refreshed: %data', array('%data' => $result['data']));
       }
     }
   }
Index: modules/sms_receive/sms_receive.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/smsframework/modules/sms_receive/sms_receive.info,v
retrieving revision 1.2
diff -u -p -r1.2 sms_receive.info
--- modules/sms_receive/sms_receive.info	30 Jul 2008 19:42:57 -0000	1.2
+++ modules/sms_receive/sms_receive.info	6 Aug 2008 20:35:16 -0000
@@ -2,4 +2,5 @@
 name = "SMS Receive"
 description = "Allows the SMS Framework to receive messages."
 package = SMS Framework
-dependencies = sms
\ No newline at end of file
+dependencies[] = sms
+core = 6.x
Index: modules/sms_receive/sms_receive.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/smsframework/modules/sms_receive/sms_receive.install,v
retrieving revision 1.2
diff -u -p -r1.2 sms_receive.install
--- modules/sms_receive/sms_receive.install	30 Jul 2008 19:42:57 -0000	1.2
+++ modules/sms_receive/sms_receive.install	6 Aug 2008 20:35:16 -0000
@@ -1,25 +1,30 @@
 <?php
 // $Id: sms_receive.install,v 1.2 2008/07/30 19:42:57 diggersf Exp $
 function sms_receive_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      db_query("CREATE TABLE  {sms_receive} (
-                    `mid` int(10) unsigned NOT NULL,
-                    `number` varchar(255) NOT NULL,
-                    `message` varchar(255) NOT NULL,
-                    `time` varchar(255) NOT NULL,
-                    PRIMARY KEY  (`mid`)
-                  )/*!40100 DEFAULT CHARACTER SET utf8 */");
-      break;
-  }
+  drupal_install_schema('sms_receive');
+}
+
+/**
+ * Implementation of hook_schema().
+ */
+function sms_receive_schema() {
+  $schema['sms_receive'] = array(
+    'fields' => array(
+      'mid'         => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE),
+      'number'      => array('type' => 'varchar', 'not null' => TRUE, 'length' => 255),
+      'message'     => array('type' => 'varchar', 'not null' => TRUE, 'length' => 255),
+      'time'        => array('type' => 'varchar', 'not null' => TRUE, 'length' => 255),
+    ),
+    'primary key' => array('mid'),
+  );
+  return $schema;
 }
 
 /**
  * Implementation of hook_uninstall().
  */
 function sms_receive_uninstall() {
-  db_query('DROP TABLE {sms_receive}');
+  drupal_uninstall_schema('sms_receive');
   // remove set_variables here
 
   drupal_set_message(t('SMS Framework uninstalled successfully.'));
Index: modules/sms_receive/sms_receive.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/smsframework/modules/sms_receive/sms_receive.module,v
retrieving revision 1.2
diff -u -p -r1.2 sms_receive.module
--- modules/sms_receive/sms_receive.module	30 Jul 2008 19:42:57 -0000	1.2
+++ modules/sms_receive/sms_receive.module	6 Aug 2008 20:35:16 -0000
@@ -2,19 +2,17 @@
 // $Id: sms_receive.module,v 1.2 2008/07/30 19:42:57 diggersf Exp $
 
 function sms_receive_menu() {
-  $items[] = array(
-    'path' => 'admin/smsframework/receive',
-    'title' => t('Receive'),
-    'description' => t('Setting for the SMS receive module.'),
-    'access' => user_access('administer smsframework'),
-    'callback' => 'drupal_get_form',
-    'callback arguments' => array('sms_receive_admin_form'),
+  $items['admin/smsframework/receive'] = array(
+    'title' => 'Receive',
+    'description' => 'Setting for the SMS receive module.',
+    'access arguments' => array('administer smsframework'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('sms_receive_admin_form'),
   );
-  $items[] = array(
-    'path' => variable_get('sms_receive_path', 'sms/in'),
-    'title' => t('SMS Receive'),
-    'access' => user_access('receive sms message'),
-    'callback' => 'sms_receive_receive',
+  $items[variable_get('sms_receive_path', 'sms/in')] = array(
+    'title' => 'SMS Receive',
+    'access arguments' => array('receive sms message'),
+    'page callback' => 'sms_receive_receive',
     'type' => MENU_CALLBACK);
   return $items;
 }
@@ -60,19 +58,19 @@ function sms_receive_admin_form() {
   return $form;
 }
 
-function sms_receive_admin_form_submit($form_id, $form_values) {
-  if ($form_values['sms_receive_path']) {
+function sms_receive_admin_form_submit($form, &$form_state) {
+  if ($form_state['values']['sms_receive_path']) {
     // TODO: validation to check if path was actually set using sms_receive_set_callback
     global $base_url;
-    sms_receive_set_callback($base_url .'/'. $form_values['sms_receive_path']);
-    variable_set('sms_receive_path', $form_values['sms_receive_path']);
+    sms_receive_set_callback($base_url .'/'. $form_state['values']['sms_receive_path']);
+    variable_set('sms_receive_path', $form_state['values']['sms_receive_path']);
   }
-  if ($form_values['sms_receive_content_type']) {
-    variable_set('sms_receive_content_type', $form_values['sms_receive_content_type']);
+  if ($form_state['values']['sms_receive_content_type']) {
+    variable_set('sms_receive_content_type', $form_state['values']['sms_receive_content_type']);
   }
   $sms_fields = sms_receive_sms_fields();
   foreach ($sms_fields as $sms_field) {
-    variable_set('sms_receive_field_'. $sms_field , $form_values['sms_receive_field_'. $sms_field]);
+    variable_set('sms_receive_field_'. $sms_field , $form_state['values']['sms_receive_field_'. $sms_field]);
   }
 }
 
@@ -135,6 +133,7 @@ function sms_receive_parse() {
 function sms_receive_sms_fields() {
   // Maybe 'from' and 'text' should be built-in fields and 
   // this is used to collect extra fields, in our case 'type'
+  $fields = array();
   $gateway = variable_get('sms_default_gateway', 0);
   $function = 'sms_'. $gateway .'_receive_fields';
   if (function_exists($function)) {
Index: modules/sms_sendtophone/sms_sendtophone.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/smsframework/modules/sms_sendtophone/sms_sendtophone.info,v
retrieving revision 1.2
diff -u -p -r1.2 sms_sendtophone.info
--- modules/sms_sendtophone/sms_sendtophone.info	30 Jul 2008 19:42:57 -0000	1.2
+++ modules/sms_sendtophone/sms_sendtophone.info	6 Aug 2008 20:35:16 -0000
@@ -1,5 +1,7 @@
 ; $Id: sms_sendtophone.info,v 1.2 2008/07/30 19:42:57 diggersf Exp $
 name = Send to phone
 description = Provides various tools for sending bits of information via SMS.
-dependencies = sms
-package = SMS Framework
\ No newline at end of file
+dependencies[] = sms
+package = SMS Framework
+core = 6.x
+
Index: modules/sms_sendtophone/sms_sendtophone.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/smsframework/modules/sms_sendtophone/sms_sendtophone.module,v
retrieving revision 1.2
diff -u -p -r1.2 sms_sendtophone.module
--- modules/sms_sendtophone/sms_sendtophone.module	30 Jul 2008 19:42:57 -0000	1.2
+++ modules/sms_sendtophone/sms_sendtophone.module	6 Aug 2008 20:35:16 -0000
@@ -4,37 +4,32 @@
 /**
  * Implementation of hook_menu().
  */
-function sms_sendtophone_menu($may_cache) {
+function sms_sendtophone_menu() {
   $items = array();
 
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'sms/sendtophone',
-      'title' => t('Send to phone'),
-      'callback' => 'sms_sendtophone_page',
-      'access' => user_access('access content'),
-      'type' => MENU_CALLBACK,
-    );
+  $items['sms/sendtophone/%/%'] = array(
+    'title' => 'Send to phone',
+    'page callback' => 'sms_sendtophone_page',
+    'page arguments' => array(2,3),
+    'access arguments' => array('access content'),
+    'type' => MENU_CALLBACK,
+  );
     
-    $items[] = array(
-      'path' => 'sms/sendtophone/thickbox',
-      'title' => t('Send to phone'),
-      'callback' => 'sms_sendtophone_thickbox',
-      'access' => user_access('access content'),
-      'type' => MENU_CALLBACK,
-    );
+  $items['sms/sendtophone/thickbox'] = array(
+    'title' => 'Send to phone',
+    'page callback' => 'sms_sendtophone_thickbox',
+    'access arguments' => array('access content'),
+    'type' => MENU_CALLBACK,
+  );
     
-    $items[] = array(
-      'path' => 'admin/smsframework/sendtophone',
-      'title' => t('Send to phone'),
-      'description' => t('Configure send to phone functinality.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('sms_sendtophone_admin_overview'),
-      'access' => user_access('administer smsframework'),
-    );
+  $items['admin/smsframework/sendtophone'] = array(
+    'title' => 'Send to phone',
+    'description' => 'Configure send to phone functinality.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('sms_sendtophone_admin_overview'),
+    'access arguments' => array('administer smsframework'),
+  );
     
-  }
-  
   drupal_add_css(drupal_get_path('module', 'sms_sendtophone') .'/sms_sendtophone.css');
   if (module_exists('thickbox')) {
     drupal_add_js(drupal_get_path('module', 'sms_sendtophone') .'/sms_sendtophone.js');
@@ -72,7 +67,7 @@ function sms_sendtophone_admin_overview(
 /**
  * Menu callback.
  */
-function sms_sendtophone_page($type = NULL) {
+function sms_sendtophone_page($type, $reference) {
   global $user;
   $user = user_load(array('uid' => $user-> uid));
   if (user_access('send to any number') || !empty($user->sms_user['0']['number'])) {
@@ -81,7 +76,7 @@ function sms_sendtophone_page($type = NU
         $form = drupal_get_form('sms_sendtophone_inline_form');
         break;
       case 'node':
-        $form = drupal_get_form('sms_sendtophone_node_form');
+        $form = drupal_get_form('sms_sendtophone_node_form', $reference);
         break;
       case 'field':
         $form = drupal_get_form('sms_sendtophone_cck_form');
@@ -99,7 +94,7 @@ function sms_sendtophone_page($type = NU
     }
     else {
       $register = array(
-        '#value' => t('You do not have permission to send messages. You may need to <a href="@signin">sign in</a> or <a href="@register">register</a> for an account to send messages to a mobile phone.', array('@signin' => url('user', 'destination='. $_GET['destination']), '@register' => url('user/register', 'destination='. $_GET['destination']))),
+        '#value' => t('You do not have permission to send messages. You may need to <a href="@signin">sign in</a> or <a href="@register">register</a> for an account to send messages to a mobile phone.', array('@signin' => url('user', array('query' => array('destination' => $_GET['destination']))), '@register' => url('user/register', array('query' => array('destination' => $_GET['destination']))))),
       );
     }
     $form = drupal_render($register);
@@ -239,7 +234,7 @@ function _sms_sendtophone_filter_inline_
     '#size' => 40,
     '#maxlength' => 255,
     '#default_value' => variable_get("sms_sendtophone_filter_inline_custom_icon_path_$format", ''),
-    '#field_prefix' => url(NULL, NULL, NULL, TRUE),
+    '#field_prefix' => url(NULL, array('absolute' => TRUE)),
   );
 
   return $form;
@@ -412,9 +407,9 @@ function sms_sendtophone_cck_form() {
   return sms_send_form($form, $destination);
 }
 
-function sms_sendtophone_node_form() {
-  if (is_numeric(arg(3))) {
-    $node = node_load(arg(3));
+function sms_sendtophone_node_form($form_state, $nid) {
+  if (is_numeric($nid)) {
+    $node = node_load($nid);
         
     $form['message'] = array(
       '#type' => 'textarea',
@@ -422,7 +417,7 @@ function sms_sendtophone_node_form() {
       '#description' => t('This URL will be sent to the phone.'),
       '#cols' => 35,
       '#rows' => 2,
-      '#default_value' => url('node/'. $node->nid, NULL, NULL, TRUE),
+      '#default_value' => url('node/'. $node->nid, array('absolute' => TRUE)),
       '#attributes' => array('disabled' => 'true'),
     );
   global $user;
@@ -450,7 +445,7 @@ function sms_sendtophone_link($type, $no
   return $links;
 }
 
-function sms_sendtophone_form_alter($form_id, &$form) {
+function sms_sendtophone_form_alter(&$form, $form_state, $form_id) {
   if($form_id == sms_sendtophone_inline_form || $form_id == sms_sendtophone_node_form || $form_id == sms_sendtophone_cck_form) {
     if(!user_access('send to any number')) {
       // Makes number field plain text
