node.admin.inc 22 KB
Newer Older
1 2
<?php

3
use Drupal\Core\Database\Query\SelectInterface;
4

5 6 7 8 9 10
/**
 * @file
 * Content administration and module settings UI.
 */

/**
11 12 13 14
 * Page callback: Form constructor for the permission rebuild confirmation form.
 *
 * @see node_menu()
 * @see node_configure_rebuild_confirm_submit()
15 16
 */
function node_configure_rebuild_confirm() {
17
  return confirm_form(array(), t('Are you sure you want to rebuild the permissions on site content?'),
18
                  'admin/reports/status', t('This action rebuilds all permissions on site content, and may be a lengthy process. This action cannot be undone.'), t('Rebuild permissions'), t('Cancel'));
19 20 21
}

/**
22
 * Form submission handler for node_configure_rebuild_confirm().
23
 */
24
function node_configure_rebuild_confirm_submit($form, &$form_state) {
25
  node_access_rebuild(TRUE);
26
  $form_state['redirect'] = 'admin/reports/status';
27 28 29
}

/**
30
 * Implements hook_node_operations().
31 32 33 34
 */
function node_node_operations() {
  $operations = array(
    'publish' => array(
35
      'label' => t('Publish selected content'),
36
      'callback' => 'node_mass_update',
37
      'callback arguments' => array('updates' => array('status' => NODE_PUBLISHED)),
38 39
    ),
    'unpublish' => array(
40
      'label' => t('Unpublish selected content'),
41
      'callback' => 'node_mass_update',
42
      'callback arguments' => array('updates' => array('status' => NODE_NOT_PUBLISHED)),
43 44
    ),
    'promote' => array(
45
      'label' => t('Promote selected content to front page'),
46
      'callback' => 'node_mass_update',
47
      'callback arguments' => array('updates' => array('status' => NODE_PUBLISHED, 'promote' => NODE_PROMOTED)),
48 49
    ),
    'demote' => array(
50
      'label' => t('Demote selected content from front page'),
51
      'callback' => 'node_mass_update',
52
      'callback arguments' => array('updates' => array('promote' => NODE_NOT_PROMOTED)),
53 54
    ),
    'sticky' => array(
55
      'label' => t('Make selected content sticky'),
56
      'callback' => 'node_mass_update',
57
      'callback arguments' => array('updates' => array('status' => NODE_PUBLISHED, 'sticky' => NODE_STICKY)),
58 59
    ),
    'unsticky' => array(
60
      'label' => t('Make selected content not sticky'),
61
      'callback' => 'node_mass_update',
62
      'callback arguments' => array('updates' => array('sticky' => NODE_NOT_STICKY)),
63 64
    ),
    'delete' => array(
65
      'label' => t('Delete selected content'),
66 67 68 69 70 71 72
      'callback' => NULL,
    ),
  );
  return $operations;
}

/**
73 74 75 76
 * Lists node administration filters that can be applied.
 *
 * @return
 *   Associative array of filters.
77 78 79
 */
function node_filters() {
  // Regular filters
80 81 82
  $filters['status'] = array(
    'title' => t('status'),
    'options' => array(
83
      '[any]' => t('any'),
84 85 86 87 88 89 90
      'status-1' => t('published'),
      'status-0' => t('not published'),
      'promote-1' => t('promoted'),
      'promote-0' => t('not promoted'),
      'sticky-1' => t('sticky'),
      'sticky-0' => t('not sticky'),
    ),
91 92 93
  );
  // Include translation states if we have this module enabled
  if (module_exists('translation')) {
94 95 96 97
    $filters['status']['options'] += array(
      'translate-0' => t('Up to date translation'),
      'translate-1' => t('Outdated translation'),
    );
98 99
  }

100 101 102 103 104 105
  $filters['type'] = array(
    'title' => t('type'),
    'options' => array(
      '[any]' => t('any'),
    ) + node_type_get_names(),
  );
106

107
  // Language filter if language support is present.
108
  if (language_multilingual()) {
109
    $languages = language_list(LANGUAGE_ALL);
110
    foreach ($languages as $langcode => $language) {
111 112
      // Make locked languages appear special in the list.
      $language_options[$langcode] = $language->locked ? t('- @name -', array('@name' => $language->name)) : $language->name;
113
    }
114 115 116
    $filters['language'] = array(
      'title' => t('language'),
      'options' => array(
117
        '[any]' => t('- Any -'),
118
      ) + $language_options,
119
    );
120 121 122 123 124
  }
  return $filters;
}

