function _block_revisions_form_submit in Block Revisions 6
Same name and namespace in other branches
- 7 block_revisions.module \_block_revisions_form_submit()
1 string reference to '_block_revisions_form_submit'
- block_revisions_form_alter in ./
block_revisions.module - Implementation of hook_form_alter().
File
- ./
block_revisions.module, line 152
Code
function _block_revisions_form_submit($form, &$form_state) {
global $user;
// Get the bid. If this handler is called as the result of an edit,
// delta will be passed in the form values array. If this is an
// addition, we need to get the new bid from the database.
$delta = $form_state['values']['delta'];
if (!isset($delta)) {
$delta = db_result(db_query("SELECT bid FROM {boxes} WHERE info = '%s'", $form_state['values']['info']));
}
if ($form_state['values']['revision']) {
// The "Create a new revision" checkbox was checked, so we need
// to save a record to the boxes_revisions table.
block_revisions_create_revision($delta, $form_state['values']['body'], $form_state['values']['format'], $form_state['values']['log']);
}
// Update the boxes table for the block that was just saved,
// adding a timestamp and user information.
db_query("UPDATE {boxes} SET uid = %d, timestamp = %d WHERE bid = %d", $user->uid, time(), $delta);
}