book_admin_save
- Versions
- 4.6
book_admin_save($nid, $edit = array())
Code
modules/book.module, line 709
<?php
function book_admin_save($nid, $edit = array()) {
if ($nid) {
$book = node_load(array('nid' => $nid));
foreach ($edit as $nid => $value) {
// Check to see whether the title needs updating:
$title = db_result(db_query('SELECT title FROM {node} WHERE nid = %d', $nid));
if ($title != $value['title']) {
db_query("UPDATE {node} SET title = '%s' WHERE nid = %d", $value['title'], $nid);
}
// Check to see whether the weight needs updating:
$weight = db_result(db_query('SELECT weight FROM {book} WHERE nid = %d', $nid));
if ($weight != $value['weight']) {
db_query('UPDATE {book} SET weight = %d WHERE nid = %d', $value['weight'], $nid);
}
}
$message = t('Updated book %title.', array('%title' => theme('placeholder', $book->title)));
watchdog('content', $message);
return $message;
}
}
?>Login or register to post comments 