/**
125
 * Applies filters for the node administration overview based on session.
126 127 128
 *
 * @param $query
 *   A SelectQuery to which the filters should be applied.
129
 */
130
function node_build_filter_query(SelectInterface $query) {
131
  // Build query
132 133
  $filter_data = isset($_SESSION['node_overview_filter']) ? $_SESSION['node_overview_filter'] : array();
  foreach ($filter_data as $index => $filter) {
134 135 136 137 138 139 140
    list($key, $value) = $filter;
    switch ($key) {
      case 'status':
        // Note: no exploitable hole as $key/$value have already been checked when submitted
        list($key, $value) = explode('-', $value, 2);
      case 'type':
      case 'language':
141
        $query->condition('n.' . $key, $value);
142
        break;
143 144 145 146 147
    }
  }
}

/**
148 149 150 151 152 153 154 155 156
 * Returns the node administration filters form object to node_admin_content().
 *
 * @see node_multiple_delete_confirm()
 * @see node_multiple_delete_confirm_submit()
 * @see node_admin_nodes()
 * @see node_admin_nodes_submit()
 * @see node_admin_nodes_validate()
 * @see node_filter_form_submit()
 * @ingroup forms
157 158
 */
function node_filter_form() {
159
  $session = isset($_SESSION['node_overview_filter']) ? $_SESSION['node_overview_filter'] : array();
160 161 162
  $filters = node_filters();

  $i = 0;
163 164
  $form['filters'] = array(
    '#type' => 'fieldset',
165
    '#title' => t('Show only items where'),
166
    '#theme' => 'exposed_filters__node',
167 168 169
  );
  foreach ($session as $filter) {
    list($type, $value) = $filter;
170
    if ($type == 'term') {
171
      // Load term name from DB rather than search and parse options array.
172
      $value = module_invoke('taxonomy', 'term_load', $value);
173 174
      $value = $value->name;
    }
175
    elseif ($type == 'language') {
176
      $value = language_name($value);
177 178 179 180
    }
    else {
      $value = $filters[$type]['options'][$value];
    }
181
    $t_args = array('%property' => $filters[$type]['title'], '%value' => $value);
182
    if ($i++) {
183
      $form['filters']['current'][] = array('#markup' => t('and where %property is %value', $t_args));
184 185
    }
    else {
186
      $form['filters']['current'][] = array('#markup' => t('where %property is %value', $t_args));
187 188 189 190 191 192 193
    }
    if (in_array($type, array('type', 'language'))) {
      // Remove the option if it is already being filtered on.
      unset($filters[$type]);
    }
  }

194 195 196 197 198 199 200 201 202
  $form['filters']['status'] = array(
    '#type' => 'container',
    '#attributes' => array('class' => array('clearfix')),
    '#prefix' => ($i ? '<div class="additional-filters">' . t('and where') . '</div>' : ''),
  );
  $form['filters']['status']['filters'] = array(
    '#type' => 'container',
    '#attributes' => array('class' => array('filters')),
  );
203
  foreach ($filters as $key => $filter) {
204
    $form['filters']['status']['filters'][$key] = array(
205 206 207 208 209
      '#type' => 'select',
      '#options' => $filter['options'],
      '#title' => $filter['title'],
      '#default_value' => '[any]',
    );
210 211
  }

212
  $form['filters']['status']['actions'] = array(
213 214
    '#type' => 'actions',
    '#attributes' => array('class' => array('container-inline')),
215
  );
216 217 218 219
  $form['filters']['status']['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => count($session) ? t('Refine') : t('Filter'),
  );
220
  if (count($session)) {
221 222
    $form['filters']['status']['actions']['undo'] = array('#type' => 'submit', '#value' => t('Undo'));
    $form['filters']['status']['actions']['reset'] = array('#type' => 'submit', '#value' => t('Reset'));
223 224
  }

225
  drupal_add_js('core/misc/form.js');
226

227 228 229 230
  return $form;
}

