Commit a76a1e1f authored by Dries's avatar Dries

- Patch 20910 by chx: centralize print theme page.
parent 79a5700c
......@@ -351,8 +351,7 @@ function menu_execute_active_handler() {
$arguments = array_merge($arguments, explode('/', $arg));
}
call_user_func_array($menu['items'][$mid]['callback'], $arguments);
return MENU_FOUND;
return call_user_func_array($menu['items'][$mid]['callback'], $arguments);
}
/**
......
......@@ -15,14 +15,19 @@
fix_gpc_magic();
$status = menu_execute_active_handler();
switch ($status) {
$return = menu_execute_active_handler();
switch ($return) {
case MENU_NOT_FOUND:
drupal_not_found();
break;
case MENU_ACCESS_DENIED:
drupal_access_denied();
break;
default:
if (!empty($return)) {
print theme('page', $return);
}
break;
}
drupal_page_footer();
......
......@@ -762,7 +762,7 @@ function aggregator_edit() {
$output = aggregator_form_feed(aggregator_get_feed(arg(2)));
}
print theme('page', $output);
return $output;
}
......@@ -792,7 +792,7 @@ function aggregator_admin_edit_category($category = 0) {
$output = aggregator_form_category();
}
}
print theme('page', $output);
return $output;
}
/**
......@@ -822,7 +822,7 @@ function aggregator_admin_edit_feed($feed = 0) {
$output = aggregator_form_feed();
}
}
print theme('page', $output);
return $output;
}
/**
......@@ -845,7 +845,7 @@ function aggregator_admin_refresh_feed($feed) {
* Menu callback; displays the aggregator administration page.
*/
function aggregator_admin_overview() {
print theme('page', aggregator_view());
return aggregator_view();
}
/**
......@@ -946,7 +946,7 @@ function _aggregator_page_list($sql, $op, $header = '') {
$output .= $pager;
}
print theme('page', $output);
return $output;
}
/**
......@@ -971,7 +971,7 @@ function aggregator_page_sources() {
}
$output .= theme('xml_icon', url('aggregator/opml'));
$output .= '</div>';
print theme('page', $output);
return $output;
}
/**
......@@ -1020,7 +1020,7 @@ function aggregator_page_categories() {
}
$output .= '</div>';
print theme('page', $output);
return $output;
}
/**
......
......@@ -762,7 +762,7 @@ function aggregator_edit() {
$output = aggregator_form_feed(aggregator_get_feed(arg(2)));
}
print theme('page', $output);
return $output;
}
......@@ -792,7 +792,7 @@ function aggregator_admin_edit_category($category = 0) {
$output = aggregator_form_category();
}
}
print theme('page', $output);
return $output;
}
/**
......@@ -822,7 +822,7 @@ function aggregator_admin_edit_feed($feed = 0) {
$output = aggregator_form_feed();
}
}
print theme('page', $output);
return $output;
}
/**
......@@ -845,7 +845,7 @@ function aggregator_admin_refresh_feed($feed) {
* Menu callback; displays the aggregator administration page.
*/
function aggregator_admin_overview() {
print theme('page', aggregator_view());
return aggregator_view();
}
/**
......@@ -946,7 +946,7 @@ function _aggregator_page_list($sql, $op, $header = '') {
$output .= $pager;
}
print theme('page', $output);
return $output;
}
/**
......@@ -971,7 +971,7 @@ function aggregator_page_sources() {
}
$output .= theme('xml_icon', url('aggregator/opml'));
$output .= '</div>';
print theme('page', $output);
return $output;
}
/**
......@@ -1020,7 +1020,7 @@ function aggregator_page_categories() {
}
$output .= '</div>';
print theme('page', $output);
return $output;
}
/**
......
......@@ -249,7 +249,7 @@ function archive_page($year = 0, $month = 0, $day = 0) {
$output .= node_view(node_load(array('nid' => $nid->nid)), 1);
}
}
print theme('page', $output);
return $output;
}
?>
......@@ -249,7 +249,7 @@ function archive_page($year = 0, $month = 0, $day = 0) {
$output .= node_view(node_load(array('nid' => $nid->nid)), 1);
}
}
print theme('page', $output);
return $output;
}
?>
......@@ -299,7 +299,7 @@ function block_admin_configure($module = NULL, $delta = 0) {
$form .= form_submit(t('Save block'));
print theme('page', form($form));
return form($form);
}
}
......@@ -323,7 +323,7 @@ function block_box_add() {
$output .= form($form);
}
print theme('page', $output);
return $output;
}
/**
......@@ -348,7 +348,7 @@ function block_box_delete($bid = 0) {
t('Delete'));
}
print theme('page', $output);
return $output;
}
function block_box_form($edit = array()) {
......@@ -390,7 +390,7 @@ function block_admin() {
cache_clear_all();
drupal_goto($_GET['q']);
}
print theme('page', block_admin_display());
return block_admin_display();
}
/**
......
......@@ -299,7 +299,7 @@ function block_admin_configure($module = NULL, $delta = 0) {
$form .= form_submit(t('Save block'));
print theme('page', form($form));
return form($form);
}
}
......@@ -323,7 +323,7 @@ function block_box_add() {
$output .= form($form);
}
print theme('page', $output);
return $output;
}
/**
......@@ -348,7 +348,7 @@ function block_box_delete($bid = 0) {
t('Delete'));
}
print theme('page', $output);
return $output;
}
function block_box_form($edit = array()) {
......@@ -390,7 +390,7 @@ function block_admin() {
cache_clear_all();
drupal_goto($_GET['q']);
}
print theme('page', block_admin_display());
return block_admin_display();
}
/**
......
......@@ -149,7 +149,7 @@ function blog_page_user($uid) {
$output .= theme('xml_icon', url("blog/$account->uid/feed"));
drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS - '. $title .'" href="'. url("blog/$account->uid/feed") .'" />');
print theme('page', $output);
return $output;
}
else {
drupal_not_found();
......@@ -173,7 +173,7 @@ function blog_page_last() {
$output .= theme('xml_icon', url('blog/feed'));
drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS - blogs" href="'. url('blog/feed') .'" />');
print theme('page', $output);
return $output;
}
/**
......
......@@ -149,7 +149,7 @@ function blog_page_user($uid) {
$output .= theme('xml_icon', url("blog/$account->uid/feed"));
drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS - '. $title .'" href="'. url("blog/$account->uid/feed") .'" />');
print theme('page', $output);
return $output;
}
else {
drupal_not_found();
......@@ -173,7 +173,7 @@ function blog_page_last() {
$output .= theme('xml_icon', url('blog/feed'));
drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS - blogs" href="'. url('blog/feed') .'" />');
print theme('page', $output);
return $output;
}
/**
......
......@@ -288,7 +288,7 @@ function book_outline() {
}
drupal_set_title(check_plain($node->title));
print theme('page', form($output));
return form($output);
}
}
}
......@@ -611,7 +611,7 @@ function book_render() {
}
drupal_set_title(t('Books'));
print theme('page', $output);
return $output;
}
/**
......@@ -767,7 +767,7 @@ function book_admin_orphan() {
$output .= theme('table', $header, $rows);
}
print theme('page', $output);
return $output;
}
/**
......@@ -785,7 +785,7 @@ function book_admin($nid = 0) {
$output .= book_admin_view($nid);
break;
}
print theme('page', $output);
return $output;
}
/**
......
......@@ -288,7 +288,7 @@ function book_outline() {
}
drupal_set_title(check_plain($node->title));
print theme('page', form($output));
return form($output);
}
}
}
......@@ -611,7 +611,7 @@ function book_render() {
}
drupal_set_title(t('Books'));
print theme('page', $output);
return $output;
}
/**
......@@ -767,7 +767,7 @@ function book_admin_orphan() {
$output .= theme('table', $header, $rows);
}
print theme('page', $output);
return $output;
}
/**
......@@ -785,7 +785,7 @@ function book_admin($nid = 0) {
$output .= book_admin_view($nid);
break;
}
print theme('page', $output);
return $output;
}
/**
......
......@@ -329,7 +329,7 @@ function comment_configure() {
$output .= form_group(t('Comment moderation settings'), $group);
}
print theme('page', system_settings_form($output));
return system_settings_form($output);
}
/**
......@@ -361,7 +361,7 @@ function comment_edit($cid) {
$comment = drupal_unpack($comment);
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
if (comment_access('edit', $comment)) {
print theme('page', comment_preview(object2array($comment)));
return comment_preview(object2array($comment));
}
else {
drupal_access_denied();
......@@ -380,15 +380,13 @@ function comment_reply($nid, $pid = NULL) {
$edit = $_POST['edit'];
$edit = comment_validate_form($edit);
drupal_set_title(t('Post comment'));
print theme('page', comment_post($edit));
return;
return comment_post($edit);
}
else if ($_POST['op'] == t('Preview comment')) {
$edit = $_POST['edit'];
$edit = comment_validate_form($edit);
drupal_set_title(t('Preview comment'));
print theme('page', comment_preview($edit));
return;
return comment_preview($edit);
}
// or are we merely showing the form?
......@@ -423,7 +421,7 @@ function comment_reply($nid, $pid = NULL) {
}
drupal_set_title(t('Add new comment'));
print theme('page', $output);
return $output;
}
function comment_validate_form($edit) {
......@@ -661,7 +659,7 @@ function comment_post($edit) {
}
}
else {
print theme('page', comment_preview($edit));
return comment_preview($edit);
}
}
else {
......@@ -945,7 +943,7 @@ function comment_admin_edit($cid) {
$form .= form_hidden('nid', $comment->nid);
$form .= form_hidden('cid', $comment->cid);
$form .= form_submit(t('Submit'));
print theme('page', form($form));
return form($form);
}
}
......@@ -989,7 +987,7 @@ function comment_delete($cid) {
drupal_set_message(t('The comment no longer exists.'));
}
print theme('page', $output);
return $output;
}
function comment_save($id, $edit) {
......@@ -1042,7 +1040,7 @@ function comment_admin_overview($type = 'new') {
$rows[] = array(array('data' => t('No comments available.'), 'colspan' => '6'));
}
print theme('page', theme('table', $header, $rows));
return theme('table', $header, $rows);
}
/**
......@@ -1091,7 +1089,7 @@ function comment_matrix_settings() {
$output .= theme('table', $header, $rows);
if ($rows) { $output .= '<br />'. form_submit(t('Submit votes')); }
print theme('page', form($output));
return form($output);
}
/**
......@@ -1121,7 +1119,7 @@ function comment_role_settings() {
$output .= theme('table', $header, $rows);
$output .= '<br />'. form_submit(t('Save scores'));
print theme('page', form($output));
return form($output);
}
/**
......@@ -1176,7 +1174,7 @@ function comment_vote_settings($mid = 0) {
$form .= form_submit(t('Add new vote'));
}
print theme('page', $output . form($form));
return $output . form($form);
}
/**
......@@ -1230,7 +1228,7 @@ function comment_threshold_settings($fid = 0) {
$form .= form_submit(t('Add new threshold'));
}
print theme('page', $output . form($form));
return $output . form($form);
}
/**
......
......@@ -329,7 +329,7 @@ function comment_configure() {
$output .= form_group(t('Comment moderation settings'), $group);
}
print theme('page', system_settings_form($output));
return system_settings_form($output);
}
/**
......@@ -361,7 +361,7 @@ function comment_edit($cid) {
$comment = drupal_unpack($comment);
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
if (comment_access('edit', $comment)) {
print theme('page', comment_preview(object2array($comment)));
return comment_preview(object2array($comment));
}
else {
drupal_access_denied();
......@@ -380,15 +380,13 @@ function comment_reply($nid, $pid = NULL) {
$edit = $_POST['edit'];
$edit = comment_validate_form($edit);
drupal_set_title(t('Post comment'));
print theme('page', comment_post($edit));
return;
return comment_post($edit);
}
else if ($_POST['op'] == t('Preview comment')) {
$edit = $_POST['edit'];
$edit = comment_validate_form($edit);
drupal_set_title(t('Preview comment'));
print theme('page', comment_preview($edit));
return;
return comment_preview($edit);
}
// or are we merely showing the form?
......@@ -423,7 +421,7 @@ function comment_reply($nid, $pid = NULL) {
}
drupal_set_title(t('Add new comment'));
print theme('page', $output);
return $output;
}
function comment_validate_form($edit) {
......@@ -661,7 +659,7 @@ function comment_post($edit) {
}
}
else {
print theme('page', comment_preview($edit));
return comment_preview($edit);
}
}
else {
......@@ -945,7 +943,7 @@ function comment_admin_edit($cid) {
$form .= form_hidden('nid', $comment->nid);
$form .= form_hidden('cid', $comment->cid);
$form .= form_submit(t('Submit'));
print theme('page', form($form));
return form($form);
}
}
......@@ -989,7 +987,7 @@ function comment_delete($cid) {
drupal_set_message(t('The comment no longer exists.'));
}
print theme('page', $output);
return $output;
}
function comment_save($id, $edit) {
......@@ -1042,7 +1040,7 @@ function comment_admin_overview($type = 'new') {
$rows[] = array(array('data' => t('No comments available.'), 'colspan' => '6'));
}
print theme('page', theme('table', $header, $rows));
return theme('table', $header, $rows);
}
/**
......@@ -1091,7 +1089,7 @@ function comment_matrix_settings() {
$output .= theme('table', $header, $rows);
if ($rows) { $output .= '<br />'. form_submit(t('Submit votes')); }
print theme('page', form($output));
return form($output);
}
/**
......@@ -1121,7 +1119,7 @@ function comment_role_settings() {
$output .= theme('table', $header, $rows);
$output .= '<br />'. form_submit(t('Save scores'));
print theme('page', form($output));
return form($output);
}
/**
......@@ -1176,7 +1174,7 @@ function comment_vote_settings($mid = 0) {
$form .= form_submit(t('Add new vote'));
}
print theme('page', $output . form($form));
return $output . form($form);
}
/**
......@@ -1230,7 +1228,7 @@ function comment_threshold_settings($fid = 0) {
$form .= form_submit(t('Add new threshold'));
}
print theme('page', $output . form($form));
return $output . form($form);
}
/**
......
......@@ -153,7 +153,8 @@ function contact_mail_user() {
$output = form($output);
}
print theme('page', $output, $account->name);
drupal_set_title($account->name);
return $output;
}
else {
drupal_not_found();
......@@ -185,17 +186,17 @@ function contact_admin_edit($subject = NULL) {
$form .= form_textarea(t('Auto-reply'), 'reply', $subject->reply, 50, 10, t("Optional auto-reply. Leave empty if you don't want to send the user an auto-reply message."));
$form .= form_submit(t('Submit'));
print theme('page', form($form));
return form($form);
}
function contact_admin_delete($subject) {
if ($_POST['op'] != t('Delete')) {
print theme('page', theme('confirm',
return theme('confirm',
t('Are you sure you want to delete %subject?', array('%subject' => theme('placeholder', $subject))),
'admin/contact/delete/'. $subject,
t('This action cannot be undone.'),
t('Delete'),
t('Cancel')));
t('Cancel'));
}
else {
db_query("DELETE FROM {contact} WHERE subject = '%s'", $subject);
......@@ -211,7 +212,7 @@ function contact_admin() {
$rows[] = array($subject->subject, $subject->recipients, l(t('edit'), 'admin/contact/edit/'. $subject->subject), l(t('delete'), 'admin/contact/delete/'. $subject->subject));
}
$header = array(t('Subject'), t('Recipients'), array('data' => t('Operations'), 'colspan' => 2));
print theme('page', theme('table', $header, $rows));
return theme('table', $header, $rows);
}
function contact_mail_page() {
......@@ -302,7 +303,7 @@ function contact_mail_page() {
}
}
print theme('page', $output);
return $output;
}
?>
......@@ -153,7 +153,8 @@ function contact_mail_user() {
$output = form($output);
}
print theme('page', $output, $account->name);
drupal_set_title($account->name);
return $output;
}
else {
drupal_not_found();
......@@ -185,17 +186,17 @@ function contact_admin_edit($subject = NULL) {
$form .= form_textarea(t('Auto-reply'), 'reply', $subject->reply, 50, 10, t("Optional auto-reply. Leave empty if you don't want to send the user an auto-reply message."));
$form .= form_submit(t('Submit'));