? gateway_mobilant_http.inc Index: gateway_clickatell_http.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/smsgateway/gateway_clickatell_http.inc,v retrieving revision 1.2 diff -u -r1.2 gateway_clickatell_http.inc --- gateway_clickatell_http.inc 3 Sep 2006 15:53:51 -0000 1.2 +++ gateway_clickatell_http.inc 27 Oct 2006 20:03:51 -0000 @@ -49,7 +49,15 @@ 'connectstring' a debug string indicating the string used to connect to the server (if supported) 'initialbalance' the balance at the start of the send (if supported) */ -function smsgateway_gateway_clickatell_http_sendsingle( $smssettings, $message) { +function smsgateway_gateway_clickatell_http_sendsingle( $message) { + + $smssettings = array(); + $smssettings['account_id'] = variable_get("smsgateway_apiid", ""); + $smssettings['accountname'] = variable_get("smsgateway_accountname", ""); + $smssettings['password'] = variable_get("smsgateway_password", ""); + $smssettings['from'] = variable_get("smsgateway_from", ""); + $smssettings['usessl'] = variable_get("smsgateway_usessl", ""); + $destination_number = trim($message['destination_number']); $message_body = trim($message['message_body']); $result = array(); @@ -78,7 +86,15 @@ Id-specific - the Unique ID passed in with each message is used to track the vendor specific text response as sent by the provider gateway server */ -function smsgateway_gateway_clickatell_http_sendbatch($smssettings, $sms_messages) { +function smsgateway_gateway_clickatell_http_sendbatch($sms_messages) { + + $smssettings = array(); + $smssettings['account_id'] = variable_get("smsgateway_apiid", ""); + $smssettings['accountname'] = variable_get("smsgateway_accountname", ""); + $smssettings['password'] = variable_get("smsgateway_password", ""); + $smssettings['from'] = variable_get("smsgateway_from", ""); + $smssettings['usessl'] = variable_get("smsgateway_usessl", ""); + $smsapi = new clickatell($smssettings['account_id'], $smssettings['accountname'], $smssettings['password'], $smssettings['usessl']); $result['connectstring'] = $smsapi->build_connection_string(); $result['initialbalance'] = $smsapi->getbalance(); @@ -118,6 +134,54 @@ return $result; } +function smsgateway_gateway_clickatell_http_settings() { + $form['smsgateway_usessl'] = array( + '#type' => 'checkbox', + '#title' => t('Use SSL Encryption'), + '#return_value' => 1, + '#default_value' => variable_get('smsgateway_usessl', '0'), + '#description' => t('Whether the connection to the gateway should be encrypted.'), + ); + + $form["smsgateway_apiid"] = array( + '#type' => 'textfield', + '#title' => t('API Identifier'), + '#default_value' => variable_get('smsgateway_apiid', ''), + '#size' => 10, + '#maxlength' => 10, + '#description' => t('The API version identifier that may be used by the SMS gateway.'), + ); + + $form['smsgateway_accountname'] = array( + '#type' => 'textfield', + '#title' => t('Account Name'), + '#default_value' => variable_get('smsgateway_accountname', ''), + '#size' => 25, + '#maxlength' => 40, + '#description' => t('The account or user name used to log into the SMS gateway.', NULL, TRUE), + ); + + $form['smsgateway_password'] = array( + '#type' => 'textfield', + '#title' => t('Password'), + '#default_value' => variable_get('smsgateway_password', ''), + '#size' => 25, + '#maxlength' => 40, + '#description' => t('The password used to log into the SMS gateway.', NULL, TRUE), + ); + + $form['smsgateway_from'] = array( + '#type' => 'textfield', + '#title' => t('From Number'), + '#default_value' => variable_get('smsgateway_from', ''), + '#size' => 25, + '#maxlength' => 40, + '#description' => t('The telephone number that the message is sent from.'), + ); + + return $form; +} + /** * Main SMS-API class * Index: smsgateway.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/smsgateway/smsgateway.module,v retrieving revision 1.4 diff -u -r1.4 smsgateway.module --- smsgateway.module 3 Sep 2006 15:53:51 -0000 1.4 +++ smsgateway.module 27 Oct 2006 20:03:51 -0000 @@ -290,19 +290,13 @@ } $smsgateway_gateway = variable_get("smsgateway_gateway", ""); - $smssettings = array(); - $smssettings['account_id'] = variable_get("smsgateway_apiid", ""); - $smssettings['accountname'] = variable_get("smsgateway_accountname", ""); - $smssettings['password'] = variable_get("smsgateway_password", ""); - $smssettings['from'] = variable_get("smsgateway_from", ""); - $smssettings['usessl'] = variable_get("smsgateway_usessl", ""); if($smsgateway_gateway != '') { $message = array(); $message['destination_number'] = $destination_number; $message['message_body'] = $message_body; _smsgateway_ensuregateway( $smsgateway_gateway); - $result = _smsgateway_invoke('sendsingle', $smsgateway_gateway, $smssettings, $message); + $result = _smsgateway_invoke('sendsingle', $smsgateway_gateway, $message); _smsgateway_smslog($destination_number, $message_body, $result['response']); } else { @@ -326,16 +320,10 @@ */ function smsgateway_sendmessageset( $sms_messages) { $smsgateway_gateway = variable_get("smsgateway_gateway", ""); - $smssettings = array(); - $smssettings['account_id'] = variable_get("smsgateway_apiid", ""); - $smssettings['accountname'] = variable_get("smsgateway_accountname", ""); - $smssettings['password'] = variable_get("smsgateway_password", ""); - $smssettings['from'] = variable_get("smsgateway_from", ""); - $smssettings['usessl'] = variable_get("smsgateway_usessl", ""); if($smsgateway_gateway != '') { _smsgateway_ensuregateway( $smsgateway_gateway); - $result = _smsgateway_invoke('sendbatch', $smsgateway_gateway, $smssettings, $sms_messages); + $result = _smsgateway_invoke('sendbatch', $smsgateway_gateway, $sms_messages); foreach( $sms_messages as $msgid => $message) { _smsgateway_smslog($message['destination_number'], $message['message_body'], $result[ $msgid]); } @@ -461,49 +449,8 @@ '#multiple' => FALSE, ); - $form['smsgateway_usessl'] = array( - '#type' => 'checkbox', - '#title' => t('Use SSL Encryption'), - '#return_value' => 1, - '#default_value' => variable_get('smsgateway_usessl', '0'), - '#description' => t('Whether the connection to the gateway should be encrypted.'), - ); - - $form["smsgateway_apiid"] = array( - '#type' => 'textfield', - '#title' => t('API Identifier'), - '#default_value' => variable_get('smsgateway_apiid', ''), - '#size' => 10, - '#maxlength' => 10, - '#description' => t('The API version identifier that may be used by the SMS gateway.'), - ); - - $form['smsgateway_accountname'] = array( - '#type' => 'textfield', - '#title' => t('Account Name'), - '#default_value' => variable_get('smsgateway_accountname', ''), - '#size' => 25, - '#maxlength' => 40, - '#description' => t('The account or user name used to log into the SMS gateway.', NULL, TRUE), - ); - - $form['smsgateway_password'] = array( - '#type' => 'textfield', - '#title' => t('Password'), - '#default_value' => variable_get('smsgateway_password', ''), - '#size' => 25, - '#maxlength' => 40, - '#description' => t('The password used to log into the SMS gateway.', NULL, TRUE), - ); - - $form['smsgateway_from'] = array( - '#type' => 'textfield', - '#title' => t('From Number'), - '#default_value' => variable_get('smsgateway_from', ''), - '#size' => 25, - '#maxlength' => 40, - '#description' => t('The telephone number that the message is sent from.'), - ); + // Display gateway dependant settings + $form[] = _smsgateway_invoke( 'settings', $current_gateway); return $form; } // function smsgateway_settings