/**
231 232 233 234 235 236 237 238 239
 * Form submission handler for node_filter_form().
 *
 * @see node_admin_content()
 * @see node_multiple_delete_confirm()
 * @see node_multiple_delete_confirm_submit()
 * @see node_admin_nodes()
 * @see node_admin_nodes_submit()
 * @see node_admin_nodes_validate()
 * @see node_filter_form()
240 241 242 243 244 245
 */
function node_filter_form_submit($form, &$form_state) {
  $filters = node_filters();
  switch ($form_state['values']['op']) {
    case t('Filter'):
    case t('Refine'):
246 247 248
      // Apply every filter that has a choice selected other than 'any'.
      foreach ($filters as $filter => $options) {
        if (isset($form_state['values'][$filter]) && $form_state['values'][$filter] != '[any]') {
249
          $_SESSION['node_overview_filter'][] = array($filter, $form_state['values'][$filter]);
250 251 252 253 254 255 256
        }
      }
      break;
    case t('Undo'):
      array_pop($_SESSION['node_overview_filter']);
      break;
    case t('Reset'):
257
      $_SESSION['node_overview_filter'] = array();
258 259 260 261
      break;
  }
}

262
/**
263
 * Updates all nodes in the passed-in array with the passed-in field values.
264 265
 *
 * IMPORTANT NOTE: This function is intended to work when called
266
 * from a form submission handler. Calling it outside of the form submission
267 268 269 270 271
 * process may not work correctly.
 *
 * @param array $nodes
 *   Array of node nids to update.
 * @param array $updates
272 273 274 275
 *   Array of key/value pairs with node field names and the value to update
 *   that field to.
 *
 * @ingroup batch
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
 */
function node_mass_update($nodes, $updates) {
  // We use batch processing to prevent timeout when updating a large number
  // of nodes.
  if (count($nodes) > 10) {
    $batch = array(
      'operations' => array(
        array('_node_mass_update_batch_process', array($nodes, $updates))
      ),
      'finished' => '_node_mass_update_batch_finished',
      'title' => t('Processing'),
      // We use a single multi-pass operation, so the default
      // 'Remaining x of y operations' message will be confusing here.
      'progress_message' => '',
      'error_message' => t('The update has encountered an error.'),
      // The operations do not live in the .module file, so we need to
      // tell the batch engine which file to load before calling them.
293
      'file' => drupal_get_path('module', 'node') . '/node.admin.inc',
294 295 296 297
    );
    batch_set($batch);
  }
  else {
298
    foreach ($nodes as $nid) {
299 300 301 302 303 304 305
      _node_mass_update_helper($nid, $updates);
    }
    drupal_set_message(t('The update has been performed.'));
  }
}

/**
306 307 308 309 310 311 312 313
 * Updates individual nodes when fewer than 10 are queued.
 *
 * @param $nid
 *   ID of node to update.
 * @param $updates
 *   Associative array of updates.
 *
 * @see node_mass_update()
314 315 316
 */
function _node_mass_update_helper($nid, $updates) {
  $node = node_load($nid, NULL, TRUE);
317 318
  // For efficiency manually save the original node before applying any changes.
  $node->original = clone $node;
319 320 321
  foreach ($updates as $name => $value) {
    $node->$name = $value;
  }
322
  $node->save();
323 324 325 326
  return $node;
}

/**
327
 * Executes a batch operation for node_mass_update().
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343
 */
function _node_mass_update_batch_process($nodes, $updates, &$context) {
  if (!isset($context['sandbox']['progress'])) {
    $context['sandbox']['progress'] = 0;
    $context['sandbox']['max'] = count($nodes);
    $context['sandbox']['nodes'] = $nodes;
  }

  // Process nodes by groups of 5.
  $count = min(5, count($context['sandbox']['nodes']));
  for ($i = 1; $i <= $count; $i++) {
    // For each nid, load the node, reset the values, and save it.
    $nid = array_shift($context['sandbox']['nodes']);
    $node = _node_mass_update_helper($nid, $updates);

    // Store result for post-processing in the finished callback.
344
    $context['results'][] = l($node->title, 'node/' . $node->nid);
345 346 347 348 349 350 351 352 353 354 355 356 357

    // Update our progress information.
    $context['sandbox']['progress']++;
  }

  // Inform the batch engine that we are not finished,
  // and provide an estimation of the completion level we reached.
  if ($context['sandbox']['progress'] != $context['sandbox']['max']) {
    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
  }
}

