Index: captcha.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/captcha/captcha.module,v
retrieving revision 1.42.2.16
diff -u -b -B -u -p -r1.42.2.16 captcha.module
--- captcha.module	10 Aug 2007 13:54:26 -0000	1.42.2.16
+++ captcha.module	11 Aug 2007 21:44:40 -0000
@@ -65,6 +65,14 @@ function captcha_menu($may_cache) {
       'title' => t('Captcha'),
       'type' => MENU_DEFAULT_LOCAL_TASK,
     );
+    $items[] = array(
+      'path' => 'admin/user/captcha/examples',
+      'title' => t('Examples'),
+      'description' => t('An overview with examples of the available captcha challenges.'),
+      'callback' => 'captcha_examples',
+      'type' => MENU_LOCAL_TASK,
+      'weight' => 20,
+    );
   }
   return $items;
 }
@@ -452,6 +460,31 @@ function captcha_pre_render_place_captch
 }
 
 /**
+ * Funtion for generating a page with examples of all available captcha challenge types
+ */
+function captcha_examples() {
+  $output = t('This page gives an overview of all available captcha challenges, generated with their current settings.');
+  foreach(module_implements('captcha') as $module) {
+    $challenges = call_user_func_array($module .'_captcha', 'list');
+    if ($challenges) {
+      foreach($challenges as $challenge) {
+        $captcha = call_user_func_array($module .'_captcha', array('generate', $challenge));
+        $form = array();
+        $form['captcha'] = array(
+          '#type' => 'fieldset',
+          '#title' => t('Challenge "%challenge" by module "%module"', array('%challenge' => $challenge, '%module' => $module)),
+        );
+        $form['captcha'] = array_merge($form['captcha'], $captcha['form']);
+        $id = "captcha_examples_$module_$challenge";
+        drupal_process_form($id, $form);
+        $output .= drupal_render_form($id, $form);
+      }
+    }
+  }
+  return $output;
+}
+
+/**
  * Default implementation of hook_captcha
  */
 function captcha_captcha($op, $captcha_type='') {
