Index: image_captcha/image_captcha.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/captcha/image_captcha/Attic/image_captcha.module,v
retrieving revision 1.1.4.14
diff -u -u -p -r1.1.4.14 image_captcha.module
--- image_captcha/image_captcha.module	29 Aug 2007 19:18:34 -0000	1.1.4.14
+++ image_captcha/image_captcha.module	10 Sep 2007 17:04:26 -0000
@@ -288,6 +288,13 @@ function image_captcha_captcha($op, $cap
       }
     case 'generate':
       if ($captcha_type == 'Image') {
+        // In offline mode, the image CAPTCHA does not work because the request
+        // for the image itself won't succeed (only ?q=user is permitted for
+        // unauthenticated users). We fall back to the Math Captcha.
+        global $user;
+        if (variable_get('site_offline', FALSE) && $user->uid == 0) {
+          return captcha_captcha('generate', 'Math', $args);
+        }
         // generate a captcha code
         $allowed_chars = _image_captcha_utf8_split(variable_get('image_captcha_image_allowed_chars', IMAGE_CAPTCHA_ALLOWED_CHARACTERS));
         $code_length = (int)variable_get('image_captcha_code_length', 5);
