From a858ff3e51503cdf4eeef594acb65d2324efdf81 Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 14 Jul 2010 14:59:20 +0000 Subject: Fixes #2195. 3rd and 4th params of page_draw() are now $page_shell and $vars. git-svn-id: http://code.elgg.org/elgg/trunk@6704 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/admin.php | 2 +- engine/lib/elgglib.php | 10 +++++----- engine/lib/views.php | 28 ++++++++++++++-------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/engine/lib/admin.php b/engine/lib/admin.php index ad7896cb7..8426adf8b 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -208,7 +208,7 @@ function admin_settings_page_handler($page) { } $body = elgg_view_layout('administration', $content); - page_draw($title, $body, "", 'page_shells/admin'); + page_draw($title, $body, 'page_shells/admin'); } /** diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index a4e83e40b..f74fbec09 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -2181,16 +2181,16 @@ function elgg_init() { register_shutdown_function('__elgg_shutdown_hook'); } +/** + * Walled garden system:index plugin hook. + */ function elgg_walled_garden_index() { $login = elgg_view('account/forms/login_walled_garden'); - echo elgg_view('page_shells/walled_garden', array( - 'body' => $login, - 'sysmessages' => system_messages(NULL, ''), - )); + page_draw('', $login, 'page_shells/walled_garden'); + // @hack Index must exit to keep plugins from continuing to extend exit; - return TRUE; } /** diff --git a/engine/lib/views.php b/engine/lib/views.php index c1c07024a..32a45bc14 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1013,16 +1013,18 @@ function autoregister_views($view_base, $folder, $base_location_path, $viewtype) } /** - * Returns a representation of a full 'page' (which might be an HTML page, RSS file, etc, depending on the current view) + * Outputs a representation of a full 'page' (which might be an HTML page, RSS file, etc, depending on the current view) * - * @param unknown_type $title - * @param unknown_type $body - * @return unknown + * @param string $title + * @param string $body + * @param string $page_shell Optional page shell to use. + * @param array $vars Optional vars array to pass to the page shell. Automatically adds title, body, and sysmessages + * @return NULL */ -function page_draw($title, $body, $sidebar = "", $page_shell = 'page_shells/default') { - +function page_draw($title, $body, $page_shell = 'page_shells/default', $vars = array()) { // get messages - try for errors first - $sysmessages = system_messages(null, "errors"); + $sysmessages = system_messages(NULL, "errors"); + if (count($sysmessages["errors"]) == 0) { // no errors so grab rest of messages $sysmessages = system_messages(null, ""); @@ -1031,14 +1033,12 @@ function page_draw($title, $body, $sidebar = "", $page_shell = 'page_shells/defa system_messages(null, ""); } + $vars['title'] = $title; + $vars['body'] = $body; + $vars['sysmessages'] = $sysmessages; + // Draw the page - $output = elgg_view($page_shell, array( - 'title' => $title, - 'body' => $body, - 'sidebar' => $sidebar, - 'sysmessages' => $sysmessages, - ) - ); + $output = elgg_view($page_shell, $vars); $split_output = str_split($output, 1024); foreach($split_output as $chunk) { -- cgit v1.2.3