commit ac1bc5de3c1dbb439e582632cecfbfef84d14319
Author: Assos Assos <assos+forge@centrale-marseille.fr>
Date:   Wed Dec 3 22:49:40 2014 +0100

    Weekly update of contrib modules

diff --git a/drupal7/sites/all/modules/captcha/captcha.admin.inc b/drupal7/sites/all/modules/captcha/captcha.admin.inc
index 164fae22..2a956c4a 100644
--- a/drupal7/sites/all/modules/captcha/captcha.admin.inc
+++ b/drupal7/sites/all/modules/captcha/captcha.admin.inc
@@ -6,16 +6,17 @@
  */
 
 /**
- * Return an array with the available CAPTCHA types, for use as options array
- * for a select form elements.
+ * Return an array with the available CAPTCHA types, for use as options array for a select form elements.
  *
- * @param $add_special_options if true: also add a 'none' and 'default' option
+ * @param bool $add_special_options
+ *   if true: also add a 'none' and 'default' option
  *
- * @return an associative array mapping "$module/$type" to
+ * @return array
+ *   Mapping "$module/$type" to
  *   "$type (from module $module)" with $module the module name implementing the CAPTCHA
  *   and $type the name of the CAPTCHA type.
  */
-function _captcha_available_challenge_types($add_special_options=TRUE) {
+function _captcha_available_challenge_types($add_special_options = TRUE) {
   $captcha_types = array();
   if ($add_special_options) {
     $captcha_types['none'] = t('- No challenge -');
@@ -35,7 +36,7 @@ function _captcha_available_challenge_types($add_special_options=TRUE) {
 }
 
 /**
- * Form builder function for the general CAPTCHA configuration
+ * Form builder function for the general CAPTCHA configuration.
  */
 function captcha_admin_settings() {
   module_load_include('inc', 'captcha');
@@ -88,7 +89,7 @@ function captcha_admin_settings() {
     $form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id]['operations'] = array(
       '#markup' => implode(", ", array(
         l(t('delete'), "admin/config/people/captcha/captcha/captcha_point/{$captcha_point->form_id}/delete"),
-      ))
+      )),
     );
   }
 
@@ -197,14 +198,10 @@ function captcha_admin_settings() {
     '#title' => t('Persistence'),
     '#default_value' => variable_get('captcha_persistence', CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL_PER_FORM_INSTANCE),
     '#options' => array(
-      CAPTCHA_PERSISTENCE_SHOW_ALWAYS =>
-        t('Always add a challenge.'),
-      CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL_PER_FORM_INSTANCE =>
-        t('Omit challenges in a multi-step/preview workflow once the user successfully responds to a challenge.'),
-      CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL_PER_FORM_TYPE =>
-        t('Omit challenges on a form type once the user successfully responds to a challenge on a form of that type.'),
-      CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL =>
-        t('Omit challenges on all forms once the user successfully responds to any challenge on the site.'),
+      CAPTCHA_PERSISTENCE_SHOW_ALWAYS => t('Always add a challenge.'),
+      CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL_PER_FORM_INSTANCE => t('Omit challenges in a multi-step/preview workflow once the user successfully responds to a challenge.'),
+      CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL_PER_FORM_TYPE => t('Omit challenges on a form type once the user successfully responds to a challenge on a form of that type.'),
+      CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL => t('Omit challenges on all forms once the user successfully responds to any challenge on the site.'),
     ),
     '#description' => t('Define if challenges should be omitted during the rest of a session once the user successfully responds to a challenge.'),
   );
@@ -236,7 +233,7 @@ function captcha_admin_settings() {
 }
 
 /**
- * Custom theme function for a table of (form_id -> CAPTCHA type) settings
+ * Custom theme function for a table of (form_id -> CAPTCHA type) settings.
  */
 function theme_captcha_admin_settings_captcha_points($variables) {
   $form = $variables['form'];
@@ -282,7 +279,7 @@ function captcha_admin_settings_submit($form, &$form_state) {
   variable_set('captcha_default_challenge', $form_state['values']['captcha_default_challenge']);
   variable_set('captcha_default_challenge_on_nonlisted_forms', $form_state['values']['captcha_default_challenge_on_nonlisted_forms']);
 
-  // Process CAPTCHA points
+  // Process CAPTCHA points.
   if (isset($form_state['values']['captcha_form_id_overview']['captcha_captcha_points'])) {
     foreach ($form_state['values']['captcha_form_id_overview']['captcha_captcha_points'] as $captcha_point_form_id => $data) {
       captcha_set_form_id_setting($captcha_point_form_id, $data['captcha_type']);
@@ -332,9 +329,6 @@ function captcha_admin_settings_submit($form, &$form_state) {
   drupal_set_message(t('The CAPTCHA settings have been saved.'), 'status');
 }
 
-
-
-
 /**
  * Submit callback; clear CAPTCHA placement cache.
  */
@@ -343,33 +337,36 @@ function captcha_clear_captcha_placement_cache_submit($form, &$form_state) {
   drupal_set_message(t('Cleared the CAPTCHA placement cache.'));
 }
 
-
 /**
- * Central handler for CAPTCHA point administration (adding, disabling, deleting)
+ * Central handler for CAPTCHA point administration (adding, disabling, deleting).
  */
-function captcha_point_admin($captcha_point_form_id=NULL, $op=NULL) {
+function captcha_point_admin($captcha_point_form_id = NULL, $op = NULL) {
   module_load_include('inc', 'captcha');
 
-  // if $captcha_point_form_id and action $op given: do the action
+  // If $captcha_point_form_id and action $op given: do the action.
   if ($captcha_point_form_id) {
     switch ($op) {
       case 'disable':
         return drupal_get_form('captcha_point_disable_confirm', $captcha_point_form_id, FALSE);
+
       case 'delete':
         return drupal_get_form('captcha_point_disable_confirm', $captcha_point_form_id, TRUE);
     }
-    // return edit form for CAPTCHA point
+    // Return edit form for CAPTCHA point.
     return drupal_get_form('captcha_point_admin_form', $captcha_point_form_id);
   }
-  // return add form for CAPTCHA point
+  // Return add form for CAPTCHA point.
   return drupal_get_form('captcha_point_admin_form');
 }
 
-function captcha_point_admin_form($form, $form_state, $captcha_point_form_id=NULL) {
+/**
+ * Admin form.
+ */
+function captcha_point_admin_form($form, $form_state, $captcha_point_form_id = NULL) {
   $form = array();
   $default_captcha_type = 'none';
   if (isset($captcha_point_form_id)) {
-    // use given CAPTCHA point form_id
+    // Use given CAPTCHA point form_id.
     $form['captcha_point_form_id'] = array(
       '#type' => 'textfield',
       '#title' => t('Form ID'),
@@ -383,14 +380,14 @@ function captcha_point_admin_form($form, $form_state, $captcha_point_form_id=NUL
     }
   }
   else {
-    // textfield for CAPTCHA point form_id
+    // Textfield for CAPTCHA point form_id.
     $form['captcha_point_form_id'] = array(
       '#type' => 'textfield',
       '#title' => t('Form ID'),
       '#description' => t('The Drupal form_id of the form to add the CAPTCHA to.'),
     );
   }
-  // select widget for CAPTCHA type
+  // Select widget for CAPTCHA type.
   $form['captcha_type'] = array(
     '#type' => 'select',
     '#title' => t('Challenge type'),
@@ -398,9 +395,9 @@ function captcha_point_admin_form($form, $form_state, $captcha_point_form_id=NUL
     '#default_value' => $default_captcha_type,
     '#options' => _captcha_available_challenge_types(),
   );
-  // redirect to general CAPTCHA settings page after submission
+  // Redirect to general CAPTCHA settings page after submission.
   $form['#redirect'] = 'admin/config/people/captcha';
-  // submit button
+  // Submit button.
   $form['actions'] = array('#type' => 'actions');
   $form['actions']['submit'] = array(
     '#type' => 'submit',
@@ -409,9 +406,8 @@ function captcha_point_admin_form($form, $form_state, $captcha_point_form_id=NUL
   return $form;
 }
 
-
 /**
- * validation function for captcha_point_admin_form
+ * Validation function for captcha_point_admin_form.
  */
 function captcha_point_admin_form_validate($form, $form_state) {
   if (!preg_match('/^[a-z0-9_]+$/', $form_state['values']['captcha_point_form_id'])) {
@@ -419,7 +415,6 @@ function captcha_point_admin_form_validate($form, $form_state) {
   }
 }
 
-
 /**
  * Submit function for captcha_point_admin_form.
  */
@@ -431,7 +426,7 @@ function captcha_point_admin_form_submit($form, $form_state) {
 }
 
 /**
- * Confirm dialog for disabling/deleting a CAPTCHA point
+ * Confirm dialog for disabling/deleting a CAPTCHA point.
  */
 function captcha_point_disable_confirm($form, &$form_state, $captcha_point_form_id, $delete) {
   $form = array();
@@ -496,12 +491,12 @@ function captcha_examples($form, $form_state, $module, $challenge) {
   $form = array();
   if ($module && $challenge) {
     // Generate 10 example challenges.
-    for ($i=0; $i<10; $i++) {
+    for ($i = 0; $i < 10; $i++) {
       $form["challenge_{$i}"] = _captcha_generate_example_challenge($module, $challenge);
     }
   }
   else {
-    // generate a list with examples of the available CAPTCHA types
+    // Generate a list with examples of the available CAPTCHA types.
     $form['info'] = array(
       '#markup' => t('This page gives an overview of all available challenge types, generated with their current settings.'),
     );
diff --git a/drupal7/sites/all/modules/captcha/captcha.inc b/drupal7/sites/all/modules/captcha/captcha.inc
index 161bf8c1..9412bc75 100644
--- a/drupal7/sites/all/modules/captcha/captcha.inc
+++ b/drupal7/sites/all/modules/captcha/captcha.inc
@@ -8,14 +8,16 @@
 /**
  * Helper function for adding/updating a CAPTCHA point.
  *
- * @param $form_id the form ID to configure.
- * @param captcha_type the setting for the given form_id, can be:
+ * @param string $form_id
+ *   the form ID to configure.
+ *
+ * @param string $captcha_type
+ *   the setting for the given form_id, can be:
  *   - 'none' to disable CAPTCHA,
  *   - 'default' to use the default challenge type
  *   - NULL to remove the entry for the CAPTCHA type
  *   - something of the form 'image_captcha/Image'
  *   - an object with attributes $captcha_type->module and $captcha_type->captcha_type
- * @return nothing
  */
 function captcha_set_form_id_setting($form_id, $captcha_type) {
   // Handle 'none'.
@@ -52,32 +54,41 @@ function captcha_set_form_id_setting($form_id, $captcha_type) {
       ->execute();
   }
   else {
-    drupal_set_message(t('Failed to set a CAPTCHA type for form %form_id: could not interpret value "@captcha_type"',
-      array('%form_id' => $form_id, '@captcha_type' => (string)$captcha_type)), 'warning');
+    drupal_set_message(
+      t('Failed to set a CAPTCHA type for form %form_id: could not interpret value "@captcha_type"',
+      array(
+        '%form_id' => $form_id,
+        '@captcha_type' => (string) $captcha_type,
+      )
+      ),
+      'warning'
+    );
   }
 }
 
 /**
  * Get the CAPTCHA setting for a given form_id.
  *
- * @param $form_id the form_id to query for
- * @param $symbolic flag to return as (symbolic) strings instead of object.
+ * @param string $form_id
+ *   the form_id to query for
+ *
+ * @param bool $symbolic
+ *   flag to return as (symbolic) strings instead of object.
  *
- * @return NULL if no setting is known
+ * @return NULL
+ *   if no setting is known
  *   or a captcha_point object with fields 'module' and 'captcha_type'.
  *   If argument $symbolic is true, returns (symbolic) as 'none', 'default'
  *   or in the form 'captcha/Math'.
  */
-function captcha_get_form_id_setting($form_id, $symbolic=FALSE) {
+function captcha_get_form_id_setting($form_id, $symbolic = FALSE) {
   // Fetch setting from database.
-  $result = db_query("SELECT module, captcha_type FROM {captcha_points} WHERE form_id = :form_id",
-    array(':form_id' =>  $form_id));
+  $result = db_query("SELECT module, captcha_type FROM {captcha_points} WHERE form_id = :form_id", array(':form_id' => $form_id));
   $captcha_point = $result->fetchObject();
 
   // If no setting is available in database for the given form,
-  // but 'captcha_default_challenge_on_nonlisted_forms' is enabled, pick the default type anyway
-  if (!$captcha_point && variable_get('captcha_default_challenge_on_nonlisted_forms', FALSE))
-  {
+  // but 'captcha_default_challenge_on_nonlisted_forms' is enabled, pick the default type anyway.
+  if (!$captcha_point && variable_get('captcha_default_challenge_on_nonlisted_forms', FALSE)) {
     $captcha_point = (object) array('captcha_type' => 'default');
   }
 
@@ -104,15 +115,19 @@ function captcha_get_form_id_setting($form_id, $symbolic=FALSE) {
   return $captcha_point;
 }
 
-
 /**
  * Helper function for generating a new CAPTCHA session.
  *
- * @param $form_id the form_id of the form to add a CAPTCHA to.
- * @param $status the initial status of the CAPTHCA session.
- * @return the session ID of the new CAPTCHA session.
+ * @param string $form_id
+ *   the form_id of the form to add a CAPTCHA to.
+ *
+ * @param int $status
+ *   the initial status of the CAPTHCA session.
+ *
+ * @return int
+ *   the session ID of the new CAPTCHA session.
  */
-function _captcha_generate_captcha_session($form_id=NULL, $status=CAPTCHA_STATUS_UNSOLVED) {
+function _captcha_generate_captcha_session($form_id = NULL, $status = CAPTCHA_STATUS_UNSOLVED) {
   global $user;
   // Initialize solution with random data.
   $solution = md5(mt_rand());
@@ -135,8 +150,11 @@ function _captcha_generate_captcha_session($form_id=NULL, $status=CAPTCHA_STATUS
 /**
  * Helper function for updating the solution in the CAPTCHA session table.
  *
- * @param $captcha_sid the CAPTCHA session ID to update.
- * @param $solution the new solution to associate with the given CAPTCHA session.
+ * @param int $captcha_sid
+ *   the CAPTCHA session ID to update.
+ *
+ * @param string $solution
+ *   the new solution to associate with the given CAPTCHA session.
  */
 function _captcha_update_captcha_session($captcha_sid, $solution) {
   db_update('captcha_sessions')
@@ -149,8 +167,9 @@ function _captcha_update_captcha_session($captcha_sid, $solution) {
 }
 
 /**
- * Helper function for checking if CAPTCHA is required for user,
- * based on the CAPTCHA persistence setting, the CAPTCHA session ID and
+ * Helper function for checking if CAPTCHA is required for user.
+ *
+ * Based on the CAPTCHA persistence setting, the CAPTCHA session ID and
  * user session info.
  */
 function _captcha_required_for_user($captcha_sid, $form_id) {
@@ -174,10 +193,11 @@ function _captcha_required_for_user($captcha_sid, $form_id) {
     return TRUE;
   }
   else {
-    $captcha_success_form_ids = isset($_SESSION['captcha_success_form_ids']) ? (array)($_SESSION['captcha_success_form_ids']) : array();
+    $captcha_success_form_ids = isset($_SESSION['captcha_success_form_ids']) ? (array) ($_SESSION['captcha_success_form_ids']) : array();
     switch ($captcha_persistence) {
       case CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL:
         return (count($captcha_success_form_ids) == 0);
+
       case CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL_PER_FORM_TYPE:
         return !isset($captcha_success_form_ids[$form_id]);
     }
@@ -189,17 +209,19 @@ function _captcha_required_for_user($captcha_sid, $form_id) {
 
 
 /**
- * Get the CAPTCHA description as configured on the general CAPTCHA
- * settings page.
+ * Get the CAPTCHA description as configured on the general CAPTCHA settings page.
  *
  * If the locale module is enabled, the description will be returned
  * for the current language the page is rendered for. This language
- * can optionally been overriden with the $lang_code argument.
+ * can optionally been overridden with the $lang_code argument.
  *
- * @param $lang_code an optional language code to get the descripion for.
- * @return a string with (localized) CAPTCHA description.
+ * @param string|null $lang_code
+ *   an optional language code to get the description for.
+ *
+ * @return string
+ *   String with (localized) CAPTCHA description.
  */
-function _captcha_get_description($lang_code=NULL) {
+function _captcha_get_description($lang_code = NULL) {
   // If no language code is given: use the language of the current page.
   global $language;
   $lang_code = isset($lang_code) ? $lang_code : $language->language;
@@ -217,9 +239,13 @@ function _captcha_get_description($lang_code=NULL) {
 
 /**
  * Parse or interpret the given captcha_type.
- * @param $captcha_type string representation of the CAPTCHA type,
+ *
+ * @param string $captcha_type
+ *   string representation of the CAPTCHA type,
  *      e.g. 'default', 'none', 'captcha/Math', 'image_captcha/Image'
- * @return list($captcha_module, $captcha_type)
+ *
+ * @return array
+ *   list($captcha_module, $captcha_type)
  */
 function _captcha_parse_captcha_type($captcha_type) {
   if ($captcha_type == 'none') {
@@ -233,11 +259,17 @@ function _captcha_parse_captcha_type($captcha_type) {
 
 /**
  * Helper function to get placement information for a given form_id.
- * @param $form_id the form_id to get the placement information for.
- * @param $form if a form corresponding to the given form_id, if there
+ *
+ * @param string $form_id
+ *   the form_id to get the placement information for.
+ *
+ * @param array $form
+ *   if a form corresponding to the given form_id, if there
  *   is no placement info for the given form_id, this form is examined to
  *   guess the placement.
- * @return placement info array (@see _captcha_insert_captcha_element() for more
+ *
+ * @return array
+ *   placement info array (@see _captcha_insert_captcha_element() for more
  *   info about the fields 'path', 'key' and 'weight'.
  */
 function _captcha_get_captcha_placement($form_id, $form) {
@@ -298,8 +330,11 @@ function _captcha_get_captcha_placement($form_id, $form) {
 /**
  * Helper function for searching the buttons in a form.
  *
- * @param $form the form to search button elements in
- * @return an array of paths to the buttons.
+ * @param array $form
+ *   the form to search button elements in
+ *
+ * @return array
+ *   an array of paths to the buttons.
  *   A path is an array of keys leading to the button, the last
  *   item in the path is the weight of the button element
  *   (or NULL if undefined).
@@ -328,8 +363,12 @@ function _captcha_search_buttons($form) {
 
 /**
  * Helper function to insert a CAPTCHA element in a form before a given form element.
- * @param $form the form to add the CAPTCHA element to.
- * @param $placement information where the CAPTCHA element should be inserted.
+ *
+ * @param array $form
+ *   the form to add the CAPTCHA element to.
+ *
+ * @param array $placement
+ *   information where the CAPTCHA element should be inserted.
  *   $placement should be an associative array with fields:
  *     - 'path': path (array of path items) of the container in the form where the
  *       CAPTCHA element should be inserted.
@@ -339,7 +378,9 @@ function _captcha_search_buttons($form) {
  *     - 'weight': if 'key' is not NULL: should be the weight of the element defined by 'key'.
  *       If 'key' is NULL and weight is not NULL: set the weight property of the CAPTCHA element
  *       to this value.
- * @param $captcha_element the CAPTCHA element to insert.
+ *
+ * @param array $captcha_element
+ *   the CAPTCHA element to insert.
  */
 function _captcha_insert_captcha_element(&$form, $placement, $captcha_element) {
   // Get path, target and target weight or use defaults if not available.
@@ -367,7 +408,7 @@ function _captcha_insert_captcha_element(&$form, $placement, $captcha_element) {
     if ($target_weight != NULL) {
       $captcha_element['#weight'] = $target_weight;
     }
-    $form_stepper['captcha'] =  $captcha_element;
+    $form_stepper['captcha'] = $captcha_element;
   }
   // If there is a target available: make sure the CAPTCHA element comes right before it.
   else {
@@ -375,7 +416,7 @@ function _captcha_insert_captcha_element(&$form, $placement, $captcha_element) {
     // and just append the CAPTCHA: sorting will fix the ordering anyway.
     if ($target_weight != NULL) {
       $captcha_element['#weight'] = $target_weight - .1;
-      $form_stepper['captcha'] =  $captcha_element;
+      $form_stepper['captcha'] = $captcha_element;
     }
     else {
       // If we can't play with weights: insert the CAPTCHA element at the right position.
@@ -384,11 +425,10 @@ function _captcha_insert_captcha_element(&$form, $placement, $captcha_element) {
       // chop of the end, append the CAPTCHA element and put the end back.
       $offset = array_search($target_key, array_keys($form_stepper));
       $end = array_splice($form_stepper, $offset);
-      $form_stepper['captcha'] =  $captcha_element;
+      $form_stepper['captcha'] = $captcha_element;
       foreach ($end as $k => $v) {
         $form_stepper[$k] = $v;
       }
     }
   }
 }
-
diff --git a/drupal7/sites/all/modules/captcha/captcha.info b/drupal7/sites/all/modules/captcha/captcha.info
index 67abde1d..574912a6 100644
--- a/drupal7/sites/all/modules/captcha/captcha.info
+++ b/drupal7/sites/all/modules/captcha/captcha.info
@@ -10,9 +10,9 @@ files[] = captcha.admin.inc
 files[] = captcha.install
 files[] = captcha.test
 
-; Information added by Drupal.org packaging script on 2014-07-06
-version = "7.x-1.1"
+; Information added by Drupal.org packaging script on 2014-11-29
+version = "7.x-1.2"
 core = "7.x"
 project = "captcha"
-datestamp = "1404666828"
+datestamp = "1417219372"
 
diff --git a/drupal7/sites/all/modules/captcha/captcha.install b/drupal7/sites/all/modules/captcha/captcha.install
index 10086290..58d0847c 100644
--- a/drupal7/sites/all/modules/captcha/captcha.install
+++ b/drupal7/sites/all/modules/captcha/captcha.install
@@ -97,7 +97,7 @@ function captcha_schema() {
         'type' => 'int',
         'not null' => TRUE,
         'default' => 0,
-      )
+      ),
     ),
     'primary key' => array('csid'),
     'indexes' => array(
@@ -109,7 +109,7 @@ function captcha_schema() {
 }
 
 /**
- * Implementation of hook_requirements().
+ * Implements of hook_requirements().
  */
 function captcha_requirements($phase) {
   $requirements = array();
@@ -130,7 +130,7 @@ function captcha_requirements($phase) {
 }
 
 /**
- * Implementation of hook_install().
+ * Implements of hook_install().
  */
 function captcha_install() {
   $t = get_t();
@@ -138,7 +138,7 @@ function captcha_install() {
   $form_ids = array(
     'contact_site_form', 'contact_personal_form',
     'user_register_form', 'user_pass', 'user_login', 'user_login_block',
-    'forum_node_form'
+    'forum_node_form',
   );
   // Add form_ids of all currently known node types too.
   foreach (node_type_get_names() as $type => $name) {
@@ -167,7 +167,7 @@ function captcha_install() {
 }
 
 /**
- * Implementation of hook_uninstall().
+ * Implements of hook_uninstall().
  */
 function captcha_uninstall() {
   drupal_uninstall_schema('captcha');
@@ -176,7 +176,7 @@ function captcha_uninstall() {
 }
 
 /**
- * Implementation of hook_update_N()
+ * Implements of hook_update_N().
  */
 function captcha_update_6200() {
   $items = array();
@@ -239,7 +239,7 @@ function captcha_update_6200() {
         'type' => 'int',
         'not null' => TRUE,
         'default' => 0,
-      )
+      ),
     ),
     'primary key' => array('csid'),
     'indexes' => array(
@@ -253,7 +253,8 @@ function captcha_update_6200() {
 }
 
 /**
- * Implementation of hook_update_N()
+ * Implements of hook_update_N().
+ *
  * Change the captcha points with the old text CAPTCHA, which was
  * removed from the 6.x-2.x branch, to the simple math CAPTCHA.
  */
@@ -264,7 +265,8 @@ function captcha_update_6201() {
 }
 
 /**
- * Implementation of hook_update_N()
+ * Implements of hook_update_N().
+ *
  * Add a CAPTCHA token column to captcha_sessions table.
  */
 function captcha_update_6202() {
@@ -274,7 +276,8 @@ function captcha_update_6202() {
 }
 
 /**
- * Implementation of hook_update_N()
+ * Implements of hook_update_N().
+ *
  * Rename the type field to captcha_type in captcha_points.
  */
 function captcha_update_6203() {
diff --git a/drupal7/sites/all/modules/captcha/captcha.js b/drupal7/sites/all/modules/captcha/captcha.js
index 0259736c..e7c469e2 100644
--- a/drupal7/sites/all/modules/captcha/captcha.js
+++ b/drupal7/sites/all/modules/captcha/captcha.js
@@ -14,25 +14,25 @@
 
   Drupal.behaviors.captchaAdmin = {
     attach: function (context) {
-    	// Add onclick handler to checkbox for adding a CAPTCHA description
-    	// so that the textfields for the CAPTCHA description are hidden
-    	// when no description should be added.
+      // Add onclick handler to checkbox for adding a CAPTCHA description
+      // so that the textfields for the CAPTCHA description are hidden
+      // when no description should be added.
       // @todo: div.form-item-captcha-description depends on theming, maybe
       // it's better to add our own wrapper with id (instead of a class).
-    	$("#edit-captcha-add-captcha-description").click(function() {
-    		if ($("#edit-captcha-add-captcha-description").is(":checked")) {
-    			// Show the CAPTCHA description textfield(s).
-    			$("div.form-item-captcha-description").show('slow');
-    		}
-    		else {
-    			// Hide the CAPTCHA description textfield(s).
-    			$("div.form-item-captcha-description").hide('slow');
-    		}
-    	});
-    	// Hide the CAPTCHA description textfields if option is disabled on page load.
-    	if (!$("#edit-captcha-add-captcha-description").is(":checked")) {
-    		$("div.form-item-captcha-description").hide();
-    	}
+      $("#edit-captcha-add-captcha-description").click(function() {
+        if ($("#edit-captcha-add-captcha-description").is(":checked")) {
+          // Show the CAPTCHA description textfield(s).
+          $("div.form-item-captcha-description").show('slow');
+        }
+        else {
+          // Hide the CAPTCHA description textfield(s).
+          $("div.form-item-captcha-description").hide('slow');
+        }
+      });
+      // Hide the CAPTCHA description textfields if option is disabled on page load.
+      if (!$("#edit-captcha-add-captcha-description").is(":checked")) {
+        $("div.form-item-captcha-description").hide();
+      }
     }
 
   };
diff --git a/drupal7/sites/all/modules/captcha/captcha.module b/drupal7/sites/all/modules/captcha/captcha.module
index 72e8e9ba..13233930 100644
--- a/drupal7/sites/all/modules/captcha/captcha.module
+++ b/drupal7/sites/all/modules/captcha/captcha.module
@@ -46,6 +46,7 @@ function captcha_help($path, $arg) {
       ) . '</p>';
       $output .= '<p>' . t('CAPTCHA is a trademark of Carnegie Mellon University.') . '</p>';
       return $output;
+
     case 'admin/config/people/captcha':
     case 'admin/config/people/captcha/captcha':
     case 'admin/config/people/captcha/captcha/settings':
@@ -56,11 +57,11 @@ function captcha_help($path, $arg) {
 }
 
 /**
- * Implementation of hook_menu().
+ * Implements of hook_menu().
  */
 function captcha_menu() {
   $items = array();
-  // main configuration page of the basic CAPTCHA module
+  // Main configuration page of the basic CAPTCHA module.
   $items['admin/config/people/captcha'] = array(
     'title' => 'CAPTCHA',
     'description' => 'Administer how and where CAPTCHAs are used.',
@@ -70,8 +71,8 @@ function captcha_menu() {
     'access arguments' => array('administer CAPTCHA settings'),
     'type' => MENU_NORMAL_ITEM,
   );
-  // the default local task (needed when other modules want to offer
-  // alternative CAPTCHA types and their own configuration page as local task)
+  // The default local task (needed when other modules want to offer,
+  // alternative CAPTCHA types and their own configuration page as local task).
   $items['admin/config/people/captcha/captcha'] = array(
     'title' => 'CAPTCHA',
     'access arguments' => array('administer CAPTCHA settings'),
@@ -106,7 +107,7 @@ function captcha_menu() {
 }
 
 /**
- * Implementation of hook_permission().
+ * Implements of hook_permission().
  */
 function captcha_permission() {
   return array(
@@ -121,7 +122,7 @@ function captcha_permission() {
 }
 
 /**
- * Implementation of hook_theme().
+ * Implements of hook_theme().
  */
 function captcha_theme() {
   return array(
@@ -135,27 +136,26 @@ function captcha_theme() {
 }
 
 /**
- * Implementation of hook_cron().
+ * Implements of hook_cron().
  *
  * Remove old entries from captcha_sessions table.
  */
 function captcha_cron() {
   // Remove challenges older than 1 day.
   db_delete('captcha_sessions')
-    ->condition('timestamp', REQUEST_TIME - 60*60*24, '<')
+    ->condition('timestamp', REQUEST_TIME - 60 * 60 * 24, '<')
     ->execute();
 }
 
-
 /**
- * Implementation of hook_element_info().
+ * Implements of hook_element_info().
  */
 function captcha_element_info() {
   // Define the CAPTCHA form element with default properties.
   $captcha_element = array(
     '#input' => TRUE,
     '#process' => array('captcha_element_process'),
-    // The type of challenge: e.g. 'default', 'none', 'captcha/Math', 'image_captcha/Image', ...
+    // The type of challenge: e.g. 'default', 'none', 'captcha/Math', 'image_captcha/Image'.
     '#captcha_type' => 'default',
     '#default_value' => '',
     // CAPTCHA in admin mode: presolve the CAPTCHA and always show it (despite previous successful responses).
@@ -254,7 +254,6 @@ function captcha_element_process($element, &$form_state, $complete_form) {
     'captcha_sid' => $captcha_sid,
   );
 
-
   if (_captcha_required_for_user($captcha_sid, $this_form_id) || $element['#captcha_admin_mode']) {
     // Generate a CAPTCHA and its solution
     // (note that the CAPTCHA session ID is given as third argument).
@@ -263,7 +262,11 @@ function captcha_element_process($element, &$form_state, $complete_form) {
       // The selected module did not return what we expected: log about it and quit.
       watchdog('CAPTCHA',
         'CAPTCHA problem: unexpected result from hook_captcha() of module %module when trying to retrieve challenge type %type for form %form_id.',
-        array('%type' => $captcha_type_challenge, '%module' => $captcha_type_module, '%form_id' => $this_form_id),
+        array(
+          '%type' => $captcha_type_challenge,
+          '%module' => $captcha_type_module,
+          '%form_id' => $this_form_id,
+        ),
         WATCHDOG_ERROR);
       return $element;
     }
@@ -300,7 +303,6 @@ function captcha_element_process($element, &$form_state, $complete_form) {
   return $element;
 }
 
-
 /**
  * Theme function for a CAPTCHA element.
  *
@@ -324,9 +326,8 @@ function theme_captcha($variables) {
   }
 }
 
-
 /**
- * Implementation of hook_form_alter().
+ * Implements of hook_form_alter().
  *
  * This function adds a CAPTCHA to forms for untrusted users if needed and adds
  * CAPTCHA administration links for site administrators if this option is enabled.
@@ -339,7 +340,7 @@ function captcha_form_alter(&$form, &$form_state, $form_id) {
 
     // Get CAPTCHA type and module for given form_id.
     $captcha_point = captcha_get_form_id_setting($form_id);
-    if ($captcha_point && $captcha_point->captcha_type) {
+    if ($captcha_point && !empty($captcha_point->captcha_type)) {
       module_load_include('inc', 'captcha');
       // Build CAPTCHA form element.
       $captcha_element = array(
@@ -365,7 +366,7 @@ function captcha_form_alter(&$form, &$form_state, $form_id) {
     module_load_include('inc', 'captcha');
 
     $captcha_point = captcha_get_form_id_setting($form_id);
-    // For administrators: show CAPTCHA info and offer link to configure it
+    // For administrators: show CAPTCHA info and offer link to configure it.
     $captcha_element = array(
       '#type' => 'fieldset',
       '#title' => t('CAPTCHA'),
@@ -424,7 +425,16 @@ function captcha_form_alter(&$form, &$form_state, $form_id) {
 
   // Add a warning about caching on the Perfomance settings page.
   if ($form_id == 'system_performance_settings') {
-    $icon = theme('image', array('path' => 'misc/watchdog-warning.png', 'width' => 18, 'height' => 18, 'alt' => t('warning'), 'title' => t('warning')));
+    $icon = theme(
+      'image',
+      array(
+        'path' => 'misc/watchdog-warning.png',
+        'width' => 18,
+        'height' => 18,
+        'alt' => t('warning'),
+        'title' => t('warning'),
+      )
+    );
     $form['caching']['captcha'] = array(
       '#type' => 'item',
       '#title' => t('CAPTCHA'),
@@ -439,9 +449,15 @@ function captcha_form_alter(&$form, &$form_state, $form_id) {
 
 /**
  * CAPTCHA validation function to tests strict equality.
- * @param $solution the solution of the test.
- * @param $response the response to the test.
- * @return TRUE when strictly equal, FALSE otherwise.
+ *
+ * @param string $solution
+ *   the solution of the test.
+ *
+ * @param string $response
+ *   the response to the test.
+ *
+ * @return bool
+ *   TRUE when equal (ignoring spaces), FALSE otherwise.
  */
 function captcha_validate_strict_equality($solution, $response) {
   return $solution === $response;
@@ -449,9 +465,15 @@ function captcha_validate_strict_equality($solution, $response) {
 
 /**
  * CAPTCHA validation function to tests case insensitive equality.
- * @param $solution the solution of the test.
- * @param $response the response to the test.
- * @return TRUE when case insensitive equal, FALSE otherwise.
+ *
+ * @param string $solution
+ *   the solution of the test.
+ *
+ * @param string $response
+ *   the response to the test.
+ *
+ * @return bool
+ *   TRUE when equal (ignoring spaces), FALSE otherwise.
  */
 function captcha_validate_case_insensitive_equality($solution, $response) {
   return drupal_strtolower($solution) === drupal_strtolower($response);
@@ -459,9 +481,15 @@ function captcha_validate_case_insensitive_equality($solution, $response) {
 
 /**
  * CAPTCHA validation function to tests equality while ignoring spaces.
- * @param $solution the solution of the test.
- * @param $response the response to the test.
- * @return TRUE when equal (ignoring spaces), FALSE otherwise.
+ *
+ * @param string $solution
+ *   the solution of the test.
+ *
+ * @param string $response
+ *   the response to the test.
+ *
+ * @return bool
+ *   TRUE when equal (ignoring spaces), FALSE otherwise.
  */
 function captcha_validate_ignore_spaces($solution, $response) {
   return preg_replace('/\s/', '', $solution) === preg_replace('/\s/', '', $response);
@@ -469,17 +497,22 @@ function captcha_validate_ignore_spaces($solution, $response) {
 
 /**
  * CAPTCHA validation function to tests case insensitive equality while ignoring spaces.
- * @param $solution the solution of the test.
- * @param $response the response to the test.
- * @return TRUE when equal (ignoring spaces), FALSE otherwise.
+ *
+ * @param string $solution
+ *   the solution of the test.
+ *
+ * @param string $response
+ *   the response to the test.
+ *
+ * @return bool
+ *   TRUE when equal (ignoring spaces), FALSE otherwise.
  */
 function captcha_validate_case_insensitive_ignore_spaces($solution, $response) {
   return preg_replace('/\s/', '', drupal_strtolower($solution)) === preg_replace('/\s/', '', drupal_strtolower($response));
 }
 
 /**
- * Helper function for getting the posted CAPTCHA info (posted form_id and
- * CAPTCHA sessions ID) from a form in case it is posted.
+ * Helper function for getting the posted CAPTCHA info (posted form_id and CAPTCHA sessions ID) from a form in case it is posted.
  *
  * This function hides the form processing mess for several use cases an
  * browser bug workarounds.
@@ -494,12 +527,18 @@ function captcha_validate_case_insensitive_ignore_spaces($solution, $response) {
  *
  * @todo for Drupal 7 version: is this IE7 workaround still needed?
  *
- * @param $element the CAPTCHA element.
- * @param $form_state the form state structure to extract the info from.
- * @param $this_form_id the form ID of the form we are currently processing
+ * @param array $element
+ *   the CAPTCHA element.
+ *
+ * @param array $form_state
+ *   the form state structure to extract the info from.
+ *
+ * @param string $this_form_id
+ *   the form ID of the form we are currently processing
  *     (which is not necessarily the form that was posted).
  *
- * @return an array with $posted_form_id and $post_captcha_sid (with NULL values
+ * @return array
+ *   an array with $posted_form_id and $post_captcha_sid (with NULL values
  *     if the values could not be found, e.g. for a fresh form).
  */
 function _captcha_get_posted_captcha_info($element, $form_state, $this_form_id) {
@@ -515,15 +554,9 @@ function _captcha_get_posted_captcha_info($element, $form_state, $this_form_id)
     // from the post data.
     // Because we possibly use raw post data here,
     // we should be extra cautious and filter this data.
-    $posted_form_id = isset($form_state['input']['form_id']) ?
-      preg_replace("/[^a-z0-9_]/", "", (string) $form_state['input']['form_id'])
-      : NULL;
-    $posted_captcha_sid = isset($form_state['input']['captcha_sid']) ?
-      (int) $form_state['input']['captcha_sid']
-      : NULL;
-    $posted_captcha_token = isset($form_state['input']['captcha_token']) ?
-      preg_replace("/[^a-zA-Z0-9]/", "", (string) $form_state['input']['captcha_token'])
-      : NULL;
+    $posted_form_id = isset($form_state['input']['form_id']) ? preg_replace("/[^a-z0-9_]/", "", (string) $form_state['input']['form_id']) : NULL;
+    $posted_captcha_sid = isset($form_state['input']['captcha_sid']) ? (int) $form_state['input']['captcha_sid'] : NULL;
+    $posted_captcha_token = isset($form_state['input']['captcha_token']) ? preg_replace("/[^a-zA-Z0-9]/", "", (string) $form_state['input']['captcha_token']) : NULL;
 
     if ($posted_form_id == $this_form_id) {
       // Check if the posted CAPTCHA token is valid for the posted CAPTCHA
@@ -599,7 +632,7 @@ function captcha_validate($element, &$form_state) {
     // Get CAPTCHA validate function or fall back on strict equality.
     $captcha_validate = $element['#captcha_validate'];
     if (!function_exists($captcha_validate)) {
-       $captcha_validate = 'captcha_validate_strict_equality';
+      $captcha_validate = 'captcha_validate_strict_equality';
     }
     // Check the response with the CAPTCHA validation function.
     // Apart from the traditional expected $solution and received $response,
@@ -626,17 +659,18 @@ function captcha_validate($element, &$form_state) {
         ->condition('csid', $csid)
         ->expression('attempts', 'attempts + 1')
         ->execute();
-      // set form error
+      // Set form error.
       form_set_error('captcha_response', t('The answer you entered for the CAPTCHA was not correct.'));
-      // update wrong response counter
+      // Update wrong response counter.
       if (variable_get('captcha_enable_stats', FALSE)) {
         variable_set('captcha_wrong_response_counter', variable_get('captcha_wrong_response_counter', 0) + 1);
       }
-      // log to watchdog if needed
+      // Log to watchdog if needed.
       if (variable_get('captcha_log_wrong_responses', FALSE)) {
         watchdog('CAPTCHA',
           '%form_id post blocked by CAPTCHA module: challenge %challenge (by module %module), user answered "@response", but the solution was "@solution".',
-          array('%form_id' => $form_id,
+          array(
+            '%form_id' => $form_id,
             '@response' => $captcha_response, '@solution' => $solution,
             '%challenge' => $captcha_info['captcha_type'], '%module' => $captcha_info['module'],
           ),
@@ -652,8 +686,11 @@ function captcha_validate($element, &$form_state) {
  * This encompasses tasks that should happen after the general FAPI processing
  * (building, submission and validation) but before rendering (e.g. storing the solution).
  *
- * @param $element the CAPTCHA form element
- * @return the manipulated element
+ * @param array $element
+ *   the CAPTCHA form element
+ *
+ * @return array
+ *   the manipulated element
  */
 function captcha_pre_render_process($element) {
   module_load_include('inc', 'captcha');
@@ -661,7 +698,7 @@ function captcha_pre_render_process($element) {
   // Get form and CAPTCHA information.
   $captcha_info = $element['#captcha_info'];
   $form_id = $captcha_info['form_id'];
-  $captcha_sid = (int)($captcha_info['captcha_sid']);
+  $captcha_sid = (int) ($captcha_info['captcha_sid']);
   // Check if CAPTCHA is still required.
   // This check is done in a first phase during the element processing
   // (@see captcha_process), but it is also done here for better support
@@ -695,7 +732,6 @@ function captcha_captcha($op, $captcha_type = '') {
   switch ($op) {
     case 'list':
       return array('Math');
-      break;
 
     case 'generate':
       if ($captcha_type == 'Math') {
@@ -741,7 +777,7 @@ function captcha_captcha($op, $captcha_type = '') {
 }
 
 /**
- * Implements hook_modules_enabled.
+ * Implements hook_modules_enabled().
  */
 function captcha_modules_enabled() {
   // When new modules are enabled: clear the CAPTCHA placement cache, so that
diff --git a/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.admin.inc b/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.admin.inc
index 5bf39fcd..f762a9fa 100644
--- a/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.admin.inc
+++ b/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.admin.inc
@@ -3,10 +3,8 @@
 /**
  * @file
  * Functions for administration/settings interface.
- *
  */
 
-
 /**
  * Configuration form for image_captcha.
  */
@@ -19,7 +17,6 @@ function image_captcha_settings_form() {
   // Use javascript for some added usability on admin form.
   $form['#attached']['js'] = array(drupal_get_path('module', 'image_captcha') . '/image_captcha.js');
 
-
   // First some error checking.
   $setup_status = _image_captcha_check_setup(FALSE);
   if ($setup_status & IMAGE_CAPTCHA_ERROR_NO_GDLIB) {
@@ -70,11 +67,10 @@ function image_captcha_settings_form() {
     );
   }
 
-
   // Font related stuff.
   $form['image_captcha_font_settings'] = _image_captcha_settings_form_font_section();
 
-    // Color and file format settings.
+  // Color and file format settings.
   $form['image_captcha_color_settings'] = array(
     '#type' => 'fieldset',
     '#title' => t('Color and image settings'),
@@ -121,13 +117,13 @@ function image_captcha_settings_form() {
     ),
   );
 
-  // distortion and noise settings
+  // Distortion and noise settings.
   $form['image_captcha_distortion_and_noise'] = array(
     '#type' => 'fieldset',
     '#title' => t('Distortion and noise'),
     '#description' => t('With these settings you can control the degree of obfuscation by distortion and added noise. Do not exaggerate the obfuscation and assure that the code in the image is reasonably readable. For example, do not combine high levels of distortion and noise.'),
   );
-  // distortion
+  // Distortion.
   $form['image_captcha_distortion_and_noise']['image_captcha_distortion_amplitude'] = array(
     '#type' => 'select',
     '#title' => t('Distortion level'),
@@ -153,7 +149,7 @@ function image_captcha_settings_form() {
     '#default_value' => variable_get('image_captcha_bilinear_interpolation', FALSE),
     '#description' => t('This option enables bilinear interpolation of the distortion which makes the image look smoother, but it is more CPU intensive.'),
   );
-  // noise
+  // Noise.
   $form['image_captcha_distortion_and_noise']['image_captcha_dot_noise'] = array(
     '#type' => 'checkbox',
     '#title' => t('Add salt and pepper noise'),
@@ -192,7 +188,6 @@ function image_captcha_settings_form() {
   return $form;
 }
 
-
 /**
  * Form elements for the font specific setting.
  *
@@ -200,7 +195,8 @@ function image_captcha_settings_form() {
  * general form function image_captcha_settings_form with some
  * specific logic.
  *
- * @return $form, the font settings specific form elements.
+ * @return array
+ *   the font settings specific form elements.
  */
 function _image_captcha_settings_form_font_section() {
   // Put it all in a fieldset.
@@ -212,7 +208,7 @@ function _image_captcha_settings_form_font_section() {
   // First check if there is TrueType support.
   $setup_status = _image_captcha_check_setup(FALSE);
   if ($setup_status & IMAGE_CAPTCHA_ERROR_NO_TTF_SUPPORT) {
-    // Show a warning that there is no TrueType support
+    // Show a warning that there is no TrueType support.
     $form['no_ttf_support'] = array(
       '#type' => 'item',
       '#title' => t('No TrueType support'),
@@ -221,7 +217,6 @@ function _image_captcha_settings_form_font_section() {
 
   }
   else {
-
     // Build a list of  all available fonts.
     $available_fonts = array();
 
@@ -231,7 +226,7 @@ function _image_captcha_settings_form_font_section() {
     // in separate requests, and we don't want to rescan the filesystem
     // every time, so we cache the result.
     variable_set('image_captcha_fonts_preview_map_cache', $fonts);
-    // Put these fonts with preview image in the list
+    // Put these fonts with preview image in the list.
     foreach ($fonts as $token => $font) {
       $img_src = check_url(url('admin/config/people/captcha/image_captcha/font_preview/' . $token));
       $title = t('Font preview of @font (@file)', array('@font' => $font->name, '@file' => $font->uri));
@@ -261,7 +256,6 @@ function _image_captcha_settings_form_font_section() {
       '#process' => array('form_process_checkboxes'),
     );
 
-
     // Font size.
     $form['image_captcha_font_size'] = array(
       '#type' => 'select',
@@ -302,16 +296,18 @@ function _image_captcha_settings_form_font_section() {
 /**
  * Helper function to get fonts from the given directories.
  *
- * @param $directories (optional) an array of directories
+ * @param array|null $directories
+ *   an array of directories
  *   to recursively search through, if not given, the default
  *   directories will be used.
  *
- * @return an array of fonts file objects (with fields 'name',
+ * @return array
+ *   an array of fonts file objects (with fields 'name',
  *   'basename' and 'filename'), keyed on the md5 hash of the font
  *   path (to have an easy token that can be used in an url
  *   without en/decoding issues).
  */
-function _image_captcha_get_available_fonts_from_directories($directories=NULL) {
+function _image_captcha_get_available_fonts_from_directories($directories = NULL) {
   // If no fonts directories are given: use the default.
   if ($directories === NULL) {
     $directories = array(
@@ -331,9 +327,8 @@ function _image_captcha_get_available_fonts_from_directories($directories=NULL)
   return $fonts;
 }
 
-
 /**
- * Validation function for image_captcha configuration form
+ * Validation function for image_captcha configuration form.
  */
 function image_captcha_settings_form_validate($form, &$form_state) {
   // Check image_captcha_image_allowed_chars for spaces.
@@ -360,7 +355,7 @@ function image_captcha_settings_form_validate($form, &$form_state) {
     }
   }
 
-  // check color settings
+  // Check color settings.
   if (!preg_match('/^#([0-9a-fA-F]{3}){1,2}$/', $form_state['values']['image_captcha_background_color'])) {
     form_set_error('image_captcha_background_color', t('Background color is not a valid hexadecimal color value.'));
   }
@@ -382,7 +377,6 @@ function image_captcha_settings_form_submit($form, &$form_state) {
 
 /**
  * Menu handler for font preview request.
- *
  */
 function image_captcha_font_preview($font_token) {
 
@@ -394,14 +388,14 @@ function image_captcha_font_preview($font_token) {
     // Get the mapping of font tokens to font file objects.
     $fonts = variable_get('image_captcha_fonts_preview_map_cache', array());
     if (!isset($fonts[$font_token])) {
-      echo('bad token');
+      echo ('bad token');
       exit();
     }
     // Get the font path.
     $font = $fonts[$font_token]->uri;
     // Some sanity checks if the given font is valid.
     if (!is_file($font) || !is_readable($font)) {
-      echo('bad font');
+      echo ('bad font');
       exit();
     }
   }
@@ -422,12 +416,12 @@ function image_captcha_font_preview($font_token) {
   $color = imagecolorallocate($image, 0, 0, 0);
   imagefilledrectangle($image, 0, 0, $width, $height, $background_color);
 
-  // Draw preview text
+  // Draw preview text.
   if ($font == 'BUILTIN') {
-    imagestring($image, 5, 1, .5*$height-10, $text, $color);
+    imagestring($image, 5, 1, .5 * $height - 10, $text, $color);
   }
   else {
-    imagettftext($image, $font_size, 0, 1, 1.5*$font_size, $color, realpath($font), $text);
+    imagettftext($image, $font_size, 0, 1, 1.5 * $font_size, $color, realpath($font), $text);
   }
 
   // Set content type.
diff --git a/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.info b/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.info
index 7023bf1c..193814f2 100644
--- a/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.info
+++ b/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.info
@@ -10,9 +10,9 @@ files[] = image_captcha.module
 files[] = image_captcha.admin.inc
 files[] = image_captcha.user.inc
 
-; Information added by Drupal.org packaging script on 2014-07-06
-version = "7.x-1.1"
+; Information added by Drupal.org packaging script on 2014-11-29
+version = "7.x-1.2"
 core = "7.x"
 project = "captcha"
-datestamp = "1404666828"
+datestamp = "1417219372"
 
diff --git a/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.install b/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.install
index 1f6385c6..33972355 100644
--- a/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.install
+++ b/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.install
@@ -18,10 +18,10 @@ function image_captcha_requirements($phase) {
     if (_image_captcha_check_setup(FALSE) & IMAGE_CAPTCHA_ERROR_NO_GDLIB) {
       $requirements['image_captcha_requires_gd'] = array(
         'title' => $t('Image CAPTCHA requires GD library'),
-        'description' =>
-          $t('The Image CAPTCHA module can not be installed because your PHP setup does not provide the <a href="!gddoc">GD library</a>, which is required to generate images.',
-            array('!gddoc' => 'http://www.php.net/manual/en/book.image.php',)
-          ),
+        'description' => $t(
+          'The Image CAPTCHA module can not be installed because your PHP setup does not provide the <a href="!gddoc">GD library</a>, which is required to generate images.',
+          array('!gddoc' => 'http://www.php.net/manual/en/book.image.php')
+        ),
         'severity' => REQUIREMENT_ERROR,
       );
     }
@@ -30,7 +30,7 @@ function image_captcha_requirements($phase) {
 }
 
 /**
- * On uninstall: remove module variables and clear variable cache
+ * On uninstall: remove module variables and clear variable cache.
  */
 function image_captcha_uninstall() {
   db_delete('variable')
diff --git a/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.js b/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.js
index b20facc7..e6d492bd 100644
--- a/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.js
+++ b/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.js
@@ -6,13 +6,12 @@
       // Helper function to show/hide noise level widget.
       var noise_level_shower = function(speed) {
         speed = (typeof speed == 'undefined') ? 'slow' : speed;
-        if ($("#edit-image-captcha-dot-noise").is(":checked")
-            || $("#edit-image-captcha-line-noise").is(":checked")) {
+        if ($("#edit-image-captcha-dot-noise").is(":checked") || $("#edit-image-captcha-line-noise").is(":checked")) {
           $(".form-item-image-captcha-noise-level").show(speed);
         } else {
           $(".form-item-image-captcha-noise-level").hide(speed);
         }
-      }
+      };
       // Add onclick handler to the dot and line noise check boxes.
       $("#edit-image-captcha-dot-noise").click(noise_level_shower);
       $("#edit-image-captcha-line-noise").click(noise_level_shower);
@@ -27,12 +26,12 @@
         } else {
           $(".form-item-image-captcha-bilinear-interpolation").hide(speed);
         }
-      }
+      };
       // Add onchange handler to the distortion level select widget.
       $("#edit-image-captcha-distortion-amplitude").change(
           smooth_distortion_shower);
       // Show or hide appropriately on page load.
-      smooth_distortion_shower(0)
+      smooth_distortion_shower(0);
 
     }
   };
diff --git a/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.module b/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.module
index fc1e850a..6fb91936 100644
--- a/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.module
+++ b/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.module
@@ -16,7 +16,6 @@ define('IMAGE_CAPTCHA_FILE_FORMAT_JPG', 1);
 define('IMAGE_CAPTCHA_FILE_FORMAT_PNG', 2);
 define('IMAGE_CAPTCHA_FILE_FORMAT_TRANSPARENT_PNG', 3);
 
-
 /**
  * Implements hook_help().
  */
@@ -33,7 +32,7 @@ function image_captcha_help($path, $arg) {
  */
 function image_captcha_menu() {
   $items = array();
-  // add an administration tab for image_captcha
+  // Add an administration tab for image_captcha.
   $items['admin/config/people/captcha/image_captcha'] = array(
     'title' => 'Image CAPTCHA',
     'file' => 'image_captcha.admin.inc',
@@ -50,7 +49,7 @@ function image_captcha_menu() {
     'access arguments' => array('administer CAPTCHA settings'),
     'type' => MENU_CALLBACK,
   );
-  // callback for generating an image
+  // Callback for generating an image.
   $items['image_captcha'] = array(
     'file' => 'image_captcha.user.inc',
     'page callback' => 'image_captcha_image',
@@ -63,7 +62,8 @@ function image_captcha_menu() {
 /**
  * Helper function for getting the fonts to use in the image CAPTCHA.
  *
- * @return a list of font paths.
+ * @return array
+ *   a list of font paths.
  */
 function _image_captcha_get_enabled_fonts() {
   if (IMAGE_CAPTCHA_ERROR_NO_TTF_SUPPORT & _image_captcha_check_setup(FALSE)) {
@@ -81,8 +81,11 @@ function _image_captcha_get_enabled_fonts() {
 /**
  * Helper function for checking if the specified fonts are available.
  *
- * @param $fonts paths of fonts to check.
- * @return list($readable_fonts, $problem_fonts)
+ * @param array $fonts
+ *   paths of fonts to check.
+ *
+ * @return array
+ *   list($readable_fonts, $problem_fonts)
  */
 function _image_captcha_check_fonts($fonts) {
   $readable_fonts = array();
@@ -100,25 +103,30 @@ function _image_captcha_check_fonts($fonts) {
 
 /**
  * Helper function for splitting an utf8 string correctly in characters.
+ *
  * Assumes the given utf8 string is well formed.
  * See http://en.wikipedia.org/wiki/Utf8 for more info
  */
 function _image_captcha_utf8_split($str) {
   $characters = array();
   $len = strlen($str);
-  for ($i=0; $i < $len; ) {
+  for ($i = 0; $i < $len;) {
     $chr = ord($str[$i]);
-    if (($chr & 0x80) == 0x00) { // one byte character (0zzzzzzz)
+    // One byte character (0zzzzzzz)
+    if (($chr & 0x80) == 0x00) {
       $width = 1;
     }
     else {
-      if (($chr & 0xE0) == 0xC0) { // two byte character (first byte: 110yyyyy)
+      // Two byte character (first byte: 110yyyyy)
+      if (($chr & 0xE0) == 0xC0) {
         $width = 2;
       }
-      elseif (($chr & 0xF0) == 0xE0) { // three byte character (first byte: 1110xxxx)
+      // Three byte character (first byte: 1110xxxx)
+      elseif (($chr & 0xF0) == 0xE0) {
         $width = 3;
       }
-      elseif (($chr & 0xF8) == 0xF0) { // four byte character (first byte: 11110www)
+      // Four byte character (first byte: 11110www)
+      elseif (($chr & 0xF8) == 0xF0) {
         $width = 4;
       }
       else {
@@ -140,13 +148,15 @@ function _image_captcha_utf8_split($str) {
  * font files should be readable.
  * This functions checks these things.
  *
- * @param $check_fonts whether or not the enabled fonts should be checked.
+ * @param bool $check_fonts
+ *   whether or not the enabled fonts should be checked.
  *
- * @return status code: bitwise 'OR' of status flags like
+ * @return int
+ *   status code: bitwise 'OR' of status flags like
  *   IMAGE_CAPTCHA_ERROR_NO_GDLIB, IMAGE_CAPTCHA_ERROR_NO_TTF_SUPPORT,
  *   IMAGE_CAPTCHA_ERROR_TTF_FILE_READ_PROBLEM.
  */
-function _image_captcha_check_setup($check_fonts=TRUE) {
+function _image_captcha_check_setup($check_fonts = TRUE) {
   // Start clean.
   $status = 0;
   // Check if we can use the GD library.
@@ -170,30 +180,29 @@ function _image_captcha_check_setup($check_fonts=TRUE) {
 }
 
 /**
- * Helper function for calculating image height and width
- * based on given code and current font/spacing settings.
+ * Helper function for calculating image height and width based on given code and current font/spacing settings.
  *
- * @return array($width, $heigh)
+ * @return array
+ *   array($width, $heigh)
  */
 function _image_captcha_image_size($code) {
-  // Get settings
+  // Get settings.
   $font_size = (int) variable_get('image_captcha_font_size', 30);
   $character_spacing = (float) variable_get('image_captcha_character_spacing', '1.2');
   $characters = _image_captcha_utf8_split($code);
   $character_quantity = count($characters);
 
-  // Calculate height and width
+  // Calculate height and width.
   $width = $character_spacing * $font_size * $character_quantity;
   $height = 2 * $font_size;
 
   return array($width, $height);
 }
 
-
 /**
  * Implements hook_captcha().
  */
-function image_captcha_captcha($op, $captcha_type='', $captcha_sid=NULL) {
+function image_captcha_captcha($op, $captcha_type = '', $captcha_sid = NULL) {
   switch ($op) {
     case 'list':
       // Only offer the image CAPTCHA if it is possible to generate an image on this setup.
@@ -214,15 +223,15 @@ function image_captcha_captcha($op, $captcha_type='', $captcha_sid=NULL) {
         if (variable_get('maintenance_mode', 0) && $user->uid == 0) {
           return captcha_captcha('generate', 'Math');
         }
-        // generate a CAPTCHA code
+        // 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);
+        $code_length = (int) variable_get('image_captcha_code_length', 5);
         $code = '';
         for ($i = 0; $i < $code_length; $i++) {
           $code .= $allowed_chars[array_rand($allowed_chars)];
         }
 
-        // build the result to return
+        // Build the result to return.
         $result = array();
 
         $result['solution'] = $code;
@@ -241,8 +250,8 @@ function image_captcha_captcha($op, $captcha_type='', $captcha_sid=NULL) {
         $result['form']['captcha_image'] = array(
           '#type' => 'markup',
           '#markup' => '<img src="' . $img_src
-            . '" width="'. $width . '" height="' . $height
-            . '" alt="' . t('Image CAPTCHA') . '" title="' . t('Image CAPTCHA') . '" />',
+          . '" width="' . $width . '" height="' . $height
+          . '" alt="' . t('Image CAPTCHA') . '" title="' . t('Image CAPTCHA') . '" />',
           '#weight' => -2,
         );
         $result['form']['captcha_response'] = array(
@@ -259,6 +268,7 @@ function image_captcha_captcha($op, $captcha_type='', $captcha_sid=NULL) {
           case CAPTCHA_DEFAULT_VALIDATION_CASE_SENSITIVE:
             $result['captcha_validate'] = 'captcha_validate_ignore_spaces';
             break;
+
           case CAPTCHA_DEFAULT_VALIDATION_CASE_INSENSITIVE:
             $result['captcha_validate'] = 'captcha_validate_case_insensitive_ignore_spaces';
             break;
diff --git a/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.user.inc b/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.user.inc
index 371717a1..18b81dda 100644
--- a/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.user.inc
+++ b/drupal7/sites/all/modules/captcha/image_captcha/image_captcha.user.inc
@@ -12,12 +12,12 @@
  * Menu callback function that generates the CAPTCHA image.
  */
 function image_captcha_image() {
-  // If output buffering is on: discard current content and disable further buffering
+  // If output buffering is on: discard current content and disable further buffering.
   if (ob_get_level()) {
     ob_end_clean();
   }
 
-  if (!isset($_GET['sid'])) {
+  if (!isset($_GET['sid']) || is_array($_GET['sid'])) {
     exit();
   }
   $captcha_sid = $_GET['sid'];
@@ -34,9 +34,9 @@ function image_captcha_image() {
     $seed = hexdec(substr(md5($captcha_sid . $code), 0, 8));
     srand($seed);
     mt_srand($seed);
-    // generate the image
+    // Generate the image.
     $image = @_image_captcha_generate_image($code);
-    // check of generation was successful
+    // Check of generation was successful.
     if (!$image) {
       watchdog('CAPTCHA', 'Generation of image CAPTCHA failed. Check your image CAPTCHA configuration and especially the used font.', array(), WATCHDOG_ERROR);
       exit();
@@ -57,12 +57,11 @@ function image_captcha_image() {
   exit();
 }
 
-
 /**
  * Small helper function for parsing a hexadecimal color to a RGB tuple.
  */
 function _image_captcha_hex_to_rgb($hex) {
-  // handle #RGB format
+  // Handle #RGB format/
   if (strlen($hex) == 4) {
     $hex = $hex[1] . $hex[1] . $hex[2] . $hex[2] . $hex[3] . $hex[3];
   }
@@ -74,7 +73,6 @@ function _image_captcha_hex_to_rgb($hex) {
   return $rgb;
 }
 
-
 /**
  * Base function for generating a image CAPTCHA.
  */
@@ -82,11 +80,11 @@ function _image_captcha_generate_image($code) {
   // Get font.
   $fonts = _image_captcha_get_enabled_fonts();
 
-  // get other settings
+  // Get other settings.
   $font_size = (int) variable_get('image_captcha_font_size', 30);
   list($width, $height) = _image_captcha_image_size($code);
 
-  // create image resource
+  // Create image resource.
   $image = imagecreatetruecolor($width, $height);
   if (!$image) {
     return FALSE;
@@ -106,13 +104,13 @@ function _image_captcha_generate_image($code) {
   global $language;
   $rtl = $language->direction && ((bool) variable_get('image_captcha_rtl_support', 0));
 
-  // draw text
+  // Draw text.
   $result = _image_captcha_image_generator_print_string($image, $width, $height, $fonts, $font_size, $code, $rtl);
   if (!$result) {
     return FALSE;
   }
 
-  // add noise
+  // Add noise.
   $noise_colors = array();
   for ($i = 0; $i < 20; $i++) {
     $noise_colors[] = imagecolorallocate($image, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
@@ -128,7 +126,7 @@ function _image_captcha_generate_image($code) {
   // Distort the image.
   $distortion_amplitude = .25 * $font_size * variable_get('image_captcha_distortion_amplitude', 0) / 10.0;
   if ($distortion_amplitude > 1) {
-    // distortion parameters
+    // Distortion parameters.
     $wavelength_xr = (2 + 3 * mt_rand(0, 1000) / 1000) * $font_size;
     $wavelength_yr = (2 + 3 * mt_rand(0, 1000) / 1000) * $font_size;
     $freq_xr = 2 * 3.141592 / $wavelength_xr;
@@ -147,45 +145,45 @@ function _image_captcha_generate_image($code) {
     }
 
     if (variable_get('image_captcha_bilinear_interpolation', FALSE)) {
-      // distortion with bilinear interpolation
+      // Distortion with bilinear interpolation.
       for ($x = 0; $x < $width; $x++) {
         for ($y = 0; $y < $height; $y++) {
-          // get distorted sample point in source image
+          // Get distorted sample point in source image.
           $r = $distortion_amplitude * sin($x * $freq_xr + $y * $freq_yr);
           $theta = $x * $freq_xt + $y * $freq_yt;
           $sx = $x + $r * cos($theta);
           $sy = $y + $r * sin($theta);
-          $sxf = (int)floor($sx);
-          $syf = (int)floor($sy);
+          $sxf = (int) floor($sx);
+          $syf = (int) floor($sy);
           if ($sxf < 0 || $syf < 0 || $sxf >= $width - 1 || $syf >= $height - 1) {
             $color = $background_color;
           }
           else {
-            // bilinear interpolation: sample at four corners
-            $color_00 = imagecolorat($image, $sxf  , $syf  );
+            // Bilinear interpolation: sample at four corners.
+            $color_00 = imagecolorat($image, $sxf, $syf);
             $color_00_r = ($color_00 >> 16) & 0xFF;
             $color_00_g = ($color_00 >> 8) & 0xFF;
             $color_00_b = $color_00 & 0xFF;
-            $color_10 = imagecolorat($image, $sxf+1, $syf  );
+            $color_10 = imagecolorat($image, $sxf + 1, $syf);
             $color_10_r = ($color_10 >> 16) & 0xFF;
             $color_10_g = ($color_10 >> 8) & 0xFF;
             $color_10_b = $color_10 & 0xFF;
-            $color_01 = imagecolorat($image, $sxf  , $syf+1);
+            $color_01 = imagecolorat($image, $sxf, $syf + 1);
             $color_01_r = ($color_01 >> 16) & 0xFF;
             $color_01_g = ($color_01 >> 8) & 0xFF;
             $color_01_b = $color_01 & 0xFF;
-            $color_11 = imagecolorat($image, $sxf+1, $syf+1);
+            $color_11 = imagecolorat($image, $sxf + 1, $syf + 1);
             $color_11_r = ($color_11 >> 16) & 0xFF;
             $color_11_g = ($color_11 >> 8) & 0xFF;
             $color_11_b = $color_11 & 0xFF;
-            // interpolation factors
+            // Interpolation factors.
             $u  = $sx - $sxf;
             $v  = $sy - $syf;
-            // interpolate
-            $r = (int)((1-$v)*((1-$u)*$color_00_r + $u*$color_10_r) + $v*((1-$u)*$color_01_r + $u*$color_11_r));
-            $g = (int)((1-$v)*((1-$u)*$color_00_g + $u*$color_10_g) + $v*((1-$u)*$color_01_g + $u*$color_11_g));
-            $b = (int)((1-$v)*((1-$u)*$color_00_b + $u*$color_10_b) + $v*((1-$u)*$color_01_b + $u*$color_11_b));
-            // build color
+            // Interpolate.
+            $r = (int) ((1 - $v) * ((1 - $u) * $color_00_r + $u * $color_10_r) + $v * ((1 - $u) * $color_01_r + $u * $color_11_r));
+            $g = (int) ((1 - $v) * ((1 - $u) * $color_00_g + $u * $color_10_g) + $v * ((1 - $u) * $color_01_g + $u * $color_11_g));
+            $b = (int) ((1 - $v) * ((1 - $u) * $color_00_b + $u * $color_10_b) + $v * ((1 - $u) * $color_01_b + $u * $color_11_b));
+            // Build color.
             $color = ($r<<16) + ($g<<8) + $b;
           }
           imagesetpixel($distorted_image, $x, $y, $color);
@@ -193,16 +191,16 @@ function _image_captcha_generate_image($code) {
       }
     }
     else {
-      // distortion with nearest neighbor interpolation
+      // Distortion with nearest neighbor interpolation.
       for ($x = 0; $x < $width; $x++) {
         for ($y = 0; $y < $height; $y++) {
-          // get distorted sample point in source image
+          // Get distorted sample point in source image.
           $r = $distortion_amplitude * sin($x * $freq_xr + $y * $freq_yr);
           $theta = $x * $freq_xt + $y * $freq_yt;
           $sx = $x + $r * cos($theta);
           $sy = $y + $r * sin($theta);
-          $sxf = (int)floor($sx);
-          $syf = (int)floor($sy);
+          $sxf = (int) floor($sx);
+          $syf = (int) floor($sy);
           if ($sxf < 0 || $syf < 0 || $sxf >= $width - 1 || $syf >= $height - 1) {
             $color = $background_color;
           }
@@ -213,9 +211,9 @@ function _image_captcha_generate_image($code) {
         }
       }
     }
-    // release undistorted image
+    // Release undistorted image.
     imagedestroy($image);
-    // return distorted image
+    // Return distorted image.
     return $distorted_image;
   }
   else {
@@ -223,16 +221,22 @@ function _image_captcha_generate_image($code) {
   }
 }
 
+/**
+ * Add lines.
+ */
 function _image_captcha_image_generator_add_lines(&$image, $width, $height, $colors) {
-  $line_quantity = $width * $height/200.0 * ((int) variable_get('image_captcha_noise_level', 5)) / 10.0;
-  for ($i = 0; $i <  $line_quantity; $i++) {
+  $line_quantity = $width * $height / 200.0 * ((int) variable_get('image_captcha_noise_level', 5)) / 10.0;
+  for ($i = 0; $i < $line_quantity; $i++) {
     imageline($image, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, $width), mt_rand(0, $height), $colors[array_rand($colors)]);
   }
 }
 
+/**
+ * Add dots.
+ */
 function _image_captcha_image_generator_add_dots(&$image, $width, $height, $colors) {
   $noise_quantity = $width * $height * ((int) variable_get('image_captcha_noise_level', 5)) / 10.0;
-  for ($i = 0; $i < $noise_quantity; $i++ ) {
+  for ($i = 0; $i < $noise_quantity; $i++) {
     imagesetpixel($image, mt_rand(0, $width), mt_rand(0, $height), $colors[array_rand($colors)]);
   }
 }
@@ -240,35 +244,38 @@ function _image_captcha_image_generator_add_dots(&$image, $width, $height, $colo
 /**
  * Helper function for drawing text on the image.
  */
-function _image_captcha_image_generator_print_string(&$image, $width, $height, $fonts, $font_size, $text, $rtl=FALSE) {
-  // get characters
+function _image_captcha_image_generator_print_string(&$image, $width, $height, $fonts, $font_size, $text, $rtl = FALSE) {
+  // Get characters.
   $characters = _image_captcha_utf8_split($text);
   $character_quantity = count($characters);
 
-  // get colors
+  // Get colors.
   $background_rgb = _image_captcha_hex_to_rgb(variable_get('image_captcha_background_color', '#ffffff'));
   $foreground_rgb = _image_captcha_hex_to_rgb(variable_get('image_captcha_foreground_color', '#000000'));
   $background_color = imagecolorallocate($image, $background_rgb[0], $background_rgb[1], $background_rgb[2]);
   $foreground_color = imagecolorallocate($image, $foreground_rgb[0], $foreground_rgb[1], $foreground_rgb[2]);
-  // precalculate the value ranges for color randomness
-  $foreground_randomness = (int)(variable_get('image_captcha_foreground_color_randomness', 100));
+  // Precalculate the value ranges for color randomness.
+  $foreground_randomness = (int) (variable_get('image_captcha_foreground_color_randomness', 100));
   if ($foreground_randomness) {
     $foreground_color_range = array();
-    for ($i=0; $i<3; $i++) {
-      $foreground_color_range[$i] = array(max(0, $foreground_rgb[$i] - $foreground_randomness), min(255, $foreground_rgb[$i] + $foreground_randomness));
+    for ($i = 0; $i < 3; $i++) {
+      $foreground_color_range[$i] = array(
+        max(0, $foreground_rgb[$i] - $foreground_randomness),
+        min(255, $foreground_rgb[$i] + $foreground_randomness),
+      );
     }
   }
 
-  // set default text color
+  // Set default text color.
   $color = $foreground_color;
 
-  // the image is seperated in different character cages, one for each character
-  // each character will be somewhere inside that cage
+  // The image is seperated in different character cages, one for each character,
+  // each character will be somewhere inside that cage.
   $ccage_width = $width / $character_quantity;
   $ccage_height = $height;
 
   foreach ($characters as $c => $character) {
-    // initial position of character: in the center of its cage
+    // Initial position of character: in the center of its cage.
     $center_x = ($c + 0.5) * $ccage_width;
     if ($rtl) {
       $center_x = $width - $center_x;
@@ -294,7 +301,16 @@ function _image_captcha_image_generator_print_string(&$image, $width, $height, $
     else {
       $character_width = imagefontwidth(5);
       $character_height = imagefontheight(5);
-      $bbox = array(0, $character_height, $character_width, $character_height, $character_width, 0, 0, 0);
+      $bbox = array(
+        0,
+        $character_height,
+        $character_width,
+        $character_height,
+        $character_width,
+        0,
+        0,
+        0,
+      );
     }
 
     // Random (but small) rotation of the character.
@@ -305,8 +321,8 @@ function _image_captcha_image_generator_print_string(&$image, $width, $height, $
     // printed so that the bounding box would be nicely centered in the cage?
     $bb_center_x = .5 * ($bbox[0] + $bbox[2]);
     $bb_center_y = .5 * ($bbox[1] + $bbox[7]);
-    $angle_cos = cos($angle*3.1415/180);
-    $angle_sin = sin($angle*3.1415/180);
+    $angle_cos = cos($angle * 3.1415 / 180);
+    $angle_sin = sin($angle * 3.1415 / 180);
     $pos_x = $center_x - ($angle_cos * $bb_center_x + $angle_sin * $bb_center_y);
     $pos_y = $center_y - (-$angle_sin * $bb_center_x + $angle_cos * $bb_center_y);
 
@@ -317,11 +333,11 @@ function _image_captcha_image_generator_print_string(&$image, $width, $height, $
     $dev_x = .5 * max(0, $ccage_width - abs($angle_cos) * $bb_width - abs($angle_sin) * $bb_height);
     $dev_y = .5 * max(0, $ccage_height - abs($angle_cos) * $bb_height - abs($angle_sin) * $bb_width);
 
-    // add jitter to position
+    // Add jitter to position.
     $pos_x = $pos_x + mt_rand(-$dev_x, $dev_x);
     $pos_y = $pos_y + mt_rand(-$dev_y, $dev_y);
 
-    // calculate text color in case of randomness
+    // Calculate text color in case of randomness.
     if ($foreground_randomness) {
       $color = imagecolorallocate($image,
         mt_rand($foreground_color_range[0][0], $foreground_color_range[0][1]),
@@ -330,7 +346,7 @@ function _image_captcha_image_generator_print_string(&$image, $width, $height, $
       );
     }
 
-    // draw character
+    // Draw character.
     if ($font == 'BUILTIN') {
       imagestring($image, 5, $pos_x, $pos_y, $character, $color);
     }
@@ -340,9 +356,8 @@ function _image_captcha_image_generator_print_string(&$image, $width, $height, $
 
     // For debugging purposes: draw character bounding box (only valid when rotation is disabled).
     // imagerectangle($image, $pos_x + $bbox[0], $pos_y + $bbox[1], $pos_x + $bbox[2], $pos_y + $bbox[7], $color);
-
   }
 
-  // return a sign of success
+  // Return a sign of success.
   return TRUE;
 }
