You are here

function legal_get_conditions in Legal 6.8

Same name and namespace in other branches
  1. 8 legal.module \legal_get_conditions()
  2. 5 legal.module \legal_get_conditions()
  3. 6.7 legal.module \legal_get_conditions()
  4. 7.2 legal.module \legal_get_conditions()
  5. 7 legal.module \legal_get_conditions()
  6. 2.0.x legal.module \legal_get_conditions()
5 calls to legal_get_conditions()
legal_administration in ./legal.admin.inc
Module settings form.
legal_conditions_updated in ./legal.admin.inc
legal_login in ./legal.module
Require registered users to accept new T&C.
legal_page in ./legal.pages.inc
@file User pages and forms.
legal_user in ./legal.module
Implementation of hook_user().

File

./legal.module, line 611
Displays Terms & Conditions, and makes sure they are accepted before registration is accepted.

Code

function legal_get_conditions($language = NULL) {
  $keys = array(
    'tc_id',
    'version',
    'revision',
    'language',
    'conditions',
    'date',
    'extras',
    'changes',
  );
  if (!empty($language)) {
    $args[] = $language;
    $result = db_fetch_array(db_query_range("SELECT * FROM {legal_conditions} WHERE language = '%s' ORDER BY version DESC, revision DESC", $args, 0, 1));
  }
  else {
    $result = db_fetch_array(db_query_range("SELECT * FROM {legal_conditions} ORDER BY tc_id DESC", 0, 1));
  }
  foreach ($keys as $key) {
    $conditions[$key] = isset($result[$key]) ? $result[$key] : '';
  }
  $conditions['extras'] = empty($conditions['extras']) ? array() : unserialize($conditions['extras']);
  return $conditions;
}