From 6307e6af3b4a717011570e71b844c4b1e366fae5 Mon Sep 17 00:00:00 2001 From: ewinslow Date: Wed, 3 Nov 2010 01:56:29 +0000 Subject: Fixes #2151: Replaced elgg_get_viewtype() implementation with @cash's much simpler version git-svn-id: http://code.elgg.org/elgg/trunk@7214 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/views.php | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'engine/lib') diff --git a/engine/lib/views.php b/engine/lib/views.php index f9ceafd2d..21056db0e 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -96,32 +96,20 @@ function elgg_set_viewtype($viewtype = "") { function elgg_get_viewtype() { global $CURRENT_SYSTEM_VIEWTYPE, $CONFIG; - $viewtype = NULL; - if ($CURRENT_SYSTEM_VIEWTYPE != "") { return $CURRENT_SYSTEM_VIEWTYPE; } - // @todo what is this? Why would you want to save a viewtype to the session? - if ((empty($_SESSION['view'])) || ( (trim($CONFIG->view != "")) - && ($_SESSION['view'] != $CONFIG->view) )) { - - $_SESSION['view'] = "default"; - // If we have a config default view for this site then use that instead of 'default' - if ((!empty($CONFIG->view)) && (trim($CONFIG->view) != "")) { - $_SESSION['view'] = $CONFIG->view; - } - } - - if (empty($viewtype) && is_callable('get_input')) { - $viewtype = get_input('view'); + $viewtype = get_input('view', NULL); + if ($viewtype) { + return $viewtype; } - if (empty($viewtype)) { - $viewtype = $_SESSION['view']; + if (isset($CONFIG->view) && !empty($CONFIG->view)) { + return $CONFIG->view; } - return $viewtype; + return 'default'; } /** -- cgit v1.2.3