/**
358
 * Reports the 'finished' status of batch operation for node_mass_update().
359 360 361 362 363 364 365 366
 */
function _node_mass_update_batch_finished($success, $results, $operations) {
  if ($success) {
    drupal_set_message(t('The update has been performed.'));
  }
  else {
    drupal_set_message(t('An error occurred and processing did not complete.'), 'error');
    $message = format_plural(count($results), '1 item successfully processed:', '@count items successfully processed:');
367
    $message .= theme('item_list', array('items' => $results));
368 369 370 371
    drupal_set_message($message);
  }
}

372
/**
373 374 375 376 377 378 379 380 381 382
 * Page callback: Form constructor for the content administration form.
 *
 * @see node_multiple_delete_confirm()
 * @see node_multiple_delete_confirm_submit()
 * @see node_admin_nodes()
 * @see node_admin_nodes_submit()
 * @see node_admin_nodes_validate()
 * @see node_filter_form()
 * @see node_filter_form_submit()
 * @see node_menu()
383
 */
384
function node_admin_content($form, $form_state) {
385
  if (isset($form_state['values']['operation']) && $form_state['values']['operation'] == 'delete') {
386
    return node_multiple_delete_confirm($form, $form_state, array_filter($form_state['values']['nodes']));
387
  }
388
  $form['filter'] = node_filter_form();
389
  $form['#submit'][] = 'node_filter_form_submit';
390
  $form['admin'] = node_admin_nodes();
391 392 393 394

  return $form;
}

395
/**
396 397 398 399 400 401 402 403 404
 * Returns the admin form object to node_admin_content().
 *
 * @see node_multiple_delete_confirm()
 * @see node_multiple_delete_confirm_submit()
 * @see node_admin_nodes_submit()
 * @see node_admin_nodes_validate()
 * @see node_filter_form()
 * @see node_filter_form_submit()
 * @ingroup forms
405
 */
406
function node_admin_nodes() {
407
  $admin_access = user_access('administer nodes');
408

409
  // Build the 'Update options' form.
410 411
  $form['options'] = array(
    '#type' => 'fieldset',
412
    '#title' => t('Update options'),
413
    '#attributes' => array('class' => array('container-inline')),
414
    '#access' => $admin_access,
415 416 417 418 419
  );
  $options = array();
  foreach (module_invoke_all('node_operations') as $operation => $array) {
    $options[$operation] = $array['label'];
  }
420 421
  $form['options']['operation'] = array(
    '#type' => 'select',
422 423
    '#title' => t('Operation'),
    '#title_display' => 'invisible',
424 425 426
    '#options' => $options,
    '#default_value' => 'approve',
  );
427 428 429
  $form['options']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Update'),
430
    '#validate' => array('node_admin_nodes_validate'),
431
    '#submit' => array('node_admin_nodes_submit'),
432 433
  );

434 435
  // Enable language column and filter if multiple languages are enabled.
  $multilingual = language_multilingual();
436 437 438 439

  // Build the sortable table header.
  $header = array(
    'title' => array('data' => t('Title'), 'field' => 'n.title'),
440
    'type' => array('data' => t('Content type'), 'field' => 'n.type'),
441
    'author' => t('Author'),
442 443 444
    'status' => array('data' => t('Status'), 'field' => 'n.status'),
    'changed' => array('data' => t('Updated'), 'field' => 'n.changed', 'sort' => 'desc')
  );
445
  if ($multilingual) {
446
    $header['language_name'] = array('data' => t('Language'), 'field' => 'n.langcode');
447 448 449
  }
  $header['operations'] = array('data' => t('Operations'));

450 451
  $query = db_select('node', 'n')
    ->extend('Drupal\Core\Database\Query\PagerSelectExtender')
