=== modified file 'sites/all/modules/customcssjs/customcssjs.module'
--- sites/all/modules/customcssjs/customcssjs.module	2010-08-13 20:43:44 +0000
+++ sites/all/modules/customcssjs/customcssjs.module	2010-08-13 20:34:00 +0000
@@ -109,10 +109,10 @@ function customcssjs_admin_validate($for
   
   $css_path = $form_state['values']['customcssjs_css'] ;
   $css_full_path = file_directory_path() .'/'. $css_path;
-  file_check_directory($css_full_path, 1, 'customcssjs_css');
+  _customcssjs_file_check_directory($css_full_path, 1, 'customcssjs_css');
   $js_path = $form_state['values']['customcssjs_js'] ;
   $js_full_path = file_directory_path() .'/'.  $js_path;
-  file_check_directory($js_full_path, 1, 'customcssjs_js');
+  _customcssjs_file_check_directory($js_full_path, 1, 'customcssjs_js');
 }
 
 /**
@@ -177,3 +177,62 @@ function customcssjs_preprocess_page(&$v
 
 }
 
+/**
+ * Copy of file_check_directory, except the mkdir command is recursive.
+ * May be removed in D7.
+ *
+ * @param $directory A string containing the name of a directory path.
+ * @param $mode A Boolean value to indicate if the directory should be created
+ *   if it does not exist or made writable if it is read-only.
+ * @param $form_item An optional string containing the name of a form item that
+ *   any errors will be attached to. This is useful for settings forms that
+ *   require the user to specify a writable directory. If it can't be made to
+ *   work, a form error will be set preventing them from saving the settings.
+ * @return FALSE when directory not found, or TRUE when directory exists.
+ *
+ * @see file_check_dorectory9)
+ */
+function _customcssjs_file_check_directory(&$directory, $mode = 0, $form_item = NULL) {
+  $directory = rtrim($directory, '/\\');
+
+  // Check if directory exists.
+  if (!is_dir($directory)) {
+    if (($mode & FILE_CREATE_DIRECTORY) && @mkdir($directory, 0755, TRUE)) {
+      drupal_set_message(t('The directory %directory has been created.', array('%directory' => $directory)));
+      @chmod($directory, 0775); // Necessary for non-webserver users.
+    }
+    else {
+      if ($form_item) {
+        form_set_error($form_item, t('The directory %directory does not exist.', array('%directory' => $directory)));
+      }
+      return FALSE;
+    }
+  }
+
+  // Check to see if the directory is writable.
+  if (!is_writable($directory)) {
+    if (($mode & FILE_MODIFY_PERMISSIONS) && @chmod($directory, 0775)) {
+      drupal_set_message(t('The permissions of directory %directory have been changed to make it writable.', array('%directory' => $directory)));
+    }
+    else {
+      form_set_error($form_item, t('The directory %directory is not writable', array('%directory' => $directory)));
+      watchdog('file system', 'The directory %directory is not writable, because it does not have the correct permissions set.', array('%directory' => $directory), WATCHDOG_ERROR);
+      return FALSE;
+    }
+  }
+
+  if ((file_directory_path() == $directory || file_directory_temp() == $directory) && !is_file("$directory/.htaccess")) {
+    $htaccess_lines = "SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006\nOptions None\nOptions +FollowSymLinks";
+    if (($fp = fopen("$directory/.htaccess", 'w')) && fputs($fp, $htaccess_lines)) {
+      fclose($fp);
+      chmod($directory .'/.htaccess', 0664);
+    }
+    else {
+      $variables = array('%directory' => $directory, '!htaccess' => '<br />'. nl2br(check_plain($htaccess_lines)));
+      form_set_error($form_item, t("Security warning: Couldn't write .htaccess file. Please create a .htaccess file in your %directory directory which contains the following lines: <code>!htaccess</code>", $variables));
+      watchdog('security', "Security warning: Couldn't write .htaccess file. Please create a .htaccess file in your %directory directory which contains the following lines: <code>!htaccess</code>", $variables, WATCHDOG_ERROR);
+    }
+  }
+
+  return TRUE;
+}

