Projet

Général

Profil

Révision 00c2605a

Ajouté par Assos Assos il y a environ 9 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/captcha/captcha.inc
83 83
 */
84 84
function captcha_get_form_id_setting($form_id, $symbolic = FALSE) {
85 85
  // Fetch setting from database.
86
  $result = db_query("SELECT module, captcha_type FROM {captcha_points} WHERE form_id = :form_id", array(':form_id' => $form_id));
87
  $captcha_point = $result->fetchObject();
86
  if (module_exists('ctools')) {
87
    ctools_include('export');
88
    $object = ctools_export_load_object('captcha_points', 'names', array($form_id));
89
    $captcha_point = array_pop($object);
90
  }
91
  else {
92
    $result = db_query("SELECT module, captcha_type FROM {captcha_points} WHERE form_id = :form_id",
93
      array(':form_id' =>  $form_id));
94
    $captcha_point = $result->fetchObject();
95
  }
88 96

  
89 97
  // If no setting is available in database for the given form,
90 98
  // but 'captcha_default_challenge_on_nonlisted_forms' is enabled, pick the default type anyway.
......
115 123
  return $captcha_point;
116 124
}
117 125

  
126
/**
127
 * Helper function to load all captcha points.
128
 *
129
 * @return array of all captcha_points
130
 */
131
function captcha_get_captcha_points() {
132
  if (module_exists('ctools')) {
133
    ctools_include('export');
134
    $captcha_points = ctools_export_load_object('captcha_points', 'all');
135
  }
136
  else {
137
    $captcha_points = array();
138
    $result = db_select('captcha_points', 'cp')->fields('cp')->orderBy('form_id')->execute();
139
    foreach ($result as $captcha_point) {
140
      $captcha_points[] = $captcha_point;
141
    }
142
  }
143
  return $captcha_points;
144
}
145

  
118 146
/**
119 147
 * Helper function for generating a new CAPTCHA session.
120 148
 *

Formats disponibles : Unified diff