]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2151: Replaced elgg_get_viewtype() implementation with @cash's much simpler...
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 3 Nov 2010 01:56:29 +0000 (01:56 +0000)
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 3 Nov 2010 01:56:29 +0000 (01:56 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7214 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/views.php

index f9ceafd2dd9db3d147e0d8eb941c8159835c97e5..21056db0edec772cb25619fddd476b29fcd02c86 100644 (file)
@@ -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';
 }
 
 /**