You are here

function quotes_block_configure_save in Quotes 6

Same name and namespace in other branches
  1. 7 quotes.module \quotes_block_configure_save()

Quotes block configuration save.

1 call to quotes_block_configure_save()
quotes_block in ./quotes.module
Implementation of hook_block().

File

./quotes.module, line 1063
The quotes module allows users to maintain a list of quotes that can be displayed in any number of administrator-defined quote blocks.

Code

function quotes_block_configure_save($delta, $edit) {
  $vals = array(
    $edit['name'],
    $edit['block_type'],
    preg_replace('<[,\\s]+>', ',', trim($edit['nid_filter'])),
    $edit['aid_filter'] == array(
      '0',
    ) ? '' : implode(',', (array) $edit['aid_filter']),
    $edit['rid_filter'] == array(
      -1 => '-1',
    ) ? '' : implode(',', (array) $edit['rid_filter']),
    $edit['uid_filter'] == array(
      -1 => '-1',
    ) ? '' : implode(',', (array) $edit['uid_filter']),
    // I'm not sure why it returns 0, but it works for me.
    $edit['tid_filter'] == array(
      '0',
    ) ? '' : implode(',', (array) $edit['tid_filter']),
    $edit['cron_interval'] ? $edit['cron_interval'] : 0,
    $edit['cron_step'],
    $edit['block_count'],
    $edit['show_titles'],
    $edit['show_citation'],
    // We only save the "more" text for random blocks.
    $edit['block_type'] == 0 ? $edit['block_more'] : NULL,
    $edit['view_text'],
    $edit['max_length'],
    // Frequency is only for random blocks.
    $edit['block_type'] == 0 ? $edit['rand_freq'] : 100,
    $delta,
  );
  db_query("UPDATE {quotes_blocks} SET name = '%s', block_type = %d, nid_filter = '%s', aid_filter = '%s', rid_filter = '%s',\n    uid_filter = '%s', tid_filter = '%s', cron_interval = %d, cron_step = %d,\n    count = %d, show_titles = %d, show_citation = %d, more_text = '%s',\n    view_text = '%s', max_length = %d, rand_freq = %d WHERE bid = %d", $vals);
}