452
    ->extend('Drupal\Core\Database\Query\TableSortExtender');
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478
  node_build_filter_query($query);

  if (!user_access('bypass node access')) {
    // If the user is able to view their own unpublished nodes, allow them
    // to see these in addition to published nodes. Check that they actually
    // have some unpublished nodes to view before adding the condition.
    if (user_access('view own unpublished content') && $own_unpublished = db_query('SELECT nid FROM {node} WHERE uid = :uid AND status = :status', array(':uid' => $GLOBALS['user']->uid, ':status' => 0))->fetchCol()) {
      $query->condition(db_or()
        ->condition('n.status', 1)
        ->condition('n.nid', $own_unpublished, 'IN')
      );
    }
    else {
      // If not, restrict the query to published nodes.
      $query->condition('n.status', 1);
    }
  }
  $nids = $query
    ->fields('n',array('nid'))
    ->limit(50)
    ->orderByHeader($header)
    ->execute()
    ->fetchCol();
  $nodes = node_load_multiple($nids);

  // Prepare the list of nodes.
479
  $languages = language_list(LANGUAGE_ALL);
480
  $destination = drupal_get_destination();
481 482
  $options = array();
  foreach ($nodes as $node) {
483
    $l_options = $node->langcode != LANGUAGE_NOT_SPECIFIED && isset($languages[$node->langcode]) ? array('language' => $languages[$node->langcode]) : array();
484
    $options[$node->nid] = array(
485 486 487
      'title' => array(
        'data' => array(
          '#type' => 'link',
488
          '#title' => $node->title,
489 490 491 492 493
          '#href' => 'node/' . $node->nid,
          '#options' => $l_options,
          '#suffix' => ' ' . theme('mark', array('type' => node_mark($node->nid, $node->changed))),
        ),
      ),
494
      'type' => check_plain(node_type_get_name($node)),
495
      'author' => theme('username', array('account' => $node)),
496
      'status' => $node->status ? t('published') : t('not published'),
497 498
      'changed' => format_date($node->changed, 'short'),
    );
499
    if ($multilingual) {
500
      $options[$node->nid]['language_name'] = language_name($node->langcode);
501
    }
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522
    // Build a list of all the accessible operations for the current node.
    $operations = array();
    if (node_access('update', $node)) {
      $operations['edit'] = array(
        'title' => t('edit'),
        'href' => 'node/' . $node->nid . '/edit',
        'query' => $destination,
      );
    }
    if (node_access('delete', $node)) {
      $operations['delete'] = array(
        'title' => t('delete'),
        'href' => 'node/' . $node->nid . '/delete',
        'query' => $destination,
      );
    }
    $options[$node->nid]['operations'] = array();
    if (count($operations) > 1) {
      // Render an unordered list of operations links.
      $options[$node->nid]['operations'] = array(
        'data' => array(
523
          '#theme' => 'links__node_operations',
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550
          '#links' => $operations,
          '#attributes' => array('class' => array('links', 'inline')),
        ),
      );
    }
    elseif (!empty($operations)) {
      // Render the first and only operation as a link.
      $link = reset($operations);
      $options[$node->nid]['operations'] = array(
        'data' => array(
          '#type' => 'link',
          '#title' => $link['title'],
          '#href' => $link['href'],
          '#options' => array('query' => $link['query']),
        ),
      );
    }
  }

  // Only use a tableselect when the current user is able to perform any
  // operations.
  if ($admin_access) {
    $form['nodes'] = array(
      '#type' => 'tableselect',
      '#header' => $header,
      '#options' => $options,
      '#empty' => t('No content available.'),
551
    );
552
  }
553 554 555 556 557 558
  // Otherwise, use a simple table.
  else {
    $form['nodes'] = array(
      '#theme' => 'table',
      '#header' => $header,
      '#rows' => $options,
559
      '#empty' => t('No content available.'),
560 561 562
    );
  }

563
  $form['pager'] = array('#markup' => theme('pager'));
564 565 566
  return $form;
}

567
/**
568
 * Form validation handler for node_admin_nodes().
569
 *
570
 * Checks if any nodes have been selected to perform the chosen
571
 * 'Update option' on.
572 573 574 575 576 577 578
 *
 * @see node_multiple_delete_confirm()
 * @see node_multiple_delete_confirm_submit()
 * @see node_admin_nodes()
 * @see node_admin_nodes_submit()
 * @see node_filter_form()
 * @see node_filter_form_submit()
579 580
 */
