| 1 |
<?php |
<?php |
| 2 |
// $Id: node.module,v 1.640 2006/04/23 05:22:05 drumm Exp $ |
// $Id: node.module,v 1.641.2.20 2006/11/14 10:34:08 killes Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 43 |
return t('<p>Enter a simple pattern to search for a post. This can include the wildcard character *.<br />For example, a search for "br*" might return "bread bakers", "our daily bread" and "brenda".</p>'); |
return t('<p>Enter a simple pattern to search for a post. This can include the wildcard character *.<br />For example, a search for "br*" might return "bread bakers", "our daily bread" and "brenda".</p>'); |
| 44 |
} |
} |
| 45 |
|
|
| 46 |
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'revisions') { |
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'revisions' && !arg(3)) { |
| 47 |
return t('The revisions let you track differences between multiple versions of a post.'); |
return t('The revisions let you track differences between multiple versions of a post.'); |
| 48 |
} |
} |
| 49 |
|
|
| 165 |
// parse errors. |
// parse errors. |
| 166 |
if (isset($format)) { |
if (isset($format)) { |
| 167 |
$filters = filter_list_format($format); |
$filters = filter_list_format($format); |
| 168 |
if (isset($filters['filter/1']) && strpos($body, '<?') !== FALSE) { |
if (isset($filters['filter/1']) && (strpos($body, '<?') !== FALSE) && (strpos($body, '<?') < $delimiter)) { |
| 169 |
return $body; |
return $body; |
| 170 |
} |
} |
| 171 |
} |
} |
| 349 |
if (is_numeric($param)) { |
if (is_numeric($param)) { |
| 350 |
$cachable = $revision == NULL; |
$cachable = $revision == NULL; |
| 351 |
if ($cachable && isset($nodes[$param])) { |
if ($cachable && isset($nodes[$param])) { |
| 352 |
return $nodes[$param]; |
return drupal_clone($nodes[$param]); |
| 353 |
} |
} |
| 354 |
$cond = 'n.nid = %d'; |
$cond = 'n.nid = %d'; |
| 355 |
$arguments[] = $param; |
$arguments[] = $param; |
| 364 |
} |
} |
| 365 |
|
|
| 366 |
// Retrieve the node. |
// Retrieve the node. |
| 367 |
|
// No db_rewrite_sql is applied so as to get complete indexing for search. |
| 368 |
if ($revision) { |
if ($revision) { |
| 369 |
array_unshift($arguments, $revision); |
array_unshift($arguments, $revision); |
| 370 |
$node = db_fetch_object(db_query(db_rewrite_sql('SELECT n.nid, r.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = %d WHERE '. $cond), $arguments)); |
$node = db_fetch_object(db_query('SELECT n.nid, r.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = %d WHERE '. $cond, $arguments)); |
| 371 |
} |
} |
| 372 |
else { |
else { |
| 373 |
$node = db_fetch_object(db_query(db_rewrite_sql('SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE '. $cond), $arguments)); |
$node = db_fetch_object(db_query('SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE '. $cond, $arguments)); |
| 374 |
} |
} |
| 375 |
|
|
| 376 |
if ($node->nid) { |
if ($node->nid) { |
| 390 |
} |
} |
| 391 |
|
|
| 392 |
if ($cachable) { |
if ($cachable) { |
| 393 |
$nodes[$param] = $node; |
$nodes[$param] = drupal_clone($node); |
| 394 |
} |
} |
| 395 |
|
|
| 396 |
return $node; |
return $node; |
| 806 |
$links = array(); |
$links = array(); |
| 807 |
|
|
| 808 |
if ($type == 'node') { |
if ($type == 'node') { |
|
if (array_key_exists('links', $node)) { |
|
|
$links = $node->links; |
|
|
} |
|
|
|
|
| 809 |
if ($main == 1 && $node->teaser && $node->readmore) { |
if ($main == 1 && $node->teaser && $node->readmore) { |
| 810 |
$links[] = l(t('read more'), "node/$node->nid", array('title' => t('Read the rest of this posting.'), 'class' => 'read-more')); |
$links[] = l(t('read more'), "node/$node->nid", array('title' => t('Read the rest of this posting.'), 'class' => 'read-more')); |
| 811 |
} |
} |
| 844 |
$items[] = array('path' => 'node', 'title' => t('content'), |
$items[] = array('path' => 'node', 'title' => t('content'), |
| 845 |
'callback' => 'node_page', |
'callback' => 'node_page', |
| 846 |
'access' => user_access('access content'), |
'access' => user_access('access content'), |
| 847 |
'type' => MENU_SUGGESTED_ITEM); |
'type' => MENU_MODIFIABLE_BY_ADMIN); |
| 848 |
$items[] = array('path' => 'node/add', 'title' => t('create content'), |
$items[] = array('path' => 'node/add', 'title' => t('create content'), |
| 849 |
'callback' => 'node_page', |
'callback' => 'node_page', |
| 850 |
'access' => user_access('access content'), |
'access' => user_access('access content'), |
| 881 |
'access' => $revisions_access, |
'access' => $revisions_access, |
| 882 |
'weight' => 2, |
'weight' => 2, |
| 883 |
'type' => MENU_LOCAL_TASK); |
'type' => MENU_LOCAL_TASK); |
| 884 |
|
$items[] = array('path' => 'node/'. arg(1) .'/revisions/' . arg(3) . '/delete', |
| 885 |
|
'title' => t('revisions'), |
| 886 |
|
'callback' => 'node_revisions', |
| 887 |
|
'access' => $revisions_access, |
| 888 |
|
'weight' => 2, |
| 889 |
|
'type' => MENU_CALLBACK); |
| 890 |
|
$items[] = array('path' => 'node/'. arg(1) .'/revisions/' . arg(3) . '/revert', |
| 891 |
|
'title' => t('revisions'), |
| 892 |
|
'callback' => 'node_revisions', |
| 893 |
|
'access' => $revisions_access, |
| 894 |
|
'weight' => 2, |
| 895 |
|
'type' => MENU_CALLBACK); |
| 896 |
} |
} |
| 897 |
} |
} |
| 898 |
else if (arg(0) == 'admin' && arg(1) == 'settings' && arg(2) == 'content-types' && is_string(arg(3))) { |
else if (arg(0) == 'admin' && arg(1) == 'settings' && arg(2) == 'content-types' && is_string(arg(3))) { |
| 916 |
function node_operations() { |
function node_operations() { |
| 917 |
$operations = array( |
$operations = array( |
| 918 |
'approve' => array(t('Approve the selected posts'), 'UPDATE {node} SET status = 1, moderate = 0 WHERE nid = %d'), |
'approve' => array(t('Approve the selected posts'), 'UPDATE {node} SET status = 1, moderate = 0 WHERE nid = %d'), |
| 919 |
'promote' => array(t('Promote the selected posts'), 'UPDATE {node} SET status = 1, promote = 1 WHERE nid = %d'), |
'promote' => array(t('Promote the selected posts'), 'UPDATE {node} SET status = 1, promote = 1, moderate = 0 WHERE nid = %d'), |
| 920 |
'sticky' => array(t('Make the selected posts sticky'), 'UPDATE {node} SET status = 1, sticky = 1 WHERE nid = %d'), |
'sticky' => array(t('Make the selected posts sticky'), 'UPDATE {node} SET status = 1, sticky = 1 WHERE nid = %d'), |
| 921 |
'demote' => array(t('Demote the selected posts'), 'UPDATE {node} SET promote = 0 WHERE nid = %d'), |
'demote' => array(t('Demote the selected posts'), 'UPDATE {node} SET promote = 0 WHERE nid = %d'), |
| 922 |
'unpublish' => array(t('Unpublish the selected posts'), 'UPDATE {node} SET status = 0 WHERE nid = %d'), |
'unpublish' => array(t('Unpublish the selected posts'), 'UPDATE {node} SET status = 0 WHERE nid = %d'), |
| 1103 |
db_query($operation, $nid); |
db_query($operation, $nid); |
| 1104 |
} |
} |
| 1105 |
} |
} |
| 1106 |
|
cache_clear_all(); |
| 1107 |
drupal_set_message(t('The update has been performed.')); |
drupal_set_message(t('The update has been performed.')); |
| 1108 |
} |
} |
| 1109 |
} |
} |
| 1317 |
$node = node_load($nid, $revision); |
$node = node_load($nid, $revision); |
| 1318 |
if ((user_access('revert revisions') || user_access('administer nodes')) && node_access('update', $node)) { |
if ((user_access('revert revisions') || user_access('administer nodes')) && node_access('update', $node)) { |
| 1319 |
if ($node->vid) { |
if ($node->vid) { |
| 1320 |
$node->revision = 1; |
$form = array(); |
| 1321 |
$node->log = t('Copy of the revision from %date.', array('%date' => theme('placeholder', format_date($node->revision_timestamp)))); |
$form['nid'] = array('#type' => 'value', '#value' => $node->nid); |
| 1322 |
$node->taxonomy = array_keys($node->taxonomy); |
$form['vid'] = array('#type' => 'value', '#value' => $node->vid); |
| 1323 |
|
return confirm_form('node_revision_revert_confirm', $form, |
| 1324 |
node_save($node); |
t('Are you sure you want to revert %title to the revision from %revision-date?', array('%title' => theme('placeholder', $node->title), '%revision-date' => theme('placeholder', format_date($node->revision_timestamp)))), |
| 1325 |
|
"node/$nid/revisions", ' ', t('Revert'), t('Cancel')); |
|
drupal_set_message(t('%title has been reverted back to the revision from %revision-date', array('%revision-date' => theme('placeholder', format_date($node->revision_timestamp)), '%title' => theme('placeholder', check_plain($node->title))))); |
|
|
watchdog('content', t('%type: reverted %title revision %revision.', array('%type' => theme('placeholder', t($node->type)), '%title' => theme('placeholder', $node->title), '%revision' => theme('placeholder', $revision)))); |
|
| 1326 |
} |
} |
| 1327 |
else { |
else { |
| 1328 |
drupal_set_message(t('You tried to revert to an invalid revision.'), 'error'); |
drupal_set_message(t('You tried to revert to an invalid revision.'), 'error'); |
| 1332 |
drupal_access_denied(); |
drupal_access_denied(); |
| 1333 |
} |
} |
| 1334 |
|
|
| 1335 |
|
function node_revision_revert_confirm_submit($form_id, $form_values) { |
| 1336 |
|
$nid = $form_values['nid']; |
| 1337 |
|
$revision = $form_values['vid']; |
| 1338 |
|
$node = node_load($nid, $revision); |
| 1339 |
|
$node->revision = 1; |
| 1340 |
|
$node->log = t('Copy of the revision from %date.', array('%date' => theme('placeholder', format_date($node->revision_timestamp)))); |
| 1341 |
|
if (module_exist('taxonomy')) { |
| 1342 |
|
$node->taxonomy = array_keys($node->taxonomy); |
| 1343 |
|
} |
| 1344 |
|
|
| 1345 |
|
node_save($node); |
| 1346 |
|
drupal_set_message(t('%title has been reverted back to the revision from %revision-date', array('%revision-date' => theme('placeholder', format_date($node->revision_timestamp)), '%title' => theme('placeholder', check_plain($node->title))))); |
| 1347 |
|
watchdog('content', t('%type: reverted %title revision %revision.', array('%type' => theme('placeholder', t($node->type)), '%title' => theme('placeholder', $node->title), '%revision' => theme('placeholder', $revision)))); |
| 1348 |
|
return 'node/'. $nid .'/revisions'; |
| 1349 |
|
} |
| 1350 |
|
|
| 1351 |
/** |
/** |
| 1352 |
* Delete the revision with specified revision number. A "delete revision" nodeapi event is invoked when a |
* Delete the revision with specified revision number. A "delete revision" nodeapi event is invoked when a |
| 1353 |
* revision is deleted. |
* revision is deleted. |
| 1359 |
// Don't delete the current revision |
// Don't delete the current revision |
| 1360 |
if ($revision != $node->vid) { |
if ($revision != $node->vid) { |
| 1361 |
$node = node_load($nid, $revision); |
$node = node_load($nid, $revision); |
| 1362 |
|
$form = array(); |
| 1363 |
db_query("DELETE FROM {node_revisions} WHERE nid = %d AND vid = %d", $nid, $revision); |
$form['nid'] = array('#type' => 'value', '#value' => $nid); |
| 1364 |
node_invoke_nodeapi($node, 'delete revision'); |
$form['vid'] = array('#type' => 'value', '#value' => $revision); |
| 1365 |
drupal_set_message(t('Deleted %title revision %revision.', array('%title' => theme('placeholder', $node->title), '%revision' => theme('placeholder', $revision)))); |
return confirm_form('node_revision_delete_confirm', $form, |
| 1366 |
watchdog('content', t('%type: deleted %title revision %revision.', array('%type' => theme('placeholder', t($node->type)), '%title' => theme('placeholder', $node->title), '%revision' => theme('placeholder', $revision)))); |
t('Are you sure you want to delete %title revision %revision?', array('%title' => theme('placeholder', $node->title), '%revision' => theme('placeholder', $revision))), |
| 1367 |
|
"node/$nid/revisions", '', t('Delete'), t('Cancel')); |
| 1368 |
} |
} |
|
|
|
| 1369 |
else { |
else { |
| 1370 |
drupal_set_message(t('Deletion failed. You tried to delete the current revision.')); |
drupal_set_message(t('Deletion failed. You tried to delete the current revision.')); |
| 1371 |
} |
} |
| 1377 |
} |
} |
| 1378 |
} |
} |
| 1379 |
} |
} |
|
|
|
| 1380 |
drupal_access_denied(); |
drupal_access_denied(); |
| 1381 |
} |
} |
| 1382 |
|
|
| 1383 |
|
function node_revision_delete_confirm_submit($form_id, $form_values) { |
| 1384 |
|
$node = node_load($form_values['nid'], $form_values['vid']); |
| 1385 |
|
db_query("DELETE FROM {node_revisions} WHERE nid = %d AND vid = %d", $node->nid, $node->vid); |
| 1386 |
|
node_invoke_nodeapi($node, 'delete revision'); |
| 1387 |
|
drupal_set_message(t('Deleted %title revision %revision.', array('%title' => theme('placeholder', $node->title), '%revision' => theme('placeholder', $node->vid)))); |
| 1388 |
|
watchdog('content', t('%type: deleted %title revision %revision.', array('%type' => theme('placeholder', t($node->type)), '%title' => theme('placeholder', $node->title), '%revision' => theme('placeholder', $node->revision)))); |
| 1389 |
|
|
| 1390 |
|
if (db_result(db_query('SELECT COUNT(vid) FROM {node_revisions} WHERE nid = %d', $node->nid)) > 1) { |
| 1391 |
|
return "node/$node->nid/revisions"; |
| 1392 |
|
} |
| 1393 |
|
return "node/$node->nid"; |
| 1394 |
|
} |
| 1395 |
|
|
| 1396 |
/** |
/** |
| 1397 |
* Return a list of all the existing revision numbers. |
* Return a list of all the existing revision numbers. |
| 1398 |
*/ |
*/ |
| 1440 |
global $base_url, $locale; |
global $base_url, $locale; |
| 1441 |
|
|
| 1442 |
if (!$nodes) { |
if (!$nodes) { |
| 1443 |
$nodes = db_query_range(db_rewrite_sql('SELECT n.nid FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.created DESC'), 0, variable_get('feed_default_items', 10)); |
$nodes = db_query_range(db_rewrite_sql('SELECT n.nid, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.created DESC'), 0, variable_get('feed_default_items', 10)); |
| 1444 |
} |
} |
| 1445 |
|
|
| 1446 |
$item_length = variable_get('feed_item_length', 'teaser'); |
$item_length = variable_get('feed_item_length', 'teaser'); |
| 1507 |
$output .= format_rss_channel($channel['title'], $channel['link'], $channel['description'], $items, $channel['language']); |
$output .= format_rss_channel($channel['title'], $channel['link'], $channel['description'], $items, $channel['language']); |
| 1508 |
$output .= "</rss>\n"; |
$output .= "</rss>\n"; |
| 1509 |
|
|
| 1510 |
drupal_set_header('Content-Type: text/xml; charset=utf-8'); |
drupal_set_header('Content-Type: application/rss+xml; charset=utf-8'); |
| 1511 |
print $output; |
print $output; |
| 1512 |
} |
} |
| 1513 |
|
|
| 1569 |
} |
} |
| 1570 |
|
|
| 1571 |
if (isset($node->nid) && (node_last_changed($node->nid) > $node->changed)) { |
if (isset($node->nid) && (node_last_changed($node->nid) > $node->changed)) { |
| 1572 |
form_set_error('changed', t('This content has been modified by another user; changes cannot be saved.')); |
form_set_error('changed', t('This content has been modified by another user, changes cannot be saved.')); |
| 1573 |
} |
} |
| 1574 |
|
|
| 1575 |
if (user_access('administer nodes')) { |
if (user_access('administer nodes')) { |
| 1633 |
* Basic node information. |
* Basic node information. |
| 1634 |
* These elements are just values so they are not even sent to the client. |
* These elements are just values so they are not even sent to the client. |
| 1635 |
*/ |
*/ |
| 1636 |
foreach (array('nid', 'vid', 'uid', 'created', 'changed', 'type') as $key) { |
foreach (array('nid', 'vid', 'uid', 'created', 'type') as $key) { |
| 1637 |
$form[$key] = array('#type' => 'value', '#value' => $node->$key); |
$form[$key] = array('#type' => 'value', '#value' => $node->$key); |
| 1638 |
} |
} |
| 1639 |
|
|
| 1640 |
|
// Changed must be sent to the client, for later overwrite error checking. |
| 1641 |
|
$form['changed'] = array('#type' => 'hidden', '#default_value' => $node->changed); |
| 1642 |
|
|
| 1643 |
// Get the node-specific bits. |
// Get the node-specific bits. |
| 1644 |
$form = array_merge_recursive($form, node_invoke($node, 'form')); |
$form = array_merge_recursive($form, node_invoke($node, 'form')); |
| 1645 |
if (!isset($form['title']['#weight'])) { |
if (!isset($form['title']['#weight'])) { |
| 1698 |
return $form; |
return $form; |
| 1699 |
} |
} |
| 1700 |
|
|
| 1701 |
function node_form_add_preview($form, $edit) { |
function node_form_add_preview($form) { |
| 1702 |
|
global $form_values; |
| 1703 |
|
|
| 1704 |
$op = isset($_POST['op']) ? $_POST['op'] : ''; |
$op = isset($_POST['op']) ? $_POST['op'] : ''; |
| 1705 |
if ($op == t('Preview')) { |
if ($op == t('Preview')) { |
| 1706 |
drupal_validate_form($form['form_id']['#value'], $form); |
drupal_validate_form($form['form_id']['#value'], $form); |
| 1707 |
if (!form_get_errors()) { |
if (!form_get_errors()) { |
| 1708 |
$form['node_preview'] = array('#value' => node_preview((object)$edit), '#weight' => -100); |
// We pass the global $form_values here to preserve changes made during form validation |
| 1709 |
|
$form['node_preview'] = array('#value' => node_preview((object)$form_values), '#weight' => -100); |
| 1710 |
} |
} |
| 1711 |
} |
} |
| 1712 |
if (variable_get('node_preview', 0) && (form_get_errors() || $op != t('Preview'))) { |
if (variable_get('node_preview', 0) && (form_get_errors() || $op != t('Preview'))) { |
| 1716 |
} |
} |
| 1717 |
|
|
| 1718 |
function theme_node_form($form) { |
function theme_node_form($form) { |
| 1719 |
$output = '<div class="node-form">'; |
$output = "\n<div class=\"node-form\">\n"; |
| 1720 |
if (isset($form['node_preview'])) { |
if (isset($form['node_preview'])) { |
| 1721 |
$output .= form_render($form['node_preview']); |
$output .= form_render($form['node_preview']); |
| 1722 |
} |
} |
| 1723 |
|
|
| 1724 |
$output .= ' <div class="standard">'; |
// Admin form fields and submit buttons must be rendered first, because |
| 1725 |
|
// they need to go to the bottom of the form, and so should not be part of |
| 1726 |
|
// the catch-all call to form_render(). |
| 1727 |
|
$admin = ''; |
| 1728 |
|
if (isset($form['author'])) { |
| 1729 |
|
$admin .= " <div class=\"authored\">\n"; |
| 1730 |
|
$admin .= form_render($form['author']); |
| 1731 |
|
$admin .= " </div>\n"; |
| 1732 |
|
} |
| 1733 |
|
if (isset($form['options'])) { |
| 1734 |
|
$admin .= " <div class=\"options\">\n"; |
| 1735 |
|
$admin .= form_render($form['options']); |
| 1736 |
|
$admin .= " </div>\n"; |
| 1737 |
|
} |
| 1738 |
|
$buttons = form_render($form['preview']); |
| 1739 |
|
$buttons .= form_render($form['submit']); |
| 1740 |
|
$buttons .= isset($form['delete']) ? form_render($form['delete']) : ''; |
| 1741 |
|
|
| 1742 |
|
// Everything else gets rendered here, and is displayed before the admin form |
| 1743 |
|
// field and the submit buttons. |
| 1744 |
|
$output .= " <div class=\"standard\">\n"; |
| 1745 |
$output .= form_render($form); |
$output .= form_render($form); |
| 1746 |
$output .= ' </div>'; |
$output .= " </div>\n"; |
| 1747 |
$output .= ' <div class="admin">'; |
|
| 1748 |
$output .= ' <div class="authored">'; |
if (!empty($admin)) { |
| 1749 |
$output .= form_render($form['author']); |
$output .= " <div class=\"admin\">\n"; |
| 1750 |
$output .= ' </div>'; |
$output .= $admin; |
| 1751 |
$output .= ' <div class="options">'; |
$output .= " </div>\n"; |
| 1752 |
$output .= form_render($form['options']); |
} |
| 1753 |
$output .= ' </div>'; |
$output .= $buttons; |
| 1754 |
$output .= ' </div>'; |
$output .= "</div>\n"; |
| 1755 |
$output .= '</div>'; |
|
| 1756 |
return $output; |
return $output; |
| 1757 |
} |
} |
| 1758 |
|
|
| 1773 |
else { |
else { |
| 1774 |
// If no (valid) node type has been provided, display a node type overview. |
// If no (valid) node type has been provided, display a node type overview. |
| 1775 |
foreach (node_get_types() as $type => $name) { |
foreach (node_get_types() as $type => $name) { |
| 1776 |
if (module_invoke(node_get_base($type), 'access', 'create', $type)) { |
if (node_access('create', $type)) { |
| 1777 |
$out = '<dt>'. l($name, "node/add/$type", array('title' => t('Add a new %s.', array('%s' => $name)))) .'</dt>'; |
$out = '<dt>'. l($name, "node/add/$type", array('title' => t('Add a new %s.', array('%s' => $name)))) .'</dt>'; |
| 1778 |
$out .= '<dd>'. implode("\n", module_invoke_all('help', 'node/add#'. $type)) .'</dd>'; |
$out .= '<dd>'. implode("\n", module_invoke_all('help', 'node/add#'. $type)) .'</dd>'; |
| 1779 |
$item[$name] = $out; |
$item[$name] = $out; |
| 1781 |
} |
} |
| 1782 |
|
|
| 1783 |
if (isset($item)) { |
if (isset($item)) { |
| 1784 |
uasort($item, 'strnatcasecmp'); |
uksort($item, 'strnatcasecmp'); |
| 1785 |
$output = t('Choose the appropriate item from the list:') .'<dl>'. implode('', $item) .'</dl>'; |
$output = t('Choose the appropriate item from the list:') .'<dl>'. implode('', $item) .'</dl>'; |
| 1786 |
} |
} |
| 1787 |
else { |
else { |
| 1872 |
if ($node->nid) { |
if ($node->nid) { |
| 1873 |
// Check whether the current user has the proper access rights to |
// Check whether the current user has the proper access rights to |
| 1874 |
// perform this operation: |
// perform this operation: |
| 1875 |
if (node_access('update', $node)) { |
$original_node = node_load($node->nid); //check access rights using the unmodified node |
| 1876 |
|
if (node_access('update', $original_node)) { |
| 1877 |
node_save($node); |
node_save($node); |
| 1878 |
watchdog('content', t('%type: updated %title.', array('%type' => theme('placeholder', t($node->type)), '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid)); |
watchdog('content', t('%type: updated %title.', array('%type' => theme('placeholder', t($node->type)), '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid)); |
| 1879 |
drupal_set_message(t('The %post was updated.', array ('%post' => node_get_name($node)))); |
drupal_set_message(t('The %post was updated.', array ('%post' => node_get_name($node)))); |
| 1985 |
} |
} |
| 1986 |
break; |
break; |
| 1987 |
case 'revert': |
case 'revert': |
| 1988 |
node_revision_revert(arg(1), arg(3)); |
return node_revision_revert(arg(1), arg(3)); |
| 1989 |
break; |
break; |
| 1990 |
case 'delete': |
case 'delete': |
| 1991 |
node_revision_delete(arg(1), arg(3)); |
return node_revision_delete(arg(1), arg(3)); |
| 1992 |
break; |
break; |
| 1993 |
} |
} |
| 1994 |
} |
} |
| 2014 |
$output .= theme('pager', NULL, variable_get('default_nodes_main', 10)); |
$output .= theme('pager', NULL, variable_get('default_nodes_main', 10)); |
| 2015 |
} |
} |
| 2016 |
else { |
else { |
| 2017 |
$output = t(" |
$output = t(' |
| 2018 |
<p>Welcome to your new <a href=\"%drupal\">Drupal</a>-powered website. This message will guide you through your first steps with Drupal, and will disappear once you have posted your first piece of content.</p> |
<h1 class="title">Welcome to your new Drupal website!</h1> |
| 2019 |
<p>The first thing you will need to do is <a href=\"%register\">create the first account</a>. This account will have full administration rights and will allow you to configure your website. Once logged in, you can visit the <a href=\"%admin\">administration section</a> and <a href=\"%config\">set up your site's configuration</a>.</p> |
<p>Please follow these steps to set up and start using your website:</p> |
| 2020 |
<p>Drupal comes with various modules, each of which contains a specific piece of functionality. You should visit the <a href=\"%modules\">module list</a> and enable those modules which suit your website's needs.</p> |
<ol> |
| 2021 |
<p><a href=\"%themes\">Themes</a> handle the presentation of your website. You can use one of the existing themes, modify them or create your own from scratch.</p> |
<li> |
| 2022 |
<p>We suggest you look around the administration section and explore the various options Drupal offers you. For more information, you can refer to the <a href=\"%handbook\">Drupal handbooks online</a>.</p>", array('%drupal' => 'http://drupal.org/', '%register' => url('user/register'), '%admin' => url('admin'), '%config' => url('admin/settings'), '%modules' => url('admin/modules'), '%themes' => url('admin/themes'), '%handbook' => 'http://drupal.org/handbooks')); |
<strong>Create your administrator account</strong> |
| 2023 |
|
To begin, <a href="%register">create the first account</a>. This account will have full administration rights and will allow you to configure your website. |
| 2024 |
|
</li> |
| 2025 |
|
<li> |
| 2026 |
|
<strong>Configure your website</strong> |
| 2027 |
|
Once logged in, visit the <a href="%admin">administration section</a>, where you can <a href="%config">customize and configure</a> all aspects of your website. |
| 2028 |
|
</li> |
| 2029 |
|
<li> |
| 2030 |
|
<strong>Enable additional functionality</strong> |
| 2031 |
|
Next, visit the <a href="%modules">module list</a> and enable features which suit your specific needs. You can find additional modules in the <a href="%download_modules">Drupal modules download section</a>. |
| 2032 |
|
</li> |
| 2033 |
|
<li> |
| 2034 |
|
<strong>Customize your website design</strong> |
| 2035 |
|
To change the "look and feel" of your website, visit the <a href="%themes">themes section</a>. You may choose from one of the included themes or download additional themes from the <a href="%download_themes">Drupal themes download section</a>. |
| 2036 |
|
</li> |
| 2037 |
|
<li> |
| 2038 |
|
<strong>Start posting content</strong> |
| 2039 |
|
Finally, you can <a href="%content">create content</a> for your website. This message will disappear once you have published your first post. |
| 2040 |
|
</li> |
| 2041 |
|
</ol> |
| 2042 |
|
<p>For more information, please refer to the <a href="%help">Help section</a>, or the <a href="%handbook">online Drupal handbooks</a>. You may also post at the <a href="%forum">Drupal forum</a>, or view the wide range of <a href="%support">other support options</a> available.</p>', |
| 2043 |
|
array('%drupal' => 'http://drupal.org/', '%register' => url('user/register'), '%admin' => url('admin'), '%config' => url('admin/settings'), '%modules' => url('admin/modules'), '%download_modules' => 'http://drupal.org/project/modules', '%themes' => url('admin/themes'), '%download_themes' => 'http://drupal.org/project/themes', '%content' => url('node/add'), '%help' => url('admin/help'), '%handbook' => 'http://drupal.org/handbooks', '%forum' => 'http://drupal.org/forum', '%support' => 'http://drupal.org/support') |
| 2044 |
|
); |
| 2045 |
|
$output = '<div id="first-time">'. $output .'</div>'; |
| 2046 |
} |
} |
| 2047 |
|
|
| 2048 |
return $output; |
return $output; |
| 2135 |
variable_set('node_cron_comments_scale', 1.0 / max(1, db_result(db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}')))); |
variable_set('node_cron_comments_scale', 1.0 / max(1, db_result(db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}')))); |
| 2136 |
variable_set('node_cron_views_scale', 1.0 / max(1, db_result(db_query('SELECT MAX(totalcount) FROM {node_counter}')))); |
variable_set('node_cron_views_scale', 1.0 / max(1, db_result(db_query('SELECT MAX(totalcount) FROM {node_counter}')))); |
| 2137 |
|
|
| 2138 |
$result = db_query_range('SELECT GREATEST(c.last_comment_timestamp, n.changed) as last_change, n.nid FROM {node} n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid WHERE n.status = 1 AND ((GREATEST(n.changed, c.last_comment_timestamp) = %d AND n.nid > %d) OR (n.changed > %d OR c.last_comment_timestamp > %d)) ORDER BY GREATEST(n.changed, c.last_comment_timestamp) ASC, n.nid ASC', $last, $last_nid, $last, $last, $last, 0, $limit); |
$result = db_query_range('SELECT GREATEST(IF(c.last_comment_timestamp IS NULL, 0, c.last_comment_timestamp), n.changed) as last_change, n.nid FROM {node} n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid WHERE n.status = 1 AND ((GREATEST(n.changed, c.last_comment_timestamp) = %d AND n.nid > %d) OR (n.changed > %d OR c.last_comment_timestamp > %d)) ORDER BY GREATEST(n.changed, c.last_comment_timestamp) ASC, n.nid ASC', $last, $last_nid, $last, $last, $last, 0, $limit); |
| 2139 |
|
|
| 2140 |
while ($node = db_fetch_object($result)) { |
while ($node = db_fetch_object($result)) { |
| 2141 |
$last_change = $node->last_change; |
$last_change = $node->last_change; |