--- spamicide.module	2009-05-16 22:00:38.000000000 +0200
+++ spamicide.module.new	2010-04-11 19:45:35.000000000 +0200
@@ -306,7 +306,7 @@
           '#value' => drupal_get_destination(),
         );
         $form['#pre_render'][] = 'spamicide_pre_render_place_spamicide';
-        $form['spamicide']['#validate']['spamicide_validate'] = array();
+        $form['spamicide']['#element_validate'] = array('spamicide_validate');
     }
     else if (user_access('administer spamicide') && variable_get('spamicide_administration_mode', TRUE) && arg(0) != 'admin') {
       $form['spamicide'] = array(
@@ -333,12 +333,12 @@
  * @return none
  */
 function spamicide_validate($form, &$form_state) {
-  $form_id = $form_state['values']['#post']['form_id'];
+  $form_id = $form_state['values']['form_id'];
   $spamicide_field = _spamicide_get_field($form_id);
   if (!$spamicide_field) {
     return;
   }
-  else if (empty($form_state['values']['#post'][$spamicide_field])) {
+  else if (empty($form_state['values'][$spamicide_field])) {
     return;
   }
   else {
@@ -348,8 +348,9 @@
     if (variable_get('spamicide_log_attempts', FALSE)) {
       watchdog('Spamicide',
         t('%form_id post blocked by Spamicide module: their IP address is "%ipaddress".',
-          array('%form_id' => $form_id, '%ipaddress' => $_ENV['REMOTE_ADDR'])
+          array('%form_id' => $form_id, '%ipaddress' => ip_address())
         ),
+        array(),
         WATCHDOG_NOTICE);
     }
     // If Spamicide was on a login form: stop validating, quit the current request
@@ -422,7 +423,7 @@
   $path = file_create_path($css_file);
   if (!file_exists($path)) { // or !is_file or !file_exists or !file_check_location
     $css = "#edit-". str_replace('_', '-', $form_field) ."-wrapper\n{\n  display: none;\n}\n";
-    file_save_data($css, $css_file, FILE_EXISTS_REPLACE);
+    file_save_data($css, $path, FILE_EXISTS_REPLACE);
   }
 }
 
@@ -436,7 +437,7 @@
   if (module_exists('locale')) {
     if ($lang_code == NULL) {
       global $language;
-      $lang_code = $language;
+      $lang_code = $language->language;
     }
     $description = variable_get("spamicide_description_$lang_code", $default);
   }