function node_admin_nodes_validate($form, &$form_state) {
581 582
  // Error if there are no items to select.
  if (!is_array($form_state['values']['nodes']) || !count(array_filter($form_state['values']['nodes']))) {
583 584 585 586 587
    form_set_error('', t('No items selected.'));
  }
}

/**
588 589 590
 * Form submission handler for node_admin_nodes().
 *
 * Executes the chosen 'Update option' on the selected nodes.
591
 *
592 593 594 595 596 597
 * @see node_multiple_delete_confirm()
 * @see node_multiple_delete_confirm_submit()
 * @see node_admin_nodes()
 * @see node_admin_nodes_validate()
 * @see node_filter_form()
 * @see node_filter_form_submit()
598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613
 */
function node_admin_nodes_submit($form, &$form_state) {
  $operations = module_invoke_all('node_operations');
  $operation = $operations[$form_state['values']['operation']];
  // Filter out unchecked nodes
  $nodes = array_filter($form_state['values']['nodes']);
  if ($function = $operation['callback']) {
    // Add in callback arguments if present.
    if (isset($operation['callback arguments'])) {
      $args = array_merge(array($nodes), $operation['callback arguments']);
    }
    else {
      $args = array($nodes);
    }
    call_user_func_array($function, $args);

614
    cache_invalidate(array('content' => TRUE));
615 616
  }
  else {
617
    // We need to rebuild the form to go to a second step. For example, to
618 619 620 621 622
    // show the confirmation form for the deletion of nodes.
    $form_state['rebuild'] = TRUE;
  }
}

623 624 625 626 627 628 629 630 631 632
/**
 * Multiple node deletion confirmation form for node_admin_content().
 *
 * @see node_multiple_delete_confirm_submit()
 * @see node_admin_nodes()
 * @see node_admin_nodes_submit()
 * @see node_admin_nodes_validate()
 * @see node_filter_form()
 * @see node_filter_form_submit()
 */
633
function node_multiple_delete_confirm($form, &$form_state, $nodes) {
634 635 636
  $form['nodes'] = array('#prefix' => '<ul>', '#suffix' => '</ul>', '#tree' => TRUE);
  // array_filter returns only elements with TRUE values
  foreach ($nodes as $nid => $value) {
637
    $title = db_query('SELECT title FROM {node} WHERE nid = :nid', array(':nid' => $nid))->fetchField();
638 639 640 641
    $form['nodes'][$nid] = array(
      '#type' => 'hidden',
      '#value' => $nid,
      '#prefix' => '<li>',
642
      '#suffix' => check_plain($title) . "</li>\n",
643
    );
644 645 646
  }
  $form['operation'] = array('#type' => 'hidden', '#value' => 'delete');
  $form['#submit'][] = 'node_multiple_delete_confirm_submit';
647 648
  $confirm_question = format_plural(count($nodes),
                                  'Are you sure you want to delete this item?',
649
                                  'Are you sure you want to delete these items?');
650
  return confirm_form($form,
651
                    $confirm_question,
652
                    'admin/content', t('This action cannot be undone.'),
653
                    t('Delete'), t('Cancel'));
654 655
}

656 657 658 659 660 661 662 663 664 665
/**
 * Form submission handler for node_multiple_delete_confirm().
 *
 * @see node_multiple_delete_confirm()
 * @see node_admin_nodes()
 * @see node_admin_nodes_submit()
 * @see node_admin_nodes_validate()
 * @see node_filter_form()
 * @see node_filter_form_submit()
 */
666 667
function node_multiple_delete_confirm_submit($form, &$form_state) {
  if ($form_state['values']['confirm']) {
668 669 670
    node_delete_multiple(array_keys($form_state['values']['nodes']));
    $count = count($form_state['values']['nodes']);
    watchdog('content', 'Deleted @count posts.', array('@count' => $count));
671
    drupal_set_message(format_plural($count, 'Deleted 1 post.', 'Deleted @count posts.'));
672
  }
673
  $form_state['redirect'] = 'admin/content';
674
}