atrblacklist_atr_form_profile_submit

Versions
6.1
atrblacklist_atr_form_profile_submit($form, &$form_state)

Form submit handler for atr_form_profile().

Code

atr/modules/atrblacklist/atrblacklist.module, line 102

<?php
function atrblacklist_atr_form_profile_submit($form, &$form_state) {
  // Delete possible old keywords and save the new ones.
  $values = $form_state['values'];
  $profile = $values['profile'];
  db_query("DELETE FROM {atrblacklist_keyword} WHERE pid = %d", $profile->pid);
  $i = 0;
  $keyword_values = array();
  while (isset($values['blacklist_keywords']['blacklist_keyword_' . $i])) {
    if (!empty($values['blacklist_keywords']['blacklist_keyword_' . $i])) {
      $keyword_values[] = $profile->pid;
      $keyword_values[] = $values['blacklist_keywords']['blacklist_keyword_' . $i];
      $keyword_values[] = $values['blacklist_keywords']['blacklist_comment_' . $i];
    }

    $i++;
  }
  if($count = count($keyword_values) / 3) {
    $placeholders = implode(',', array_fill(0, $count, "(%d, '%s', '%s')"));
    db_query("INSERT INTO {atrblacklist_keyword} VALUES " . $placeholders, $keyword_values);
  }
}
?>