diff --git a/ehawk.info b/ehawk.info index 4dd481d..a027211 100644 --- a/ehawk.info +++ b/ehawk.info @@ -1,5 +1,6 @@ name = E-Hawk Integration description = Provides integration between webforms and the E-Hawk vetting service. +package = Fraud core = 7.x dependencies[] = webform configure = admin/config/services/ehawk diff --git a/ehawk.module b/ehawk.module index 721d1a6..f550bc8 100644 --- a/ehawk.module +++ b/ehawk.module @@ -247,7 +247,7 @@ function _ehawk_current_forms() { /** * Builds a form for choosing a new form to integrate with E-Hawk. * - * @param $form_state + * @param array $form_state * The keyed array of the current form state. * * @return array @@ -283,9 +283,9 @@ function ehawk_add_form($form_state) { /** * Processes initial integration of webform with E-Hawk. * - * @param $form + * @param array $form * The nested array of form elements. - * @param $form_state + * @param array $form_state * Keyed array of current state of the form. */ function ehawk_add_form_submit($form, &$form_state) { @@ -336,9 +336,9 @@ function ehawk_forms_list() { /** * Menu callback to providing form confirming removal of ehawk form integration. * - * @param $form + * @param array $form * Nested array of elements comprising the form. - * @param $form_state + * @param array $form_state * The keyed array of the current form's state. * @param int $the_id * Node ID of the webform to remove E-Hawk integration from. @@ -363,9 +363,9 @@ function ehawk_form_remove($form, &$form_state, $the_id) { /** * Process removal of webform E-Hawk integration. * - * @param $form + * @param array $form * Nested array of form elements. - * @param $form_state + * @param array $form_state * Keyed array of current state of the form, including submitted data. */ function ehawk_form_remove_submit($form, &$form_state) { @@ -393,9 +393,9 @@ function ehawk_form_remove_submit($form, &$form_state) { /** * Menu callback to provide a form to config a specific ehawk form integration. * - * @param $form + * @param array $form * Nested array of form elements. - * @param $form_state + * @param array $form_state * Keyed array of current state of the form, including submitted data. * @param int $nid * Node ID of the webform being integrated into E-Hawk. @@ -406,7 +406,7 @@ function ehawk_form_remove_submit($form, &$form_state) { function ehawk_form_configure($form, &$form_state, $nid) { // Fetch our webform components. - // TO DO: make sure this is a real node, has a webform component, etc. + // @todo: make sure this is a real node, has a webform component, etc. $node = node_load($nid); $elements = $node->webform['components']; @@ -478,7 +478,7 @@ function ehawk_form_configure($form, &$form_state, $nid) { $ehawk_collection_fields = _ehawk_fields(); - // TO DO : support teasing out "details=yes" functionality provided by API. + // @todo : support teasing out "details=yes" functionality provided by API. $ehawk_return_fields = _ehawk_fields('return'); // Some fields need descriptions. @@ -582,7 +582,7 @@ function ehawk_form_configure($form, &$form_state, $nid) { '#default_value' => (isset($config['options']['suppress_server'])) ? $config['options']['suppress_server'] : "", ); - // TO DO: options for timeout, HTTPS?, revet toggle, details=yes, etc. + // @todo: options for timeout, HTTPS?, revet toggle, details=yes, etc. $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( @@ -600,9 +600,9 @@ function ehawk_form_configure($form, &$form_state, $nid) { /** * Process saving a configuration. * - * @param $form + * @param array $form * Nested array of form elements. - * @param $form_state + * @param array $form_state * Keyed array of current state of the form, including submitted data. */ function ehawk_form_configure_submit($form, &$form_state) { @@ -660,7 +660,12 @@ function ehawk_form_alter(&$form, &$form_state, $form_id) { if (!$webform_id) { return; } - if (db_query('SELECT nid FROM {ehawk_forms} WHERE nid = :wid', array(':wid' => $webform_id))->rowCount() != 1) { + $count = db_select('ehawk_forms', 'e') + ->fields('e') + ->condition('nid', $webform_id) + ->execute() + ->rowCount(); + if ($count != 1) { return; } @@ -695,9 +700,9 @@ function ehawk_form_alter(&$form, &$form_state, $form_id) { /** * Check a webform's submission against E-Hawk's vetting API. * - * @param $form + * @param array $form * Nested array of form elements. - * @param $form_state + * @param array $form_state * Keyed array of current state of the form, including submitted data. */ function ehawk_api_connector($form, &$form_state) { @@ -710,15 +715,19 @@ function ehawk_api_connector($form, &$form_state) { } // Pull this node's ehawk options, if present. Otherwise, continue on... - $query = db_query('SELECT * FROM {ehawk_forms} WHERE nid = :wid', array(':wid' => $nid)); - if ($query->rowCount() != 1) { + $results = db_select('ehawk_forms', 'e') + ->fields('e') + ->condition('e.nid', $nid) + ->execute(); + $count = $results->rowCount(); + if ($count != 1) { return; } - $config = $query->fetchObject(); + $config = $results->fetch(); $config->field_map = unserialize($config->field_map); - $config->options = unserialize($config->options); - $config->apikey = variable_get('ehawk_api_key'); - $config->version = 'V1.5'; + $config->options = unserialize($config->options); + $config->apikey = variable_get('ehawk_api_key'); + $config->version = 'V1.5'; // Set Vet API request vars. $post_array['details'] = 'yes'; @@ -740,6 +749,7 @@ function ehawk_api_connector($form, &$form_state) { } // Provide the talon. + $talon_fingerprint = ''; if (isset($form_state['values']['talon'])) { $post_array['talon'] = $form_state['values']['talon']; $talon = json_decode($form_state['values']['talon']);